:root {
  --bg: #f4f8ff;
  --paper: #fbfdff;
  --paper-strong: #ffffff;
  --ink: #1d2f45;
  --muted: #6b7d92;
  --accent: #3f79bd;
  --accent-strong: #244f84;
  --accent-soft: #e4eefb;
  --line: #dbe7f4;
  --line-strong: #c7d8ea;
  --shadow: 0 18px 42px rgba(98, 134, 184, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(127, 180, 240, 0.22), transparent 22%),
    radial-gradient(circle at top right, rgba(162, 202, 238, 0.18), transparent 22%),
    linear-gradient(180deg, #fcfeff 0%, #f5f9ff 45%, #edf4fd 100%);
}

.page-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 18px 80px;
}

.focus-exit-floating {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: auto;
  min-height: 50px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(20, 55, 102, 0.22);
  background: linear-gradient(135deg, #163b70 0%, #2d67ad 100%);
  color: #ffffff;
  box-shadow: 0 16px 28px rgba(25, 68, 125, 0.24);
  font-weight: 800;
  letter-spacing: -0.02em;
  display: none;
}

.topbar {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 18px;
  margin-bottom: 18px;
  align-items: stretch;
}

.brand-block,
.topbar-side,
.auth-card,
.overview-card,
.panel,
.auth-stage {
  background: rgba(251, 253, 255, 0.94);
  border: 1px solid rgba(63, 121, 189, 0.1);
  box-shadow: var(--shadow);
  border-radius: 28px;
  backdrop-filter: blur(10px);
}

.brand-block {
  display: flex;
  flex-direction: column;
  padding: 28px;
  height: 100%;
}

.brand-lockup {
  display: block;
  margin-bottom: 22px;
}

.brand-mark {
  display: block;
  width: min(420px, 100%);
  line-height: 0;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.topbar-side {
  height: 100%;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-chip {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #edf5ff);
  border: 1px solid rgba(63, 121, 189, 0.12);
  font-weight: 700;
}

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-guide-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: 18px;
  margin-top: 18px;
  padding: 20px;
  border-radius: 26px;
  background:
    radial-gradient(circle at top right, rgba(125, 173, 230, 0.22), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(234, 243, 255, 0.95));
  border: 1px solid rgba(63, 121, 189, 0.14);
  box-shadow: 0 18px 34px rgba(88, 130, 185, 0.12);
}

.hero-guide-copy {
  display: grid;
  align-content: start;
  gap: 12px;
}

.hero-guide-copy h3 {
  font-size: 1.45rem;
  line-height: 1.2;
}

.hero-guide-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.68;
}

.hero-guide-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-guide-points span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(63, 121, 189, 0.12);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 800;
}

.hero-guide-copy button {
  width: fit-content;
  min-width: 220px;
}

.hero-guide-visual {
  display: grid;
  align-items: stretch;
}

.hero-guide-screen {
  display: grid;
  gap: 12px;
  min-height: 240px;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(225, 238, 255, 0.95));
  border: 1px solid rgba(63, 121, 189, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hero-guide-content {
  display: grid;
  gap: 14px;
}

.hero-guide-flow-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, #ffffff, #ecf5ff);
  border: 1px solid rgba(63, 121, 189, 0.12);
}

.hero-guide-flow-card strong {
  font-size: 1.05rem;
}

.hero-guide-flow-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.hero-guide-flow-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hero-guide-mini-card {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 96px;
  padding: 14px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(63, 121, 189, 0.12);
  text-align: center;
}

.hero-guide-mini-card strong {
  font-size: 0.94rem;
}

.hero-guide-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eaf3ff, #d5e8ff);
  color: var(--accent-strong);
  font-size: 0.96rem;
  font-weight: 900;
}

.hero-guide-mini-card.level-up .hero-guide-icon {
  background: linear-gradient(135deg, #fff3ea, #ffe0c4);
  color: #a85e18;
}

.hero-guide-mini-card.student-link .hero-guide-icon {
  background: linear-gradient(135deg, #f5ecff, #e4d4ff);
  color: #6b4da6;
}

.hero-guide-mini-card.worksheet .hero-guide-icon {
  background: linear-gradient(135deg, #edf6ff, #d3e8ff);
  color: #285f9f;
}

.hero-guide-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-guide-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(63, 121, 189, 0.1);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.hero-guide-badge.eng {
  background: rgba(195, 79, 134, 0.12);
  color: #b2487b;
}

.hero-guide-badge.math {
  background: rgba(63, 121, 189, 0.12);
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 3vw, 2.55rem);
  line-height: 1.14;
  letter-spacing: -0.03em;
  max-width: 18ch;
}

h2,
h3 {
  margin: 0;
}

.hero-copy,
.muted {
  color: var(--muted);
}

.auth-copy {
  padding: 2px 2px 0;
}

.auth-copy h2 {
  font-size: 1.05rem;
  line-height: 1.1;
}

.auth-copy .muted {
  margin: 6px 0 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.auth-card {
  padding: 16px;
}

.auth-hero-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.hero-auth-card {
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.auth-header,
.auth-actions,
.panel-head,
.workspace-head {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.panel-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-actions {
  margin-top: 12px;
}

.auth-role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.auth-role-button {
  min-height: 52px;
  font-size: 1.02rem;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.auth-role-button:hover {
  transform: translateY(-1px);
}

.auth-role-button.active {
  background: linear-gradient(135deg, #5d94d2, var(--accent-strong));
  color: #fff;
  box-shadow: 0 10px 22px rgba(69, 126, 196, 0.22);
}

.auth-primary-actions {
  margin-top: 10px;
}

#start-journey-button {
  position: relative;
  padding-right: 52px;
}

.start-journey-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.start-journey-google {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
}

body[data-app-role="guest"] .start-journey-google {
  display: inline-flex;
}

body[data-app-role="student"] .start-journey-google,
body[data-app-role="parent"] .start-journey-google,
body[data-app-role="admin"] .start-journey-google {
  display: none;
}

.auth-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
}

.auth-shortcuts .compact-button {
  min-height: 42px;
  padding: 10px 12px;
  font-size: 0.96rem;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.auth-shortcuts .compact-button:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 103, 173, 0.22);
  background: linear-gradient(135deg, #ffffff, #dfeeff);
  box-shadow: 0 14px 26px rgba(69, 126, 196, 0.14);
}

.auth-shortcuts .compact-button:active {
  transform: translateY(0);
  box-shadow: 0 8px 14px rgba(69, 126, 196, 0.12);
}

.full-guide-button {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  font-weight: 800;
}

.compact-button.has-new {
  position: relative;
  padding-right: 48px;
}

.compact-button .new-pill {
  position: absolute;
  top: 8px;
  right: 10px;
  min-width: 34px;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff729f, #ff4d81);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.2;
  box-shadow: 0 8px 18px rgba(255, 77, 129, 0.28);
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.site-profile-bar {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.site-profile-bar .profile-summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.95fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(235, 245, 255, 0.96));
  border: 1px solid rgba(63, 121, 189, 0.14);
  box-shadow: 0 14px 28px rgba(80, 123, 179, 0.1);
}

.site-profile-bar .profile-summary-main {
  display: grid;
  gap: 10px;
}

.site-profile-bar .profile-summary-head {
  align-items: center;
}

.site-profile-bar .profile-summary-head .section-kicker {
  margin-bottom: 4px;
}

.site-profile-bar .achievement-badge {
  justify-self: end;
}

.site-profile-bar .profile-level-detail {
  min-height: 52px;
  padding: 10px 14px;
}

.site-profile-bar .achievement-strip {
  display: none;
}

.mastery-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mastery-status-card {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.96));
  border: 1px solid rgba(63, 121, 189, 0.1);
}

.mastery-status-card strong {
  font-size: 1.02rem;
  color: var(--ink);
}

.subject-stat-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.subject-stat-card {
  display: grid;
  gap: 8px;
  min-height: 98px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(63, 121, 189, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 255, 0.96));
}

.subject-stat-card.math {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 245, 255, 0.96));
}

.subject-stat-card.english {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 241, 248, 0.96));
  border-color: rgba(195, 79, 134, 0.14);
}

.subject-stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.subject-stat-head strong {
  font-size: 1rem;
}

.subject-stat-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(63, 121, 189, 0.1);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.subject-stat-card.english .subject-stat-chip {
  background: rgba(195, 79, 134, 0.12);
  color: #b2487b;
}

.subject-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.subject-stat-grid div {
  display: grid;
  gap: 2px;
}

.subject-stat-grid strong {
  font-size: 1.06rem;
  color: var(--ink);
}

.site-profile-bar .mastery-slider-card {
  padding: 10px 12px;
  border-radius: 18px;
}

.site-profile-bar .mastery-slider-head strong {
  font-size: 0.96rem;
}

.site-profile-bar .mastery-slider-window {
  border-radius: 14px;
}

.site-profile-bar .mastery-slider-track {
  gap: 12px;
  padding: 10px 12px;
}

.site-profile-bar .mastery-badge-chip {
  width: 72px;
}

.site-profile-bar .mastery-badge-chip img {
  width: 48px;
  height: 48px;
}

.site-profile-bar .mastery-badge-chip span {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.guide-stage {
  display: grid;
  gap: 16px;
  padding: 22px;
  margin-bottom: 18px;
  background: rgba(251, 253, 255, 0.94);
  border: 1px solid rgba(63, 121, 189, 0.1);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

.guide-manual-page {
  display: grid;
  gap: 18px;
  padding: 22px;
  margin-bottom: 18px;
  background: rgba(251, 253, 255, 0.94);
  border: 1px solid rgba(63, 121, 189, 0.1);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

.guide-manual-body {
  display: grid;
  gap: 14px;
}

.guide-manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.guide-manual-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.96));
  border: 1px solid rgba(63, 121, 189, 0.12);
}

.guide-manual-card .section-kicker {
  font-size: 0.98rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-transform: none;
  margin-bottom: 2px;
}

.guide-manual-card h4 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
}

.guide-manual-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.guide-manual-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  display: grid;
  gap: 8px;
  line-height: 1.55;
}

.guide-manual-list li strong {
  color: var(--ink);
}

.guide-modal-card {
  max-height: min(86vh, 920px);
  overflow: auto;
}

.guide-modal-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.guide-stage-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.guide-slider {
  position: relative;
  min-height: 270px;
}

.guide-slide {
  display: none;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: center;
  padding: 12px 4px 4px;
}

.guide-slide.active {
  display: grid;
}

.guide-copy strong {
  display: block;
  margin-bottom: 10px;
  font-size: 1.55rem;
}

.guide-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 38ch;
}

.guide-art {
  min-height: 220px;
  padding: 22px;
  border-radius: 30px;
  border: 1px solid rgba(63, 121, 189, 0.1);
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.82), transparent 28%),
    linear-gradient(135deg, #ffffff, #eaf3ff);
  display: grid;
  align-items: center;
  overflow: hidden;
}

.guide-showcase {
  width: 100%;
  height: 100%;
  display: grid;
}

.guide-showcase-math {
  position: relative;
  align-items: center;
  justify-items: center;
}

.guide-device-card {
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(63, 121, 189, 0.08);
  box-shadow: 0 22px 38px rgba(98, 134, 184, 0.16);
}

.guide-device-main {
  width: min(100%, 360px);
  min-height: 190px;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.guide-device-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5f84ac;
  font-weight: 800;
}

.guide-equation {
  font-size: 2.3rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--accent-strong);
}

.guide-progress-mini {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.guide-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(31, 44, 51, 0.08);
  overflow: hidden;
}

.guide-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, #75a8df, #356baa);
}

.guide-device-float {
  position: absolute;
  min-width: 132px;
  min-height: 82px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--accent-strong);
}

.guide-device-float.top {
  top: 18px;
  right: 18px;
}

.guide-device-float.bottom {
  bottom: 18px;
  left: 18px;
}

.guide-showcase-review {
  grid-template-columns: minmax(0, 1.15fr) minmax(140px, 0.7fr);
  gap: 18px;
  align-items: center;
}

.guide-review-sheet {
  min-height: 188px;
  padding: 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(63, 121, 189, 0.08);
  box-shadow: 0 22px 38px rgba(98, 134, 184, 0.16);
  display: grid;
  gap: 12px;
}

.guide-review-row {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #f2f7fd;
  display: flex;
  align-items: center;
  font-weight: 800;
  color: var(--ink);
}

.guide-review-row.strong {
  background: linear-gradient(135deg, #edf5ff, #dceafd);
}

.guide-review-row.accent {
  background: linear-gradient(135deg, #ddeafb, #eef5ff);
  color: var(--accent-strong);
}

.guide-review-stack {
  display: grid;
  gap: 12px;
}

.guide-card-mini {
  width: 100%;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(63, 121, 189, 0.08);
  font-weight: 800;
  color: var(--ink);
  box-shadow: 0 12px 24px rgba(98, 134, 184, 0.12);
}

.guide-showcase-report {
  align-items: center;
  justify-items: center;
}

.guide-report-card {
  width: min(100%, 360px);
  min-height: 200px;
  padding: 22px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(63, 121, 189, 0.08);
  box-shadow: 0 22px 38px rgba(98, 134, 184, 0.16);
  display: grid;
  gap: 16px;
}

.guide-report-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-weight: 800;
}

.guide-report-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: #e6f0fb;
  color: var(--accent-strong);
}

.guide-chart {
  min-height: 96px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.guide-chart-bar {
  width: 100%;
  border-radius: 18px 18px 8px 8px;
  background: linear-gradient(180deg, #8cb8e9, var(--accent));
}

.guide-report-lines {
  display: grid;
  gap: 10px;
}

.guide-report-lines div {
  height: 12px;
  border-radius: 999px;
  background: rgba(63, 121, 189, 0.14);
}

.guide-report-lines .short {
  width: 62%;
}

.guide-dots {
  display: flex;
  gap: 8px;
}

.guide-dot {
  width: 12px;
  min-height: 12px;
  height: 12px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: rgba(63, 121, 189, 0.16);
  box-shadow: none;
}

.guide-dot.active {
  width: 30px;
  background: linear-gradient(135deg, #70a4df, var(--accent-strong));
}

.overview-card {
  padding: 18px;
}

.overview-card strong {
  display: block;
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.overview-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.app-layout {
  display: grid;
  gap: 28px;
}

.workspace {
  display: grid;
  gap: 16px;
}

.workspace-head {
  padding: 0 4px;
}

.workspace-head h2 {
  font-size: 1.9rem;
}

.workspace-grid {
  display: grid;
  gap: 16px;
}

.student-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.admin-grid {
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1.22fr);
}

.panel {
  padding: 20px;
}

.feature-panel {
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(136, 182, 235, 0.18), transparent 24%),
    rgba(252, 254, 255, 0.98);
}

#practice-panel {
  grid-column: 1 / -1;
}

#worksheet-web-panel {
  grid-column: 1 / -1;
}

.wide-panel {
  grid-column: span 2;
}

.worksheet-panel-wide {
  grid-column: 1 / -1;
}

.practice-toolbar,
.grid-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.subject-chooser {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 14px;
}

.subject-tile {
  display: grid;
  justify-items: start;
  gap: 6px;
  min-height: 124px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(63, 121, 189, 0.1);
  background: linear-gradient(180deg, #ffffff, #eef5ff);
  color: var(--ink);
  text-align: left;
}

.subject-tile strong {
  font-size: 1.28rem;
}

.subject-tile .muted {
  line-height: 1.45;
}

.subject-tile.active {
  border-color: rgba(63, 121, 189, 0.34);
  box-shadow: 0 18px 34px rgba(98, 134, 184, 0.18);
  transform: translateY(-2px);
}

.subject-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(63, 121, 189, 0.1);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.practice-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(250px, 0.62fr);
  gap: 10px;
  margin-top: 10px;
}

.practice-main {
  display: grid;
  gap: 12px;
}

.practice-side {
  display: grid;
  align-content: start;
  gap: 10px;
}

.coach-card,
.preview-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #eef5ff);
}

.coach-card strong,
.preview-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.coach-card p,
.preview-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.stack,
.compact-form {
  display: grid;
  gap: 12px;
}

.dual-field,
.triple-field,
.summary-grid,
.child-metrics {
  display: grid;
  gap: 10px;
}

.difficulty-choice {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dual-field {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.triple-field {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.difficulty-chip {
  min-height: 64px;
  border-radius: 22px;
  border: 1px solid rgba(63, 121, 189, 0.14);
  background: linear-gradient(180deg, #ffffff, #f1f7ff);
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease, background 150ms ease;
}

.difficulty-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 103, 173, 0.28);
}

.difficulty-chip.active {
  color: #fff;
  border-color: rgba(38, 87, 147, 0.7);
  background: linear-gradient(135deg, #6fa5e0, #2f67ad);
  box-shadow: 0 14px 28px rgba(47, 103, 173, 0.22);
}

.summary-grid,
.child-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

input,
select,
button {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.96);
}

button {
  border: none;
  background: linear-gradient(135deg, #5d94d2, var(--accent-strong));
  color: white;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(69, 126, 196, 0.22);
}

button.secondary {
  background: linear-gradient(135deg, #f3f8ff, #e5effc);
  color: var(--ink);
  box-shadow: none;
}

.compact-button {
  width: auto;
  min-height: 42px;
  padding: 10px 16px;
}

.progress-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(63, 121, 189, 0.14);
  background: linear-gradient(135deg, #f7fbff, #e7f0fb);
  font-weight: 800;
}

.result,
.list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.card,
.answer-row,
.review-card,
.child-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.student-roster-card {
  display: grid;
  gap: 10px;
}

.profile-summary-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #edf5ff);
  border: 1px solid rgba(63, 121, 189, 0.14);
}

.modal-shell {
  position: fixed;
  inset: 0;
  background: rgba(17, 34, 58, 0.32);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 24px;
  backdrop-filter: blur(8px);
}

.modal-shell[hidden],
.badge-celebration-shell[hidden] {
  display: none !important;
}

.badge-celebration-shell {
  position: fixed;
  inset: 0;
  z-index: 48;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(137, 188, 240, 0.42), rgba(10, 30, 58, 0.82)),
    rgba(10, 30, 58, 0.78);
  backdrop-filter: blur(8px);
}

.badge-celebration-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.28), transparent 18%),
    radial-gradient(circle at 80% 22%, rgba(140, 214, 255, 0.24), transparent 16%),
    radial-gradient(circle at 30% 78%, rgba(121, 165, 255, 0.22), transparent 18%),
    radial-gradient(circle at 72% 72%, rgba(255, 255, 255, 0.18), transparent 20%);
  animation: celebrationPulse 2200ms ease-in-out infinite;
}

.badge-celebration-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  justify-items: center;
  width: min(520px, 100%);
  padding: 30px 28px;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(233, 244, 255, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 32px 90px rgba(11, 38, 71, 0.34);
  animation: celebrationRise 520ms ease-out;
}

.badge-celebration-card img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(46, 108, 173, 0.2));
}

.level-celebration-shell .badge-celebration-burst {
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.24), transparent 18%),
    radial-gradient(circle at 80% 22%, rgba(255, 230, 122, 0.28), transparent 16%),
    radial-gradient(circle at 30% 78%, rgba(255, 162, 214, 0.2), transparent 18%),
    radial-gradient(circle at 72% 72%, rgba(140, 214, 255, 0.22), transparent 20%);
}

.level-celebration-card {
  border-color: rgba(90, 140, 212, 0.26);
  box-shadow: 0 32px 90px rgba(35, 79, 135, 0.3);
}

.level-celebration-card h3 {
  color: #234f87;
}

@keyframes celebrationPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.92;
  }

  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@keyframes celebrationRise {
  0% {
    transform: translateY(26px) scale(0.94);
    opacity: 0;
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-card {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 246, 255, 0.98));
  border: 1px solid rgba(63, 121, 189, 0.14);
  box-shadow: 0 28px 80px rgba(39, 77, 128, 0.18);
}

.modal-card-wide {
  width: min(1080px, 100%);
}

.form-note {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid rgba(63, 121, 189, 0.1);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.form-note strong {
  color: var(--accent-strong);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profile-identity-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-nickname {
  font-size: 1.18rem;
  font-weight: 900;
  color: var(--ink);
}

.profile-subline {
  color: var(--muted);
  font-size: 0.94rem;
}

.level-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f3f8ff, #dcecff);
  border: 1px solid rgba(63, 121, 189, 0.14);
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--accent-strong);
}

.level-pill img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.profile-level-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(63, 121, 189, 0.1);
}

.mastery-slider-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(235, 245, 255, 0.88));
  border: 1px solid rgba(63, 121, 189, 0.12);
}

.mastery-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mastery-slider-window {
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(63, 121, 189, 0.08);
}

.mastery-slider-track {
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  padding: 12px 14px;
  animation: badge-marquee 22s linear infinite;
}

.mastery-slider-window:hover .mastery-slider-track {
  animation-play-state: paused;
}

.mastery-badge-chip {
  width: 88px;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
}

.mastery-badge-chip img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(55, 96, 148, 0.12));
}

.mastery-badge-chip span {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.badge-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.badge-gallery-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(63, 121, 189, 0.12);
}

.badge-gallery-card img {
  width: 112px;
  height: 112px;
  justify-self: center;
  object-fit: contain;
}

.badge-gallery-card strong {
  text-align: center;
}

.badge-gallery-card .muted {
  text-align: center;
  font-size: 13px;
}

@keyframes badge-marquee {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

.profile-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.profile-title {
  margin: 0;
  font-size: 1.08rem;
}

.achievement-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #70a4df, #2f67ad);
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.profile-metric {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(63, 121, 189, 0.1);
}

.profile-metric strong {
  display: block;
  font-size: 1.12rem;
}

.achievement-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.achievement-pill {
  padding: 7px 11px;
  border-radius: 999px;
  background: #e9f2ff;
  font-size: 12px;
  font-weight: 700;
}

.mastery-board {
  display: grid;
  gap: 10px;
}

.level-progress-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--line);
}

.level-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.level-progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(24, 36, 42, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #8fbaeb);
}

.progress-fill.mastered {
  background: linear-gradient(135deg, #6aa76f, #9ac36b);
}

.progress-fill.review-needed {
  background: linear-gradient(135deg, #d27055, #c84f43);
}

.answer-row {
  padding: 18px;
  border-radius: 22px;
  box-shadow: 0 10px 26px rgba(68, 101, 144, 0.06);
}

.card strong {
  font-size: 1rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e6f0fb;
  font-size: 12px;
  font-weight: 800;
}

.answer-row label {
  margin-bottom: 8px;
  font-weight: 700;
  line-height: 1.55;
  font-size: 0.98rem;
}

.problem-line {
  display: flex;
  align-items: center;
  gap: 14px;
}

.problem-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #edf5ff, #d9e9fb);
  color: var(--accent-strong);
  font-size: 1.1rem;
  font-weight: 900;
  flex: 0 0 auto;
}

.problem-text {
  display: block;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.problem-helper {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f4f9ff;
  border: 1px solid rgba(63, 121, 189, 0.12);
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.review-card.correct {
  border-color: #a3c59c;
  background: #f4fbf2;
}

.review-card.wrong {
  border-color: #e0b0aa;
  background: #fff6f5;
}

.review-answer {
  margin-top: 8px;
  color: var(--muted);
}

.problem-visual {
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  background: #f4f9ff;
}

.problem-passage-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-style: solid;
  background: linear-gradient(180deg, #f7fbff, #edf5ff);
}

.problem-passage-label,
.problem-question-label {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.problem-passage-text {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(63, 121, 189, 0.1);
  color: #28425f;
  font-size: 1.08rem;
  line-height: 1.8;
  white-space: pre-line;
}

.problem-question-text {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(63, 121, 189, 0.08);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 700;
}

.audio-row {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.audio-guide {
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef5ff;
  border: 1px solid rgba(63, 121, 189, 0.12);
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.answer-example {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid rgba(63, 121, 189, 0.1);
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.answer-example strong {
  color: var(--accent-strong);
}

.answer-notice {
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #f7fbff;
  border: 1px solid rgba(63, 121, 189, 0.12);
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.vertical-math {
  width: 120px;
  margin-left: auto;
  font-family: "Courier New", monospace;
  font-size: 22px;
  text-align: right;
}

.vertical-math .line {
  border-bottom: 2px solid #4f7097;
  margin: 4px 0 6px;
}

.geometry-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.geometry-rect {
  position: relative;
  width: 140px;
  height: 90px;
  border: 3px solid var(--accent);
  margin: 12px auto;
}

.geometry-triangle {
  width: 0;
  height: 0;
  margin: 12px auto;
  border-left: 70px solid transparent;
  border-right: 70px solid transparent;
  border-bottom: 120px solid rgba(63, 121, 189, 0.22);
  position: relative;
}

.geometry-triangle::after {
  content: "";
  position: absolute;
  left: -66px;
  top: 6px;
  width: 0;
  height: 0;
  border-left: 66px solid transparent;
  border-right: 66px solid transparent;
  border-bottom: 110px solid #fff;
}

.geometry-circle {
  width: 120px;
  height: 120px;
  margin: 12px auto;
  border-radius: 50%;
  border: 3px solid var(--accent);
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-weight: 800;
}

.geometry-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.94rem;
}

.fraction-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.fraction-mark {
  display: inline-grid;
  justify-items: center;
  min-width: 42px;
  line-height: 1;
}

.fraction-top,
.fraction-bottom {
  font-size: 1.2rem;
  font-weight: 800;
}

.fraction-line {
  width: 100%;
  min-width: 36px;
  height: 2px;
  margin: 4px 0;
  background: var(--ink);
  border-radius: 999px;
}

.fraction-operator,
.fraction-whole,
.fraction-answer-box {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--accent-strong);
}

.probability-card {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.probability-ball-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.probability-ball {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.26);
}

.probability-ball.red {
  background: radial-gradient(circle at 30% 30%, #ffb7b7, #d84b4b);
}

.probability-ball.blue {
  background: radial-gradient(circle at 30% 30%, #bdd8ff, #4e7fda);
}

.power-mark {
  display: inline-flex;
  align-items: flex-start;
  gap: 1px;
}

.power-mark sup {
  font-size: 0.45em;
  line-height: 1;
  position: relative;
  top: 0.08em;
}

.geometry-label-top,
.geometry-label-side {
  position: absolute;
  font-size: 12px;
  color: var(--muted);
}

.geometry-label-top {
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
}

.geometry-label-side {
  right: -38px;
  top: 50%;
  transform: translateY(-50%);
}

.summary-stat,
.child-metric {
  padding: 14px;
  border-radius: 16px;
  background: #f4f9ff;
  border: 1px solid rgba(63, 121, 189, 0.08);
}

.summary-stat strong,
.child-metric strong {
  display: block;
  font-size: 1.25rem;
}

.child-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.child-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 245, 255, 0.96));
  position: relative;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.child-card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.child-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, var(--accent), #8fbaeb);
}

.child-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(98, 134, 184, 0.18);
  border-color: rgba(63, 121, 189, 0.2);
}

.mini-chart {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.mini-chart-row {
  display: grid;
  grid-template-columns: 64px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.mini-chart-label,
.sparkline-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.mini-chart-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(24, 36, 42, 0.08);
  overflow: hidden;
}

.mini-chart-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #8fbaeb);
}

.sparkline {
  display: flex;
  gap: 6px;
  align-items: end;
  min-height: 72px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(63, 121, 189, 0.08);
}

.sparkline-bar {
  flex: 1;
  min-width: 18px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #c5ddf8, var(--accent));
}

.sparkline-empty {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px dashed rgba(63, 121, 189, 0.16);
  color: var(--muted);
  font-size: 13px;
}

.avatar-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-line img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.tiny {
  font-size: 12px;
}

.worksheet-shell {
  display: grid;
  grid-template-columns: minmax(620px, 1.7fr) minmax(380px, 1fr);
  gap: 22px;
}

.worksheet-subject-chooser {
  margin: 8px 0 16px;
}

#worksheet-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

#worksheet-form > select,
#worksheet-form > input,
#worksheet-form > button,
#worksheet-form > .dual-field,
#worksheet-form > .triple-field,
#worksheet-form > .difficulty-choice,
#worksheet-form > .field-group {
  grid-column: span 2;
}

#worksheet-form > .dual-field {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#worksheet-form > .triple-field {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#worksheet-form > .difficulty-choice {
  grid-column: span 1;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group label {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.field-group-student {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(63, 121, 189, 0.14);
  background: linear-gradient(180deg, #fafdff, #edf5ff);
}

.field-group-student select {
  border-color: rgba(47, 103, 173, 0.2);
  background: rgba(255, 255, 255, 0.98);
}

#worksheet-form > select[name="questionCount"] {
  grid-column: span 1;
}

#worksheet-form > .triple-field {
  grid-column: span 1;
}

#worksheet-form > input[name="title"] {
  grid-column: span 2;
}

.worksheet-preview {
  position: sticky;
  top: 24px;
  align-self: start;
}

.worksheet-preview h4 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.preview-card {
  min-height: 100%;
}

.preview-sheet {
  display: grid;
  gap: 12px;
  min-height: 240px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #eef5ff);
  border: 1px solid rgba(63, 121, 189, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.preview-sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.preview-sheet-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.preview-meta-box {
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(63, 121, 189, 0.12);
  font-size: 13px;
}

.preview-lines {
  display: grid;
  gap: 8px;
}

.preview-line {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(63, 121, 189, 0.2), rgba(24, 36, 42, 0.06));
}

.preview-line.short {
  width: 58%;
}

.preview-line.medium {
  width: 74%;
}

.worksheet-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.worksheet-result-card {
  display: grid;
  gap: 12px;
}

.worksheet-web-head-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 245, 255, 0.96));
  border: 1px solid rgba(63, 121, 189, 0.12);
}

.answer-row.worksheet-correct {
  border-color: rgba(121, 179, 109, 0.26);
  background: linear-gradient(180deg, #ffffff, #f4fbf2);
}

.answer-row.worksheet-wrong {
  border-color: rgba(219, 133, 122, 0.26);
  background: linear-gradient(180deg, #ffffff, #fff7f5);
}

.worksheet-thumb {
  min-height: 180px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #eef5ff);
  border: 1px solid rgba(63, 121, 189, 0.1);
}

.worksheet-thumb-sheet {
  display: grid;
  gap: 10px;
}

.worksheet-thumb-boxes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.worksheet-thumb-box {
  display: grid;
  gap: 4px;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(63, 121, 189, 0.12);
}

.worksheet-thumb-meta-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.worksheet-thumb-meta-value {
  font-size: 0.92rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worksheet-thumb-lines {
  display: grid;
  gap: 7px;
}

.worksheet-thumb-line {
  height: 10px;
  border-radius: 999px;
  background: rgba(63, 121, 189, 0.16);
}

.worksheet-thumb-line.short {
  width: 62%;
}

.focus-mode {
  overflow: hidden;
}

.focus-mode .topbar,
.focus-mode .auth-stage,
.focus-mode .overview-strip,
.focus-mode #parent-home,
.focus-mode #admin-home,
.focus-mode #report-panel {
  display: none;
}

.focus-mode .page-shell {
  max-width: none;
  padding: 0;
}

.focus-mode #student-home {
  gap: 0;
}

.focus-mode #student-home .workspace-head {
  display: none;
}

.focus-mode .student-grid {
  grid-template-columns: 1fr;
}

.focus-mode #practice-panel {
  position: fixed;
  inset: 16px;
  z-index: 20;
  min-height: auto;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 28px;
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(136, 182, 235, 0.18), transparent 24%),
    linear-gradient(180deg, #fcfeff 0%, #edf5ff 100%);
}

.focus-mode .focus-exit-floating {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.focus-mode #practice-focus-toggle {
  display: none;
}

body[data-app-role="guest"] #app-shell,
body[data-app-role="student"] #parent-home,
body[data-app-role="student"] #admin-home,
body[data-app-role="parent"] #admin-link-panel {
  display: none !important;
}

body[data-app-role="student"] .guide-stage,
body[data-app-role="parent"] .guide-stage {
  display: none !important;
}

body[data-current-page="profile"] #student-home,
body[data-current-page="profile"] #parent-home,
body[data-current-page="profile"] #admin-home,
body[data-current-page="profile"] #guide-manual-page {
  display: none !important;
}

body[data-current-page="main"] #student-home,
body[data-current-page="main"] #parent-home,
body[data-current-page="main"] #admin-home,
body[data-current-page="main"] #profile-home,
body[data-current-page="main"] #guide-manual-page,
body[data-current-page="guest"] #profile-home,
body[data-current-page="guest"] #guide-manual-page {
  display: none !important;
}

body[data-current-page="practice"] #parent-home,
body[data-current-page="practice"] #admin-home,
body[data-current-page="practice"] #profile-home,
body[data-current-page="practice"] #guide-manual-page,
body[data-current-page="parent"] #student-home,
body[data-current-page="parent"] #admin-home,
body[data-current-page="parent"] #profile-home,
body[data-current-page="parent"] #guide-manual-page,
body[data-current-page="admin"] #student-home,
body[data-current-page="admin"] #parent-home,
body[data-current-page="admin"] #profile-home,
body[data-current-page="admin"] #guide-manual-page {
  display: none !important;
}

body[data-current-page="guide"] .overview-strip,
body[data-current-page="guide"] #student-home,
body[data-current-page="guide"] #parent-home,
body[data-current-page="guide"] #admin-home,
body[data-current-page="guide"] #profile-home,
body[data-current-page="guide"] .guide-stage {
  display: none !important;
}

body[data-current-page="guide"] #guide-manual-page,
body[data-current-page="guide"] #guide-manual-page[hidden] {
  display: grid !important;
}

body[data-app-role="parent"] #parent-home {
  order: 1;
}

body[data-app-role="parent"] #admin-home {
  order: 2;
}

body[data-app-role="parent"] #student-home {
  order: 3;
}

.profile-grid {
  grid-template-columns: 1.05fr 1.45fr;
}

.my-profile-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #edf5ff);
  border: 1px solid rgba(63, 121, 189, 0.12);
}

.my-profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-large {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  object-fit: cover;
  border: 1px solid rgba(63, 121, 189, 0.12);
  background: #f0f6ff;
}

.chapter-stats-grid {
  display: grid;
  gap: 12px;
}

.chapter-stat-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(63, 121, 189, 0.1);
}

.badge-mini-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge-mini-grid img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.preview-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.preview-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: #e9f2ff;
  font-size: 12px;
  font-weight: 700;
}

.footer-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(234, 243, 255, 0.96));
  border: 1px solid rgba(63, 121, 189, 0.12);
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-banner strong {
  color: var(--ink);
}

.footer-banner a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.footer-banner a:hover {
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .topbar,
  .student-grid,
  .admin-grid,
  .overview-strip,
  .practice-stage,
  .worksheet-shell,
  .subject-chooser,
  .guide-slide,
  .hero-guide-banner,
  .hero-guide-flow-row {
    grid-template-columns: 1fr;
  }

  .guide-showcase-review {
    grid-template-columns: 1fr;
  }

  .guide-manual-grid {
    grid-template-columns: 1fr;
  }

  .guide-device-float {
    position: static;
    min-width: 100%;
  }

  #worksheet-form {
    grid-template-columns: 1fr;
  }

  #worksheet-form > select,
  #worksheet-form > input,
  #worksheet-form > button,
  #worksheet-form > .dual-field,
  #worksheet-form > .triple-field,
  #worksheet-form > .difficulty-choice,
  #worksheet-form > select[name="questionCount"],
  #worksheet-form > input[name="title"] {
    grid-column: span 1;
  }

  .worksheet-preview {
    position: static;
  }

  .worksheet-thumb-boxes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide-panel {
    grid-column: span 1;
  }

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

  .site-profile-bar .profile-summary-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .subject-stat-strip,
  .subject-stat-grid,
  .mastery-status-grid {
    grid-template-columns: 1fr;
  }

  .site-profile-bar .achievement-badge {
    justify-self: start;
  }

  .focus-mode #practice-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 18px 14px 60px;
  }

  .focus-exit-floating {
    top: 12px;
    min-height: 46px;
    padding: 10px 18px;
    font-size: 0.94rem;
  }

  .practice-toolbar,
  .grid-form,
  .triple-field,
  .dual-field,
  .summary-grid,
  .child-metrics,
  .profile-metrics,
  .auth-shortcuts {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: none;
  }

  .footer-banner {
    flex-direction: column;
    text-align: center;
  }
}
