/* ====== Trang giáo viên ====== */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1d2742;
  --muted: #6b7590;
  --line: #e7e2d8;
  --accent: #ff6a3d;
  --accent-ink: #ffffff;
  --green: #1f9e5a;
  --blue: #3d7bff;
  --pink: #ff4081;
  --amber: #e7a300;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(29, 39, 66, 0.06), 0 6px 20px rgba(29, 39, 66, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { border-color: #cfc8ba; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #f25a2c; }
.btn.accent { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(29, 39, 66, 0.06); }
.btn.danger { color: #c62f2f; }
.btn.danger:hover { background: #fdecec; border-color: #f3c2c2; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- đăng nhập ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 20% 20%, #ffe6c9 0, transparent 40%), radial-gradient(circle at 80% 80%, #d8ecff 0, transparent 45%), var(--bg);
}
.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border-radius: 24px;
  padding: 36px 30px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.login-logo { font-size: 56px; }
.login-card h1 { margin: 0; font-family: 'Baloo 2', sans-serif; font-size: 34px; line-height: 1.1; }
.login-card p { margin: 0 0 8px; color: var(--muted); }
.login-card input { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); font-size: 16px; }
.login-err { color: #c62f2f; min-height: 20px; font-size: 14px; }

/* ---------- thanh trên ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: rgba(246, 244, 239, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { font-size: 30px; }
.brand b { display: block; font-family: 'Baloo 2', sans-serif; font-size: 22px; line-height: 1; }
.brand small { color: var(--muted); font-size: 12.5px; }
.top-stats { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; justify-content: center; }
.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
}
.stat b { font-size: 15px; }
.top-actions { display: flex; gap: 8px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 24px 4px;
}
.seg {
  display: inline-flex;
  background: #ebe7de;
  border-radius: 12px;
  padding: 3px;
}
.seg button {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.search {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  min-width: 200px;
}
.toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.class-msg { display: flex; gap: 6px; }
.class-msg input { padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; width: 190px; }

/* ---------- lưới học sinh ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
  padding: 16px 24px 40px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.card.is-online { border-color: rgba(31, 158, 90, 0.35); }
.card.is-done { border-color: rgba(231, 163, 0, 0.5); }
.mirror {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 10;
  background: #dfe9f3;
  overflow: hidden;
}
.card .mirror { cursor: zoom-in; }
.mirror .kg-stage { border-radius: 0; }
.kg-stage:not(.kg-control) .kg-root { pointer-events: none; }
.mirror-veil {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 39, 66, 0.45);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  padding: 10px;
  pointer-events: none;
}
.mirror-veil.light { background: rgba(246, 244, 239, 0.72); color: var(--ink); }
.mirror-veil span { background: rgba(29, 39, 66, 0.82); color: #fff; padding: 6px 14px; border-radius: 999px; }
.mirror-veil.light span { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; }
.card-top { display: flex; align-items: center; gap: 8px; }
.card-top .name { font-size: 16.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code {
  margin-left: auto;
  font: 600 12px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--muted);
  background: #f2efe8;
  padding: 2px 7px;
  border-radius: 6px;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #b7bccb; }
.status.online { color: var(--green); }
.status.online::before { background: var(--green); box-shadow: 0 0 0 3px rgba(31, 158, 90, 0.18); }
.status.paused { color: var(--amber); }
.status.paused::before { background: var(--amber); }
.status.done { color: #b07c00; }
.status.done::before { background: var(--amber); }
.status.left::before { background: #d0a7a7; }
.game-line { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; min-width: 0; }
.game-line span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 7px; background: #efebe3; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffb340, var(--accent)); border-radius: 99px; transition: width 0.4s; }
.card.is-done .bar i { background: linear-gradient(90deg, #4fd18b, var(--green)); }
.sum { font-size: 14px; font-weight: 600; min-height: 20px; }
.card-actions { display: flex; gap: 6px; margin-top: 2px; }
.card-actions .btn { flex: 1; }

.empty { text-align: center; padding: 60px 20px; max-width: 520px; margin: 0 auto; }
.empty-art { font-size: 54px; letter-spacing: 8px; }
.empty h2 { font-family: 'Baloo 2', sans-serif; font-size: 30px; margin: 10px 0 6px; }
.empty p { color: var(--muted); margin: 0 0 22px; }

/* ---------- màn hình xem lớn ---------- */
.focus {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #141b2e;
  display: grid;
  grid-template-columns: 1fr 360px;
  color: #fff;
}
.focus-main { display: flex; flex-direction: column; min-width: 0; padding: 14px 18px 12px; gap: 12px; }
.focus-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.focus-head .game-line { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.focus-head h2, .focus-head .status { flex: none; }
.focus-head .back { background: rgba(255, 255, 255, 0.1); border: 0; color: #fff; }
.focus-head .back:hover { background: rgba(255, 255, 255, 0.18); }
.focus-head h2 { margin: 0; font-size: 20px; }
.focus-head .status { color: #aab3c9; }
.focus-head .status.online { color: #5fe39b; }
.focus-head .game-line { color: #aab3c9; }
.modes {
  margin-left: auto;
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 3px;
}
.modes button {
  border: 0;
  background: transparent;
  color: #c9d1e4;
  padding: 7px 14px;
  border-radius: 9px;
  font-weight: 600;
  cursor: pointer;
}
.modes button.on { background: #fff; color: var(--ink); }
.modes button[data-m='control'].on { background: var(--pink); color: #fff; }
.focus-mirror { position: relative; flex: 1; min-height: 0; isolation: isolate; }
.focus-mirror .kg-stage { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.focus-mirror.mode-point .kg-stage { cursor: crosshair; }
.focus-mirror.mode-control .kg-stage { box-shadow: 0 0 0 4px var(--pink), 0 20px 60px rgba(0, 0, 0, 0.45); }
.focus-hint { text-align: center; color: #9aa4bd; font-size: 13.5px; min-height: 20px; }
.focus-side {
  background: var(--bg);
  color: var(--ink);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel {
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
.row .btn { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #faf8f4;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13.5px;
  cursor: pointer;
}
.chip:hover { background: #fff1ea; border-color: #ffc6b2; }
.msg-form { display: flex; gap: 6px; }
.msg-form input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field select, .field input, .field textarea {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.link-box { display: flex; gap: 6px; }
.link-box input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; font: 13px ui-monospace, Consolas, monospace; background: #faf8f4; }
.log { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; font-size: 13.5px; }
.log li { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed #eee8dc; }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; font-size: 12.5px; padding-top: 1px; }
.log li.teacher span { color: #c2185b; }
.log li.system span { color: var(--muted); font-style: italic; }

/* ---------- hộp thoại tạo phiên ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(20, 27, 46, 0.5);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-card {
  width: min(860px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg);
  border-radius: 22px;
  padding: 22px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}
.modal-card h2 { margin: 0 0 4px; font-family: 'Baloo 2', sans-serif; font-size: 28px; }
.modal-card .lead { margin: 0 0 16px; color: var(--muted); }
.step { margin-bottom: 18px; }
.step-title { font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.step-title i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-size: 13px; }
.ages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.age {
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  display: flex;
  gap: 10px;
  align-items: center;
}
.age .ic { font-size: 30px; }
.age b { display: block; }
.age small { color: var(--muted); }
.age.on { border-color: var(--accent); background: #fff6f2; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.game-card {
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.game-card .ic {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 26px;
  margin-bottom: 4px;
}
.game-card b { font-size: 16px; }
.game-card small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.game-card.on { border-color: var(--accent); background: #fff6f2; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.result-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 16px; }
.result-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 8px;
  align-items: center;
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 10px;
}
.result-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-row input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: 13px ui-monospace, Consolas, monospace; background: #faf8f4; min-width: 0; }

/* ---------- thông báo ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.3s;
  max-width: 360px;
}
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

@media (max-width: 900px) {
  .focus { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow-y: auto; }
  .focus-main { min-height: 62vh; }
  .focus-head { flex-wrap: wrap; }
  .top { flex-wrap: wrap; padding: 12px 16px; }
  .top-stats { order: 3; justify-content: flex-start; flex-basis: 100%; }
  .toolbar, .grid { padding-left: 16px; padding-right: 16px; }
  .toolbar-right { margin-left: 0; }
  .ages { grid-template-columns: 1fr; }
  .result-row { grid-template-columns: 1fr; }
}

/* ---------- thanh chuyển trang ---------- */
.tabs { display: inline-flex; background: #ebe7de; border-radius: 12px; padding: 3px; }
.tabs button {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 7px 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.field-hint { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.field-hint a { color: var(--accent); font-weight: 600; text-decoration: none; }
.opts-hint { grid-column: 1 / -1; }
.focus-side .opts-hint { display: block; margin: -2px 0 8px; }

/* ---------- kho nội dung ---------- */
.cv {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 18px 24px 40px;
  align-items: start;
}
.cv-list {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.cv-new { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cv-new .btn { padding: 9px 8px; font-size: 14px; }
.cv-list h4 { margin: 16px 4px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cv-empty { color: var(--muted); font-size: 13.5px; margin: 4px; }
.cv-item {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 7px 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}
.cv-item:hover { background: #f6f3ec; }
.cv-item.on { background: #fff1ea; box-shadow: inset 0 0 0 2px #ffc6b2; }
.cv-thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f2efe8;
  display: grid;
  place-items: center;
  font-size: 24px;
  overflow: hidden;
  flex: none;
}
.cv-thumb .kg-img { width: 100%; height: 100%; object-fit: cover; }
.cv-meta { min-width: 0; display: flex; flex-direction: column; }
.cv-meta b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-meta small { color: var(--muted); font-size: 12.5px; }
.cv-editor {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  min-height: 60vh;
}
.cv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.cv-head h2 { margin: 0; font-family: 'Baloo 2', sans-serif; font-size: 26px; line-height: 1.15; }
.cv-sub { margin: 4px 0 0; color: var(--muted); max-width: 640px; }
.cv-head-actions { display: flex; gap: 8px; align-items: center; }
.cv-status { color: var(--muted); font-size: 13px; margin-right: 4px; }
.cv-meta-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.cv-games { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.cv-game {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px;
  cursor: pointer;
  background: #faf8f4;
}
.cv-game:has(input:checked) { background: #fff1ea; border-color: #ffc6b2; }
.cv-items { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 14px; position: relative; }
.cv-items.dragover { outline: 3px dashed var(--accent); outline-offset: 6px; border-radius: 10px; }
.cv-items-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cv-count { color: var(--muted); font-size: 13.5px; }
.cv-tools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.cv-drop { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.cv-quick { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin-bottom: 10px; }
.cv-quick textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.cv-rows { display: flex; flex-direction: column; gap: 6px; }
.cv-row { display: flex; align-items: center; gap: 8px; }
.cv-num { width: 24px; text-align: right; color: var(--muted); font-size: 12.5px; flex: none; }
.cv-word { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }
.pic-cell { display: flex; align-items: center; gap: 6px; position: relative; flex: none; }
.pic-thumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #faf8f4;
  display: grid;
  place-items: center;
  font-size: 32px;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  line-height: 1;
}
.pic-thumb.empty { font-size: 20px; opacity: 0.6; border-style: dashed; }
.pic-thumb.loading { opacity: 0.4; }
.pic-thumb .kg-img { width: 100%; height: 100%; object-fit: cover; }
.pic-thumb .kg-emo { font-size: 30px; }
.pic-clear {
  position: absolute;
  left: 42px;
  top: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
.pic-emoji { width: 72px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 10px; text-align: center; font-size: 18px; }
.cv-qs { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.cv-q { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #fcfbf8; }
.cv-q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cv-q-body { display: flex; gap: 12px; align-items: flex-start; }
.cv-q-body .pic-cell { flex-direction: column; align-items: flex-start; }
.cv-q-body .pic-clear { left: 42px; }
.cv-q-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cv-qtext { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; font-weight: 600; }
.cv-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-items: center; }
.cv-ans { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 3px 4px 3px 6px; background: #fff; }
.cv-ans.ok { border-color: #8fd8ae; background: #effbf3; }
.cv-ans input:not([type]) { flex: 1; min-width: 0; border: 0; padding: 6px; background: transparent; font-size: 15px; outline: none; }
.cv-radio { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--muted); cursor: pointer; font-size: 13px; }
.cv-ans-img { flex: 1; height: 44px; display: flex; align-items: center; }
.cv-ans-img .kg-img { height: 44px; width: 44px; object-fit: cover; border-radius: 8px; }
.cv-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; flex-wrap: wrap; }
.cv-welcome { text-align: center; padding: 50px 20px; max-width: 620px; margin: 0 auto; }
.cv-welcome h2 { font-family: 'Baloo 2', sans-serif; font-size: 30px; margin: 8px 0 6px; }
.cv-welcome p { color: var(--muted); margin: 0 0 20px; }
.cv-welcome .row { justify-content: center; }
.cv-welcome .row .btn { flex: none; }
.cv-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: #faf8f4; font-size: 14px; }
.cv-chip.big { font-size: 15px; font-weight: 600; padding: 5px 12px; }
.cv-chip.ok { background: #effbf3; border-color: #8fd8ae; }
.cv-inline.kg-img { width: 26px; height: 26px; object-fit: cover; border-radius: 6px; display: inline-block; vertical-align: middle; }
.cv-inline.kg-emo { font-size: 20px; }
.cv-qlist { padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.cv-anslist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

@media (max-width: 900px) {
  .cv { grid-template-columns: 1fr; padding: 12px 16px 30px; }
  .cv-list { position: static; max-height: 320px; }
  .cv-meta-grid { grid-template-columns: 1fr; }
  .cv-answers { grid-template-columns: 1fr; }
  .tabs { order: 2; }
}

.cv-row .pic-cell { width: 132px; }

/* ---------- bảng điều khiển riêng của trò chơi ---------- */
.panel.tp { box-shadow: 0 0 0 2px #ffcfb5, var(--shadow); }
.tp-label { font-weight: 700; font-size: 13.5px; margin: 4px 0 6px; }
.tp-label small { font-weight: 400; color: var(--muted); }
.tp-ask { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tp-animal {
  border: 1px solid var(--line);
  background: #faf8f4;
  border-radius: 12px;
  padding: 4px 2px 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.tp-animal:hover { border-color: #ffb08a; background: #fff6f2; }
.tp-animal.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tp-thumb { width: 48px; height: 40px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; font-size: 26px; background: #eee; }
.tp-thumb .kg-img { width: 100%; height: 100%; object-fit: cover; }
.tp-name { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tp-row { margin: 8px 0 12px; }
.tp-row .btn { flex: none; }
.tp-pos { display: grid; gap: 5px; background: #eef3f8; padding: 6px; border-radius: 12px; }
.tp-cell {
  aspect-ratio: 1.15;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  cursor: grab;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
}
.tp-cell .kg-img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.tp-cell .kg-emo { font-size: 28px; }
.tp-cell.sel { border-color: #ffb703; box-shadow: 0 0 0 3px #ffe08a; transform: scale(1.05); }
.tp-cell.over { border-color: var(--blue); }
.tp-cell.target { border-color: var(--accent); }
.tp-info { font-size: 13px; color: var(--muted); }
.tp-info.warn { color: #b45309; }

/* =====================================================================
   Giao diện gọn cho giáo viên (bản đơn giản)
   ===================================================================== */
body { font-size: 15.5px; }
.top { gap: 14px; }
.brand b { font-size: 24px; }
.top .tabs { margin-right: auto; }
.btn.primary-soft { background: #fff1ea; border-color: #ffd2bf; color: #c2410c; }
.btn.primary-soft:hover { background: #ffe5d8; }
.btn.danger-fill { background: #d93636; border-color: #d93636; color: #fff; }
.btn.danger-fill:hover { background: #c22a2a; }
.btn:disabled { opacity: 0.45; cursor: default; }
.icon-btn {
  border: 0;
  background: transparent;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  flex: none;
}
.icon-btn:hover { background: rgba(29, 39, 66, 0.07); color: var(--ink); }

/* thanh trên lưới */
.toolbar { padding: 18px 24px 2px; }
.summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 15px; }
.summary b { font-size: 18px; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.st::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #b7bccb; }
.st.online { color: var(--green); }
.st.online::before { background: var(--green); }
.st.paused { color: var(--amber); }
.st.paused::before, .st.done::before { background: var(--amber); }
.st.done { color: #a16f00; }
.st.left::before { background: #d0a7a7; }
.st.wait::before { background: #c4c8d4; }
.selectbar {
  margin: 12px 24px 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fff3c4;
  border: 1px solid #f1d77a;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.selectbar span { margin-right: auto; font-weight: 600; }

/* thẻ của bé */
.card-body { gap: 6px; }
.card-top { gap: 8px; }
.card-top .name { font-size: 18px; flex: 1; min-width: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #c4c8d4; flex: none; }
.dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(31, 158, 90, 0.18); }
.dot.paused, .dot.done { background: var(--amber); }
.dot.left { background: #d0a7a7; }
.card .game-line { justify-content: space-between; gap: 10px; color: var(--ink); font-weight: 500; }
.card .game-line .st { font-size: 12.5px; }
.card .sum { font-size: 13.5px; font-weight: 500; color: var(--muted); min-height: 18px; }
.pick {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 80;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: rgba(29, 39, 66, 0.35);
  color: transparent;
  font-weight: 800;
  display: none;
  place-items: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
body.selecting .pick { display: grid; }
body.selecting .card { cursor: pointer; }
body.selecting .card .card-actions, body.selecting .card .icon-btn { visibility: hidden; }
.card.is-selected { border-color: #d93636; box-shadow: 0 0 0 3px rgba(217, 54, 54, 0.25), var(--shadow); }
.card.is-selected .pick { background: #d93636; color: #fff; }

/* menu bật lên */
.popmenu {
  position: fixed;
  z-index: 120;
  min-width: 240px;
  background: #fff;
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 12px 40px rgba(20, 27, 46, 0.22), 0 0 0 1px rgba(20, 27, 46, 0.06);
}
.popmenu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
}
.popmenu button:hover { background: #f4f1ea; }
.popmenu button.danger { color: #c62f2f; }
.popmenu button.danger:hover { background: #fdecec; }
.popmenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

/* hộp thoại xác nhận */
.dialog { position: fixed; inset: 0; z-index: 150; background: rgba(20, 27, 46, 0.45); display: grid; place-items: center; padding: 16px; }
.dialog-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 24px 22px 18px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  animation: toast-in 0.2s;
}
.dialog-icon { font-size: 40px; margin-bottom: 4px; }
.dialog-card h3 { margin: 0 0 6px; font-size: 19px; }
.dialog-card p { margin: 0 0 14px; color: var(--muted); }
.dialog-input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; margin-bottom: 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: center; }
.dialog-actions .btn { min-width: 110px; padding: 10px 16px; }

/* màn xem lớn */
.focus { grid-template-columns: 1fr 340px; }
.focus-head h2 { font-size: 22px; }
.focus-head .st { color: #aab3c9; }
.focus-head .st.online { color: #5fe39b; }
.modes button { padding: 8px 14px; font-size: 14.5px; }
.focus-hint { font-size: 14px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qbtn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 12px 6px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.qbtn:hover { border-color: #ffb08a; background: #fff6f2; }
.fold { padding: 0; }
.fold > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: '▸'; color: var(--muted); transition: transform 0.15s; }
.fold[open] > summary::after { transform: rotate(90deg); }
.fold > :not(summary) { padding: 0 14px 14px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .btn { width: 100%; }
.chips .chip { font-size: 14.5px; padding: 6px 12px; }

/* hộp giao trò chơi */
.modal-card { width: min(900px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h2 { margin: 0; }
.step-title { flex-wrap: wrap; }
.ages-seg { margin-left: auto; }
.ages-seg button { font-size: 13px; padding: 5px 10px; }
.games { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.game-card small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ages-tag { margin-top: auto; padding-top: 4px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.opts-fold { margin: 0 0 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.opts-fold > summary { cursor: pointer; padding: 12px 14px; font-weight: 600; color: var(--muted); }
.opts-fold .opts { padding: 0 14px 14px; }
.modal-actions .btn.big { padding: 12px 26px; }

@media (max-width: 900px) {
  .top .tabs { margin-right: 0; order: 3; width: 100%; }
  .top .tabs button { flex: 1; }
  .ages-seg { margin-left: 0; }
  .focus { grid-template-columns: 1fr; }
}

.modal-card > .modal-actions:last-child { position: sticky; bottom: -22px; background: var(--bg); padding: 12px 0 4px; margin-bottom: -4px; }

/* =====================================================================
   Tài khoản
   ===================================================================== */
.user-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); max-width: 260px; }
.user-chip #userName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: #fff3c4; color: #8a5a00; border: 1px solid #f1d77a; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.notice {
  margin: 14px 24px 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fff3c4;
  border: 1px solid #f1d77a;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 500;
}
.notice .btn { margin-left: auto; }
.dialog-card .dialog-input { margin-bottom: 8px; }
.dialog-card .login-err { margin: -2px 0 10px; }

.acc { padding: 18px 24px 40px; max-width: 1200px; margin: 0 auto; }
.acc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.acc-head h2 { margin: 0; font-family: 'Baloo 2', sans-serif; font-size: 28px; }
.acc-head .row .btn { flex: none; }
.muted { color: var(--muted); }
.acc-head p { margin: 2px 0 0; }
.acc-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0 12px; }
.acc-tools .search { margin-left: auto; min-width: 240px; }
.acc-list { display: flex; flex-direction: column; gap: 8px; }
.empty-line { padding: 30px; text-align: center; background: var(--surface); border-radius: var(--radius); }
.acc-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(150px, 1.2fr) minmax(150px, 1.3fr) auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  border-left: 5px solid #c4c8d4;
}
.acc-row.ok { border-left-color: var(--green); }
.acc-row.soon { border-left-color: var(--amber); }
.acc-row.expired { border-left-color: #d93636; }
.acc-row.locked { border-left-color: #6b7590; }
.acc-row.admin { border-left-color: #7b61ff; }
.acc-who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.acc-who > div:last-child { display: flex; flex-direction: column; min-width: 0; }
.acc-who b { font-size: 16px; }
.acc-who small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff1ea; color: #c2410c; display: grid; place-items: center; font-weight: 800; flex: none; }
.acc-row.admin .avatar { background: #efeaff; color: #5b3fd6; }
.acc-plan, .acc-use { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.acc-plan small, .acc-use small { color: var(--muted); }
.pill-st { align-self: flex-start; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; background: #eef0f4; color: #4a5470; }
.pill-st.ok { background: #e3f7ec; color: #17784a; }
.pill-st.soon { background: #fff3c4; color: #8a5a00; }
.pill-st.expired { background: #fde4e4; color: #b42323; }
.pill-st.locked { background: #e6e8ee; color: #3b4459; }
.pill-st.admin { background: #efeaff; color: #5b3fd6; }
.acc-act { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }

.modal-card.small { width: min(620px, 100%); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.form-grid .login-err { grid-column: 1 / -1; }
.field input, .field select { width: 100%; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline input { flex: 1; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.cred { background: #fff; border: 1px dashed #cfc8ba; border-radius: 12px; padding: 12px 14px; font: 15px/1.6 ui-monospace, Consolas, monospace; white-space: pre-wrap; user-select: all; }
.plan-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.plan-opt { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 10px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.plan-opt small { color: var(--muted); }
.plan-opt .price { font-weight: 700; color: #c2410c; font-size: 13.5px; }
.plan-opt.on { border-color: var(--accent); background: #fff6f2; }
.renew-preview { margin: 10px 0; padding: 10px 12px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.renew-preview .new { color: var(--green); }
.hist { max-height: 200px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.hist-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 4px 10px; padding: 5px 0; border-bottom: 1px dashed #eee8dc; font-size: 13.5px; }
.hist-row .muted { grid-column: 2 / -1; font-size: 12.5px; }
.hist-row:last-child { border-bottom: 0; }
.plans-edit { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.plan-row { display: grid; grid-template-columns: 2fr 1.3fr 1fr 34px; gap: 6px; align-items: center; }
.plan-row.head { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.plan-row input, .plan-row select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; width: 100%; }
.login-card input[type='text'] { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); font-size: 16px; }

@media (max-width: 900px) {
  .acc { padding: 12px 16px 30px; }
  .acc-row { grid-template-columns: 1fr auto; }
  .acc-plan, .acc-use { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .acc-act { grid-column: 2; grid-row: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .acc-tools .search { margin-left: 0; width: 100%; }
}

.plan-row .inline input { flex: none; width: 72px; }
.plan-row .inline select { flex: 1; }

/* Chọn con vật – hỏi nhiều con */
.tp-per { display: inline-flex; background: #eef3f8; border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 10px; }
.tp-seg { border: 0; background: transparent; border-radius: 999px; padding: 6px 16px; font-weight: 700; cursor: pointer; color: var(--muted); }
.tp-seg.on { background: #fff; color: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.tp-animal { position: relative; }
.tp-animal.pending { border-color: #ffb703; background: #fff4cc; box-shadow: 0 0 0 2px #ffd65c; }
.tp-animal.got { background: #2fbf71; border-color: #2fbf71; color: #fff; }
.tp-badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; border-radius: 999px; font-size: 12px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; color: #fff; }
.tp-badge:empty { display: none; }
.tp-animal.pending .tp-badge { background: #e09a00; }
.tp-animal.got .tp-badge { background: #1f9255; }
.tp-row { flex-wrap: wrap; gap: 6px; }
.tp-status { font-size: 13px; color: var(--muted); margin: -4px 0 12px; }
.tp-status.on { color: var(--accent); font-weight: 600; }
.tp-cell.got { border-color: #2fbf71; }
