/* Giao diện Học Viện AI của Alee */

/* =========================================================
   Trang lộ trình
   ========================================================= */
.roadmap { margin-bottom: 26px; padding: 20px 24px; }
.roadmap h3 { margin: 0 0 14px; font-size: 1.15rem; }
.road { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; position: relative; }
.road-tier {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(150deg, var(--c1), var(--c2));
  box-shadow: 0 14px 26px -18px var(--c2);
}
.road-tier + .road-tier::before {
  content: "➜";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-soft);
  font-size: 1rem;
}
.road-num { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.road-tier b { font-size: 1.05rem; }
.road-tier small { font-weight: 800; opacity: 0.9; }
.road-tier p { margin: 4px 0 6px; font-size: 0.75rem; opacity: 0.95; }
.road-mods { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.road-chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  text-decoration: none;
}
.road-chip.link { background: #fff; color: var(--c2); }

.tier-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 30px 0 14px;
  font-size: 1.25rem;
}
.tier-title span {
  padding: 4px 14px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--c1), var(--c2));
  color: #fff;
  font-size: 0.8rem;
}
.related {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding: 14px 20px;
  color: var(--text);
  text-decoration: none;
  border: 1.5px dashed var(--c1);
}
.related .island-icon { background: linear-gradient(120deg, var(--c1), var(--c2)); color: #fff; }
.related b, .related small { display: block; }
.related small { color: var(--text-soft); font-weight: 700; }

/* =========================================================
   Khung màn chơi
   ========================================================= */
.academy-play {
  --play-max: 1100px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 16px;
}
.academy-coach {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: var(--play-max);
  margin: 0 auto;
}
.academy-coach img { width: 48px; flex: none; animation: float 3.2s ease-in-out infinite; }
.academy-coach .bubble { flex: 1; font-size: 0.8rem; }
.module-stage {
  width: 100%;
  max-width: var(--play-max);
  min-height: max(420px, calc(100vh - 260px));
  margin: 0 auto;
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.mod-task { margin: 0; font-size: 1rem; font-weight: 800; text-align: center; }
.mod-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.ai-note {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
}

/* =========================================================
   Tìm quy luật
   ========================================================= */
.pt-seq { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
.pt-item {
  display: grid;
  place-items: center;
  min-width: 72px;
  height: 72px;
  padding: 0 10px;
  border-radius: 18px;
  background: var(--surface-2);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}
.pt-seq.wide .pt-item { font-size: 1.4rem; letter-spacing: -2px; }
.pt-blank { border: 3px dashed var(--primary-2); background: #fff; color: var(--primary); }
.pt-blank.filled { border-style: solid; border-color: var(--success); animation: pop-in 0.3s; }
.pt-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 18px; }
.pt-opt {
  min-width: 96px;
  height: 96px;
  padding: 0 16px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--border), 0 6px 0 var(--border);
  font-size: 2.6rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s;
}
.pt-seq.wide ~ .pt-opts .pt-opt { font-size: 1.4rem; letter-spacing: -2px; }
.pt-opt:hover { transform: translateY(-3px); }
.pt-opt.ok { box-shadow: inset 0 0 0 3px var(--success), 0 6px 0 var(--success); }
.pt-opt.bad { opacity: 0.4; animation: shake 0.3s; }
.pt-rule { min-height: 1.5em; margin: 6px 0 0; font-weight: 800; color: var(--primary); text-align: center; }

/* =========================================================
   Mắt của Alee
   ========================================================= */
.px-wrap { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 28px; }
.px-grid {
  /* Ô co lại theo chiều cao màn hình để lưới lớn vẫn vừa */
  --cell: min(52px, calc((100vh - 350px) / var(--rows, 5)));
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell));
  gap: 4px;
  padding: 10px;
  border-radius: 18px;
  background: #e6e1f7;
}
.px-cell {
  position: relative;
  width: var(--cell);
  height: var(--cell);
  border: 0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: background 0.1s;
}
.px-cell small { position: absolute; top: 4px; left: 6px; font-size: 0.7rem; font-weight: 800; color: #9a95b5; }
.px-cell.painted small { color: rgba(255, 255, 255, 0.85); }
.px-grid.draw .px-cell.painted { background: var(--text); }
.px-cell.ghost { background: #ece8fb; box-shadow: inset 0 0 0 2px #cfc6f5; }
.px-cell.wrong { box-shadow: inset 0 0 0 4px var(--danger); }
.px-grid.done { animation: pop-in 0.4s; }
.px-grid.done .px-cell small { opacity: 0; }
.px-side { display: flex; flex-direction: column; gap: 14px; min-width: 240px; }
.px-palette { display: flex; flex-direction: column; gap: 8px; }
.px-brush {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}
.px-brush i { width: 26px; height: 26px; border-radius: 8px; background: var(--brush); }
.px-brush.on { border-color: var(--brush); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brush) 25%, transparent); }
.px-bars { display: flex; flex-direction: column; gap: 8px; max-width: 320px; }
.px-bar { display: grid; grid-template-columns: 100px 1fr 44px; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 700; }
.px-track { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.px-track i { display: block; height: 100%; border-radius: inherit; background: #c9c4dd; transition: width 0.4s; }
.px-bar.top .px-track i { background: linear-gradient(90deg, var(--c1), var(--c2)); }
.px-bar.top { color: var(--c2); }

/* =========================================================
   Cổng logic
   ========================================================= */
.lg-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-radius: 22px;
  background: linear-gradient(120deg, #2b2a4a, #3b3760);
  color: #fff;
  box-shadow: var(--shadow);
}
.lg-door { font-size: 2rem; }
.lg-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px; border-radius: 16px; }
.lg-group .lg-group { background: rgba(255, 255, 255, 0.1); }
.lg-chip { padding: 6px 14px; border-radius: 999px; background: #fff; color: var(--text); font-weight: 800; font-size: 0.9rem; }
.lg-chip.c-do { box-shadow: inset 0 0 0 3px #f0436a; }
.lg-chip.c-xl { box-shadow: inset 0 0 0 3px #1fae7a; }
.lg-chip.c-xd { box-shadow: inset 0 0 0 3px #3a7bde; }
.lg-chip.c-vang { box-shadow: inset 0 0 0 3px #f7a21b; }
.lg-gate { padding: 6px 12px; border-radius: 10px; font-weight: 800; font-size: 0.85rem; letter-spacing: 0.04em; }
.lg-gate.and { background: #ffb347; color: #3a2400; }
.lg-gate.or { background: #5ec8f2; color: #00263a; }
.lg-gate.not { background: #ff8a80; color: #3a0000; }
.lg-grid { display: grid; grid-template-columns: repeat(4, 96px); gap: 14px; }
.lg-item {
  position: relative;
  height: 96px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--border), 0 5px 0 var(--border);
  font-size: 3rem;
  cursor: pointer;
  transition: transform 0.1s;
}
.lg-item.on { transform: translateY(-4px); box-shadow: inset 0 0 0 4px var(--primary), 0 9px 0 var(--primary-dark); }
.lg-item.pass { background: #e3f8ee; }
.lg-item.block { background: #f4f2fa; }
.lg-item.wrong { box-shadow: inset 0 0 0 4px var(--danger), 0 5px 0 var(--danger); }
.lg-item small {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: 0.9rem;
  font-weight: 800;
}
.lg-item.pass small { color: var(--success); }
.lg-item.block small { color: var(--text-soft); }

/* =========================================================
   Đoán số
   ========================================================= */
.bs-hint {
  min-height: 2.2em;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
}
.bs-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(36px, 52px)); gap: 5px; width: min(100%, 600px); }
.bs-cell {
  /* Chiều cao ô co theo màn hình để bảng 100 số vẫn vừa */
  height: min(46px, calc((100vh - 400px) / var(--rows, 1)));
  min-height: 28px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(31, 27, 61, 0.2);
  transition: opacity 0.25s, transform 0.1s;
}
.bs-cell:hover { transform: translateY(-2px); }
.bs-cell.out { background: #e2deef; color: #b3aecb; box-shadow: none; }
.bs-cell.tried { outline: 3px solid #fff36b; outline-offset: -3px; }
.bs-cell.found { background: linear-gradient(160deg, #ffe08a, #f7a21b); color: #3a2400; animation: pop-in 0.4s; }
.bs-cell.secret { box-shadow: 0 0 0 4px var(--accent); }
.bs-cell.bip-guess { background: linear-gradient(160deg, var(--accent-2), var(--accent)); color: #fff; transform: scale(1.12); }
.bs-answers[hidden] { display: none; }

/* =========================================================
   Cân và sắp xếp
   ========================================================= */
.sc-wrap { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 28px; }
.sc-scale { --tilt: 0; position: relative; width: 340px; height: 170px; }
.sc-arm {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 30px;
  height: 100px;
  transform: rotate(calc(var(--tilt) * 10deg));
  transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.sc-beam { position: absolute; left: 0; right: 0; top: 0; height: 10px; border-radius: 999px; background: linear-gradient(180deg, #8b74f7, #5b49e0); }
.sc-pan {
  position: absolute;
  top: 10px;
  display: grid;
  place-items: center;
  width: 86px;
  height: 64px;
  border-radius: 0 0 40px 40px;
  background: linear-gradient(180deg, #ffe08a, #f7a21b);
  color: #3a2400;
  font-size: 1.6rem;
  font-weight: 800;
  transform: rotate(calc(var(--tilt) * -10deg));
  transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.sc-pan.left { left: -10px; }
.sc-pan.right { right: -10px; }
.sc-post {
  position: absolute;
  left: 50%;
  top: 30px;
  bottom: 0;
  width: 16px;
  transform: translateX(-50%);
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #625d82, #3b3760);
}
.sc-post::after { content: ""; position: absolute; bottom: 0; left: 50%; width: 120px; height: 14px; transform: translateX(-50%); border-radius: 8px; background: #3b3760; }
.sc-side { min-width: 200px; }
.sc-log { margin: 0; padding: 0; list-style: none; max-height: 140px; overflow: auto; }
.sc-log li { padding: 4px 10px; margin-bottom: 4px; border-radius: 10px; background: var(--surface-2); font-size: 0.82rem; font-weight: 700; }
.sc-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.sc-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 92px;
  padding: 10px 6px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(160deg, #fff, color-mix(in srgb, var(--box) 22%, #fff));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--box) 60%, #fff), 0 5px 0 color-mix(in srgb, var(--box) 60%, #fff);
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s;
}
.sc-box.on { transform: translateY(-8px); box-shadow: inset 0 0 0 4px var(--box), 0 10px 0 var(--box); }
.sc-gift { font-size: 2.2rem; }
.sc-box b { font-size: 1.2rem; }
.sc-box small { font-size: 0.75rem; font-weight: 800; color: var(--text-soft); }

/* =========================================================
   Cây quyết định
   ========================================================= */
.tr-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 18px; width: 100%; }
.tr-asks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tr-canvas { overflow: auto; padding: 10px; border-radius: 18px; background: var(--surface-2); }
.tr-tree { display: flex; justify-content: center; min-width: max-content; }
.tr-node { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tr-q {
  padding: 6px 14px;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--c1), var(--c2));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}
.tr-kids { display: flex; gap: 12px; padding-top: 6px; border-top: 3px solid color-mix(in srgb, var(--c1) 55%, #fff); }
.tr-branch { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tr-yes, .tr-no { padding: 1px 10px; border-radius: 999px; font-size: 0.68rem; font-weight: 800; }
.tr-yes { background: #e3f8ee; color: var(--success); }
.tr-no { background: #ffe8ea; color: var(--danger); }
.tr-leaf {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  max-width: 150px;
  padding: 6px 8px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--border);
  font-size: 1.6rem;
}
.tr-leaf.focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255, 122, 89, 0.2); }
.tr-leaf.solved { border-color: var(--success); background: #f1fbf6; }
.tr-panel { display: flex; flex-direction: column; gap: 8px; }
.tr-group { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-group span { display: flex; flex-direction: column; align-items: center; padding: 3px 6px; border-radius: 12px; background: var(--surface-2); font-size: 1.35rem; }
.tr-group small { font-size: 0.6rem; font-weight: 700; }
.tr-ask {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.tr-ask:hover:not([disabled]) { border-color: var(--c1); }
.tr-ask small { flex: none; color: var(--text-soft); }
.tr-ask.good small { color: var(--success); }
.tr-ask[disabled] { opacity: 0.45; cursor: not-allowed; }

/* =========================================================
   Nơ-ron của Alee
   ========================================================= */
.nr-wrap { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; width: 100%; }
.nr-left, .nr-right { display: flex; flex-direction: column; gap: 10px; }
.nr-diagram svg { width: 100%; height: auto; max-height: 210px; }
.nr-in rect { fill: #f1eefc; stroke: #d6cff5; stroke-width: 2; }
.nr-in.on rect { fill: #fff36b; stroke: #f7a21b; }
.nr-in text { font: 800 12px var(--font); fill: #1f1b3d; }
.nr-w { font: 800 14px var(--font); fill: #1f1b3d; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.nr-cell { fill: #7258f0; stroke: #4636c2; stroke-width: 3; }
.nr-sum { font: 800 14px var(--font); fill: #fff; }
.nr-thr { font: 700 11px var(--font); fill: #e6e1f7; }
.nr-out.yes { fill: #2ed59a; }
.nr-out.no { fill: #c9c4dd; }
.nr-out-text { font: 800 12px var(--font); fill: #1f1b3d; }
.nr-calc { margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: 0.8rem; font-weight: 800; text-align: center; }
.nr-controls { display: flex; flex-direction: column; gap: 6px; }
.nr-step { display: grid; grid-template-columns: 1fr auto 44px auto; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 700; }
.nr-step b { text-align: center; font-size: 1.1rem; }
.nr-step .btn-icon { width: 40px; min-width: 40px; min-height: 40px; }
.nr-hint { align-self: flex-start; min-height: 40px; font-size: 0.8rem; }
.nr-table { display: flex; flex-direction: column; gap: 6px; }
.nr-row {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--surface-2);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.nr-row.head { background: transparent; color: var(--text-soft); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; cursor: default; }
.nr-row.ok span:last-child { color: var(--success); font-weight: 800; }
.nr-row.bad span:last-child { color: var(--danger); font-weight: 800; }
.nr-row.sel { border-color: var(--primary-2); background: #fff; }
.nr-status { margin: 0; font-size: 0.85rem; font-weight: 800; color: var(--primary); }

/* =========================================================
   Mạng nơ-ron
   ========================================================= */
.nn-diagram svg { width: 100%; height: auto; max-height: 190px; }
.nn-in { fill: #fff36b; stroke: #f7a21b; stroke-width: 2; }
.nn-t { font: 800 12px var(--font); fill: #1f1b3d; }
.nn-line { stroke: #b9b1e8; stroke-width: 3; stroke-linecap: round; }
.nn-node { fill: #8b74f7; stroke: #4636c2; stroke-width: 3; }
.nn-node.out { fill: #ff7a59; stroke: #d9542f; }
.nn-tw { font: 800 15px var(--font); fill: #fff; }
.nn-w { font: 800 13px var(--font); fill: #1f1b3d; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.nn-cap { font: 700 11px var(--font); fill: #625d82; }
.nn-controls { display: flex; flex-direction: column; gap: 8px; }
/* Mỗi nơ-ron một hàng: trọng số 1 | trọng số 2 | ngưỡng */
.nn-box { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; padding: 8px 10px; border-radius: 14px; background: var(--surface-2); }
.nn-box > b, .nn-box > small { grid-column: 1 / -1; font-size: 0.85rem; }
.nn-box .nr-step { grid-template-columns: 34px 1fr 34px; gap: 4px; }
.nn-box .nr-step-label { grid-column: 1 / -1; font-size: 0.68rem; text-align: center; }
.nn-box .nr-step .btn-icon { width: 34px; min-width: 34px; min-height: 34px; }
.nn-box .nr-step b { font-size: 1rem; }
.nn-box.locked { opacity: 0.75; }
.nn-box.locked small { font-size: 0.75rem; color: var(--text-soft); }
.nr-row.wide { grid-template-columns: 1.6fr 0.6fr 0.6fr 0.8fr 1fr; }

/* =========================================================
   Alee học bằng thưởng
   ========================================================= */
.rl-wrap { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 24px; }
.rl-grid {
  --cell: min(76px, calc((100vh - 360px) / var(--rows)));
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell));
  grid-auto-rows: var(--cell);
  gap: 4px;
  padding: 8px;
  border-radius: 18px;
  background: #e6e1f7;
}
.rl-cell {
  --heat: transparent;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(var(--heat), var(--heat)), #fff;
  transition: background 0.3s;
}
.rl-cell.wall { background: linear-gradient(160deg, #8e89a8, #625d82); }
.rl-cell.trap { background: #ffe1e5; }
.rl-cell.goal { background: #e3f8ee; }
.rl-cell.start::after { content: ""; position: absolute; inset: 22%; border: 2px dashed #b9b1e8; border-radius: 50%; }
.rl-icon { font-size: calc(var(--cell) * 0.45); }
.rl-arrow { position: absolute; top: 2px; right: 6px; font-style: normal; font-weight: 800; font-size: 0.9rem; color: #14a38b; }
.rl-val { position: absolute; bottom: 3px; left: 5px; font-size: 0.65rem; font-weight: 800; color: #1f1b3d; }
.rl-bip {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--cell);
  height: var(--cell);
  font-size: calc(var(--cell) * 0.55);
  transform: translate(calc(var(--c) * (var(--cell) + 4px)), calc(var(--r) * (var(--cell) + 4px)));
  transition: transform 0.08s linear;
  pointer-events: none;
}
.rl-side { display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.rl-explore { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rl-opt {
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}
.rl-opt.on { border-color: var(--c2); background: color-mix(in srgb, var(--c1) 18%, #fff); }
.rl-actions { display: flex; flex-direction: column; gap: 8px; }
.rl-actions .btn { font-size: 0.85rem; }

/* =========================================================
   Alee đoán chữ
   ========================================================= */
.lm-sentence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  width: min(100%, 760px);
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--surface-2);
}
.lm-chip { padding: 6px 14px; border-radius: 999px; background: linear-gradient(120deg, var(--c1), var(--c2)); color: #fff; font-weight: 800; animation: pop-in 0.2s; }
.lm-caret { color: var(--c2); font-weight: 800; animation: float 1s steps(2) infinite; }
.lm-panel { width: min(100%, 560px); }
.lm-bars { display: flex; flex-direction: column; gap: 8px; }
.lm-bar {
  display: grid;
  grid-template-columns: 120px 1fr 110px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
}
button.lm-bar { cursor: pointer; }
button.lm-bar:hover { border-color: var(--c1); }
.lm-word { font-weight: 800; }
.lm-track { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.lm-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--c1), var(--c2)); transition: width 0.3s; }
.lm-bar b { font-size: 0.72rem; color: var(--text-soft); text-align: right; }
.lm-teach, .lm-quiz { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; width: 100%; }
.lm-pool { display: flex; flex-direction: column; gap: 6px; }
.lm-sent {
  padding: 9px 14px;
  border: 2px dashed var(--border);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.lm-sent.on { border-style: solid; border-color: var(--success); background: #e3f8ee; }
.lm-corpus { display: flex; flex-direction: column; gap: 3px; max-height: 360px; overflow: auto; padding: 10px; border-radius: 14px; background: var(--surface-2); }
.lm-line { display: flex; flex-wrap: wrap; gap: 5px; font-size: 0.82rem; }
.lm-line .hit { padding: 0 6px; border-radius: 6px; background: var(--c2); color: #fff; font-weight: 800; }
.lm-line .after { padding: 0 6px; border-radius: 6px; background: #ffe0b8; font-weight: 800; }
.lm-ask { margin: 0 0 6px; font-size: 1.05rem; font-weight: 800; }
.lm-opt { min-width: 120px; height: 64px; font-size: 1.1rem; }
.lm-story { display: flex; flex-direction: column; gap: 8px; width: min(100%, 760px); }
.lm-line.big { align-items: center; gap: 8px; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); font-size: 0.95rem; }
.lm-tag { font-size: 1.2rem; }

/* =========================================================
   Dữ liệu công bằng
   ========================================================= */
.fd-block { width: 100%; }
.fd-block h4 { margin: 0 0 6px; font-size: 0.85rem; }
.fd-block.test { padding: 10px 12px; border-radius: 18px; background: var(--surface-2); }
.fd-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mod-du-lieu-cong-bang { gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.fd-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 122px;
  padding: 5px 5px 6px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: #fff;
  font: inherit;
  font-size: 0.75rem;
  color: var(--text);
}
button.fd-card { cursor: pointer; }
button.fd-card:hover { border-color: var(--c1); }
.fd-card.pool { border-style: dashed; }
.fd-card.new { border-color: var(--success); }
.fd-card.ok { border-color: var(--success); }
.fd-card.bad { border-color: var(--danger); }
.fd-card.ok, .fd-card.bad { width: 220px; }
.fd-photo {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 42px;
  border-radius: 10px;
}
.fd-photo.indoor { background: linear-gradient(180deg, #ffe9c7, #f5cf9a); }
.fd-photo.outdoor { background: linear-gradient(180deg, #bfe6ff, #9be7a3 70%); }
.fd-photo.kid.red { background: linear-gradient(180deg, #ffe1e5, #ffb3bf); }
.fd-photo.kid.blue { background: linear-gradient(180deg, #dbeeff, #a9d2ff); }
.fd-photo small { position: absolute; bottom: 3px; font-size: 0.62rem; font-weight: 800; }
.fd-deco { position: absolute; left: 5px; bottom: 3px; font-size: 0.95rem; }
.fd-animal { font-size: 1.5rem; }
.fd-card > b { font-size: 0.64rem; white-space: nowrap; }
.fd-label { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); font-weight: 800; }
.fd-feat { color: var(--text-soft); font-size: 0.6rem; font-weight: 700; white-space: nowrap; }
.fd-feat.strong { color: var(--text); font-size: 0.66rem; }
.fd-label { white-space: nowrap; }
.fd-guess { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.fd-card.ok .fd-guess b { color: var(--success); }
.fd-card.bad .fd-guess b { color: var(--danger); }
.fd-guess small { color: var(--text-soft); font-size: 0.65rem; }

/* =========================================================
   Có nên tin AI?
   ========================================================= */
.tu-card {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(100%, 720px);
  padding: 22px 26px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fff, #faf8ff);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}
.tu-card.enter { animation: pop-in 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); }
.tu-icon { font-size: 3.4rem; flex: none; }
.tu-card p { margin: 0; font-size: 1.15rem; font-weight: 800; line-height: 1.4; }
.tu-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.tu-choice {
  min-width: 190px;
  min-height: 64px;
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--border), 0 5px 0 var(--border);
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}
.tu-choice:hover { transform: translateY(-2px); }
.tu-choice.ok { box-shadow: inset 0 0 0 3px var(--success), 0 5px 0 var(--success); background: #e3f8ee; }
.tu-choice.bad { box-shadow: inset 0 0 0 3px var(--danger), 0 5px 0 var(--danger); background: #ffe8ea; }
.tu-why { min-height: 3em; width: min(100%, 720px); margin: 0; font-size: 0.9rem; font-weight: 700; text-align: center; }

/* =========================================================
   Mạng tự học (biểu đồ lỗi)
   ========================================================= */
.nn-chart { padding: 8px 10px; border-radius: 14px; background: var(--surface-2); }
.nn-chart svg { width: 100%; height: auto; max-height: 150px; }
.nn-blame { font: 800 10px var(--font); fill: #d9542f; }
.nn-back { font: 800 10px var(--font); fill: #d9542f; }

/* =========================================================
   Gom nhóm
   ========================================================= */
.cl-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; width: 100%; align-items: start; }
.cl-plane { position: relative; width: min(100%, calc(100vh - 330px)); aspect-ratio: 1; margin: 0 auto; padding: 0 0 18px 18px; }
.cl-svg { width: 100%; height: 100%; display: block; }
.cl-svg.placing { cursor: crosshair; }
.cl-bg { fill: #f6f4ff; stroke: #e6e1f7; stroke-width: 0.6; }
.cl-pt { transition: fill 0.2s; }
.cl-pt.click { cursor: pointer; }
.cl-center { paint-order: stroke; stroke: #fff; stroke-width: 1.4px; pointer-events: none; }
.cl-ax { position: absolute; font-size: 0.68rem; font-weight: 800; color: var(--text-soft); }
.cl-ax.x { bottom: 0; right: 0; }
.cl-ax.y { top: 0; left: 0; writing-mode: vertical-rl; transform: rotate(180deg); }
.cl-side { display: flex; flex-direction: column; gap: 10px; }
.cl-brushes { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-brush {
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--b);
  cursor: pointer;
}
.cl-brush.on { border-color: var(--b); background: color-mix(in srgb, var(--b) 15%, #fff); }
.cl-info { margin: 0; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 0.85rem; font-weight: 700; }
.cl-algo { margin: 0; padding-left: 1.2em; font-size: 0.8rem; color: var(--text-soft); }
.cl-names { display: flex; flex-direction: column; gap: 8px; }
.cl-name-row { display: flex; align-items: center; gap: 10px; }
.cl-name-row .field { margin: 0; }
.cl-dot { width: 18px; height: 18px; flex: none; border-radius: 50%; }

/* =========================================================
   Bộ lọc ảnh
   ========================================================= */
.cv-wrap { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 22px; }
.cv-col { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.85rem; }
.cv-col.mid { min-width: 120px; }
.cv-grid {
  --cv: min(36px, calc((100vh - 480px) / 8));
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cv));
  gap: 2px;
  padding: 6px;
  border-radius: 12px;
  background: #e6e1f7;
}
.cv-grid.small { --cv: min(44px, calc((100vh - 480px) / 6)); }
.cv-grid.mini { --cv: min(30px, calc((100vh - 500px) / 8)); }
.cv-grid.kernel { --cv: 38px; background: #2b2a4a; }
.cv-cell {
  display: grid;
  place-items: center;
  width: var(--cv);
  height: var(--cv);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
}
.cv-cell.on { background: #3b3760; color: #fff; }
.cv-cell.off { background: #fff; color: #9a95b5; }
.cv-cell.win { box-shadow: inset 0 0 0 3px #f7a21b; }
.cv-cell.off.win { background: #fff4d6; }
.cv-cell.pos { background: rgba(58, 123, 222, calc(0.15 + var(--h, 1) * 0.85)); color: #fff; }
.cv-cell.neg { background: rgba(255, 122, 89, calc(0.15 + var(--h, 1) * 0.85)); color: #fff; }
.cv-cell.zero { background: #fff; color: #9a95b5; }
.cv-cell.k { font-size: 0.85rem; }
.cv-cell.k.pos { background: #3a7bde; }
.cv-cell.k.neg { background: #ff7a59; }
.cv-cell.k.zero { background: #4a4670; color: #fff; }
.cv-calc { margin: 0; font-weight: 800; text-align: center; }
.cv-opt { min-width: 88px; height: 72px; font-size: 1.5rem; }
.cv-arrow { font-size: 1.4rem; font-weight: 800; color: var(--text-soft); }
.cv-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--border), 0 5px 0 var(--border);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.cv-choice .cv-grid.kernel { --cv: 24px; padding: 4px; }
.cv-choice .cv-cell.k { font-size: 0.6rem; }
.mod-bo-loc-anh { gap: 10px; }
.cv-choice.ok { box-shadow: inset 0 0 0 3px var(--success), 0 5px 0 var(--success); }
.cv-choice.bad { opacity: 0.45; }

/* =========================================================
   Dự án cuối khóa
   ========================================================= */
.pj-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(100%, 820px); }
.pj-stage h3 { margin: 0; font-size: 1.2rem; }
.pj-ideas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.pj-form { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; width: 100%; }
.pj-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; font-weight: 800; color: var(--text-soft); }
.pj-form .field { margin: 0; }
.pj-stage .item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: min(100%, 420px);
  padding: 16px 20px;
  border-radius: 26px;
  background: linear-gradient(180deg, #fff, #f6f3ff);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}
.pj-stage .item-card.enter { animation: pop-in 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); }
.pj-stage .item-emoji { font-size: 4.5rem; line-height: 1.1; }
.pj-stage .item-name { font-size: 1.3rem; font-weight: 800; }
.pj-stage .verdict { width: 100%; margin-top: 6px; padding: 10px 14px; border-radius: 16px; background: #eef4ff; text-align: center; }
.pj-stage .reason { font-size: 0.8rem; color: var(--text-soft); }
.pj-stage .class-btn { min-height: 60px; font-size: 1.05rem; }
.pj-report { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.pj-box { padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.pj-box b { display: block; margin-bottom: 4px; font-size: 0.85rem; }
.pj-box p { margin: 2px 0; font-size: 0.85rem; }
.recap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.recap-item { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; font-size: 1.5rem; }
.recap-item.ok { background: #e3f8ee; }
.recap-item.bad { background: #ffe8ea; }
.recap-item small { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 0.6rem; font-weight: 800; }
.recap-item.ok small { background: var(--success); }
.recap-item.bad small { background: var(--danger); }

/* =========================================================
   Alee vẽ tranh
   ========================================================= */
.ar-mid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; width: 100%; align-items: start; }
.ar-block { display: flex; flex-direction: column; gap: 8px; }
.ar-block h4 { margin: 0; font-size: 0.85rem; }
.ar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.ar-pic { --s: 10px; display: grid; grid-template-columns: repeat(8, var(--s)); gap: 1px; padding: 4px; border-radius: 8px; background: #e6e1f7; width: max-content; }
.ar-pic.tiny { --s: 5px; padding: 2px; }
.ar-pic.mid { --s: 15px; }
.ar-pic.big { --s: min(36px, calc((100vh - 420px) / 8)); gap: 2px; padding: 6px; }
.ar-cell { width: var(--s); height: var(--s); border-radius: 2px; background: #fff; }
.ar-cell.on { background: #3b3760; }
.ar-cell.prob { background: rgba(114, 88, 240, var(--p)); }
.ar-pic.edit { cursor: pointer; touch-action: none; user-select: none; }
.ar-pic.edit .ar-cell:hover { outline: 2px solid var(--c1); }
.ar-made { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ar-made small { font-size: 0.65rem; font-weight: 700; color: var(--text-soft); }

@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

@media (max-width: 1100px) {
  .road { grid-template-columns: repeat(2, 1fr); }
  .road-tier:nth-child(3)::before { display: none; }
}
@media (max-width: 900px) {
  .road { grid-template-columns: 1fr; }
  .road-tier + .road-tier::before { display: none; }
  .tr-wrap, .nr-wrap, .lm-teach, .lm-quiz, .cl-wrap, .pj-report, .pj-form, .pj-ideas, .ar-mid { grid-template-columns: 1fr; }
  .lg-grid { grid-template-columns: repeat(4, 72px); }
  .lg-item { height: 72px; font-size: 2.2rem; }
  .px-grid { --cell: 38px; }
}
