/* ============================================================
   ห้องการบ้าน
   ------------------------------------------------------------
   แถวใต้การ์ดงานต้องอ่านเป็น "หมายเหตุ" ไม่ใช่ "การ์ดใบที่สอง"
   ถ้ามันหนักเท่าการ์ด รายการงานจะกลายเป็นสองเท่าของความยาวเดิมทันที
   จึงไม่มีพื้นหลังทึบ ไม่มีเงา มีแค่เส้นคั่นบาง ๆ กับตัวหนังสือเล็กลงหนึ่งขั้น
   ============================================================ */

.hw {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--muted);
  cursor: pointer;
}
.hw-n { color: var(--ink); font-weight: 600; }

/* จุดเขียวเต้น = มีคนอยู่จริงตอนนี้ · นี่คือของชิ้นเดียวในแถวนี้ที่ควรดึงตา */
.hw-live { display: inline-flex; align-items: center; gap: 5px; color: var(--good); font-weight: 600; }
.hw-live i {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: currentColor; animation: hwPulse 1.9s ease-in-out infinite;
}
@keyframes hwPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.78); } }
@media (prefers-reduced-motion: reduce) { .hw-live i { animation: none; } }

.hw-talk { color: var(--muted); }
.hw-go {
  margin-left: auto; display: inline-flex; align-items: center; gap: 2px;
  color: var(--blue); font-weight: 700; white-space: nowrap;
}
/* lu-chevron ในสไปรท์ชี้ขวาอยู่แล้ว (ปุ่มย้อนกลับเป็นตัวที่หมุนเอา) — ตรงนี้จึงไม่หมุน */
.hw-go svg { width: 14px; height: 14px; }

/* ---------- ใบขออนุญาตครั้งแรก ---------- */
/* ไม่ใช่ป๊อปอัปกลางจอ — ถามตรงจุดที่มันจะเริ่มมีประโยชน์ แล้วกดผ่านได้ในนิ้วเดียว */
.hw-ask { display: block; cursor: default; }
.hw-ask p { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
.hw-fine { display: block; font-size: 11.5px; line-height: 1.6; color: var(--faint); }
.hw-ask-row { display: flex; gap: 8px; margin-top: 10px; }
.hw-ask-row button {
  flex: 1; border-radius: 10px; padding: 8px 0;
  font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.hw-no { border: 1.5px solid var(--line); background: var(--card2); color: var(--muted); }
.hw-yes { border: 0; background: var(--blue); color: var(--on-accent); }
.hw-ask-row button:active { transform: scale(.97); }

/* ============================================================
   จอห้อง — โครงเดียวกับจอแชท: หัวจออยู่บน ช่องพิมพ์ติดก้นจอ เลื่อนเฉพาะตรงกลาง
   ============================================================ */
/* โครงเดียวกับ #scr-chat ทุกบรรทัด: จอนี้กินเต็มความสูงและซ่อนแถบล่าง (chat-mode ใน go())
   ถ้าไม่ซ่อน ช่องพิมพ์จะไปนั่งอยู่หลังแถบล่างสูง 54px แล้วกดไม่โดน */
#scr-hw .scr-body {
  display: flex; flex-direction: column;
  position: absolute; inset: 0;
  padding: 0;
}
#hwBody { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* กันช่องพิมพ์ชนขอบล่างของเครื่องที่มีแถบบ้าน (iPhone) */
.hw-bar { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }

.hw-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--card);
}
.hw-back {
  width: 38px; height: 38px; flex: none; border: 0; border-radius: 12px;
  background: var(--card2); color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.hw-back svg { width: 19px; height: 19px; transform: rotate(180deg); }
.hw-who { min-width: 0; }
.hw-who b { display: block; font-size: 15px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-who i { display: block; font-style: normal; font-size: 11.5px; color: var(--faint); }

/* แถบ "ใครยังไม่เสร็จ" — เหตุผลทั้งหมดที่คนกดเข้ามาอยู่ในแถบนี้ จึงอยู่บนสุดที่เห็นก่อน */
.hw-here {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; font-size: 12.5px; color: var(--muted);
  background: var(--card2); border-bottom: 1px solid var(--line);
}
.hw-faces { display: flex; }
.hw-faces .hw-av { margin-left: -7px; border: 2px solid var(--card2); }
.hw-faces .hw-av:first-child { margin-left: 0; }

.hw-av {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background-size: cover; background-position: center;
  background-color: var(--card); color: var(--muted);
}
.hw-av.ai { background: var(--blue); color: var(--on-accent); }
.hw-av.ai svg { width: 15px; height: 15px; }

.hw-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.hw-msg { display: flex; gap: 8px; align-items: flex-end; }
.hw-msg.me { justify-content: flex-end; }
.hw-bub {
  max-width: 78%; padding: 9px 13px; border-radius: 16px;
  background: var(--card2); color: var(--ink);
  font-size: 14px; line-height: 1.55; word-break: break-word;
}
.hw-msg.me .hw-bub { background: var(--blue); color: var(--on-accent); }
.hw-msg.ai .hw-bub { background: var(--card); border: 1.5px solid var(--blue); }
.hw-nm { display: block; font-size: 11px; font-weight: 700; color: var(--faint); margin-bottom: 2px; }
/* ป้าย AI ต้องอ่านออกทันทีว่าไม่ใช่คน — ถ้าเนียนไปกับเพื่อน แปลว่าเราหลอกเด็ก */
.hw-nm em {
  font-style: normal; margin-left: 5px; padding: 0 5px;
  font-size: 9.5px; letter-spacing: .06em;
  border: 1px solid var(--blue); border-radius: 999px; color: var(--blue);
}

.hw-empty { margin: auto 0; text-align: center; font-size: 13px; line-height: 1.8; color: var(--faint); }
.hw-shut {
  margin: 0; padding: 14px 16px; text-align: center;
  font-size: 12.5px; color: var(--faint);
  border-top: 1px solid var(--line); background: var(--card2);
}

.hw-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px; border-top: 1px solid var(--line); background: var(--card);
}
.hw-bar input {
  flex: 1; min-width: 0;
  background: var(--card2); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 11px 16px; color: var(--ink);
  font-family: inherit; font-size: 14.5px;
}
.hw-bar input:focus { outline: none; border-color: var(--blue); }
.hw-send {
  width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%;
  background: var(--blue); color: var(--on-accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-brand);
}
.hw-send svg { width: 19px; height: 19px; }
.hw-send:active { transform: scale(.94); }

/* แถวชวนเชื่อมห้องเรียน — หน้าตาเดียวกับแถวปกติ ต่างกันตรงที่มันเป็นคำชวน ไม่ใช่ตัวเลข
   จงใจไม่ทำให้เด่นกว่า — มันคือคำเชิญที่อยู่ใต้งาน ไม่ใช่การแจ้งเตือนเรื่องงาน */
.hw.hw-link .hw-n { color: var(--muted); font-weight: 500; }

/* ============================================================
   1B40 — บล็อก "กำลังทำอยู่ตอนนี้" บนหน้าแรก
   ============================================================
   ก้อนอ่านอย่างเดียว ไม่ใช่การ์ดสีเน้น — จอ "วันนี้" มีของสีเน้นได้ชิ้นเดียว
   คือการ์ดคำสั่ง (กฎ 60/30/10 ท้าย alt.css) ก้อนนี้จึงเป็นพื้นการ์ดธรรมดา
   สีเขียวอยู่ที่จุดสถานะจุดเดียว ซึ่งเป็นสีของ "มีชีวิตอยู่ตอนนี้" ไม่ใช่สีของแบรนด์ */
.hw-now {
  display: flex; align-items: center; gap: 11px; width: 100%;
  margin-top: 14px; padding: 12px 14px;
  background: var(--card); border: none; border-radius: 18px;
  box-shadow: var(--shadow);
  font-family: inherit; text-align: left; color: var(--ink);
}
.hw-now.tap { cursor: pointer; transition: transform .14s ease; }
.hw-now.tap:active { transform: scale(.985); }

/* จุดสด — วงกระเพื่อมรอบจุดบอกว่านี่คือค่าที่เปลี่ยนเองได้ ไม่ใช่เลขที่ค้างมาจากเมื่อวาน */
.hn-live { flex: none; position: relative; width: 10px; height: 10px; }
.hn-live i {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--good); box-shadow: 0 0 0 0 var(--good);
  animation: hn-pulse 2.4s ease-out infinite;
}
@keyframes hn-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .hn-live i { animation: none; } }

.hn-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hn-tx b { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.hn-tx span {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hn-go {
  flex: none; display: inline-flex; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 600; color: var(--blue);
}
.hn-go svg { width: 14px; height: 14px; }
