:root {
  --mobile-content-gutter: clamp(16px, 4.1vw, 22px);
  --bg: #fbf7ff;
  --panel: #fff;
  --ink: #35235f;
  --muted: #7c6f96;
  --line: #eadff8;
  --dark: #5b38d6;
  --blue: #2f82ef;
  --violet: #6d3fd9;
  --pink: #ec3f9d;
  --orange: #ffa33f;
  --gold: #ffd166;
  --green: #0f9f6e;
  --amber: #b7791f;
  --red: #dc2626;
  --student-nav-selected-surface: rgba(222, 207, 249, .72);
  --app-shared-background:
    radial-gradient(circle at 12% 10%, rgba(255, 163, 63, .20), transparent 28%),
    radial-gradient(circle at 88% 4%, rgba(236, 63, 157, .20), transparent 30%),
    radial-gradient(circle at 50% 92%, rgba(47, 130, 239, .16), transparent 34%),
    linear-gradient(180deg, #fbf7ff 0%, #fff7ef 48%, #eef7ff 100%);
  --single-storey-latin: "Poppins", sans-serif;
  --ui-font: "Poppins", "Microsoft YaHei", "PingFang SC", "HarmonyOS Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ui-font);
  background: var(--app-shared-background);
  background-attachment: fixed;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: 100vw 100dvh;
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }

.shell {
  max-width: 520px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
}

.mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #fff;
  color: #fff;
  font-weight: 900;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(109, 63, 217, .18);
}

.mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 19px; margin-bottom: 8px; }
h3 { font-size: 16px; }

.brand p, .muted, .meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.panel, .card, .row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

.panel { padding: 16px; }

label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.primary, .ghost {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 750;
}

.primary {
  width: 100%;
  margin-top: 14px;
  border: 0;
  background: linear-gradient(135deg, var(--violet), var(--pink) 58%, var(--orange));
  color: #fff;
  box-shadow: 0 10px 22px rgba(109, 63, 217, .18);
}

.primary.inline {
  width: auto;
  margin-top: 0;
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.message {
  min-height: 20px;
  margin-top: 10px;
  color: var(--red);
  font-size: 13px;
}

.hidden { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  background: rgba(251, 247, 255, .94);
  backdrop-filter: blur(10px);
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
}

.metric-button {
  text-align: left;
  color: var(--ink);
}

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

.metric strong {
  display: block;
  font-size: 25px;
  margin: 5px 0;
}

.section { margin-top: 16px; }

.card {
  padding: 14px;
  margin-top: 10px;
}

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

.edit-panel {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.row {
  padding: 12px;
  margin-top: 9px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.row.compact {
  border: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #edf7f3;
  color: var(--green);
  white-space: nowrap;
}

.badge.warn { background: #fff7e6; color: var(--amber); }
.badge.blue { background: #f3e8ff; color: var(--violet); }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.actions.three-actions {
  grid-template-columns: 1fr 1fr 1fr;
}

.danger {
  border-color: #fecaca;
  color: #b91c1c;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
  margin-top: 8px;
}

.bar {
  height: 100%;
  width: var(--w);
  background: linear-gradient(90deg, var(--violet), var(--pink), var(--orange));
}

.notice {
  padding: 11px;
  border: 1px solid #e5d7ff;
  border-radius: 8px;
  background: #f7edff;
  color: #5b21b6;
  font-size: 13px;
  line-height: 1.55;
  margin-top: 10px;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  color: var(--ink);
}

.import-format {
  margin: 10px 0;
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  word-break: break-word;
}

.word-card {
  padding: 0;
  overflow: hidden;
}

.word-summary {
  width: 100%;
  border: 0;
  background: #fff;
  padding: 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  color: var(--ink);
}

.word-summary small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.word-card .edit-panel {
  padding: 12px;
}

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

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

.word-image-preview {
  min-height: 82px;
  margin: 8px 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.word-image-preview img,
.study-word-card img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
}

.upload-button {
  position: relative;
  overflow: hidden;
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.hidden-file {
  display: none;
}

.study-word-card {
  display: grid;
  gap: 8px;
}

.audio-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.structure-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
  background: #fff;
}

body.student-active {
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #eef7ff;
}

body.student-active .shell {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  min-height: 100dvh;
  padding: 0;
}

.student-mode {
  height: 100dvh;
  overflow: hidden;
}

body.student-active #appView > .topbar,
.student-mode > .topbar {
  display: none !important;
}

.student-mode #content {
  height: 100dvh;
  overflow: hidden;
}

.student-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--app-shared-background);
  background-attachment: fixed;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: 100vw 100dvh;
}

.student-slider {
  display: flex;
  width: 100%;
  height: calc(100dvh - 86px - env(safe-area-inset-bottom, 0px));
  transition: transform .36s cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
  overflow: visible;
}

.student-screen {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: 100%;
  flex: 0 0 100%;
  padding: max(12px, env(safe-area-inset-top, 0px)) 14px 8px;
  overflow: hidden;
}

.student-board {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(7px, 1.2vh, 14px);
  min-width: 0;
  min-height: 0;
}

.student-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.student-board-head p {
  color: var(--muted);
  font-size: 13px;
}

.student-board-head h2 {
  margin: 3px 0 0;
  font-size: 24px;
}

.star-pill {
  min-width: 74px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff0b8, #ffd1ef);
  border: 1px solid #f8b4d9;
  color: #7432b8;
  font-weight: 850;
}

.review-word-card {
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 24px;
  padding: 18px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(37, 99, 235, .14);
  transform: translateZ(0);
  transition: transform .22s ease, box-shadow .22s ease;
}

.review-word-card:active {
  transform: scale(.985);
}

.review-word-card.pulse {
  animation: cardPulse .42s ease;
}

.review-word-card.done {
  background: #f0fdf4;
  box-shadow: 0 18px 50px rgba(15, 159, 110, .16);
}

.review-word-card h1 {
  font-size: 36px;
  text-align: center;
}

.review-word-card p {
  font-size: 18px;
  color: #334155;
}

.review-word-card small {
  min-height: 24px;
  color: var(--muted);
  font-size: 15px;
}

.audio-chip {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

.pronunciation-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.pronunciation-actions .audio-chip {
  border: 0;
}

.student-structures {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 2px 0;
}

.student-structure-chip {
  min-width: 78px;
  min-height: 58px;
  border: 1px solid #e9d5ff;
  border-radius: 18px;
  padding: 0 15px;
  background: linear-gradient(135deg, #f7edff, #fff3e0);
  color: #6736c8;
  font-size: 27px;
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .08);
}

.audio-glow {
  animation: audioGlow 1s ease-in-out infinite;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, .34), 0 0 32px rgba(250, 204, 21, .72) !important;
  border-color: #facc15 !important;
}

.audio-glow-soft {
  box-shadow: 0 18px 50px rgba(250, 204, 21, .22), 0 0 0 3px rgba(250, 204, 21, .18) !important;
}

.audio-text-glow {
  color: #b45309;
  text-shadow: 0 0 12px rgba(250, 204, 21, .9), 0 0 28px rgba(250, 204, 21, .55);
}

.review-word-card img {
  width: min(68vw, 260px);
  max-height: 210px;
  object-fit: cover;
  border-radius: 20px;
}

.word-visual {
  width: min(58vw, 230px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 34px;
  background: linear-gradient(145deg, #e9d5ff, #ffd1ec 55%, #ffe5b4);
  border: 1px solid rgba(37, 99, 235, .15);
}

.word-visual span {
  font-size: 58px;
  font-weight: 950;
  color: #6736c8;
}

.study-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 8px;
}

.two-actions {
  grid-template-columns: 1fr 1fr;
}

.practice-board {
  grid-template-rows: auto auto 1fr auto;
  gap: clamp(6px, 1vh, 9px);
  min-height: 0;
}

.practice-step-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.practice-step-tabs button {
  min-height: 34px;
  border: 1px solid #e9d5ff;
  border-radius: 12px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
}

.practice-step-tabs button.active {
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
  border-color: var(--violet);
}

.practice-stage {
  min-height: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: clamp(8px, 1.4vh, 12px);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(37, 99, 235, .12);
  overflow: hidden;
  min-width: 0;
}

.practice-stage.done {
  background: #f0fdf4;
}

.practice-media {
  min-height: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.practice-media.small {
  gap: 6px;
}

.practice-media img,
.practice-prompt-only img {
  width: min(62vw, 250px);
  max-height: min(24dvh, 190px);
  object-fit: contain;
  border-radius: 18px;
}

.practice-media.small img {
  width: min(50vw, 190px);
  max-height: min(18dvh, 140px);
}

.practice-media h1 {
  font-size: clamp(26px, 7vw, 34px);
  text-align: center;
  word-break: break-word;
}

.practice-media p,
.practice-prompt-only p {
  color: #334155;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.read-targets {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.speech-hint {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid #e9d5ff;
  border-radius: 14px;
  background: #f7edff;
  color: #5b21b6;
  text-align: center;
  font-size: 13px;
}

.speech-result {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  background: #f8fafc;
  color: #475569;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.speech-result.ok {
  background: #dcfce7;
  color: #166534;
}

.speech-result.bad {
  background: #fee2e2;
  color: #991b1b;
}

.recording-now {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #dc2626 !important;
}

.practice-prompt-only {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.spell-answer {
  width: min(74vw, 320px);
  min-height: clamp(40px, 6vh, 48px);
  display: grid;
  place-items: center;
  border: 2px solid #e9d5ff;
  border-radius: 16px;
  background: linear-gradient(135deg, #f7edff, #fff3e0);
  color: #35235f;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 950;
  letter-spacing: 1px;
  overflow: hidden;
}

.flow-progress {
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2vw, 10px);
}

.flow-progress span {
  width: clamp(24px, 7vw, 34px);
  height: clamp(24px, 7vw, 34px);
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  border: 1px solid #e9d5ff;
  font-size: 12px;
  font-weight: 900;
}

.flow-progress span.active {
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
}

.flow-progress span.done {
  background: #dcfce7;
  color: #166534;
}

.structure-spell-boxes {
  width: min(92vw, 430px);
  display: grid;
  gap: clamp(8px, 1.5vh, 12px);
}

.structure-blank {
  min-height: clamp(46px, 7vh, 62px);
  display: grid;
  place-items: center;
  border: 2px solid #eadff8;
  border-radius: 18px;
  background: rgba(255,255,255,.88);
  color: #35235f;
  font-size: clamp(22px, 7vw, 34px);
  font-weight: 950;
  letter-spacing: 3px;
}

.structure-blank.active {
  border-color: var(--violet);
  box-shadow: 0 0 0 5px rgba(109, 63, 217, .12), 0 16px 36px rgba(109, 63, 217, .18);
}

.structure-blank.done {
  border-color: rgba(34, 197, 94, .45);
  background: #f0fdf4;
  color: #166534;
}

.letter-bank {
  width: min(92vw, 430px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(6px, 1.5vw, 10px);
}

.letter-bank button {
  width: clamp(38px, 10vw, 54px);
  height: clamp(38px, 10vw, 54px);
  border: 1px solid #d8c8f4;
  border-radius: 15px;
  background: linear-gradient(180deg, #fff, #fbf7ff);
  color: #35235f;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 950;
  text-transform: lowercase;
  font-family: var(--single-storey-latin), "Microsoft YaHei", "PingFang SC", sans-serif;
  box-shadow: 0 8px 18px rgba(73, 45, 139, .08);
}

.letter-bank button:disabled {
  opacity: .22;
}

.letter-bank .wide {
  width: clamp(72px, 18vw, 98px);
  text-transform: none;
  font-size: 15px;
}

.qwerty-keyboard {
  display: grid;
  gap: 5px;
  justify-items: center;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.qwerty-keyboard div {
  display: flex;
  justify-content: center;
  gap: clamp(2px, .9vw, 4px);
  width: 100%;
}

.qwerty-keyboard button {
  min-width: 0;
  width: clamp(24px, 8.1vw, 31px);
  height: clamp(30px, 5vh, 34px);
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  color: #35235f;
  font-weight: 900;
  text-transform: lowercase;
  font-family: var(--single-storey-latin), "Microsoft YaHei", "PingFang SC", sans-serif;
}

.qwerty-keyboard .wide {
  min-width: 0;
  width: clamp(68px, 22vw, 86px);
  text-transform: none;
}

.handwriting-box {
  width: min(92vw, 460px);
  display: grid;
  gap: 8px;
  justify-items: center;
}

.handwriting-box canvas {
  width: 100%;
  height: clamp(150px, 28dvh, 260px);
  border: 2px dashed #c084fc;
  border-radius: 18px;
  background: repeating-linear-gradient(0deg, #fff, #fff 23px, #f7edff 24px);
  touch-action: none;
}

.handwriting-result {
  width: 100%;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #f8fafc;
  color: #334155;
  font-weight: 850;
}

.center {
  text-align: center;
}

.flash-ok {
  animation: flashOk .46s ease;
}

.flash-bad {
  animation: flashBad .46s ease;
}

.student-tabs {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 58px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 7px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(226, 232, 240, .9);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .12);
  backdrop-filter: blur(14px);
}

.student-tabs button {
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.student-tabs span {
  display: block;
  font-size: 15px;
  line-height: 1;
  margin-bottom: 3px;
}

.student-tabs button.active {
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
}

.rank-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.rank-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.rank-row.me {
  background: #fff7ed;
  border-color: #fed7aa;
}

.rank-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 900;
}

.pet-board {
  text-align: center;
}

.pet-stage {
  position: relative;
  border: 0;
  border-radius: 28px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  background: linear-gradient(180deg, #fff0b8 0%, #f7edff 100%);
  overflow: hidden;
}

.pet-sprite {
  position: relative;
  width: 184px;
  height: 170px;
  animation: petFloat 2.6s ease-in-out infinite;
}

.pet-body {
  position: absolute;
  left: 26px;
  top: 34px;
  width: 132px;
  height: 118px;
  border-radius: 58% 58% 48% 48%;
  background: #ffdfeb;
  border: 5px solid #fff;
  box-shadow: inset 0 -10px 0 rgba(244, 114, 182, .18), 0 14px 28px rgba(190, 24, 93, .16);
}

.pet-ear {
  position: absolute;
  top: 12px;
  width: 50px;
  height: 64px;
  border-radius: 60% 60% 18% 18%;
  background: #f9a8d4;
  border: 5px solid #fff;
}

.pet-ear.left {
  left: 35px;
  transform: rotate(-22deg);
}

.pet-ear.right {
  right: 35px;
  transform: rotate(22deg);
}

.pet-eye {
  position: absolute;
  top: 42px;
  width: 15px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
}

.pet-eye.left { left: 36px; }
.pet-eye.right { right: 36px; }

.pet-blush {
  position: absolute;
  top: 70px;
  width: 23px;
  height: 12px;
  border-radius: 999px;
  background: rgba(244, 114, 182, .38);
}

.pet-blush.left { left: 22px; }
.pet-blush.right { right: 22px; }

.pet-mouth {
  position: absolute;
  left: 57px;
  top: 69px;
  width: 20px;
  height: 4px;
  border-radius: 999px;
  background: var(--violet);
}

.pet-tail {
  position: absolute;
  right: 1px;
  top: 82px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 10px solid #f9a8d4;
  border-left-color: transparent;
  transform: rotate(-18deg);
}

.pet-bubble {
  padding: 10px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  color: #9f1239;
  font-weight: 850;
}

.pet-hop {
  animation: petHop .5s ease;
}

.pet-stats {
  display: grid;
  gap: 9px;
}

.pet-stats > div {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
}

.pet-meter {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
}

.pet-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--pink), var(--orange));
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}

.profile-grid button,
.profile-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.profile-grid b {
  display: block;
  font-size: 23px;
  margin-bottom: 4px;
}

.profile-grid span {
  color: var(--muted);
  font-size: 13px;
}

.profile-card {
  align-self: end;
}

.student-board .profile-card {
  display: none !important;
}

.pet-board-v2,
.profile-board-v2 {
  gap: clamp(12px, 2vh, 18px);
  overflow: hidden;
}

.pet-head-v2,
.profile-head-v2 {
  flex-shrink: 0;
}

.pet-stage-3d {
  min-height: clamp(220px, 34vh, 330px);
  display: grid;
  place-items: center;
  gap: 10px;
  border: 0;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .62) 34%, transparent 66%),
    linear-gradient(145deg, rgba(109, 63, 217, .16), rgba(236, 63, 157, .15), rgba(255, 163, 63, .16));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8), 0 22px 48px rgba(73, 45, 139, .12);
  perspective: 850px;
}

.pet-world {
  position: relative;
  width: clamp(190px, 58vw, 260px);
  aspect-ratio: 1 / .82;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
}

.pet-orbit-ring {
  position: absolute;
  width: 92%;
  height: 45%;
  border: 6px solid rgba(109, 63, 217, .18);
  border-left-color: rgba(47, 130, 239, .38);
  border-right-color: rgba(236, 63, 157, .34);
  border-radius: 999px;
  transform: rotateX(68deg) rotateZ(-12deg) translateY(42px);
  filter: drop-shadow(0 18px 18px rgba(109, 63, 217, .12));
}

.pet-sprite-3d {
  width: clamp(160px, 45vw, 218px);
  height: clamp(150px, 38vw, 198px);
  transform-style: preserve-3d;
  animation: pet3dFloat 3.2s ease-in-out infinite;
}

.pet-shadow-3d {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -12px;
  height: 24px;
  border-radius: 999px;
  background: rgba(73, 45, 139, .16);
  filter: blur(7px);
  transform: translateZ(-60px) rotateX(78deg);
}

.pet-face3d {
  position: absolute;
  left: 16%;
  top: 20%;
  width: 68%;
  height: 68%;
  border-radius: 52% 52% 46% 46%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, .95), transparent 18%),
    linear-gradient(145deg, #fff1f8 0%, #ffd8e8 46%, #c9b7ff 100%);
  border: 6px solid rgba(255, 255, 255, .92);
  box-shadow:
    inset -12px -18px 22px rgba(109, 63, 217, .18),
    inset 10px 12px 16px rgba(255, 255, 255, .7),
    0 22px 36px rgba(190, 24, 93, .17);
  transform: translateZ(46px) rotateX(4deg);
}

.pet-glow {
  position: absolute;
  inset: 12%;
  border-radius: inherit;
  background: radial-gradient(circle at 42% 24%, rgba(255, 255, 255, .55), transparent 42%);
  pointer-events: none;
}

.pet-ear3d {
  position: absolute;
  top: 6%;
  width: 28%;
  height: 37%;
  border-radius: 58% 58% 18% 18%;
  background: linear-gradient(145deg, #ffd5e7, #f59bd1 62%, #bda7ff);
  border: 5px solid rgba(255, 255, 255, .9);
  box-shadow: inset -6px -8px 12px rgba(109, 63, 217, .16);
}

.pet-ear3d.left {
  left: 23%;
  transform: translateZ(18px) rotate(-24deg);
}

.pet-ear3d.right {
  right: 23%;
  transform: translateZ(18px) rotate(24deg);
}

.pet-eye3d {
  position: absolute;
  top: 37%;
  width: 12%;
  height: 18%;
  border-radius: 999px;
  background: linear-gradient(145deg, #3b216e, #7c3aed);
  box-shadow: inset 2px 3px 0 rgba(255, 255, 255, .72);
}

.pet-eye3d.left { left: 28%; }
.pet-eye3d.right { right: 28%; }

.pet-cheek3d {
  position: absolute;
  top: 60%;
  width: 17%;
  height: 9%;
  border-radius: 999px;
  background: rgba(236, 63, 157, .25);
}

.pet-cheek3d.left { left: 16%; }
.pet-cheek3d.right { right: 16%; }

.pet-mouth3d {
  position: absolute;
  left: 43%;
  top: 58%;
  width: 14%;
  height: 4px;
  border-radius: 999px;
  background: #6d3fd9;
}

.pet-tail3d {
  position: absolute;
  right: 2%;
  top: 48%;
  width: 26%;
  height: 26%;
  border-radius: 999px;
  border: 11px solid #e99bd6;
  border-left-color: transparent;
  transform: translateZ(10px) rotate(-20deg);
  box-shadow: 0 10px 18px rgba(109, 63, 217, .12);
}

.pet-starbit {
  position: absolute;
  color: #ffa33f;
  font-size: 18px;
  text-shadow: 0 0 18px rgba(255, 163, 63, .55);
  animation: petStarDrift 2.8s ease-in-out infinite;
}

.pet-starbit.one { left: 8%; top: 32%; }
.pet-starbit.two { right: 8%; top: 18%; animation-delay: .7s; }

.pet-bubble-v2 {
  max-width: min(88%, 360px);
  border-radius: 18px;
  text-align: center;
  white-space: normal;
}

.pet-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.pet-dashboard > div {
  grid-template-columns: 42px 1fr;
  padding: 10px;
  border: 1px solid rgba(234, 223, 248, .9);
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
}

.pet-actions-v2,
.profile-metrics-v2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pet-actions-v2 button,
.profile-metrics-v2 button,
.profile-actions-v2 button {
  border: 1px solid rgba(234, 223, 248, .95);
  border-radius: 18px;
  background: rgba(255, 255, 255, .82);
  color: var(--ink);
  padding: 13px;
  text-align: left;
  box-shadow: 0 12px 24px rgba(73, 45, 139, .07);
}

.pet-actions-v2 b,
.profile-metrics-v2 b {
  display: block;
  font-size: clamp(17px, 4.6vw, 24px);
  margin-bottom: 4px;
}

.pet-actions-v2 span,
.profile-metrics-v2 span,
.profile-hero-v2 span,
.profile-hero-v2 em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.pet-missions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pet-missions div,
.profile-progress-v2 {
  border-radius: 18px;
  padding: 12px;
  background: linear-gradient(145deg, rgba(109, 63, 217, .10), rgba(255, 163, 63, .10));
  border: 1px solid rgba(234, 223, 248, .85);
}

.pet-missions b,
.pet-missions span {
  display: block;
}

.pet-missions span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
}

.profile-board-v2 {
  align-content: start;
}

.profile-hero-v2 {
  min-height: clamp(130px, 20vh, 190px);
  border-radius: 28px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, .82), transparent 28%),
    linear-gradient(135deg, rgba(109, 63, 217, .20), rgba(236, 63, 157, .18), rgba(255, 163, 63, .18));
  border: 1px solid rgba(255, 255, 255, .88);
  box-shadow: 0 20px 42px rgba(73, 45, 139, .10);
}

.profile-hero-v2 strong {
  display: block;
  font-size: clamp(42px, 13vw, 72px);
  line-height: .95;
  margin: 6px 0;
}

.profile-hero-v2 button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--violet), var(--pink), var(--orange));
  box-shadow: 0 16px 30px rgba(236, 63, 157, .24);
}

.profile-progress-v2 {
  display: grid;
  gap: 10px;
}

.profile-progress-v2 > div:first-child,
.profile-actions-v2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-actions-v2 button {
  flex: 1;
  text-align: center;
  font-weight: 900;
}

@keyframes pet3dFloat {
  0%, 100% { transform: rotateX(5deg) rotateY(-8deg) translateY(0); }
  50% { transform: rotateX(8deg) rotateY(8deg) translateY(-10px); }
}

@keyframes petStarDrift {
  0%, 100% { transform: translateY(0) scale(.9); opacity: .58; }
  50% { transform: translateY(-12px) scale(1.12); opacity: 1; }
}

/* Compact student pet/profile layout */
.pet-board-v2,
.profile-board-v2 {
  gap: clamp(8px, 1.25vh, 12px);
  padding-bottom: calc(var(--android-nav-safe, 18px) + 70px);
}

.pet-stage-3d {
  min-height: clamp(170px, 25vh, 238px);
  gap: 0;
  border-radius: 24px;
}

.pet-world {
  width: clamp(158px, 48vw, 218px);
}

.pet-sprite-3d {
  width: clamp(136px, 38vw, 184px);
  height: clamp(124px, 33vw, 166px);
}

.pet-bubble-v2 {
  display: none !important;
}

.pet-dashboard {
  gap: 7px;
}

.pet-dashboard > div {
  padding: 8px 10px;
}

.pet-actions-v2,
.pet-missions,
.profile-metrics-v2 {
  gap: 8px;
}

.pet-actions-v2 button,
.profile-metrics-v2 button,
.profile-actions-v2 button {
  padding: 10px 12px;
  border-radius: 16px;
}

.pet-missions div,
.profile-progress-v2 {
  padding: 10px 12px;
  border-radius: 16px;
}

.profile-hero-v2 {
  min-height: clamp(96px, 14vh, 135px);
  padding: 14px 16px;
  border-radius: 23px;
}

.profile-hero-v2 strong {
  font-size: clamp(34px, 10vw, 52px);
  margin: 4px 0;
}

.profile-hero-v2 button {
  padding: 11px 14px;
}

.profile-progress-v2 {
  gap: 8px;
}

/* Pet avatar: grey-white cat based on the reference photo */
.pet-sprite-3d {
  filter: drop-shadow(0 20px 18px rgba(70, 57, 90, .16));
}

.pet-sprite-3d::before {
  content: "";
  position: absolute;
  left: 17%;
  top: 42%;
  width: 66%;
  height: 53%;
  border-radius: 48% 52% 38% 42%;
  background:
    radial-gradient(ellipse at 60% 74%, rgba(255, 255, 255, .98) 0 21%, transparent 22%),
    linear-gradient(145deg, #8e8f8a 0%, #6f746f 58%, #4f5652 100%);
  border: 5px solid rgba(255, 255, 255, .82);
  box-shadow:
    inset 16px 10px 22px rgba(255, 255, 255, .22),
    inset -18px -16px 22px rgba(42, 47, 45, .22);
  transform: translateZ(10px) rotate(-6deg);
}

.pet-sprite-3d::after {
  content: "";
  position: absolute;
  left: 36%;
  top: 62%;
  width: 28%;
  height: 32%;
  border-radius: 50% 50% 44% 44%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(246, 243, 238, .9));
  transform: translateZ(28px);
  filter: blur(.1px);
}

.pet-face3d {
  left: 19%;
  top: 12%;
  width: 62%;
  height: 58%;
  border-radius: 48% 48% 45% 45%;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, .98) 0 12%, transparent 13%),
    radial-gradient(ellipse at 39% 58%, rgba(255, 255, 255, .98) 0 23%, transparent 24%),
    radial-gradient(ellipse at 61% 58%, rgba(255, 255, 255, .98) 0 23%, transparent 24%),
    linear-gradient(90deg, #81847f 0 39%, #f8f5ef 40% 60%, #747974 61% 100%);
  border: 6px solid rgba(255, 255, 255, .9);
  box-shadow:
    inset 12px 12px 18px rgba(255, 255, 255, .34),
    inset -14px -18px 24px rgba(49, 55, 52, .2),
    0 22px 36px rgba(86, 77, 105, .2);
}

.pet-face3d::before,
.pet-face3d::after {
  content: "";
  position: absolute;
  top: 56%;
  width: 34%;
  height: 2px;
  background: rgba(255, 255, 255, .9);
  box-shadow:
    0 9px 0 rgba(255, 255, 255, .82),
    0 -9px 0 rgba(255, 255, 255, .82);
  opacity: .9;
}

.pet-face3d::before {
  left: -11%;
  transform: rotate(8deg);
}

.pet-face3d::after {
  right: -11%;
  transform: rotate(-8deg);
}

.pet-glow {
  left: 42%;
  top: 13%;
  width: 16%;
  height: 54%;
  border-radius: 999px 999px 70% 70%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .34));
}

.pet-ear3d {
  top: 2%;
  width: 27%;
  height: 34%;
  border-radius: 18% 80% 22% 72%;
  background:
    radial-gradient(ellipse at 55% 62%, #d8ada7 0 28%, transparent 30%),
    linear-gradient(145deg, #8b8d87, #606761 70%);
  border: 5px solid rgba(255, 255, 255, .82);
  box-shadow: inset -6px -8px 12px rgba(36, 42, 39, .2);
}

.pet-ear3d.left {
  left: 23%;
  transform: translateZ(16px) rotate(-31deg);
}

.pet-ear3d.right {
  right: 23%;
  transform: translateZ(16px) rotate(31deg) scaleX(-1);
}

.pet-eye3d {
  top: 39%;
  width: 14%;
  height: 21%;
  background:
    radial-gradient(circle at 58% 45%, #211d1d 0 34%, transparent 36%),
    radial-gradient(circle at 39% 28%, rgba(255, 255, 255, .86) 0 10%, transparent 11%),
    linear-gradient(145deg, #f6c45a, #8a6b23);
  border: 2px solid rgba(52, 43, 27, .42);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .65);
}

.pet-cheek3d {
  top: 58%;
  width: 22%;
  height: 16%;
  background: rgba(255, 255, 255, .9);
  box-shadow: inset 0 -4px 8px rgba(185, 176, 168, .14);
}

.pet-cheek3d.left { left: 27%; }
.pet-cheek3d.right { right: 27%; }

.pet-mouth3d {
  left: 45%;
  top: 56%;
  width: 10%;
  height: 9%;
  border: 0;
  border-radius: 58% 58% 62% 62%;
  background: #f3a5ad;
  box-shadow:
    0 8px 0 -5px #655552,
    -10px 13px 0 -7px rgba(80, 66, 62, .72),
    10px 13px 0 -7px rgba(80, 66, 62, .72);
}

.pet-mouth3d::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 80%;
  width: 2px;
  height: 12px;
  background: rgba(83, 67, 64, .72);
  transform: translateX(-50%);
}

.pet-tail3d {
  right: 0;
  top: 58%;
  width: 32%;
  height: 22%;
  border: 13px solid #6f746f;
  border-left-color: transparent;
  border-bottom-color: #5f6660;
  transform: translateZ(8px) rotate(-14deg);
  box-shadow: 0 10px 18px rgba(73, 66, 86, .14);
}

/* Student tab performance: render one page and reduce expensive WebView effects */
.student-slider-single {
  transform: none !important;
  transition: opacity .12s ease;
  will-change: auto;
}

.student-slider-single .student-screen {
  flex: 0 0 100%;
}

.pet-stage-3d {
  contain: layout paint;
}

.pet-world,
.pet-sprite-3d {
  backface-visibility: hidden;
}

.pet-orbit-ring {
  filter: none;
}

.pet-shadow-3d {
  filter: none;
  opacity: .58;
}

.pet-sprite-3d {
  filter: none;
}

.pet-sprite-3d::before {
  box-shadow:
    inset 9px 7px 14px rgba(255, 255, 255, .2),
    inset -10px -9px 14px rgba(42, 47, 45, .18);
}

.pet-sprite-3d::after {
  filter: none;
}

.pet-face3d {
  box-shadow:
    inset 8px 8px 12px rgba(255, 255, 255, .3),
    inset -9px -12px 15px rgba(49, 55, 52, .16),
    0 12px 22px rgba(86, 77, 105, .14);
}

.pet-starbit {
  animation: none;
  opacity: .82;
}

.student-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.float-star {
  position: fixed;
  left: 50%;
  bottom: 78px;
  font-size: 54px;
  color: #ffa33f;
  animation: none;
  pointer-events: none;
}

.float-star.fly-corner {
  animation: coinToBadge .9s cubic-bezier(.22,.72,.2,1) forwards;
}

@keyframes cardPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

@keyframes starFly {
  0% { transform: translate(-50%, 0) scale(.6); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(-50%, -120px) scale(1.4); opacity: 0; }
}

@keyframes coinToBadge {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(.65); opacity: 0; }
  18% { transform: translate(-50%, -50%) rotate(90deg) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--reward-dx)), calc(-50% + var(--reward-dy))) rotate(360deg) scale(.45); opacity: 1; }
}

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

@keyframes petHop {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-18px) scale(1.04); }
}

@keyframes audioGlow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

@keyframes flashOk {
  0%, 100% {
    background: rgba(255, 255, 255, .86);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, .08), inset 0 0 0 0 rgba(34, 197, 94, 0);
  }
  45% {
    background: #dcfce7;
    box-shadow: inset 0 0 0 5px rgba(34, 197, 94, .36), inset 0 0 28px 4px rgba(34, 197, 94, .48);
  }
}

@keyframes flashBad {
  0%, 100% {
    background: rgba(255, 255, 255, .86);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .08), inset 0 0 0 0 rgba(239, 68, 68, 0);
  }
  45% {
    background: #fee2e2;
    box-shadow: inset 0 0 0 5px rgba(239, 68, 68, .32), inset 0 0 28px 4px rgba(239, 68, 68, .46);
  }
}

/* GALAXY visual polish layer */
:root {
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --shadow-soft: 0 14px 34px rgba(73, 45, 139, .10);
  --shadow-card: 0 18px 50px rgba(73, 45, 139, .14);
  --shadow-lift: 0 24px 64px rgba(109, 63, 217, .18);
  --glass: rgba(255, 255, 255, .76);
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease;
}

button:active {
  transform: scale(.975);
}

input,
select,
textarea {
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: rgba(109, 63, 217, .55);
  box-shadow: 0 0 0 4px rgba(109, 63, 217, .12);
  background: #fff;
}

.shell {
  max-width: 1120px;
  padding: 22px;
}

.login {
  max-width: 440px;
  min-height: calc(100vh - 44px);
  display: grid;
  align-content: start;
  margin: 0 auto;
  padding-top: clamp(34px, 7vh, 86px);
}

.login .brand {
  justify-content: center;
  margin: 0 0 22px;
}

.login .brand h1 {
  font-size: 26px;
  letter-spacing: .2px;
}

.login .panel {
  border: 1px solid rgba(234, 223, 248, .86);
  border-radius: 28px;
  padding: 24px;
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow-lift);
  backdrop-filter: blur(18px);
}

.mark {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  box-shadow: 0 18px 36px rgba(109, 63, 217, .22);
}

.brand h1,
.topbar h1,
.student-board-head h2 {
  letter-spacing: .1px;
}

.panel,
.card,
.row,
.metric,
.profile-grid button,
.profile-card,
.rank-row {
  border-color: rgba(234, 223, 248, .78);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  background: rgba(255, 255, 255, .9);
}

.card,
.metric,
.row {
  backdrop-filter: blur(10px);
}

.panel {
  padding: 20px;
}

.card {
  padding: 18px;
  margin-top: 14px;
}

.metric {
  min-height: 112px;
  display: grid;
  align-content: space-between;
  padding: 18px;
}

.metric strong {
  font-size: 32px;
  line-height: 1;
}

.metric-button:hover,
.card:hover,
.row:hover {
  box-shadow: var(--shadow-card);
}

.topbar {
  top: 10px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(234, 223, 248, .76);
  border-radius: 22px;
  background: var(--glass);
  box-shadow: var(--shadow-soft);
}

.primary,
.ghost {
  border-radius: 15px;
  min-height: 46px;
}

.primary {
  box-shadow: 0 12px 26px rgba(236, 63, 157, .22);
}

.primary:hover {
  box-shadow: 0 16px 34px rgba(236, 63, 157, .28);
}

.ghost {
  background: rgba(255, 255, 255, .82);
}

.ghost:hover {
  border-color: rgba(109, 63, 217, .32);
  box-shadow: 0 10px 22px rgba(109, 63, 217, .10);
}

.badge {
  min-height: 28px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, .58);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}

.notice,
.import-format,
.audio-box,
.image-box,
.structure-row {
  border-radius: 18px;
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.word-card {
  border-radius: 22px;
}

.word-summary {
  padding: 16px 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,240,255,.9));
}

.word-summary b {
  font-size: 18px;
}

.word-card .edit-panel {
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(251,247,255,.88));
}

.word-image-preview {
  min-height: 112px;
  border-radius: 18px;
  background: linear-gradient(145deg, #f7edff, #fff6e8);
}

.word-image-preview img,
.study-word-card img {
  border-radius: 16px;
}

body.student-active {
  background:
    radial-gradient(circle at 78% 5%, rgba(236, 63, 157, .22), transparent 28%),
    radial-gradient(circle at 8% 18%, rgba(47, 130, 239, .18), transparent 26%),
    linear-gradient(180deg, #fff 0%, #fbf7ff 55%, #fff4ec 100%);
}

.student-shell {
  background:
    radial-gradient(circle at 80% 7%, rgba(236, 63, 157, .22), transparent 28%),
    radial-gradient(circle at 12% 14%, rgba(47, 130, 239, .16), transparent 30%),
    linear-gradient(180deg, #fff 0%, #fbf7ff 54%, #fff4ec 100%);
}

.student-screen {
  padding: max(12px, env(safe-area-inset-top, 0px)) 14px 8px;
}

.student-board {
  gap: clamp(7px, 1.2vh, 14px);
}

.student-board-head {
  min-height: clamp(44px, 7vh, 56px);
  padding: 2px 2px 0;
}

.student-board-head p {
  font-weight: 750;
}

.star-pill {
  min-width: 84px;
  min-height: 42px;
  box-shadow: 0 10px 22px rgba(255, 163, 63, .22);
}

.review-word-card,
.practice-stage,
.pet-stage {
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 30px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow-lift);
  backdrop-filter: blur(14px);
}

.review-word-card {
  padding: clamp(12px, 2vh, 22px);
}

.review-word-card h1,
.practice-media h1 {
  font-size: clamp(26px, 8vw, 42px);
  line-height: 1.05;
  word-break: break-word;
}

.review-word-card img,
.practice-media img,
.practice-prompt-only img {
  border-radius: 24px;
  box-shadow: 0 16px 32px rgba(73, 45, 139, .14);
  object-fit: contain;
  width: min(62vw, 250px);
  max-height: min(24dvh, 190px);
}

.student-structure-chip {
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(109, 63, 217, .12);
}

.audio-chip {
  min-height: 38px;
  border-radius: 14px;
  padding: 0 16px;
  box-shadow: 0 10px 22px rgba(109, 63, 217, .18);
}

.practice-step-tabs {
  padding: 5px;
  border: 1px solid rgba(234, 223, 248, .82);
  border-radius: 18px;
  background: rgba(255, 255, 255, .72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.practice-step-tabs button {
  border-radius: 13px;
  border: 0;
  background: transparent;
  color: #7c6f96;
}

.practice-step-tabs button.active {
  box-shadow: 0 10px 20px rgba(109, 63, 217, .18);
}

.speech-hint,
.speech-result,
.spell-answer,
.handwriting-result {
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(73, 45, 139, .08);
}

.qwerty-keyboard {
  width: 100%;
  gap: 7px;
  max-width: 100%;
  overflow: hidden;
}

.qwerty-keyboard div {
  gap: clamp(2px, .9vw, 5px);
  width: 100%;
}

.qwerty-keyboard button {
  height: clamp(30px, 5vh, 38px);
  min-width: 0;
  width: clamp(24px, 8.1vw, 31px);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #fbf7ff);
  box-shadow: 0 7px 14px rgba(73, 45, 139, .08);
}

.handwriting-box canvas {
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), var(--shadow-soft);
}

.student-tabs {
  left: 14px;
  right: 14px;
  bottom: max(4px, env(safe-area-inset-bottom));
  height: clamp(50px, 6.8vh, 56px);
  border-radius: 20px;
  padding: 5px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(255, 255, 255, .76);
  box-shadow: 0 20px 44px rgba(73, 45, 139, .18);
  backdrop-filter: blur(20px);
  transform: translateY(26px);
}

.student-tabs button {
  border-radius: 16px;
  font-size: 13px;
  gap: 1px;
}

.student-tabs button.active {
  box-shadow: 0 12px 24px rgba(109, 63, 217, .22);
}

.rank-row,
.profile-grid button,
.profile-card {
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
}

.rank-index {
  background: linear-gradient(135deg, #e9d5ff, #ffd1ec);
  color: #6736c8;
}

.pet-stage::before {
  content: "";
  position: absolute;
  inset: -30% -20% auto auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(236, 63, 157, .22), transparent 62%);
}

.pet-sprite,
.pet-bubble {
  position: relative;
  z-index: 1;
}

.profile-grid button {
  min-height: 104px;
  transition: transform .18s ease, box-shadow .18s ease;
}

.profile-grid button:active {
  transform: scale(.97);
}

@media (max-width: 720px) {
  .shell {
    max-width: 520px;
    padding: 18px;
  }

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

  .actions.three-actions {
    grid-template-columns: 1fr;
  }
}

.login-password-field { display: block; position: relative; }
.login-password-field input { width: 100%; padding-right: 52px; }
.login .password-visibility-toggle {
  position: absolute; right: 3px; top: 2px; bottom: 2px;
  width: 44px; height: auto; min-height: 0; padding: 10px;
  border: 0; border-radius: 12px; background: transparent; color: #593398;
  box-shadow: none;
  transform: none !important;
}
.password-visibility-toggle svg { width: 24px; height: 24px; display: block; }
.password-visibility-toggle .eye-off-slash { display: none; }
.password-visibility-toggle[aria-pressed="true"] .eye-off-slash { display: block; }
.password-visibility-toggle:focus-visible { outline: 2px solid #7040ce; outline-offset: -3px; }

/* Login brand refinement */
.login .brand {
  display: grid;
  justify-items: center;
  gap: 0;
  text-align: center;
  margin-bottom: 18px;
}

.login .login-app-banner {
  display: block;
  width: min(88vw, 410px);
  max-width: 100%;
  height: auto;
  max-height: min(27dvh, 220px);
  object-fit: contain;
}

body.auth-mode {
  height: var(--login-viewport-height, 100dvh);
  min-height: var(--login-viewport-height, 100dvh);
  overflow: hidden;
}

body.auth-mode .shell {
  position: fixed;
  top: var(--login-viewport-offset, 0px);
  right: 0;
  left: 0;
  height: var(--login-viewport-height, 100dvh);
  min-height: var(--login-viewport-height, 100dvh);
  margin-inline: auto;
  padding: 0;
}

body.auth-mode .login,
body.auth-mode .login:focus-within {
  box-sizing: border-box;
  height: var(--login-viewport-height, 100dvh);
  min-height: var(--login-viewport-height, 100dvh);
  max-height: var(--login-viewport-height, 100dvh);
  padding-top: max(28px, calc(env(safe-area-inset-top, 0px) + 18px));
  padding-bottom: max(72px, calc(env(safe-area-inset-bottom, 0px) + 54px));
  padding-inline:
    max(var(--mobile-content-gutter), env(safe-area-inset-left, 0px))
    max(var(--mobile-content-gutter), env(safe-area-inset-right, 0px));
  max-width: 504px;
  align-content: safe center;
  overflow-x: hidden;
  overflow-y: auto;
}

html[data-login-ime-constrained="true"] body.auth-mode .login,
html[data-login-ime-constrained="true"] body.auth-mode .login:focus-within {
  padding-top: max(28px, calc(env(safe-area-inset-top, 0px) + 18px));
  align-content: start;
}

.practice-word-slot .masked-word {
  position: relative;
  width: min(100%, 240px);
  height: 44px;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
  border-radius: 12px;
}
.practice-word-slot button.masked-word { cursor: pointer; }
.practice-word-slot button.masked-word:focus-visible { outline: 3px solid rgba(109, 63, 217, .48); outline-offset: 3px; }
.masked-word-text { position: relative; z-index: 0; display: block; font: inherit; line-height: inherit; }
.word-mask { position: absolute; z-index: 1; inset: 0; border-radius: inherit; background: #e4d5fa; }
.word-mask.entering { animation: lessonMaskEnter 200ms ease-out both; }
.word-mask.exiting { animation: lessonMaskExit 200ms ease-in both; }
@keyframes lessonMaskEnter { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes lessonMaskExit { from { transform: translateY(0); } to { transform: translateY(100%); } }
.lesson-position { cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .word-mask.entering, .word-mask.exiting { animation-duration: 1ms; }
}

@media (prefers-reduced-motion: reduce) {
  body.auth-mode .login,
  body.auth-mode .login:focus-within {
    transition: none;
  }
}

.login .brand > div:last-child {
  display: grid;
  justify-items: center;
}

.login .mark {
  width: min(42vw, 178px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.login .mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login .brand h1 {
  font-family: "Trebuchet MS", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: clamp(30px, 8vw, 44px);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: .8px;
  background: transparent;
  color: var(--violet);
  text-shadow: 0 12px 30px rgba(109, 63, 217, .14);
}

.login .panel h2 {
  text-align: center;
  font-size: 22px;
  margin-bottom: 16px;
}

#loginForm {
  display: grid;
  gap: 4px;
}

.login .primary {
  margin-top: 10px;
}

.auth-switch {
  display: grid;
  justify-items: center;
  margin-top: 6px;
}

.auth-link {
  border: 0;
  background: transparent;
  color: var(--violet);
  font-size: 15px;
  font-weight: 850;
  min-height: 40px;
  padding: 0 12px;
}

.register-panel {
  animation: sheetIn .2s ease both;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 8px;
  align-items: center;
}

.code-row input {
  width: 100%;
}

.secondary-inline {
  min-height: 46px;
  border: 1px solid rgba(109, 63, 217, .18);
  border-radius: 16px;
  background: rgba(109, 63, 217, .09);
  color: var(--violet);
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.secondary-inline:disabled {
  opacity: .62;
}

.back-login {
  justify-self: center;
  margin-top: 2px;
}

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

.login .brand,
.login .panel {
  transition: transform .18s ease, opacity .18s ease;
}

.login:focus-within {
  padding-top: clamp(18px, 4dvh, 44px);
  padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
}

.hidden,
.login.hidden,
.app.hidden,
body.auth-bootstrapping #loginView,
body.auth-bootstrapping #appView,
body.app-mode #loginView,
body.auth-mode #appView {
  display: none !important;
}

body.app-mode:not(.student-active) .shell {
  padding-top: max(46px, calc(env(safe-area-inset-top, 0px) + 28px));
}

body.app-mode:not(.student-active) .topbar {
  top: max(18px, env(safe-area-inset-top, 0px));
}

.topbar p:empty {
  display: none;
}

#logoutBtn {
  min-width: 92px;
  padding: 0 22px;
  white-space: nowrap;
}

.admin-page {
  display: grid;
  gap: 18px;
  padding: 4px 0 28px;
}

.admin-hero {
  min-height: 156px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
  padding: 22px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(109, 63, 217, .95), rgba(236, 63, 157, .86) 58%, rgba(255, 163, 63, .92));
  color: #fff;
  box-shadow: 0 22px 54px rgba(109, 63, 217, .25);
  overflow: hidden;
}

.admin-hero h2 {
  margin: 6px 0 8px;
  font-size: 26px;
  line-height: 1.15;
}

.admin-hero p {
  max-width: 520px;
  color: rgba(255,255,255,.84);
  font-size: 14px;
  line-height: 1.6;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.admin-hero-action {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: rgba(255,255,255,.95);
  color: var(--violet);
  font-weight: 850;
  box-shadow: 0 12px 26px rgba(60, 29, 130, .18);
}

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

.admin-stat-card {
  position: relative;
  min-height: 156px;
  display: grid;
  gap: 16px;
  align-content: space-between;
  text-align: left;
  border: 1px solid rgba(234, 223, 248, .78);
  border-radius: 26px;
  padding: 18px;
  background: rgba(255,255,255,.9);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.stat-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.stat-card-head b {
  display: block;
  font-size: 18px;
  line-height: 1.15;
  white-space: nowrap;
  letter-spacing: 0;
}

.stat-card-head small {
  display: block;
  margin-top: 4px;
}

.admin-stat-card strong {
  font-size: 38px;
  line-height: 1;
}

.admin-stat-card small {
  color: var(--muted);
  font-weight: 700;
}

.stat-icon,
.avatar-badge,
.word-initial {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  box-shadow: 0 10px 22px rgba(109, 63, 217, .18);
}

.stat-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 420px) {
  .admin-stat-card {
    padding: 16px 14px;
  }

  .admin-stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .admin-stat-card .stat-icon svg {
    width: 24px;
    height: 24px;
  }

  .stat-card-head b {
    font-size: 16px;
  }
}

.accent-blue .stat-icon { background: linear-gradient(135deg, var(--blue), var(--violet)); }
.accent-orange .stat-icon { background: linear-gradient(135deg, var(--orange), var(--pink)); }
.accent-pink .stat-icon { background: linear-gradient(135deg, var(--pink), var(--violet)); }

.admin-panel,
.import-card-modern {
  border: 1px solid rgba(234, 223, 248, .78);
  border-radius: 26px;
  padding: 18px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-soft);
}

.panel-title-row,
.admin-subnav,
.account-main,
.book-body .panel-title-row,
.structure-head,
.word-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-action-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-action-list button {
  min-height: 70px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  text-align: left;
  border: 1px solid rgba(234, 223, 248, .74);
  border-radius: 20px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,240,255,.88));
  color: var(--ink);
}

.admin-action-list button::after {
  content: "›";
  align-self: center;
  color: var(--violet);
  font-size: 24px;
  font-weight: 700;
}

.admin-action-list span {
  grid-column: 1 / 2;
  color: var(--muted);
  font-size: 13px;
}

.back-chip {
  min-width: 86px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
  font-weight: 850;
  box-shadow: 0 12px 26px rgba(109, 63, 217, .22);
}

.admin-toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 18px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(234, 223, 248, .74);
}

.admin-toolbar button {
  min-height: 40px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.admin-toolbar button.active {
  background: #fff;
  color: var(--violet);
  box-shadow: 0 8px 18px rgba(109, 63, 217, .12);
}

.admin-list,
.word-list-modern {
  display: grid;
  gap: 12px;
}

.admin-account-card,
.book-card,
.modern-word-card {
  border: 1px solid rgba(234, 223, 248, .78);
  border-radius: 24px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.account-main,
.modern-word-summary {
  width: 100%;
  border: 0;
  padding: 16px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.account-main > span:nth-child(2),
.word-title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.account-main b,
.word-title-wrap b {
  font-size: 17px;
}

.account-main small,
.word-title-wrap small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill.ok {
  background: #eafaf3;
  color: #0b7b55;
}

.status-pill.pending {
  background: #fff7e8;
  color: #9a5b00;
}

.status-pill.warn {
  background: #fff0f3;
  color: #b4234b;
}

.admin-edit-panel {
  margin: 0 16px 16px;
  padding: 14px;
  border: 1px solid rgba(234, 223, 248, .72);
  border-radius: 20px;
  background: rgba(251, 247, 255, .72);
}

.book-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.book-card {
  display: grid;
  grid-template-columns: 178px 1fr;
  min-height: 210px;
}

.book-cover {
  min-height: 210px;
  display: grid;
  align-content: end;
  gap: 8px;
  border: 0;
  padding: 18px;
  text-align: left;
  color: #fff;
  background:
    linear-gradient(150deg, rgba(47,130,239,.95), rgba(109,63,217,.95) 48%, rgba(236,63,157,.9));
}

.book-cover span {
  font-size: 12px;
  font-weight: 850;
  opacity: .78;
}

.book-cover strong {
  font-size: 24px;
  line-height: 1.25;
}

.book-body {
  min-width: 0;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 20px;
}

.book-actions,
.import-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.import-card-modern {
  display: grid;
  gap: 12px;
}

.import-card-modern .eyebrow {
  background: #f7edff;
  color: var(--violet);
}

.import-card-modern textarea {
  min-height: 110px;
  border-radius: 18px;
  background: rgba(255,255,255,.94);
}

.word-section-head {
  margin-top: 2px;
}

.word-section-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modern-word-summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.word-initial {
  border-radius: 15px;
  background: linear-gradient(135deg, #2f82ef, #6d3fd9);
}

.structure-head {
  margin-top: 14px;
}

.empty-state {
  min-height: 110px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(109, 63, 217, .25);
  border-radius: 24px;
  background: rgba(255,255,255,.62);
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 720px) {
  .admin-hero {
    grid-template-columns: 1fr;
  }

  .admin-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .book-card {
    grid-template-columns: 124px 1fr;
    min-height: 166px;
  }

  .book-cover {
    min-height: 166px;
    padding: 16px;
  }

  .book-cover strong {
    font-size: 20px;
  }
}

.subnav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.import-chip {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #fff;
  font-weight: 850;
  box-shadow: 0 12px 26px rgba(47, 130, 239, .2);
  white-space: nowrap;
}

.book-detail-page {
  position: relative;
}

.book-detail-nav {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  justify-content: stretch;
  gap: 12px;
}

.book-detail-heading {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.book-detail-title {
  font-size: 34px;
  line-height: 1.15;
  margin: 0;
  word-break: break-word;
}

.book-detail-nav .subnav-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.book-detail-nav .back-chip,
.book-detail-nav .import-chip {
  min-height: 46px;
  padding: 0 18px;
}

.word-index-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  gap: 8px;
  padding-right: 0;
  align-items: start;
}

.indexed-word-list {
  gap: 10px;
}

.alphabet-rail {
  position: fixed;
  right: max(8px, calc((100vw - 520px) / 2 + 6px));
  top: 332px;
  bottom: 44px;
  z-index: 4;
  width: 22px;
  height: auto;
  max-height: none;
  min-height: 0;
  display: grid;
  align-content: stretch;
  gap: 1px;
  padding: 8px 2px;
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  border: 1px solid rgba(234, 223, 248, .68);
  box-shadow: 0 10px 24px rgba(109, 63, 217, .1);
  backdrop-filter: blur(12px);
}

.alphabet-rail button {
  width: 16px;
  min-height: 0;
  height: auto;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: rgba(53, 35, 95, .38);
  font-size: 9px;
  line-height: 1;
  font-weight: 850;
}

.alphabet-rail button.active {
  color: var(--violet);
  background: rgba(109, 63, 217, .12);
}

.swipe-word-row {
  height: 88px;
  border-radius: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  box-shadow: var(--shadow-soft);
}

.swipe-word-row::-webkit-scrollbar {
  display: none;
}

.swipe-track {
  display: flex;
  height: 88px;
  width: calc(100% + 68px);
}

.word-row-main {
  min-width: 100%;
  flex: 0 0 100%;
  height: 88px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(234, 223, 248, .78);
  border-radius: 22px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  text-align: left;
  scroll-snap-align: start;
}

.swipe-delete {
  flex: 0 0 62px;
  height: 88px;
  margin-left: 6px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  scroll-snap-align: end;
}

.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  background: rgba(39, 25, 76, .38);
  backdrop-filter: blur(10px);
}

.admin-modal-sheet {
  width: min(100%, 560px);
  max-height: 86vh;
  margin: 0 auto;
  overflow: auto;
  border-radius: 28px 28px 0 0;
  padding: 18px 18px calc(var(--android-nav-safe, 18px) + 34px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(251,247,255,.96));
  box-shadow: 0 -22px 54px rgba(53, 35, 95, .24);
}

.admin-modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.86));
}

.admin-modal-head h2 {
  margin: 0;
  font-size: 22px;
}

.modal-close {
  min-width: 72px;
  min-height: 40px;
  border: 1px solid rgba(234, 223, 248, .86);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
}

.modal-form {
  display: grid;
  gap: 12px;
  padding-bottom: 12px;
}

.modal-form textarea {
  min-height: 140px;
  border-radius: 18px;
}

.delete-confirm-modal {
  justify-items: center;
  text-align: center;
  padding: 10px 0 0;
}

.delete-confirm-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, #fee2e2, #fff1f2);
  color: #dc2626;
  font-size: 32px;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(220, 38, 38, .12);
}

.delete-confirm-modal h3 {
  margin: 4px 0 0;
  color: #3b236d;
  font-size: 22px;
  line-height: 1.3;
}

.delete-confirm-modal .meta {
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
}

.two-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.danger-solid {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #fff !important;
}

.danger-solid:disabled {
  opacity: .72;
  filter: grayscale(.16);
}

.word-editor-modal .image-box,
.word-editor-modal .audio-box,
.word-editor-modal .structure-row {
  background: rgba(255,255,255,.88);
}

@media (max-height: 760px) {
  .alphabet-rail {
    top: 300px;
    bottom: 34px;
  }

  .alphabet-rail button {
    font-size: 8px;
  }
}

/* Universal phone adaptation */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

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

button,
input,
select,
textarea {
  max-width: 100%;
}

.shell,
.app,
#content,
.section,
.panel,
.card,
.admin-page,
.admin-panel,
.student-shell,
.student-board,
.practice-stage,
.modal-form {
  min-width: 0;
  max-width: 100%;
}

@supports (height: 100dvh) {
  .shell {
    min-height: 100dvh;
  }

  body.student-active,
  body.student-active .shell,
  .student-mode,
  .student-mode #content {
    height: 100dvh;
    min-height: 100dvh;
  }
}

@media (max-width: 520px) {
  .shell {
    width: 100%;
    padding-left: clamp(10px, 4vw, 18px);
    padding-right: clamp(10px, 4vw, 18px);
  }

  .topbar {
    gap: 8px;
  }

  .topbar h1 {
    font-size: clamp(18px, 5.4vw, 22px);
  }

  .grid,
  .admin-stat-grid,
  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(8px, 3vw, 14px);
  }

  .admin-stat-card,
  .admin-panel,
  .import-card-modern,
  .book-tile {
    border-radius: clamp(18px, 6vw, 26px);
    padding: clamp(12px, 4vw, 18px);
  }

  .modal-form {
    width: min(100%, 460px);
  }

  .actions,
  .audio-actions,
  .read-targets {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  }
}

@media (max-width: 390px) {
  .student-screen {
    padding-left: 10px;
    padding-right: 10px;
  }

  .student-board-head {
    gap: 8px;
  }

  .student-board-head h2 {
    font-size: clamp(18px, 6vw, 24px);
  }

  .star-pill {
    min-width: 66px;
    min-height: 34px;
    font-size: 12px;
  }

  .practice-step-tabs {
    gap: 3px;
    padding: 4px;
  }

  .practice-step-tabs button {
    min-height: 30px;
    font-size: 11px;
  }

  .audio-chip {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

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

  .study-actions button {
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (max-height: 760px) {
  .student-slider {
    height: calc(100dvh - 76px - env(safe-area-inset-bottom, 0px));
  }

  .student-tabs {
    height: 56px;
    padding: 6px;
  }

  .student-tabs span {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }

  .student-tabs button {
    font-size: 11px;
    gap: 2px;
  }

  .practice-media {
    gap: 5px;
  }

  .practice-media img,
  .practice-prompt-only img {
    width: min(54vw, 200px);
    max-height: min(18dvh, 140px);
  }

  .practice-media.small img {
    width: min(42vw, 160px);
    max-height: min(13dvh, 105px);
  }

  .practice-media h1,
  .review-word-card h1 {
    font-size: clamp(24px, 7vw, 34px);
  }

  .speech-hint,
  .speech-result {
    padding: 6px 8px;
    font-size: 12px;
  }

  .handwriting-box canvas {
    height: clamp(132px, 24dvh, 210px);
  }

  .qwerty-keyboard {
    gap: 4px;
  }

  .qwerty-keyboard button {
    height: clamp(28px, 4.7vh, 34px);
  }
}

@media (max-height: 660px) {
  .student-board-head small,
  .practice-board .meta.center,
  .speech-hint b {
    display: none;
  }

  .practice-stage {
    gap: 6px;
  }

  .student-board {
    gap: 6px;
  }

  .handwriting-result {
    min-height: 28px;
  }
}

@media (orientation: landscape) and (max-height: 760px) {
  .student-slider {
    height: calc(100dvh - 68px - env(safe-area-inset-bottom, 0px));
  }

  .student-screen {
    padding: max(8px, env(safe-area-inset-top, 0px)) 12px 6px;
  }

  .student-board {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }

  .student-board-head {
    min-height: 48px;
    padding: 8px 10px;
  }

  .student-board-head h2 {
    font-size: clamp(18px, 3vw, 26px);
  }

  .practice-stage {
    width: min(96vw, 980px);
    max-height: calc(100dvh - 142px);
    grid-template-columns: minmax(220px, .86fr) minmax(260px, 1.14fr);
    grid-auto-flow: column;
    align-items: center;
    align-content: center;
    column-gap: clamp(10px, 2.2vw, 24px);
    row-gap: 8px;
    padding: clamp(10px, 2vh, 18px);
  }

  .practice-media,
  .practice-media.small {
    grid-row: 1 / span 8;
    align-self: center;
  }

  .practice-media img,
  .practice-prompt-only img,
  .practice-media.small img {
    width: min(32vw, 270px);
    max-height: min(42dvh, 230px);
  }

  .practice-media h1,
  .review-word-card h1 {
    font-size: clamp(24px, 4vw, 40px);
  }

  .structure-word,
  .structure-chip.large {
    font-size: clamp(19px, 3vw, 34px);
  }

  .handwriting-box {
    width: min(48vw, 500px);
  }

  .handwriting-box canvas {
    height: min(38dvh, 250px);
  }

  .letter-bank {
    max-width: min(52vw, 520px);
  }

  .student-tabs {
    height: 52px;
    bottom: max(6px, env(safe-area-inset-bottom));
  }
}

.lesson-stage {
  gap: clamp(10px, 1.8vh, 18px);
}

.lesson-media {
  width: 100%;
}

.lesson-structures {
  gap: 10px;
}

.lesson-part {
  min-width: clamp(74px, 24vw, 150px);
  min-height: clamp(58px, 8vh, 82px);
  border: 2px solid #eadcff;
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  color: #6d3fd9;
  font-size: clamp(30px, 8vw, 54px);
  font-weight: 950;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: filter .34s ease, opacity .34s ease, transform .34s ease, border-color .2s ease, box-shadow .2s ease;
}

.lesson-part.long-active {
  border-color: #facc15;
  box-shadow: 0 0 0 8px rgba(250, 204, 21, .16), 0 18px 38px rgba(250, 204, 21, .22);
}

.lesson-part.soft-blur {
  filter: blur(2.4px);
  opacity: .72;
  transform: scale(.98);
}

.lesson-part.done {
  background: #f0fdf4;
  border-color: #86efac;
}

.lesson-part span {
  min-width: .58em;
  text-align: center;
  transition: color .18s ease, text-shadow .18s ease, transform .18s ease;
}

.lesson-part .letter-hot {
  color: #ef4444;
  text-shadow: 0 0 18px rgba(239, 68, 68, .55);
  transform: scale(1.2);
}

.lesson-bank {
  max-width: min(92vw, 560px);
}

.lesson-bank button {
  min-width: clamp(44px, 12vw, 62px);
  height: clamp(44px, 7vh, 62px);
  font-size: clamp(22px, 6vw, 32px);
  text-transform: lowercase;
}

.lesson-waiting {
  padding: 12px 18px;
  border-radius: 999px;
  background: #f8f0ff;
  color: #6d3fd9;
  font-weight: 850;
}

.record-only img {
  width: min(76vw, 360px);
  max-height: min(34dvh, 310px);
}

.teacher-page {
  display: grid;
  gap: 18px;
}

.teacher-hero,
.teacher-student-card,
.teacher-review-card,
.teacher-recording-row {
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 20px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 14px 34px rgba(73,45,139,.1);
}

.teacher-hero {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.teacher-student-grid,
.teacher-review-list,
.teacher-recording-list {
  display: grid;
  gap: 10px;
}

.teacher-student-card {
  padding: 14px;
}

.teacher-review-card,
.teacher-recording-row {
  width: 100%;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.teacher-review-card i {
  font-style: normal;
  font-weight: 900;
  color: #6d3fd9;
}

.teacher-review-card.done i {
  color: #16a34a;
}

.teacher-review-card.missing i {
  color: #ef4444;
}

.teacher-recording-row.missing {
  background: #fef2f2;
  border-color: #fecaca;
}

.teacher-recording-row.approved {
  background: #f0fdf4;
  border-color: #86efac;
}

.teacher-recording-row.warning {
  background: #fefce8;
  border-color: #fde68a;
}

.teacher-recording-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.teacher-recording-actions button:disabled {
  opacity: .38;
  cursor: not-allowed;
}

:root {
  --android-nav-safe: max(18px, env(safe-area-inset-bottom));
}

body.app-mode .shell {
  padding-bottom: calc(var(--android-nav-safe) + 8px);
}

.student-mode #content,
.teacher-page,
.admin-page {
  padding-bottom: calc(var(--android-nav-safe) + 18px);
}

.student-tabs {
  bottom: 26px;
  transform: translateY(8px);
}

.start-practice-board {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
}

.start-practice-panel {
  width: min(88vw, 430px);
  aspect-ratio: 1 / 1;
  margin: clamp(18px, 3.4vh, 34px) auto 0;
  align-self: start;
  padding: clamp(22px, 5.2vw, 38px);
  border: 1px solid #eadcff;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(250,245,255,.96));
  box-shadow: 0 18px 44px rgba(73,45,139,.13);
  text-align: center;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(22px, 5vw, 34px);
}

.start-practice-panel h2 {
  margin: 0;
  color: #3b236d;
  font-size: clamp(26px, 6.5vw, 40px);
}

.start-practice-btn {
  width: min(100%, 360px);
  min-height: clamp(78px, 12vh, 96px);
  margin-top: 2px;
  border-radius: 26px;
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 950;
  white-space: nowrap;
}

.student-mode .practice-media .word-visual {
  width: min(46vw, 180px);
  border-radius: 28px;
}

.student-mode .practice-media .word-visual span {
  font-size: clamp(40px, 12vw, 48px);
}

.student-mode .lesson-stage {
  width: min(calc(100vw - 40px), 720px);
  box-sizing: border-box;
  justify-self: center;
  align-self: stretch;
  margin-left: auto;
  margin-right: auto;
  padding: clamp(10px, 1.8vh, 16px);
  overflow-x: hidden;
  transform: translateX(0);
  place-items: center;
}

.student-mode .practice-board {
  grid-template-rows: auto minmax(0, 1fr);
  justify-items: center;
  overflow-x: hidden;
}

.student-mode .lesson-media,
.student-mode .lesson-bank {
  width: min(100%, 620px);
  max-width: 100%;
  justify-self: center;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  justify-items: center;
}

.student-mode .lesson-structures {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  align-items: center;
  margin-left: auto;
  margin-right: auto;
}

.teacher-page-simple .section {
  display: grid;
  gap: 14px;
}

.teacher-hero.compact {
  min-height: auto;
}

.teacher-student-name-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.teacher-student-name-card {
  min-height: 92px;
  border: 1px solid #eadcff;
  border-radius: 20px;
  background: linear-gradient(135deg, #ffffff, #fbf7ff);
  color: #3b236d;
  font-size: clamp(17px, 4vw, 22px);
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(73,45,139,.1);
}

.teacher-book-choice-grid {
  padding-top: 44px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.student-mode .student-shell {
  padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
}

.student-tabs {
  bottom: max(0px, env(safe-area-inset-bottom, 0px));
  height: 62px;
  padding: 6px;
  border-radius: 22px 22px 0 0;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 -10px 28px rgba(73, 45, 139, .12);
}

.student-tabs button {
  gap: 2px;
  font-size: 12px;
}

.student-tabs span {
  width: 28px;
  height: 28px;
  margin: 0 auto 1px;
  display: grid;
  place-items: center;
}

.student-tabs svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.student-mode .student-board,
.student-mode .practice-board {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.student-mode .practice-board {
  grid-template-rows: auto minmax(0, 1fr);
  align-items: start;
}

.student-mode .lesson-stage {
  max-height: calc(100dvh - 178px - env(safe-area-inset-bottom, 0px));
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.student-mode .lesson-media {
  padding: clamp(10px, 1.6vh, 14px);
  gap: clamp(8px, 1.4vh, 13px);
}

.student-mode .practice-media img {
  max-height: min(28vh, 210px);
  object-fit: contain;
}

.student-mode .lesson-media h1 {
  margin: 2px 0;
  font-size: clamp(34px, 9vw, 54px);
}

.lesson-progress-head {
  width: min(calc(100vw - 34px), 720px);
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.lesson-progress-strip {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(234, 220, 255, .95);
  border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  color: #3b236d;
  box-shadow: 0 10px 24px rgba(73, 45, 139, .08);
}

.lesson-progress-strip b {
  font-size: clamp(20px, 5.2vw, 28px);
  font-weight: 950;
}

.lesson-progress-strip span,
.lesson-progress-strip small {
  white-space: nowrap;
  font-weight: 850;
  color: #72569b;
}

.lesson-progress-strip span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-profile-hero {
  min-height: 118px;
  padding: 18px;
}

.profile-actions-v2 {
  margin-top: 8px;
}

.lesson-bank button {
  font-family: "Comic Sans MS", "Trebuchet MS", Arial, sans-serif;
  text-transform: lowercase;
}

@media (orientation: landscape) {
  .student-mode .lesson-stage {
    max-height: calc(100dvh - 132px - env(safe-area-inset-bottom, 0px));
  }

  .student-mode .practice-media img {
    max-height: min(34vh, 170px);
  }

  .student-tabs {
    height: 56px;
  }

  .student-mode .student-board,
  .student-mode .practice-board {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

.teacher-book-choice {
  min-height: 118px;
  border: 1px solid #eadcff;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff, #f8f0ff);
  color: #3b236d;
  display: grid;
  gap: 6px;
  align-content: center;
  text-align: left;
  padding: 16px;
}

.teacher-book-choice b {
  font-size: 18px;
}

.teacher-book-choice span {
  color: #756493;
  font-size: 13px;
}

.teacher-modal-back {
  position: sticky;
  top: 0;
  margin-left: auto;
  z-index: 3;
  min-width: 88px;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #f43f8f);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(124,58,237,.24);
}

.teacher-word-select-panel {
  padding-top: 44px;
  display: grid;
  gap: 12px;
}

.teacher-word-select-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.teacher-word-check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.teacher-word-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid #eadcff;
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
  color: #3b236d;
  font-weight: 800;
}

.teacher-word-check input {
  width: 20px;
  height: 20px;
}

@media (max-width: 430px) {
  .teacher-student-name-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .teacher-student-name-card {
    min-height: 82px;
    font-size: 15px;
  }

  .teacher-book-choice-grid,
  .teacher-word-check-list {
    grid-template-columns: 1fr;
  }
}

.import-excel-modal {
  gap: 14px;
}

.import-guide-card,
.import-template-box,
.quick-import-box {
  border: 1px solid #eadcff;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #fbf7ff);
  padding: 14px;
}

.import-guide-card b,
.import-template-box b {
  display: block;
  margin-bottom: 6px;
  color: #3b236d;
  font-size: 15px;
}

.import-guide-card p {
  margin: 4px 0;
  color: #705f93;
  font-size: 13px;
  line-height: 1.55;
}

.import-excel-modal input[type="file"] {
  margin-top: 8px;
  width: 100%;
  border: 1px dashed #c9b6ff;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  color: #3b236d;
}

.import-template-box code {
  display: block;
  white-space: normal;
  word-break: break-word;
  color: #6d42d8;
  font-size: 12px;
  line-height: 1.5;
}

.quick-import-box summary {
  cursor: pointer;
  color: #6d42d8;
  font-weight: 900;
}

.quick-import-box textarea {
  margin-top: 10px;
}

/* 2026-07 UI system polish: final active visual layer. */
:root {
  --surface: #ffffff;
  --surface-soft: #fbf8ff;
  --surface-warm: #fff8ef;
  --primary: #6840d8;
  --primary-strong: #5630c4;
  --accent: #ef4b9a;
  --reward: #f7a928;
  --text-main: #30234f;
  --text-soft: #74688d;
  --border-soft: #e9def8;
  --shadow-card: 0 14px 34px rgba(48, 35, 79, .10);
  --shadow-control: 0 8px 18px rgba(86, 48, 196, .16);
}

body {
  font-family: var(--ui-font);
  letter-spacing: 0;
  background: var(--app-shared-background);
  color: var(--text-main);
}

button,
input,
select,
textarea {
  font-family: var(--ui-font);
  letter-spacing: 0;
}

.primary,
.admin-subnav button.active,
.teacher-modal-back,
.book-detail-nav .import-chip {
  background: var(--primary);
  box-shadow: var(--shadow-control);
}

.primary:active,
.ghost:active,
.student-tabs button:active,
.admin-stat-card:active,
.teacher-student-name-card:active {
  transform: translateY(1px);
}

.panel,
.card,
.admin-panel,
.teacher-hero,
.admin-stat-card,
.book-tile,
.import-card-modern,
.modal-form,
.profile-hero-polished,
.rank-summary-card,
.pet-stage-polished,
.pet-stat-card,
.profile-metrics-polished button,
.profile-progress-polished,
.profile-actions-polished button {
  border-color: var(--border-soft);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.admin-page,
.teacher-page {
  background: linear-gradient(180deg, #ffffff 0%, #fbf8ff 100%);
}

.admin-stat-grid {
  gap: clamp(10px, 2.5vw, 16px);
}

.admin-stat-card {
  border-radius: 22px;
  min-height: 108px;
}

.admin-stat-card b,
.teacher-student-name-card,
.book-tile b {
  color: var(--text-main);
}

.admin-stat-card span,
.teacher-book-choice span,
.book-tile span,
.profile-metrics-polished span,
.pet-stat-card span {
  color: var(--text-soft);
}

.stat-icon,
.accent-blue .stat-icon,
.accent-orange .stat-icon,
.accent-pink .stat-icon {
  background: #f3edff;
  color: var(--primary);
}

.accent-purple .stat-icon {
  background: #fff1f7;
  color: var(--accent);
}

.admin-subnav,
.book-detail-nav {
  background: rgba(255, 255, 255, .94);
  border-color: var(--border-soft);
  box-shadow: 0 10px 28px rgba(48, 35, 79, .08);
}

.book-detail-nav .back-chip,
.book-detail-nav .import-chip,
.teacher-modal-back {
  min-width: 92px;
  border-radius: 999px;
}

.student-active,
body.student-active {
  background: var(--app-shared-background);
}

.polished-student-shell,
.student-shell {
  background: var(--app-shared-background) !important;
}

.student-mode #content {
  height: 100dvh;
  overflow: hidden;
}

.student-slider,
.student-slider-single {
  height: calc(100dvh - 70px - env(safe-area-inset-bottom, 0px)) !important;
  min-height: 0;
  overflow: hidden;
  transition: none;
  transform: none !important;
}

.student-screen {
  min-height: 0;
  padding: max(12px, env(safe-area-inset-top, 0px)) clamp(12px, 3.6vw, 18px) 8px;
  overflow: hidden;
}

.student-board,
.student-mode .student-board {
  min-height: 0;
  gap: clamp(8px, 1.5vh, 14px);
  padding-bottom: 0;
}

.student-board-head {
  min-height: 48px;
}

.student-board-head h2 {
  font-size: clamp(22px, 5.2vw, 30px);
  line-height: 1.05;
}

.student-board-head p {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
}

.star-pill {
  min-width: auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #ffe0a6;
  background: #fff6de;
  color: #8a5411;
  box-shadow: 0 8px 18px rgba(247, 169, 40, .18);
  white-space: nowrap;
}

.polished-tabs.student-tabs {
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(62px + env(safe-area-inset-bottom, 0px));
  padding: 7px max(12px, env(safe-area-inset-left, 0px)) max(7px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-right, 0px));
  border: 0;
  border-top: 1px solid rgba(233, 222, 248, .95);
  border-radius: 0;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 -8px 22px rgba(48, 35, 79, .10);
  transform: none;
  backdrop-filter: blur(18px);
}

.polished-tabs button {
  min-width: 0;
  min-height: 48px;
  border-radius: 18px;
  color: #817394;
  font-size: 12px;
  font-weight: 850;
  gap: 2px;
}

.polished-tabs button b {
  display: block;
  font-weight: 850;
  line-height: 1;
}

.polished-tabs button.active {
  background: #f3edff;
  color: var(--primary);
  box-shadow: none;
}

.polished-tabs span {
  width: 26px;
  height: 26px;
  margin: 0 auto 2px;
}

.polished-tabs svg {
  width: 22px;
  height: 22px;
}

.start-practice-board {
  grid-template-rows: auto minmax(0, 1fr);
}

.start-practice-panel {
  width: min(84vw, 410px);
  max-height: min(52dvh, 410px);
  aspect-ratio: 1 / 1;
  margin: clamp(10px, 3vh, 24px) auto 0;
  border-radius: clamp(22px, 7vw, 34px);
  border-color: var(--border-soft);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.start-practice-panel h2 {
  color: var(--text-main);
  font-size: clamp(24px, 6vw, 34px);
}

.start-practice-btn {
  min-height: clamp(72px, 10vh, 92px);
  border-radius: 24px;
  font-size: clamp(23px, 6vw, 32px);
}

.student-mode .practice-board {
  grid-template-rows: auto minmax(0, 1fr);
  padding-bottom: 0 !important;
}

.lesson-progress-head {
  width: min(100%, 720px);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.lesson-progress-strip {
  border-color: var(--border-soft);
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(48, 35, 79, .08);
}

.lesson-progress-strip b {
  color: var(--primary);
}

.student-mode .lesson-stage,
.practice-stage {
  width: min(100%, 720px);
  max-height: calc(100dvh - 148px - env(safe-area-inset-bottom, 0px));
  min-height: 0;
  margin: 0 auto;
  padding: clamp(12px, 2.4vh, 18px);
  border: 1px solid var(--border-soft);
  border-radius: clamp(22px, 6vw, 30px);
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-card);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  transform: none !important;
}

.student-mode .lesson-media,
.student-mode .lesson-bank {
  width: min(100%, 620px);
}

.student-mode .lesson-media {
  padding: clamp(8px, 1.5vh, 14px);
  gap: clamp(7px, 1.4vh, 12px);
}

.student-mode .practice-media img,
.student-mode .practice-prompt-only img {
  width: min(72vw, 270px);
  max-height: min(30dvh, 230px);
  border-radius: 22px;
  box-shadow: 0 12px 24px rgba(48, 35, 79, .12);
}

.student-mode .lesson-media h1,
.practice-media h1 {
  margin: 0;
  font-size: clamp(34px, 9vw, 58px);
  line-height: 1;
  color: var(--text-main);
}

.lesson-structures,
.student-structures {
  gap: clamp(8px, 2vw, 12px);
}

.lesson-part,
.student-structure-chip,
.structure-chip {
  background: #f8f4ff;
  border-color: #d8c9ff;
}

.lesson-part span,
.lesson-bank button,
.letter-bank button,
.structure-word,
.structure-chip.large,
.word-visual span,
.student-mode .lesson-media h1 {
  font-family: var(--single-storey-latin);
}

.lesson-bank,
.letter-bank {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(8px, 2.2vw, 12px);
  flex-wrap: wrap;
  max-width: min(100%, 620px);
}

.lesson-bank button,
.letter-bank button {
  width: clamp(48px, 13vw, 68px);
  height: clamp(48px, 13vw, 68px);
  border: 1px solid #ded2fb;
  border-radius: 18px;
  background: #ffffff;
  color: var(--primary);
  font-size: clamp(24px, 7vw, 34px);
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(86, 48, 196, .10);
}

.lesson-waiting {
  color: var(--text-soft);
  font-weight: 800;
}

.leaderboard-board-polished,
.pet-board-polished,
.profile-board-polished {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.rank-summary-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: 1fr;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 22px;
}

.rank-summary-card span,
.rank-summary-card small {
  color: var(--text-soft);
  font-weight: 800;
}

.rank-summary-card span {
  font-size: 20px;
  align-self: center;
}

.rank-summary-card b {
  grid-row: auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: var(--primary);
  font-size: 34px;
}

.rank-trophy-summary {
  font-size: 24px;
}

.polished-rank-list {
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 4px;
}

.rank-row {
  border-color: var(--border-soft);
  background: var(--surface);
}

.rank-row.me {
  border-color: #d6c8ff;
  background: #f7f2ff;
}

.pet-board-polished {
  grid-template-rows: auto minmax(132px, 1fr) auto auto;
}

.pet-stage-polished {
  width: min(100%, 520px);
  min-height: 0;
  height: 100%;
  margin: 0 auto;
  border-radius: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.pet-cat-portrait {
  position: relative;
  width: min(48vw, 210px);
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 18px 24px rgba(48, 35, 79, .16));
}

.cat-body,
.cat-face,
.cat-ear,
.cat-tail {
  position: absolute;
  display: block;
}

.cat-body {
  left: 20%;
  right: 14%;
  bottom: 6%;
  height: 52%;
  border-radius: 48% 48% 42% 42%;
  background: linear-gradient(145deg, #8b8e88, #5e6861);
}

.cat-face {
  left: 19%;
  top: 12%;
  width: 62%;
  height: 58%;
  border-radius: 45% 45% 48% 48%;
  background:
    radial-gradient(ellipse at 50% 62%, #faf7f0 0 34%, transparent 35%),
    linear-gradient(90deg, #7b7f78 0 39%, #faf7f0 40% 61%, #6e7770 62% 100%);
}

.cat-ear {
  top: 8%;
  width: 23%;
  height: 23%;
  background: #737a73;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.cat-ear.left {
  left: 18%;
  transform: rotate(-16deg);
}

.cat-ear.right {
  right: 16%;
  transform: rotate(16deg);
}

.cat-eye {
  position: absolute;
  top: 38%;
  width: 16%;
  height: 19%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 58% 45%, #1d1a1b 0 34%, transparent 36%),
    radial-gradient(circle at 40% 28%, rgba(255, 255, 255, .88) 0 10%, transparent 11%),
    linear-gradient(145deg, #f4c95a, #866b28);
}

.cat-eye.left { left: 24%; }
.cat-eye.right { right: 24%; }

.cat-nose {
  position: absolute;
  left: 46%;
  top: 60%;
  width: 9%;
  height: 7%;
  border-radius: 55% 55% 65% 65%;
  background: #e9a0a8;
}

.cat-mouth {
  position: absolute;
  left: 41%;
  top: 69%;
  width: 18%;
  height: 3px;
  border-radius: 999px;
  background: #5b4747;
}

.cat-tail {
  left: 1%;
  bottom: 11%;
  width: 34%;
  height: 14%;
  border-radius: 999px;
  background: linear-gradient(90deg, #626b64, #81867f);
  transform: rotate(-12deg);
}

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

.pet-stat-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
}

.pet-stat-card b {
  display: block;
  color: var(--text-main);
  font-size: 18px;
}

.pet-stat-card i {
  display: block;
  height: 5px;
  margin-top: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) var(--w), #ece4f8 var(--w));
}

.pet-mission-row,
.profile-actions-polished {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pet-mission-row div {
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--surface);
}

.pet-mission-row span {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
}

.pet-mission-row b {
  display: block;
  margin-top: 4px;
  color: var(--text-main);
  font-size: 18px;
}

.profile-board-polished {
  grid-template-rows: auto auto auto minmax(0, auto) auto;
}

.profile-hero-polished {
  min-height: 122px;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.profile-hero-polished span,
.profile-hero-polished em {
  display: block;
  color: var(--text-soft);
  font-style: normal;
  font-weight: 800;
}

.profile-hero-polished strong {
  display: block;
  margin: 4px 0;
  color: var(--primary);
  font-size: clamp(34px, 9vw, 48px);
  line-height: 1;
}

.profile-hero-polished button,
.profile-actions-polished button {
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

.profile-actions-polished button:last-child {
  background: #f4eefc;
  color: var(--primary);
}

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

.profile-metrics-polished button {
  min-width: 0;
  min-height: 76px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 10px 6px;
  color: var(--text-main);
}

.profile-metrics-polished b {
  display: block;
  color: var(--primary);
  font-size: clamp(20px, 5.4vw, 28px);
}

.profile-progress-polished {
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
}

.profile-progress-polished > div:first-child {
  display: flex;
  justify-content: space-between;
  color: var(--text-soft);
  font-weight: 850;
}

@media (max-width: 390px) {
  .pet-stat-grid,
  .profile-metrics-polished {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-hero-polished {
    min-height: 108px;
    padding: 14px;
  }

  .profile-hero-polished button {
    min-width: 98px;
  }
}

@media (max-height: 720px) {
  .student-slider,
  .student-slider-single {
    height: calc(100dvh - 62px - env(safe-area-inset-bottom, 0px)) !important;
  }

  .student-mode .lesson-stage,
  .practice-stage {
    max-height: calc(100dvh - 128px - env(safe-area-inset-bottom, 0px));
    padding: 10px;
  }

  .student-mode .practice-media img,
  .student-mode .practice-prompt-only img {
    max-height: min(24dvh, 170px);
  }

  .start-practice-panel {
    max-height: min(48dvh, 360px);
  }

  .profile-hero-polished {
    min-height: 100px;
  }

  .pet-stage-polished {
    min-height: 126px;
  }
}

@media (orientation: landscape) {
  .student-slider,
  .student-slider-single {
    height: calc(100dvh - 58px - env(safe-area-inset-bottom, 0px)) !important;
  }

  .polished-tabs.student-tabs {
    height: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  .student-board-head {
    min-height: 42px;
  }

  .student-mode .lesson-stage,
  .practice-stage {
    width: min(96vw, 980px);
    max-height: calc(100dvh - 104px - env(safe-area-inset-bottom, 0px));
    grid-template-columns: minmax(220px, .9fr) minmax(260px, 1.1fr);
    column-gap: clamp(12px, 2.4vw, 24px);
  }

  .student-mode .practice-media img,
  .student-mode .practice-prompt-only img {
    width: min(30vw, 250px);
    max-height: min(42dvh, 220px);
  }

  .student-mode .lesson-media h1,
  .practice-media h1 {
    font-size: clamp(30px, 4vw, 48px);
  }

  .pet-board-polished {
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr);
    column-gap: 12px;
  }

  .pet-board-polished .student-board-head {
    grid-column: 1 / -1;
  }

  .pet-stage-polished {
    min-height: 0;
  }

  .pet-stat-grid,
  .pet-mission-row {
    align-self: center;
  }
}

/* 2026-07 second round polish: admin, teacher, student refinements. */
.admin-ops-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.admin-ops-strip button {
  min-height: 92px;
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  text-align: left;
  padding: 14px;
  color: var(--text-main);
}

.admin-ops-strip b,
.admin-list-summary b,
.word-media-badge {
  display: block;
}

.admin-ops-strip span,
.admin-list-summary span,
.word-media-badge {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
}

.admin-subnav-v2 {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.add-account-btn {
  min-width: 112px;
}

.admin-list-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(48, 35, 79, .06);
}

.admin-list-summary > div {
  min-width: 92px;
}

.admin-list-summary input,
.admin-search-strip input,
.teacher-word-select-toolbar input,
.section-title-row input {
  min-height: 44px;
  border-radius: 16px;
  border-color: var(--border-soft);
  background: #fff;
}

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

.account-card-v2 {
  margin: 0;
  border-radius: 20px;
}

.account-card-v2 .account-main {
  min-height: 82px;
}

.book-title-block-v2 {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: -2px -2px 12px;
  padding: max(12px, env(safe-area-inset-top, 0px)) 12px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 0 0 24px 24px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 10px 24px rgba(48, 35, 79, .08);
  backdrop-filter: blur(16px);
}

.book-title-block-v2 h2 {
  margin: 2px 0;
  font-size: clamp(24px, 6.4vw, 34px);
  line-height: 1.05;
}

.book-title-block-v2 small {
  color: var(--text-soft);
  font-weight: 800;
}

.admin-search-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 8px 0 12px;
}

.word-index-layout-v2 {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.word-row-v2 .word-row-main {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 70px;
}

.word-row-v2 .word-title-wrap small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-media-badge {
  justify-self: end;
  white-space: nowrap;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f7f2ff;
  color: var(--primary);
}

.alphabet-rail-v2 {
  position: sticky;
  top: 104px;
  max-height: calc(100dvh - 132px);
  overflow: hidden;
}

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

.media-health-grid div,
.media-ok,
.media-warning {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.media-health-grid span {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
}

.media-health-grid b {
  display: block;
  margin-top: 4px;
  word-break: break-all;
  color: var(--text-main);
}

.media-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-weight: 900;
}

.media-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 900;
}

.teacher-page-v2 {
  display: grid;
  gap: 18px;
}

.teacher-hero-v2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.teacher-hero-v2 small {
  display: block;
  margin-top: 5px;
  color: var(--text-soft);
  font-weight: 800;
}

.section-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 220px);
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.teacher-review-count {
  justify-self: end;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff6de;
  color: #8a5411;
  font-size: 12px;
  font-weight: 900;
}

.teacher-student-name-card-v2 {
  border-radius: 18px;
  background: #fff;
  border-color: var(--border-soft);
}

.teacher-word-select-panel-v2 {
  padding-top: 48px;
}

.teacher-word-select-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

#teacher-word-selected-count {
  min-width: 72px;
  padding: 9px 10px;
  border-radius: 999px;
  background: #f3edff;
  color: var(--primary);
  text-align: center;
  font-weight: 900;
}

.teacher-word-check-list-v2 {
  max-height: min(58dvh, 520px);
  overflow-y: auto;
  align-content: start;
  padding-right: 2px;
}

.student-shell-v2 .student-screen {
  padding-bottom: 6px;
}

.student-shell-v2 .lesson-progress-strip span {
  text-align: center;
}

.student-shell-v2 .practice-stage {
  scrollbar-width: thin;
}

.student-shell-v2 .profile-hero-polished,
.student-shell-v2 .rank-summary-card,
.student-shell-v2 .pet-stage-polished {
  box-shadow: 0 12px 26px rgba(48, 35, 79, .09);
}

@media (max-width: 620px) {
  .admin-ops-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-subnav-v2,
  .book-title-block-v2 {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .add-account-btn,
  .book-title-block-v2 .import-chip {
    grid-column: 1 / -1;
    width: 100%;
  }

  .word-row-v2 .word-row-main {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .word-media-badge {
    grid-column: 2;
    justify-self: start;
  }

  .media-health-grid,
  .section-title-row,
  .teacher-word-select-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 700px) {
  .book-title-block-v2 h2 {
    font-size: clamp(21px, 5vw, 28px);
  }

  .teacher-word-check-list-v2 {
    max-height: min(50dvh, 420px);
  }
}

/* 2026-07 third round polish: review filters, media health details, lesson status. */
.teacher-page-v3 .section {
  margin-top: 0;
}

.teacher-review-title-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.teacher-review-filters,
.teacher-recording-filterbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 10px;
  scrollbar-width: none;
}

.teacher-review-filters::-webkit-scrollbar,
.teacher-recording-filterbar::-webkit-scrollbar {
  display: none;
}

.teacher-review-filters button,
.teacher-recording-filterbar button {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: #fff;
  color: var(--text-soft);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 900;
}

.teacher-review-filters button.active,
.teacher-recording-filterbar button.active {
  border-color: #d8c9ff;
  background: #f3edff;
  color: var(--primary);
}

.teacher-review-list-v3 {
  display: grid;
  gap: 10px;
}

.teacher-recording-modal-v3 {
  display: grid;
  gap: 12px;
}

.teacher-recording-list-v3 {
  max-height: min(62dvh, 560px);
  overflow-y: auto;
  padding-right: 2px;
}

.teacher-recording-row span {
  min-width: 0;
}

.teacher-recording-row small {
  display: block;
  margin-top: 4px;
  color: var(--text-soft);
  font-weight: 800;
}

.teacher-recording-row.approved {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.teacher-recording-row.warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.teacher-recording-row.missing {
  border-color: #fecaca;
  background: #fff1f2;
}

.teacher-recording-actions .ok {
  color: #166534;
}

.teacher-recording-actions .warn {
  color: #92400e;
}

.media-health-modal-v3 {
  gap: 14px;
}

.media-health-status {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--border-soft);
}

.media-health-status.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.media-health-status.warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.media-health-status span {
  font-size: 13px;
  font-weight: 800;
}

.media-type-list {
  display: grid;
  gap: 8px;
}

.media-type-row {
  display: grid;
  grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: #fff;
}

.media-type-row span,
.media-sample-list span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
}

.media-sample-list {
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: #fff;
  padding: 12px;
}

.media-sample-list summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 900;
}

.media-sample-list div {
  display: grid;
  gap: 4px;
  padding: 10px 0 0;
  word-break: break-all;
}

.word-empty-v3 {
  place-items: center;
}

.large-empty {
  width: min(100%, 420px);
  min-height: 210px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--border-soft);
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.large-empty b {
  color: var(--text-main);
  font-size: clamp(20px, 5vw, 28px);
}

.large-empty span {
  color: var(--text-soft);
  font-weight: 800;
  line-height: 1.5;
}

.daily-start-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.daily-start-summary div {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(48, 35, 79, .06);
}

.daily-start-summary span {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 850;
}

.daily-start-summary b {
  display: block;
  margin-top: 5px;
  color: var(--primary);
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1;
}

.practice-board-v3 {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.lesson-progress-head-v3 {
  gap: 8px;
}

.lesson-hint-card {
  width: min(100%, 720px);
  justify-self: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(48, 35, 79, .06);
}

.lesson-hint-card span,
.lesson-hint-card small {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.lesson-hint-card b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
}

.practice-board-v3 .lesson-stage {
  max-height: calc(100dvh - 198px - env(safe-area-inset-bottom, 0px));
}

@media (max-width: 520px) {
  .media-type-row,
  .lesson-hint-card {
    grid-template-columns: 1fr;
  }

  .lesson-hint-card small {
    white-space: normal;
  }

  .teacher-recording-row {
    grid-template-columns: 1fr;
  }

  .teacher-recording-actions {
    justify-content: stretch;
  }

  .teacher-recording-actions button {
    flex: 1;
  }
}

@media (max-height: 720px) {
  .daily-start-summary div {
    min-height: 64px;
  }

  .lesson-hint-card {
    padding: 8px 10px;
  }

  .practice-board-v3 .lesson-stage {
    max-height: calc(100dvh - 174px - env(safe-area-inset-bottom, 0px));
  }
}

@media (orientation: landscape) {
  .practice-board-v3 {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .practice-board-v3 .lesson-stage {
    max-height: calc(100dvh - 142px - env(safe-area-inset-bottom, 0px));
  }

  .teacher-recording-list-v3 {
    max-height: min(56dvh, 460px);
  }
}

/* 2026-07 fourth round: practice flow, compact admin, teacher workspace, pet video. */
.topbar .ghost,
.logout-mini-v4 {
  min-width: 64px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  white-space: nowrap;
}

.practice-board-v4 {
  grid-template-rows: auto minmax(0, 1fr);
  row-gap: 10px;
}

.lesson-progress-head-v4 {
  width: min(100%, 720px);
  justify-self: center;
}

.practice-board-v4 .lesson-stage {
  max-height: calc(100dvh - 154px - env(safe-area-inset-bottom, 0px));
}

.lesson-structures-v4 {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(8px, 1.8vw, 12px);
  flex-wrap: wrap;
  max-width: min(100%, 620px);
}

.lesson-part-v4 {
  flex: 0 0 auto;
  width: clamp(calc(var(--letters) * 22px + 26px), calc(var(--letters) * 7vw + 18px), calc(var(--letters) * 34px + 34px));
  min-width: clamp(56px, 16vw, 92px);
  min-height: clamp(50px, 10vw, 68px);
  border: 1px solid #d8c9ff;
  border-radius: 18px;
  background: #f8f4ff;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: clamp(27px, 7vw, 42px);
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 8px 16px rgba(86, 48, 196, .08);
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.lesson-part-v4:active {
  transform: scale(.98);
}

.lesson-part-v4.active,
.lesson-part-v4.long-active {
  background: #efe7ff;
  border-color: #bda7ff;
  box-shadow: 0 0 0 4px rgba(125, 87, 255, .13), 0 12px 22px rgba(86, 48, 196, .14);
}

.lesson-part-v4 span.letter-hot,
.lesson-part-v4 .letter-hot {
  color: #e33257;
  text-shadow: 0 0 12px rgba(227, 50, 87, .28);
}

.lesson-waiting-v4 {
  min-height: 44px;
  display: grid;
  place-items: center;
}

.start-practice-board-v4 .start-practice-panel {
  width: min(82vw, 390px);
}

.pet-board-v4 {
  grid-template-rows: auto minmax(150px, 1fr) auto auto auto;
  row-gap: 10px;
}

.pet-video-stage {
  min-height: clamp(150px, 34dvh, 280px);
  background: linear-gradient(180deg, #f9f5ff, #fff);
}

.pet-video-mask {
  width: min(72vw, 360px);
  height: min(48vw, 260px);
  max-height: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: #f6f1ff;
  box-shadow: 0 18px 34px rgba(48, 35, 79, .16);
}

.pet-video-mask video {
  width: 100%;
  height: 113%;
  object-fit: cover;
  object-position: center 42%;
  transform: translateY(-2%) scale(1.04);
  display: block;
}

.pet-video-mask video.playing {
  filter: saturate(1.04) contrast(1.02);
}

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

.pet-actions-v4 button {
  min-height: 58px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: #fff;
  color: var(--text-main);
  padding: 8px;
  box-shadow: 0 8px 16px rgba(48, 35, 79, .06);
}

.pet-actions-v4 b,
.pet-actions-v4 span {
  display: block;
}

.pet-actions-v4 span {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
}

.admin-page-v4 {
  padding-top: max(8px, env(safe-area-inset-top, 0px));
}

.admin-hero-v4 {
  min-height: 106px;
  padding: 16px;
}

.admin-hero-v4 p {
  display: none;
}

.admin-stat-grid-v4 .admin-stat-card {
  min-height: 112px;
}

.admin-stat-grid-v4 .stat-card-head {
  grid-template-columns: auto minmax(0, 1fr);
}

.admin-stat-grid-v4 .stat-card-head b {
  white-space: nowrap;
  font-size: clamp(17px, 4.1vw, 22px);
}

.admin-titlebar-v4 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 0 2px;
}

.admin-titlebar-v4 h2 {
  margin: 0;
  color: var(--text-main);
  font-size: clamp(26px, 6vw, 34px);
  line-height: 1.08;
}

.admin-titlebar-v4 span {
  display: block;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 850;
}

.admin-title-actions-v4 {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-title-actions-v4 .back-chip,
.admin-title-actions-v4 .add-account-btn {
  min-height: 42px;
  border-radius: 16px;
}

.account-toolbar-v4 {
  margin: 0 0 10px;
}

.admin-list-v4 {
  gap: 6px;
}

.account-row-v4 {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: #fff;
  color: var(--text-main);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  text-align: left;
  box-shadow: 0 6px 12px rgba(48, 35, 79, .05);
}

.account-row-v4 b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.account-row-v4 span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.book-grid-v4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.book-card-v4 {
  border-radius: 20px;
}

.book-cover-v4 {
  min-height: 74px;
  padding: 12px 14px;
  justify-content: center;
}

.book-cover-v4 strong {
  font-size: clamp(20px, 5vw, 26px);
}

.book-card-v4 .book-body {
  padding: 12px;
}

.book-card-v4 .panel-title-row {
  gap: 8px;
}

.book-card-v4 .panel-title-row h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.15;
}

.book-actions-v4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.book-actions-v4 button {
  min-height: 42px;
  border-radius: 14px;
  padding: 0 8px;
  white-space: nowrap;
}

.teacher-page-v4 {
  gap: 12px;
}

.teacher-hero-v4 {
  min-height: 84px;
  padding: 14px;
}

.teacher-hero-v4 h2 {
  margin: 2px 0 0;
}

.teacher-hero-v4 .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.teacher-page-v4 .section {
  margin-top: 0;
}

.teacher-page-v4 .teacher-student-name-card-v2 {
  min-height: 58px;
}

@media (max-width: 520px) {
  .admin-titlebar-v4 {
    grid-template-columns: 1fr;
  }

  .admin-title-actions-v4 {
    justify-content: start;
  }

  .book-grid-v4 {
    grid-template-columns: 1fr;
  }

  .pet-actions-v4 {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 720px) {
  .practice-board-v4 .lesson-stage {
    max-height: calc(100dvh - 132px - env(safe-area-inset-bottom, 0px));
  }

  .pet-video-stage {
    min-height: 130px;
  }

  .pet-video-mask {
    height: min(38vw, 190px);
  }
}

@media (orientation: landscape) {
  .practice-board-v4 .lesson-stage {
    max-height: calc(100dvh - 102px - env(safe-area-inset-bottom, 0px));
  }

  .pet-board-v4 {
    grid-template-columns: minmax(230px, .95fr) minmax(300px, 1.05fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .pet-board-v4 .student-board-head {
    grid-column: 1 / -1;
  }

  .pet-video-stage {
    min-height: 0;
  }

  .pet-stat-grid,
  .pet-actions-v4,
  .pet-mission-row {
    align-self: center;
  }
}

/* 2026-07 fifth round: global interaction, frosted shell, teacher assignment, compact student practice. */
body {
  background: var(--app-shared-background);
  background-attachment: fixed;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: 100vw 100dvh;
}

button,
.teacher-word-check,
.rank-row,
.pet-stat-card,
.profile-metrics-polished button {
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background-color .16s ease, filter .16s ease;
}

button:not(:disabled):active,
.teacher-word-check:active,
.rank-row:active,
.profile-metrics-polished button:active {
  transform: scale(.975);
  filter: saturate(1.04);
}

@media (prefers-reduced-motion: reduce) {
  button,
  .teacher-word-check,
  .rank-row,
  .pet-stat-card,
  .profile-metrics-polished button {
    transition: none;
  }
}

.panel,
.card,
.admin-page-v4 .admin-hero,
.admin-stat-card,
.book-card-v4,
.account-row-v4,
.student-board-head,
.daily-progress-card,
.start-practice-panel-v5,
.lesson-stage-v5,
.teacher-hero-v5,
.rank-summary-card,
.profile-hero-polished,
.profile-metrics-polished button,
.pet-stage-polished,
.pet-stat-card {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(16px);
}

.auth-switch,
.register-panel {
  display: none !important;
}

.topbar .ghost,
.logout-mini-v4 {
  min-width: 58px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 13px;
}

.admin-page-v4 {
  padding-top: max(2px, env(safe-area-inset-top, 0px));
}

.admin-hero-v4 {
  min-height: 82px;
  margin-bottom: 8px;
}

.admin-titlebar-v4 {
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px;
  margin-bottom: 8px;
  padding-top: 4px;
}

.admin-titlebar-v4 h2 {
  font-size: clamp(24px, 5.4vw, 31px);
}

.admin-title-actions-v4 {
  justify-content: flex-end;
}

.admin-title-actions-v4 .back-chip,
.admin-title-actions-v4 .add-account-btn {
  min-width: auto;
  min-height: 38px;
  padding: 0 11px;
  white-space: nowrap;
}

.app-mode,
.app-mode .shell,
.app-mode .app,
.app-mode #content {
  min-height: 100dvh;
}

#content:has(.admin-home-v5) {
  min-height: 0;
}

.admin-home-v5 {
  min-height: 0;
  margin: 0;
  padding: 0 0 8px;
  align-content: start;
  background: transparent;
}

.admin-home-v5.admin-page {
  gap: 0;
}

.admin-home-v5 .admin-hero-v5 {
  display: none !important;
}

.admin-stat-grid-v5 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 3.2vw, 18px);
  align-content: start;
  margin-top: 4px;
}

.admin-stat-grid-v5 .admin-stat-card-v5 {
  min-height: clamp(132px, 22vw, 168px);
  padding: clamp(16px, 4vw, 22px);
  border-radius: clamp(22px, 5vw, 30px);
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 16px 36px rgba(73, 45, 139, .10);
}

.admin-stat-card-v5 .stat-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.admin-stat-card-v5 .stat-card-head b {
  font-size: clamp(23px, 5.5vw, 32px) !important;
  line-height: 1.05;
}

.admin-stat-card-v5 strong {
  align-self: end;
  font-size: clamp(42px, 10vw, 58px);
  line-height: .95;
}

.admin-stat-card-v5.accent-orange {
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(255, 247, 237, .88)),
    rgba(255,255,255,.86);
}

.admin-stat-card-v5.accent-purple {
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(247, 242, 255, .88)),
    rgba(255,255,255,.86);
}

.admin-stat-card-v5.accent-blue {
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(239, 246, 255, .88)),
    rgba(255,255,255,.86);
}

.admin-stat-card-v5.accent-pink {
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(253, 242, 248, .88)),
    rgba(255,255,255,.86);
}

@media (max-width: 360px) {
  .admin-titlebar-v4 {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .admin-title-actions-v4 {
    gap: 5px;
  }

  .admin-title-actions-v4 .back-chip,
  .admin-title-actions-v4 .add-account-btn {
    min-height: 34px;
    padding: 0 8px;
    font-size: 12px;
  }
}

.teacher-topbar-hidden {
  display: none !important;
}

.teacher-page-v5 {
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  gap: 12px;
}

.teacher-hero-v5 {
  min-height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
}

.teacher-hero-v5 h2 {
  margin: 0;
  text-align: left;
  font-size: clamp(22px, 5.2vw, 30px);
}

.teacher-hero-v5 .actions {
  display: flex;
  gap: 8px;
  margin: 0;
}

.teacher-word-select-panel-v5 {
  padding-top: 44px;
}

.teacher-all-books-word-list {
  max-height: min(60dvh, 560px);
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding-right: 2px;
}

.teacher-book-word-section {
  display: grid;
  gap: 8px;
}

.teacher-book-word-section h3 {
  margin: 0;
  color: var(--text-main, var(--ink));
}

.teacher-book-word-section small {
  color: var(--text-soft, var(--muted));
  font-size: 12px;
}

.student-mode .student-shell,
.polished-student-shell {
  background:
    radial-gradient(circle at 12% 6%, rgba(255, 163, 63, .18), transparent 30%),
    radial-gradient(circle at 88% 0%, rgba(236, 63, 157, .16), transparent 30%),
    linear-gradient(180deg, #fbf7ff 0%, #fff8ef 50%, #eef7ff 100%);
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

.student-slider,
.student-slider-single {
  height: calc(100dvh - 66px - env(safe-area-inset-bottom, 0px)) !important;
}

.student-tabs.polished-tabs,
.student-tabs {
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(54px + env(safe-area-inset-bottom, 0px));
  padding: 4px 10px max(4px, env(safe-area-inset-bottom, 0px));
  border-radius: 18px 18px 0 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(18px);
}

.student-tabs button {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 0;
  border-radius: 13px;
}

.student-tabs span {
  width: 23px;
  height: 23px;
  margin: 0;
}

.student-tabs svg {
  width: 20px;
  height: 20px;
}

.student-tabs b {
  line-height: 1;
  font-size: 11px;
}

.student-board-head-v5 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(234, 220, 255, .95);
  border-radius: 20px;
  box-shadow: 0 10px 22px rgba(73, 45, 139, .08);
}

.student-count-pill {
  min-height: 32px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #f3edff;
  color: #6736c8;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.star-gold,
.star-pill {
  color: #b7791f !important;
}

.rank-row b,
.profile-metrics-polished b,
.lesson-progress-strip b {
  color: #b7791f;
}

.start-practice-board-v5 {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 0 !important;
}

.daily-progress-card {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(234, 220, 255, .95);
  border-radius: 22px;
  box-shadow: 0 10px 22px rgba(73, 45, 139, .08);
}

.daily-progress-card span {
  color: var(--text-soft, var(--muted));
  font-size: 13px;
  font-weight: 900;
}

.daily-progress-card b {
  color: var(--text-main, var(--ink));
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1;
}

.start-practice-panel-v5 {
  width: min(100%, 420px) !important;
  max-height: none;
  justify-self: center;
  align-self: start;
  min-height: 190px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  border: 1px solid rgba(234, 220, 255, .95);
  border-radius: 28px;
  box-shadow: 0 16px 38px rgba(73, 45, 139, .12);
}

.start-practice-panel-v5 .start-practice-btn {
  min-height: 58px;
  min-width: min(86vw, 320px);
  border-radius: 20px;
  font-size: 18px;
}

.practice-board-v5 {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding-bottom: 0 !important;
}

.lesson-progress-head-v5 {
  width: min(100%, 720px);
  justify-self: center;
}

.lesson-stage-v5 {
  width: min(100%, 720px);
  justify-self: center;
  max-height: calc(100dvh - 130px - env(safe-area-inset-bottom, 0px)) !important;
  padding: clamp(8px, 1.3vh, 12px);
  overflow-y: auto;
}

.lesson-media-v5 {
  width: 100%;
  gap: clamp(6px, 1vh, 10px);
  padding: 0 !important;
}

.lesson-media-v5 img,
.lesson-media-v5 .word-visual {
  width: min(54vw, 220px);
  max-height: min(21dvh, 170px);
}

.lesson-media-v5 h1 {
  font-size: clamp(30px, 8vw, 48px) !important;
  margin: 0;
}

.lesson-structures-v5 {
  width: 100%;
  display: flex;
  flex-wrap: nowrap !important;
  justify-content: center;
  align-items: stretch;
  gap: clamp(5px, 1vw, 8px);
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}

.lesson-structures-v5::-webkit-scrollbar {
  display: none;
}

.lesson-part-v5 {
  flex: var(--letters) 1 0;
  min-width: calc(var(--letters) * 18px + 24px);
  max-width: calc(var(--letters) * 38px + 42px);
  min-height: clamp(46px, 9vw, 62px);
  border-radius: 16px;
  font-size: clamp(24px, 6.2vw, 38px);
}

.lesson-waiting-v5 {
  min-height: 40px;
  display: grid;
  place-items: center;
  color: var(--text-soft, var(--muted));
  font-weight: 900;
}

.lesson-bank {
  margin-top: 2px;
}

.lesson-bank button {
  width: clamp(40px, 10vw, 54px);
  height: clamp(40px, 10vw, 54px);
}

.pet-board-v5 {
  grid-template-rows: auto minmax(120px, 1fr) auto auto;
  row-gap: 8px;
}

.pet-gif-stage {
  min-height: clamp(140px, 30dvh, 230px);
  overflow: hidden;
}

.cat-motion-card {
  position: relative;
  width: min(62vw, 260px);
  aspect-ratio: 1.2;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 80%, #f1d7c8 0 11%, transparent 12%),
    linear-gradient(180deg, #f6f1ff, #fff);
  animation: catIdle 1.9s ease-in-out infinite;
}

.cat-motion-head,
.cat-motion-body,
.cat-motion-tail,
.cat-motion-bowl {
  position: absolute;
  display: block;
}

.cat-motion-body {
  left: 22%;
  bottom: 18%;
  width: 48%;
  height: 44%;
  border-radius: 52% 48% 46% 50%;
  background: linear-gradient(135deg, #7b7d80 0 55%, #fff 56% 100%);
  box-shadow: inset -10px -12px 0 rgba(0,0,0,.08);
}

.cat-motion-head {
  left: 45%;
  top: 19%;
  width: 34%;
  height: 32%;
  border-radius: 48%;
  background: linear-gradient(135deg, #8d9094 0 47%, #fff 48% 100%);
}

.cat-motion-head::before,
.cat-motion-head::after {
  content: "";
  position: absolute;
  top: -13%;
  width: 24%;
  height: 28%;
  background: #7b7d80;
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.cat-motion-head::before { left: 12%; transform: rotate(-12deg); }
.cat-motion-head::after { right: 10%; transform: rotate(15deg); }

.cat-motion-tail {
  left: 7%;
  bottom: 19%;
  width: 30%;
  height: 13%;
  border-radius: 999px;
  background: #74777c;
  transform-origin: right center;
  animation: tailWave 1.1s ease-in-out infinite;
}

.cat-motion-bowl {
  right: 17%;
  bottom: 12%;
  width: 28%;
  height: 11%;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(180deg, #f43f8f, #b83280);
}

.cat-motion-card.feeding {
  animation: catFeed .38s ease-in-out 3;
}

.pet-actions-v5 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pet-actions-v5 button {
  min-height: 50px;
  border: 1px solid var(--border-soft, var(--line));
  border-radius: 16px;
  background: rgba(255, 255, 255, .86);
  color: var(--text-main, var(--ink));
  font-weight: 900;
}

.profile-board-v5 {
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
}

.compact-profile-hero-v5 {
  min-height: 104px;
  padding: 14px;
}

.profile-metrics-v5 {
  gap: 8px;
}

.profile-metrics-v5 button {
  min-height: 72px;
}

.profile-actions-v5 {
  margin-top: 0;
  padding-bottom: 2px;
}

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

@keyframes tailWave {
  0%, 100% { transform: rotate(3deg); }
  50% { transform: rotate(-8deg); }
}

@keyframes catFeed {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(5px) scale(1.015); }
}

@media (max-width: 430px) {
  .student-board-head-v5 {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .student-count-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .teacher-word-check-list-v2 {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 720px) {
  .student-slider,
  .student-slider-single {
    height: calc(100dvh - 58px - env(safe-area-inset-bottom, 0px)) !important;
  }

  .student-tabs.polished-tabs,
  .student-tabs {
    height: calc(50px + env(safe-area-inset-bottom, 0px));
  }

  .start-practice-panel-v5 {
    min-height: 150px;
  }

  .lesson-stage-v5 {
    max-height: calc(100dvh - 112px - env(safe-area-inset-bottom, 0px)) !important;
  }

  .lesson-media-v5 img,
  .lesson-media-v5 .word-visual {
    max-height: min(18dvh, 130px);
  }
}

@media (orientation: landscape) {
  .lesson-stage-v5 {
    grid-template-columns: minmax(230px, .95fr) minmax(260px, 1.05fr);
    max-height: calc(100dvh - 88px - env(safe-area-inset-bottom, 0px)) !important;
  }

  .lesson-media-v5 img,
  .lesson-media-v5 .word-visual {
    width: min(28vw, 220px);
    max-height: min(36dvh, 180px);
  }

  .pet-board-v5 {
    grid-template-columns: minmax(220px, .9fr) minmax(260px, 1.1fr);
    grid-template-rows: auto 1fr auto;
  }

  .pet-board-v5 .student-board-head {
    grid-column: 1 / -1;
  }
}

/* 2026-07 sixth round: viewport-aware responsive shell and redesigned admin home. */
html {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
}

body.app-mode:not(.student-active) {
  background:
    radial-gradient(circle at 15% 8%, rgba(255, 163, 63, .18), transparent 30%),
    radial-gradient(circle at 84% 2%, rgba(236, 63, 157, .16), transparent 32%),
    linear-gradient(180deg, #fff7fb 0%, #fbf7ff 48%, #eef7ff 100%);
}

body.app-mode:not(.student-active) .shell {
  width: min(100%, 900px);
  max-width: 100%;
  min-height: 100dvh;
  padding:
    max(14px, calc(env(safe-area-inset-top, 0px) + 14px))
    clamp(12px, 3.2dvw, 24px)
    max(16px, calc(env(safe-area-inset-bottom, 0px) + 14px));
}

body.app-mode:not(.student-active) .app {
  width: 100%;
  min-height: calc(100dvh - max(28px, calc(env(safe-area-inset-top, 0px) + 28px)) - max(20px, calc(env(safe-area-inset-bottom, 0px) + 18px)));
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2dvh, 16px);
}

body.app-mode:not(.student-active) .topbar {
  position: static;
  width: 100%;
  min-height: clamp(58px, 8.5dvh, 76px);
  margin: 0;
  padding: clamp(10px, 2.4dvw, 18px);
  border-radius: clamp(18px, 3.5dvw, 28px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(234, 223, 248, .86);
  box-shadow: 0 14px 34px rgba(73, 45, 139, .10);
  backdrop-filter: blur(18px);
}

body.app-mode:not(.student-active) .topbar h1 {
  font-size: clamp(24px, 4.3dvw, 34px);
  line-height: 1.08;
  text-wrap: balance;
}

body.app-mode:not(.student-active) #content {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
}

body.app-mode:not(.student-active) .admin-page,
body.app-mode:not(.student-active) .teacher-page,
body.app-mode:not(.student-active) .section,
body.app-mode:not(.student-active) .admin-panel,
body.app-mode:not(.student-active) .card,
body.app-mode:not(.student-active) .panel {
  max-width: 100%;
}

body.app-mode:not(.student-active) .admin-page,
body.app-mode:not(.student-active) .teacher-page {
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

body.app-mode:not(.student-active) .modal-form,
body.app-mode:not(.student-active) .admin-modal,
body.app-mode:not(.student-active) dialog {
  max-width: min(94dvw, 620px);
  max-height: min(88dvh, 760px);
  overflow: auto;
}

body.app-mode:not(.student-active) table,
body.app-mode:not(.student-active) .table-wrap,
body.app-mode:not(.student-active) .word-list,
body.app-mode:not(.student-active) .account-list,
body.app-mode:not(.student-active) .book-word-list {
  max-width: 100%;
}

.admin-home-v5 {
  --admin-gap: clamp(10px, 2.2vmin, 18px);
  --admin-card-h: clamp(108px, 17dvh, 150px);
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  display: grid;
  align-content: start;
  gap: var(--admin-gap);
}

#content:has(.admin-home-v5) {
  min-height: 0;
}

.admin-stat-grid-v5 {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(var(--admin-card-h), auto);
  gap: var(--admin-gap);
  margin: 0;
  align-content: start;
}

.admin-stat-grid-v5 .admin-stat-card-v5 {
  position: relative;
  min-height: var(--admin-card-h) !important;
  height: auto;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: stretch;
  gap: clamp(10px, 1.8vmin, 16px);
  padding: clamp(14px, 2.8vmin, 22px) !important;
  border: 1px solid rgba(234, 223, 248, .9);
  border-radius: clamp(18px, 3.8vmin, 26px) !important;
  background:
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,255,255,.74)),
    rgba(255,255,255,.86) !important;
  box-shadow: 0 14px 34px rgba(73, 45, 139, .10) !important;
  isolation: isolate;
}

.admin-stat-grid-v5 .admin-stat-card-v5::before {
  content: "";
  position: absolute;
  inset: auto -18% -42% auto;
  width: clamp(96px, 22vmin, 150px);
  aspect-ratio: 1;
  border-radius: 999px;
  background: radial-gradient(circle, var(--card-glow, rgba(109, 63, 217, .18)), transparent 68%);
  z-index: -1;
}

.admin-stat-card-v5 .stat-card-head {
  display: flex !important;
  align-items: center;
  gap: clamp(8px, 1.8vmin, 12px);
  min-width: 0;
}

.admin-stat-card-v5 .stat-icon {
  width: clamp(42px, 8.5vmin, 58px);
  height: clamp(42px, 8.5vmin, 58px);
  flex: 0 0 auto;
  border-radius: clamp(14px, 3vmin, 20px);
  background: rgba(247, 242, 255, .9);
  box-shadow: 0 12px 24px rgba(73, 45, 139, .10);
}

.admin-stat-card-v5 .stat-card-head b {
  display: block;
  min-width: 0;
  font-size: clamp(20px, 4.8vmin, 30px) !important;
  line-height: 1.08;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-stat-card-v5 strong {
  align-self: end;
  justify-self: start;
  font-size: clamp(38px, 7.5vmin, 54px) !important;
  line-height: .9;
  letter-spacing: 0;
  color: #35235f;
}

.admin-stat-card-v5.accent-orange { --card-glow: rgba(255, 163, 63, .24); }
.admin-stat-card-v5.accent-purple { --card-glow: rgba(109, 63, 217, .20); }
.admin-stat-card-v5.accent-blue { --card-glow: rgba(47, 130, 239, .18); }
.admin-stat-card-v5.accent-pink { --card-glow: rgba(236, 63, 157, .18); }

@media (hover: hover) {
  .admin-stat-grid-v5 .admin-stat-card-v5:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(73, 45, 139, .14) !important;
  }
}

@media (min-width: 760px) {
  body.app-mode:not(.student-active) .shell {
    width: min(100%, 760px);
  }

  .admin-home-v5 {
    --admin-card-h: clamp(108px, 16dvh, 136px);
  }

  .admin-stat-grid-v5 .admin-stat-card-v5 {
    padding: clamp(14px, 2vmin, 18px) !important;
  }

  .admin-stat-card-v5 .stat-card-head b {
    font-size: clamp(20px, 3.5vmin, 27px) !important;
  }

  .admin-stat-card-v5 strong {
    font-size: clamp(36px, 6.6vmin, 48px) !important;
  }
}

@media (min-width: 980px) {
  body.app-mode:not(.student-active) .shell {
    width: min(100%, 860px);
  }

  .admin-stat-grid-v5 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-home-v5 {
    --admin-card-h: clamp(116px, 18dvh, 150px);
  }

  .admin-stat-card-v5 .stat-card-head {
    align-items: flex-start;
  }

  .admin-stat-card-v5 .stat-card-head b {
    white-space: normal;
  }
}

@media (max-width: 430px) {
  body.app-mode:not(.student-active) .shell {
    padding-left: clamp(10px, 3.6dvw, 16px);
    padding-right: clamp(10px, 3.6dvw, 16px);
  }

  .admin-home-v5 {
    --admin-gap: clamp(10px, 3dvw, 14px);
    --admin-card-h: clamp(116px, 16dvh, 146px);
  }

  .admin-stat-card-v5 .stat-card-head b {
    font-size: clamp(20px, 5.1dvw, 26px) !important;
  }
}

@media (max-width: 360px) {
  .admin-stat-grid-v5 {
    grid-template-columns: 1fr;
  }

  .admin-home-v5 {
    --admin-card-h: 92px;
  }

  .admin-stat-grid-v5 .admin-stat-card-v5 {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 1fr;
    align-items: center;
  }

  .admin-stat-card-v5 strong {
    justify-self: end;
    align-self: center;
  }
}

@media (max-height: 760px) {
  body.app-mode:not(.student-active) .topbar {
    min-height: 54px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  body.app-mode:not(.student-active) .topbar h1 {
    font-size: clamp(22px, 4dvw, 29px);
  }

  .admin-home-v5 {
    --admin-gap: clamp(8px, 1.7vmin, 14px);
    --admin-card-h: clamp(96px, 20dvh, 128px);
  }

  .admin-stat-card-v5 .stat-icon {
    width: clamp(38px, 7vmin, 50px);
    height: clamp(38px, 7vmin, 50px);
  }

  .admin-stat-card-v5 .stat-card-head b {
    font-size: clamp(18px, 4vmin, 25px) !important;
  }

  .admin-stat-card-v5 strong {
    font-size: clamp(32px, 7vmin, 46px) !important;
  }
}

@media (orientation: landscape) and (max-height: 680px) {
  body.app-mode:not(.student-active) .shell {
    width: min(100%, 980px);
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }

  body.app-mode:not(.student-active) .app {
    gap: 8px;
  }

  .admin-stat-grid-v5 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-home-v5 {
    --admin-card-h: clamp(92px, 28dvh, 118px);
  }
}

/* 2026-07 sixth round hotfix: continuous background and container-based book layout. */
body.app-mode:not(.student-active) #content,
body.app-mode:not(.student-active) .admin-page,
body.app-mode:not(.student-active) .admin-page-v4,
body.app-mode:not(.student-active) .teacher-page,
body.app-mode:not(.student-active) .teacher-page-simple {
  background: transparent !important;
  box-shadow: none;
}

body.app-mode:not(.student-active) #content {
  display: grid;
  align-content: start;
}

body.app-mode:not(.student-active) .admin-page-v4 {
  width: 100%;
  gap: clamp(10px, 2.2vmin, 16px);
  padding-top: 0;
}

.admin-titlebar-v4 {
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: end;
  gap: clamp(8px, 2vmin, 14px);
}

.admin-titlebar-v4 h2 {
  font-size: clamp(25px, 6.4vmin, 38px);
  line-height: 1.08;
  text-wrap: balance;
}

.admin-titlebar-v4 span {
  font-size: clamp(14px, 3.2vmin, 18px);
  font-weight: 850;
}

.admin-title-actions-v4 {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: clamp(8px, 2vmin, 12px);
  flex-wrap: nowrap;
}

.admin-title-actions-v4 .back-chip,
.admin-title-actions-v4 .add-account-btn {
  min-width: 0;
  min-height: clamp(38px, 7vmin, 52px);
  padding: 0 clamp(14px, 3.2vmin, 22px);
  border-radius: clamp(14px, 3vmin, 22px);
  font-size: clamp(14px, 3.2vmin, 19px);
  white-space: nowrap;
}

.book-grid-v4 {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)) !important;
  gap: clamp(10px, 2.2vmin, 16px);
  align-items: stretch;
}

.book-card-v4 {
  min-width: 0;
  min-height: clamp(132px, 20dvh, 178px) !important;
  display: grid;
  grid-template-columns: minmax(112px, 34%) minmax(0, 1fr);
  border-radius: clamp(18px, 3.2vmin, 24px);
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(234, 223, 248, .88);
  box-shadow: 0 14px 32px rgba(73, 45, 139, .09);
  overflow: hidden;
}

.book-cover-v4 {
  min-height: 100% !important;
  padding: clamp(12px, 2.8vmin, 18px);
  display: grid;
  align-content: end;
}

.book-cover-v4 strong {
  max-width: 100%;
  font-size: clamp(22px, 5.2vmin, 34px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.book-card-v4 .book-body {
  min-width: 0;
  padding: clamp(12px, 2.5vmin, 18px);
  gap: clamp(10px, 2vmin, 14px);
}

.book-card-v4 .panel-title-row {
  min-width: 0;
  align-items: start;
}

.book-card-v4 .panel-title-row > div {
  min-width: 0;
}

.book-card-v4 .panel-title-row h3 {
  font-size: clamp(18px, 4.1vmin, 25px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.book-card-v4 .meta {
  font-size: clamp(13px, 3vmin, 17px);
}

.book-card-v4 .status-pill {
  flex: 0 0 auto;
  min-height: clamp(28px, 5.5vmin, 38px);
  padding: 0 clamp(10px, 2.2vmin, 14px);
  font-size: clamp(12px, 2.8vmin, 15px);
}

.book-actions-v4 {
  width: 100%;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.8vmin, 10px);
  margin-top: 0;
}

.book-actions-v4 button {
  width: 100%;
  min-width: 0;
  min-height: clamp(40px, 6.8vmin, 50px);
  padding: 0 clamp(8px, 1.6vmin, 12px);
  border-radius: clamp(13px, 2.6vmin, 18px);
  font-size: clamp(13px, 3vmin, 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .book-grid-v4 {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 430px) {
  .admin-titlebar-v4 {
    align-items: start;
  }

  .admin-titlebar-v4 h2 {
    font-size: clamp(26px, 7.2dvw, 34px);
  }

  .admin-title-actions-v4 .back-chip,
  .admin-title-actions-v4 .add-account-btn {
    min-height: clamp(42px, 10dvw, 50px);
    padding: 0 clamp(14px, 3.4dvw, 18px);
    font-size: clamp(15px, 4dvw, 18px);
  }

  .book-card-v4 {
    grid-template-columns: minmax(116px, 36%) minmax(0, 1fr);
    min-height: clamp(150px, 23dvh, 190px) !important;
  }
}

@media (max-width: 360px) {
  .admin-titlebar-v4 {
    grid-template-columns: 1fr !important;
  }

  .admin-title-actions-v4 {
    justify-content: start;
  }

  .book-card-v4 {
    grid-template-columns: 1fr;
  }

  .book-cover-v4 {
    min-height: 88px !important;
  }
}

/* 2026-07 density parity: keep admin book pages visually consistent across devices. */
body.app-mode:not(.student-active) .shell {
  width: min(100%, 780px);
}

body.app-mode:not(.student-active) .app {
  gap: 14px;
}

body.app-mode:not(.student-active) .topbar {
  min-height: 70px;
  padding: 12px 18px;
  border-radius: 26px;
}

body.app-mode:not(.student-active) .topbar h1 {
  font-size: 30px;
  line-height: 1.08;
}

body.app-mode:not(.student-active) .topbar .ghost {
  min-width: 112px;
  min-height: 46px;
  border-radius: 18px;
  font-size: 18px;
}

body.app-mode:not(.student-active) .admin-page-v4 {
  gap: 14px;
}

.admin-titlebar-v4 {
  gap: 12px;
}

.admin-titlebar-v4 h2 {
  font-size: 34px;
  line-height: 1.08;
}

.admin-titlebar-v4 span {
  font-size: 17px;
}

.admin-title-actions-v4 {
  gap: 10px;
}

.admin-title-actions-v4 .back-chip,
.admin-title-actions-v4 .add-account-btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 18px;
  font-size: 18px;
}

.book-grid-v4 {
  grid-template-columns: 1fr !important;
  gap: 14px;
}

.book-card-v4 {
  min-height: 168px !important;
  grid-template-columns: minmax(150px, 34%) minmax(0, 1fr);
  border-radius: 24px;
}

.book-cover-v4 {
  min-height: 168px !important;
  padding: 16px;
}

.book-cover-v4 strong {
  font-size: 30px;
  line-height: 1.14;
}

.book-card-v4 .book-body {
  padding: 18px;
  gap: 14px;
}

.book-card-v4 .panel-title-row h3 {
  font-size: 25px;
}

.book-card-v4 .meta {
  font-size: 17px;
}

.book-card-v4 .status-pill {
  min-height: 36px;
  padding: 0 14px;
  font-size: 15px;
}

.book-actions-v4 {
  gap: 10px;
}

.book-actions-v4 button {
  min-height: 48px;
  border-radius: 18px;
  font-size: 17px;
}

@media (min-width: 860px) {
  body.app-mode:not(.student-active) .shell {
    width: min(100%, 820px);
  }
}

@media (max-width: 520px) {
  body.app-mode:not(.student-active) .shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  body.app-mode:not(.student-active) .topbar {
    min-height: 68px;
    padding: 12px 16px;
  }

  body.app-mode:not(.student-active) .topbar h1 {
    font-size: 29px;
  }

  body.app-mode:not(.student-active) .topbar .ghost {
    min-width: 104px;
    min-height: 44px;
    font-size: 17px;
  }

  .admin-titlebar-v4 h2 {
    font-size: 32px;
  }

  .admin-title-actions-v4 .back-chip,
  .admin-title-actions-v4 .add-account-btn {
    min-height: 46px;
    padding: 0 18px;
    font-size: 17px;
  }

  .book-card-v4 {
    min-height: 166px !important;
    grid-template-columns: minmax(132px, 36%) minmax(0, 1fr);
  }

  .book-cover-v4 {
    min-height: 166px !important;
  }

  .book-cover-v4 strong {
    font-size: 27px;
  }

  .book-card-v4 .book-body {
    padding: 16px;
  }

  .book-card-v4 .panel-title-row h3 {
    font-size: 23px;
  }

  .book-card-v4 .meta {
    font-size: 16px;
  }

  .book-actions-v4 button {
    min-height: 46px;
    font-size: 16px;
  }
}

@media (max-width: 380px) {
  .admin-titlebar-v4 {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .admin-titlebar-v4 h2 {
    font-size: 29px;
  }

  .admin-title-actions-v4 .back-chip,
  .admin-title-actions-v4 .add-account-btn {
    min-height: 42px;
    padding: 0 12px;
    font-size: 15px;
  }

  .book-card-v4 {
    min-height: 150px !important;
    grid-template-columns: minmax(112px, 34%) minmax(0, 1fr);
  }

  .book-cover-v4 {
    min-height: 150px !important;
    padding: 14px;
  }

  .book-cover-v4 strong {
    font-size: 23px;
  }

  .book-card-v4 .book-body {
    padding: 14px;
    gap: 10px;
  }

  .book-card-v4 .panel-title-row h3 {
    font-size: 20px;
  }

  .book-card-v4 .meta {
    font-size: 14px;
  }

  .book-card-v4 .status-pill {
    min-height: 30px;
    padding: 0 10px;
    font-size: 13px;
  }

  .book-actions-v4 {
    gap: 8px;
  }

  .book-actions-v4 button {
    min-height: 40px;
    border-radius: 15px;
    font-size: 14px;
  }
}

/* 2026-07 book detail polish: unified visual density, fixed A-Z rail, clean rows. */
.book-detail-page,
.book-detail-page-v2 {
  gap: 14px !important;
}

.book-title-block-v2 {
  margin: 0 !important;
  padding: 16px !important;
  min-height: 0 !important;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(234, 223, 248, .78);
  border-radius: 24px !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 163, 63, .14), transparent 36%),
    radial-gradient(circle at 96% 8%, rgba(236, 63, 157, .16), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, .82), rgba(248, 244, 255, .74)) !important;
  box-shadow: 0 14px 34px rgba(73, 45, 139, .10) !important;
  backdrop-filter: blur(16px);
}

.book-title-block-v2 .eyebrow {
  margin: 0 0 2px;
  color: rgba(53, 35, 95, .76);
  font-size: 13px;
  font-weight: 900;
}

.book-title-block-v2 h2 {
  margin: 0 !important;
  font-size: 30px !important;
  line-height: 1.08 !important;
}

.book-title-block-v2 small {
  display: block;
  margin-top: 5px;
  color: rgba(53, 35, 95, .64);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 850;
}

.book-title-block-v2 .back-chip,
.book-title-block-v2 .import-chip {
  min-height: 44px !important;
  min-width: 92px;
  padding: 0 16px !important;
  border-radius: 18px !important;
  font-size: 16px !important;
  white-space: nowrap;
}

.book-title-block-v2 .import-chip {
  min-width: 132px;
}

.admin-search-strip {
  margin: 2px 0 8px !important;
  gap: 10px;
}

.admin-search-strip input {
  min-height: 54px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .88);
}

.admin-search-strip button {
  min-height: 54px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
}

.word-index-layout,
.word-index-layout-v2 {
  grid-template-columns: minmax(0, 1fr) 0 !important;
  gap: 0 !important;
  padding-right: 32px;
}

.alphabet-rail,
.alphabet-rail-v2 {
  position: fixed !important;
  right: max(8px, calc((100vw - 780px) / 2 + 8px)) !important;
  top: max(168px, 24dvh) !important;
  bottom: max(22px, env(safe-area-inset-bottom, 0px)) !important;
  z-index: 18 !important;
  width: 24px !important;
  max-height: none !important;
  height: auto !important;
  display: grid !important;
  align-content: stretch !important;
  gap: 1px !important;
  padding: 8px 3px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, .78) !important;
  border: 1px solid rgba(234, 223, 248, .72) !important;
  box-shadow: 0 12px 28px rgba(73, 45, 139, .13) !important;
  backdrop-filter: blur(14px);
  overflow: hidden !important;
}

.alphabet-rail button,
.alphabet-rail-v2 button {
  width: 18px !important;
  min-height: 0 !important;
  height: auto !important;
  font-size: 10px !important;
  line-height: 1 !important;
}

.indexed-word-list {
  gap: 10px !important;
}

.swipe-word-row,
.word-row-v2 {
  height: 86px !important;
  min-height: 86px !important;
  border-radius: 22px !important;
  overflow-y: hidden !important;
  box-shadow: 0 10px 24px rgba(73, 45, 139, .08) !important;
}

.swipe-track {
  height: 86px !important;
}

.word-row-main,
.word-row-v2 .word-row-main {
  height: 86px !important;
  min-height: 86px !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  gap: 12px !important;
  padding: 13px 14px !important;
  border-radius: 22px !important;
  background: rgba(255, 255, 255, .9) !important;
}

.word-row-v2 .word-media-badge {
  display: none !important;
}

.word-title-wrap b {
  font-size: 22px !important;
  line-height: 1.05;
}

.word-title-wrap small,
.word-row-v2 .word-title-wrap small {
  max-width: 100%;
  color: rgba(53, 35, 95, .62) !important;
  font-size: 15px !important;
  line-height: 1.35 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.word-initial {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  font-size: 22px;
}

.book-detail-back-top {
  position: fixed;
  left: max(14px, env(safe-area-inset-left, 0px));
  bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 14px));
  z-index: 28;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #2f82ef, #6d3fd9);
  color: #fff;
  font-size: 28px;
  font-weight: 950;
  box-shadow: 0 14px 32px rgba(73, 45, 139, .22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .16s ease, transform .16s ease;
}

.book-detail-back-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 520px) {
  .book-title-block-v2 {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px !important;
  }

  .book-title-block-v2 h2 {
    font-size: 27px !important;
  }

  .book-title-block-v2 small {
    font-size: 14px;
  }

  .book-title-block-v2 .back-chip,
  .book-title-block-v2 .import-chip {
    min-width: 78px;
    min-height: 42px !important;
    padding: 0 13px !important;
    font-size: 15px !important;
  }

  .book-title-block-v2 .import-chip {
    min-width: 112px;
  }

  .alphabet-rail,
  .alphabet-rail-v2 {
    right: max(8px, env(safe-area-inset-right, 0px)) !important;
    top: max(148px, 22dvh) !important;
    width: 24px !important;
  }

  .word-index-layout,
  .word-index-layout-v2 {
    padding-right: 32px;
  }
}

@media (max-width: 390px) {
  .book-title-block-v2 {
    grid-template-columns: 1fr auto;
  }

  .book-title-block-v2 .back-chip {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .book-title-block-v2 .import-chip {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }
}

/* 2026-07 mobile book list title fix: prevent book names from being squeezed. */
@media (max-width: 520px) {
  .book-grid-v4 .book-card-v4 {
    grid-template-columns: minmax(150px, 42%) minmax(0, 1fr) !important;
  }

  .book-grid-v4 .book-cover-v4 {
    padding: 14px !important;
  }

  .book-grid-v4 .book-cover-v4 strong {
    display: block;
    width: 100%;
    font-size: 24px !important;
    line-height: 1.08;
    white-space: nowrap;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: clip;
  }
}

@media (max-width: 390px) {
  .book-grid-v4 .book-card-v4 {
    grid-template-columns: minmax(134px, 40%) minmax(0, 1fr) !important;
  }

  .book-grid-v4 .book-cover-v4 strong {
    font-size: 22px !important;
  }
}

/* 2026-07 word index ergonomics: sticky admin bar, touch rail, reserved rail space. */
body.app-mode:not(.student-active) .topbar {
  position: sticky !important;
  top: max(10px, env(safe-area-inset-top, 0px)) !important;
  z-index: 50 !important;
}

body.app-mode:not(.student-active) .app {
  overflow: visible;
}

.book-detail-page .book-title-block-v2,
.book-detail-page .admin-search-strip {
  width: calc(100% - 42px) !important;
  max-width: calc(100% - 42px) !important;
  margin-right: 42px !important;
}

.book-detail-page .word-index-layout,
.book-detail-page .word-index-layout-v2 {
  padding-right: 42px !important;
}

.book-detail-page .admin-search-strip {
  grid-template-columns: minmax(0, 1fr) minmax(54px, auto) !important;
}

.book-detail-page .admin-search-strip input {
  min-width: 0;
}

.book-detail-page .admin-search-strip button {
  min-width: 54px;
  padding: 0 12px;
}

.book-detail-page .alphabet-rail,
.book-detail-page .alphabet-rail-v2 {
  top: max(94px, calc(env(safe-area-inset-top, 0px) + 94px)) !important;
  right: max(8px, calc((100vw - 780px) / 2 + 8px)) !important;
  bottom: max(18px, env(safe-area-inset-bottom, 0px)) !important;
  z-index: 46 !important;
  touch-action: none !important;
  overscroll-behavior: contain !important;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.book-detail-page .alphabet-rail button,
.book-detail-page .alphabet-rail-v2 button {
  touch-action: none !important;
}

.book-detail-back-top {
  left: max(14px, env(safe-area-inset-left, 0px)) !important;
  bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 14px)) !important;
  z-index: 60 !important;
  width: 42px !important;
  height: 42px !important;
  border-radius: 999px !important;
  font-size: 24px !important;
}

@media (max-width: 520px) {
  .book-detail-page .book-title-block-v2,
  .book-detail-page .admin-search-strip {
    width: calc(100% - 42px) !important;
    max-width: calc(100% - 42px) !important;
    margin-right: 42px !important;
  }

  .book-detail-page .word-index-layout,
  .book-detail-page .word-index-layout-v2 {
    padding-right: 42px !important;
  }

  .book-detail-page .alphabet-rail,
  .book-detail-page .alphabet-rail-v2 {
    right: max(8px, env(safe-area-inset-right, 0px)) !important;
    top: max(94px, calc(env(safe-area-inset-top, 0px) + 94px)) !important;
  }
}

/* 2026-07 focus and background cleanup: remove cheap focus halos and color seams. */
*,
*::before,
*::after {
  -webkit-tap-highlight-color: transparent !important;
}

*:focus,
*:focus-visible,
*:focus-within {
  outline: none !important;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
button:focus-visible,
.admin-search-strip input:focus,
.admin-search-strip button:focus,
.book-detail-page button:focus,
.book-detail-page button:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(234, 223, 248, .86) !important;
  background: rgba(255, 255, 255, .9) !important;
}

.book-detail-page,
.book-detail-page-v2,
.book-detail-page .admin-search-strip,
.book-detail-page .word-index-layout,
.book-detail-page .word-index-layout-v2,
.book-detail-page .indexed-word-list {
  background: transparent !important;
  box-shadow: none !important;
}

.book-detail-page .admin-search-strip {
  border: 0 !important;
  padding: 0 !important;
  margin-top: 10px !important;
  margin-bottom: 14px !important;
}

.book-detail-page .admin-search-strip input,
.book-detail-page .admin-search-strip button {
  box-shadow: none !important;
}

/* 2026-07 admin surface unification: keep book list and book detail on the same backdrop. */
body.app-mode:not(.student-active),
body.app-mode:not(.student-active) .shell,
body.app-mode:not(.student-active) .app {
  background:
    radial-gradient(circle at 16% 4%, rgba(255, 167, 78, .16), transparent 30%),
    radial-gradient(circle at 88% 2%, rgba(236, 63, 157, .18), transparent 34%),
    linear-gradient(180deg, #ffe8ed 0%, #f8cbd5 48%, #f8cbd5 100%) fixed !important;
}

body.app-mode:not(.student-active) #content,
body.app-mode:not(.student-active) .admin-page,
body.app-mode:not(.student-active) .admin-page-v4,
body.app-mode:not(.student-active) .book-detail-page,
body.app-mode:not(.student-active) .book-detail-page-v2,
body.app-mode:not(.student-active) .teacher-page,
body.app-mode:not(.student-active) .teacher-page-simple {
  background: transparent !important;
}

body.app-mode:not(.student-active) #content::before,
body.app-mode:not(.student-active) #content::after,
body.app-mode:not(.student-active) .admin-page::before,
body.app-mode:not(.student-active) .admin-page::after,
body.app-mode:not(.student-active) .admin-page-v4::before,
body.app-mode:not(.student-active) .admin-page-v4::after,
body.app-mode:not(.student-active) .book-detail-page::before,
body.app-mode:not(.student-active) .book-detail-page::after {
  content: none !important;
  display: none !important;
}

/* 2026-07 admin home feature card: restore the content entry above management tiles. */
.admin-home-v5 {
  gap: clamp(14px, 3dvw, 20px) !important;
}

.admin-home-v5 .admin-home-feature {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: clamp(18px, 4dvw, 28px);
  min-height: clamp(224px, 34dvh, 292px) !important;
  width: 100%;
  margin: 0 0 clamp(8px, 1.8dvw, 12px) !important;
  padding: clamp(26px, 5.8dvw, 42px) !important;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: clamp(26px, 6dvw, 38px) !important;
  background:
    radial-gradient(circle at 100% 100%, rgba(255, 183, 73, .95), transparent 30%),
    radial-gradient(circle at 15% 0%, rgba(47, 130, 239, .42), transparent 38%),
    linear-gradient(135deg, #7446df 0%, #d43fb7 52%, #ff5a54 100%) !important;
  box-shadow: 0 24px 54px rgba(109, 63, 217, .20) !important;
  color: #fff;
  overflow: hidden;
  position: relative;
}

.admin-home-v5 .admin-home-feature::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .22), transparent 38%),
    radial-gradient(circle at 92% 8%, rgba(255, 255, 255, .18), transparent 20%);
  pointer-events: none;
}

.admin-home-feature-copy,
.admin-home-feature-actions {
  position: relative;
  z-index: 1;
}

.admin-home-feature-pill {
  display: inline-flex;
  align-items: center;
  min-height: clamp(38px, 7dvw, 50px);
  padding: 0 clamp(18px, 4dvw, 26px);
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  color: rgba(255, 255, 255, .96);
  font-size: clamp(15px, 3.7dvw, 22px);
  font-weight: 950;
  letter-spacing: 0;
  backdrop-filter: blur(10px);
}

.admin-home-feature h2 {
  margin: clamp(18px, 4dvw, 28px) 0 clamp(12px, 2.8dvw, 18px) !important;
  color: #fff;
  font-size: clamp(34px, 8dvw, 54px) !important;
  line-height: 1.06 !important;
  font-weight: 950;
}

.admin-home-feature p {
  max-width: 14em;
  margin: 0 !important;
  color: rgba(255, 255, 255, .82) !important;
  font-size: clamp(19px, 4.5dvw, 28px) !important;
  line-height: 1.52 !important;
  font-weight: 760;
}

.admin-home-v5 .admin-home-feature-action {
  justify-self: stretch;
  min-height: clamp(58px, 11dvw, 78px) !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, .94) !important;
  color: #6532d2 !important;
  box-shadow: 0 18px 34px rgba(73, 45, 139, .16) !important;
  font-size: clamp(20px, 4.8dvw, 30px) !important;
  font-weight: 950 !important;
}

.admin-home-feature-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.admin-home-v5 .admin-home-password-action {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

.admin-home-v5 .admin-home-password-action:hover {
  background: rgba(255, 255, 255, .22);
}

@media (min-width: 760px) {
  .admin-home-v5 .admin-home-feature {
    min-height: 230px !important;
    padding: 32px !important;
  }

  .admin-home-feature p {
    max-width: 24em;
  }

  .admin-home-feature-actions {
    grid-template-columns: minmax(0, 1fr) minmax(180px, .38fr);
    align-items: stretch;
  }
}

@media (max-height: 760px) {
  .admin-home-v5 .admin-home-feature {
    min-height: clamp(190px, 29dvh, 230px) !important;
    padding: clamp(22px, 4.8dvw, 32px) !important;
    gap: clamp(14px, 3dvw, 20px);
  }

  .admin-home-feature h2 {
    margin-top: 14px !important;
    margin-bottom: 8px !important;
  }
}

/* 2026-07 independent shadows: short per-card depth instead of one large haze. */
:root {
  --galaxy-shadow-panel: 0 7px 14px rgba(73, 45, 139, .075);
  --galaxy-shadow-card: 0 6px 12px rgba(73, 45, 139, .065);
  --galaxy-shadow-raised: 0 9px 18px rgba(73, 45, 139, .09);
  --galaxy-shadow-control: 0 4px 9px rgba(73, 45, 139, .055);
  --galaxy-border-soft: rgba(109, 63, 217, .12);
  --galaxy-border-panel: rgba(109, 63, 217, .16);
}

body.app-mode:not(.student-active) .topbar,
body.app-mode:not(.student-active) .admin-home-feature,
body.app-mode:not(.student-active) .book-title-block-v2,
body.app-mode:not(.student-active) .admin-panel,
body.app-mode:not(.student-active) .teacher-hero,
body.app-mode:not(.student-active) .student-board-head {
  border-color: var(--galaxy-border-panel) !important;
  box-shadow: var(--galaxy-shadow-panel) !important;
}

body.app-mode:not(.student-active) .admin-stat-card,
body.app-mode:not(.student-active) .admin-stat-card-v5,
body.app-mode:not(.student-active) .book-card-v4,
body.app-mode:not(.student-active) .account-row-v4,
body.app-mode:not(.student-active) .word-row-v2,
body.app-mode:not(.student-active) .teacher-student-name-card,
body.app-mode:not(.student-active) .teacher-review-card,
body.app-mode:not(.student-active) .teacher-book-choice,
body.app-mode:not(.student-active) .media-card,
body.app-mode:not(.student-active) .import-card-modern {
  border-color: var(--galaxy-border-soft) !important;
  box-shadow: var(--galaxy-shadow-card) !important;
}

body.app-mode:not(.student-active) .admin-home-feature-action,
body.app-mode:not(.student-active) .admin-title-actions-v4 .back-chip,
body.app-mode:not(.student-active) .admin-title-actions-v4 .add-account-btn,
body.app-mode:not(.student-active) .book-title-block-v2 .back-chip,
body.app-mode:not(.student-active) .book-title-block-v2 .import-chip,
body.app-mode:not(.student-active) .book-actions-v4 button,
body.app-mode:not(.student-active) .primary,
body.app-mode:not(.student-active) .ghost {
  border-color: rgba(109, 63, 217, .14) !important;
  box-shadow: var(--galaxy-shadow-control) !important;
}

body.app-mode:not(.student-active) .admin-search-strip input,
body.app-mode:not(.student-active) .admin-search-strip button {
  border-color: rgba(109, 63, 217, .12) !important;
  box-shadow: var(--galaxy-shadow-control) !important;
}

body.app-mode:not(.student-active) .alphabet-rail,
body.app-mode:not(.student-active) .alphabet-rail-v2,
body.app-mode:not(.student-active) .book-detail-back-top {
  box-shadow: var(--galaxy-shadow-raised) !important;
}

@media (hover: hover) {
  body.app-mode:not(.student-active) .admin-stat-grid-v5 .admin-stat-card-v5:hover,
  body.app-mode:not(.student-active) .book-card-v4:hover,
  body.app-mode:not(.student-active) .word-row-v2:hover {
    box-shadow: var(--galaxy-shadow-raised) !important;
  }
}

/* Lexigo APK release summary and update prompt. */
.admin-download-summary { margin-top: 16px; padding: 18px 20px; }
.admin-download-summary .admin-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-download-summary h3 { margin: 0; color: #211446; }
.admin-download-summary strong { color: #5b37aa; font-size: 28px; }
.admin-download-summary-grid { display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; color: #74698b; font-size: 13px; }
.lexigo-update-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: end center; padding: 18px; background: rgba(26, 17, 48, .28); }
.lexigo-update-sheet { width: min(420px, 100%); padding: 22px; border-radius: 8px; background: #fff; box-shadow: 0 18px 50px rgba(35, 19, 75, .24); }
.lexigo-update-sheet h2 { margin: 0; color: #211446; }
.lexigo-update-sheet p { margin: 8px 0 18px; color: #74698b; }
.lexigo-update-actions { display: flex; gap: 10px; justify-content: flex-end; }
.lexigo-update-actions button, .lexigo-update-actions a { border: 0; border-radius: 6px; padding: 10px 14px; font: inherit; text-decoration: none; cursor: pointer; }
.lexigo-update-actions button { background: #f1edf8; color: #5b37aa; }
.lexigo-update-actions a { background: #5b37aa; color: #fff; }

/* 2026-07 flat admin surfaces: remove panel edges and all panel shadows. */
body.app-mode:not(.student-active) .topbar,
body.app-mode:not(.student-active) .admin-home-feature,
body.app-mode:not(.student-active) .admin-stat-card,
body.app-mode:not(.student-active) .admin-stat-card-v5,
body.app-mode:not(.student-active) .book-card-v4,
body.app-mode:not(.student-active) .book-title-block-v2,
body.app-mode:not(.student-active) .account-row-v4,
body.app-mode:not(.student-active) .word-row-v2,
body.app-mode:not(.student-active) .admin-panel,
body.app-mode:not(.student-active) .teacher-hero,
body.app-mode:not(.student-active) .teacher-student-name-card,
body.app-mode:not(.student-active) .teacher-review-card,
body.app-mode:not(.student-active) .teacher-book-choice,
body.app-mode:not(.student-active) .media-card,
body.app-mode:not(.student-active) .import-card-modern,
body.app-mode:not(.student-active) .student-board-head,
body.app-mode:not(.student-active) .admin-search-strip input,
body.app-mode:not(.student-active) .admin-search-strip button,
body.app-mode:not(.student-active) .alphabet-rail,
body.app-mode:not(.student-active) .alphabet-rail-v2,
body.app-mode:not(.student-active) .book-detail-back-top {
  border: 0 !important;
  box-shadow: none !important;
}

body.app-mode:not(.student-active) button,
body.app-mode:not(.student-active) .primary,
body.app-mode:not(.student-active) .ghost,
body.app-mode:not(.student-active) .back-chip,
body.app-mode:not(.student-active) .import-chip,
body.app-mode:not(.student-active) .add-account-btn,
body.app-mode:not(.student-active) .admin-home-feature-action,
body.app-mode:not(.student-active) .book-actions-v4 button {
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .admin-home-feature::before {
  opacity: .55;
}

@media (hover: hover) {
  body.app-mode:not(.student-active) .admin-stat-grid-v5 .admin-stat-card-v5:hover,
  body.app-mode:not(.student-active) .book-card-v4:hover,
  body.app-mode:not(.student-active) .word-row-v2:hover {
    box-shadow: none !important;
  }
}

/* 2026-07 modal surface cleanup: secondary menus should sit on the same backdrop, without white shells or inner gaps. */
body.app-mode:not(.student-active) .admin-modal-backdrop {
  z-index: 120 !important;
  align-items: end;
  padding: 0 clamp(0px, 2.6dvw, 14px);
  background: rgba(54, 29, 72, .30) !important;
  backdrop-filter: blur(12px);
}

body.app-mode:not(.student-active):has(.admin-modal-backdrop) .alphabet-rail,
body.app-mode:not(.student-active):has(.admin-modal-backdrop) .alphabet-rail-v2 {
  display: none !important;
}

body.app-mode:not(.student-active) .admin-modal-sheet {
  width: min(100%, 680px) !important;
  max-height: min(88dvh, 900px) !important;
  padding: clamp(18px, 4.8dvw, 28px) clamp(16px, 4.2dvw, 26px) calc(var(--android-nav-safe, 18px) + 22px) !important;
  border: 0 !important;
  border-radius: clamp(28px, 8dvw, 42px) clamp(28px, 8dvw, 42px) 0 0 !important;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 173, 93, .18), transparent 30%),
    radial-gradient(circle at 92% 0%, rgba(236, 63, 157, .20), transparent 34%),
    linear-gradient(180deg, rgba(255, 232, 237, .98), rgba(248, 203, 213, .98)) !important;
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .admin-modal-head {
  margin: calc(clamp(18px, 4.8dvw, 28px) * -1) calc(clamp(16px, 4.2dvw, 26px) * -1) clamp(18px, 4dvw, 24px);
  padding: clamp(18px, 4.8dvw, 28px) clamp(16px, 4.2dvw, 26px) clamp(14px, 3.8dvw, 20px);
  border: 0 !important;
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 173, 93, .12), transparent 30%),
    radial-gradient(circle at 92% 0%, rgba(236, 63, 157, .15), transparent 34%),
    linear-gradient(180deg, rgba(255, 232, 237, .98), rgba(255, 232, 237, .88)) !important;
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .admin-modal-head h2 {
  min-width: 0;
  font-size: clamp(28px, 7dvw, 38px) !important;
  line-height: 1.16;
}

body.app-mode:not(.student-active) .modal-form {
  width: 100% !important;
  max-width: none !important;
  gap: clamp(16px, 4dvw, 22px) !important;
  padding-bottom: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .modal-form > *,
body.app-mode:not(.student-active) .import-guide-card,
body.app-mode:not(.student-active) .import-template-box,
body.app-mode:not(.student-active) .quick-import-box,
body.app-mode:not(.student-active) .notice,
body.app-mode:not(.student-active) .import-format,
body.app-mode:not(.student-active) .word-editor-modal .image-box,
body.app-mode:not(.student-active) .word-editor-modal .audio-box,
body.app-mode:not(.student-active) .word-editor-modal .structure-row,
body.app-mode:not(.student-active) .image-box,
body.app-mode:not(.student-active) .audio-box,
body.app-mode:not(.student-active) .structure-row,
body.app-mode:not(.student-active) .media-health-modal,
body.app-mode:not(.student-active) .teacher-recording-modal-v3,
body.app-mode:not(.student-active) .teacher-word-check-list,
body.app-mode:not(.student-active) .teacher-book-choice-grid {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .modal-form label,
body.app-mode:not(.student-active) .import-guide-card p,
body.app-mode:not(.student-active) .import-template-box code,
body.app-mode:not(.student-active) .quick-import-box summary {
  color: rgba(48, 35, 79, .72) !important;
}

body.app-mode:not(.student-active) .modal-form input,
body.app-mode:not(.student-active) .modal-form textarea,
body.app-mode:not(.student-active) .modal-form select,
body.app-mode:not(.student-active) .import-excel-modal input[type="file"] {
  border: 1px solid rgba(109, 63, 217, .13) !important;
  background: rgba(255, 255, 255, .42) !important;
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .modal-form input:focus,
body.app-mode:not(.student-active) .modal-form textarea:focus,
body.app-mode:not(.student-active) .modal-form select:focus {
  outline: 0 !important;
  border-color: rgba(109, 63, 217, .30) !important;
  background: rgba(255, 255, 255, .56) !important;
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .word-editor-modal .word-image-preview {
  background: rgba(255, 255, 255, .34) !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .delete-confirm-icon {
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .modal-close {
  background: rgba(255, 255, 255, .48) !important;
  border-color: rgba(109, 63, 217, .14) !important;
  box-shadow: none !important;
}

/* 2026-07 glass modal final: translucent secondary menus and locked base scroll. */
html:has(body.modal-open),
body.modal-open,
body.modal-open .shell,
body.modal-open .app {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.modal-open {
  touch-action: none;
}

body.modal-open .admin-modal-backdrop,
body.modal-open .admin-modal-sheet {
  touch-action: auto;
}

body.app-mode .admin-modal-backdrop {
  z-index: 140 !important;
  background: rgba(48, 30, 58, .22) !important;
  backdrop-filter: blur(16px) saturate(128%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(128%) !important;
}

body.app-mode .admin-modal-sheet {
  border: 0 !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 224, 232, .26)),
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, .22), transparent 34%),
    radial-gradient(circle at 94% 4%, rgba(236, 63, 157, .16), transparent 36%) !important;
  backdrop-filter: blur(26px) saturate(164%) !important;
  -webkit-backdrop-filter: blur(26px) saturate(164%) !important;
  box-shadow: none !important;
}

body.app-mode .admin-modal-head {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

body.app-mode .admin-modal-head::before,
body.app-mode .admin-modal-head::after {
  content: none !important;
  display: none !important;
}

body.app-mode .admin-modal-sheet .modal-form,
body.app-mode .admin-modal-sheet .modal-form > *,
body.app-mode .admin-modal-sheet .import-guide-card,
body.app-mode .admin-modal-sheet .import-template-box,
body.app-mode .admin-modal-sheet .quick-import-box,
body.app-mode .admin-modal-sheet .image-box,
body.app-mode .admin-modal-sheet .audio-box,
body.app-mode .admin-modal-sheet .structure-row {
  background: transparent !important;
  box-shadow: none !important;
}

body.app-mode .admin-modal-sheet input,
body.app-mode .admin-modal-sheet textarea,
body.app-mode .admin-modal-sheet select,
body.app-mode .admin-modal-sheet input[type="file"] {
  background: rgba(255, 255, 255, .34) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.galaxy-confirm-modal {
  justify-items: center;
  text-align: center;
  gap: 14px !important;
  padding: clamp(8px, 2dvw, 14px) 0 0 !important;
}

.galaxy-confirm-icon {
  width: clamp(54px, 13dvw, 72px);
  height: clamp(54px, 13dvw, 72px);
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(135deg, #347ef1, #6a38db 64%, #ec3f9d);
  color: #fff;
  font-size: clamp(24px, 6dvw, 34px);
  font-weight: 950;
}

.galaxy-confirm-modal h3 {
  margin: 0;
  color: #2f214e;
  font-size: clamp(22px, 5.8dvw, 32px);
  line-height: 1.2;
}

.galaxy-confirm-modal p {
  max-width: 24em;
  margin: 0 auto;
  color: rgba(48, 35, 79, .72);
  font-size: clamp(14px, 3.7dvw, 18px);
  line-height: 1.55;
}

.galaxy-confirm-modal .two-actions {
  margin-top: 6px;
}

/* 2026-07 hard override: force real glass sheets over older solid modal rules. */
body.app-mode:not(.student-active) .admin-modal-backdrop {
  background: rgba(33, 20, 44, .18) !important;
  backdrop-filter: blur(18px) saturate(135%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(135%) !important;
}

body.app-mode:not(.student-active) .admin-modal-sheet {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .20), rgba(255, 213, 226, .14)),
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, .16), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(236, 63, 157, .10), transparent 38%) !important;
  backdrop-filter: blur(30px) saturate(170%) !important;
  -webkit-backdrop-filter: blur(30px) saturate(170%) !important;
  box-shadow: none !important;
}

body.app-mode:not(.student-active) .admin-modal-head {
  margin: 0 0 clamp(18px, 4dvw, 24px) !important;
  padding: 0 0 clamp(14px, 3.8dvw, 18px) !important;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

body.app-mode:not(.student-active) .admin-modal-sheet input,
body.app-mode:not(.student-active) .admin-modal-sheet textarea,
body.app-mode:not(.student-active) .admin-modal-sheet select,
body.app-mode:not(.student-active) .admin-modal-sheet input[type="file"] {
  background: rgba(255, 255, 255, .58) !important;
}

body.modal-open #content,
body.modal-open .app,
body.modal-open .shell {
  overscroll-behavior: none !important;
}

/* Stage 1E: word-part feedback is paint-only so playback never moves or clips chunks. */
.lesson-part-v5 {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  transform: none !important;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.lesson-part-v5:active,
.lesson-part-v5.soft-blur {
  transform: none !important;
}

.lesson-position.soft-blur {
  color: transparent !important;
  text-shadow:
    0 0 12px rgba(109, 63, 217, .28),
    0 0 18px rgba(109, 63, 217, .18) !important;
  filter: blur(7px);
  transform: none !important;
  transition: none !important;
}

.lesson-part-v5.long-active {
  border-color: #facc15;
  background: #fff9d9;
  box-shadow:
    inset 0 0 0 2px rgba(250, 204, 21, .28),
    inset 0 -5px 12px rgba(250, 204, 21, .18) !important;
}

.lesson-part-v5.long-active::after {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 0;
  border-radius: 12px;
  background: radial-gradient(ellipse at center, rgba(255, 243, 150, .74), rgba(250, 204, 21, .18) 72%, transparent 100%);
  box-shadow:
    inset 0 0 14px 5px rgba(250, 204, 21, .36),
    inset 0 0 0 2px rgba(250, 204, 21, .26);
  pointer-events: none;
}

.lesson-part-v5 > span:not(.galaxy-interaction-ripple) {
  position: relative;
  z-index: 1;
}

/* Stage 1E continuation: approved Student home composition and GALAXY coin visual. */
.student-mode {
  --student-practice-shell-max-width: 440px;
  --student-practice-shell-radius: 34px;
  --student-practice-shell-background: #fff;
  --student-practice-shell-border: 1px solid rgba(109, 63, 217, .10);
}

.student-home-v6 {
  width: min(100%, var(--student-practice-shell-max-width));
  justify-self: center;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(14px, 2.4vh, 22px);
  padding: clamp(6px, 1.6vh, 14px) 0 2px !important;
}

.student-home-greeting {
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 12px 22px;
  border: 0;
  outline: 0;
  border-radius: 26px;
  background: linear-gradient(105deg, #dcd0ff 0%, #eadbff 47%, #ffe0c7 100%);
  color: #4a277f;
  font-size: 19px;
  font-weight: 900;
  text-align: center;
  box-shadow: none;
}

.student-home-practice-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 4vh, 34px);
  padding: clamp(34px, 6vh, 54px) clamp(24px, 8vw, 42px);
  border: var(--student-practice-shell-border);
  border-radius: var(--student-practice-shell-radius);
  background: var(--student-practice-shell-background);
  box-shadow: 0 12px 24px rgba(73, 45, 139, .14);
}

.student-home-progress {
  width: min(100%, 270px);
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.student-home-progress > span {
  color: #6e5a91;
  font-size: 16px;
  font-weight: 800;
}

.student-home-progress > strong {
  color: #35235f;
  font-size: 34px;
  line-height: 1;
}

.student-home-progress .progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #eee8f8;
  overflow: hidden;
}

.student-home-progress .bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8d68e8, #ec69aa);
}

.galaxy-coin-balance {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 16px 6px 8px;
  border: 1px solid #f8dc79;
  border-radius: 999px;
  background: #fff6c9;
  color: #8d5700;
  box-shadow: 0 10px 22px rgba(209, 143, 15, .16);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.galaxy-coin-balance:active {
  transform: translateY(1px) scale(.97);
}

.galaxy-coin-balance:focus-visible {
  outline: 3px solid rgba(109, 63, 217, .34);
  outline-offset: 3px;
}

.galaxy-coin-pop {
  position: fixed;
  z-index: 90;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  pointer-events: none;
  perspective: 280px;
  animation: galaxyCoinPop 620ms cubic-bezier(.2, .78, .28, 1) both;
  transform-origin: center;
  will-change: transform, opacity;
}

.galaxy-coin-pop > .galaxy-coin {
  width: 36px;
  height: 36px;
  backface-visibility: visible;
  transform-style: preserve-3d;
}

@keyframes galaxyCoinPop {
  0% { opacity: 1; transform: perspective(280px) translate3d(0, 0, 0) rotateY(0deg) scale(.78); }
  12.5% { transform: perspective(280px) translate3d(0, calc(var(--coin-pop-rise, -88px) * .08), 0) rotateY(90deg) scale(.88); }
  18% { opacity: 1; }
  25% { transform: perspective(280px) translate3d(0, calc(var(--coin-pop-rise, -88px) * .22), 0) rotateY(180deg) scale(.94); }
  37.5% { transform: perspective(280px) translate3d(0, calc(var(--coin-pop-rise, -88px) * .36), 0) rotateY(270deg) scale(.98); }
  50% { opacity: .94; transform: perspective(280px) translate3d(0, calc(var(--coin-pop-rise, -88px) * .5), 0) rotateY(360deg) scale(1); }
  62.5% { transform: perspective(280px) translate3d(0, calc(var(--coin-pop-rise, -88px) * .63), 0) rotateY(450deg) scale(1.02); }
  75% { opacity: .58; transform: perspective(280px) translate3d(0, calc(var(--coin-pop-rise, -88px) * .76), 0) rotateY(540deg) scale(1.03); }
  87.5% { transform: perspective(280px) translate3d(0, calc(var(--coin-pop-rise, -88px) * .9), 0) rotateY(630deg) scale(1.04); }
  100% { opacity: 0; transform: perspective(280px) translate3d(0, var(--coin-pop-rise, -88px), 0) rotateY(720deg) scale(1.05); }
}

.galaxy-coin-balance > strong {
  min-width: 1ch;
  font-size: 18px;
  line-height: 1;
}

.galaxy-coin-balance.compact {
  min-height: 38px;
  gap: 7px;
  padding: 4px 12px 4px 6px;
}

.galaxy-coin-balance.compact > .galaxy-coin {
  width: 27px;
  height: 27px;
}

.galaxy-coin-balance.compact > .galaxy-coin > span {
  font-size: 14px;
}

.galaxy-coin-balance.compact > strong {
  font-size: 16px;
}

.galaxy-coin {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid #d9850b;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff2a7 0 11%, #ffc844 36%, #f39a12 78%, #cf7205 100%);
  color: #884800;
  box-shadow:
    inset 0 0 0 3px rgba(255, 241, 156, .72),
    inset 0 -3px 5px rgba(154, 75, 0, .24),
    0 3px 7px rgba(180, 94, 0, .22);
}

.galaxy-coin > span {
  font: 900 17px/1 var(--ui-font);
  text-shadow: 0 1px 0 rgba(255, 239, 144, .8);
}

.float-star .reward-coin {
  width: 54px;
  height: 54px;
  border-width: 3px;
}

.float-star .reward-coin > span {
  font-size: 28px;
}

.galaxy-coin.nav-coin,
.galaxy-coin.inline-coin,
.galaxy-coin.pet-coin-bit {
  display: inline-grid;
  vertical-align: middle;
}

.galaxy-coin.nav-coin {
  width: 22px;
  height: 22px;
  border-width: 1px;
}

.galaxy-coin.nav-coin > span {
  font-size: 11px;
}

.galaxy-coin.inline-coin {
  width: 20px;
  height: 20px;
  margin-right: 3px;
  border-width: 1px;
}

.galaxy-coin.inline-coin > span {
  font-size: 10px;
}

.galaxy-coin.pet-coin-bit {
  width: 24px;
  height: 24px;
}

.galaxy-coin.pet-coin-bit > span {
  font-size: 12px;
}

.reward-balance-with-prefix {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #6b4b22;
  font-size: 13px;
  font-weight: 800;
}

.student-home-start-button {
  width: min(100%, 286px) !important;
  min-height: 58px;
  margin: 0;
  border-radius: 19px;
  background: linear-gradient(112deg, #7447dc 0%, #e637a0 52%, #ff942d 100%);
  font-size: 18px;
  box-shadow: 0 14px 28px rgba(226, 55, 147, .25), 0 6px 14px rgba(255, 148, 45, .20);
}

@media (max-width: 360px) {
  .student-mode {
    --student-practice-shell-radius: 28px;
  }

  .student-home-practice-card {
    gap: 20px;
    padding-inline: 20px;
  }

  .student-home-greeting {
    min-height: 58px;
    font-size: 18px;
  }
}

@media (max-height: 720px) {
  .student-home-v6 {
    gap: 10px;
    padding-top: 2px !important;
  }

  .student-home-greeting {
    min-height: 52px;
  }

  .student-home-practice-card {
    gap: 18px;
    padding-block: 24px;
  }
}

/* Stage 1E practice lifecycle correction: viewport, header and playback geometry. */
body.student-active,
body.student-active .shell,
.student-mode,
.student-mode #content {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.student-mode .student-shell,
.polished-student-shell {
  box-sizing: border-box;
  height: 100dvh;
  padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px));
}

.student-tabs.polished-tabs,
.student-tabs {
  position: fixed;
  z-index: 40;
  inset: auto 0 0;
  box-sizing: border-box;
  height: calc(54px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  padding: 4px 10px max(4px, env(safe-area-inset-bottom, 0px));
}

.lesson-progress-head-v5 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.lesson-progress-head-v5 .lesson-progress-strip {
  width: 100%;
  min-width: 0;
  grid-template-columns: auto minmax(max-content, 1fr) auto;
  padding-inline: clamp(8px, 2.5vw, 12px);
  gap: clamp(5px, 1.7vw, 8px);
}

.lesson-progress-head-v5 .lesson-progress-strip span {
  overflow: visible;
  text-overflow: clip;
  font-size: clamp(11px, 3.1vw, 13px);
}

.practice-coin-target {
  min-width: max-content;
  justify-self: end;
}

.student-mode .audio-glow,
.student-mode .audio-glow-soft,
.student-mode .audio-text-glow,
.lesson-part-v5.long-active,
.lesson-part-v5 .letter-hot {
  animation: none !important;
  transform: none !important;
}

.student-mode .audio-glow {
  box-shadow:
    inset 0 0 0 4px rgba(250, 204, 21, .34),
    inset 0 0 28px 4px rgba(250, 204, 21, .48) !important;
}

.student-mode .audio-glow-soft {
  box-shadow:
    inset 0 0 0 3px rgba(250, 204, 21, .18),
    inset 0 0 24px 3px rgba(250, 204, 21, .24) !important;
}

.lesson-bank button,
.letter-bank button {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 0;
  line-height: 1;
  text-align: center;
}

.lesson-bank button > span,
.letter-bank button > span {
  display: block;
  line-height: 1;
}

@media (max-width: 360px) {
  .lesson-progress-head-v5 {
    gap: 6px;
  }

  .lesson-progress-head-v5 .lesson-progress-strip {
    padding-inline: 7px;
    gap: 5px;
  }

  .lesson-progress-head-v5 .lesson-progress-strip b {
    font-size: 18px;
  }

  .lesson-progress-head-v5 .lesson-progress-strip span,
  .lesson-progress-head-v5 .lesson-progress-strip small {
    font-size: 11px;
  }
}

/* Stage 1E real-device feedback: one viewport contract, equal header cells, and stable practice slots. */
.student-mode .student-shell,
.polished-student-shell {
  --student-nav-height: 64px;
  padding-bottom: calc(var(--student-nav-height) + env(safe-area-inset-bottom, 0px));
  background: var(--app-shared-background) !important;
}

body.student-active {
  background: var(--app-shared-background);
}

.student-slider,
.student-slider-single {
  height: calc(100dvh - var(--student-nav-height, 64px) - env(safe-area-inset-bottom, 0px)) !important;
}

.student-mode .student-slider,
.student-mode .student-screen,
.student-mode .practice-board-v5 {
  background: var(--app-shared-background);
}

/* The direct paint layer behind both approved white cards is identical. */
.student-mode .student-home-v6,
.student-mode .practice-board-v5 {
  background: var(--app-shared-background) !important;
  filter: none !important;
}

.student-tabs.polished-tabs,
.student-tabs {
  height: calc(var(--student-nav-height, 64px) + env(safe-area-inset-bottom, 0px));
  padding: 4px 10px max(4px, env(safe-area-inset-bottom, 0px));
  border: 0;
  border-radius: 0;
  background: var(--app-shared-background);
  box-shadow: none;
}

.student-tabs button {
  min-height: 52px;
  gap: 1px;
}

.student-tabs span {
  width: 30px;
  height: 30px;
}

.student-tabs svg {
  width: 28px;
  height: 28px;
}

.student-tabs b {
  font-size: 15px;
  line-height: 1;
}

.student-home-practice-card {
  gap: clamp(16px, 2.5vh, 24px);
}

.student-home-reader-count {
  margin: -8px 0 -2px;
  color: #6e5a91;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.lesson-progress-head-v5 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
}

.practice-status-box {
  box-sizing: border-box;
  min-width: 0;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid rgba(234, 220, 255, .95);
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  color: #563197;
  font-size: clamp(16px, 4.3vw, 19px);
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  filter: none;
}

.practice-coin-target {
  box-sizing: border-box;
  min-width: 0;
  height: 52px;
  display: grid;
  place-items: stretch;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  justify-self: stretch;
}

.practice-coin-target .galaxy-coin-balance {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 52px;
  min-height: 52px;
  margin: 0;
  border-radius: 18px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
}

.student-mode .lesson-stage-v5,
.lesson-stage-v5 {
  width: 100%;
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 72px;
  align-content: stretch;
  gap: 8px;
  border: var(--student-practice-shell-border);
  border-radius: var(--student-practice-shell-radius);
  background: var(--student-practice-shell-background);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
  overflow: visible;
}

.student-mode .practice-board-v5,
.practice-board-v5 {
  width: min(100%, var(--student-practice-shell-max-width));
  height: 100%;
  justify-self: center;
  grid-template-rows: 52px minmax(0, 1fr);
  align-items: stretch;
  align-content: stretch;
}

/* Stage 1E account-action parity and restrained logout bottom sheet. */
.profile-actions-v5 .student-account-action,
.profile-actions-v5 .student-account-action:last-child {
  background: var(--primary) !important;
  color: #fff !important;
}

.logout-modal-backdrop {
  align-items: end !important;
  animation: logoutBackdropEnter 260ms ease-out both;
}

.logout-modal-sheet {
  width: min(100%, 560px) !important;
  margin: 0 auto !important;
  border-radius: 28px 28px 0 0 !important;
  animation: logoutSheetEnter 260ms ease-out both;
}

.logout-modal-sheet .admin-modal-head {
  justify-content: center;
  text-align: center;
}

.student-display-name-modal-backdrop {
  align-items: end !important;
}

.student-display-name-modal-sheet {
  width: min(100%, 480px) !important;
  max-height: min(58dvh, 420px) !important;
  margin: 0 auto !important;
  border-radius: 28px 28px 0 0 !important;
}

.student-display-name-modal-sheet .admin-modal-head {
  position: static;
  justify-content: center;
  text-align: center;
}

.student-display-name-editor {
  gap: 14px;
}

.student-display-name-field {
  display: grid;
  gap: 8px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 850;
}

.student-display-name-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 0 14px;
  color: var(--text-main);
  font-size: 16px;
}

.display-name-editor-actions button {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  border: 0;
  border-radius: 17px;
  font: inherit;
  font-weight: 900;
}

.student-display-name-cancel {
  background: #f1edf7;
  color: #47385f;
}

.student-display-name-save {
  background: var(--primary);
  color: #fff;
}

.logout-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
}

.logout-actions .logout-action {
  box-sizing: border-box;
  width: 100%;
  height: 52px;
  min-width: 0;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.logout-actions .logout-cancel-action {
  background: #f1edf7;
  color: #47385f;
}

.logout-actions .logout-confirm-action {
  background: #dc2626 !important;
  color: #fff !important;
}

.logout-actions .logout-confirm-action:active {
  background: #b91c1c !important;
}

@keyframes logoutSheetEnter {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

/* One motion authority for every Student secondary sheet. */
.student-secondary-modal-backdrop {
  align-items: end !important;
  animation: studentSecondaryBackdropEnter 260ms ease-out both;
}

.student-secondary-modal-sheet {
  margin-bottom: 0;
  animation: studentSecondarySheetEnter 260ms cubic-bezier(.2, .78, .28, 1) both;
}

.student-secondary-modal-backdrop.is-exiting {
  animation: studentSecondaryBackdropExit 240ms ease-in both;
  pointer-events: none;
}

.student-secondary-modal-backdrop.is-exiting .student-secondary-modal-sheet {
  animation: studentSecondarySheetExit 240ms cubic-bezier(.55, .06, .68, .19) both;
}

@keyframes studentSecondarySheetEnter {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes studentSecondarySheetExit {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

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

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

@media (prefers-reduced-motion: reduce) {
  .galaxy-coin-pop {
    animation-duration: 1ms !important;
    transform: translateY(-18px);
  }

  .logout-modal-backdrop,
  .logout-modal-sheet,
  .student-secondary-modal-backdrop,
  .student-secondary-modal-sheet {
    animation-duration: 1ms !important;
  }
}

.lesson-stage-v5 > .lesson-media-v5 {
  height: 100%;
  align-self: stretch;
}

.lesson-media-v5 {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(132px, 1fr) 66px 76px;
  align-content: stretch;
  gap: clamp(5px, .9vh, 8px);
  overflow: hidden;
}

.practice-slot {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.practice-image-slot,
.practice-word-slot,
.practice-decomposition-slot,
.practice-interaction-slot {
  display: grid;
  place-items: center;
  overflow: hidden;
}

.practice-decomposition-slot {
  overflow: visible;
}

.practice-image-slot img,
.practice-image-slot .word-visual {
  width: min(54vw, 220px);
  height: min(100%, 170px);
  max-height: 100%;
  object-fit: contain;
}

.practice-word-slot {
  align-content: center;
  gap: 2px;
}

.practice-word-slot h1 {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

.practice-word-slot p {
  margin: 0;
}

.practice-decomposition-slot .lesson-structures-v5 {
  max-height: 100%;
}

.practice-interaction-slot {
  height: 100%;
  align-self: stretch;
  align-content: center;
  overflow: visible;
}

.practice-interaction-slot .lesson-bank,
.practice-interaction-slot .letter-bank {
  margin: 0;
}

.practice-record-slot {
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  align-content: center;
  gap: 0;
}

.practice-record-button.primary.inline {
  box-sizing: border-box;
  width: min(100%, 286px);
  min-height: 58px;
  margin: 0;
  padding: 12px 28px;
  border: 0;
  border-radius: 19px;
  background: linear-gradient(112deg, #7447dc 0%, #e637a0 52%, #ff942d 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .28),
    inset 0 -2px 0 rgba(111, 37, 126, .16);
}

.lesson-bank button,
.letter-bank button {
  border-color: #d8c8f4;
  background: linear-gradient(180deg, #ffffff 0%, #fbf7ff 58%, #efe6ff 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -3px 0 rgba(109, 63, 217, .12) !important;
}

.lesson-bank button:active,
.letter-bank button:active {
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -3px 0 rgba(109, 63, 217, .12) !important;
}

@media (max-width: 360px) {
  .lesson-progress-head-v5 {
    gap: 6px;
  }

  .practice-status-box {
    height: 50px;
    padding-inline: 4px;
    border-radius: 16px;
  }

  .practice-coin-target,
  .practice-coin-target .galaxy-coin-balance {
    height: 50px;
    min-height: 50px;
  }

  .practice-coin-target .galaxy-coin-balance {
    border-radius: 16px;
  }

  .lesson-media-v5 {
    grid-template-rows: minmax(120px, 1fr) 62px 70px;
  }
}

/* Stage 1E effective Student page paint authority: every outer layer resolves identically. */
html:has(body.student-active),
body.student-active,
body.student-active .shell,
body.student-active .app.student-mode,
.student-mode #content,
.student-mode .student-shell,
.student-mode .student-slider,
.student-mode .student-screen,
.student-mode .student-board,
.student-mode .student-tabs {
  background: var(--app-shared-background) !important;
  background-attachment: fixed !important;
  background-position: center top !important;
  background-repeat: no-repeat !important;
  background-size: 100vw 100dvh !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html:has(body.student-active)::before,
html:has(body.student-active)::after,
body.student-active::before,
body.student-active::after,
body.student-active .shell::before,
body.student-active .shell::after,
body.student-active .app.student-mode::before,
body.student-active .app.student-mode::after,
.student-mode #content::before,
.student-mode #content::after,
.student-mode .student-shell::before,
.student-mode .student-shell::after,
.student-mode .student-slider::before,
.student-mode .student-slider::after,
.student-mode .student-screen::before,
.student-mode .student-screen::after,
.student-mode .student-board::before,
.student-mode .student-board::after,
.student-mode .student-tabs::before,
.student-mode .student-tabs::after {
  content: none !important;
  background: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Stage 1E Student identity headers and leaderboard shadow paint room. */
.student-mode .student-identity-header {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.student-mode .student-identity-header > * {
  min-width: 0;
}

.student-mode .student-display-name-primary {
  max-width: 100%;
  margin: 0;
  color: var(--text-main);
  font-size: clamp(26px, 7vw, 31px);
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.leaderboard-rank-list-v6 {
  box-sizing: border-box;
  width: calc(100% + 24px);
  margin-inline: -12px;
  padding: 10px 12px 14px;
  overflow-x: hidden;
  overflow-y: auto;
}

.rank-row-shadow-wrap {
  min-width: 0;
  overflow: visible;
}

.rank-row-shadow-wrap .rank-row {
  width: 100%;
  box-sizing: border-box;
}

.profile-actions-v5 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.profile-actions-v5 .student-account-action,
.profile-actions-v5 .student-account-action:last-child {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 6px;
  border-radius: 18px;
  font-size: clamp(12px, 3.45vw, 15px);
  line-height: 1.15;
  white-space: nowrap;
}

.student-tabs button.active {
  background: var(--student-nav-selected-surface) !important;
  color: #4c258b !important;
  box-shadow: inset 0 0 0 1px rgba(109, 63, 217, .18) !important;
}
.student-tabs button.active span { color: inherit; }

/* Keep the shared authenticated rail compact while retaining safe-area clearance. */
.student-mode .student-screen {
  padding-inline:
    max(var(--mobile-content-gutter), env(safe-area-inset-left, 0px))
    max(var(--mobile-content-gutter), env(safe-area-inset-right, 0px));
  padding-bottom: 28px;
}
.student-mode .student-shell, .polished-student-shell { --student-nav-height: 64px; }
.student-tabs.polished-tabs, .student-tabs {
  padding-inline: 16px;
  padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
  transform: none;
}
.leaderboard-rank-list-v6 { width: calc(100% + 44px); margin-inline: -22px; padding: 10px 22px 38px; }

/* Stage 1E final polish: the slider already terminates at the navigation seam. */
.student-mode .student-screen {
  padding-bottom: 18px;
  overflow: visible;
}

.student-mode .student-slider,
.student-mode .student-slider-single {
  overflow: visible;
}

/* Shared, paint-only tactile feedback for Student and login controls. */
.galaxy-feedback-control {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transform-origin: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms cubic-bezier(.2, .8, .2, 1), box-shadow 140ms cubic-bezier(.2, .8, .2, 1);
}

.galaxy-feedback-control.galaxy-pressing {
  transform: scale(.975);
}

.lesson-part-v5.galaxy-feedback-control.galaxy-pressing {
  transform: none !important;
  box-shadow: inset 0 0 0 2px rgba(109, 63, 217, .14);
}

.galaxy-interaction-ripple {
  position: absolute;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  pointer-events: none;
  background: rgba(255, 255, 255, .52);
  transform: translate(-50%, -50%) scale(0);
  animation: galaxyInteractionRipple 440ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes galaxyInteractionRipple {
  0% { opacity: .68; transform: translate(-50%, -50%) scale(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(16); }
}

/* Practice content renders immediately; this only animates its first painted frame. */
.practice-page-entering {
  animation: studentPracticeEnter 200ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes studentPracticeEnter {
  from { opacity: .35; transform: translateX(8px) scale(.992); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.galaxy-coin-balance.galaxy-coin-bursting {
  animation: galaxyCoinFrameBurst 360ms cubic-bezier(.2, .8, .2, 1) both;
}

.galaxy-coin-burst {
  position: fixed;
  z-index: 90;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.galaxy-coin-burst > i {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f6b922;
  box-shadow: 0 0 0 2px rgba(255, 246, 190, .88);
  transform: rotate(var(--burst-angle)) translateY(-3px) scale(.4);
  animation: galaxyCoinBurst 560ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes galaxyCoinFrameBurst {
  0%, 100% { transform: scale(1); }
  36% { transform: scale(1.075); }
}

@keyframes galaxyCoinBurst {
  0% { opacity: 1; transform: rotate(var(--burst-angle)) translateY(-3px) scale(.4); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--burst-angle)) translateY(-28px) scale(.85); }
}

@media (prefers-reduced-motion: reduce) {
  .galaxy-feedback-control,
  .galaxy-feedback-control.galaxy-pressing,
  .lesson-part-v5.galaxy-feedback-control.galaxy-pressing,
  .practice-page-entering,
  .galaxy-coin-balance.galaxy-coin-bursting {
    animation: none !important;
    transform: none !important;
    transition: none !important;
  }

  .galaxy-interaction-ripple,
  .galaxy-coin-burst {
    display: none;
  }
}

/* Stage 1E-A4.5: stable word masking, tactile letters, handwriting, and glass navigation. */
.student-mode {
  --student-handwritten-font: var(--ui-font);
  font-family: var(--student-handwritten-font);
}

/* Stage 1E-ADMIN-REPAIR-2.1: keep editor content in one predictable scroll flow. */
body.app-mode:not(.student-active) .admin-modal-sheet {
  max-height: calc(100dvh - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 72px;
}
body.app-mode:not(.student-active) .admin-modal-head {
  top: -1px;
  padding-top: 4px !important;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.72)) !important;
}
.teacher-page-v5 { gap: 8px; }
.teacher-page-v5 .section { padding: 14px; }
.teacher-page-v5 .teacher-student-grid { gap: 8px; }
.teacher-page-v5 .teacher-review-list-v3 { gap: 8px; }

.student-mode button,
.student-mode input,
.student-mode select,
.student-mode textarea,
.student-mode .practice-word-slot,
.student-mode .lesson-position,
.student-mode .letter-bank,
.student-mode .student-tabs {
  font-family: var(--student-handwritten-font);
}

.practice-word-slot .lesson-word-control {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  width: min(100%, 320px);
  min-height: 48px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0 8px;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-family: var(--student-handwritten-font);
  font-size: clamp(26px, 8vw, 42px);
  font-weight: 900;
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-align: center;
  transform: none !important;
}

.practice-word-slot .lesson-word-control:active {
  transform: none !important;
}

.practice-word-slot .lesson-word-control:focus-visible {
  outline: 3px solid rgba(109, 63, 217, .48);
  outline-offset: 3px;
}

.practice-word-slot .lesson-word-control .masked-word-text {
  position: relative;
  z-index: 0;
  display: block;
  font: inherit;
  line-height: inherit;
}

.practice-word-slot .lesson-word-control .word-mask {
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
  background: #e4d5fa;
  pointer-events: none;
}

.practice-interaction-slot,
.practice-interaction-slot .lesson-bank,
.practice-interaction-slot .letter-bank {
  overflow: visible;
}

.practice-interaction-slot .lesson-bank button,
.practice-interaction-slot .letter-bank button {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -3px 0 rgba(109, 63, 217, .12),
    0 5px 0 rgba(142, 111, 207, .34),
    0 9px 15px rgba(73, 45, 139, .18) !important;
  transition: transform 160ms cubic-bezier(.22, .72, .2, 1), box-shadow 160ms cubic-bezier(.22, .72, .2, 1), border-color 160ms ease;
}

.practice-interaction-slot .lesson-bank button:active,
.practice-interaction-slot .letter-bank button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -2px 0 rgba(109, 63, 217, .12),
    0 2px 0 rgba(142, 111, 207, .34),
    0 4px 8px rgba(73, 45, 139, .14) !important;
}

.student-mode .letter-bank button.letter-slot-empty {
  visibility: hidden;
  pointer-events: none;
}

/* Keep the compact mobile composition, but give desktop browsers a readable
   centered learning surface and room for its projected paint. */
@media (min-width: 721px) {
  .student-mode {
    --student-practice-shell-max-width: min(720px, calc(100vw - 64px));
  }

  .student-mode #content,
  .student-mode .student-shell,
  .student-mode .student-screen {
    overflow: visible;
  }

  .student-mode .student-screen {
    padding-inline: 24px;
  }

  .student-mode .practice-board-v5 {
    padding-bottom: 0;
  }

  .student-mode .lesson-stage-v5 {
    max-height: none !important;
  }

  .student-mode .practice-stage.lesson-stage-v5 {
    max-height: none !important;
  }

  body.auth-mode .login {
    overflow: visible;
  }
}

@media (min-width: 721px) and (max-height: 700px) {
  body.auth-mode .login {
    /* Keep the low-height scroll rail wider than the panel so its lift shadow
       remains inside the horizontal paint area at both lower corners. */
    width: 632px;
    max-width: calc(100vw - 32px);
    padding-inline: 86px;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

.student-mode .student-tabs.polished-tabs,
.student-mode .student-tabs {
  position: fixed;
  isolation: isolate;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, .76) !important;
  background: rgba(250, 246, 255, .68) !important;
  box-shadow: 0 -12px 28px rgba(73, 45, 139, .12) !important;
  backdrop-filter: blur(18px) saturate(145%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(145%) !important;
}

.student-mode .student-tab-highlight {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: max(4px, env(safe-area-inset-bottom, 0px));
  left: 10px;
  width: calc(25% - 5px);
  border-radius: 16px;
  background: var(--student-nav-selected-surface) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .68), 0 5px 14px rgba(109, 63, 217, .15);
  transition: left 220ms cubic-bezier(.22, .72, .2, 1);
  pointer-events: none;
}

.student-mode .student-tabs button {
  position: relative;
  z-index: 1;
  background: transparent !important;
  box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .practice-interaction-slot .lesson-bank button,
  .practice-interaction-slot .letter-bank button,
  .student-mode .student-tab-highlight {
    transition-duration: 1ms;
  }
}
/* Stage 1E Admin/Teacher consistency polish */
body.app-mode:not(.student-active){background:radial-gradient(circle at 15% 0%,#f4efff 0,#fbfaff 42%,#f6f8ff 100%)}
body.app-mode:not(.student-active) .topbar{position:sticky;top:0;z-index:30}
.admin-modal-backdrop{opacity:0;transition:opacity .18s ease}.admin-modal-sheet{transform:translateY(10px);transition:transform .18s ease,opacity .18s ease}body.modal-open .admin-modal-backdrop{opacity:1}body.modal-open .admin-modal-sheet{transform:translateY(0)}
.admin-page button,.teacher-page button{min-height:40px}.word-entry-image{width:42px;height:42px;border-radius:12px;object-fit:cover;flex:0 0 42px;box-shadow:0 4px 12px rgba(73,45,139,.12)}
.word-index-layout,.word-index-layout-v2{grid-template-columns:minmax(0,1fr) 48px!important;gap:16px!important}.alphabet-rail,.alphabet-rail-v2{width:44px!important;padding-inline:5px!important}.alphabet-rail button,.alphabet-rail-v2 button{width:34px!important;min-height:28px!important;font-size:12px!important}
.double-back-toast{position:fixed;left:50%;bottom:24px;z-index:100;transform:translate(-50%,12px);opacity:0;pointer-events:none;padding:10px 16px;border-radius:999px;color:#fff;background:rgba(40,31,73,.9);box-shadow:0 8px 24px rgba(40,31,73,.22);transition:opacity .18s ease,transform .18s ease}.double-back-toast.visible{opacity:1;transform:translate(-50%,0)}
@media(max-width:560px){.admin-page button,.teacher-page button{min-height:44px}.word-index-layout,.word-index-layout-v2{grid-template-columns:minmax(0,1fr) 44px!important;gap:10px!important}}

/* Stage 1E-ADMIN-REPAIR-2.3: scoped management surfaces, one scroll owner. */
body.app-mode:not(.student-active) {
  --management-header-clearance: 100px;
  --management-shell-width: 780px;
  --management-gutter: clamp(12px, 3.2dvw, 24px);
  background: var(--app-shared-background) !important;
  background-attachment: fixed !important;
  background-position: center top !important;
  background-size: 100vw 100dvh !important;
  background-repeat: no-repeat !important;
  overflow: visible !important;
}
html:has(body.app-mode:not(.student-active)) { overflow-x: clip; }
body.app-mode:not(.student-active) .shell,
body.app-mode:not(.student-active) .app {
  background: transparent !important;
  /* Do not create a new sticky containing scroller when a modal opens. */
  overflow: visible !important;
}
body.app-mode:not(.student-active) #content { overflow: visible; }
body.app-mode:not(.student-active) .topbar {
  flex: 0 0 auto;
  top: max(10px, env(safe-area-inset-top, 0px)) !important;
}
body.app-mode:not(.student-active) .topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}
body.app-mode:not(.student-active) #roleSub:empty { display: none; }
.management-title-actions { display: flex; gap: 8px; justify-content: flex-end; }
body.app-mode:not(.student-active) :is(.management-title-actions, .teacher-hero-v5 .actions) button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
  min-width: 88px;
  min-height: 44px !important;
  height: 44px;
  margin: 0;
  padding: 0 12px !important;
  border: 1px solid var(--line) !important;
  border-radius: 16px !important;
  line-height: 1.2;
  font-size: 14px !important;
  white-space: nowrap;
  transform: none !important;
}
body.app-mode:not(.student-active) :is(.admin-page, .admin-modal-sheet, .teacher-page) button:not(.alphabet-rail button):not(.book-cover) {
  min-height: 44px;
  line-height: 1.2;
}
body.app-mode:not(.student-active) .admin-home-feature-actions { grid-template-columns: minmax(0, 1fr); }
body.app-mode:not(.student-active) .book-cover-v4 {
  /* Scaling the cover reveals the white card underneath; darken in place. */
  transform: none !important;
  -webkit-tap-highlight-color: transparent;
  transition: filter 140ms ease;
}
body.app-mode:not(.student-active) .book-cover-v4:active { filter: brightness(.94); }
body.app-mode:not(.student-active) .book-cover-v4:focus-visible { outline: 3px solid var(--ink) !important; outline-offset: -4px; }
body.app-mode:not(.student-active) .book-entry-loading {
  min-height: 180px;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 16px;
}
body.app-mode:not(.student-active) .book-detail-page :is(.book-title-block-v2, .admin-search-strip) {
  width: calc(100% - 54px) !important;
  max-width: calc(100% - 54px) !important;
  margin-right: 54px !important;
}
body.app-mode:not(.student-active) .book-detail-page .book-title-block-v2 { position: static; }
body.app-mode:not(.student-active) .book-detail-page .word-index-layout {
  padding-right: 0 !important;
  grid-template-columns: minmax(0, 1fr) 44px !important;
  gap: 10px !important;
  align-items: start;
}
body.app-mode:not(.student-active) .book-detail-page .alphabet-rail {
  position: fixed !important;
  top: var(--management-header-clearance) !important;
  right: max(var(--management-gutter), calc((100vw - var(--management-shell-width)) / 2 + var(--management-gutter))) !important;
  bottom: auto !important;
  height: calc(100dvh - var(--management-header-clearance) - 20px - env(safe-area-inset-bottom, 0px)) !important;
  grid-template-rows: repeat(26, minmax(0, 1fr));
  padding: 6px 5px !important;
}
body.app-mode:not(.student-active) .book-detail-page .alphabet-rail button {
  min-height: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
}
body.app-mode:not(.student-active) .word-row-v2 { scroll-margin-top: var(--management-header-clearance); }

/* The sheet owns its header; only the body scrolls, including editor actions. */
body.app-mode:not(.student-active) .admin-modal-sheet {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px));
}
body.app-mode:not(.student-active) .admin-modal-head {
  position: static;
  flex: 0 0 auto;
  min-width: 0;
  margin: 0 0 12px !important;
  padding: 0 !important;
  background: transparent !important;
}
body.app-mode:not(.student-active) .admin-modal-head h2 {
  min-width: 0;
  font-size: 24px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
body.app-mode:not(.student-active) .admin-modal-head .modal-close { flex-shrink: 0; }
body.app-mode:not(.student-active) .admin-modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 2px;
}
body.app-mode:not(.student-active) .admin-modal-body .modal-form {
  max-height: none;
  overflow: visible;
  padding: 0 !important;
}
body.app-mode:not(.student-active) #change-password-submit {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #dc2626 !important;
}
body.app-mode:not(.student-active) .teacher-recording-filterbar {
  flex-wrap: wrap;
  overflow: visible;
  gap: 8px;
  padding: 0 0 12px;
}
body.app-mode:not(.student-active) .teacher-recording-filterbar button {
  white-space: nowrap;
  padding: 0 12px;
}
body.app-mode:not(.student-active) .teacher-page-v5 { padding-top: 0; gap: 12px; }
body.app-mode:not(.student-active) .teacher-page-v5 > .section {
  margin: 0;
  padding: 12px !important;
  gap: 12px;
}
body.app-mode:not(.student-active) .teacher-hero-v5 { gap: 12px; min-height: 68px; }
body.app-mode:not(.student-active) .teacher-hero-v5 > div:first-child { min-width: 0; }
body.app-mode:not(.student-active) .teacher-hero-v5 h2 { font-size: 24px; line-height: 1.2; overflow-wrap: anywhere; }
body.app-mode:not(.student-active) .teacher-page-v5 .section-title-row { margin: 0; gap: 12px; }
body.app-mode:not(.student-active) .teacher-page-v5 .section-title-row h2 { margin: 0; font-size: 20px; }
body.app-mode:not(.student-active) .teacher-review-card > span { display: grid; gap: 4px; min-width: 0; text-align: left; }
body.app-mode:not(.student-active) .teacher-review-card small { line-height: 1.4; }
body.app-mode:not(.student-active) .teacher-review-card { gap: 12px; }
body.app-mode:not(.student-active) .teacher-recording-row[hidden] { display: none !important; }
@media (min-width: 860px) {
  body.app-mode:not(.student-active) { --management-shell-width: 820px; }
}
@media (max-width: 520px) {
  body.app-mode:not(.student-active) { --management-gutter: 14px; }
}
@media (max-width: 560px) {
  body.app-mode:not(.student-active) { --management-header-clearance: 132px; }
  body.app-mode:not(.student-active) .topbar { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  body.app-mode:not(.student-active) .topbar h1 { font-size: 22px; }
  body.app-mode:not(.student-active) .teacher-hero-v5 { flex-direction: column; align-items: stretch; gap: 8px; }
  body.app-mode:not(.student-active) .teacher-hero-v5 .actions { justify-content: flex-end; }
  body.app-mode:not(.student-active) .teacher-recording-row { flex-wrap: wrap; gap: 10px; }
  body.app-mode:not(.student-active) .teacher-recording-actions { flex-wrap: wrap; }
}
@media (max-height: 620px) {
  body.app-mode:not(.student-active) .book-detail-page .alphabet-rail {
    /* Short screens scroll the index instead of compressing letter glyphs. */
    grid-template-rows: repeat(26, 28px);
    overflow-y: auto !important;
    scrollbar-width: thin;
    touch-action: pan-y !important;
  }
  body.app-mode:not(.student-active) .book-detail-page .alphabet-rail button {
    touch-action: pan-y !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.app-mode:not(.student-active) :is(.book-cover-v4, .admin-modal-backdrop, .admin-modal-sheet) { transition: none; }
}
/* Stage 1E Admin/Teacher nested layout refinement */
/* Empty account validation feedback must not reserve a blank grid row. */
/* Account editors need room for the reset control and all three footer actions. */
body.app-mode:not(.student-active) .admin-modal-sheet:has(.account-editor-form) {
  max-height: min(960px, calc(100dvh - 16px - env(safe-area-inset-top, 0px))) !important;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)) !important;
}
body.app-mode:not(.student-active) .admin-modal-body:has(.account-editor-form) {
  padding-bottom: 12px;
  scroll-padding-bottom: 12px;
}
body.app-mode:not(.student-active) .modal-form > .message[id^="account-edit-message-"]:empty {
  display: none;
}
body.app-mode:not(.student-active) .modal-form > .message[id^="account-edit-message-"] + .actions {
  margin-top: 0;
}
body.app-mode:not(.student-active) .admin-modal-sheet.management-modal-motion {
  box-sizing: border-box;
  animation: none !important;
  transition: none !important;
}
.topbar { display:flex; align-items:center; justify-content:space-between; gap:16px; min-width:0; }
.topbar > div:first-child { min-width:0; }
.topbar h1, .topbar p { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.management-title-actions { flex:0 0 auto; display:flex; align-items:center; gap:8px; }
.admin-home-topbar { width:100%; box-sizing:border-box; }
.admin-home-topbar h1 { flex:0 1 auto; min-width:0; font-size:clamp(18px, 5vw, 28px); line-height:1.15; }
.admin-home-topbar .management-title-actions button { white-space:nowrap; min-width:72px; }
body.app-mode:not(.student-active) .topbar.admin-nested-topbar-hidden { display:none !important; }
body.app-mode:not(.student-active):has(.topbar.admin-nested-topbar-hidden) {
  --management-header-clearance: calc(20px + env(safe-area-inset-top, 0px));
}
.nested-admin-page { width:100%; max-width:none; margin:0; padding:16px 20px 28px; box-sizing:border-box; background:transparent; }
.nested-page-header { position:sticky; top:0; z-index:4; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:10px 0; background:transparent; }
.nested-page-header h2 { margin:0; white-space:nowrap; }
.nested-page-header span { font-size:12px; color:var(--muted,#74809a); }
.nested-page-actions { display:flex; align-items:center; gap:8px; flex:0 0 auto; }
.nested-search-row { position:sticky; top:58px; z-index:3; padding:6px 0 10px; background:transparent; }
.nested-search-row input, .book-detail-search, .teacher-association-modal > input { width:100%; box-sizing:border-box; }
.nested-scroll-list { max-height:calc(100vh - 180px); overflow:auto; overscroll-behavior:contain; }
/* Keep account pages scrollable without showing inner or page scrollbar tracks. */
html:has(#nested-account-list),
body:has(#nested-account-list),
#nested-account-list {
  scrollbar-width: none;
}
html:has(#nested-account-list)::-webkit-scrollbar,
body:has(#nested-account-list)::-webkit-scrollbar,
#nested-account-list::-webkit-scrollbar {
  display: none;
}
.nested-account-row { display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:left; }
.nested-account-row span { color:var(--muted,#74809a); font-size:12px; }
.nested-account-row .account-row-details { flex:1; min-width:0; display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:3px; padding:8px 0; border:0; background:transparent; box-shadow:none; color:inherit; text-align:left; }
.nested-account-row .account-row-details b { max-width:100%; }
.nested-account-row .account-row-details span { max-width:100%; white-space:normal; overflow-wrap:anywhere; line-height:1.35; }
.nested-account-row .account-row-reset { flex:0 0 auto; min-height:36px; padding:6px 10px; display:flex; align-items:center; justify-content:center; white-space:nowrap; }
.nested-account-row[hidden] { display:none !important; }
body.app-mode:not(.student-active) .account-role-switcher {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 22px;
  background: rgba(255,255,255,.22);
}
body.app-mode:not(.student-active) .account-role-switcher .account-role-indicator {
  position: absolute;
  z-index: -1;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: calc((100% - 12px) / 3);
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(255,255,255,.55), rgba(255,255,255,.2));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 3px 8px rgba(77,55,124,.1);
  pointer-events: none;
}
body.app-mode:not(.student-active) .account-role-switcher button {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border: 0 !important;
  border-radius: 17px;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  color: #716080;
}
body.app-mode:not(.student-active) .account-role-switcher button.active { color: #6e36cc; }
body.app-mode:not(.student-active) .account-role-switcher button:focus-visible { outline: 2px solid #7950c5; outline-offset: -3px; }
body.app-mode:not(.student-active) #nested-account-list .nested-account-row {
  background: linear-gradient(135deg, rgba(255,255,255,.38), rgba(255,255,255,.16)) !important;
  border: 1px solid rgba(255,255,255,.68) !important;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 2px 6px rgba(55,40,90,.035) !important;
}
.account-password-dialog { box-sizing:border-box; width:min(360px, calc(100vw - 40px)); max-height:calc(100dvh - 48px); margin:auto; padding:24px; border:1px solid rgba(255,255,255,.8); border-radius:24px; background:rgba(250,246,255,.94); color:var(--text-main); box-shadow:0 18px 60px rgba(48,35,79,.24); backdrop-filter:blur(18px); overflow:auto; }
.account-password-dialog::backdrop { background:rgba(38,26,62,.25); }
.account-password-dialog[open] { display:grid; gap:12px; animation:accountPasswordDialogEnter .24s ease-out; }
.account-password-dialog h2 { margin:0; font-size:22px; }
.account-password-dialog p { margin:0; line-height:1.6; overflow-wrap:anywhere; }
.account-password-dialog .actions { margin-top:4px; }
.account-password-dialog .message:empty { display:none; }
.account-reset-password-value { display:block; padding:14px; border-radius:14px; background:rgba(255,255,255,.65); font:600 22px/1.4 ui-monospace,monospace; text-align:center; overflow-wrap:anywhere; user-select:text; }
@keyframes accountPasswordDialogEnter { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:translateY(0); } }
@media (prefers-reduced-motion:reduce) { .account-password-dialog[open] { animation:none; } }
.nested-book-header { position:sticky; top:0; z-index:5; padding:8px 0; background:var(--page-bg, #f7f8fc); }
.nested-book-header { display:grid; grid-template-columns:minmax(0,1fr) auto; row-gap:8px; }
.nested-book-header .book-detail-heading { grid-column:1 / -1; grid-row:1; }
.nested-book-header .subnav-actions { grid-column:1 / -1; grid-row:2; display:flex; justify-content:flex-end; gap:8px; }
.nested-book-header .book-detail-heading > .eyebrow { display:none; }
.nested-book-header .book-detail-heading > .meta { display:none; }
.nested-book-title-block { display:grid !important; grid-template-columns:minmax(0,1fr) auto; row-gap:8px; align-items:center; }
.nested-book-title-block > div { grid-column:1 / -1; grid-row:1; }
.nested-book-title-block > .back-chip { grid-column:1; grid-row:2; justify-self:start; }
.nested-book-title-block > .import-chip { grid-column:2; grid-row:2; justify-self:end; }
.nested-book-title-block small { display:flex; flex-direction:column; gap:2px; }
.nested-book-title-block > div { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.nested-book-title-block > div h2 { margin:0; }
.nested-book-title-block > div small { flex:0 0 auto; text-align:right; }
.book-detail-page-v2 .admin-search-strip { position:relative; display:block; width:100%; }
.book-detail-page-v2 .admin-search-strip input { width:100%; box-sizing:border-box; padding-right:64px; }
.book-detail-page-v2 .admin-search-strip button { position:absolute; right:8px; top:50%; transform:translateY(-50%); background:transparent; box-shadow:none !important; }
.nested-book-header .book-detail-heading { display:flex; align-items:center; gap:14px; min-width:0; }
.nested-book-header .book-detail-title { margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.book-header-stats { display:flex; flex-direction:column; gap:2px; white-space:nowrap; font-size:12px; color:var(--muted,#74809a); }
.book-detail-search { position:sticky; top:54px; z-index:4; margin:0 0 10px; }
.nested-word-scroll { min-height:0; align-items:start; }
.nested-word-scroll .word-list-modern { max-height:calc(100vh - 190px); overflow:auto; overscroll-behavior:contain; }
.teacher-association-modal .teacher-word-check { align-items:center; box-sizing:border-box; min-height:52px; padding:6px 12px; margin:0; }
body.app-mode:not(.student-active) .teacher-association-modal .teacher-word-check {
  background: linear-gradient(135deg, rgba(255,255,255,.34), rgba(255,255,255,.12));
  border: 1px solid rgba(255,255,255,.48);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.48), inset 0 -1px 0 rgba(255,255,255,.12);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
  backdrop-filter: blur(16px) saturate(145%);
  color: #35234f !important;
}
body.app-mode:not(.student-active) .teacher-association-modal .teacher-word-check small { color: #514065; }
body.app-mode:not(.student-active) .teacher-association-modal .teacher-word-check:has(input:checked) {
  background: linear-gradient(135deg, rgba(226,208,255,.58), rgba(235,219,255,.28));
  border-color: rgba(115,63,214,.62);
}
.teacher-association-modal .teacher-word-check:focus-within { outline: 2px solid #7340ce; outline-offset: -2px; }
.teacher-association-modal .teacher-word-check-list { grid-template-columns:minmax(0,1fr); gap:6px; align-content:start; min-height:0; overflow-y:auto; scrollbar-width:none; }
.teacher-association-modal .teacher-word-check-list::-webkit-scrollbar { display:none; }
body.app-mode:not(.student-active) .admin-modal-sheet:has(.teacher-association-modal) { height:86dvh; }
body.app-mode:not(.student-active) .admin-modal-sheet:has(.teacher-association-modal) .admin-modal-body { display:flex; flex:1; overflow:hidden; }
body.app-mode:not(.student-active) .teacher-association-modal { display:grid; grid-template-rows:auto minmax(0,1fr) auto; gap:12px; width:100%; min-height:0; }
.teacher-association-modal .teacher-word-check span { display:flex; flex-direction:column; gap:2px; min-width:0; font-size:16px; line-height:1.2; overflow-wrap:anywhere; }
.teacher-association-modal .teacher-word-check small { color:var(--muted,#74809a); font-size:13px; line-height:1.2; }
body.app-mode:not(.student-active) .teacher-association-modal .teacher-word-check input[type="checkbox"] { width:20px; height:20px; min-height:20px; margin:0; flex:0 0 20px; }
@media (max-width:700px) { .nested-admin-page { padding:10px 12px 20px; } .nested-page-header { align-items:flex-start; } .nested-page-header h2 { font-size:20px; } .nested-page-actions button { padding-inline:10px; } .nested-scroll-list { max-height:calc(100vh - 205px); } .admin-home-topbar { display:grid !important; grid-template-columns:minmax(0,1fr) auto !important; align-items:center; gap:8px; padding-inline:12px; } .admin-home-topbar > div:first-child { min-width:0; } .admin-home-topbar .management-title-actions { gap:4px; } .admin-home-topbar .management-title-actions button { padding-inline:8px; font-size:12px; } }
/* Shared card-to-page geometry, like opening an app from its home-screen tile. */
html.admin-card-transition body.app-mode:not(.student-active) .topbar {
  view-transition-name: admin-home-header;
  /* A live backdrop filter is captured separately from the sliding snapshot
     in Chromium and leaves a stationary rectangular blur over the next page. */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html.admin-card-transition::view-transition-group(admin-home-header) {
  animation: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html.admin-card-transition::view-transition-old(admin-home-header) {
  animation: adminHomeHeaderOut 350ms cubic-bezier(.22, 1, .36, 1) both;
}
html.admin-card-transition::view-transition-new(admin-home-header) {
  animation: adminHomeHeaderIn 350ms cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes adminHomeHeaderOut {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(calc(-100% - 32px)); opacity: 0; }
}
@keyframes adminHomeHeaderIn {
  from { transform: translateY(calc(-100% - 32px)); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
html.admin-card-transition::view-transition-group(admin-card-open) {
  animation-duration: 430ms;
  animation-timing-function: cubic-bezier(.22, 1, .36, 1);
}
html.admin-card-transition::view-transition-image-pair(admin-card-open) {
  overflow: hidden;
  animation: adminCardOutlineOpen 430ms cubic-bezier(.22, 1, .36, 1) both;
}
html.admin-card-transition::view-transition-old(admin-card-open) {
  height: 100%;
  object-fit: cover;
  animation: adminCardSnapshotOut 180ms ease-out both;
}
html.admin-card-transition::view-transition-new(admin-card-open) {
  height: 100%;
  object-fit: cover;
  animation: adminCardContentIn 300ms ease-out both;
}
@keyframes adminCardOutlineOpen { from { border-radius: 26px; } to { border-radius: 0; } }
html.admin-card-return::view-transition-group(admin-card-open) { animation-duration: 350ms; }
html.admin-card-return::view-transition-image-pair(admin-card-open) {
  animation-name: adminCardOutlineClose;
  animation-duration: 350ms;
}
html.admin-card-return::view-transition-old(admin-card-open) { animation-duration: 300ms; }
html.admin-card-return::view-transition-new(admin-card-open) { animation-duration: 180ms; }
@keyframes adminCardOutlineClose { from { border-radius: 0; } to { border-radius: 26px; } }
@keyframes adminCardSnapshotOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes adminCardContentIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  html.admin-card-transition::view-transition-old(admin-home-header),
  html.admin-card-transition::view-transition-new(admin-home-header),
  html.admin-card-transition::view-transition-group(admin-card-open),
  html.admin-card-transition::view-transition-image-pair(admin-card-open),
  html.admin-card-transition::view-transition-old(admin-card-open),
  html.admin-card-transition::view-transition-new(admin-card-open) { animation-duration: 0s; }
}
.admin-stat-card, .admin-stat-card-v5 { transition:transform .16s ease, box-shadow .16s ease; transform:translateZ(0); }
.admin-stat-card:active, .admin-stat-card-v5:active { transform:translateY(-4px) scale(1.015); box-shadow:0 14px 28px rgba(73,52,153,.2) !important; }
@media (prefers-reduced-motion: reduce) { .admin-stat-card, .admin-stat-card-v5 { transition:none; } .admin-stat-card:active, .admin-stat-card-v5:active { transform:none; } }

/* Compact account-list rhythm: keep each nested control group close without
   changing the existing cards, typography, or interaction states. */
body.app-mode:not(.student-active) .account-list-page-v6 {
  padding-top: 0;
  padding-bottom: 12px;
  margin-top: -6px;
}
body.app-mode:not(.student-active) .account-list-page-v6 .nested-page-header {
  padding-top: 0;
  padding-bottom: 0;
  gap: 6px;
}
body.app-mode:not(.student-active) .account-list-page-v6 .nested-search-row {
  top: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: -3px;
}
body.app-mode:not(.student-active) .account-list-page-v6 .account-toolbar-v4 {
  margin-top: -3px;
  margin-bottom: 0;
}
body.app-mode:not(.student-active) .account-list-page-v6 .nested-scroll-list {
  gap: 6px;
  margin-top: -3px;
}

/* Shared book/account list headers, followed by the bound-book tile. */
body.app-mode:not(.student-active) .account-list-page-v6 {
  margin-top: 0;
  padding-top: calc(22px + env(safe-area-inset-top, 0px));
}
body.app-mode:not(.student-active) .account-list-page-v6 .nested-page-header {
  align-items: center;
  margin-bottom: 6px;
}
body.app-mode:not(.student-active) .account-list-page-v6 .nested-page-header h2 { font-size: 24px; }
body.app-mode:not(.student-active) .account-list-page-v6 .nested-page-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  min-width: 90px;
  height: 46px;
  padding: 0 8px;
  border: 0 !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, #7246dc, #993cc6) !important;
  color: #fff !important;
  font-size: 18px !important;
  line-height: 1.2;
  white-space: nowrap;
}
body.app-mode:not(.student-active) .book-library-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 148px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 24px;
  background: rgba(255,255,255,.76);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease, filter 160ms ease;
}
.book-library-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 88px;
  height: 112px;
  padding: 14px 8px 13px 12px;
  border-radius: 4px 11px 11px 4px;
  background: linear-gradient(90deg, rgba(28,25,82,.4), rgba(255,255,255,.16) 5px, transparent 10px),
    linear-gradient(145deg, #3978da 0%, #7550cb 52%, #c34c9c 100%);
  color: #fff;
  box-shadow: 3px 4px 0 -1px #e1dfee, 5px 8px 13px rgba(48,39,87,.16), inset 0 1px 0 rgba(255,255,255,.22);
  overflow: hidden;
}
.book-library-cover-mark { font-size: 8px; font-weight: 600; letter-spacing: 1.1px; opacity: .82; }
.book-library-cover strong { font-size: 14px; line-height: 1.25; font-weight: 650; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-library-info { display: flex; flex-direction: column; min-width: 0; gap: 8px; }
.book-library-info > strong { font-size: 23px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.book-library-info > span { font-size: 14px; color: #756b89; font-weight: 500; }
.book-library-chevron { width: 18px; height: 18px; color: #8b819b; }
body.app-mode:not(.student-active) .book-library-card:focus-visible { outline: 3px solid #7050cc; outline-offset: 3px; }
body.app-mode:not(.student-active) .book-library-card:active { filter: brightness(.97); }
@media (hover:hover) { body.app-mode:not(.student-active) .book-library-card:hover { background: rgba(255,255,255,.94); } }
@media (max-width:360px) {
  body.app-mode:not(.student-active) .account-list-page-v6 .nested-page-header { gap: 8px; }
  body.app-mode:not(.student-active) .account-list-page-v6 .nested-page-header h2 { font-size: 22px; }
  body.app-mode:not(.student-active) .account-list-page-v6 .nested-page-actions { gap: 6px; }
  body.app-mode:not(.student-active) .account-list-page-v6 .nested-page-actions button { width: 78px; min-width: 78px; padding: 0 4px; font-size: 16px !important; }
  body.app-mode:not(.student-active) .book-library-card { gap: 12px; padding: 14px; grid-template-columns: 76px minmax(0,1fr) 16px; }
  .book-library-cover { width: 76px; height: 104px; padding-left: 12px; }
  .book-library-info > strong { font-size: 20px; }
}
@media (prefers-reduced-motion:reduce) { body.app-mode:not(.student-active) .book-library-card { transition: none; } }

/* The title and search stay outside the sole word-list scroll area. */
body.app-mode:not(.student-active):has(.book-detail-workspace) { overflow: hidden !important; }
html:has(body.app-mode:not(.student-active) .book-detail-workspace) { overflow: hidden; }
body.app-mode:not(.student-active) .book-detail-workspace {
  display: flex !important;
  flex-direction: column;
  height: calc(100dvh - 2 * var(--management-gutter) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 10px !important;
  overflow: hidden;
}
body.app-mode:not(.student-active) .book-detail-workspace :is(.book-title-block-v2, .admin-search-strip) {
  position: static !important;
  flex: 0 0 auto;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}
body.app-mode:not(.student-active) .book-detail-workspace .book-title-block-v2 {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px !important;
}
body.app-mode:not(.student-active) .book-detail-workspace .admin-search-strip { position: relative !important; }
.book-detail-workspace .book-detail-heading h2 { min-width: 0; overflow-wrap: anywhere; }
body.app-mode:not(.student-active) .book-detail-workspace .book-detail-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
body.app-mode:not(.student-active) .book-detail-workspace .book-detail-actions button {
  grid-column: auto !important;
  grid-row: auto !important;
  justify-self: stretch !important;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 44px !important;
  height: 44px;
  padding: 0 4px !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, #7246dc, #993cc6) !important;
  color: #fff !important;
  font-size: 18px !important;
  line-height: 1.2;
  white-space: nowrap;
}
body.app-mode:not(.student-active) .book-detail-workspace .word-index-layout {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px !important;
  align-items: stretch;
  gap: 8px !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}
body.app-mode:not(.student-active) .book-detail-workspace .indexed-word-list {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  align-content: start;
  gap: 10px;
  padding: 0 0 8px;
}
.book-detail-workspace .indexed-word-list::-webkit-scrollbar { display: none; }
body.app-mode:not(.student-active) .book-detail-workspace .alphabet-rail {
  position: static !important;
  width: 40px !important;
  height: 100% !important;
  min-height: 0;
  max-height: none;
  margin: 0;
  grid-template-rows: repeat(26, minmax(0, 1fr));
  overflow-y: auto;
  scrollbar-width: none;
}
.book-detail-workspace .alphabet-rail::-webkit-scrollbar { display: none; }
body.app-mode:not(.student-active) .book-detail-workspace .word-row-v2 { scroll-margin-top: 0; }
@media (max-width:360px) {
  body.app-mode:not(.student-active) .book-detail-workspace .book-detail-actions { gap: 6px; }
  body.app-mode:not(.student-active) .book-detail-workspace .book-detail-actions button { font-size: 16px !important; }
}
@media (max-height:540px) {
  body.app-mode:not(.student-active) .book-detail-workspace .alphabet-rail { grid-template-rows: repeat(26, 22px); }
}

/* The overview introduces the dashboard; the four tiles own navigation. */
body.app-mode:not(.student-active) .admin-home-v5 .admin-home-overview {
  min-height: 0 !important;
  padding: 24px !important;
  margin: 0 !important;
  border-radius: 28px !important;
  align-items: center;
  background: linear-gradient(120deg, rgba(255,255,255,.72), rgba(245,241,255,.62)) !important;
  backdrop-filter: blur(18px) saturate(115%);
  -webkit-backdrop-filter: blur(18px) saturate(115%);
  color: #30234f;
}
.admin-home-overview .admin-overview-brand {
  color: #655481;
  font-size: 14px;
  font-weight: 650;
}
.admin-home-overview h2 {
  margin: 10px 0 10px !important;
  font-size: 28px !important;
  line-height: 1.2;
  font-weight: 750;
  color: #30234f;
}
.admin-home-overview p {
  max-width: none;
  font-size: 16px !important;
  line-height: 1.55;
  font-weight: 500;
  color: #655481 !important;
}

/* Hide native scrollbar chrome globally while preserving each surface's scrolling. */
*, *::before, *::after {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
*::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Teacher assignment: fixed title/search/actions, one scrolling book list. */
body.app-mode:not(.student-active) .admin-modal-sheet:has(.teacher-assignment-panel) {
  height: min(84dvh, 820px);
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
  overflow: hidden;
}
body.app-mode:not(.student-active) .admin-modal-sheet:has(.teacher-assignment-panel) .admin-modal-head {
  margin-bottom: 10px !important;
  align-items: center;
}
body.app-mode:not(.student-active) .admin-modal-sheet:has(.teacher-assignment-panel) .admin-modal-head h2 {
  font-size: 20px !important;
  line-height: 1.3;
}
body.app-mode:not(.student-active) .admin-modal-body:has(.teacher-assignment-panel) {
  display: flex;
  flex: 1;
  overflow: hidden;
}
body.app-mode:not(.student-active) .teacher-assignment-panel {
  width: 100%;
  min-height: 0;
  padding: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr) auto;
  gap: 8px;
}
.teacher-assignment-panel .teacher-word-select-toolbar { grid-template-columns: minmax(0,1fr); }
.teacher-assignment-panel .teacher-word-select-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}
.teacher-assignment-panel #teacher-word-selected-count {
  min-width: 0;
  margin-right: auto;
  padding: 0;
  background: transparent;
  white-space: nowrap;
  font-size: 14px;
}
body.app-mode:not(.student-active) .teacher-assignment-panel .teacher-word-select-actions button {
  min-width: 0;
  padding: 0 10px;
  min-height: 36px !important;
  height: 36px;
  box-sizing: border-box;
  font-size: 14px !important;
  white-space: nowrap;
}
.teacher-assignment-panel .teacher-all-books-word-list {
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: block;
}
.teacher-assignment-panel .teacher-book-word-section { margin: 0 0 8px; }
.teacher-assignment-panel .teacher-book-word-section > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 10px 2px;
  font-size: 19px;
  font-weight: 750;
  list-style: none;
}
.teacher-assignment-panel summary::-webkit-details-marker { display: none; }
.teacher-assignment-panel summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  margin-left: auto;
  margin-right: 6px;
  transform: rotate(-45deg);
  transition: transform .18s ease;
}
.teacher-assignment-panel details[open] > summary::after { transform: rotate(45deg); }
.teacher-assignment-panel summary:focus-visible { outline: 2px solid #7340ce; outline-offset: -2px; border-radius: 8px; }
.teacher-assignment-panel summary small { font-size: 13px; color: #655481; font-weight: 500; }
body.app-mode:not(.student-active) .teacher-assignment-panel .teacher-word-check-list {
  grid-template-columns: minmax(0,1fr);
  gap: 6px;
  max-height: none;
  overflow: visible;
}
body.app-mode:not(.student-active) .teacher-assignment-panel .teacher-word-check {
  background: linear-gradient(135deg, rgba(255,255,255,.34), rgba(255,255,255,.12));
  border: 1px solid rgba(255,255,255,.48);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.48), inset 0 -1px 0 rgba(255,255,255,.12);
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
  color: #35234f;

  min-height: 46px;
  padding: 6px 12px;
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}
.teacher-assignment-panel .teacher-word-check span { font-size: 18px; overflow-wrap: anywhere; }
.teacher-assignment-panel .teacher-word-check input { flex: 0 0 20px; min-height: 20px; margin: 0; }
.teacher-assignment-panel [hidden] { display: none !important; }
.teacher-assignment-panel #teacher-word-save-message:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .teacher-assignment-panel summary::after { transition: none; } }

body.app-mode:not(.student-active) .teacher-assignment-panel .teacher-word-check:has(input:checked) {
  background: linear-gradient(135deg, rgba(226,208,255,.58), rgba(235,219,255,.28));
  border-color: rgba(115,63,214,.62);
}
.teacher-assignment-panel .teacher-word-check:focus-within { outline: 2px solid #7340ce; outline-offset: -2px; }

/* Compact empty books and allow the last row to clear the sheet's safe area. */
.teacher-assignment-panel:has(#teacher-word-save-message:empty) {
  grid-template-rows: auto auto minmax(0,1fr);
}
.teacher-assignment-panel .teacher-all-books-word-list {
  padding-bottom: 12px;
  scroll-padding-bottom: 12px;
}
body.app-mode:not(.student-active) .teacher-assignment-panel .empty-state {
  min-height: 44px;
  padding: 10px 12px;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.4;
}

/* Select-all belongs to each book, independently of its disclosure state. */
.teacher-assignment-panel .teacher-book-word-section > summary > span { min-width: 0; overflow-wrap: anywhere; }
.teacher-assignment-panel .teacher-book-word-section > summary > small { white-space: nowrap; }
body.app-mode:not(.student-active) .teacher-assignment-panel .teacher-book-select-all {
  margin-left: auto;
  flex: 0 0 auto;
  height: 32px;
  min-height: 32px !important;
  padding: 0 12px;
  font-size: 14px !important;
  line-height: 1;
}
.teacher-assignment-panel summary:has(.teacher-book-select-all)::after { margin-left: 4px; flex-shrink: 0; }

/* Resize the button with its label while crossfading the text. */
body.app-mode:not(.student-active) .teacher-assignment-panel .teacher-book-select-all {
  display: grid;
  place-items: center;
  width: 54px;
  min-width: 0;
  overflow: hidden;
  padding-inline: 8px;
  transition: width .24s cubic-bezier(.22,1,.36,1), background-color .2s ease, color .2s ease, border-color .2s ease;
}
.teacher-book-select-all > span {
  grid-area: 1 / 1;
  min-width: 0;
  justify-self: center;
  white-space: nowrap;
  transition: opacity .2s ease, transform .2s ease;
}
.teacher-book-select-all .book-select-label { opacity: 1; transform: translateY(0); }
.teacher-book-select-all .book-deselect-label { opacity: 0; transform: translateY(5px); }
.teacher-book-select-all[data-all-selected="true"] .book-select-label { opacity: 0; transform: translateY(-5px); }
.teacher-book-select-all[data-all-selected="true"] .book-deselect-label { opacity: 1; transform: translateY(0); }
body.app-mode:not(.student-active) .teacher-assignment-panel .teacher-book-select-all[data-all-selected="true"] {
  width: 82px;
  background-color: rgba(225,209,255,.8);
  color: #512a95;
  border-color: rgba(115,63,214,.4);
}
@media (prefers-reduced-motion: reduce) {
  body.app-mode:not(.student-active) .teacher-assignment-panel .teacher-book-select-all,
  .teacher-book-select-all > span { transition: none; }
}

/* Teacher home keeps its identity card fixed above a single scrolling dashboard. */
html:has(body.app-mode:not(.student-active) .teacher-page-v5),
body.app-mode:not(.student-active):has(.teacher-page-v5) {
  height: 100dvh;
  overflow: hidden !important;
  overscroll-behavior: none;
}
body.app-mode:not(.student-active):has(.teacher-page-v5) .shell {
  box-sizing: border-box;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body.app-mode:not(.student-active):has(.teacher-page-v5) :is(#appView, #content) {
  height: 100%;
  min-height: 0;
}
body.app-mode:not(.student-active) .teacher-page-v5 {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.teacher-page-v5 > .teacher-hero-v5 { flex: 0 0 auto; }
.teacher-dashboard-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 12px;
}
body.app-mode:not(.student-active) .teacher-dashboard-scroll > .section {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px !important;
  gap: 12px;
}
body.app-mode:not(.student-active) .teacher-page-v5 :is(.teacher-student-name-card, .teacher-review-card) {
  background: linear-gradient(135deg, rgba(255,255,255,.38), rgba(255,255,255,.14)) !important;
  border: 2px solid #fff !important;
  box-shadow: inset 0 0 7px rgba(255,255,255,.72), 0 0 5px rgba(255,255,255,.95), 0 0 14px rgba(255,255,255,.75), 0 2px 7px rgba(93,68,136,.12) !important;
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
  color: #35234f;
}
body.app-mode:not(.student-active) .teacher-page-v5 .teacher-review-card {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  min-height: 52px;
  padding: 8px 12px;
  gap: 12px;
  border-radius: 18px !important;
}
body.app-mode:not(.student-active) .teacher-page-v5 .teacher-review-card > span {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
}
.teacher-page-v5 .teacher-review-card b { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
body.app-mode:not(.student-active) .teacher-page-v5 .teacher-review-progress {
  display: flex;
  flex-direction: column;
  text-align: right;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
  white-space: nowrap;
  color: #655481;
}
.teacher-page-v5 .teacher-review-card i { font-size: 14px; white-space: nowrap; }
@media (max-width:360px) {
  body.app-mode:not(.student-active) .teacher-page-v5 .teacher-review-card { gap: 8px; padding-inline: 10px; }
}




/* Keep the original Chinese weight hierarchy while using lighter Poppins defaults for Latin text. */
body.student-active { font-family: var(--ui-font); font-weight: 400; }
body.student-active button { font-family: var(--ui-font); }

/* Local 49220 Pet preview: lighten Latin words and numeric counters while preserving Chinese text hierarchy. */
body.student-active .lesson-media-v5 h1,
body.student-active .practice-word-slot h1,
body.student-active .practice-word-slot .masked-word,
body.student-active .masked-word-text,
body.student-active .letter-bank button,
body.student-active .lesson-part-v5 {
  font-weight: 400 !important;
}
body.student-active .lesson-progress-strip b,
body.student-active .practice-coin-target {
  font-weight: 400 !important;
}

/* Local 49220 spacing refinement: keep the practice sections on one consistent rhythm. */
body.student-active .lesson-media-v5 {
  gap: 8px;
}
body.student-active .practice-word-slot {
  gap: 8px;
}

/* Local 49220 Pet preview: lift the lower practice controls clear of the card edge. */
body.student-active .practice-word-slot,
body.student-active .practice-decomposition-slot,
body.student-active .practice-interaction-slot {
  position: relative;
  top: -12px;
}

/* Local workspace refinement: enlarge profile metric labels by one step. */
.profile-metrics-v5 button span,
.profile-metrics-polished button span,
.profile-metrics-v2 button span { font-size: 14px; }


/* Keep long leaderboard names inside the row without displacing the coin badge. */
.student-mode .rank-row { grid-template-columns: 52px minmax(0, 1fr) auto; min-width: 0; }
.student-mode .rank-row > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-mode .rank-row .galaxy-coin-balance { flex: 0 0 auto; min-width: 72px; }

.rank-index-top {
  width: 52px;
  min-height: 32px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #573b16;
  font-weight: 900;
  box-shadow: 0 3px 8px rgb(89 61 28 / 12%);
}
.rank-trophy {
  display: inline-block;
  font-size: 19px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgb(92 59 24 / 22%));
}
.rank-trophy-2 { filter: grayscale(1) brightness(1.35) drop-shadow(0 1px 1px rgb(92 59 24 / 22%)); }
.rank-trophy-3 { filter: sepia(.85) saturate(1.8) hue-rotate(330deg) brightness(.9) drop-shadow(0 1px 1px rgb(92 59 24 / 22%)); }
.rank-index-top:has(.rank-trophy-1) { background: linear-gradient(135deg, #fff5c7, #ffe08a); border-color: #f4c95d; }
.rank-index-top:has(.rank-trophy-2) { background: linear-gradient(135deg, #f4f6f8, #d8dde3); border-color: #c5ccd5; color: #4b5563; }
.rank-index-top:has(.rank-trophy-3) { background: linear-gradient(135deg, #ffe5d0, #e7a879); border-color: #d7925c; color: #6b351d; }


/* NO-PET workspace: remove all visible pet navigation and profile references. */


/* Final no-pet guard: hide every Pet surface and direct Pet navigation action. */
body.student-active .pet-board,
body.student-active [class*='pet-board'],
body.student-active .pet-stage,
body.student-active .pet-stat-card,
body.student-active .pet-actions-v5,
body.student-active .pet-actions-v2 { display: none !important; }



/* NO-PET navigation adaptation: three visible tabs fill the rail evenly. */
body.student-active .student-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; }
body.student-active .student-tabs button { width: 100%; min-width: 0; }



/* No-pet: the selected surface matches the actual button bounds. */
body.student-active .student-tabs button.active { background: transparent !important; box-shadow: none !important; }
body.student-active .profile-metrics-v5 > button:last-child { grid-column: 1 / -1; }

/* Correct three-item no-pet nav: the highlight is aligned from live button bounds. */
body.student-active .student-tab-highlight { width: auto; }


body.student-active .profile-metrics-polished { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.student-active .profile-metrics-polished > button:last-child { grid-column: 1 / -1; }

:root .admin-quarantine-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid #dedce5; }
.admin-quarantine-section h3 { margin: 0; }
.admin-quarantine-list { padding: 0; margin: 0; list-style: none; }
.admin-quarantine-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid #dedce5; }
.admin-quarantine-row > div { min-width: 0; overflow-wrap: anywhere; }
.admin-quarantine-row p { margin: 5px 0 0; color: #544b63; font-size: 13px; line-height: 1.6; }
.admin-quarantine-row button { flex-shrink: 0; }
.admin-quarantine-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.admin-quarantine-actions button:disabled { opacity: .5; cursor: not-allowed; }
.quarantine-confirm { overflow-wrap: anywhere; }
.quarantine-restore-result .account-reset-password-value { display: block; width: 100%; padding: 14px; border: 1px solid #d8d3e0; border-radius: 6px; background: #f7f6f9; font: 700 18px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.quarantine-confirm .quarantine-ack { display: flex; align-items: flex-start; gap: 10px; }
.quarantine-ack input { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 3px; }
@media (max-width: 480px) {
  .admin-quarantine-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .admin-quarantine-row button { align-self: flex-end; }
  .admin-quarantine-actions { width: 100%; justify-content: flex-end; }
}
