:root {
  color-scheme: light;
  --bg: #f4f7f3;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --ink: #18201c;
  --muted: #6f7871;
  --line: rgba(24, 32, 28, 0.1);
  --accent: #7b6154;
  --accent-strong: #563f34;
  --sage: #477c68;
  --rose: #c9787b;
  --gold: #cf9f42;
  --shadow: 0 18px 48px rgba(36, 52, 43, 0.14);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 18% 0%, rgba(201, 120, 123, 0.18), transparent 28rem),
    radial-gradient(circle at 100% 18%, rgba(71, 124, 104, 0.16), transparent 22rem),
    linear-gradient(145deg, #fbfcfa 0%, var(--bg) 48%, #edf3f7 100%);
  color: var(--ink);
}

body.app-loading {
  overflow: hidden;
  background: #fbf8f5;
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 36%, rgba(143, 112, 93, 0.12), transparent 14rem),
    #fbf8f5;
  transition:
    opacity 640ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 640ms cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 640ms ease;
  animation: splashAutoExit 760ms cubic-bezier(0.2, 0.8, 0.2, 1) 3600ms forwards;
}

.app-splash.hide {
  visibility: hidden;
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.splash-guitar {
  width: 132px;
  height: 182px;
  opacity: 0;
  transform: translateY(12px) scale(0.94);
}

.app-splash.play .splash-guitar {
  animation: splashGuitarEnter 420ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.splash-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.sound-hole {
  stroke-width: 2.4;
}

.app-splash.play .body-line {
  animation: guitarDraw 1100ms cubic-bezier(0.2, 0.8, 0.2, 1) 260ms forwards;
}

.app-splash.play .waist-line,
.app-splash.play .sound-hole {
  animation: guitarDraw 760ms cubic-bezier(0.2, 0.8, 0.2, 1) 980ms forwards;
}

.app-splash.play .neck-line,
.app-splash.play .head-line {
  animation: guitarDraw 820ms cubic-bezier(0.2, 0.8, 0.2, 1) 1380ms forwards;
}

.string-line {
  stroke-width: 1.2;
  opacity: 0.78;
}

.app-splash.play .string-line {
  animation: guitarDraw 920ms cubic-bezier(0.2, 0.8, 0.2, 1) 1900ms forwards;
}

.app-splash.play .bridge-line {
  animation: guitarDraw 620ms cubic-bezier(0.2, 0.8, 0.2, 1) 2320ms forwards;
}

.app-splash p {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  opacity: 0;
  transform: translateY(8px);
}

.app-splash.play p {
  animation: splashText 760ms ease 2700ms forwards;
}

@keyframes guitarDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes splashGuitarEnter {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes splashText {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes splashAutoExit {
  to {
    visibility: hidden;
    opacity: 0;
    transform: scale(1.04);
  }
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

.app-shell {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(250, 252, 249, 0.72);
  opacity: 1;
  transition: opacity 520ms ease;
}

body.app-loading .app-shell {
  opacity: 0;
  animation: appShellEnter 520ms ease 3820ms forwards;
}

@keyframes appShellEnter {
  to {
    opacity: 1;
  }
}

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
  transform: translateX(16px);
  opacity: 0;
  transition:
    opacity 260ms ease,
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}

.app-status {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  width: max-content;
  max-width: calc(100% - 36px);
  min-height: 28px;
  place-items: center;
  margin: 0 auto -28px;
  padding: 0 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 0 0 999px 999px;
  background: rgba(71, 124, 104, 0.94);
  box-shadow: 0 10px 24px rgba(24, 32, 28, 0.14);
  transform: translateY(-32px);
  transition:
    transform 220ms ease,
    background-color 220ms ease;
}

.app-status.show {
  transform: translateY(0);
}

.app-status.offline {
  background: rgba(159, 52, 44, 0.94);
}

.app-status.syncing {
  background: rgba(207, 159, 66, 0.96);
}

.screen-active {
  display: block;
  transform: translateX(0);
  opacity: 1;
}

.screen-entering {
  display: block;
  transform: translateX(18px);
  opacity: 0;
}

.screen-entering.screen-entered {
  transform: translateX(0);
  opacity: 1;
}

.screen-leaving {
  transform: translateX(-10px);
  opacity: 0;
  pointer-events: none;
}

.status-bar,
.top-header,
.section-title,
.pairing-preview,
.teacher-card,
.feedback-card,
.student-row,
.quick-actions {
  display: flex;
  align-items: center;
}

.status-bar {
  justify-content: space-between;
  height: 28px;
  color: rgba(31, 36, 32, 0.72);
  font-size: 13px;
  font-weight: 600;
}

.role-screen {
  display: none;
  padding-bottom: 36px;
}

.role-screen.screen-active {
  display: flex;
  flex-direction: column;
}

.role-screen.screen-entering {
  display: flex;
  flex-direction: column;
}

.brand-block {
  padding-top: 54px;
  position: relative;
  overflow: hidden;
}

.music-lines {
  position: absolute;
  right: -16px;
  top: 48px;
  width: 170px;
  height: 88px;
  opacity: 0.34;
  transform: rotate(-8deg);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 12px,
    rgba(109, 81, 67, 0.28) 12px,
    rgba(109, 81, 67, 0.28) 13px
  );
}

.music-lines::before,
.music-lines::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
}

.music-lines::before {
  right: 42px;
  bottom: 10px;
  width: 13px;
  height: 10px;
  box-shadow: 0 -34px 0 -1px var(--accent);
}

.music-lines::after {
  right: 50px;
  bottom: 16px;
  width: 2px;
  height: 48px;
  border-radius: 2px;
}

.logo-mark {
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(145deg, #312820, #8f705d);
  box-shadow: 0 16px 34px rgba(80, 55, 41, 0.22);
}

.logo-mark span {
  width: 28px;
  height: 42px;
  border: 3px solid #f8efe5;
  border-radius: 50% 50% 48% 48%;
  position: relative;
}

.logo-mark span::before,
.logo-mark span::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #f8efe5;
}

.logo-mark span::before {
  top: -19px;
  width: 7px;
  height: 20px;
  border-radius: 5px;
}

.logo-mark span::after {
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.eyebrow {
  margin: 20px 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 44px;
  line-height: 1.06;
  font-weight: 800;
}

h2 {
  font-size: 28px;
  line-height: 1.12;
}

.lead {
  width: 82%;
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.role-cards {
  display: grid;
  gap: 12px;
  margin-top: 58px;
}

.role-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 16px;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  box-shadow: 0 10px 32px rgba(66, 52, 42, 0.1);
  backdrop-filter: blur(18px);
}

.role-card.active {
  outline: 2px solid rgba(127, 156, 142, 0.5);
  background: rgba(255, 255, 255, 0.94);
}

.role-card strong {
  display: block;
  font-size: 17px;
}

.role-card small,
.teacher-card span,
.student-row span,
.today-card span,
.section-title span,
.pairing-preview p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.role-icon,
.avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 18px;
}

.role-icon {
  position: relative;
  background: #f3ebe4;
}

.role-icon::before,
.role-icon::after {
  content: "";
  position: absolute;
  background: var(--accent);
}

.role-icon-student::before {
  width: 16px;
  height: 16px;
  top: 11px;
  border-radius: 50%;
}

.role-icon-student::after {
  width: 28px;
  height: 14px;
  bottom: 11px;
  border-radius: 14px 14px 6px 6px;
}

.role-icon-teacher::before {
  width: 26px;
  height: 18px;
  top: 12px;
  border-radius: 5px;
}

.role-icon-teacher::after {
  width: 30px;
  height: 3px;
  bottom: 15px;
  border-radius: 4px;
}

.top-header {
  justify-content: space-between;
  padding-top: 18px;
}

.detail-header {
  justify-content: flex-start;
  gap: 12px;
}

.top-header .eyebrow {
  margin-top: 0;
}

.ghost-button,
.modal-close,
.back-button,
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  position: relative;
  box-shadow: 0 8px 24px rgba(66, 52, 42, 0.1);
}

.ghost-button::before,
.ghost-button::after,
.modal-close::before,
.modal-close::after,
.back-button::before,
.back-button::after,
.icon-button::before,
.icon-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 2px;
  background: var(--ink);
  border-radius: 4px;
}

.ghost-button::before {
  transform: translate(-50%, -5px);
}

.ghost-button::after {
  transform: translate(-50%, 4px);
}

.modal-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.back-button::before {
  width: 11px;
  transform: translate(-55%, -50%) rotate(-45deg);
  transform-origin: left center;
}

.back-button::after {
  width: 11px;
  transform: translate(-55%, -50%) rotate(45deg);
  transform-origin: left center;
}

.icon-button::before {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  background: transparent;
  transform: translate(-50%, -50%);
}

.icon-button::after {
  width: 5px;
  height: 5px;
  background: var(--ink);
  transform: translate(-50%, -50%);
}

.today-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 26px;
  padding: 20px;
  min-height: 134px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(31, 36, 32, 0.18), transparent),
    linear-gradient(145deg, #7f9c8e 0%, #6d5143 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.fret-lines {
  position: absolute;
  inset: 0 0 auto auto;
  width: 112px;
  height: 100%;
  opacity: 0.18;
  background:
    repeating-linear-gradient(to right, transparent 0, transparent 16px, #fff 16px, #fff 17px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 17px, #fff 17px, #fff 18px);
  transform: skewX(-14deg);
}

.today-card p {
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.today-card h3 {
  font-size: 22px;
  line-height: 1.22;
}

.today-card span {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.72);
}

.ring-progress {
  display: grid;
  flex: 0 0 78px;
  width: 78px;
  height: 78px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#fff 0 100%, rgba(255, 255, 255, 0.22) 0);
  position: relative;
}

.ring-progress::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #789285;
}

.ring-progress span {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #fff;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.danger-button,
.pill-button,
.text-button {
  min-height: 46px;
  border-radius: var(--radius);
  font-weight: 700;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
}

.primary-button {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 24px rgba(31, 36, 32, 0.16);
}

.primary-button:disabled,
.primary-button.disabled {
  cursor: not-allowed;
  color: rgba(31, 36, 32, 0.48);
  background: rgba(31, 36, 32, 0.1);
  box-shadow: none;
}

.primary-button.is-loading::after {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.44);
  border-top-color: #fff;
  border-radius: 999px;
  content: "";
  animation: spin 780ms linear infinite;
}

.primary-button.is-loading:disabled::after {
  border-color: rgba(31, 36, 32, 0.22);
  border-top-color: var(--ink);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.full-button {
  width: 100%;
  margin: 18px 0;
}

.secondary-button,
.pill-button {
  color: var(--ink);
  background: var(--surface-strong);
}

.danger-button {
  color: #9f342c;
  background: rgba(159, 52, 44, 0.1);
}

.settings-list {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.settings-list strong {
  color: var(--ink);
}

.app-state-list {
  padding: 12px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
}

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

.settings-actions .secondary-button[hidden] {
  display: none;
}

.settings-list strong {
  color: var(--ink);
}

.compact {
  width: 100%;
}

.icon-upload,
.icon-link {
  position: relative;
  width: 18px;
  height: 18px;
}

.icon-upload::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}

.icon-upload::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 1px;
  width: 12px;
  height: 8px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 4px 4px;
}

.icon-link::before,
.icon-link::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 8px;
}

.icon-link::before {
  left: 1px;
  top: 5px;
  transform: rotate(-28deg);
}

.icon-link::after {
  right: 1px;
  bottom: 5px;
  transform: rotate(-28deg);
}

.teacher-card,
.panel,
.profile-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(66, 52, 42, 0.09);
  backdrop-filter: blur(18px);
}

.teacher-card,
.profile-card {
  gap: 12px;
  padding: 14px;
}

.teacher-card > div:nth-child(2),
.profile-card > div:nth-child(2) {
  flex: 1;
}

.teacher-card p,
.student-row p,
.profile-card p {
  color: var(--muted);
  font-size: 12px;
}

.profile-card {
  display: flex;
  align-items: center;
  margin-top: 24px;
}

.profile-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.avatar {
  color: #fff;
  font-weight: 800;
}

.avatar-warm {
  background: linear-gradient(145deg, var(--rose), var(--accent));
}

.avatar-sage {
  background: linear-gradient(145deg, var(--sage), #4e7564);
}

.avatar-gold {
  background: linear-gradient(145deg, var(--gold), var(--accent));
}

.pill-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--accent-strong);
  font-size: 12px;
}

.panel {
  margin-top: 14px;
  padding: 16px;
}

.last-panel {
  margin-bottom: 10px;
}

.section-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h3 {
  font-size: 18px;
}

.text-button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--accent-strong);
  background: #f5ede7;
  font-size: 13px;
}

.chart-wrap {
  height: 148px;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.calendar-day {
  display: grid;
  height: 39px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  position: relative;
}

.calendar-day.done {
  color: #fff;
  background: var(--sage);
}

.calendar-day.missed {
  color: var(--accent);
  background: #f3e8e2;
}

.calendar-day.today {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.calendar-day.clickable {
  cursor: pointer;
}

.calendar-day.selected {
  color: #fff;
  background: var(--ink);
}

.calendar-video-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.video-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.64);
  border-radius: var(--radius);
}

.video-row p,
.empty-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mini-play {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: #f1ebe5;
  position: relative;
}

.mini-play::after {
  content: "";
  margin-left: 3px;
  border-left: 10px solid var(--accent-strong);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

.empty-note {
  padding: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
}

.video-player-screen {
  display: none;
  min-height: 100vh;
  background: #171715;
  color: #fff;
}

.video-player-screen.screen-active {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.video-player-screen.screen-entering {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.player-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 18px;
}

.player-header .eyebrow {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.66);
}

.player-surface {
  display: grid;
  align-content: center;
  min-height: 52vh;
}

.player-surface video {
  width: 100%;
  max-height: 62vh;
  border-radius: var(--radius);
  background: #000;
}

.player-placeholder {
  display: grid;
  min-height: 52vh;
  place-items: center;
  gap: 12px;
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(145deg, #3b332d, #171715);
  background-size: 26px 26px, 26px 26px, auto;
}

.player-placeholder p {
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
}

.player-actions {
  display: grid;
  gap: 10px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

.feedback-card {
  align-items: flex-start;
  gap: 12px;
}

.feedback-card-large {
  margin-top: 12px;
  padding: 18px;
}

.feedback-card-large .score-badge {
  flex-basis: 64px;
  width: 64px;
  height: 64px;
  font-size: 22px;
}

.score-badge {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 16px;
  font-weight: 800;
}

.feedback-card h4 {
  margin-bottom: 6px;
  font-size: 15px;
}

.feedback-card-large h4 {
  font-size: 18px;
}

.feedback-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.feedback-card-large p {
  color: var(--ink);
  font-size: 15px;
}

.weekly-review-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.review-row {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.review-row > span {
  flex: 0 0 38px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.review-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.review-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.teacher-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 24px;
}

.teacher-summary div {
  padding: 16px 10px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(66, 52, 42, 0.08);
}

.teacher-summary span {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.teacher-summary p {
  color: var(--muted);
  font-size: 12px;
}

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

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.overview-stats div {
  min-height: 86px;
  padding: 14px 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(66, 52, 42, 0.07);
}

.overview-stats span {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

.overview-stats p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.summary-note {
  padding: 14px;
  background: rgba(255, 255, 255, 0.58);
  border-radius: var(--radius);
}

.summary-note strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.summary-note p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.student-row {
  width: 100%;
  gap: 12px;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.64);
  border-radius: var(--radius);
}

.student-row > div:nth-child(2) {
  flex: 1;
}

.student-row strong {
  display: block;
  margin-bottom: 3px;
}

.student-row.active {
  outline: 2px solid rgba(127, 156, 142, 0.45);
}

.empty-state {
  display: grid;
  gap: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.58);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty-state strong {
  color: var(--ink);
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.status-chip {
  padding: 5px 8px;
  color: #fff;
  background: var(--sage);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-chip.pending {
  background: var(--gold);
}

.video-review {
  display: grid;
  gap: 14px;
}

.video-thumb {
  display: grid;
  width: 100%;
  height: 168px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(31, 36, 32, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 36, 32, 0.06) 1px, transparent 1px),
    linear-gradient(145deg, #dac7b8, #8f705d 50%, #3b332d);
  background-size: 24px 24px, 24px 24px, auto;
  overflow: hidden;
  position: relative;
}

.string-line {
  position: absolute;
  left: -14px;
  right: -14px;
  height: 1px;
  background: rgba(255, 255, 255, 0.5);
  transform: rotate(-10deg);
}

.string-line-1 {
  top: 54px;
}

.string-line-2 {
  top: 82px;
}

.string-line-3 {
  top: 110px;
}

.play-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  position: relative;
  box-shadow: 0 14px 28px rgba(31, 36, 32, 0.2);
}

.play-icon::after {
  content: "";
  position: absolute;
  left: 23px;
  top: 18px;
  border-left: 16px solid var(--ink);
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
}

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

.weekly-plan-card,
.weekly-plan-editor,
.success-card {
  display: grid;
  gap: 12px;
}

.weekly-plan-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.58);
  border-radius: var(--radius);
}

.weekly-plan-card strong {
  font-size: 16px;
}

.weekly-plan-card p,
.success-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.weekly-plan-editor input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
}

.modal-note.error {
  color: #a44f43;
}

.success-screen {
  display: none;
  min-height: 100vh;
  place-items: center;
}

.success-screen.screen-active {
  display: grid;
}

.success-screen.screen-entering {
  display: grid;
}

.success-card {
  width: 100%;
  padding: 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.success-card .eyebrow {
  margin: 0;
}

.success-mark {
  display: grid;
  width: 68px;
  height: 68px;
  place-self: center;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  position: relative;
}

.success-mark::before {
  content: "";
  width: 26px;
  height: 14px;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #fff;
  transform: rotate(-45deg) translate(2px, -2px);
}

.success-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input[type="range"] {
  accent-color: var(--accent);
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(31, 36, 32, 0.28);
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(100vw, 430px);
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  background: #fffaf6;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -18px 54px rgba(31, 36, 32, 0.2);
  position: relative;
}

.modal-card h3 {
  margin-bottom: 16px;
  font-size: 22px;
}

.modal-close {
  position: absolute;
  right: 16px;
  top: 16px;
  box-shadow: none;
  background: #f3ece6;
}

.upload-drop {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 20px;
  text-align: center;
  border: 1px dashed rgba(109, 81, 67, 0.35);
  border-radius: var(--radius);
  background: #f7f1ec;
}

.video-upload-picker {
  display: grid;
  min-height: 190px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 22px;
  text-align: center;
  border: 1px solid rgba(71, 124, 104, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 251, 248, 0.78)),
    #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.video-upload-picker.disabled {
  opacity: 0.58;
  cursor: default;
}

.video-upload-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-plus {
  position: relative;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 14px 28px rgba(24, 32, 28, 0.18);
}

.upload-plus::before,
.upload-plus::after {
  position: absolute;
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: #fff;
  content: "";
}

.upload-plus::after {
  transform: rotate(90deg);
}

.video-upload-picker strong {
  color: var(--ink);
  font-size: 17px;
}

.video-upload-picker small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.video-upload-picker.has-file {
  border-color: rgba(71, 124, 104, 0.44);
  background: rgba(244, 250, 246, 0.92);
}

.video-upload-picker.has-file .upload-plus {
  background: var(--sage);
}

.upload-drop strong {
  display: block;
  margin-bottom: 8px;
}

.upload-drop p,
.modal-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.file-input {
  width: 100%;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.modal-field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.upload-note-field {
  margin-top: 14px;
}

.modal-field input,
.modal-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
  font: inherit;
  resize: vertical;
}

.upload-status {
  min-height: 20px;
  margin: 10px 0 0;
  text-align: center;
}

.upload-status.error {
  color: #a44f43;
}

.upload-submit-button {
  width: 100%;
  margin-top: 10px;
}

.match-code {
  display: grid;
  gap: 10px;
}

.match-panel {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(66, 52, 42, 0.09);
  backdrop-filter: blur(18px);
}

.match-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.match-panel p.error {
  color: #a44f43;
}

.match-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 108px;
  gap: 8px;
}

.match-input-row.teacher-mode {
  grid-template-columns: 1fr;
}

.match-code input,
.match-panel input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
  font-weight: 800;
  text-transform: uppercase;
}

.generated-code-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.66);
  border-radius: var(--radius);
}

.generated-code-card .code-copy-button {
  width: 100%;
  margin-top: 6px;
}

.generated-code-card[hidden] {
  display: none;
}

.generated-code-card span {
  color: var(--muted);
  font-size: 12px;
}

.generated-code-card strong {
  color: var(--accent-strong);
  font-size: 26px;
  letter-spacing: 0;
}

.copy-code-home-button {
  margin-top: 10px;
  margin-bottom: 18px;
}

.range-field {
  gap: 10px;
}

.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.range-label strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.toast-region {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 1200;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  justify-self: end;
  max-width: 100%;
  padding: 12px 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  border-radius: var(--radius);
  background: rgba(24, 32, 28, 0.94);
  box-shadow: 0 18px 42px rgba(24, 32, 28, 0.24);
  opacity: 0;
  transform: translateY(12px);
  animation: toastIn 180ms ease forwards;
}

.toast.success {
  background: rgba(71, 124, 104, 0.96);
}

.toast.warning {
  background: rgba(158, 112, 35, 0.96);
}

.toast.error {
  background: rgba(159, 52, 44, 0.96);
}

.toast.leaving {
  animation: toastOut 180ms ease forwards;
}

@keyframes toastIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (min-width: 431px) {
  body {
    padding: 22px 0;
  }

  .app-shell {
    min-height: calc(100vh - 44px);
    border-radius: 32px;
    box-shadow: 0 28px 70px rgba(58, 45, 35, 0.2);
  }

  .screen {
    min-height: calc(100vh - 44px);
    min-height: calc(100dvh - 44px);
  }

  .toast-region {
    right: calc((100vw - 430px) / 2 + 18px);
  }
}
