/*
  SafeSteps global UI stylesheet.
  Shared styling for kids game, parent dashboard, and teacher dashboard.
*/
:root {
  --bg: #eef3f9;
  --bg-alt: #f7fafc;
  --panel: #ffffff;
  --text: #1f2a37;
  --muted: #4f5d75;
  --border: #d9e2ec;
  --primary: #2f6ea8;
  --primary-hover: #255a88;
  --success: #2f855a;
  --danger: #b54747;
  --accent-soft: #e8f1fb;
  --btn-v-pad: 9px;
  --btn-h-pad: 12px;
  --btn-font: 14px;
  --btn-radius: 9px;
  --btn-min-height: 36px;
}

* {
  box-sizing: border-box;
}

img,
svg,
canvas,
video {
  max-width: 100%;
  height: auto;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* Prevent accidental text selection across app screens. */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Keep form and editable controls selectable for usability. */
input,
textarea,
select,
option,
[contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

:focus-visible {
  outline: 3px solid #3d7cb2;
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: #ffffff;
  color: #1f2a37;
  border: 1px solid #b7cbe0;
  border-radius: 8px;
  padding: 6px 10px;
  z-index: 1000;
}

.skip-link:focus {
  left: 10px;
}

.lang-switch-row {
  max-width: 720px;
  margin: 0 auto 8px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.lang-switch-row label {
  margin: 0;
  font-size: 13px;
}

.lang-switch-row select {
  max-width: 160px;
}

body {
  font-family: "Verdana", "Tahoma", "Arial", sans-serif;
  font-style: normal;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg), var(--bg-alt));
  min-height: 100vh;
  text-align: center;
  padding: 16px 16px 64px;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

body.kids-page {
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 228, 181, 0.65), transparent 30%),
    radial-gradient(circle at 88% 14%, rgba(181, 232, 255, 0.7), transparent 32%),
    linear-gradient(180deg, #eef6ff, #fff6ea);
}

body.kids-page.kids-avatar-theme-forest {
  background:
    radial-gradient(circle at 14% 18%, rgba(166, 232, 190, 0.52), transparent 30%),
    radial-gradient(circle at 84% 14%, rgba(197, 242, 180, 0.46), transparent 30%),
    linear-gradient(180deg, #edfbee, #f8fff3);
}

body.kids-page.kids-avatar-theme-ocean {
  background:
    radial-gradient(circle at 16% 16%, rgba(170, 225, 255, 0.56), transparent 32%),
    radial-gradient(circle at 86% 14%, rgba(153, 212, 255, 0.45), transparent 28%),
    linear-gradient(180deg, #e9f7ff, #f3fbff);
}

body.kids-page.kids-avatar-theme-space {
  background:
    radial-gradient(circle at 82% 16%, rgba(208, 190, 255, 0.4), transparent 28%),
    radial-gradient(circle at 12% 14%, rgba(183, 205, 255, 0.34), transparent 30%),
    linear-gradient(180deg, #eef1ff, #f7f8ff);
}

body.kids-page.kids-avatar-theme-sunrise {
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 218, 176, 0.5), transparent 30%),
    radial-gradient(circle at 84% 14%, rgba(255, 200, 173, 0.36), transparent 28%),
    linear-gradient(180deg, #fff2e5, #fff9f2);
}

h1,
h2,
h3,
h4,
p,
label,
span,
button,
input,
a {
  font-style: normal;
}

h1 {
  margin: 12px 0 6px;
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.2;
}

.report-banner {
  max-width: 1000px;
  margin: 8px auto 14px;
  padding: 14px 18px;
  border-radius: 14px;
  color: #fff;
  text-align: left;
  box-shadow: 0 8px 22px rgba(31, 42, 55, 0.18);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.report-banner h1 {
  margin: 0;
  color: #eef5ff;
  font-size: clamp(17px, 2.1vw, 21px);
}

.report-banner p {
  margin: 6px 0 0;
  font-size: 12px;
  color: #f7fbff;
  opacity: 0.9;
}

.teacher-banner {
  background-image:
    linear-gradient(120deg, rgba(37, 90, 136, 0.9), rgba(75, 135, 187, 0.86)),
    url("/assets/images/banner-teacher.svg");
}

.parent-banner {
  background-image:
    linear-gradient(120deg, rgba(47, 110, 168, 0.88), rgba(91, 155, 213, 0.84)),
    url("/assets/images/banner-parent.svg");
}

.school-banner {
  background-image:
    linear-gradient(120deg, rgba(114, 96, 173, 0.9), rgba(154, 137, 205, 0.86)),
    url("/assets/images/banner-school.svg");
}

body.parent-page .report-banner h1 {
  font-size: clamp(17px, 2.1vw, 21px);
}

.brand-header {
  max-width: 1000px;
  margin: 0 auto 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  background: #f5f8fc;
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
}

.brand-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  border: none;
}

.brand-text {
  text-align: left;
  line-height: 1.2;
  color: #20354b;
}

.centered-brand {
  text-align: left;
}

.dashboard-main-title {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 900;
  letter-spacing: 0.2px;
  color: #255a88;
}

.numirai-title {
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, #4682b4, #6a5acd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtle-text {
  font-size: 13px;
  color: var(--muted);
}

.dashboard-subtitle {
  font-size: 12px;
  color: rgba(235, 244, 255, 0.9);
  font-weight: 500;
}

.brand-feedback {
  position: absolute;
  right: 12px;
  top: 8px;
  font-size: 12px;
  color: #5b5ea6;
  opacity: 0.9;
}

.brand-feedback:hover {
  opacity: 1;
}

.feedback-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px;
  font-size: 12px;
  text-align: center;
  color: #445668;
  background: rgba(247, 250, 252, 0.95);
  border-top: 1px solid #d5e0ea;
  z-index: 40;
}

.feedback-footer a {
  color: #2f6ea8;
  font-weight: 700;
}

.powered-by {
  font-size: 12px;
  font-style: italic;
  margin-bottom: 2px;
}

.side-rail {
  position: fixed;
  top: 170px;
  width: 240px;
  max-height: calc(100vh - 210px);
  overflow: hidden;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(31, 42, 55, 0.1);
  z-index: 25;
  text-align: left;
}

/* Professional colorful layout for parent/teacher/ai pages */
body.teacher-page {
  background:
    radial-gradient(circle at 10% 10%, rgba(144, 188, 231, 0.2), transparent 25%),
    linear-gradient(180deg, #eef6ff, #f8fbff);
}

body.parent-page {
  background:
    radial-gradient(circle at 88% 12%, rgba(169, 218, 201, 0.2), transparent 24%),
    linear-gradient(180deg, #f2fbf8, #fbfffd);
}

body.school-page {
  background:
    radial-gradient(circle at 12% 14%, rgba(197, 182, 232, 0.2), transparent 24%),
    linear-gradient(180deg, #f5f2ff, #fcfbff);
}

body.kid-dash-page {
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 214, 153, 0.35), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(145, 208, 255, 0.35), transparent 30%),
    linear-gradient(180deg, #eef7ff, #f8fcff);
}

body.kid-dash-page .brand-header {
  background: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
  justify-content: center !important;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-top: 6px;
  padding-bottom: 6px;
}

body.kid-dash-page .brand-logo {
  width: 102px;
  height: 102px;
}

body.kid-dash-page .brand-text {
  text-align: center;
}

body.kid-dash-page .dashboard-main-title {
  font-size: clamp(22px, 3.1vw, 30px);
  color: #274f73;
}

body.kid-dash-page .dashboard-main-title::before {
  content: "🧒";
  display: inline-block;
  margin-right: 8px;
  line-height: 1;
  vertical-align: middle;
}

body.kid-dash-page .dashboard-subtitle {
  color: #4b6a85;
}

body.kid-dash-page .kid-dashboard-shell {
  padding: 12px;
  border-radius: 18px;
}

body.kid-dash-page .kid-console-layout {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  background: linear-gradient(180deg, #f0f3f8, #f7f9fd);
  border: 1px solid #d7e0ec;
  border-radius: 20px;
  padding: 14px;
}

body.kid-dash-page .kid-left-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ff4f85, #ff6f53);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

body.kid-dash-page .kid-nav-item {
  border-radius: 10px;
  min-height: 62px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  color: #fff;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

body.kid-dash-page .kid-nav-item span {
  font-size: 18px;
  line-height: 1;
}

body.kid-dash-page .kid-nav-item small {
  font-size: 10px;
  letter-spacing: 0.2px;
  font-weight: 700;
}

body.kid-dash-page .kid-nav-item:hover,
body.kid-dash-page .kid-nav-item:focus-visible {
  text-decoration: none;
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.42);
}

body.kid-dash-page .kid-nav-item.active {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.56);
}

body.kid-dash-page .kid-main-workspace {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

body.kid-dash-page .kid-toolbar {
  background: linear-gradient(120deg, #ffe18b, #ffd978);
  border: 1px solid #efcb69;
  border-radius: 14px;
  padding: 12px;
  margin: 0;
}

body.kid-dash-page .kid-toolbar h2 {
  font-size: clamp(20px, 2.7vw, 28px);
  color: #6f4c08;
}

body.kid-dash-page .kid-toolbar-actions button {
  background: linear-gradient(180deg, #fffef8, #f9f0dc);
  border-color: #e7d4a6;
}

body.kid-dash-page #kidProfileLine,
body.kid-dash-page #kidMaskingNote {
  margin: 0;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  border-radius: 10px;
  padding: 8px 10px;
}

body.kid-dash-page .kid-performance-hero {
  border: 1px solid #d9e2f0;
  border-radius: 14px;
  background: linear-gradient(120deg, #fff7d9, #e7f3ff);
  padding: 12px 14px;
  margin: 0;
}

body.kid-dash-page .kid-metrics .metric {
  border-left: 0;
  border: 1px solid #d7e1ee;
  border-radius: 12px;
  background: #fff;
}

body.kid-dash-page .kid-section {
  margin: 0;
  border: 1px solid #d8e1ee;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

body.kid-dash-page .kid-section > summary {
  border: none;
  background: linear-gradient(90deg, #eef5ff, #f7fbff);
  border-bottom: 1px solid #e3ebf4;
  font-weight: 800;
}

body.kid-dash-page .kid-section-body {
  padding-top: 10px;
}

body.kid-dash-page .kid-top-list,
body.kid-dash-page .kid-level-badges,
body.kid-dash-page #kidIncompleteSessions,
body.kid-dash-page #kidAdvancedAssessments {
  min-width: 0;
}

.kid-wrap {
  max-width: 1020px;
  margin: 14px auto 0;
  display: grid;
  gap: 14px;
}

.kid-panel {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid #d7e5f2;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(31, 42, 55, 0.09);
  padding: 14px;
  text-align: left;
}

.kid-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.kid-hero h2 {
  margin: 0 0 6px;
  font-size: clamp(22px, 3vw, 30px);
  color: #2a4f72;
}

.kid-hero p {
  margin: 0;
  color: #46607a;
}

.kid-hero-art {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 34px;
  background: linear-gradient(160deg, #ffeab8, #d7ecff);
  border: 1px solid #d9e5f3;
}

.kid-login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.kid-login-box {
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  border: 1px solid #d9e7f5;
  border-radius: 12px;
  padding: 12px;
}

.kid-login-box h3 {
  margin: 0 0 10px;
  color: #2e587f;
  font-size: 15px;
}

.kid-login-box input {
  margin-bottom: 8px;
}

.kid-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.kid-toolbar h2 {
  margin: 0;
  color: #2b5076;
  font-size: clamp(20px, 2.6vw, 26px);
}

.kid-toolbar-actions {
  align-items: center;
  justify-content: flex-end;
}

.kid-toolbar-actions button {
  background: linear-gradient(180deg, #f6fbff, #eaf5ff);
  border-color: #c4d9ed;
}

.mask-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  margin: 0;
  border: 1px solid #c4d8eb;
  border-radius: 10px;
  background: #f2f8ff;
  color: #2f5478;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mask-toggle input {
  margin: 0;
  width: auto !important;
  min-width: 0 !important;
}

.kid-metrics .metric {
  border-left: 5px solid #8ec2ea;
  background: linear-gradient(180deg, #ffffff, #f5faff);
}

.kid-section > summary {
  background: linear-gradient(90deg, #eef6ff, #f6fbff);
  border: 1px solid #d7e6f4;
}

.kid-section-body {
  padding-top: 4px;
}

.kid-performance-hero {
  border: 1px solid #d7e6f3;
  border-radius: 12px;
  background: linear-gradient(120deg, #f0f8ff, #fff8eb);
  padding: 12px 14px;
  margin: 6px 0 10px;
  text-align: left;
}

.kid-performance-hero h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #264e71;
}

.kid-performance-hero p {
  margin: 0;
  color: #345777;
}

.kid-power-track {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  background: #e3edf7;
  overflow: hidden;
}

.kid-power-fill {
  height: 100%;
  background: linear-gradient(90deg, #5aa0d8, #6fc690);
}

.kid-level-badges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.kid-level-card {
  border: 1px solid #d6e6f2;
  border-radius: 10px;
  padding: 8px;
  background: linear-gradient(180deg, #fff, #f6fbff);
  text-align: center;
}

.kid-level-card.earned {
  border-color: #b7d9bf;
  background: linear-gradient(180deg, #f3fff6, #eaffee);
}

.kid-level-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 4px;
}

.kid-leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.kid-rank-card {
  border: 1px solid #d6e6f2;
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  text-align: center;
}

.kid-rank-card h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #3d5b78;
}

.kid-rank-value {
  font-size: 22px;
  color: #1f476b;
  font-weight: 800;
}

.kid-top-list {
  margin-top: 10px;
}

.kid-advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.kid-advanced-card {
  border: 1px solid #cfe0ef;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f3f9ff);
  padding: 10px;
}

.kid-advanced-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: #2c5073;
}

.kid-advanced-card.ready {
  border-color: #b9dcc8;
  background: linear-gradient(180deg, #f8fff9, #ecf9f1);
}

.kid-advanced-card.locked {
  opacity: 0.95;
}

.kid-advanced-status {
  font-size: 13px;
  font-weight: 700;
  color: #345877;
  margin-bottom: 4px;
}

@media (max-width: 860px) {
  .kid-login-grid {
    grid-template-columns: 1fr;
  }
  .kid-toolbar-actions {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body.teacher-page .brand-header {
  background-image:
    linear-gradient(110deg, rgba(77, 127, 180, 0.9), rgba(93, 150, 192, 0.88)),
    url("/assets/images/banner-teacher.svg");
  background-size: cover;
  background-position: center;
  border: 1px solid #4b80aa;
  box-shadow: 0 10px 24px rgba(46, 84, 122, 0.2);
}

body.parent-page .brand-header {
  background-image:
    linear-gradient(110deg, rgba(91, 165, 143, 0.9), rgba(124, 194, 173, 0.88)),
    url("/assets/images/banner-parent.svg");
  background-size: cover;
  background-position: center;
  border: 1px solid #5faaa0;
  box-shadow: 0 10px 24px rgba(56, 112, 98, 0.2);
}

body.school-page .brand-header {
  background-image:
    linear-gradient(110deg, rgba(127, 116, 184, 0.9), rgba(155, 140, 203, 0.88)),
    url("/assets/images/banner-school.svg");
  background-size: cover;
  background-position: center;
  border: 1px solid #8073b5;
  box-shadow: 0 10px 24px rgba(75, 63, 116, 0.22);
}

body.admin-page .brand-header {
  background-image:
    linear-gradient(110deg, rgba(31, 90, 100, 0.9), rgba(75, 142, 158, 0.88)),
    url("/assets/images/banner-admin.svg");
  background-size: cover;
  background-position: center;
  border: 1px solid #3f7f8d;
  box-shadow: 0 10px 24px rgba(43, 87, 95, 0.22);
}

body.teacher-page .dashboard-main-title,
body.parent-page .dashboard-main-title,
body.school-page .dashboard-main-title,
body.admin-page .dashboard-main-title {
  font-size: clamp(21px, 3vw, 28px);
  color: #ffffff;
}

body.teacher-page .brand-header .subtle-text,
body.parent-page .brand-header .subtle-text,
body.school-page .brand-header .subtle-text,
body.admin-page .brand-header .subtle-text {
  color: #f2f8ff;
}

.side-rail h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.kids-rail {
  left: 14px;
  border-left: 6px solid #6cb1e7;
}

body.kids-page .kids-rail {
  position: static;
  width: min(720px, 100%);
  max-height: none;
  margin: 8px auto 14px;
  left: auto;
  right: auto;
  top: auto;
}

.kids-rail h4 {
  color: #245784;
}

.kids-rail ul {
  margin: 0;
  padding-left: 18px;
}

.kids-rail li {
  margin: 8px 0;
}

.kids-links-bottom {
  max-width: 720px;
  margin: 10px auto 8px;
  padding: 9px 10px;
  border: 1px solid #d5e4f3;
  border-left: 6px solid #6cb1e7;
  border-radius: 12px;
  text-align: left;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(31, 42, 55, 0.08);
}

.kids-links-bottom h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: #245784;
}

.kids-links-bottom ul {
  margin: 0;
  padding-left: 18px;
}

.kids-links-bottom li {
  margin: 6px 0;
}

.kids-links-bottom .links-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding-left: 20px;
}

.kids-links-bottom .links-inline li {
  margin: 0;
  font-size: 13px;
}

.news-rail {
  right: 14px;
  border-left: 6px solid #8dc0e8;
  background: linear-gradient(180deg, #f8fcff, #edf6ff);
}

.news-rail h4 {
  color: #2d5f86;
}

.resources-rail {
  left: 14px;
  right: auto;
  border-left: 6px solid #95a8df;
  background: linear-gradient(180deg, #f8f9ff, #eef1ff);
}

.resources-rail h4 {
  color: #3b4f8a;
}

.news-live-rail {
  right: 14px;
  border-left: 6px solid #7ecfc7;
  background: linear-gradient(180deg, #f7fffc, #ebfbf7);
}

.news-live-rail h4 {
  color: #2e6d66;
}

.ticker-list {
  position: relative;
  height: calc(100vh - 290px);
  min-height: 240px;
  overflow: hidden;
}

body.teacher-page .side-rail,
body.parent-page .side-rail {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  width: min(490px, calc(50% - 22px));
  max-height: none;
  overflow: visible;
  display: inline-block;
  vertical-align: top;
  margin: 6px 10px 10px;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(27, 49, 71, 0.09);
}

.single-line-ticker {
  flex: 1 1 auto;
  min-height: 42px;
}

.single-line-item {
  display: block;
  line-height: 1.35;
  min-width: 0;
  white-space: normal;
  overflow: hidden;
  max-height: 2.8em;
}

.news-label {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #3a78a8;
}

.news-label.breaking {
  background: #c0392b;
}

.single-line-item a {
  color: #1f4466;
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
  display: inline;
}

.single-line-item a:hover {
  text-decoration: underline;
}

.bottom-info-dock {
  max-width: 1000px;
  margin: 14px auto 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dock-item {
  border: 1px solid #dee7f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  overflow: hidden;
}

.dock-item > summary {
  cursor: pointer;
  padding: 9px 12px;
  font-weight: 500;
  font-size: 12px;
  color: #2a4f72;
  border-bottom: 1px solid #e7eef5;
  background: #f1f7ff;
}

.dock-item[open] > summary {
  background: #e9f3ff;
}

.dock-item .single-line-ticker {
  padding: 8px 10px;
}

body.teacher-page .ticker-list,
body.parent-page .ticker-list {
  height: auto;
  min-height: auto;
  overflow: visible;
}

.briefing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.briefing-item {
  background: linear-gradient(180deg, #ffffff, #f5f9ff);
  border: 1px solid #d8e6f4;
  border-radius: 10px;
}

.headline-flipper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-height: 182px;
}

.flipper-slot {
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.flipper-slot.flipper-fade {
  opacity: 0.25;
  transform: translateY(6px);
}

.flipper-card {
  display: block;
  border: 1px solid #d8e6f4;
  border-radius: 10px;
  padding: 9px 10px;
  background: linear-gradient(180deg, #ffffff, #f5f9ff);
  color: #22384f;
  text-decoration: none;
}

.flipper-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.ticker-track {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: ticker-scroll 30s linear infinite;
}

.ticker-list:hover .ticker-track {
  animation-play-state: paused;
}

.ticker-item {
  display: block;
  border: 1px solid #d7e4f2;
  border-radius: 10px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #f9fcff, #eef5ff);
  color: #22384f;
  text-decoration: none;
}

.ticker-item strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.ticker-meta {
  display: block;
  font-size: 11px;
  color: #4c5f74;
}

.top-links {
  margin: 6px 0 20px;
  color: var(--muted);
}

.kids-brand {
  max-width: 720px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.kids-brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

body.kids-page .kids-brand h1 {
  margin: 0;
  font-size: clamp(28px, 4.3vw, 40px);
  letter-spacing: 0.4px;
  color: #1d4870;
}

body.kids-page .lang-switch-row,
body.kids-page .top-links {
  max-width: 920px;
}

body.kids-page .top-links {
  margin: 2px auto 12px;
  text-align: right;
  font-size: 13px;
}

body.kids-page .top-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #cde1f4;
  background: linear-gradient(180deg, #ffffff, #f2f8ff);
}

.kid-sketch-layer {
  position: fixed;
  inset: 78px 0 auto 0;
  height: 190px;
  pointer-events: none;
  z-index: 0;
}

.kid-sketch-layer .sketch {
  position: absolute;
  font-size: clamp(24px, 3vw, 38px);
  opacity: 0.2;
  filter: saturate(1.2);
  animation: sketchFloat 7s ease-in-out infinite;
}

.kid-sketch-layer .s1 { left: 8%; top: 8px; animation-delay: 0s; }
.kid-sketch-layer .s2 { left: 23%; top: 92px; animation-delay: 1.1s; }
.kid-sketch-layer .s3 { left: 45%; top: 18px; animation-delay: 2s; }
.kid-sketch-layer .s4 { right: 22%; top: 90px; animation-delay: 1.7s; }
.kid-sketch-layer .s5 { right: 8%; top: 14px; animation-delay: 0.8s; }

body.kids-page .container {
  position: relative;
  z-index: 1;
  max-width: 920px;
}

body.kids-page .container.game-console {
  border: 2px solid #2f5477;
  border-radius: 26px;
  padding: 20px 20px 18px;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.34), transparent 26%),
    radial-gradient(circle at 86% 14%, rgba(255, 206, 120, 0.22), transparent 28%),
    linear-gradient(170deg, #204666 0%, #33679a 38%, #2b608f 68%, #2a5378 100%);
  box-shadow:
    0 16px 34px rgba(20, 47, 70, 0.26),
    inset 0 0 0 3px rgba(130, 175, 213, 0.22);
}

body.kids-page .container.game-console::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7fcff, #edf6ff);
  border: 1px solid #c8def1;
  z-index: 0;
}

body.kids-page .container.game-console > * {
  position: relative;
  z-index: 1;
}

.kid-mini-label {
  margin: 2px 0 5px;
  text-align: center;
  font-size: 12px;
  color: #2b5b83;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  text-decoration: underline;
}

.container,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(31, 42, 55, 0.08);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.metric {
  border: 1px solid #dbe7f2;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.metric h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #3c5a78;
}

.metric p {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #1f476b;
}

body.kid-dash-page .kid-panel table th,
body.kid-dash-page .kid-panel table td {
  padding-left: 10px;
  padding-right: 10px;
}

body.kid-dash-page .kid-panel table {
  table-layout: auto;
}

body.teacher-page .panel,
body.parent-page .panel,
body.school-page .panel {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid #dce6f0;
  padding: 14px 16px 14px;
  margin-bottom: 14px;
}

.container {
  max-width: 720px;
  margin: 0 auto 16px;
  padding: 22px;
  text-align: left;
  animation: pop-in 0.35s ease;
}

.admin-wrap,
.dash-wrap,
.ai-wrap {
  max-width: 100%;
  padding-left: 6px;
  padding-right: 6px;
}

.panel,
.admin-section,
.ai-panel,
.report-banner,
.brand-header {
  overflow-wrap: anywhere;
}

.container h2,
.container h3 {
  margin-top: 0;
  color: #1e344a;
}

label {
  display: block;
  margin: 10px 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #2d3f52;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d8e6f4;
  background: #f5faff;
  font-size: 13px;
  font-weight: 600;
  color: #2f4f6d;
}

.consent-check input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
}

input {
  width: 100%;
  padding: 12px 13px;
  margin: 0 0 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  background: #fff;
  color: var(--text);
  max-width: 100%;
}

input:focus {
  outline: 2px solid #b8d6f4;
  border-color: #9cc3eb;
}

.quick-login-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.quick-login-row button {
  white-space: nowrap;
}

.auth-grid {
  grid-template-columns: 1fr auto;
}

.auth-grid-credentials {
  grid-template-columns: 1fr 1fr auto;
}

.auth-grid input[type="password"] {
  min-width: 0;
}

@media (max-width: 760px) {
  .auth-grid-credentials {
    grid-template-columns: 1fr;
  }
}

/* Phase A: Premium Dashboard Visual System (Teacher/Parent/School) */
body.teacher-page,
body.parent-page,
body.school-page {
  --dash-surface: rgba(255, 255, 255, 0.9);
  --dash-border: rgba(143, 171, 198, 0.44);
  --dash-shadow: 0 16px 34px rgba(28, 52, 74, 0.14);
  --dash-text: #1f3b57;
  --dash-muted: #59748f;
}

body.teacher-page .dash-wrap,
body.parent-page .dash-wrap,
body.school-page .dash-wrap {
  max-width: 1220px !important;
  margin: 18px auto 26px !important;
  padding: 0 10px;
  display: grid;
  gap: 14px;
}

body.teacher-page .brand-header,
body.parent-page .brand-header,
body.school-page .brand-header {
  max-width: 1220px !important;
  margin: 0 auto 12px !important;
  padding: 12px 16px;
}

body.teacher-page .report-banner,
body.parent-page .report-banner,
body.school-page .report-banner {
  max-width: 1220px;
  margin: 12px auto 12px;
  border-radius: 18px;
  border: 1px solid var(--dash-border);
  box-shadow: var(--dash-shadow);
  text-align: left;
  padding: 18px 20px;
}

body.teacher-page .report-banner h1,
body.parent-page .report-banner h1,
body.school-page .report-banner h1 {
  margin: 0 0 5px;
  font-size: clamp(24px, 2.4vw, 33px);
  letter-spacing: 0.2px;
}

body.teacher-page .report-banner p,
body.parent-page .report-banner p,
body.school-page .report-banner p {
  margin: 0;
  color: #f4f8fc;
  opacity: 0.97;
  font-size: 14px;
}

body.teacher-page .panel,
body.parent-page .panel,
body.school-page .panel {
  background: linear-gradient(180deg, var(--dash-surface), rgba(250, 253, 255, 0.94)) !important;
  border: 1px solid var(--dash-border) !important;
  border-radius: 16px !important;
  box-shadow: var(--dash-shadow) !important;
  backdrop-filter: blur(4px);
  padding: 15px 16px 14px !important;
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

body.teacher-page .panel:hover,
body.parent-page .panel:hover,
body.school-page .panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 38px rgba(26, 49, 72, 0.18);
  border-color: rgba(114, 156, 191, 0.6) !important;
}

body.teacher-page .panel h3,
body.parent-page .panel h3,
body.school-page .panel h3 {
  margin: 0 0 12px !important;
  border-radius: 10px !important;
  border: 1px solid #d7e5f3 !important;
  font-size: 15px !important;
  letter-spacing: 0.2px;
}

body.teacher-page .row,
body.parent-page .row,
body.school-page .row {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

body.teacher-page .metric,
body.parent-page .metric,
body.school-page .metric {
  text-align: left;
  border-radius: 14px !important;
  border: 1px solid #d4e4f1 !important;
  background:
    radial-gradient(circle at 82% 16%, rgba(155, 198, 235, 0.25), transparent 30%),
    linear-gradient(180deg, #ffffff, #f3f9ff) !important;
  padding: 12px 13px !important;
}

body.teacher-page .metric h4,
body.parent-page .metric h4,
body.school-page .metric h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dash-muted);
}

body.teacher-page .metric p,
body.parent-page .metric p,
body.school-page .metric p {
  font-size: clamp(22px, 2.2vw, 30px);
  color: var(--dash-text);
}

body.teacher-page .actions,
body.parent-page .actions,
body.school-page .actions {
  gap: 9px;
}

body.teacher-page .actions button,
body.parent-page .actions button,
body.school-page .actions button,
body.teacher-page .actions .back-game-link,
body.parent-page .actions .back-game-link,
body.school-page .actions .back-game-link {
  min-height: 34px;
  border-radius: 999px !important;
  border-width: 1px !important;
  box-shadow: 0 6px 12px rgba(44, 84, 122, 0.1);
  font-weight: 700;
  letter-spacing: 0.1px;
}

body.teacher-page .table-controls,
body.parent-page .table-controls,
body.school-page .table-controls {
  margin: 2px 0 8px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid #d7e5f2;
  background: linear-gradient(180deg, #f6fbff, #eff6ff);
}

body.teacher-page .table-controls label,
body.parent-page .table-controls label,
body.school-page .table-controls label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #4e6781;
}

body.teacher-page .table-controls input,
body.teacher-page .table-controls select,
body.parent-page .table-controls input,
body.parent-page .table-controls select,
body.school-page .table-controls input,
body.school-page .table-controls select {
  min-height: 28px !important;
  font-size: 12px !important;
}

body.teacher-page .section-tabs,
body.parent-page .section-tabs,
body.school-page .section-tabs {
  border-bottom: 0;
  padding: 0;
  margin: 2px 0 12px;
  overflow: visible;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 8px;
  white-space: normal;
}

body.teacher-page .section-tab-link,
body.parent-page .section-tab-link,
body.school-page .section-tab-link {
  max-width: none;
  border-radius: 11px;
  border: 1px solid #c9ddef;
  background: linear-gradient(180deg, #f9fcff, #edf5fc);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(37, 71, 106, 0.08);
}

body.teacher-page .section-tab-link.active,
body.parent-page .section-tab-link.active,
body.school-page .section-tab-link.active {
  border-color: #79a9d3;
  background: linear-gradient(180deg, #e7f3ff, #dfeeff);
  box-shadow: 0 10px 18px rgba(42, 89, 133, 0.16);
  color: #1a486f;
}

body.teacher-page .collapsible-section,
body.parent-page .collapsible-section,
body.school-page .collapsible-section,
body.admin-page .collapsible-section {
  border-radius: 16px;
  border: 1px solid #d8e7f4;
  background: linear-gradient(180deg, #f9fcff, #f3f8fe);
  box-shadow: 0 14px 30px rgba(26, 50, 73, 0.12);
  overflow: hidden;
}

body.teacher-page .collapsible-section > summary,
body.parent-page .collapsible-section > summary,
body.school-page .collapsible-section > summary,
body.admin-page .collapsible-section > summary {
  border-radius: 16px;
  border-bottom: 1px solid #d9e7f3;
  font-size: 14px;
  letter-spacing: 0.2px;
  padding: 12px 14px;
  font-weight: 800;
}

body.teacher-page .collapsible-section > summary {
  background: linear-gradient(90deg, #e3f1ff, #f1f8ff);
  border-left: 5px solid #63a6e6;
}

body.parent-page .collapsible-section > summary {
  background: linear-gradient(90deg, #e4f6ea, #f2fbf5);
  border-left: 5px solid #6fbc88;
}

body.school-page .collapsible-section > summary {
  background: linear-gradient(90deg, #ece5f8, #f6f2fd);
  border-left: 5px solid #8f76ca;
}

body.admin-page .collapsible-section > summary {
  background: linear-gradient(90deg, #fbeee5, #fcf5ef);
  border-left: 5px solid #e09c6d;
}

body.teacher-page table,
body.parent-page table,
body.school-page table {
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid #d7e5f2;
}

body.teacher-page table thead th,
body.parent-page table thead th,
body.school-page table thead th {
  background: linear-gradient(180deg, #ebf4fd, #e3eef9);
  color: #274c6d;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid #cfe0ee;
}

body.teacher-page .bottom-info-dock,
body.parent-page .bottom-info-dock,
body.school-page .bottom-info-dock {
  max-width: 1220px;
  margin: 10px auto 8px;
  padding: 0 10px;
}

body.teacher-page .dock-item,
body.parent-page .dock-item,
body.school-page .dock-item {
  border-radius: 12px;
  border: 1px solid #d4e4f1;
  box-shadow: 0 10px 20px rgba(29, 56, 82, 0.1);
}

@media (max-width: 980px) {
  body.teacher-page .section-tabs,
  body.parent-page .section-tabs,
  body.school-page .section-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body.teacher-page .dash-premium,
body.parent-page .dash-premium,
body.school-page .dash-premium {
  position: relative;
}

body.teacher-page .dash-premium::before,
body.parent-page .dash-premium::before,
body.school-page .dash-premium::before {
  content: "";
  position: absolute;
  inset: -8px -4px auto -4px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(156, 197, 234, 0.18), rgba(162, 219, 202, 0.14), rgba(177, 168, 229, 0.12));
  z-index: 0;
  pointer-events: none;
}

body.teacher-page .dash-premium > *,
body.parent-page .dash-premium > *,
body.school-page .dash-premium > * {
  position: relative;
  z-index: 1;
}

.panel-premium {
  overflow: hidden;
}

.dash-top-actions {
  border: 1px solid #d2e3f3;
  border-radius: 12px;
  background: linear-gradient(180deg, #f9fcff, #edf4fb);
  padding: 8px;
}

.metric-premium {
  position: relative;
  overflow: hidden;
  padding: 10px 12px 12px !important;
}

.metric-premium::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -14px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.44);
}

.metric-premium .metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.metric-premium .metric-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(153, 180, 204, 0.45);
  font-size: 15px;
}

.metric-premium .metric-trend {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 800;
  color: #5f7890;
}

.metric-tint-blue {
  background:
    radial-gradient(circle at 84% 14%, rgba(149, 204, 244, 0.34), transparent 34%),
    linear-gradient(180deg, #ffffff, #edf7ff) !important;
}

.metric-tint-violet {
  background:
    radial-gradient(circle at 84% 14%, rgba(188, 176, 238, 0.3), transparent 34%),
    linear-gradient(180deg, #ffffff, #f3f0ff) !important;
}

.metric-tint-green {
  background:
    radial-gradient(circle at 84% 14%, rgba(148, 220, 194, 0.28), transparent 34%),
    linear-gradient(180deg, #ffffff, #eefcf6) !important;
}

.metric-tint-indigo {
  background:
    radial-gradient(circle at 84% 14%, rgba(171, 185, 235, 0.28), transparent 34%),
    linear-gradient(180deg, #ffffff, #eef2ff) !important;
}

.metric-tint-cyan {
  background:
    radial-gradient(circle at 84% 14%, rgba(155, 215, 232, 0.3), transparent 34%),
    linear-gradient(180deg, #ffffff, #eef9ff) !important;
}

.metric-tint-slate {
  background:
    radial-gradient(circle at 84% 14%, rgba(197, 209, 221, 0.3), transparent 34%),
    linear-gradient(180deg, #ffffff, #f4f8fc) !important;
}

.daily-mission-card {
  margin: 10px 0 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #b7d4f2;
  background: linear-gradient(140deg, #eef7ff, #f7fcff);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
}

.daily-mission-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(126, 196, 255, 0.35), transparent 70%);
  pointer-events: none;
}

.mission-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #2f6ea8;
}

.daily-mission-card h4 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #1e4b72;
}

#missionText,
#missionWhy,
#missionChallenge {
  margin: 0 0 6px;
  font-size: 14px;
  color: #2a4158;
}

#missionChallenge {
  font-weight: 700;
  color: #17456c;
}

.mission-link-wrap {
  margin: 2px 0 0;
  font-size: 13px;
}

.mission-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 6px;
}

.mission-progress {
  display: flex;
  gap: 6px;
  margin: 8px 0 4px;
}

.mission-step {
  width: 26px;
  height: 10px;
  border-radius: 999px;
  background: #d4e6f8;
  border: 1px solid #c1d9f1;
}

.mission-step.done {
  background: linear-gradient(180deg, #79c28c, #56a86f);
  border-color: #4e9e66;
}

.mission-coach-note {
  margin: 0 0 6px;
  font-size: 13px;
  color: #2b567f;
  font-weight: 600;
}

button {
  padding: var(--btn-v-pad) var(--btn-h-pad);
  font-size: var(--btn-font);
  line-height: 1.2;
  border-radius: var(--btn-radius);
  border: 1px solid rgba(158, 186, 220, 0.65);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(223, 236, 252, 0.55));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #1f4e78;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--btn-min-height);
  box-shadow: 0 4px 14px rgba(49, 96, 145, 0.12);
  transition: background-color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}

body.teacher-page button,
body.parent-page button,
body.school-page button {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff, #eef4fb);
  border: 1px solid #cedded;
  box-shadow: 0 2px 8px rgba(45, 78, 110, 0.08);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  min-height: 30px;
}

body.teacher-page input,
body.parent-page input,
body.school-page input {
  padding: 9px 10px;
  font-size: 14px;
}

body.teacher-page label,
body.parent-page label,
body.school-page label {
  font-size: 13px;
}

.back-game-link {
  color: #9a4f00;
  background: #fff0da;
  border: 1px solid #f2c899;
  border-radius: 999px;
  padding: 4px 10px;
}

.back-game-link:hover {
  color: #7b3e00;
  text-decoration: none;
  background: #ffe4be;
}

body.teacher-page .back-game-link,
body.parent-page .back-game-link,
body.school-page .back-game-link {
  color: #2a5278;
  background: #eef5fc;
  border: 1px solid #cddff0;
}

body.teacher-page .back-game-link:hover,
body.parent-page .back-game-link:hover,
body.school-page .back-game-link:hover {
  color: #1f4465;
  background: #e4eef8;
}

.ai-search-link {
  background: linear-gradient(180deg, #e8fbff, #d8f5ff) !important;
  border: 1px solid #b8dfef !important;
  color: #11607f !important;
  font-weight: 700 !important;
}

#teacherLoginBtn,
#parentLoginBtn,
#schoolLoginBtn {
  background: linear-gradient(180deg, #eefaf1, #dcf2e3);
  border-color: #b8dfc7;
  color: #1f5d3a;
}

#refreshReportBtn,
#parentFetchBtn,
#refreshSchoolReportBtn {
  background: linear-gradient(180deg, #eef6ff, #dfeeff);
  border-color: #bfd4f1;
  color: #1f4f78;
}

#downloadTeacherPdfBtn,
#downloadParentPdfBtn,
#downloadSchoolPdfBtn {
  background: linear-gradient(180deg, #f3f1ff, #e6e2ff);
  border-color: #cdc3ef;
  color: #4a3f82;
}

#teacherLogoutBtn,
#parentLogoutBtn,
#schoolLogoutBtn {
  background: linear-gradient(180deg, #fff1f1, #ffe6e6);
  border-color: #efc2c2;
  color: #8b2f2f;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.actions > * {
  margin: 0;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 6px;
}

.table-controls label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.table-controls input,
.table-controls select {
  width: auto;
  min-width: 72px;
  margin: 0;
  padding: 3px 8px;
  font-size: 11px;
  min-height: 26px;
  line-height: 1.2;
}

.table-controls .small-btn,
.admin-table-controls .small-btn {
  min-height: 24px;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 7px;
}

.table-controls .icon-btn,
.admin-table-controls .icon-btn {
  width: 26px;
  min-width: 26px;
  height: 24px;
  font-size: 13px;
}

.table-controls span,
.admin-table-controls span {
  font-size: 11px !important;
  line-height: 1.15;
}

.admin-row > * {
  min-width: 0;
}

.small-btn {
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 7px;
  min-height: 28px;
}

.session-modal {
  position: fixed;
  inset: 0;
  background: rgba(23, 34, 46, 0.45);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.session-modal.hidden {
  display: none;
}

.session-modal-card {
  width: min(1120px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #d9e3ee;
  box-shadow: 0 18px 46px rgba(26, 40, 58, 0.24);
  padding: 14px;
  text-align: left;
}

.session-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.session-modal-head h3 {
  margin: 0;
  color: #21476b;
}

.session-review-row-risk td {
  background: #ffe9ea !important;
  color: #8d1f28;
  font-weight: 700;
}

.icon-btn {
  min-width: 32px;
  width: 32px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

/* Table action controls should read like compact links, while preserving existing handlers. */
table .small-btn:not(.icon-btn),
table .table-action-link {
  padding: 0 !important;
  min-height: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #2b5f8f !important;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 12px;
  font-weight: 700;
}

table .small-btn:not(.icon-btn):hover,
table .table-action-link:hover {
  color: #1f4567 !important;
  background: transparent !important;
}

table .small-btn:not(.icon-btn) + .small-btn:not(.icon-btn),
table .table-action-link + .table-action-link,
table .table-action-link + .small-btn:not(.icon-btn),
table .small-btn:not(.icon-btn) + .table-action-link {
  margin-left: 0;
  margin-top: 6px;
}

/* Keep action columns clean: one action per line with compact width. */
table td .small-btn:not(.icon-btn),
table td .table-action-link,
table td .back-game-link {
  display: block;
  width: fit-content;
  max-width: 100%;
}

table td .small-btn:not(.icon-btn) + .back-game-link,
table td .back-game-link + .small-btn:not(.icon-btn),
table td .table-action-link + .back-game-link,
table td .back-game-link + .table-action-link,
table td .back-game-link + .back-game-link {
  margin-top: 6px;
}

.cell-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
  max-height: 4.2em;
}

.table-view-more {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: #2d5f90;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.text-popup-modal {
  position: fixed;
  inset: 0;
  z-index: 2400;
  background: rgba(18, 28, 40, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.text-popup-modal.hidden {
  display: none !important;
}

.text-popup-card {
  width: min(760px, 96vw);
  max-height: 84vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #d9e4ef;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(22, 36, 52, 0.24);
  padding: 12px;
  text-align: left;
}

.text-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.text-popup-head h3 {
  margin: 0;
  font-size: 16px;
  color: #244e75;
}

.text-popup-content {
  font-size: 13px;
  line-height: 1.5;
  color: #1f2a37;
  white-space: pre-wrap;
  word-break: break-word;
}

.text-popup-content pre {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #dbe5ef;
  border-radius: 10px;
  background: #f8fbff;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}

.text-popup-format {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #cddced;
  border-radius: 999px;
  background: #eff6ff;
  color: #2b5278;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}

.text-popup-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.text-popup-toolbar label {
  margin: 0;
  font-size: 12px;
  color: #385a7c;
  font-weight: 700;
}

.text-popup-toolbar select {
  min-width: 140px;
  max-width: 220px;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #c8d9eb;
  border-radius: 8px;
  background: #fff;
}

.text-popup-hint {
  font-size: 11px;
  color: #5b6f86;
  margin: 2px 0 8px;
}

.section-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0 12px;
  border-bottom: 1px solid #d8e5f2;
  padding: 0 2px 6px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}

.section-tab-link {
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #4a6480;
  border-radius: 8px 8px 0 0;
  padding: 6px 10px 5px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-height: 26px;
  text-decoration: none;
  line-height: 1.2;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-tab-link:hover {
  color: #2a5278;
  background: #f3f8ff;
}

.section-tab-link.active {
  color: #123b63;
  background: linear-gradient(180deg, #e4f0ff, #dbeaff);
  border-color: #a9c5e3;
  border-bottom-color: #2f6ea8;
  box-shadow: inset 0 -2px 0 #2f6ea8;
  font-weight: 800;
}

/* Admin gets a no-scroll, card-tab experience. */
body.admin-page .section-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
  white-space: normal;
  border-bottom: 0;
  padding: 0;
  margin: 8px 0 14px;
}

body.admin-page .section-tab-link {
  max-width: none;
  min-height: 42px;
  border: 1px solid #c8dbef;
  border-bottom-width: 1px;
  border-radius: 10px;
  background: linear-gradient(180deg, #f9fcff, #eef5fc);
  color: #2a557f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  text-align: center;
  font-size: 12px;
  line-height: 1.15;
}

body.admin-page .section-tab-link .tab-icon {
  font-size: 14px;
  line-height: 1;
}

body.admin-page .section-tab-link .tab-label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.admin-page .section-tab-link:hover {
  background: linear-gradient(180deg, #f3f9ff, #e7f1fb);
  color: #224b71;
}

body.admin-page .section-tab-link.active {
  background: linear-gradient(180deg, #dfeeff, #d1e6ff);
  border-color: #93b9dd;
  box-shadow: inset 0 -2px 0 #2f6ea8, 0 4px 10px rgba(41, 86, 127, 0.12);
  color: #143d62;
}

@media (max-width: 1180px) {
  body.admin-page .section-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  body.admin-page .section-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  body.admin-page .section-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.icon-csv {
  background: linear-gradient(180deg, #edf9f1, #dff3e6) !important;
  border-color: #b9dfc6 !important;
  color: #1f6c3f !important;
}

.icon-pdf {
  background: linear-gradient(180deg, #fff1f1, #ffe4e4) !important;
  border-color: #efc2c2 !important;
  color: #8e2d2d !important;
}

/* Phase C dashboard visual strip + command UX */
body.teacher-page .hero-visual-strip,
body.parent-page .hero-visual-strip,
body.school-page .hero-visual-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 12px;
}

body.teacher-page .hero-card,
body.parent-page .hero-card,
body.school-page .hero-card {
  border: 1px solid #d4e4f2;
  border-radius: 12px;
  background: linear-gradient(180deg, #fdfefe, #f2f8ff);
  box-shadow: 0 10px 22px rgba(34, 60, 88, 0.1);
  min-height: 128px;
  padding: 10px;
}

body.teacher-page .hero-card-radial,
body.parent-page .hero-card-radial,
body.school-page .hero-card-radial {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-radial {
  width: 116px;
  height: 116px;
}

.hero-radial-track {
  fill: none;
  stroke: #d8e6f3;
  stroke-width: 10;
}

.hero-radial-fill {
  fill: none;
  stroke: #3f86c9;
  stroke-width: 10;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
}

.hero-radial-value {
  fill: #214a73;
  font-size: 18px;
  font-weight: 800;
}

.hero-radial-label {
  fill: #59718a;
  font-size: 11px;
  font-weight: 700;
}

body.teacher-page .hero-card-spark,
body.parent-page .hero-card-spark,
body.school-page .hero-card-spark {
  display: flex;
  align-items: center;
}

.hero-sparkline-block {
  width: 100%;
}

.hero-sparkline-meta {
  font-size: 12px;
  color: #355979;
  margin: 0 0 6px;
}

.hero-sparkline-meta strong {
  color: #1f3f5e;
}

.hero-sparkline {
  width: 100%;
  height: 82px;
}

.hero-sparkline-line {
  fill: none;
  stroke: #4f99d5;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-empty {
  font-size: 12px;
  color: #5f7790;
}

.hero-risk-radar h4 {
  margin: 0 0 7px;
  font-size: 13px;
  color: #295170;
}

.risk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  color: #36566f;
  padding: 4px 0;
}

.risk-row strong {
  color: #1e3d5a;
}

.risk-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.risk-dot.high {
  background: #d65252;
}

.risk-dot.med {
  background: #e5a22d;
}

.risk-dot.low {
  background: #4ea76a;
}

body.teacher-page .dash-command-bar,
body.parent-page .dash-command-bar,
body.school-page .dash-command-bar {
  position: sticky;
  top: 8px;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px;
  border: 1px solid #cfe0ef;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.94), rgba(236, 244, 252, 0.94));
  backdrop-filter: blur(4px);
}

body.teacher-page .dash-command-bar button,
body.parent-page .dash-command-bar button,
body.school-page .dash-command-bar button {
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
}

.dash-session-timer {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: #335a7c;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #c9dbee;
  background: linear-gradient(180deg, #f7fbff, #ecf4fd);
}

body.teacher-page .dash-side-rail,
body.parent-page .dash-side-rail,
body.school-page .dash-side-rail {
  position: fixed;
  top: 132px;
  width: 86px;
  max-height: calc(100vh - 180px);
  overflow: auto;
  padding: 10px 7px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 16px;
  background: linear-gradient(180deg, #eef5fb, #e6eff8);
  box-shadow: 0 12px 26px rgba(35, 58, 82, 0.14);
  z-index: 35;
}

body.teacher-page .dash-side-rail a,
body.parent-page .dash-side-rail a,
body.school-page .dash-side-rail a {
  min-height: 62px;
  padding: 8px 5px;
  margin: 0 0 8px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  font-size: 10px;
  color: #24445f;
  border: 1px solid rgba(139, 167, 194, 0.26);
  background: rgba(255, 255, 255, 0.5);
  text-align: center;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

body.teacher-page .dash-side-rail .rail-icon,
body.parent-page .dash-side-rail .rail-icon,
body.school-page .dash-side-rail .rail-icon {
  font-size: 18px;
  line-height: 1;
}

body.teacher-page .dash-side-rail .rail-text,
body.parent-page .dash-side-rail .rail-text,
body.school-page .dash-side-rail .rail-text {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  max-width: 68px;
  max-height: 2.25em;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.teacher-page .dash-side-rail a:hover,
body.parent-page .dash-side-rail a:hover,
body.school-page .dash-side-rail a:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(103, 136, 168, 0.38);
}

body.teacher-page .dash-side-rail a.active,
body.parent-page .dash-side-rail a.active,
body.school-page .dash-side-rail a.active {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(79, 120, 161, 0.46);
  color: #1d3d59;
  font-weight: 700;
}

body.teacher-page .dash-side-rail {
  left: auto;
  right: max(12px, calc((100vw - 1220px) / 2 - 102px));
  background: linear-gradient(180deg, #d5ebff, #bddcf4);
}

body.parent-page .dash-side-rail {
  left: auto;
  right: max(12px, calc((100vw - 1220px) / 2 - 102px));
  background: linear-gradient(180deg, #d9f1df, #c2e8cd);
}

body.school-page .dash-side-rail {
  left: auto;
  right: max(12px, calc((100vw - 1220px) / 2 - 102px));
  background: linear-gradient(180deg, #e8ddf7, #d7c6ef);
}

@media (max-width: 1280px) {
  body.teacher-page .hero-visual-strip,
  body.parent-page .hero-visual-strip,
  body.school-page .hero-visual-strip {
    grid-template-columns: 1fr;
  }

  body.teacher-page .dash-side-rail,
  body.parent-page .dash-side-rail,
  body.school-page .dash-side-rail {
    display: none;
  }
}

body.admin-page .dash-side-rail {
  position: fixed;
  top: 132px;
  width: 86px;
  max-height: calc(100vh - 180px);
  overflow: auto;
  padding: 10px 7px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 16px;
  background: linear-gradient(180deg, #f9e6d9, #f3dcec);
  box-shadow: 0 12px 26px rgba(35, 58, 82, 0.14);
  z-index: 35;
}

body.admin-page .dash-side-rail.admin-right {
  left: auto;
  right: max(12px, calc((100vw - 1000px) / 2 - 102px));
}

body.admin-page .dash-side-rail.admin-left {
  right: auto;
  left: max(12px, calc((100vw - 1000px) / 2 - 102px));
}

body.admin-page .admin-float-link {
  min-height: 62px;
  padding: 8px 5px;
  margin: 0 0 8px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid transparent;
  font-size: 10px;
  line-height: 1.1;
  color: #24445f;
  text-decoration: none;
  text-align: center;
  background: rgba(255, 255, 255, 0.62);
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

body.admin-page .admin-float-link .rail-icon {
  font-size: 18px;
  line-height: 1;
}

body.admin-page .admin-float-link .rail-text {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  max-width: 68px;
  max-height: 2.25em;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.admin-page .admin-float-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(130, 151, 172, 0.42);
}

body.admin-page .admin-float-link.active {
  background: rgba(255, 255, 255, 0.99);
  border-color: rgba(109, 134, 161, 0.48);
  color: #1d3d59;
  font-weight: 700;
}

@media (max-width: 1280px) {
  body.admin-page .dash-side-rail {
    display: none;
  }
}

/* Header refresh: transparent title area, centered text, larger logo */
body.teacher-page .brand-header,
body.parent-page .brand-header,
body.school-page .brand-header,
body.admin-page .brand-header {
  background: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
  justify-content: center !important;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-top: 6px;
  padding-bottom: 6px;
}

body.teacher-page .brand-logo,
body.parent-page .brand-logo,
body.school-page .brand-logo,
body.admin-page .brand-logo {
  width: 102px;
  height: 102px;
}

body.teacher-page .brand-text,
body.parent-page .brand-text,
body.school-page .brand-text,
body.admin-page .brand-text {
  text-align: center;
}

body.teacher-page .dashboard-main-title,
body.parent-page .dashboard-main-title,
body.school-page .dashboard-main-title,
body.admin-page .dashboard-main-title {
  color: #274f73;
}

body.parent-page .dashboard-main-title::before,
body.teacher-page .dashboard-main-title::before,
body.school-page .dashboard-main-title::before,
body.admin-page .dashboard-main-title::before {
  display: inline-block;
  margin-right: 8px;
  font-size: 1em;
  line-height: 1;
  vertical-align: middle;
}

body.parent-page .dashboard-main-title::before { content: "👨‍👩‍👧"; }
body.teacher-page .dashboard-main-title::before { content: "👩‍🏫"; }
body.school-page .dashboard-main-title::before { content: "🏫"; }
body.admin-page .dashboard-main-title::before { content: "🛠️"; }

body.teacher-page .dashboard-subtitle,
body.parent-page .dashboard-subtitle,
body.school-page .dashboard-subtitle,
body.admin-page .dashboard-subtitle {
  color: #4b6a85;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  border: 1px solid #e6edf4;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

thead th {
  background: linear-gradient(180deg, #f2f7fc, #edf4fb);
  color: #254665;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 7px;
  border-bottom: 1px solid #e7eef5;
  text-align: left;
}

tbody td {
  padding: 7px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  font-size: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#schoolTeacherModalBody table th:first-child,
#schoolTeacherModalBody table td:first-child {
  text-align: left !important;
  font-weight: 700;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.table-scroll table {
  min-width: 720px;
}

tbody tr:nth-child(even) {
  background: #f8fbff;
}

tbody tr:hover {
  background: #eef5fd;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.action-right {
  margin-left: auto;
}

button:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(209, 227, 248, 0.7));
  box-shadow: 0 7px 18px rgba(49, 96, 145, 0.16);
}

body.teacher-page button:hover,
body.parent-page button:hover {
  background: linear-gradient(180deg, #ffffff, #e9f1fa);
  box-shadow: 0 4px 12px rgba(45, 78, 110, 0.12);
}

button:active {
  transform: translateY(1px);
}

#error,
#avatarError {
  color: var(--danger);
  font-size: 14px;
  margin: 6px 0;
}

#playerInfo {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid #d4e5f7;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 700;
}

#avatarDisplay {
  font-size: 22px;
}

#nameDisplay {
  color: #1f4f7a;
}

.age-highlight {
  color: #2f7d47;
}

#icon {
  text-align: center;
  margin: 8px 0 6px;
  font-size: 42px;
}

#question {
  text-align: center;
  font-size: clamp(24px, 4vw, 30px);
  font-weight: 800;
  color: #152c42;
  margin: 18px 0;
  line-height: 1.35;
}

body.kids-page #question {
  margin: 12px auto;
  max-width: 760px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #d5e6f6;
  background: linear-gradient(180deg, #ffffff, #f4f9ff);
  color: #13324c;
  box-shadow: 0 7px 18px rgba(43, 87, 126, 0.1);
}

.level-logo {
  text-align: center;
  font-size: 42px;
  margin: 6px 0 10px;
  animation: level-fly 3.6s ease-in-out infinite;
}

.level-number {
  color: #e07a00;
  background: #fff0d9;
  border: 1px solid #ffd39b;
  border-radius: 8px;
  padding: 2px 8px;
  margin-right: 6px;
}

.level-logo-pop {
  animation: level-pop 0.45s ease;
}

.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.game-actions {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.hint-row {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.hint-btn {
  background: linear-gradient(120deg, rgba(169, 151, 250, 0.45), rgba(108, 163, 229, 0.45));
  border: 1px solid rgba(117, 138, 210, 0.55);
  color: #fff;
  font-weight: 700;
}

.hint-btn:hover {
  background: linear-gradient(120deg, #7f73e0, #447ac7);
}

.answer-btn {
  width: 100%;
  min-height: 52px;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(222, 239, 253, 0.72));
  color: #1d3b58;
  border: 1px solid rgba(171, 202, 232, 0.78);
  font-weight: 700;
}

.answer-btn:hover {
  background: linear-gradient(180deg, #eef8ff, #cfe7fb);
  transform: translateY(-1px);
}

body.kids-page .buttons {
  gap: 12px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

body.kids-page .answer-btn {
  min-height: 68px;
  border-radius: 14px;
  font-size: 18px;
  letter-spacing: 0.15px;
  background: linear-gradient(180deg, #ffffff, #d7ecff);
  box-shadow: 0 6px 14px rgba(36, 84, 121, 0.14);
}

body.kids-page .answer-btn:hover {
  background: linear-gradient(180deg, #ffffff, #cbe5ff);
}

#feedback,
#explanation {
  margin-top: 12px;
  font-size: 16px;
  color: #2d3f52;
  text-align: center;
}

.progress {
  background: #e5edf5;
  height: 14px;
  border-radius: 999px;
  margin: 14px 0;
  overflow: hidden;
}

.bar {
  background: linear-gradient(90deg, #5aa2e3, #2f6ea8);
  height: 100%;
  width: 0%;
}

.stats {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #30445a;
}

.summary-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 18px;
}

.summary-item {
  border-bottom: 1px solid #dfe8f1;
  padding: 10px 0;
}

.summary-item span {
  font-weight: 700;
}

.certificate-container .certificate {
  max-width: 820px;
  margin: 20px auto;
  padding: 28px;
  border: 2px solid #b4c9df;
  border-radius: 18px;
  text-align: center;
  background: #fff;
  box-shadow: 0 10px 26px rgba(31, 42, 55, 0.08);
}

.certificate h1 {
  font-size: 34px;
  margin-bottom: 10px;
}

.certificate h2 {
  font-size: 28px;
  margin: 10px 0;
}

.certificate h3 {
  font-size: 22px;
  margin: 12px 0;
}

#certModuleTag {
  margin: 2px 0 10px;
  font-size: 16px;
  font-weight: 700;
  color: #2a557b;
}

.cert-module-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #c8ddf0;
  background: linear-gradient(180deg, #f6fbff, #eaf4ff);
  color: #275276;
  font-weight: 800;
}

.cert-module-icon {
  font-size: 20px;
  line-height: 1;
}

.module-badge-cybersmart {
  border-color: #b8d5ea;
  background: linear-gradient(180deg, #f4faff, #e4f1ff);
}

.module-badge-actionsmart {
  border-color: #bddfc7;
  background: linear-gradient(180deg, #f4fff6, #e6f7ea);
  color: #2f6d44;
}

.module-badge-aismart {
  border-color: #cdc8f4;
  background: linear-gradient(180deg, #f7f6ff, #ebe9ff);
  color: #4a438a;
}

.story-challenge-container {
  max-width: 980px;
  margin: 10px auto 16px;
  padding: 12px;
  border: 1px solid #cadff1;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fcff, #edf6ff);
  box-shadow: 0 12px 28px rgba(20, 52, 82, 0.13);
}

.story-stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
}

.story-visual {
  border-radius: 16px;
  border: 1px solid #c8def1;
  position: relative;
  min-height: 320px;
  overflow: hidden;
  background: #dff1ff;
}

.story-backdrop {
  position: absolute;
  inset: 0;
  background-size: 150% 150%;
  animation: backdropPan 8s ease-in-out infinite alternate;
}

.story-backdrop.backdrop-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.story-backdrop.anim-fast-pan {
  animation-duration: 5s;
}

.story-backdrop.anim-slow-pan {
  animation-duration: 10s;
}

.story-backdrop.anim-pulse {
  animation: backdropPulse 6s ease-in-out infinite;
}

.backdrop-city {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.24), transparent 30%),
    linear-gradient(160deg, #8fd2ff, #a6b8ff 45%, #ffd5b2);
}

.backdrop-classroom {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.24), transparent 30%),
    linear-gradient(160deg, #c7ebff, #ffdcb3 45%, #ffeecb);
}

.backdrop-home {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.24), transparent 30%),
    linear-gradient(160deg, #bde6d2, #d8edff 45%, #fff3c8);
}

.backdrop-park {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.24), transparent 30%),
    linear-gradient(160deg, #c6efc3, #a6d8ff 45%, #fff2b6);
}

.backdrop-lab {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.24), transparent 30%),
    linear-gradient(160deg, #d0d7ff, #d4eaff 45%, #e9f2ff);
}

.story-scene-actors {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.story-actor {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: clamp(28px, 5vw, 42px);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.22));
  animation: actorBob 2.2s ease-in-out infinite;
}

.story-actor.actor-image {
  width: clamp(52px, 8vw, 94px);
  height: auto;
  filter: drop-shadow(0 6px 12px rgba(16, 35, 52, 0.26));
}

.story-actor.motion-hover {
  animation: actorHover 2.8s ease-in-out infinite;
}

.story-actor.motion-walk {
  animation: actorWalk 6.4s ease-in-out infinite;
}

.story-actor.motion-glide {
  animation: actorGlide 7.2s ease-in-out infinite;
}

.story-actor.motion-cheer {
  animation: actorCheer 1.2s ease-in-out infinite;
}

.story-hazard-layer {
  position: absolute;
  inset: 0;
}

.story-hazard-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 120px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(30, 64, 91, 0.35);
  color: #fff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-start;
  animation: hazardPulse 1.8s ease-in-out infinite;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.story-hazard-btn .hz-icon {
  font-size: 18px;
}

.story-hazard-btn .hz-label {
  font-size: 12px;
  text-align: left;
  line-height: 1.2;
}

.story-hazard-btn:hover {
  background: rgba(25, 82, 124, 0.7);
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 0 12px 22px rgba(8, 26, 42, 0.35);
}

.story-hazard-btn.hit {
  background: rgba(48, 150, 88, 0.9);
  border-color: rgba(198, 255, 216, 0.95);
  animation: none;
}

.story-hazard-btn.miss {
  background: rgba(171, 67, 67, 0.9);
  border-color: rgba(255, 210, 210, 0.95);
}

.story-scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05) 0px,
    rgba(255, 255, 255, 0.05) 2px,
    rgba(255, 255, 255, 0) 3px,
    rgba(255, 255, 255, 0) 6px
  );
}

.story-meta h2 {
  margin: 0 0 5px;
  color: #214b70;
}

.story-meta p {
  margin: 0 0 8px;
}

.story-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.story-question {
  font-size: 20px;
  font-weight: 800;
  color: #173a59;
}

.story-hazard-prompt {
  font-size: 14px;
  font-weight: 800;
  color: #2a5b83;
}

.story-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 8px 0;
}

.story-option-btn {
  text-align: left;
  border-radius: 12px;
  min-height: 46px;
  font-size: 15px;
  border: 1px solid #c5dbef;
  background: linear-gradient(180deg, #ffffff, #e6f3ff);
  color: #1f4468;
  font-weight: 700;
}

.story-option-btn:hover {
  background: linear-gradient(180deg, #ffffff, #d6ebff);
}

.story-feedback {
  min-height: 22px;
  font-size: 14px;
  font-weight: 700;
  color: #2d5f87;
}

.story-progress {
  height: 10px;
  border-radius: 999px;
  background: #dceaf7;
  overflow: hidden;
  margin: 8px 0 10px;
}

.story-progress-fill {
  width: 8%;
  height: 100%;
  background: linear-gradient(90deg, #58a4df, #55c38b);
  transition: width 0.35s ease;
}

.story-footer-actions {
  display: flex;
  justify-content: flex-end;
}

.advanced-scene {
  min-height: 380px;
  border: 1px solid #bfd8ee;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34), 0 12px 22px rgba(17, 48, 74, 0.16);
}

.advanced-question-block {
  margin-top: 12px;
  border: 1px solid #d5e6f4;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f5fbff);
  padding: 12px;
}

.advanced-question-block h3 {
  margin: 0 0 6px;
  color: #204769;
}

@keyframes storyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes actorBob {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-4px); }
}

@keyframes actorHover {
  0%, 100% { transform: translate(-50%, -50%) translateY(0) scale(1); }
  50% { transform: translate(-50%, -50%) translateY(-8px) scale(1.03); }
}

@keyframes actorWalk {
  0% { transform: translate(-52%, -50%) translateY(0) scale(1); }
  25% { transform: translate(-48%, -50%) translateY(-3px) scale(1.02); }
  50% { transform: translate(-52%, -50%) translateY(0) scale(1); }
  75% { transform: translate(-48%, -50%) translateY(-2px) scale(1.02); }
  100% { transform: translate(-52%, -50%) translateY(0) scale(1); }
}

@keyframes actorGlide {
  0%, 100% { transform: translate(-50%, -50%) translateX(0) translateY(0) rotate(0deg); }
  50% { transform: translate(-50%, -50%) translateX(6px) translateY(-6px) rotate(-2deg); }
}

@keyframes actorCheer {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  50% { transform: translate(-50%, -50%) scale(1.08) rotate(-4deg); }
}

@keyframes hazardPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.05); }
}

@keyframes backdropPan {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

@keyframes backdropPulse {
  0%, 100% { transform: scale(1); filter: saturate(1); }
  50% { transform: scale(1.03); filter: saturate(1.1); }
}

.medal {
  font-size: 54px;
  opacity: 0;
  transform: translateY(-30px) scale(0.8);
  transition: all 0.6s ease;
  margin-bottom: 8px;
}

.avatar-selection {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 12px 0;
  flex-wrap: wrap;
}

.avatar {
  font-size: 38px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  padding: 6px;
  border-radius: 12px;
  border: 2px solid transparent;
  animation: bob 2.2s ease-in-out infinite;
}

body.kids-page .avatar {
  font-size: 44px;
  padding: 8px 10px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #edf6ff);
  border: 1px solid #d7e6f5;
  box-shadow: 0 5px 12px rgba(31, 66, 100, 0.11);
}

.avatar.selected {
  transform: scale(1.12);
  border-color: #5aa2e3;
  background: #ecf5ff;
  animation: pulse-ring 1.2s ease-in-out infinite;
}

body.kids-page .avatar.selected {
  border-color: #63a7dc;
  box-shadow: 0 0 0 3px rgba(99, 167, 220, 0.22), 0 10px 20px rgba(20, 59, 92, 0.2);
}

.badge-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 25px;
}

.badge-icon {
  transition: transform 0.2s ease;
}

.badge-icon.locked {
  opacity: 0.32;
  filter: grayscale(0.45);
}

.badge-icon.unlocked {
  opacity: 1;
}

.badge-icon:hover {
  transform: scale(1.2) rotate(-6deg);
}

.floating-text {
  position: fixed;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: #ff8c00;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.65), 0 8px 18px rgba(0, 0, 0, 0.22);
  animation: celebrateFly 1.25s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  z-index: 10000;
  pointer-events: none;
}

.floating-text.color-1 { color: #ff4d6d; }
.floating-text.color-2 { color: #f59e0b; }
.floating-text.color-3 { color: #10b981; }
.floating-text.color-4 { color: #3b82f6; }
.floating-text.color-5 { color: #a855f7; }

/* Center-screen mascot badge celebration */
.mega-badge-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(19, 54, 91, 0.2), rgba(19, 54, 91, 0.45));
  animation: megaBadgeIn 0.35s ease-out both;
  pointer-events: none;
}

.mega-badge-card {
  width: min(460px, calc(100vw - 24px));
  border-radius: 22px;
  padding: 22px 20px 18px;
  text-align: center;
  color: #15344f;
  background: linear-gradient(180deg, #ffffff, #e9f4ff);
  border: 2px solid #8cb7de;
  box-shadow: 0 18px 34px rgba(8, 30, 50, 0.28);
  position: relative;
  overflow: hidden;
  animation: megaBadgePop 0.45s cubic-bezier(0.15, 0.75, 0.2, 1) both;
}

.mega-badge-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 270px;
  height: 270px;
  border-radius: 50%;
  border: 8px solid rgba(80, 148, 212, 0.23);
  transform: translate(-50%, -50%);
  animation: megaRingPulse 1.35s ease-out infinite;
}

.mega-badge-icon {
  position: relative;
  z-index: 1;
  font-size: 84px;
  margin-bottom: 8px;
  animation: megaBadgeBob 0.9s ease-in-out infinite;
}

.mega-badge-card h3 {
  margin: 6px 0 4px;
  font-size: 28px;
  color: #184a72;
}

.mega-badge-card p {
  margin: 0;
  font-size: 18px;
  color: #234665;
}

.mega-badge-overlay.fade-out {
  animation: megaBadgeOut 0.55s ease-in forwards;
}

@keyframes celebrateFly {
  0% { opacity: 0; transform: translate(-50%, 90px) scale(0.55) rotate(-5deg); }
  20% { opacity: 1; transform: translate(-50%, 25px) scale(1.08) rotate(2deg); }
  70% { opacity: 1; transform: translate(-50%, -190px) scale(1.15) rotate(-1deg); }
  100% { opacity: 0; transform: translate(-50%, -300px) scale(0.85) rotate(4deg); }
}

@keyframes megaBadgeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes megaBadgeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes megaBadgePop {
  0% { transform: translateY(22px) scale(0.74) rotate(-2deg); opacity: 0; }
  70% { transform: translateY(-4px) scale(1.03) rotate(1deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}

@keyframes megaRingPulse {
  0% { transform: translate(-50%, -50%) scale(0.84); opacity: 0.65; }
  100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0; }
}

@keyframes megaBadgeBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-4deg); }
}

@keyframes level-fly {
  0% { transform: translate(-12px, 0px) scale(0.94) rotate(-6deg); }
  25% { transform: translate(8px, -6px) scale(1.03) rotate(5deg); }
  50% { transform: translate(12px, 0px) scale(0.98) rotate(-3deg); }
  75% { transform: translate(-8px, 6px) scale(1.06) rotate(4deg); }
  100% { transform: translate(-12px, 0px) scale(0.94) rotate(-6deg); }
}

@keyframes level-pop {
  0% { transform: scale(0.6) rotate(-8deg); opacity: 0.7; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 40, 0.45);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-content {
  background: #fff;
  padding: 22px;
  border-radius: 14px;
  width: min(90vw, 430px);
  text-align: center;
  border: 1px solid var(--border);
}

.modal-content button {
  margin-top: 12px;
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  opacity: 0.9;
  z-index: 9999;
  pointer-events: none;
  border-radius: 3px;
  animation: fall 3s linear forwards;
}

@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(600px) rotate(720deg); opacity: 0; }
}

.chip {
  display: inline-block;
  margin: 4px 6px 0 0;
  padding: 6px 10px;
  border-radius: 20px;
  background: #eef3fb;
}

.score-good {
  color: #1c6e40;
  background: #eaf9ef;
  border: 1px solid #a7dfbc;
}

.score-mid {
  color: #8d5a00;
  background: #fff5dd;
  border: 1px solid #f1d08b;
}

.score-risk {
  color: #952f2f;
  background: #ffeaea;
  border: 1px solid #e8aaaa;
}

.risk-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.risk-high {
  color: #8d1f28;
  background: #ffe8eb;
  border-color: #efb1b8;
}

.risk-medium {
  color: #8d5a00;
  background: #fff5dd;
  border-color: #f0d398;
}

.risk-low {
  color: #1f6b3c;
  background: #e9f8ef;
  border-color: #abd9bb;
}

.score-pill {
  display: inline-block;
  min-width: 74px;
  text-align: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 800;
}

.score-legend {
  margin-top: 10px;
  font-size: 12px;
  color: #4a5a6b;
}

.score-legend span {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
}

body.teacher-page .panel {
  border-left: 3px solid #7fb3de;
}

body.parent-page .panel {
  border-left: 3px solid #79b8a3;
}

body.school-page .panel {
  border-left: 3px solid #9c8fcb;
}

body.teacher-page .panel h3,
body.parent-page .panel h3,
body.school-page .panel h3 {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #e4ebf3;
  border-radius: 8px;
  font-size: 16px;
}

body.teacher-page .panel h3 {
  background: linear-gradient(90deg, #eaf3ff, #f6fbff);
  color: #2a4e74;
}

body.parent-page .panel h3 {
  background: linear-gradient(90deg, #edf5ff, #f7fbff);
  color: #2a4e74;
}

body.school-page .panel h3 {
  background: linear-gradient(90deg, #f2efff, #faf8ff);
  color: #4a3f73;
}

.collapsible-section {
  border: 1px solid #dee7f0;
  border-radius: 12px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, #f9fcff, #f5f9fe);
}

.collapsible-section > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 14px;
  color: #2a4e74;
  padding: 10px 13px;
  border-radius: 12px;
  background: linear-gradient(90deg, #edf5ff, #f4f9ff);
}

.collapsible-section > summary::-webkit-details-marker {
  display: none;
}

.collapsible-section > summary::after {
  content: "▾";
  float: right;
}

.collapsible-section[open] > summary::after {
  content: "▴";
}

.collapse-body {
  padding: 12px;
}

.collapse-body .panel {
  margin-bottom: 14px;
}

.collapse-body .panel:last-child {
  margin-bottom: 0;
}

.spacer-sm {
  height: 10px;
}

.chart-box {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fbfdff;
}

.chart-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: #2b3f55;
}

.bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 56px;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  font-size: 14px;
}

.bar-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #e6eef8;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7fb2e5, #2f6ea8);
}

.org-pane {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 12px;
  align-items: stretch;
}

.org-graph-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.org-tool-btn {
  border-radius: 999px;
  white-space: nowrap;
  min-height: 30px;
  padding: 4px 10px;
}

.org-tool-expand {
  min-width: 44px;
  font-size: 22px;
  line-height: 1;
  padding: 2px 0;
}

.org-graph-canvas {
  position: relative;
  min-height: 420px;
  border: 1px solid #d8e3f0;
  border-radius: 12px;
  background:
    radial-gradient(circle at 10% 12%, rgba(195, 226, 255, 0.35), transparent 30%),
    radial-gradient(circle at 86% 84%, rgba(255, 228, 189, 0.34), transparent 30%),
    linear-gradient(180deg, #f7fbff, #f2f8ff);
  overflow: hidden;
}

body.teacher-page .org-graph-canvas {
  background:
    radial-gradient(circle at 12% 14%, rgba(153, 207, 255, 0.34), transparent 30%),
    radial-gradient(circle at 86% 84%, rgba(176, 225, 214, 0.24), transparent 30%),
    linear-gradient(180deg, #f4faff, #eef7ff);
}

body.parent-page .org-graph-canvas {
  background:
    radial-gradient(circle at 10% 14%, rgba(194, 234, 207, 0.34), transparent 30%),
    radial-gradient(circle at 86% 84%, rgba(174, 214, 255, 0.24), transparent 30%),
    linear-gradient(180deg, #f4fff8, #eefcf5);
}

body.school-page .org-graph-canvas {
  background:
    radial-gradient(circle at 10% 14%, rgba(207, 197, 245, 0.34), transparent 30%),
    radial-gradient(circle at 86% 84%, rgba(191, 219, 255, 0.24), transparent 30%),
    linear-gradient(180deg, #f7f4ff, #f1efff);
}

body.admin-page .org-graph-canvas {
  background:
    radial-gradient(circle at 10% 14%, rgba(255, 224, 190, 0.36), transparent 30%),
    radial-gradient(circle at 86% 84%, rgba(201, 227, 255, 0.26), transparent 30%),
    linear-gradient(180deg, #fff8f1, #f4f8ff);
}

.org-graph-canvas svg.org-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.org-graph-canvas line.org-edge {
  stroke: #b3c7db;
  stroke-width: 2;
  opacity: 0.72;
  transition: stroke 0.16s ease, stroke-width 0.16s ease, opacity 0.16s ease;
}

.org-graph-canvas line.org-edge.active {
  stroke: #0f78d1;
  stroke-width: 4;
  opacity: 1;
}

.org-node {
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid #c9d8eb;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(38, 66, 94, 0.16);
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  padding: 6px;
}

.org-node:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 10px 24px rgba(30, 52, 74, 0.24);
}

.org-node.active {
  border-color: #2f6ea8;
  box-shadow: 0 0 0 3px rgba(47, 110, 168, 0.25), 0 10px 24px rgba(30, 52, 74, 0.24);
}

.org-node-emoji {
  font-size: 24px;
  line-height: 1;
}

.org-node-label {
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  color: #274866;
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-node-sub {
  font-size: 10px;
  color: #587089;
  max-width: 78px;
  overflow: hidden;
  white-space: pre-line;
  line-height: 1.15;
  max-height: 2.3em;
}

.org-node-admin { background: linear-gradient(180deg, #ffe9d4, #fff7ef); }
.org-node-school { background: linear-gradient(180deg, #e8f2ff, #f6faff); }
.org-node-teacher { background: linear-gradient(180deg, #ebf8ff, #f6fdff); }
.org-node-student { background: linear-gradient(180deg, #f1fff0, #f8fff7); }
.org-node-parent { background: linear-gradient(180deg, #f7f1ff, #fcf8ff); }

.org-insight-panel {
  border: 1px solid #d8e3f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  padding: 10px 12px;
  font-size: 13px;
  color: #334f69;
  overflow: auto;
}

.org-insight-panel h4 {
  margin: 0 0 8px;
  color: #245178;
  font-size: 15px;
}

.org-insight-panel ul {
  margin: 0;
  padding-left: 16px;
}

.org-insight-panel li {
  margin: 5px 0;
}

.org-popup-modal {
  position: fixed;
  inset: 0;
  background: rgba(18, 32, 49, 0.62);
  display: grid;
  place-items: center;
  z-index: 2400;
  padding: 24px;
}

.org-popup-modal.hidden {
  display: none !important;
}

.org-popup-card {
  width: min(1320px, 94vw);
  max-height: 92vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #d5e1ef;
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(18, 39, 61, 0.24);
  padding: 12px;
}

.org-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.org-popup-head h3 {
  margin: 0;
  color: #234d73;
}

.org-popup-pane .org-graph-canvas {
  min-height: 70vh;
}

.org-key {
  color: #264f73;
  font-weight: 800;
}

.org-val-blue { color: #2f6ea8; font-weight: 800; }
.org-val-green { color: #2f855a; font-weight: 800; }
.org-val-amber { color: #b57718; font-weight: 800; }
.org-val-red { color: #b54747; font-weight: 800; }

@media (max-width: 700px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 16px;
  }

  .buttons {
    grid-template-columns: 1fr;
  }

  .brand-header {
    justify-content: flex-start;
    padding-top: 22px;
  }

  .brand-feedback {
    top: 4px;
    right: 10px;
    font-size: 11px;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  #question {
    font-size: 24px;
  }

  .news-rail,
  .resources-rail,
  .news-live-rail {
    display: none;
  }

  .bottom-info-dock {
    grid-template-columns: 1fr;
  }

  body.kids-page .kids-rail {
    display: block;
  }

  .actions {
    flex-wrap: wrap;
  }

  .action-right {
    margin-left: 0;
  }

  .feedback-footer {
    position: static;
    margin-top: 10px;
  }

  .org-pane {
    grid-template-columns: 1fr;
  }

  .org-graph-canvas {
    min-height: 360px;
  }

  body.kid-dash-page .kid-console-layout {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  body.kid-dash-page .kid-left-nav {
    flex-direction: row;
    justify-content: space-between;
    overflow-x: auto;
    padding: 8px;
  }

  body.kid-dash-page .kid-nav-item {
    flex: 0 0 78px;
    min-height: 56px;
  }
}

@media (max-width: 1120px) {
  body.teacher-page .side-rail,
  body.parent-page .side-rail {
    width: min(980px, calc(100% - 24px));
    display: block;
    margin: 8px auto;
  }

  .bottom-info-dock {
    grid-template-columns: 1fr;
  }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 110, 168, 0.25); }
  50% { box-shadow: 0 0 0 8px rgba(47, 110, 168, 0); }
}

@keyframes ticker-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

@media print {
  body {
    background: #fff;
    padding: 0;
  }

  button,
  .top-links,
  .side-rail,
  .feedback-footer {
    display: none !important;
  }

  body.kids-page.print-kids > * {
    display: none !important;
  }

  body.kids-page.print-kids.print-kids-certificate .certificate-container {
    display: block !important;
  }

  body.kids-page.print-kids.print-kids-summary .summary-container {
    display: block !important;
  }

  body.kids-page.print-kids.print-kids-both .certificate-container,
  body.kids-page.print-kids.print-kids-both .summary-container {
    display: block !important;
  }

  body.print-teacher #loginPanel,
  body.print-teacher h1,
  body.print-teacher .top-links {
    display: none !important;
  }

  body.print-teacher .dash-wrap > *:not(#dashboardPanel) {
    display: none !important;
  }

  body.print-parent > *:not(.dash-wrap) {
    display: none !important;
  }

  body.print-parent .dash-wrap > *:not(#parentReport) {
    display: none !important;
  }

  body.print-parent #parentReport,
  body.print-teacher #dashboardPanel {
    display: block !important;
  }
}

/* Additional module gameplay pages (behavioural + ethical AI companion). */
.module-page .dashboard-subtitle {
  color: #e8f3ff;
}

.module-wrap {
  max-width: 980px;
}

.module-actions {
  gap: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.module-resume-banner {
  margin: 8px auto 12px;
  background: #eaf6ff;
  border: 1px solid #c7dff3;
  border-radius: 10px;
  padding: 8px 12px;
  color: #214b71;
  font-weight: 700;
}

.module-header-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.module-pill {
  background: #edf5ff;
  border: 1px solid #cfe2f7;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  color: #27557f;
}

.module-progress {
  margin-bottom: 10px;
}

.question-block {
  margin: 10px 0 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #d8e5f3;
  background: #f7fbff;
  font-size: 20px;
  font-weight: 700;
  color: #1f3954;
}

.module-picker {
  margin: 10px 0 12px;
  text-align: left;
}

.module-picker-title {
  margin: 0 0 8px;
  font-weight: 800;
  color: #264766;
}

.module-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.module-option {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 10px;
  border: 1px solid #cddff0;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fcff, #eef6ff);
  cursor: pointer;
}

body.kids-page .module-picker {
  margin-top: 8px;
}

body.kids-page .module-picker-title {
  text-align: center;
  font-size: 14px;
}

body.kids-page .module-picker-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.kids-page .module-option {
  align-items: center;
  justify-items: center;
  text-align: center;
  padding: 10px 8px;
  min-height: 118px;
}

body.kids-page .module-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.kids-page .module-option .module-icon {
  font-size: 28px;
}

body.kids-page .module-option .module-name {
  font-size: 14px;
}

body.kids-page .module-option .module-desc {
  font-size: 11px;
}

.module-option input {
  justify-self: start;
}

.module-option .module-icon { font-size: 22px; }
.module-option .module-name { font-weight: 800; color: #254e72; }
.module-option .module-desc { font-size: 12px; color: #496279; }
.module-option.module-behavioural { background: linear-gradient(180deg, #f5fbf6, #eaf7ec); border-color: #c9e6cf; }
.module-option.module-ai { background: linear-gradient(180deg, #f7f6ff, #edebff); border-color: #d7d4f4; }
.module-option:has(input:checked) {
  border-color: #4b88bc;
  box-shadow: 0 0 0 2px rgba(75, 136, 188, 0.16);
}

.module-option.locked {
  opacity: 0.55;
  border-style: dashed;
  cursor: not-allowed;
}

.module-option.locked .module-desc::after {
  content: " (Purchase Required)";
  color: #7a3f3f;
  font-weight: 700;
}

.session-timeout-banner {
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff5d9;
  border: 1px solid #f2d487;
  color: #7a5816;
  font-weight: 700;
  font-size: 13px;
  text-align: left;
}

.session-timeout-banner button {
  margin-left: 8px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.resume-session-panel {
  margin: 8px auto 10px;
  max-width: 760px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #cfe2f6;
  background: linear-gradient(180deg, #f7fbff, #eef5ff);
}

.resume-session-panel .resume-title {
  margin: 0 0 8px;
  color: #1f4e78;
  font-weight: 800;
}

.resume-session-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.resume-session-item {
  border: 1px solid #d4e6f7;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-height: 74px;
  width: 100%;
  box-sizing: border-box;
}

.resume-session-item input[type="radio"] {
  margin-top: 3px;
}

.resume-session-item .resume-session-main {
  flex: 1;
}

.resume-session-item .resume-session-main strong {
  color: #1f4b74;
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.resume-session-item .resume-session-sub {
  display: block;
  color: #516a80;
  font-size: 12px;
  margin-top: 2px;
}

body.module-theme-behavioural {
  background:
    radial-gradient(circle at 10% 12%, rgba(178, 226, 186, 0.25), transparent 26%),
    linear-gradient(180deg, #f2fbf3, #f7fffa);
}

body.module-theme-ai {
  background:
    radial-gradient(circle at 90% 12%, rgba(195, 190, 255, 0.25), transparent 28%),
    linear-gradient(180deg, #f4f5ff, #fbfbff);
}

/* Avatar theme should remain visible even when a module theme is selected. */
body.kids-page.kids-avatar-theme-forest,
body.kids-page.module-theme-behavioural.kids-avatar-theme-forest,
body.kids-page.module-theme-ai.kids-avatar-theme-forest {
  background:
    radial-gradient(circle at 14% 18%, rgba(166, 232, 190, 0.52), transparent 30%),
    radial-gradient(circle at 84% 14%, rgba(197, 242, 180, 0.46), transparent 30%),
    linear-gradient(180deg, #edfbee, #f8fff3);
}

body.kids-page.kids-avatar-theme-ocean,
body.kids-page.module-theme-behavioural.kids-avatar-theme-ocean,
body.kids-page.module-theme-ai.kids-avatar-theme-ocean {
  background:
    radial-gradient(circle at 16% 16%, rgba(170, 225, 255, 0.56), transparent 32%),
    radial-gradient(circle at 86% 14%, rgba(153, 212, 255, 0.45), transparent 28%),
    linear-gradient(180deg, #e9f7ff, #f3fbff);
}

body.kids-page.kids-avatar-theme-space,
body.kids-page.module-theme-behavioural.kids-avatar-theme-space,
body.kids-page.module-theme-ai.kids-avatar-theme-space {
  background:
    radial-gradient(circle at 82% 16%, rgba(208, 190, 255, 0.4), transparent 28%),
    radial-gradient(circle at 12% 14%, rgba(183, 205, 255, 0.34), transparent 30%),
    linear-gradient(180deg, #eef1ff, #f7f8ff);
}

body.kids-page.kids-avatar-theme-sunrise,
body.kids-page.module-theme-behavioural.kids-avatar-theme-sunrise,
body.kids-page.module-theme-ai.kids-avatar-theme-sunrise {
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 218, 176, 0.5), transparent 30%),
    radial-gradient(circle at 84% 14%, rgba(255, 200, 173, 0.36), transparent 28%),
    linear-gradient(180deg, #fff2e5, #fff9f2);
}

.session-indicators {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 6px;
}

.active-timer {
  padding: 6px 10px;
  border-radius: 10px;
  background: #edf6ff;
  border: 1px solid #cfe2f7;
  color: #234d74;
  font-size: 12px;
  font-weight: 800;
}

.session-meta-pill {
  max-width: 52%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.kids-page #setup h3,
body.kids-page #levelTitle {
  text-align: center;
  color: #1f4e78;
}

body.kids-page #setup h3 {
  margin-bottom: 10px;
}

body.kids-page #authStatus {
  text-align: center;
  margin-top: 2px;
  margin-bottom: 8px;
  font-size: 12px;
}

body.kids-page #kidLoginPanel.hidden {
  display: none !important;
}

body.kids-page .quick-login-row {
  margin-bottom: 7px;
}

body.kids-page .quick-login-row input {
  margin-bottom: 0;
}

body.kids-page #startGameBtn {
  width: 100%;
  max-width: 300px;
  display: block;
  margin: 8px auto 0;
  min-height: 46px;
  font-size: 18px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #3d9be0, #2f76b8);
  border-color: #2d6ca5;
  box-shadow: 0 10px 20px rgba(34, 92, 138, 0.3);
}

body.kids-page #game .stats {
  margin-top: 10px;
}

body.kids-page #game .progress {
  max-width: 760px;
  margin: 16px auto;
}

body.kids-page .game-actions {
  margin-top: 14px;
}

body.kids-page .game-actions button {
  min-width: 210px;
  min-height: 44px;
  border-radius: 999px;
  background: linear-gradient(180deg, #eef9ff, #d8edff);
}

body.kids-page .session-indicators {
  margin-bottom: 10px;
}

#avatarPicker {
  margin-top: 2px;
}

body.kids-page .kids-links-bottom {
  margin: 8px auto 8px;
  padding: 8px 10px;
}

body.kids-page .kids-links-bottom h4 {
  margin-bottom: 4px;
}

body.kids-page .kids-links-bottom .links-inline {
  gap: 4px 12px;
}

@keyframes sketchFloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-7px) rotate(4deg); }
}

@media (max-width: 760px) {
  .kid-sketch-layer {
    height: 130px;
  }
  body.kids-page .module-picker-grid {
    grid-template-columns: 1fr;
  }
  body.kids-page .buttons {
    grid-template-columns: 1fr;
  }
  body.kids-page #question {
    font-size: clamp(20px, 6vw, 25px);
  }
  body.kids-page .top-links {
    text-align: center;
  }
  .story-stage {
    grid-template-columns: 1fr;
  }
  .story-visual {
    min-height: 220px;
  }
  .story-hazard-btn {
    min-width: 96px;
    padding: 5px 8px;
  }
  .story-hazard-btn .hz-label {
    font-size: 11px;
  }
}
