/* Science School Tycoon — interface styling */
:root {
  --ink: #21304d;
  --ink-2: #415573;
  --muted: #5b6b82;
  --cream: #fff8ea;
  --paper: #fffdf8;
  --teal: #22a9a1;
  --teal-d: #147a75;
  --teal-l: #d9f6f2;
  --coral: #ff7a4a;
  --coral-d: #de5b2e;
  --sun: #ffd34d;
  --sun-d: #d7a513;
  --green: #68b85c;
  --green-d: #4a8f40;
  --violet: #7b6bd6;
  --violet-d: #5c4cb5;
  --red: #e2575d;
  --red-d: #b63a44;
  --blue: #4f8fe0;
  --pink: #ef86ad;
  --line: rgba(33, 48, 77, 0.13);
  --line-strong: rgba(33, 48, 77, 0.22);
  --shadow-sm: 0 4px 12px rgba(33, 48, 77, 0.10);
  --shadow: 0 16px 36px rgba(33, 48, 77, 0.18);
  --shadow-lg: 0 26px 70px rgba(26, 40, 68, 0.28);
  --radius: 18px;
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: #a8e0f4;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { touch-action: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid rgba(34, 169, 161, 0.65); outline-offset: 2px; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  z-index: 0;
}
.scene-shade {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(20, 45, 75, 0.22) 0, rgba(20, 45, 75, 0) 18%),
    linear-gradient(0deg, rgba(20, 45, 75, 0.20) 0, rgba(20, 45, 75, 0) 22%);
}

/* ============================== BOOT ============================== */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  text-align: center;
  color: var(--ink);
  background:
    radial-gradient(1000px 700px at 20% 10%, #d9f7ff, transparent 60%),
    radial-gradient(800px 600px at 90% 90%, #ffe3c0, transparent 55%),
    var(--cream);
  transition: opacity 0.4s ease, visibility 0.4s;
}
.boot.gone { opacity: 0; visibility: hidden; }
.boot-flask { font-size: 68px; animation: bob 1.6s ease-in-out infinite; filter: drop-shadow(0 12px 14px rgba(33, 48, 77, 0.16)); }
.boot h1 { margin: 0; font-size: clamp(24px, 4vw, 36px); letter-spacing: -0.03em; }
.boot p { margin: 0; color: var(--muted); font-weight: 600; }
.boot-bar { width: 220px; height: 12px; border-radius: 999px; background: rgba(33, 48, 77, 0.10); overflow: hidden; }
.boot-bar i { display: block; width: 45%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--green), var(--sun)); animation: bootSlide 1.4s ease-in-out infinite; }

/* ============================== TITLE ============================= */
.title-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow-y: auto;
  overflow-x: hidden;
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 4vw, 54px) 18px;
  background:
    radial-gradient(1100px 700px at 12% 4%, rgba(156, 226, 246, 0.72), transparent 60%),
    radial-gradient(900px 700px at 96% 86%, rgba(255, 217, 137, 0.65), transparent 58%),
    linear-gradient(160deg, rgba(255, 248, 234, 0.82) 0%, rgba(255, 248, 234, 0.94) 55%, rgba(255, 248, 234, 0.99) 100%);
  backdrop-filter: blur(2px) saturate(1.05);
}
.title-topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, background 0.15s;
}
.back-link:hover { transform: translateX(-2px); background: #fff; }
.title-inner {
  position: relative;
  z-index: 4;
  width: 100%;
  max-width: 1280px;
  margin: clamp(18px, 3vh, 40px) auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.86fr);
  gap: clamp(26px, 4vw, 64px);
  align-items: center;
}
.title-copy { padding: 6px 0 20px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal-d);
  background: rgba(255, 255, 255, 0.68);
  border: 1.5px solid rgba(34, 169, 161, 0.22);
  padding: 7px 13px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.game-logo {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: clamp(8px, 1.4vw, 18px);
  font-size: clamp(46px, 6.7vw, 92px);
  line-height: 0.88;
  letter-spacing: -0.055em;
  font-weight: 900;
  color: var(--ink);
  text-wrap: balance;
}
.game-logo em {
  font-style: normal;
  color: #a83412;
  background: linear-gradient(180deg, #cf4a17, #9c2f0d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 rgba(222, 91, 46, 0.14));
}
.logo-flask {
  display: inline-grid;
  place-items: center;
  width: 0.92em;
  height: 0.92em;
  flex: none;
  margin-top: 0.03em;
  border-radius: 26%;
  background: linear-gradient(145deg, #ffffff, #d7f7f3);
  border: 2px solid rgba(33, 48, 77, 0.12);
  box-shadow: 0 10px 0 rgba(33, 48, 77, 0.07), 0 18px 30px rgba(33, 48, 77, 0.14);
  font-size: 0.72em;
  transform: rotate(-4deg);
}
.logo-words { display: block; }
.tagline {
  max-width: 580px;
  margin: 22px 0 18px;
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.55;
  font-weight: 600;
  color: var(--ink-2);
}
.title-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.title-chips span {
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.continue-wrap {
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid rgba(215, 165, 19, 0.35);
  border-radius: 20px;
  padding: 14px;
  margin-bottom: 16px;
  max-width: 470px;
  box-shadow: var(--shadow-sm);
}
.continue-wrap p { margin: 8px 2px 0; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.title-steps { display: flex; gap: 18px; flex-wrap: wrap; }
.title-steps div { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.title-steps b {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-size: 12px;
}
.level-panel {
  position: relative;
  background: rgba(255, 253, 248, 0.95);
  border: 2px solid rgba(33, 48, 77, 0.11);
  border-radius: 28px;
  padding: clamp(18px, 2.4vw, 28px);
  box-shadow: var(--shadow-lg);
  max-height: min(720px, 82vh);
  overflow-y: auto;
}
.level-panel::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 22px;
  border: 1.5px dashed rgba(33, 48, 77, 0.10);
  pointer-events: none;
}
.level-panel-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; position: relative; }
.level-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: var(--teal-l);
  border: 1.5px solid rgba(34, 169, 161, 0.25);
  font-size: 23px;
}
.level-panel h2 { margin: 1px 0 6px; font-size: clamp(20px, 2vw, 24px); letter-spacing: -0.02em; }
.level-panel h2 + p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; font-weight: 600; }
.level-bands { display: grid; gap: 12px; position: relative; }
.level-band-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.level-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1.8px solid var(--line);
  background: #fff;
  text-align: left;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s, background 0.14s;
}
.level-btn:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.level-btn b { font-size: 14px; letter-spacing: -0.01em; }
.level-btn small { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.level-btn .lvl-emoji { font-size: 18px; line-height: 1; }
.level-btn.selected {
  background: var(--teal-l);
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(34, 169, 161, 0.14);
}
.level-btn.selected::after {
  content: "✓";
  position: absolute;
  top: 7px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.level-note {
  margin: 13px 0 11px;
  min-height: 38px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: #f6f9f7;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  line-height: 1.4;
}
.link-btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 10px;
  border: 0;
  background: none;
  color: var(--teal-d);
  font-weight: 800;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px 6px;
}
.save-hint { text-align: center; color: var(--muted); font-size: 11px; margin: 6px 0 0; font-weight: 600; }
.title-footer {
  position: relative;
  z-index: 4;
  max-width: 1280px;
  margin: clamp(18px, 3vh, 34px) auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(33, 48, 77, 0.78);
  text-align: center;
}
.title-footer .dot { opacity: 0.5; }
.title-deco { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.deco {
  position: absolute;
  display: grid;
  place-items: center;
  width: clamp(48px, 5vw, 78px);
  height: clamp(48px, 5vw, 78px);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
  border: 1.5px solid rgba(33, 48, 77, 0.09);
  box-shadow: 0 12px 24px rgba(33, 48, 77, 0.10);
  font-size: clamp(24px, 2.6vw, 38px);
  animation: floaty 7s ease-in-out infinite;
}
.deco.a { left: 2%; top: 23%; transform: rotate(-8deg); animation-delay: -1s; }
.deco.b { left: 37%; top: 5%; transform: rotate(6deg); animation-delay: -3s; }
.deco.c { right: 4%; top: 12%; transform: rotate(7deg); animation-delay: -2s; }
.deco.d { left: 48%; bottom: 9%; transform: rotate(-6deg); animation-delay: -4s; }
.deco.e { left: 7%; bottom: 12%; transform: rotate(5deg); animation-delay: -2.5s; }
.deco.f { right: 10%; bottom: 8%; transform: rotate(-4deg); animation-delay: -5s; }
.deco.g { left: 28%; top: 38%; transform: rotate(10deg); opacity: 0.75; animation-delay: -3.8s; }
.deco.h { right: 30%; top: 30%; transform: rotate(-9deg); opacity: 0.7; animation-delay: -1.6s; }

/* ============================== HUD ============================== */
.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
.hud button, .hud a, .hud .pill, .hud .objective-card, .hud .day-card, .hud .joystick, .hud .coach { pointer-events: auto; }
.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) clamp(10px, 1.6vw, 20px) 0;
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hud-right { justify-content: flex-end; }
.brand-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1.5px solid rgba(33, 48, 77, 0.11);
  background: rgba(255, 253, 248, 0.93);
  border-radius: 16px;
  padding: 7px 12px 7px 8px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  text-align: left;
  transition: transform 0.14s;
}
.brand-chip:hover { transform: translateY(-1px); }
.brand-ico {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 11px;
  background: var(--teal-l);
  font-size: 20px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text small { font-size: 8.5px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.brand-text b { font-size: 13.5px; letter-spacing: -0.01em; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.93);
  border: 1.5px solid rgba(33, 48, 77, 0.11);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}
.pill b { font-weight: 900; }
.pill-ico { font-size: 15px; }
.coin-pill { background: linear-gradient(180deg, #fff9e0, #ffeaa2); border-color: rgba(215, 165, 19, 0.3); }
.coin-pill b { color: #6e4f00; min-width: 44px; }
.coin-pill.bump { animation: bump 0.38s ease; }
.level-pill { background: rgba(217, 246, 242, 0.95); border-color: rgba(34, 169, 161, 0.25); }
.chip { cursor: pointer; transition: transform 0.14s, background 0.14s; }
.chip:hover { transform: translateY(-1px); background: #fff; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border: 1.5px solid rgba(33, 48, 77, 0.11);
  background: rgba(255, 253, 248, 0.93);
  box-shadow: var(--shadow-sm);
  font-size: 17px;
  backdrop-filter: blur(10px);
  transition: transform 0.14s, background 0.14s;
}
.icon-btn:hover { transform: translateY(-1px); background: #fff; }
.icon-btn.light { background: rgba(255, 255, 255, 0.75); }
.icon-btn.off { opacity: 0.55; }

.hud-aside {
  position: absolute;
  top: 78px;
  left: clamp(10px, 1.6vw, 20px);
  width: 310px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.objective-card, .day-card {
  background: rgba(255, 253, 248, 0.95);
  border: 1.5px solid rgba(33, 48, 77, 0.12);
  border-radius: 18px;
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}
.objective-card { display: flex; gap: 11px; align-items: flex-start; }
.obj-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff2c9;
  border: 1.5px solid rgba(215, 165, 19, 0.25);
  font-size: 19px;
}
.obj-body { min-width: 0; }
.obj-body small { display: block; font-size: 8.6px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal-d); margin-bottom: 3px; }
.obj-body b { display: block; font-size: 13.5px; line-height: 1.25; letter-spacing: -0.01em; }
.obj-body p { margin: 4px 0 8px; font-size: 11.5px; line-height: 1.4; color: var(--ink-2); font-weight: 600; }
.obj-progress { height: 7px; border-radius: 999px; background: rgba(33, 48, 77, 0.10); overflow: hidden; }
.obj-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--green)); transition: width 0.4s ease; }
.obj-progress-text { display: block; margin-top: 4px; font-size: 10px; font-weight: 800; color: var(--muted); }

.day-card { padding: 12px 13px; }
.day-head { display: flex; align-items: center; gap: 9px; }
.day-sun { font-size: 21px; }
.day-head > div { min-width: 0; flex: 1; }
.day-head small { display: block; font-size: 8.5px; font-weight: 900; letter-spacing: 0.11em; text-transform: uppercase; color: var(--coral-d); }
.day-head b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-date { font-size: 10px; color: var(--muted); font-weight: 800; white-space: nowrap; }
.task-list { display: grid; gap: 5px; margin: 10px 0; }
.task-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
  line-height: 1.25;
}
.task-row .tick {
  flex: none;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  font-size: 10px;
  color: transparent;
  background: #fff;
}
.task-row.done { color: var(--muted); }
.task-row.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.task-row.done span:last-child { text-decoration: line-through; }

.prompt {
  position: fixed;
  left: 50%;
  bottom: 98px;
  transform: translateX(-50%);
  z-index: 12;
  animation: popIn 0.22s ease;
}
.prompt-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px 11px 12px;
  border-radius: 999px;
  border: 2px solid rgba(33, 48, 77, 0.14);
  background: rgba(255, 253, 248, 0.97);
  box-shadow: var(--shadow);
  font-weight: 900;
  font-size: 14px;
  color: var(--ink);
  transition: transform 0.14s, background 0.14s;
}
.prompt-btn:hover { transform: translateY(-2px); background: #fff; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 27px;
  height: 27px;
  padding: 0 7px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 3px 0 #101a2c;
}
.action-bar {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  align-items: stretch;
  gap: 5px;
  padding: 6px;
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.94);
  border: 1.5px solid rgba(33, 48, 77, 0.12);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 58px;
  height: 52px;
  padding: 4px 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  transition: background 0.14s, transform 0.14s;
}
.dock-btn:hover { background: rgba(34, 169, 161, 0.10); transform: translateY(-1px); }
.dock-btn .dock-ico { font-size: 20px; line-height: 1; }
.dock-btn.primary-dock { background: var(--teal); color: #fff; }
.dock-btn.primary-dock:hover { background: var(--teal-d); }
.dock-btn.pulse { animation: dockPulse 1.8s ease-in-out infinite; }
.highlight { animation: highlightPulse 1.6s ease-in-out infinite; border-radius: 16px; }

.joystick {
  display: none;
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 116px;
  height: 116px;
  z-index: 13;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.joy-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 6px 20px rgba(20, 40, 70, 0.18), inset 0 0 30px rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(3px);
}
.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.94);
  border: 2px solid rgba(33, 48, 77, 0.12);
  box-shadow: var(--shadow-sm);
  font-size: 19px;
  color: var(--muted);
  will-change: transform;
}
.interact-hint {
  position: fixed;
  right: 16px;
  bottom: 86px;
  z-index: 9;
  font-size: 10px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(20, 40, 70, 0.35);
  pointer-events: none;
  transition: opacity 0.4s;
}
.save-dot {
  position: fixed;
  right: 16px;
  top: 64px;
  z-index: 9;
  font-size: 9.5px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 4px rgba(20, 40, 70, 0.4);
  pointer-events: none;
  opacity: 0.8;
}
.save-dot.saving { color: #fff3c4; }
.save-dot.error { color: #ffd4d4; }

/* ============================== COACH & TOASTS ============================== */
.coach {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 30;
  width: min(430px, calc(100vw - 28px));
  background: #fffdf8;
  border: 2px solid rgba(33, 48, 77, 0.12);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 13px 14px 12px;
}
.coach.pop { animation: popIn 0.25s ease; }
.coach-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.coach-step {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--teal-d);
  background: var(--teal-l);
  border-radius: 999px;
  padding: 4px 9px;
}
.coach-skip { border: 0; background: none; color: var(--muted); font-size: 10.5px; font-weight: 800; text-decoration: underline; padding: 3px; }
.coach-main { display: flex; gap: 10px; align-items: flex-start; }
.coach-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff2c9;
  font-size: 20px;
}
.coach-main b { display: block; font-size: 14px; letter-spacing: -0.01em; margin-bottom: 3px; }
.coach-main p { margin: 0; font-size: 12px; line-height: 1.42; color: var(--ink-2); font-weight: 600; }
.coach .coach-next { margin-top: 10px; width: 100%; }

/* The greeting that appears when the teacher walks into the classroom. It is
   deliberately small, so the children themselves stay in view. */
.class-callout {
  position: fixed;
  top: max(78px, calc(env(safe-area-inset-top) + 68px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 31;
  width: min(660px, calc(100vw - 28px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: linear-gradient(180deg, #fffdf6, #fdf6e6);
  border: 2px solid rgba(33, 48, 77, 0.12);
  border-left: 6px solid var(--teal);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: fadeIn 0.22s ease;
}
.cc-face {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e4f6ee;
  font-size: 22px;
}
.cc-copy { flex: 1; min-width: 0; }
.cc-copy b { display: block; font-size: 13.5px; line-height: 1.15; letter-spacing: -0.01em; }
.cc-copy p { margin: 2px 0 0; font-size: 11.5px; line-height: 1.35; color: var(--ink-2); font-weight: 600; }
.cc-actions { flex: none; display: flex; align-items: center; gap: 6px; }
.cc-actions .btn { white-space: nowrap; }
.cc-close {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 8px;
  border-radius: 9px;
  cursor: pointer;
}
.cc-close:hover { background: rgba(33, 48, 77, 0.07); color: var(--ink); }
/* The greeting and the left-hand cards both say "take the register", and they
   share the top of the screen. The greeting stands alone, with the same next
   step as buttons, until it is dismissed or a menu opens. */
body.class-greeting #objectiveCard,
body.class-greeting #dayCard { display: none; }
@media (max-width: 1100px) and (min-width: 761px) {
  .class-callout {
    top: auto;
    bottom: 92px;
    width: min(620px, calc(100vw - 24px));
  }
}
/* On a landscape tablet the camera is full of children's faces; keep the
   greeting in the sky above them instead of across the front row. */
@media (max-width: 1100px) and (min-width: 761px) and (orientation: landscape) {
  .class-callout {
    top: max(78px, calc(env(safe-area-inset-top) + 68px));
    bottom: auto;
  }
}
@media (max-width: 760px) {
  .class-callout {
    top: max(118px, calc(env(safe-area-inset-top) + 108px));
    width: calc(100vw - 20px);
    flex-wrap: wrap;
    gap: 7px;
    padding: 9px 10px;
  }
  .cc-copy { flex: 1 1 calc(100% - 54px); }
  .cc-copy b { font-size: 13px; }
  .cc-copy p { font-size: 11px; }
  .cc-face { width: 36px; height: 36px; border-radius: 11px; font-size: 19px; }
  .cc-actions { flex: 1 1 100%; }
  .cc-actions .btn { flex: 1; min-height: 38px; padding: 0 8px; font-size: 11px; }
  .cc-close { position: absolute; top: 4px; right: 4px; }
}

.toasts {
  position: fixed;
  top: max(72px, calc(env(safe-area-inset-top) + 64px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  width: min(420px, calc(100vw - 24px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(33, 48, 77, 0.94);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  transition: opacity 0.22s, transform 0.22s;
  text-align: center;
}
.toast.in { opacity: 1; transform: none; }
.toast .toast-ico { font-size: 15px; }
.toast.success { background: linear-gradient(135deg, #1b7f6e, #2fb0a8); }
.toast.error { background: linear-gradient(135deg, #a8303b, #d8505a); }
.toast.gold { background: linear-gradient(135deg, #b8860c, #e7b530); color: #2b240d; }
.toast.tip { background: rgba(255, 253, 248, 0.97); color: var(--ink); border: 1.5px solid var(--line); }

.coin-float {
  position: fixed;
  z-index: 70;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px rgba(20, 40, 70, 0.45);
  pointer-events: none;
  animation: coinFloat 0.95s ease-out forwards;
}
.coin-float.up { color: #ffe68a; }
.coin-float.down { color: #ffb4b4; }

/* ============================== MODALS ============================== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 34, 56, 0.52);
  backdrop-filter: blur(5px) saturate(0.9);
  animation: fadeIn 0.2s ease;
}
.modal-backdrop.transparent { background: rgba(21, 34, 56, 0.30); backdrop-filter: blur(2px); }
.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(760px, calc(100vw - 32px));
  max-height: min(880px, var(--modal-max, 92vh));
  background: var(--paper);
  border: 2px solid rgba(33, 48, 77, 0.12);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-card.wide { width: min(1080px, calc(100vw - 32px)); }
.modal-card.narrow { width: min(520px, calc(100vw - 32px)); }
.modal-card.tall .modal-body { max-height: none; }
.modal-card.closing { animation: modalOut 0.16s ease forwards; }
.modal-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 7px;
  border: 1.5px dashed rgba(33, 48, 77, 0.07);
  border-radius: 20px;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1.5px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 253, 248, 0.2));
  flex: none;
  position: relative;
  z-index: 1;
}
.modal-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--teal-l);
  border: 1.5px solid rgba(34, 169, 161, 0.22);
  font-size: 22px;
}
.modal-titles { min-width: 0; flex: 1; }
.modal-titles h2 { margin: 1px 0 2px; font-size: clamp(19px, 2.1vw, 24px); letter-spacing: -0.025em; line-height: 1.16; }
.modal-titles p { margin: 0; font-size: 12px; color: var(--muted); font-weight: 600; line-height: 1.38; }
.modal-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 900;
  transition: background 0.14s, transform 0.14s;
}
.modal-close:hover { background: #f4f0e6; transform: rotate(4deg); }
.modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(33, 48, 77, 0.22) transparent;
  position: relative;
  z-index: 1;
}
.modal-body::-webkit-scrollbar { width: 9px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(33, 48, 77, 0.18); border-radius: 999px; border: 2px solid var(--paper); }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 20px;
  border-top: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  flex: none;
  position: relative;
  z-index: 1;
}
.modal-actions .btn.block { flex: 1 1 100%; }
.modal-footnote { padding: 0 20px 12px; font-size: 10.5px; color: var(--muted); font-weight: 600; text-align: center; }
.modal-footnote:empty { display: none; }

/* ============================== BUTTONS ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 13px;
  border: 1.8px solid transparent;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.15;
  transition: transform 0.14s, box-shadow 0.14s, background 0.14s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn .btn-ico { font-size: 16px; }
.btn.primary { background: #12827b; color: #fff; border-color: var(--teal-d); box-shadow: 0 4px 0 var(--teal-d); }
.btn.primary:hover:not(:disabled) { background: #0d6f69; }
.btn.gold { background: linear-gradient(180deg, #ffdd6a, #ffc72c); color: #4b3600; border-color: #d9a900; box-shadow: 0 4px 0 #cb9c00; }
.btn.gold:hover:not(:disabled) { background: #ffe17f; }
.btn.coral { background: var(--coral); color: #fff; border-color: var(--coral-d); box-shadow: 0 4px 0 var(--coral-d); }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line-strong); box-shadow: 0 3px 0 rgba(33, 48, 77, 0.10); }
.btn.ghost:hover:not(:disabled) { background: #faf6ed; }
.btn.soft { background: var(--teal-l); color: var(--teal-d); border-color: rgba(34, 169, 161, 0.22); }
.btn.danger { background: var(--red-d); color: #fff; border-color: #8f2c35; box-shadow: 0 4px 0 #8f2c35; }
.btn.violet { background: var(--violet); color: #fff; border-color: var(--violet-d); box-shadow: 0 4px 0 var(--violet-d); }
.btn.small { min-height: 34px; padding: 6px 11px; font-size: 11.5px; border-radius: 10px; }
.btn.big { min-height: 52px; padding: 13px 22px; font-size: 16px; border-radius: 15px; }
.btn.block { width: 100%; }
.btn.rowbtn { justify-content: flex-start; text-align: left; white-space: normal; min-height: 46px; }
.btn-ico { line-height: 1; }

/* ============================== GENERIC CONTENT ============================== */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title b { color: var(--ink); letter-spacing: -0.01em; text-transform: none; font-size: 15px; }
.muted { color: var(--muted); }
.small-text { font-size: 11.5px; line-height: 1.45; color: var(--ink-2); }
.tiny-text { font-size: 10px; color: var(--muted); font-weight: 600; }
.panel {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  box-shadow: var(--shadow-sm);
}
.panel.tinted { background: #f7fbf9; }
.panel.warn { background: #fff8ec; border-color: rgba(215, 165, 19, 0.28); }
.panel.danger { background: #fff5f5; border-color: rgba(226, 87, 93, 0.24); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.stack { display: grid; gap: 9px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.divider { height: 1.5px; background: var(--line); margin: 14px 0; border-radius: 2px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2f6f4;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip-tag.green { background: #e9f8e6; color: var(--green-d); border-color: rgba(104, 184, 92, 0.25); }
.chip-tag.gold { background: #fff7da; color: #7d600d; border-color: rgba(215, 165, 19, 0.25); }
.chip-tag.red { background: #fff0f0; color: var(--red-d); border-color: rgba(226, 87, 93, 0.22); }
.chip-tag.teal { background: var(--teal-l); color: var(--teal-d); border-color: rgba(34, 169, 161, 0.22); }
.chip-tag.violet { background: #f1edff; color: var(--violet-d); border-color: rgba(123, 107, 214, 0.22); }
.chip-tag.blue { background: #eaf3ff; color: #2f63b0; border-color: rgba(79, 143, 224, 0.25); }
.bar { height: 9px; border-radius: 999px; background: rgba(33, 48, 77, 0.10); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--green)); transition: width 0.4s; }
.bar.gold i { background: linear-gradient(90deg, #ffd34d, #ff9f43); }
.bar.rose i { background: linear-gradient(90deg, #ff9fc0, #ff6f91); }
.stat-tile {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.stat-tile small { display: block; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 2px; }
.stat-tile b { font-size: 21px; letter-spacing: -0.03em; display: block; }
.stat-tile span { font-size: 10.5px; color: var(--ink-2); font-weight: 700; }
.empty-state {
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
  padding: 26px 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
}
.empty-icon { font-size: 36px; }
.empty-state b { font-size: 15px; }
.empty-state p { margin: 0 0 6px; color: var(--muted); font-size: 12px; max-width: 360px; line-height: 1.45; }
.note-strip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 13px;
  background: #fff9e6;
  border: 1.5px solid rgba(215, 165, 19, 0.24);
  font-size: 11.5px;
  line-height: 1.45;
  font-weight: 600;
  color: #6e5b1d;
}
.note-strip.teal { background: var(--teal-l); border-color: rgba(34, 169, 161, 0.22); color: var(--teal-d); }
.note-strip.coral { background: #fff0e8; border-color: rgba(255, 122, 74, 0.25); color: #9c4525; }
.note-ico { font-size: 17px; line-height: 1.15; flex: none; }

/* tabs */
.tabbar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px;
  background: #f1f5f2;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  margin-bottom: 13px;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbtn {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 900;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}
.tabbtn:hover { background: rgba(255, 255, 255, 0.65); }
.tabbtn.active { background: #fff; color: var(--teal-d); box-shadow: 0 2px 7px rgba(33, 48, 77, 0.12); }

/* ============================== LEVEL / WORLD PANELS ============================== */
.inline-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #dfe9ff;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  font-size: 18px;
}
.speech-card {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: linear-gradient(180deg, #ffffff, #f7fbfa);
  border: 1.5px solid var(--line);
  border-radius: 18px 18px 18px 5px;
  padding: 13px;
}
.speech-card .inline-avatar { width: 44px; height: 44px; font-size: 22px; }
.speech-card b { font-size: 13px; display: block; }
.speech-card p { margin: 3px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); font-weight: 600; }
.npc-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--teal-l);
  color: var(--teal-d);
  border: 1px solid rgba(34, 169, 161, 0.2);
}
.quiz-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 12px 0 8px; }
.quiz-q {
  margin: 0;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.32;
  letter-spacing: -0.02em;
  font-weight: 900;
}
.answers { display: grid; gap: 8px; margin-top: 13px; }
.answer-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 52px;
  padding: 10px 13px;
  border-radius: 14px;
  border: 1.8px solid var(--line);
  background: #fff;
  text-align: left;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.answer-btn:hover:not(:disabled) { transform: translateX(3px); border-color: var(--teal); background: #fbfffe; }
.answer-btn .letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: #f3f6f4;
  border: 1.5px solid var(--line);
  font-size: 12px;
  font-weight: 900;
  color: var(--ink-2);
}
.answer-btn.correct { background: #e9f9e7; border-color: var(--green); }
.answer-btn.correct .letter { background: var(--green); color: #fff; border-color: var(--green-d); }
.answer-btn.wrong { background: #fff0f0; border-color: var(--red); }
.answer-btn.wrong .letter { background: var(--red); color: #fff; border-color: var(--red-d); }
.answer-btn.chosen { border-color: var(--ink-2); }
.answer-btn:disabled { cursor: default; opacity: 1; }
.feedback {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 13px;
  padding: 12px 13px;
  border-radius: 14px;
  background: #eefaf0;
  border: 1.5px solid rgba(104, 184, 92, 0.28);
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 600;
  color: #285b25;
  animation: popIn 0.2s ease;
}
.feedback.bad { background: #fff4f1; border-color: rgba(226, 87, 93, 0.25); color: #8d3434; }
.feedback .fb-ico { font-size: 22px; line-height: 1; }
.feedback b { display: block; margin-bottom: 2px; font-size: 13px; }
.reward-line { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 900; color: #8a6500; }
.reward-line .reward-big { font-size: 22px; letter-spacing: -0.02em; }
.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff3d4;
  border: 1px solid rgba(215, 165, 19, 0.3);
  color: #7d600d;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

/* ============================== SHOP / BUILD ============================== */
.shop-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 15px;
  background: #f3faf7;
  border: 1.5px solid rgba(34, 169, 161, 0.18);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.shop-bar .bar { flex: 1; min-width: 120px; }
.shop-bar b { font-size: 15px; }
.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.shop-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 15px;
  border: 1.8px solid var(--line);
  background: #fff;
  text-align: left;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.shop-item:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.shop-item.selected { border-color: var(--teal); background: #f6fffd; box-shadow: 0 0 0 3px rgba(34, 169, 161, 0.11); }
.shop-item.built { background: #f5faf3; border-color: rgba(104, 184, 92, 0.3); }
.shop-item.cant { opacity: 0.7; }
.shop-item .si-top { display: flex; align-items: center; gap: 8px; }
.shop-item .si-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 11px;
  background: #f3f6f4;
  border: 1px solid var(--line);
  font-size: 20px;
}
.shop-item b { font-size: 12.5px; line-height: 1.2; }
.shop-item p { margin: 0; font-size: 10.5px; line-height: 1.35; color: var(--muted); font-weight: 600; }
.shop-item .si-cost { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; font-size: 12px; font-weight: 900; }
.shop-item .si-cost .cost { color: #8a6500; }
.shop-item .si-badge { position: absolute; top: 8px; right: 8px; font-size: 9px; font-weight: 900; padding: 3px 6px; border-radius: 999px; }
.si-badge.required { background: #fff1d6; color: #8a6500; }
.si-badge.done { background: #e5f8e1; color: var(--green-d); }
.place-card {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eefbf8, #fff8e8);
  border: 2px dashed rgba(34, 169, 161, 0.4);
}
.place-card .pc-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: #fff;
  border: 1.5px solid var(--line);
  font-size: 27px;
}
.place-card b { display: block; font-size: 14px; }
.place-card p { margin: 2px 0 0; font-size: 11px; color: var(--ink-2); font-weight: 600; line-height: 1.4; }
.school-ready {
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff6d8, #e7fbf5);
  border: 2px solid rgba(34, 169, 161, 0.3);
  text-align: center;
}
.school-ready .sr-emoji { font-size: 38px; }
.school-ready h3 { margin: 3px 0 3px; font-size: 19px; letter-spacing: -0.02em; }
.school-ready p { margin: 0 0 9px; font-size: 12px; color: var(--ink-2); font-weight: 600; line-height: 1.4; }

/* ============================== CLASSROOM / TEACHER ============================== */
.teacher-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 17px;
  background: linear-gradient(135deg, #e9faf6, #fff6db);
  border: 1.5px solid rgba(34, 169, 161, 0.24);
  margin-bottom: 12px;
}
.teacher-hero .th-face {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: #fff;
  border: 1.5px solid var(--line);
  font-size: 25px;
}
.teacher-hero b { display: block; font-size: 15px; }
.teacher-hero p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-2); font-weight: 600; line-height: 1.4; }
.teacher-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.tool-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 15px;
  border: 1.8px solid var(--line);
  background: #fff;
  text-align: left;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.tool-card .tc-ico { flex: none; display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; background: #f3f7f5; font-size: 20px; }
.tool-card b { display: block; font-size: 12.5px; line-height: 1.2; }
.tool-card p { margin: 2px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.35; font-weight: 600; }
.tool-card .tc-badge { margin-top: 4px; display: inline-block; font-size: 9px; font-weight: 900; padding: 2px 6px; border-radius: 999px; background: #fff2d2; color: #8a6500; }
.register { display: grid; gap: 5px; }
.attend-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid var(--line);
}
.attend-row.absent-row { background: #fff9f2; border-color: rgba(226, 87, 93, 0.18); }
.attend-person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.attend-face {
  flex: none;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: #edf5f2;
  font-size: 15px;
}
.attend-person b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attend-person small { display: block; font-size: 9px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg { display: inline-flex; gap: 3px; padding: 2px; border-radius: 10px; background: #f2f5f3; border: 1px solid var(--line); }
.seg button {
  min-width: 34px;
  height: 28px;
  padding: 0 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 10px;
  font-weight: 900;
  color: var(--ink-2);
  transition: background 0.12s, color 0.12s;
}
.seg button:hover { background: rgba(255, 255, 255, 0.8); }
.seg button.on-p { background: var(--green); color: #fff; }
.seg button.on-a { background: var(--red); color: #fff; }
.seg button.on-l { background: var(--sun); color: #5f4800; }
.reason-row { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; padding-top: 2px; }
.reason-row label { font-size: 9.5px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.select {
  width: 100%;
  min-height: 36px;
  padding: 6px 9px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}
.register-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.summary-pill { font-size: 10.5px; font-weight: 900; padding: 5px 9px; border-radius: 999px; background: #f3f6f4; border: 1px solid var(--line); }
.summary-pill.p { background: #e9f8e5; color: var(--green-d); }
.summary-pill.a { background: #ffefef; color: var(--red-d); }
.summary-pill.l { background: #fff7da; color: #7d600d; }

.student-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.student-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: #fff;
  text-align: left;
  transition: transform 0.14s, border-color 0.14s;
}
.student-card:hover { transform: translateY(-1px); border-color: var(--teal); }
.student-card .sc-face {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 17px;
  border: 1.5px solid rgba(33, 48, 77, 0.10);
}
.student-card b { display: block; font-size: 11.5px; line-height: 1.2; }
.student-card small { display: block; font-size: 9.5px; color: var(--muted); font-weight: 700; }
.student-card .sc-score { margin-left: auto; flex: none; font-size: 11px; font-weight: 900; color: var(--teal-d); }
.student-card.absent { opacity: 0.55; background: #faf7f3; }
.student-card.hand { border-color: var(--sun); background: #fffbe9; box-shadow: 0 0 0 2px rgba(255, 211, 77, 0.22); }
.student-card.hand .sc-face { animation: handWave 1.1s ease-in-out infinite; }

.lesson-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.lesson-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 15px;
  border: 1.8px solid var(--line);
  background: #fff;
  text-align: left;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.lesson-card:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: var(--shadow-sm); }
.lesson-card b { font-size: 12.5px; line-height: 1.2; }
.lesson-card .lc-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.lesson-card .lc-points { font-size: 10px; color: var(--muted); font-weight: 700; }
.lesson-card.done { background: #f6fbf4; border-color: rgba(104, 184, 92, 0.28); }
.lesson-stage { display: grid; gap: 11px; }
.lesson-diagram {
  border-radius: 16px;
  background: linear-gradient(135deg, #eef8ff, #f7f3ff);
  border: 1.5px solid var(--line);
  padding: 10px;
  min-height: 150px;
  display: grid;
  place-items: center;
}
.lesson-diagram svg { width: 100%; max-width: 400px; height: auto; }
.lesson-points { display: grid; gap: 7px; }
.lesson-point {
  display: flex;
  gap: 9px;
  padding: 10px 11px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 600;
  color: var(--ink-2);
  animation: popIn 0.25s ease;
}
.lesson-point b { flex: none; display: grid; place-items: center; width: 21px; height: 21px; border-radius: 7px; background: var(--teal-l); color: var(--teal-d); font-size: 10px; }
.lesson-point.next {
  border-color: rgba(34, 169, 161, 0.4);
  background: #f2fffd;
  box-shadow: 0 0 0 3px rgba(34, 169, 161, 0.08);
}
.lesson-point.revealed { opacity: 1; }
.class-strip { display: flex; gap: 5px; flex-wrap: wrap; }
.mini-student {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 800;
  padding: 4px 7px;
  border-radius: 999px;
  background: #f4f7f5;
  border: 1px solid var(--line);
}
.mini-student.hand { background: #fff6cf; border-color: rgba(215, 165, 19, 0.3); }

.hw-list { display: grid; gap: 8px; }
.hw-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
}
.hw-card .hw-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #fff3da; font-size: 18px; }
.hw-card b { display: block; font-size: 12.5px; }
.hw-card p { margin: 2px 0 4px; font-size: 10.5px; color: var(--muted); font-weight: 600; line-height: 1.35; }
.hw-card .hw-actions { margin-left: auto; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.hw-paper {
  position: relative;
  background:
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(79, 143, 224, 0.14) 31px 32.5px),
    #fffef9;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px 16px 42px;
  box-shadow: inset 3px 0 0 rgba(226, 87, 93, 0.35);
}
.hw-paper::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(226, 87, 93, 0.25);
}
.hw-paper-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; border-bottom: 1.5px dashed var(--line-strong); padding-bottom: 8px; }
.hw-paper-head b { font-size: 15px; }
.hw-paper-head small { display: block; font-size: 10px; color: var(--muted); font-weight: 700; }
.hw-q { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.hw-q:last-child { border-bottom: 0; }
.hw-q .hq-top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.hw-q .hq-num { flex: none; font-size: 10px; font-weight: 900; color: var(--muted); padding-top: 2px; }
.hw-q .hq-text { flex: 1; font-size: 12.5px; font-weight: 700; line-height: 1.4; }
.hw-q .hq-answer { margin-top: 5px; display: flex; align-items: flex-start; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.hw-q .hq-answer .ans-letter { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: #eef3f0; font-size: 9px; font-weight: 900; }
.hw-q .hq-answer.correct { color: #2d6a32; }
.hw-q .hq-answer.wrong { color: #a3353f; }
.hw-q .hq-mark { flex: none; display: flex; gap: 4px; align-items: center; }
.mark-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 15px;
  font-weight: 900;
  color: var(--muted);
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
}
.mark-btn:hover { transform: scale(1.06); }
.mark-btn.right.on { background: #e9f8e5; border-color: var(--green); color: var(--green-d); }
.mark-btn.wrongmark.on { background: #ffefef; border-color: var(--red); color: var(--red-d); }
.red-pen {
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  color: #c4363f;
  transform: rotate(-1.5deg);
}
.paper-mark {
  position: absolute;
  right: 16px;
  top: 12px;
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  font-size: 34px;
  font-weight: 900;
  color: #c4363f;
  transform: rotate(-9deg);
  border: 3px solid rgba(196, 54, 63, 0.7);
  border-radius: 12px;
  padding: 0 8px;
  opacity: 0.9;
  pointer-events: none;
}
.comment-box { width: 100%; min-height: 76px; resize: vertical; padding: 9px 11px; border-radius: 11px; border: 1.5px solid var(--line); background: #fff; font-size: 12px; line-height: 1.5; font-weight: 600; }
.comment-box.red { border-color: rgba(226, 87, 93, 0.3); color: #8d3434; font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; font-size: 13px; }
.grade-badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 7px;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 900;
  background: #eef7ee;
  color: var(--green-d);
  border: 1.5px solid rgba(104, 184, 92, 0.25);
}
.grade-badge.b { background: #eef5ff; color: #2f63b0; border-color: rgba(79, 143, 224, 0.25); }
.grade-badge.c { background: #fff7e4; color: #8a6500; border-color: rgba(215, 165, 19, 0.25); }
.grade-badge.d { background: #fff0e8; color: #9c4525; border-color: rgba(255, 122, 74, 0.25); }
.grade-badge.f { background: #ffefef; color: var(--red-d); border-color: rgba(226, 87, 93, 0.25); }

.exam-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border-radius: 17px;
  background: linear-gradient(135deg, #eef1ff, #fff8ea);
  border: 1.5px solid rgba(123, 107, 214, 0.22);
  margin-bottom: 11px;
}
.exam-banner .ex-ico { flex: none; display: grid; place-items: center; width: 47px; height: 47px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); font-size: 24px; }
.exam-banner b { display: block; font-size: 15px; }
.exam-banner p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-2); font-weight: 600; line-height: 1.4; }
.exam-timer { margin-left: auto; flex: none; font-size: 19px; font-weight: 900; letter-spacing: -0.02em; color: var(--violet-d); font-variant-numeric: tabular-nums; }
.supervise-task {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.supervise-task .sup-ico { font-size: 18px; }
.supervise-task.done { background: #f4fbf2; border-color: rgba(104, 184, 92, 0.24); color: var(--green-d); }
.supervise-task .btn { margin-left: auto; }

.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.report-card {
  background: #fffef8;
  border: 2px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px;
  position: relative;
  overflow: hidden;
}
.report-card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(33, 48, 77, 0.13);
  border-radius: 9px;
  pointer-events: none;
}
.report-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.report-card-head .rc-face { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-size: 16px; background: #eef6f3; }
.report-card-head b { font-size: 12.5px; }
.report-card-head small { display: block; font-size: 9px; color: var(--muted); font-weight: 700; }
.report-card-head .grade-badge { margin-left: auto; }
.report-lines { display: grid; gap: 4px; margin-top: 6px; }
.report-line { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; font-weight: 700; color: var(--ink-2); }
.report-line b { color: var(--ink); }
.report-comment { margin-top: 7px; font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; font-size: 11px; color: #8d3434; line-height: 1.4; border-top: 1px dashed var(--line); padding-top: 6px; }

/* ============================== CALENDAR ============================== */
.calendar-hero {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 13px;
  border-radius: 17px;
  background: linear-gradient(135deg, #e8f8ff, #fff8e9);
  border: 1.5px solid var(--line);
  margin-bottom: 12px;
}
.calendar-hero .cal-big { font-size: 33px; }
.calendar-hero b { display: block; font-size: 16px; letter-spacing: -0.02em; }
.calendar-hero p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.calendar-hero .cal-date { margin-left: auto; text-align: right; font-size: 10.5px; font-weight: 800; color: var(--muted); }
.week-strip { display: flex; gap: 4px; margin: 9px 0 13px; }
.week-day {
  flex: 1;
  text-align: center;
  padding: 7px 3px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 9px;
  font-weight: 900;
  color: var(--muted);
}
.week-day.today { background: var(--ink); color: #fff; border-color: var(--ink); }
.week-day.past { background: #eef8ee; border-color: rgba(104, 184, 92, 0.22); color: var(--green-d); }
.week-day.holiday { background: #fff4d8; border-color: rgba(215, 165, 19, 0.25); color: #7d600d; }
.term-list { display: grid; gap: 8px; }
.term-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
}
.term-card.current { border-color: var(--teal); background: #f4fffc; box-shadow: 0 0 0 3px rgba(34, 169, 161, 0.08); }
.term-badge { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--teal-l); color: var(--teal-d); font-size: 12px; font-weight: 900; }
.term-card b { display: block; font-size: 12.5px; }
.term-card p { margin: 2px 0 0; font-size: 10.5px; color: var(--muted); font-weight: 600; line-height: 1.4; }
.term-card .term-holiday { margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 800; color: #8a6500; background: #fff6dc; padding: 3px 7px; border-radius: 999px; }
.term-card .term-status { margin-left: auto; font-size: 9px; font-weight: 900; color: var(--muted); white-space: nowrap; }
.timetable { display: grid; gap: 4px; }
.tt-row { display: grid; grid-template-columns: 74px 1fr; gap: 8px; font-size: 11px; padding: 6px 8px; border-radius: 8px; background: #f8faf8; border: 1px solid var(--line); }
.tt-row b { font-size: 10px; color: var(--teal-d); }
.tt-row.now { background: #fff8e4; border-color: rgba(215, 165, 19, 0.3); }
.holiday-hero {
  text-align: center;
  padding: 22px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff3d2, #e9f9ff);
  border: 1.8px dashed rgba(215, 165, 19, 0.4);
}
.holiday-hero .hh-emoji { font-size: 48px; }
.holiday-hero h3 { margin: 8px 0 3px; font-size: 22px; letter-spacing: -0.03em; }
.holiday-hero p { margin: 0 auto; max-width: 470px; font-size: 12px; color: var(--ink-2); line-height: 1.5; font-weight: 600; }
.holiday-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.holiday-opt {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 11px;
  border-radius: 14px;
  border: 1.8px solid var(--line);
  background: #fff;
  text-align: left;
  transition: transform 0.14s, border-color 0.14s;
}
.holiday-opt:hover { transform: translateY(-2px); border-color: var(--teal); }
.holiday-opt .ho-ico { font-size: 23px; flex: none; }
.holiday-opt b { display: block; font-size: 12px; }
.holiday-opt p { margin: 2px 0 0; font-size: 10px; line-height: 1.35; color: var(--muted); font-weight: 600; }
.holiday-opt.done { background: #f3fbf1; border-color: rgba(104, 184, 92, 0.3); }

/* ============================== SCIENCE BOOK ============================== */
.book-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-bottom: 11px; }
.book-stat { text-align: center; padding: 8px 5px; border-radius: 11px; background: #fff; border: 1.5px solid var(--line); }
.book-stat b { display: block; font-size: 18px; letter-spacing: -0.03em; }
.book-stat small { font-size: 8.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.book-filters { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 3px; margin-bottom: 10px; scrollbar-width: none; }
.book-filters::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 10px;
  font-weight: 900;
  color: var(--ink-2);
  white-space: nowrap;
}
.filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.book-search {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}
.book-list { display: grid; gap: 7px; }
.fact-card {
  padding: 11px 12px;
  border-radius: 13px;
  background: #fff;
  border: 1.5px solid var(--line);
}
.fact-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.fact-top b { font-size: 12px; line-height: 1.35; }
.fact-why { margin: 5px 0 0; font-size: 11px; line-height: 1.45; color: var(--ink-2); font-weight: 600; }
.fact-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.fact-answer { font-size: 10.5px; font-weight: 800; color: var(--green-d); background: #eef9eb; padding: 3px 7px; border-radius: 6px; }
.fact-card.wrong-card .fact-answer { color: var(--red-d); background: #fff0f0; }
.book-progress { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; font-size: 10.5px; font-weight: 800; color: var(--muted); }

/* ============================== EXPERIMENTS ============================== */
.lab-wrap { display: grid; gap: 10px; }
.lab-stage {
  position: relative;
  min-height: 190px;
  border-radius: 18px;
  border: 1.5px solid var(--line);
  background: linear-gradient(160deg, #eaf9ff, #f7f4ff);
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}
.lab-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(33, 48, 77, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.55;
}
.lab-art { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: center; gap: 14px; height: 140px; }
.lab-art .jar {
  position: relative;
  width: 72px;
  height: 96px;
  border: 3px solid rgba(79, 143, 224, 0.4);
  border-top: 0;
  border-radius: 5px 5px 16px 16px;
  background: rgba(255, 255, 255, 0.48);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.lab-art .jar .water { width: 100%; height: 55%; background: linear-gradient(180deg, #7ed8f0, #38a7d9); transition: height 0.6s ease; }
.lab-art .seed {
  position: absolute;
  left: 50%;
  bottom: 20%;
  width: 16px;
  height: 22px;
  transform: translateX(-50%) rotate(-8deg);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: #8d5a3b;
  transition: all 0.8s ease;
}
.lab-art .sprout {
  position: absolute;
  left: 50%;
  bottom: 32%;
  width: 4px;
  height: 0;
  background: #5aa84f;
  transform: translateX(-50%);
  transition: height 0.8s ease;
  border-radius: 4px;
}
.lab-art .sprout::before, .lab-art .sprout::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 12px;
  background: #6fbf5f;
  border-radius: 50% 50% 50% 0;
  top: -2px;
}
.lab-art .sprout::before { left: -22px; transform: rotate(20deg); }
.lab-art .sprout::after { right: -22px; transform: scaleX(-1) rotate(20deg); }
.lab-art .magnet {
  width: 54px;
  height: 70px;
  border: 14px solid #d94b5d;
  border-top: 0;
  border-radius: 0 0 50px 50px;
  position: relative;
}
.lab-art .magnet::before, .lab-art .magnet::after {
  content: ""; position: absolute; bottom: -14px; width: 14px; height: 20px; background: #dfe6ea;
}
.lab-art .magnet::before { left: -14px; }
.lab-art .magnet::after { right: -14px; }
.lab-art .bulb { width: 58px; height: 72px; border-radius: 50% 50% 42% 42%; background: radial-gradient(circle at 38% 32%, #fffbe0, #ffd34d 60%, #e8a900); box-shadow: 0 0 26px rgba(255, 211, 77, 0.65); border: 2px solid rgba(33, 48, 77, 0.12); }
.lab-art .bulb.off { background: #e8eef1; box-shadow: none; }
.lab-art .battery { width: 74px; height: 40px; border-radius: 6px; background: linear-gradient(180deg, #3c4e68, #22304a); position: relative; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.12); }
.lab-art .battery::after { content: ""; position: absolute; right: -10px; top: 12px; width: 10px; height: 16px; background: #cfd6d9; border-radius: 0 3px 3px 0; }
.lab-art .wire { width: 46px; height: 3px; background: #b63a32; align-self: center; }
.lab-art .object { width: 48px; height: 34px; border-radius: 6px; background: #a06a3f; align-self: center; }
.lab-art .object.ball { border-radius: 50%; background: #ff9f43; width: 42px; height: 42px; }
.lab-art .object.plastic { background: #7fd8cf; }
.lab-art .object.metal { background: #b9c6cf; box-shadow: inset -6px -6px 0 rgba(0,0,0,0.1); }
.lab-art .cloud { font-size: 44px; }
.lab-art .raindrop { font-size: 18px; animation: rainDrop 1.4s linear infinite; }
.lab-art .sunny { font-size: 42px; }
.lab-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.lab-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1.8px solid var(--line);
  background: #fff;
  font-size: 11.5px;
  font-weight: 800;
  text-align: left;
  line-height: 1.3;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.lab-choice:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--teal); background: #fafffd; }
.lab-choice .lc-letter { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: #f1f5f2; font-size: 10px; font-weight: 900; }
.lab-choice.correct { background: #eaf9e6; border-color: var(--green); }
.lab-choice.wrong { background: #fff0f0; border-color: var(--red); }
.lab-fact { animation: popIn 0.25s ease; }
.lab-progress { display: flex; gap: 5px; }
.lab-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(33, 48, 77, 0.16); }
.lab-dot.done { background: var(--teal); }
.lab-dot.now { background: var(--sun); box-shadow: 0 0 0 3px rgba(255, 211, 77, 0.22); }

/* ============================== OFFICE / ACTIVITIES ============================== */
.office-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.office-card {
  padding: 11px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  text-align: left;
  transition: transform 0.14s, border-color 0.14s;
}
.office-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.office-card .oc-top { display: flex; align-items: center; gap: 8px; }
.office-card .oc-ico { font-size: 20px; }
.office-card b { font-size: 12px; }
.office-card p { margin: 4px 0 0; font-size: 10px; color: var(--muted); line-height: 1.35; font-weight: 600; }
.seating-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seating-opt {
  padding: 11px 9px;
  border-radius: 13px;
  border: 1.8px solid var(--line);
  background: #fff;
  text-align: center;
  transition: transform 0.14s, border-color 0.14s;
}
.seating-opt:hover { transform: translateY(-2px); border-color: var(--teal); }
.seating-opt .so-icon { font-size: 26px; }
.seating-opt b { display: block; font-size: 11px; margin-top: 3px; }
.seating-opt p { margin: 2px 0 0; font-size: 9px; color: var(--muted); line-height: 1.3; font-weight: 600; }
.seating-opt.current { border-color: var(--teal); background: var(--teal-l); }
.supply-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.supply-item { display: flex; gap: 9px; align-items: center; padding: 10px; border-radius: 13px; border: 1.5px solid var(--line); background: #fff; }
.supply-item .sup-ico { font-size: 22px; flex: none; }
.supply-item b { display: block; font-size: 11.5px; }
.supply-item small { display: block; font-size: 9.5px; color: var(--muted); font-weight: 700; }
.supply-item .btn { margin-left: auto; }
.plan-list { display: grid; gap: 5px; }
.plan-row { display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 9px; background: #f8faf8; font-size: 10.5px; font-weight: 700; color: var(--ink-2); }
.plan-row .tick { color: var(--green-d); font-weight: 900; }
.plan-row .muted { margin-left: auto; font-size: 9px; }

/* ============================== CELEBRATION / YEAR END ============================== */
.celebration { text-align: center; }
.celebration .cel-emoji { font-size: clamp(54px, 9vw, 88px); animation: bob 2s ease-in-out infinite; }
.celebration h2 { margin: 4px 0 6px; font-size: clamp(24px, 4vw, 36px); letter-spacing: -0.04em; }
.celebration p { margin: 0 auto 12px; max-width: 560px; color: var(--ink-2); font-size: 13px; line-height: 1.55; font-weight: 600; }
.cel-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.cel-stat { background: #fff; border: 1.5px solid var(--line); border-radius: 13px; padding: 10px 8px; }
.cel-stat b { display: block; font-size: 22px; letter-spacing: -0.03em; }
.cel-stat small { font-size: 9px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.year-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd34d, #ffb03a);
  color: #4b3600;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 4px 0 rgba(203, 156, 0, 0.5);
  margin-bottom: 10px;
}

/* ============================== CONFETTI / ANIMATIONS ============================== */
.confetti { position: fixed; inset: 0; z-index: 150; pointer-events: none; overflow: hidden; }
.confetti-piece {
  position: absolute;
  top: -8vh;
  animation: confettiFall 2.4s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  will-change: transform, opacity;
}
.confetti-piece.emoji { font-size: 20px; background: none !important; width: auto !important; height: auto !important; }

@keyframes confettiFall {
  0% { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; }
  100% { transform: translate3d(var(--drift, 0px), 108vh, 0) rotate(var(--spin, 360deg)); opacity: 0.85; }
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes floaty { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes bootSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(240%); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes popIn { 0% { opacity: 0; transform: translateY(6px) scale(0.98); } 100% { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(10px) scale(0.985); } }
@keyframes coinFloat { 0% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -44px); } }
@keyframes dockPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 122, 74, 0.45); } 50% { box-shadow: 0 0 0 7px rgba(255, 122, 74, 0); } }
@keyframes highlightPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 211, 77, 0.65); } 50% { box-shadow: 0 0 0 8px rgba(255, 211, 77, 0); background: rgba(255, 246, 207, 0.9); } }
@keyframes handWave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }
@keyframes rainDrop { 0% { transform: translateY(-10px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(46px); opacity: 0; } }

/* ============================== RESPONSIVE ============================== */
@media (max-width: 1120px) {
  .title-inner { grid-template-columns: minmax(0, 1fr) minmax(340px, 0.92fr); gap: 24px; }
  .game-logo { font-size: clamp(42px, 6vw, 70px); }
  .hud-aside { width: 268px; }
  .obj-body p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .title-deco .deco.g, .title-deco .deco.h { display: none; }
}
@media (max-width: 900px) {
  .title-inner { grid-template-columns: 1fr; gap: 22px; margin-top: 14px; align-items: start; }
  .title-copy { padding: 0; }
  .game-logo { font-size: clamp(44px, 10vw, 78px); }
  .tagline { margin: 14px 0 14px; max-width: 640px; }
  .title-steps { margin-bottom: 4px; }
  .level-panel { max-height: none; }
  .title-screen { padding-bottom: 28px; }
  .title-footer { margin-top: 18px; }
  .deco.a, .deco.e { display: none; }
  .hud-aside { top: 72px; width: 250px; }
  .objective-card { padding: 10px 11px; }
  .obj-icon { width: 33px; height: 33px; font-size: 17px; }
  .obj-body p { display: none; }
  .obj-progress-text { display: none; }
  .day-card { padding: 10px; }
  .task-list { margin: 8px 0; }
  .brand-text b { max-width: 100px; }
  .date-chip .chip-label { max-width: 118px; overflow: hidden; text-overflow: ellipsis; }
  .report-grid { grid-template-columns: 1fr; }
  .hud-right { gap: 5px; }
}
@media (max-width: 720px) {
  .hud-top { padding: 9px 8px 0; gap: 6px; align-items: flex-start; }
  .hud-left { gap: 5px; }
  .hud-right { gap: 4px; }
  .brand-chip { padding: 5px 8px 5px 5px; border-radius: 13px; }
  .brand-ico { width: 30px; height: 30px; font-size: 17px; border-radius: 9px; }
  .brand-text small { display: none; }
  .brand-text b { font-size: 11.5px; max-width: 92px; }
  .pill { padding: 6px 9px; font-size: 11.5px; gap: 4px; }
  .level-pill { display: none; }
  .clock-chip { display: none; }
  .date-chip .chip-label { font-size: 10.5px; max-width: 106px; }
  .icon-btn { width: 34px; height: 34px; border-radius: 11px; font-size: 15px; }
  #helpBtn { display: none; }
  .hud-aside { top: 62px; left: 8px; width: min(232px, calc(100vw - 58px)); gap: 6px; }
  .objective-card { padding: 9px 10px; gap: 8px; border-radius: 14px; }
  .obj-icon { width: 29px; height: 29px; font-size: 15px; border-radius: 9px; }
  .obj-body small { font-size: 7.5px; }
  .obj-body b { font-size: 11.5px; }
  .obj-progress { height: 5px; }
  .day-card { border-radius: 14px; }
  .day-head small { font-size: 7.5px; }
  .day-head b { font-size: 11px; }
  .day-date { display: none; }
  .task-row { font-size: 10px; }
  .action-bar {
    left: auto;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(54px, 1fr));
    gap: 4px;
    padding: 5px;
    border-radius: 17px;
  }
  .dock-btn { min-width: 50px; height: 46px; font-size: 8.5px; border-radius: 12px; padding: 3px 5px; }
  .dock-btn .dock-ico { font-size: 18px; }
  .prompt { bottom: 122px; }
  .prompt-btn { font-size: 12.5px; padding: 9px 15px 9px 10px; }
  .coach { bottom: 190px; }
  .toasts { top: 56px; }
  .save-dot { top: 52px; right: 9px; font-size: 8.5px; }
  .interact-hint { display: none; }
  .modal-root { padding: 0; align-items: flex-end; }
  .modal-card, .modal-card.wide, .modal-card.narrow { width: 100%; max-height: 93dvh; border-radius: 22px 22px 0 0; border-bottom: 0; animation: modalUp 0.25s cubic-bezier(0.22, 1, 0.36, 1); }
  .modal-card::after { inset: 6px; border-radius: 17px; border-bottom: 0; }
  .modal-head { padding: 14px 15px 10px; gap: 9px; }
  .modal-icon { width: 36px; height: 36px; font-size: 19px; border-radius: 11px; }
  .modal-titles h2 { font-size: 18px; }
  .modal-titles p { font-size: 11px; }
  .modal-body { padding: 13px 14px 16px; }
  .modal-actions { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); gap: 6px; }
  .modal-actions .btn { flex: 1 1 auto; min-height: 40px; font-size: 12px; padding: 8px 11px; }
  .shop-grid { grid-template-columns: 1fr; }
  .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teacher-tools { grid-template-columns: 1fr; }
  .student-grid { grid-template-columns: 1fr; }
  .lesson-grid { grid-template-columns: 1fr; }
  .holiday-grid { grid-template-columns: 1fr; }
  .office-grid { grid-template-columns: 1fr; }
  .lab-choice-grid { grid-template-columns: 1fr; }
  .seating-grid { grid-template-columns: 1fr; }
  .supply-grid { grid-template-columns: 1fr; }
  .cel-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-strip { gap: 3px; }
  .week-day { font-size: 8px; padding: 6px 2px; }
  .title-screen { padding: 12px 12px 24px; }
  .title-topbar { margin-bottom: 4px; }
  .back-link { font-size: 12px; padding: 7px 10px; }
  .game-logo { font-size: clamp(40px, 12vw, 64px); }
  .eyebrow { font-size: 10px; padding: 5px 9px; margin-bottom: 10px; }
  .tagline { font-size: 14.5px; line-height: 1.5; }
  .title-chips span { font-size: 11px; padding: 6px 9px; }
  .title-steps { gap: 10px; }
  .title-steps div { font-size: 11px; }
  .title-steps b { width: 21px; height: 21px; font-size: 10px; }
  .title-footer { font-size: 10px; gap: 5px; }
  .title-footer .dot { display: none; }
  .level-panel { border-radius: 22px; padding: 15px; }
  .level-panel::before { inset: 5px; border-radius: 18px; }
  .level-grid { gap: 5px; }
  .level-btn { min-height: 54px; padding: 8px; }
  .level-btn b { font-size: 12.5px; }
  .level-btn small { font-size: 9px; }
  .level-btn .lvl-emoji { font-size: 16px; }
  .title-deco { display: none; }
  .hud .day-card { display: none; }
}
@media (max-width: 480px) {
  .brand-text { display: none; }
  .brand-chip { padding: 5px; }
  .date-chip { padding: 6px 8px; }
  .date-chip .chip-label {
    max-width: 112px;
    white-space: pre-line;
    line-height: 1.22;
    overflow: hidden;
    text-overflow: clip;
  }
  .hud-right .icon-btn { width: 32px; height: 32px; }
  #bookBtnTop { display: none; }
  .action-bar { grid-template-columns: repeat(3, 52px); }
  .dock-btn { min-width: 48px; height: 44px; }
  .prompt { bottom: 118px; }
  .coach { bottom: 182px; }
  .coach-main p { font-size: 11px; }
  .modal-actions .btn { font-size: 11.5px; min-height: 38px; }
  .attend-row { grid-template-columns: 1fr; gap: 5px; }
  .attend-row .seg { justify-self: stretch; }
  .seg button { flex: 1; }
  .reason-row { grid-column: 1; }
  .shop-item .si-top { align-items: flex-start; }
  .answer-btn { font-size: 12.5px; padding: 9px 10px; min-height: 48px; }
  .game-logo { font-size: clamp(37px, 12.5vw, 56px); }
  .logo-flask { border-radius: 22%; }
  .week-day { font-size: 7px; }
  .cel-stats { grid-template-columns: 1fr 1fr; }
}
@media (pointer: coarse) {
  .joystick { display: block; }
  .interact-hint { display: none; }
  .dock-btn { min-width: 54px; }
}
@media (pointer: coarse) and (max-width: 480px) {
  .action-bar { grid-template-columns: repeat(3, 50px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============================== PLACEMENT PREVIEW BAR ============================== */
.place-bar {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 65;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(640px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.98);
  border: 2px solid rgba(33, 48, 77, 0.14);
  box-shadow: 0 18px 44px rgba(22, 38, 67, 0.28), 0 4px 0 rgba(33, 48, 77, 0.08);
  animation: placeBarIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes placeBarIn {
  from { opacity: 0; transform: translate(-50%, 18px) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.pb-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  font-size: 25px;
  border-radius: 14px;
  background: linear-gradient(160deg, #d9f6f2, #fff3c9);
  border: 1px solid rgba(34, 169, 161, 0.22);
}
.pb-copy { flex: 1; min-width: 0; display: grid; gap: 0; }
.pb-copy small { font-size: 8.5px; font-weight: 900; letter-spacing: 0.14em; color: var(--teal-d); }
.pb-copy b { font-size: 14px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-copy span { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.pb-actions { display: flex; gap: 6px; flex: 0 0 auto; }
@media (max-width: 620px) {
  .place-bar { bottom: calc(78px + env(safe-area-inset-bottom)); gap: 8px; padding: 8px 9px; border-radius: 15px; }
  .pb-icon { width: 38px; height: 38px; flex-basis: 38px; font-size: 20px; border-radius: 11px; }
  .pb-copy b { font-size: 12px; }
  .pb-copy span { font-size: 9.5px; }
  .pb-actions { flex-direction: column; }
  .pb-actions .btn { min-height: 30px; padding: 4px 9px; font-size: 10px; }
}
