:root {
  color-scheme: light;
  --bg: #f7f8f4;
  --surface: rgba(255, 255, 253, 0.9);
  --surface-solid: #ffffff;
  --surface-2: #eef3ef;
  --text: #121a18;
  --muted: #64716d;
  --border: rgba(27, 42, 35, 0.14);
  --primary: #0d7564;
  --primary-strong: #075245;
  --primary-soft: #d9f1ec;
  --amber: #e5a32e;
  --coral: #bd593f;
  --danger: #a23636;
  --success: #087761;
  --shadow: 0 28px 70px rgba(20, 33, 29, 0.16);
  --soft-shadow: 0 14px 34px rgba(20, 33, 29, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(247, 248, 244, 0.92), rgba(235, 241, 237, 0.96)),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("./assets/ui/practice-flow-bg.png");
  background-position: center;
  background-size: cover;
  opacity: 0.62;
  transform: scale(1.03);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.08) 42%, rgba(255, 255, 255, 0.38)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(227, 236, 232, 0.36));
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 1040px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 26px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 850;
}

h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.session-status {
  min-width: 116px;
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  box-shadow: var(--soft-shadow);
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 1px;
  font-weight: 850;
  backdrop-filter: blur(18px);
}

.session-status-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.practice-surface {
  position: relative;
  min-height: 560px;
  padding: 24px 28px 28px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(250, 253, 251, 0.82)),
    var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto auto auto auto auto 1fr;
  gap: 20px;
  overflow: hidden;
  backdrop-filter: blur(22px);
}

.practice-surface > *:not(.surface-ambient) {
  position: relative;
  z-index: 1;
}

.surface-ambient {
  position: absolute;
  inset: 0;
  background-image: url("./assets/ui/practice-flow-bg.png");
  background-position: center;
  background-size: cover;
  opacity: 0.24;
  filter: saturate(1.08);
  pointer-events: none;
}

.flow-line {
  height: 10px;
  padding: 2px;
  border: 1px solid rgba(14, 79, 67, 0.13);
  border-radius: 999px;
  background: rgba(226, 235, 230, 0.7);
  overflow: hidden;
}

.flow-line span {
  position: relative;
  display: block;
  width: 6%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(13, 117, 100, 0.95), rgba(87, 207, 184, 0.96) 58%, rgba(229, 163, 46, 0.96)),
    var(--primary);
  box-shadow: 0 0 22px rgba(42, 180, 155, 0.36);
  transition: width 420ms ease;
}

.flow-line span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  transform: translateX(-100%);
  animation: flowSweep 1900ms ease-in-out infinite;
}

.prompt-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-label,
.answer-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.prompt-text {
  min-height: 150px;
  margin: 0;
  display: flex;
  align-items: center;
  color: #07110f;
  font-size: 2.45rem;
  line-height: 1.35;
  font-weight: 850;
  letter-spacing: 0;
  text-wrap: balance;
  animation: promptIn 280ms ease both;
}

.mode-tabs {
  width: fit-content;
  min-height: 46px;
  padding: 4px;
  border: 1px solid rgba(20, 33, 29, 0.11);
  border-radius: 8px;
  background: rgba(230, 238, 234, 0.8);
  display: inline-grid;
  grid-template-columns: 104px 104px;
  gap: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.mode-tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.mode-tab:hover {
  transform: translateY(-1px);
}

.mode-tab.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 245, 0.96));
  color: var(--text);
  box-shadow:
    0 9px 18px rgba(20, 33, 29, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.answer-area {
  display: grid;
  gap: 10px;
}

.input-row {
  min-height: 64px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.answer-input {
  width: 100%;
  min-height: 64px;
  padding: 0 18px;
  border: 1px solid rgba(20, 33, 29, 0.16);
  border-radius: 8px;
  outline: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 249, 0.96));
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 10px 25px rgba(20, 33, 29, 0.06);
  font-size: 1.22rem;
  line-height: 1.2;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.answer-input:focus {
  border-color: rgba(13, 117, 100, 0.62);
  box-shadow:
    0 0 0 4px rgba(111, 213, 191, 0.22),
    0 14px 30px rgba(20, 33, 29, 0.08);
}

.mode-speech .input-row {
  grid-template-columns: 1fr 82px;
}

.mode-speech .answer-input {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 250, 247, 0.9));
}

.action-row {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button,
.secondary-button {
  padding: 0 18px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  border: 1px solid rgba(7, 82, 69, 0.74);
  background:
    linear-gradient(180deg, #13927c, #0b6b5a);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(8, 119, 97, 0.24);
}

.primary-button:hover {
  background:
    linear-gradient(180deg, #118871, #075245);
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.icon-button:active {
  transform: translateY(1px) scale(0.99);
}

.secondary-button {
  border: 1px solid rgba(20, 33, 29, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 246, 243, 0.9));
  color: var(--text);
}

.secondary-button:hover,
.text-button:hover,
.icon-button:hover {
  box-shadow: 0 12px 24px rgba(20, 33, 29, 0.08);
}

.text-button {
  min-width: 90px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.icon-button {
  width: 48px;
  min-width: 48px;
  padding: 0;
  border: 1px solid rgba(20, 33, 29, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 247, 244, 0.92));
  color: var(--text);
  box-shadow: 0 10px 22px rgba(20, 33, 29, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

.mic-button {
  position: relative;
  width: 78px;
  min-width: 78px;
  min-height: 78px;
  border: 0;
  border-radius: 50%;
  overflow: visible;
  background:
    linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0)),
    url("./assets/ui/voice-orb.png") center / cover no-repeat;
  color: #effffa;
  box-shadow:
    0 16px 34px rgba(6, 82, 70, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.86);
}

.mic-button::before {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(16, 177, 149, 0.32);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.86);
}

.mic-button::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.28), transparent 55%);
  pointer-events: none;
}

.mic-button:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 18px 38px rgba(6, 82, 70, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.9);
}

.mic-button.recording {
  color: #ffffff;
  animation: voicePress 1200ms ease-in-out infinite;
}

.mic-button.recording::before {
  animation: voiceRing 1200ms ease-out infinite;
}

.play-icon {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid currentColor;
}

.mic-icon {
  position: relative;
  z-index: 1;
  width: 15px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 10px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.28));
}

.mic-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 18px;
  height: 12px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  transform: translateX(-50%);
}

.mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -16px;
  width: 2px;
  height: 8px;
  background: currentColor;
  transform: translateX(-50%);
}

.speech-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.is-recording .speech-status {
  color: var(--primary-strong);
  font-weight: 800;
}

.is-transcribing .speech-status {
  color: var(--coral);
  font-weight: 800;
}

.feedback {
  position: relative;
  min-height: 118px;
  padding: 18px 20px;
  border: 1px solid rgba(20, 33, 29, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 251, 249, 0.86));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  align-self: end;
  overflow: hidden;
}

.feedback:empty {
  visibility: hidden;
}

.feedback.correct-feedback {
  border-color: rgba(13, 117, 100, 0.22);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.9)),
    url("./assets/ui/feedback-glow.png");
  background-position: center;
  background-size: cover;
  animation: correctLift 360ms ease both;
}

.feedback.wrong-feedback {
  border-color: rgba(162, 54, 54, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 246, 0.9));
}

.feedback-title {
  margin: 0 0 8px;
  font-weight: 900;
}

.feedback-title.correct {
  color: var(--success);
}

.feedback-title.wrong {
  color: var(--danger);
}

.feedback-answer {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.4;
  font-weight: 850;
}

.feedback-note {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.bottom-panel {
  min-height: 76px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--soft-shadow);
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(18px);
}

.stat {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.stat-value {
  min-height: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.hidden {
  display: none !important;
}

@keyframes flowSweep {
  0% {
    transform: translateX(-100%);
  }
  54%,
  100% {
    transform: translateX(130%);
  }
}

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

@keyframes correctLift {
  from {
    transform: translateY(4px);
    opacity: 0.72;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes voiceRing {
  0% {
    opacity: 0.7;
    transform: scale(0.86);
  }
  100% {
    opacity: 0;
    transform: scale(1.3);
  }
}

@keyframes voicePress {
  0%,
  100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.24) brightness(1.05);
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: 100%;
    padding: 14px 28px 14px 14px;
    gap: 12px;
  }

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

  .session-status {
    width: 100%;
    min-width: 96px;
    min-height: 44px;
    justify-items: start;
  }

  .practice-surface {
    min-height: calc(100vh - 176px);
    min-height: calc(100svh - 176px);
    padding: 18px;
    width: min(100%, calc(100vw - 52px));
    max-width: calc(100vw - 52px);
    gap: 17px;
  }

  .topbar,
  .bottom-panel {
    width: min(100%, calc(100vw - 52px));
    max-width: calc(100vw - 52px);
  }

  .prompt-row,
  .input-row,
  .action-row,
  .bottom-panel {
    min-width: 0;
  }

  .prompt-text {
    min-height: 130px;
    font-size: 1.82rem;
  }

  .mode-tabs {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .mode-speech .input-row {
    grid-template-columns: 1fr 74px;
  }

  .mic-button {
    width: 72px;
    min-width: 72px;
    min-height: 72px;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

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

  .text-button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .session-status {
    width: 100%;
    min-width: 0;
    justify-items: start;
  }

  h1 {
    font-size: 1.25rem;
  }

  .prompt-text {
    min-height: 112px;
    font-size: 1.52rem;
  }

  .answer-input {
    min-height: 58px;
    font-size: 1rem;
  }

  .practice-surface {
    padding: 14px;
    width: 100%;
    max-width: 100%;
  }

  .prompt-row,
  .input-row,
  .action-row,
  .bottom-panel {
    min-width: 0;
  }

  .icon-button {
    width: 44px;
    min-width: 44px;
  }

  .mic-button {
    width: 68px;
    min-width: 68px;
    min-height: 68px;
  }
}

@media (max-width: 520px) {
  .topbar,
  .practice-surface,
  .bottom-panel {
    width: 84vw;
    max-width: 84vw;
  }

  .prompt-row {
    padding-right: 38px;
  }
}

.conversation-surface {
  min-height: calc(100vh - 188px);
  min-height: calc(100svh - 188px);
  padding: 22px;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 14px;
}

.conversation-top {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conversation-stream {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}

.message-card {
  position: relative;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 20px 22px;
  border: 1px solid rgba(20, 33, 29, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 14px 34px rgba(20, 33, 29, 0.08);
  backdrop-filter: blur(18px);
}

.message-role {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.conversation-surface .prompt-text {
  min-height: 0;
  display: block;
  font-size: 2.28rem;
  line-height: 1.34;
}

.voice-stage {
  min-height: 250px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
}

.voice-stage .mic-button {
  width: 190px;
  min-width: 190px;
  min-height: 190px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 30px 80px rgba(6, 82, 70, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.9);
}

.voice-stage .mic-button::before {
  inset: -18px;
  border-color: rgba(16, 177, 149, 0.26);
}

.voice-stage .mic-button::after {
  inset: 22px;
}

.voice-stage .mic-icon {
  width: 21px;
  height: 30px;
  border-width: 3px;
}

.voice-stage .mic-icon::before {
  bottom: -14px;
  width: 28px;
  height: 17px;
  border-width: 3px;
}

.voice-stage .mic-icon::after {
  bottom: -25px;
  width: 3px;
  height: 12px;
}

.mode-speech .voice-stage .mic-button {
  display: inline-flex !important;
}

.mode-text .voice-stage {
  min-height: 86px;
}

.mode-text .voice-stage .mic-button {
  display: none !important;
}

.mode-speech .answer-area {
  width: min(100%, 760px);
  margin: 0 auto;
  display: none;
}

.mode-speech .answer-label {
  display: none;
}

.mode-speech .answer-input {
  min-height: 54px;
  border-radius: 999px;
  text-align: center;
  font-weight: 800;
}

.mode-speech .answer-input:placeholder-shown {
  color: var(--muted);
}

.mode-speech .action-row {
  display: none;
}

.mode-text .answer-area {
  width: min(100%, 760px);
  margin: 0 auto;
}

.conversation-surface .mode-tabs {
  justify-self: center;
}

.conversation-surface .feedback {
  width: min(100%, 760px);
  min-height: 92px;
  margin: 0 auto;
}

.conversation-surface .feedback:empty {
  min-height: 0;
  padding: 0;
  border: 0;
}

.is-recording .voice-stage .mic-button {
  box-shadow:
    0 34px 90px rgba(6, 82, 70, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.92),
    0 0 70px rgba(45, 214, 183, 0.32);
}

.is-transcribing .voice-stage .mic-button {
  filter: saturate(0.92) brightness(1.05);
}

.is-correct .voice-stage .mic-button {
  animation: correctPulse 720ms ease both;
}

@keyframes correctPulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.045);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 720px) {
  .conversation-surface {
    min-height: calc(100vh - 206px);
    min-height: calc(100svh - 206px);
    padding: 16px;
  }

  .topbar,
  .practice-surface,
  .bottom-panel {
    width: 100%;
    max-width: 100%;
  }

  .conversation-surface .prompt-text {
    font-size: 1.82rem;
  }

  .message-card {
    padding: 18px;
  }

  .voice-stage {
    min-height: 230px;
  }

  .voice-stage .mic-button {
    width: 162px;
    min-width: 162px;
    min-height: 162px;
  }

  .conversation-surface .feedback {
    min-height: 82px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: calc(100vw - 28px);
    margin-left: 14px;
    margin-right: auto;
    padding: 14px 0;
  }

  .topbar,
  .practice-surface,
  .bottom-panel {
    width: 100%;
    max-width: 100%;
  }

  .conversation-top {
    padding-right: 0;
  }

  .conversation-top .icon-button {
    display: none;
  }

  .conversation-surface .prompt-text {
    font-size: 1.48rem;
  }

  .voice-stage {
    min-height: 206px;
  }

  .voice-stage .mic-button {
    width: 138px;
    min-width: 138px;
    min-height: 138px;
  }

  .mode-tabs {
    min-height: 42px;
  }

  .mode-speech .answer-input {
    min-height: 50px;
    font-size: 0.98rem;
  }
}

body {
  background: #000000;
  color: #f7f7f4;
}

body::before {
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.08), transparent 28%),
    radial-gradient(circle at 50% 72%, rgba(255, 70, 70, 0.1), transparent 34%),
    #000000;
  opacity: 1;
  transform: none;
}

body::after {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 36%),
    radial-gradient(circle at 50% 50%, transparent 0 52%, rgba(0, 0, 0, 0.48) 100%);
}

.app-shell {
  width: min(100%, 620px);
  height: 100vh;
  height: 100svh;
  min-height: 0;
  padding: 18px 18px 16px;
  gap: 12px;
}

.topbar {
  min-height: 50px;
  align-items: center;
}

.eyebrow {
  color: rgba(255, 255, 255, 0.66);
}

h1 {
  color: #ffffff;
  font-size: 1.26rem;
}

.session-status {
  min-width: 82px;
  min-height: 40px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  box-shadow: none;
  backdrop-filter: blur(20px);
}

.session-status-label {
  color: rgba(255, 255, 255, 0.52);
}

.conversation-surface {
  min-height: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #000000;
  box-shadow:
    0 34px 80px rgba(0, 0, 0, 0.56),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  backdrop-filter: none;
}

.surface-ambient {
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.08), transparent 24%),
    radial-gradient(circle at 50% 72%, rgba(255, 42, 42, 0.14), transparent 32%),
    #000000;
  opacity: 1;
}

.flow-line {
  height: 4px;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
}

.flow-line span {
  background: linear-gradient(90deg, #c3c3c3, #ffffff 62%, #ff3434);
  box-shadow: 0 0 20px rgba(255, 58, 58, 0.35);
}

.conversation-top {
  min-height: 34px;
}

.prompt-label,
.answer-label,
.message-role,
.stat-label {
  color: rgba(255, 255, 255, 0.54);
}

.conversation-top .icon-button {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.86);
  box-shadow: none;
}

.conversation-stream {
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}

.message-card {
  width: min(100%, 480px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  text-align: center;
}

.conversation-surface .prompt-text {
  color: #ff4a4a;
  font-size: clamp(1.7rem, 5vw, 2.45rem);
  line-height: 1.28;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
  text-wrap: balance;
}

.voice-stage {
  min-height: clamp(260px, 42vh, 360px);
  gap: 20px;
}

.voice-stage .mic-button {
  width: min(58vw, 300px);
  min-width: min(58vw, 300px);
  min-height: min(58vw, 300px);
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: #151050;
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.06),
    0 0 58px rgba(255, 255, 255, 0.16),
    0 0 110px rgba(255, 55, 55, 0.12);
  overflow: visible;
  animation: faceIdle 5200ms ease-in-out infinite;
}

.voice-stage .mic-button::before {
  inset: -8%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  opacity: 0.8;
  border-radius: 50%;
}

.voice-stage .mic-button::after,
.voice-stage .mic-icon {
  display: none;
}

.smile-face {
  position: absolute;
  inset: 0;
  display: block;
  border: 8px solid #151050;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 -14px 24px rgba(21, 16, 80, 0.05);
}

.face-eyes {
  position: absolute;
  left: 50%;
  top: 34%;
  width: 38%;
  height: 20%;
  transform: translateX(-50%);
}

.face-features {
  position: absolute;
  inset: 0;
  transform-origin: center;
  animation: lookAroundTogether 6200ms ease-in-out infinite;
}

.face-eye {
  position: absolute;
  top: 0;
  width: 18%;
  height: 68%;
  border-radius: 999px;
  background: #151050;
  transform-origin: center;
  animation: blink 6200ms ease-in-out infinite;
}

.left-eye {
  left: 8%;
}

.right-eye {
  right: 8%;
}

.face-mouth {
  position: absolute;
  left: 50%;
  top: 47%;
  width: 56%;
  height: 30%;
  border: 7px solid #151050;
  border-top: 0;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
  transition:
    border-radius 180ms ease,
    height 180ms ease,
    width 180ms ease,
    transform 180ms ease;
}

.thinking-dots {
  position: absolute;
  left: 50%;
  top: 58%;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  transform: translateX(-50%);
}

.thinking-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #151050;
  opacity: 0.35;
  animation: thinkingDot 900ms ease-in-out infinite;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 240ms;
}

.mic-button:hover {
  transform: scale(1.012);
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.07),
    0 0 70px rgba(255, 255, 255, 0.2),
    0 0 130px rgba(255, 55, 55, 0.16);
}

.mic-button.recording {
  animation: nodListen 1000ms ease-in-out infinite;
}

.mic-button.recording::before {
  animation: voiceRing 1300ms ease-out infinite;
}

.mic-button.recording .face-eyes {
  animation: none;
}

.mic-button.recording .face-eye {
  height: 8%;
  top: 26%;
  border-radius: 999px;
  animation: none;
}

.mic-button.recording .face-mouth {
  top: 48%;
  width: 48%;
  height: 23%;
  border-width: 6px;
}

.is-transcribing .smile-face {
  background: #ffffff;
}

.is-transcribing .face-eyes {
  animation: none;
}

.is-transcribing .face-eye {
  top: 10%;
  width: 15%;
  height: 15%;
  border-radius: 50%;
  animation: thinkingEyes 900ms ease-in-out infinite;
}

.is-transcribing .face-mouth {
  top: 54%;
  width: 30%;
  height: 0;
  border-width: 6px;
  border-left-color: transparent;
  border-right-color: transparent;
  border-bottom: 0;
  border-radius: 999px;
}

.is-transcribing .thinking-dots {
  display: grid;
}

.mode-chunks .voice-stage .mic-button.listening {
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.07),
    0 0 70px rgba(255, 255, 255, 0.2),
    0 0 130px rgba(255, 55, 55, 0.16);
  animation: nodListen 1000ms ease-in-out infinite;
}

.mode-chunks .voice-stage .mic-button.listening::before {
  animation: voiceRing 1300ms ease-out infinite;
}

.mode-chunks .voice-stage .mic-button.listening .face-features,
.mode-chunks .voice-stage .mic-button.listening .face-eyes {
  animation: none;
}

.mode-chunks .voice-stage .mic-button.listening .face-eye {
  top: 26%;
  height: 8%;
  border-radius: 999px;
  animation: none;
}

.mode-chunks .voice-stage .mic-button.listening .face-mouth {
  top: 48%;
  width: 48%;
  height: 23%;
  border-width: 6px;
}

.mode-chunks .voice-stage .mic-button.listening .thinking-dots {
  display: none;
}

.is-correct .smile-face {
  box-shadow:
    inset 0 -14px 24px rgba(21, 16, 80, 0.05),
    0 0 42px rgba(255, 255, 255, 0.34);
}

.is-correct .face-mouth {
  width: 62%;
  height: 34%;
}

.speech-status {
  min-height: 22px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.is-recording .speech-status,
.is-transcribing .speech-status {
  color: #ffffff;
}

.conversation-surface .mode-tabs {
  min-height: 44px;
  padding: 5px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  grid-template-columns: 108px 108px;
  box-shadow: none;
}

.mode-tab {
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.54);
}

.mode-tab.active {
  background: rgba(255, 255, 255, 0.92);
  color: #050505;
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.1);
}

.mode-text .answer-area {
  width: min(100%, 480px);
}

.mode-speech .answer-area,
.mode-speech.has-transcript .answer-area {
  display: none !important;
}

.mode-speech.is-transcribing .conversation-surface .mode-tabs,
.mode-speech.is-correct .conversation-surface .mode-tabs,
.mode-speech.is-wrong .conversation-surface .mode-tabs {
  display: none;
}

.mode-speech.is-transcribing .voice-stage,
.mode-speech.is-correct .voice-stage,
.mode-speech.is-wrong .voice-stage {
  min-height: clamp(180px, 30vh, 250px);
}

.mode-speech.is-transcribing .voice-stage .mic-button,
.mode-speech.is-correct .voice-stage .mic-button,
.mode-speech.is-wrong .voice-stage .mic-button {
  width: min(44vw, 220px);
  min-width: min(44vw, 220px);
  min-height: min(44vw, 220px);
}

.answer-input {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  box-shadow: none;
}

.answer-input:focus {
  border-color: rgba(255, 255, 255, 0.44);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.primary-button {
  border-color: #ffffff;
  background: #ffffff;
  color: #000000;
  box-shadow: none;
}

.primary-button:hover {
  background: #eeeeee;
}

.secondary-button,
.text-button {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.84);
}

.conversation-surface .feedback {
  width: min(100%, 480px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  box-shadow: none;
}

.feedback.correct-feedback {
  border-color: rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at 50% 100%, rgba(255, 64, 64, 0.18), transparent 68%),
    rgba(255, 255, 255, 0.08);
}

.feedback.wrong-feedback {
  border-color: rgba(255, 71, 71, 0.34);
  background: rgba(255, 47, 47, 0.1);
}

.feedback-title.correct,
.feedback-title.wrong {
  color: #ffffff;
}

.feedback-note {
  color: rgba(255, 255, 255, 0.62);
}

.bottom-panel {
  min-height: 62px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  box-shadow: none;
  backdrop-filter: blur(18px);
}

.stat-value {
  color: #ffffff;
}

@keyframes blobIdle {
  0%,
  100% {
    border-radius: 43% 57% 52% 48% / 46% 45% 55% 54%;
    transform: scale(1);
  }
  33% {
    border-radius: 52% 48% 43% 57% / 52% 58% 42% 48%;
    transform: scale(1.025);
  }
  66% {
    border-radius: 48% 52% 58% 42% / 44% 50% 50% 56%;
    transform: scale(0.985);
  }
}

@keyframes blobListen {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.15);
  }
}

@keyframes faceIdle {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  30% {
    transform: translateY(-3px) rotate(-1.4deg);
  }
  62% {
    transform: translateY(2px) rotate(1.2deg);
  }
}

@keyframes lookAround {
  0%,
  18%,
  100% {
    transform: translateX(-50%);
  }
  32%,
  46% {
    transform: translateX(-57%);
  }
  66%,
  78% {
    transform: translateX(-43%);
  }
}

@keyframes blink {
  0%,
  8%,
  10%,
  52%,
  54%,
  100% {
    transform: scaleY(1);
  }
  9%,
  53% {
    transform: scaleY(0.08);
  }
}

@keyframes nodListen {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  46% {
    transform: translateY(10px) rotate(1.8deg);
  }
  72% {
    transform: translateY(-2px) rotate(-0.8deg);
  }
}

@keyframes thinkingDot {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

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

@media (max-width: 520px) {
  .app-shell {
    width: 100%;
    height: 100vh;
    height: 100svh;
    margin: 0;
    padding: 14px;
  }

  .topbar,
  .practice-surface,
  .bottom-panel {
    width: 100%;
    max-width: 100%;
  }

  .topbar {
    min-height: 54px;
  }

  h1 {
    font-size: 1.22rem;
  }

  .conversation-surface {
    padding: 18px;
    gap: 12px;
  }

  .conversation-surface .prompt-text {
    font-size: 1.5rem;
  }

  .conversation-stream {
    gap: 8px;
  }

  .voice-stage {
    min-height: clamp(260px, 42vh, 340px);
  }

  .voice-stage .mic-button {
    width: min(64vw, 230px);
    min-width: min(64vw, 230px);
    min-height: min(64vw, 230px);
  }

  .conversation-surface .mode-tabs {
    width: min(100%, 260px);
    grid-template-columns: 1fr 1fr;
  }

  .mode-tab.active {
    color: #000000;
  }

  .mode-tab {
    color: rgba(255, 255, 255, 0.7);
  }
}

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

/* Focused voice-practice layout */
.topbar,
.bottom-panel,
.flow-line,
.conversation-top {
  display: none !important;
}

.app-shell {
  width: min(100%, 620px);
  height: 100vh;
  height: 100svh;
  min-height: 0;
  padding: 12px;
  display: grid;
  grid-template-rows: 1fr;
}

.conversation-surface {
  min-height: 0;
  height: 100%;
  padding: 18px;
  display: grid;
  grid-template-rows: 1fr;
}

.conversation-stream {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: center;
  align-items: center;
  gap: clamp(16px, 3vh, 34px);
}

.conversation-surface .mode-tabs {
  display: none !important;
}

.voice-stage {
  min-height: 0;
  align-self: center;
  gap: 12px;
}

.voice-stage .mic-button {
  width: min(62vw, 292px);
  min-width: min(62vw, 292px);
  min-height: min(62vw, 292px);
}

.practice-copy {
  width: min(100%, 520px);
  margin: 0 auto;
  display: grid;
  gap: 10px;
  align-self: start;
  text-align: center;
}

.practice-copy .prompt-label,
.message-role {
  display: none;
}

.prompt-meta {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  justify-self: center;
  max-width: 100%;
}

.prompt-category-label {
  max-width: min(72vw, 230px);
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.conversation-surface .prompt-text {
  margin: 0;
  color: #ff5555;
  font-size: clamp(1.55rem, 5.4vw, 2.3rem);
  line-height: 1.22;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
}

.user-transcript {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  white-space: pre-wrap;
}

.user-transcript .wrong-token {
  color: #ff6b6b;
  text-decoration: underline;
  text-decoration-color: rgba(255, 107, 107, 0.8);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.user-transcript .missing-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3em;
  min-width: 2.3em;
  min-height: 1.55em;
  padding: 1px 8px 2px;
  border: 1px dashed rgba(255, 209, 102, 0.85);
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.14);
  color: transparent;
  line-height: 1;
  vertical-align: 0.08em;
}

.answer-reveal {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #070707;
  cursor: pointer;
  font-size: 1.08rem;
  font-weight: 900;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

.answer-reveal.revealed {
  background: #ffffff;
  color: #0d2b19;
}

.practice-copy > .problem-feedback.hidden {
  display: none !important;
}

.problem-feedback {
  width: 100%;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.problem-feedback-button {
  width: 40px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
  touch-action: manipulation;
}

.problem-feedback-button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.problem-feedback-button.is-selected,
.problem-feedback-button[aria-pressed="true"] {
  border-color: rgba(255, 255, 255, 0.72);
  background: #ffffff;
  color: #070707;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
}

.problem-feedback-button.is-pulsing {
  animation: problemFeedbackPulse 420ms ease both;
}

.problem-feedback-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.conversation-surface .feedback {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.feedback-title {
  margin: 0 0 3px;
  font-size: 0.9rem;
}

.feedback-note {
  margin: 0;
  font-size: 0.82rem;
}

.mode-speech .answer-area,
.mode-speech.has-transcript .answer-area {
  display: none !important;
}

.mode-speech.is-transcribing .conversation-surface .mode-tabs,
.mode-speech.is-correct .conversation-surface .mode-tabs,
.mode-speech.is-wrong .conversation-surface .mode-tabs {
  display: none;
}

.mode-speech.is-transcribing .voice-stage,
.mode-speech.is-correct .voice-stage,
.mode-speech.is-wrong .voice-stage {
  align-self: center;
}

.mode-speech.is-transcribing .voice-stage .mic-button,
.mode-speech.is-correct .voice-stage .mic-button,
.mode-speech.is-wrong .voice-stage .mic-button {
  width: min(48vw, 210px);
  min-width: min(48vw, 210px);
  min-height: min(48vw, 210px);
}

.mode-speech.is-correct .speech-status,
.mode-speech.is-wrong .speech-status {
  display: none;
}

.lesson-word-counter {
  position: absolute !important;
  right: 14px;
  top: 14px;
  z-index: 5 !important;
  min-width: 98px;
  min-height: 38px;
  padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: none;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.lesson-word-label {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

.lesson-word-value {
  color: #ffffff;
  font-size: 1.06rem;
  font-weight: 950;
  line-height: 1;
  transform-origin: center;
}

.lesson-word-counter.is-bumping {
  border-color: rgba(255, 85, 85, 0.58);
  background: rgba(255, 85, 85, 0.2);
  box-shadow:
    0 0 0 1px rgba(255, 85, 85, 0.14),
    0 0 34px rgba(255, 85, 85, 0.22);
}

.lesson-word-counter.is-bumping .lesson-word-value {
  animation: lessonWordBump 460ms ease both;
}

.practice-surface.is-lesson-gaining .voice-stage .mic-button::before {
  animation: lessonGainRing 1380ms ease both;
}

.practice-surface.is-lesson-gaining .voice-stage .mic-button {
  box-shadow:
    0 0 0 8px rgba(255, 85, 85, 0.1),
    0 0 72px rgba(255, 85, 85, 0.22),
    0 0 128px rgba(255, 55, 55, 0.18);
}

.lesson-finish-button {
  position: absolute !important;
  left: 50%;
  bottom: 18px;
  z-index: 6 !important;
  width: min(calc(100% - 36px), 360px);
  min-height: 54px;
  padding: 0 22px;
  border: 1px solid rgba(255, 85, 85, 0.72);
  border-radius: 999px;
  background: #ff5555;
  color: #ffffff;
  cursor: pointer;
  box-shadow:
    0 18px 42px rgba(255, 61, 61, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-weight: 950;
  transform: translateX(-50%);
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.lesson-finish-button:hover {
  background: #ff4545;
  box-shadow:
    0 22px 54px rgba(255, 61, 61, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateX(-50%) translateY(-1px);
}

.lesson-finish-button:active {
  transform: translateX(-50%) translateY(1px);
}

.mic-button.recording .face-features,
.is-transcribing .face-features,
.is-wrong .face-features {
  animation: none;
}

.is-correct .voice-stage .mic-button {
  animation: correctNod 1300ms ease-in-out infinite;
}

.is-correct .face-features {
  animation: correctFace 1300ms ease-in-out infinite;
}

.is-correct .face-eye {
  animation: correctEyes 1300ms ease-in-out infinite;
}

.is-correct .face-mouth {
  animation: correctMouth 1300ms ease-in-out infinite;
}

.is-correct .smile-face {
  border-color: #106b39;
  background: #f4fff7;
  box-shadow:
    inset 0 -14px 24px rgba(16, 107, 57, 0.06),
    0 0 46px rgba(80, 255, 153, 0.22);
}

.is-correct .face-eye,
.is-correct .thinking-dots span {
  background: #106b39;
}

.is-correct .face-mouth {
  border-color: #106b39;
  border-top: 0;
  border-left-color: transparent;
  border-right-color: transparent;
}

.is-wrong .smile-face {
  border-color: #c84545;
  background: #fff5f5;
  box-shadow:
    inset 0 -14px 24px rgba(200, 69, 69, 0.06),
    0 0 46px rgba(255, 75, 75, 0.18);
}

.is-wrong .face-eye,
.is-wrong .thinking-dots span {
  background: #c84545;
}

.is-wrong .face-mouth {
  top: 58%;
  width: 34%;
  height: 0;
  border-color: #c84545;
  border-bottom: 0;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 999px;
}

.is-wrong .answer-reveal {
  border-color: rgba(255, 92, 92, 0.5);
  background: rgba(255, 92, 92, 0.14);
  color: #ffffff;
}

@keyframes mouthLookAround {
  0%,
  18%,
  100% {
    transform: translateX(-50%);
  }
  32%,
  46% {
    transform: translateX(-54%);
  }
  66%,
  78% {
    transform: translateX(-46%);
  }
}

@keyframes lookAroundTogether {
  0%,
  18%,
  100% {
    transform: translateX(0);
  }
  32%,
  46% {
    transform: translateX(-6%);
  }
  66%,
  78% {
    transform: translateX(6%);
  }
}

@keyframes correctNod {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  28% {
    transform: translateY(-6px) scale(1.035);
  }
  58% {
    transform: translateY(7px) scale(0.99);
  }
}

@keyframes correctFace {
  0%,
  100% {
    transform: translateY(0);
  }
  36% {
    transform: translateY(-2%);
  }
  64% {
    transform: translateY(3%);
  }
}

@keyframes correctEyes {
  0%,
  100% {
    transform: scaleY(1);
  }
  42% {
    transform: scaleY(0.42);
  }
}

@keyframes correctMouth {
  0%,
  100% {
    transform: translateX(-50%) scaleX(1) scaleY(1);
  }
  36% {
    transform: translateX(-50%) scaleX(1.08) scaleY(1.06);
  }
  64% {
    transform: translateX(-50%) scaleX(0.96) scaleY(0.92);
  }
}

@keyframes lessonWordBump {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.24);
  }
  56% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes lessonGainRing {
  0% {
    opacity: 0.64;
    transform: scale(1);
  }
  42% {
    opacity: 1;
    transform: scale(1.08);
    border-color: rgba(255, 85, 85, 0.52);
  }
  100% {
    opacity: 0.8;
    transform: scale(1);
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: 100%;
    margin: 0;
    padding: 10px;
  }

  .conversation-surface {
    padding: 14px;
  }

  .conversation-stream {
    grid-template-rows: auto auto auto;
    align-content: center;
    gap: 18px;
  }

  .voice-stage .mic-button {
    width: min(70vw, 250px);
    min-width: min(70vw, 250px);
    min-height: min(70vw, 250px);
  }

  .mode-speech.is-transcribing .voice-stage .mic-button,
  .mode-speech.is-correct .voice-stage .mic-button,
  .mode-speech.is-wrong .voice-stage .mic-button {
    width: min(44vw, 174px);
    min-width: min(44vw, 174px);
    min-height: min(44vw, 174px);
  }

  .conversation-surface .prompt-text {
    font-size: 1.36rem;
  }

  .user-transcript {
    padding: 9px 12px;
    font-size: 0.98rem;
  }

  .answer-reveal {
    min-height: 50px;
    font-size: 1rem;
  }
}

/* Stable voice layout: states should not resize or move the practice target. */
.conversation-surface {
  --smile-size: min(62vw, 292px);
  --voice-stage-height: calc(var(--smile-size) + 38px);
}

.voice-stage,
.mode-speech.is-recording .voice-stage,
.mode-speech.is-transcribing .voice-stage,
.mode-speech.is-correct .voice-stage,
.mode-speech.is-wrong .voice-stage {
  height: var(--voice-stage-height);
  min-height: var(--voice-stage-height) !important;
  align-self: center;
}

.voice-stage .mic-button,
.mode-speech.is-recording .voice-stage .mic-button,
.mode-speech.is-transcribing .voice-stage .mic-button,
.mode-speech.is-correct .voice-stage .mic-button,
.mode-speech.is-wrong .voice-stage .mic-button {
  width: var(--smile-size);
  min-width: var(--smile-size);
  min-height: var(--smile-size);
}

.practice-copy {
  min-height: clamp(196px, 24vh, 236px);
  grid-template-rows: 24px minmax(58px, auto) minmax(42px, auto) 54px 40px;
  align-content: start;
}

.practice-copy > .hidden {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.conversation-surface .prompt-text {
  min-height: 2.55em;
  display: grid;
  place-items: center;
  animation: none;
}

.conversation-surface .prompt-text.is-long-text {
  min-height: 3.05em;
  font-size: clamp(1.34rem, 4.6vw, 1.92rem);
  line-height: 1.2;
}

.conversation-surface .prompt-text.is-very-long-text {
  min-height: 3.55em;
  font-size: clamp(1.14rem, 4vw, 1.58rem);
  line-height: 1.18;
}

.user-transcript {
  min-height: 42px;
  display: block;
}

.answer-reveal {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.answer-reveal.is-long-text {
  padding-inline: 16px;
  font-size: 0.96rem;
}

.answer-reveal.is-very-long-text {
  padding-inline: 14px;
  font-size: 0.88rem;
  line-height: 1.12;
}

.conversation-surface .feedback,
.conversation-surface .feedback:empty {
  min-height: 40px;
}

.conversation-surface .feedback:empty {
  visibility: hidden;
  padding: 0;
  border: 0;
}

@media (max-width: 520px) {
  .conversation-surface {
    --smile-size: min(62vw, 230px);
    --voice-stage-height: calc(var(--smile-size) + 30px);
  }

  .practice-copy {
    min-height: 0;
    max-height: min(40svh, 270px);
    grid-template-rows: 24px minmax(52px, auto) minmax(40px, auto) 50px 38px;
  }

  .answer-reveal {
    height: 50px;
  }

  .conversation-surface .prompt-text.is-long-text {
    font-size: clamp(1.18rem, 4.8vw, 1.42rem);
  }

  .conversation-surface .prompt-text.is-very-long-text {
    font-size: clamp(1.02rem, 4.5vw, 1.2rem);
  }
}

.conversation-surface {
  padding-bottom: 92px;
  overflow: hidden;
}

.conversation-stream {
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  align-content: safe center;
  padding-bottom: 4px;
}

.practice-copy {
  min-height: 0;
  max-height: min(42svh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.conversation-surface .prompt-text {
  max-height: 7.2em;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.speech-status {
  max-width: min(100%, 520px);
  overflow-wrap: anywhere;
}

.user-transcript {
  max-height: 5.4em;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.quiet-start-button {
  justify-self: start;
  width: fit-content;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  touch-action: manipulation;
}

.quiet-start-button:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.13);
}

.input-mode-control {
  position: absolute !important;
  left: 16px;
  top: 14px;
  z-index: 5 !important;
  min-width: 86px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(34, 31, 36, 0.96), rgba(18, 17, 20, 0.94));
  color: #ffffff;
  display: inline-grid;
  grid-template-columns: 40px 36px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 950;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 26px rgba(0, 0, 0, 0.24);
  touch-action: manipulation;
  backdrop-filter: blur(16px);
}

.input-mode-control:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, rgba(42, 39, 45, 0.98), rgba(22, 21, 25, 0.96));
}

.input-mode-svg {
  width: 25px;
  height: 25px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-mode-svg-speech {
  width: 32px;
  height: 30px;
  stroke-width: 2.45;
}

.input-mode-svg-chunks {
  stroke-width: 3.2;
}

.input-mode-svg-speech .input-mode-eye {
  fill: currentColor;
  stroke: none;
}

.input-mode-option {
  width: 36px;
  min-width: 36px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 950;
  line-height: 1;
  touch-action: manipulation;
}

.input-mode-option[data-input-mode="speech"] {
  width: 40px;
  min-width: 40px;
}

.input-mode-option.is-active,
.input-mode-option[aria-pressed="true"] {
  background: #f7f4ef;
  color: #141112;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

.input-mode-option:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.82);
  outline-offset: 2px;
}

.input-mode-control.home-input-mode-control {
  position: static !important;
  left: auto;
  top: auto;
  width: fit-content;
  min-width: 90px;
  justify-self: start;
  min-height: 42px;
}

body.mode-chunks .practice-copy {
  grid-template-rows: 24px minmax(58px, auto) minmax(42px, auto) minmax(108px, auto) 54px 40px;
}

.chunk-builder {
  width: 100%;
  min-height: 108px;
  margin: 0 auto;
  display: grid;
  gap: 8px;
  align-content: center;
}

.chunk-builder.hidden {
  display: none !important;
}

.chunk-answer {
  display: none !important;
}

.chunk-builder.is-cloze .chunk-answer {
  display: none !important;
}

.user-transcript.is-cloze-answer {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: normal;
}

.chunk-answer-token {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
}

.chunk-answer-token.is-blank {
  min-width: 54px;
  justify-content: center;
  padding: 0 8px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.55);
  color: rgba(255, 255, 255, 0.72);
}

.chunk-answer-token.is-filled {
  border-bottom-color: rgba(255, 255, 255, 0.9);
  color: #ffffff;
}

.chunk-answer-token.is-punctuation {
  margin-left: -3px;
}

.user-transcript.is-long-text {
  font-size: 0.96rem;
  line-height: 1.28;
}

.user-transcript.is-very-long-text {
  font-size: 0.88rem;
  line-height: 1.22;
}

.chunk-options {
  min-height: 52px;
  max-height: 118px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 8px;
  padding: 2px 4px;
}

.chunk-chip {
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #080808;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.05;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  touch-action: manipulation;
}

.chunk-chip:hover:not(:disabled) {
  transform: translateY(-1px);
}

.chunk-chip.used {
  opacity: 0.28;
  transform: none;
}

.chunk-actions {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.chunk-action-button {
  min-width: 72px;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 900;
}

.chunk-action-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.mode-chunks .voice-stage .mic-button,
.mode-chunks.is-correct .voice-stage .mic-button,
.mode-chunks.is-wrong .voice-stage .mic-button {
  width: var(--smile-size);
  min-width: var(--smile-size);
  min-height: var(--smile-size);
}

@media (max-width: 520px) {
  body.mode-chunks .practice-copy {
    grid-template-rows: 24px minmax(52px, auto) minmax(40px, auto) minmax(104px, auto) 50px 38px;
  }

  .conversation-surface {
    padding-bottom: 84px;
  }

  .lesson-word-counter {
    right: 12px;
    top: 12px;
    min-width: 92px;
    min-height: 36px;
    padding: 5px 9px;
  }

  .lesson-word-label {
    font-size: 0.66rem;
  }

  .lesson-word-value {
    font-size: 0.98rem;
  }

  .lesson-finish-button {
    bottom: 14px;
    width: calc(100% - 28px);
    min-height: 50px;
  }

  .quiet-start-button {
    min-height: 44px;
    padding: 0 17px;
  }

  .input-mode-control {
    left: 14px;
    top: 12px;
    min-width: 88px;
    min-height: 42px;
    padding: 4px;
    grid-template-columns: 39px 35px;
    gap: 3px;
  }

  .input-mode-option {
    width: 35px;
    min-width: 35px;
    min-height: 34px;
  }

  .input-mode-option[data-input-mode="speech"] {
    width: 39px;
    min-width: 39px;
  }

  .chunk-builder {
    min-height: 104px;
    gap: 7px;
  }

  .chunk-options {
    min-height: 50px;
    max-height: 112px;
    gap: 8px;
  }

  .chunk-chip {
    min-height: 44px;
    padding: 0 14px;
    font-size: 0.84rem;
  }
}

@media (max-width: 360px) {
  .input-mode-control:not(.home-input-mode-control) {
    left: 10px;
    min-width: 88px;
  }
}

@media (max-height: 720px) {
  .app-shell {
    padding: 10px;
  }

  .conversation-surface {
    --smile-size: min(54vw, 212px);
    --voice-stage-height: calc(var(--smile-size) + 24px);
    padding: 12px 14px 82px;
  }

  .conversation-stream {
    gap: clamp(8px, 1.8vh, 14px);
  }

  .practice-copy {
    max-height: min(39svh, 250px);
    gap: 8px;
    grid-template-rows: 24px minmax(56px, auto) minmax(34px, auto) 46px 32px;
  }

  .conversation-surface .prompt-text {
    font-size: clamp(1.16rem, 4.3vw, 1.56rem);
    line-height: 1.18;
    text-underline-offset: 5px;
  }

  .conversation-surface .prompt-text.is-long-text {
    min-height: 2.7em;
    font-size: clamp(1.04rem, 4vw, 1.28rem);
  }

  .conversation-surface .prompt-text.is-very-long-text {
    min-height: 3em;
    font-size: clamp(0.94rem, 3.7vw, 1.08rem);
  }

  .speech-status {
    min-height: 18px;
    font-size: 0.78rem;
  }

  .user-transcript {
    min-height: 34px;
    max-height: 4.25em;
    padding: 8px 12px;
    font-size: 0.96rem;
  }

  .lesson-finish-button {
    bottom: 14px;
    min-height: 52px;
  }

  body.mode-chunks .practice-copy {
    grid-template-rows: 24px minmax(56px, auto) minmax(34px, auto) minmax(96px, auto) 46px 32px;
  }

  .chunk-builder {
    min-height: 96px;
  }
}

@media (max-height: 640px) {
  .conversation-surface {
    --smile-size: min(48vw, 184px);
    --voice-stage-height: calc(var(--smile-size) + 20px);
    padding-bottom: 76px;
  }

  .practice-copy {
    max-height: min(38svh, 220px);
  }
}

/* Home screen */
body.view-home {
  background: #000000;
  color: #ffffff;
}

body.view-summary {
  background: #000000;
  color: #ffffff;
}

body.view-history {
  background: #000000;
  color: #ffffff;
}

body.view-admin {
  background: #000000;
  color: #ffffff;
}

body.auth-checking,
body.view-auth {
  background: #000000;
  color: #ffffff;
}

body.auth-checking .app-shell,
body.view-auth .app-shell,
body:not(.auth-checking):not(.view-auth) .auth-screen {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  min-height: 100svh;
  padding: 22px;
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(100%, 420px);
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  box-shadow:
    0 34px 80px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-smile {
  position: relative;
  width: 82px;
  height: 82px;
  margin-bottom: 22px;
}

.auth-smile .smile-face {
  border-width: 5px;
}

.auth-smile .face-mouth {
  border-width: 5px;
  border-top: 0;
  border-left-color: transparent;
  border-right-color: transparent;
}

.auth-form {
  margin-top: 22px;
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 7px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
  font-weight: 900;
}

.auth-field input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 1rem;
}

.auth-field input:focus {
  border-color: rgba(255, 255, 255, 0.46);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.auth-submit {
  min-height: 54px;
  border: 1px solid rgba(255, 85, 85, 0.7);
  border-radius: 999px;
  background: #ff5555;
  color: #ffffff;
  cursor: pointer;
  font-weight: 950;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.6;
}

.auth-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.86rem;
  font-weight: 800;
}

body.view-home .app-shell {
  grid-template-rows: 1fr;
}

body.view-summary .app-shell {
  grid-template-rows: 1fr;
}

body.view-history .app-shell {
  grid-template-rows: 1fr;
}

body.view-admin .app-shell {
  grid-template-rows: 1fr;
}

.lesson-summary-screen {
  min-height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
}

.history-screen,
.admin-screen {
  min-height: 0;
  height: 100%;
  display: none;
  overflow: hidden auto;
}

.view-summary .topbar,
.view-summary .home-screen,
.view-summary .history-screen,
.view-summary .admin-screen,
.view-summary .practice-surface,
.view-summary .bottom-panel {
  display: none !important;
}

.view-history .topbar,
.view-history .home-screen,
.view-history .admin-screen,
.view-history .lesson-summary-screen,
.view-history .practice-surface,
.view-history .bottom-panel {
  display: none !important;
}

.view-admin .topbar,
.view-admin .home-screen,
.view-admin .history-screen,
.view-admin .lesson-summary-screen,
.view-admin .practice-surface,
.view-admin .bottom-panel {
  display: none !important;
}

.view-summary .lesson-summary-screen {
  display: grid;
}

.view-history .history-screen {
  display: grid;
}

.view-admin .admin-screen {
  display: grid;
}

.lesson-summary-panel {
  width: min(100%, 520px);
  padding: clamp(20px, 5vw, 30px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  box-shadow:
    0 34px 80px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 18px;
}

.summary-kicker {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.82rem;
  font-weight: 900;
}

.lesson-summary-panel h2 {
  margin: -8px 0 0;
  color: #ffffff;
  font-size: clamp(1.8rem, 8vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.summary-message {
  min-height: 20px;
  margin: -10px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.88rem;
  font-weight: 850;
}

.summary-main {
  min-height: 104px;
  padding: 18px;
  border: 1px solid rgba(255, 85, 85, 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at 92% 20%, rgba(255, 85, 85, 0.24), transparent 34%),
    rgba(255, 85, 85, 0.12);
  display: grid;
  align-content: center;
  gap: 8px;
  transition:
    border-color 240ms ease,
    box-shadow 240ms ease;
}

.lesson-summary-screen.is-ready .summary-main {
  border-color: rgba(255, 85, 85, 0.52);
  box-shadow:
    0 18px 42px rgba(255, 61, 61, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.summary-main span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.84rem;
  font-weight: 900;
}

.summary-main strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  display: inline-block;
  color: #ffffff;
  font-size: clamp(2.4rem, 13vw, 4.4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.summary-main strong.is-counting {
  animation: summaryMainPulse 1100ms ease-in-out infinite;
}

.summary-effort-track {
  width: 100%;
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.summary-effort-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #ff5555;
  box-shadow: 0 0 24px rgba(255, 85, 85, 0.38);
  transition: width 1500ms cubic-bezier(0.18, 0.88, 0.2, 1);
}

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

.summary-metric-card {
  position: relative;
  min-height: 104px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: grid;
  align-content: space-between;
  gap: 12px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  transition:
    opacity 360ms ease,
    transform 360ms ease,
    border-color 260ms ease,
    background 260ms ease;
}

.summary-metric-card.is-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.summary-metric-card.is-impact {
  animation: summaryImpact 760ms ease both;
}

.summary-metric-card[data-summary-card="time"] {
  grid-column: 1 / -1;
}

.summary-category-panel {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  display: grid;
  gap: 12px;
}

.summary-category-moves {
  display: grid;
  gap: 10px;
}

.summary-category-move {
  display: grid;
  gap: 8px;
}

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

.summary-category-head p,
.summary-category-foot,
.summary-category-empty {
  margin: 0;
}

.summary-category-head p {
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 950;
}

.summary-category-head span,
.summary-category-foot,
.summary-category-empty {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.74rem;
  font-weight: 850;
}

.summary-category-head strong {
  min-width: 48px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ffffff;
  color: #0a0a0a;
  font-size: 0.8rem;
  line-height: 1;
  text-align: center;
}

.summary-category-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.summary-category-track span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
}

.summary-category-track .before {
  background: rgba(255, 255, 255, 0.24);
}

.summary-category-track .after {
  background: #2fd5b8;
  box-shadow: 0 0 22px rgba(47, 213, 184, 0.34);
  transition: width 1400ms cubic-bezier(0.18, 0.88, 0.2, 1);
}

.summary-category-track .after.stage-retention {
  background: #ffd166;
  box-shadow: 0 0 22px rgba(255, 209, 102, 0.28);
}

.summary-category-track .after.stage-stability {
  background: #83a5ff;
  box-shadow: 0 0 22px rgba(131, 165, 255, 0.3);
}

.summary-metric-label {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
  font-weight: 900;
}

.summary-metric-value {
  position: relative;
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  margin: 0;
  padding-right: 58px;
  color: #ffffff;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: clamp(1.55rem, 7vw, 2.35rem);
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
  overflow: hidden;
  white-space: nowrap;
}

.summary-metric-value.compact {
  padding-right: 66px;
  font-size: clamp(1.35rem, 5.7vw, 1.95rem);
}

.summary-metric-value span {
  min-width: 0;
  white-space: nowrap;
}

.summary-unit {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  font-weight: 900;
}

.summary-plus {
  position: absolute;
  right: 0;
  top: 50%;
  max-width: 58px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #ffffff;
  color: #0a0a0a;
  font-size: 0.84rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-70%) scale(0.9);
}

.summary-plus.is-active {
  animation: summaryPlusHit 1120ms cubic-bezier(0.18, 0.88, 0.2, 1) both;
}

.summary-ok-button {
  width: 100%;
  min-height: 56px;
  border: 1px solid rgba(255, 85, 85, 0.7);
  border-radius: 999px;
  background: #ff5555;
  color: #ffffff;
  cursor: pointer;
  box-shadow:
    0 18px 42px rgba(255, 61, 61, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-size: 1.02rem;
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    opacity 240ms ease,
    transform 160ms ease;
}

.lesson-summary-screen.is-ready .summary-ok-button {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.summary-ok-button:disabled {
  cursor: default;
}

.summary-ok-button:hover {
  background: #ff4545;
  box-shadow:
    0 22px 54px rgba(255, 61, 61, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

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

@keyframes summaryPlusHit {
  0% {
    opacity: 0;
    transform: translateY(-92%) scale(0.88);
  }
  42% {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
  }
  70% {
    opacity: 1;
    transform: translateY(-50%) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes summaryImpact {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  46% {
    transform: translateX(0) scale(1.018);
    border-color: rgba(255, 85, 85, 0.46);
    background: rgba(255, 85, 85, 0.12);
  }
}

@keyframes problemFeedbackPulse {
  0%,
  100% {
    transform: scale(1);
  }

  42% {
    transform: scale(1.16);
  }
}

@keyframes summaryMainPulse {
  0%,
  100% {
    transform: scale(1);
    text-shadow: none;
  }
  50% {
    transform: scale(1.035);
    text-shadow: 0 0 26px rgba(255, 85, 85, 0.34);
  }
}

@media (max-width: 520px) {
  .lesson-summary-panel {
    gap: 14px;
    padding: 18px;
  }

  .summary-main {
    min-height: 96px;
    padding: 16px;
  }

  .summary-metric-grid {
    gap: 10px;
  }

  .summary-metric-card {
    min-height: 96px;
    padding: 14px;
  }

  .summary-category-panel {
    padding: 14px;
  }
}

.home-screen {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: clamp(20px, 4vh, 34px);
  overflow: hidden auto;
}

.view-lesson .home-screen,
.view-lesson .history-screen,
.view-home:not(.is-starting) .practice-surface {
  display: none !important;
}

.view-home .history-screen {
  display: none !important;
}

.view-home.is-starting .home-screen {
  pointer-events: none;
}

.view-home.is-starting .home-smile-button {
  opacity: 0;
}

.view-home.is-starting .practice-surface {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 0;
  width: min(calc(100vw - 24px), 596px);
  height: calc(100svh - 24px);
  min-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
}

.home-topbar {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-button {
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  gap: 2px;
  align-content: center;
  transition:
    background 160ms ease,
    transform 160ms ease,
    border-color 160ms ease;
}

.menu-button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
}

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

.menu-line {
  width: 19px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.home-hero {
  min-height: clamp(132px, 22vh, 170px);
  display: grid;
  grid-template-columns: clamp(96px, 24vw, 130px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(18px, 5vw, 30px);
}

.home-smile-button {
  position: relative;
  width: clamp(92px, 23vw, 124px);
  min-width: clamp(92px, 23vw, 124px);
  height: clamp(92px, 23vw, 124px);
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: #151050;
  cursor: pointer;
  overflow: visible;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.06),
    0 18px 42px rgba(0, 0, 0, 0.46),
    0 0 48px rgba(255, 75, 75, 0.12);
  animation: faceIdle 5200ms ease-in-out infinite;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    box-shadow 180ms ease;
}

.home-smile-button:hover {
  transform: scale(1.025);
  box-shadow:
    0 0 0 7px rgba(255, 255, 255, 0.08),
    0 22px 54px rgba(0, 0, 0, 0.5),
    0 0 62px rgba(255, 75, 75, 0.18);
}

.home-smile-button .smile-face {
  border-width: 5px;
}

.home-smile-button .face-mouth {
  border-width: 5px;
  border-top: 0;
  border-left-color: transparent;
  border-right-color: transparent;
}

.home-smile-button .thinking-dots span {
  width: 6px;
  height: 6px;
}

.home-start-copy {
  min-width: 0;
  display: grid;
  gap: 10px;
  align-content: center;
}

.home-kicker {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.82rem;
  font-weight: 900;
}

.start-button {
  width: 100%;
  max-width: 290px;
  min-width: 0;
  min-height: 58px;
  padding: 0 22px 0 24px;
  border: 1px solid rgba(255, 85, 85, 0.7);
  border-radius: 999px;
  background: #ff5555;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  justify-self: start;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow:
    0 18px 42px rgba(255, 61, 61, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-size: 1.08rem;
  font-weight: 950;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.start-button:hover {
  background: #ff4545;
  transform: translateY(-1px);
  box-shadow:
    0 22px 54px rgba(255, 61, 61, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

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

.start-button-icon {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid currentColor;
}

.home-dashboard {
  display: grid;
  gap: 12px;
  align-content: start;
}

.home-card,
.metric-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.home-card {
  padding: 18px;
}

.card-heading-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.card-kicker,
.metric-label,
.card-side-note {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-weight: 900;
}

.card-kicker,
.metric-label {
  font-size: 0.82rem;
}

.card-side-note {
  padding-top: 5px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.home-card h2 {
  margin: 5px 0 0;
  color: #ffffff;
  font-size: 2.2rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.weekly-activity {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.week-day {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.week-label {
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.72rem;
  font-weight: 900;
}

.week-dot {
  position: relative;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.36);
  overflow: hidden;
}

.week-eye,
.week-mouth {
  position: absolute;
  pointer-events: none;
}

.week-eye {
  top: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  transform-origin: center;
}

.week-eye.left {
  left: 10px;
}

.week-eye.right {
  right: 10px;
}

.week-mouth {
  left: 50%;
  bottom: 10px;
  width: 13px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translateX(-50%);
  transform-origin: center;
}

.week-day.active .week-dot {
  --week-color: #ff5555;
  --week-glow: rgba(255, 85, 85, 0.32);
  --week-ring: rgba(255, 85, 85, 0.22);
  --week-face-speed: 5200ms;
  border-color: var(--week-color);
  background: #ffffff;
  color: #151050;
  box-shadow:
    0 0 0 2px var(--week-ring),
    0 0 20px var(--week-glow);
}

.week-day.active .week-eye {
  animation: weekEyeBlink var(--week-face-speed) ease-in-out infinite;
  animation-delay: var(--blink-delay, 0ms);
}

.week-day.active .week-mouth {
  bottom: 7px;
  width: 18px;
  height: 9px;
  border: 3px solid currentColor;
  border-top: 0;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 0 0 999px 999px;
  background: transparent;
  animation: weekMouthLift var(--week-face-speed) ease-in-out infinite;
  animation-delay: var(--blink-delay, 0ms);
}

.week-day.today .week-dot {
  border-color: rgba(255, 255, 255, 0.74);
}

.week-day.active.today .week-dot {
  border-color: var(--week-color);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.78),
    0 0 24px var(--week-glow);
}

.week-day.day-0.active .week-dot {
  --week-color: #ff5f79;
  --week-glow: rgba(255, 95, 121, 0.34);
  --week-ring: rgba(255, 95, 121, 0.24);
  --blink-delay: 0ms;
  --week-face-speed: 5600ms;
}

.week-day.day-0.active .week-eye {
  animation-name: weekEyesLookSide;
}

.week-day.day-0.active .week-mouth {
  animation-name: weekMouthLookSide;
}

.week-day.day-1.active .week-dot {
  --week-color: #ff9f43;
  --week-glow: rgba(255, 159, 67, 0.34);
  --week-ring: rgba(255, 159, 67, 0.24);
  --blink-delay: 240ms;
  --week-face-speed: 4800ms;
}

.week-day.day-1.active .week-eye {
  animation-name: weekEyesSoftBlink;
}

.week-day.day-1.active .week-mouth {
  animation-name: weekMouthSoftBlink;
}

.week-day.day-2.active .week-dot {
  --week-color: #f6c445;
  --week-glow: rgba(246, 196, 69, 0.32);
  --week-ring: rgba(246, 196, 69, 0.24);
  --blink-delay: 480ms;
  --week-face-speed: 6200ms;
}

.week-day.day-2.active .week-eye {
  animation-name: weekEyesLookUpDown;
}

.week-day.day-2.active .week-mouth {
  animation-name: weekMouthSmallBounce;
}

.week-day.day-3.active .week-dot {
  --week-color: #42d392;
  --week-glow: rgba(66, 211, 146, 0.32);
  --week-ring: rgba(66, 211, 146, 0.24);
  --blink-delay: 720ms;
  --week-face-speed: 4400ms;
}

.week-day.day-3.active .week-eye {
  animation-name: weekEyesSpark;
}

.week-day.day-3.active .week-mouth {
  animation-name: weekMouthSmallBounce;
}

.week-day.day-4.active .week-dot {
  --week-color: #39c5d7;
  --week-glow: rgba(57, 197, 215, 0.32);
  --week-ring: rgba(57, 197, 215, 0.24);
  --blink-delay: 960ms;
  --week-face-speed: 5200ms;
}

.week-day.day-4.active .week-eye {
  animation-name: weekEyesLookSideAlt;
}

.week-day.day-4.active .week-mouth {
  animation-name: weekMouthLookSideAlt;
}

.week-day.day-5.active .week-dot {
  --week-color: #7c8cff;
  --week-glow: rgba(124, 140, 255, 0.34);
  --week-ring: rgba(124, 140, 255, 0.24);
  --blink-delay: 1200ms;
  --week-face-speed: 6800ms;
}

.week-day.day-5.active .week-eye {
  animation-name: weekEyesSlowDrift;
}

.week-day.day-5.active .week-mouth {
  animation-name: weekMouthSlowDrift;
}

.week-day.day-6.active .week-dot {
  --week-color: #b86bff;
  --week-glow: rgba(184, 107, 255, 0.34);
  --week-ring: rgba(184, 107, 255, 0.24);
  --blink-delay: 1440ms;
  --week-face-speed: 3900ms;
}

.week-day.day-6.active .week-eye {
  animation-name: weekEyesSpark;
}

.week-day.day-6.active .week-mouth {
  animation-name: weekMouthWide;
}

.week-milestone-badge {
  min-height: 12px;
  margin-top: -2px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.55rem;
  line-height: 1;
  font-weight: 950;
  white-space: nowrap;
  letter-spacing: 0;
}

.week-day.milestone .week-dot {
  border-color: var(--week-color, #ffffff);
}

.week-day.milestone-week .week-dot {
  --week-color: #ffd45f;
  --week-glow: rgba(255, 212, 95, 0.42);
  --week-ring: rgba(255, 212, 95, 0.42);
  background: #ffffff;
  color: #151050;
  box-shadow:
    0 0 0 2px var(--week-ring),
    0 0 26px rgba(255, 212, 95, 0.44);
  animation: weekPremiumGlow 2600ms ease-in-out infinite;
}

.week-day.milestone-month .week-dot {
  --week-color: #37d8ff;
  --week-glow: rgba(55, 216, 255, 0.44);
  --week-ring: rgba(55, 216, 255, 0.42);
  background: #ffffff;
  color: #151050;
  box-shadow:
    0 0 0 2px var(--week-ring),
    0 0 30px rgba(124, 140, 255, 0.46);
  animation: weekPremiumGlow 2400ms ease-in-out infinite;
}

.week-day.milestone-century .week-dot {
  --week-color: #b86bff;
  --week-glow: rgba(255, 255, 255, 0.5);
  --week-ring: rgba(184, 107, 255, 0.48);
  background: #ffffff;
  color: #151050;
  box-shadow:
    0 0 0 2px var(--week-ring),
    0 0 36px rgba(255, 255, 255, 0.44);
  animation: weekCenturyAura 3600ms linear infinite;
}

.week-day.milestone-week .week-milestone-badge {
  color: #ffd45f;
  text-shadow: 0 0 12px rgba(255, 212, 95, 0.58);
}

.week-day.milestone-month .week-milestone-badge {
  color: #9de8ff;
  text-shadow: 0 0 12px rgba(55, 216, 255, 0.52);
}

.week-day.milestone-century .week-milestone-badge {
  color: #ffffff;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.72),
    0 0 18px rgba(184, 107, 255, 0.46);
  animation: weekBadgeGlow 2400ms ease-in-out infinite;
}

@keyframes weekEyeBlink {
  0%,
  8%,
  12%,
  100% {
    transform: translate(0, 0) scaleY(1);
  }

  10% {
    transform: translate(0, 0) scaleY(0.18);
  }
}

@keyframes weekEyesLookSide {
  0%,
  20%,
  100% {
    transform: translate(0, 0) scaleY(1);
  }

  10% {
    transform: translate(0, 0) scaleY(0.18);
  }

  42%,
  56% {
    transform: translate(-2px, 0) scaleY(1);
  }

  74%,
  86% {
    transform: translate(2px, 0) scaleY(1);
  }
}

@keyframes weekEyesLookUpDown {
  0%,
  18%,
  100% {
    transform: translateY(0) scaleY(1);
  }

  9% {
    transform: translateY(0) scaleY(0.18);
  }

  42%,
  56% {
    transform: translateY(-2px) scaleY(1);
  }

  72%,
  84% {
    transform: translateY(2px) scaleY(1);
  }
}

@keyframes weekEyesSoftBlink {
  0%,
  36%,
  58%,
  100% {
    transform: translateY(0) scaleY(1);
  }

  46% {
    transform: translateY(1px) scaleY(0.22);
  }
}

@keyframes weekEyesSlowDrift {
  0%,
  100% {
    transform: translateX(0) scaleY(1);
  }

  8% {
    transform: translateX(0) scaleY(0.18);
  }

  48% {
    transform: translateX(1px) scaleY(1);
  }
}

@keyframes weekEyesLookSideAlt {
  0%,
  20%,
  100% {
    transform: translate(0, 0) scaleY(1);
  }

  10% {
    transform: translate(0, 0) scaleY(0.18);
  }

  42%,
  56% {
    transform: translate(2px, 0) scaleY(1);
  }

  74%,
  86% {
    transform: translate(-2px, 0) scaleY(1);
  }
}

@keyframes weekEyesSpark {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  8% {
    transform: translateY(0) scaleY(0.18);
  }

  44% {
    transform: translateY(-1px) scale(1.12);
  }
}

@keyframes weekMouthLift {
  0%,
  100% {
    transform: translateX(-50%);
  }

  52% {
    transform: translateX(-50%) translateY(-1px);
  }
}

@keyframes weekMouthSoftBlink {
  0%,
  36%,
  58%,
  100% {
    transform: translateX(-50%);
  }

  46% {
    transform: translateX(-50%) translateY(1px) scaleX(0.94);
  }
}

@keyframes weekMouthLookSide {
  0%,
  20%,
  100% {
    transform: translateX(-50%);
  }

  42%,
  56% {
    transform: translateX(calc(-50% - 1px)) scaleX(1.06);
  }

  74%,
  86% {
    transform: translateX(calc(-50% + 1px)) scaleX(1.06);
  }

  50% {
    transform: translateX(calc(-50% - 1px)) scaleX(1.08);
  }
}

@keyframes weekMouthLookSideAlt {
  0%,
  20%,
  100% {
    transform: translateX(-50%);
  }

  42%,
  56% {
    transform: translateX(calc(-50% + 1px)) scaleX(1.06);
  }

  74%,
  86% {
    transform: translateX(calc(-50% - 1px)) scaleX(1.06);
  }
}

@keyframes weekMouthWide {
  0%,
  100% {
    transform: translateX(-50%);
  }

  44%,
  52% {
    transform: translateX(-50%) scaleX(1.1);
  }
}

@keyframes weekMouthSmallBounce {
  0%,
  18%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  42%,
  56% {
    transform: translateX(-50%) translateY(-1px);
  }

  72%,
  84% {
    transform: translateX(-50%) translateY(1px);
  }
}

@keyframes weekMouthSlowDrift {
  0%,
  100% {
    transform: translateX(-50%);
  }

  48% {
    transform: translateX(calc(-50% + 1px));
  }
}

@keyframes weekPremiumGlow {
  0%,
  100% {
    filter: brightness(1);
    box-shadow:
      0 0 0 2px var(--week-ring),
      0 0 22px var(--week-glow);
  }

  50% {
    filter: brightness(1.08);
    box-shadow:
      0 0 0 3px var(--week-ring),
      0 0 34px var(--week-glow);
  }
}

@keyframes weekCenturyAura {
  0%,
  100% {
    filter: hue-rotate(0deg) brightness(1.02);
    box-shadow:
      0 0 0 2px var(--week-ring),
      0 0 34px rgba(255, 255, 255, 0.42),
      0 0 46px rgba(184, 107, 255, 0.28);
  }

  50% {
    filter: hue-rotate(28deg) brightness(1.12);
    box-shadow:
      0 0 0 3px var(--week-ring),
      0 0 40px rgba(255, 255, 255, 0.5),
      0 0 58px rgba(184, 107, 255, 0.34);
  }
}

@keyframes weekBadgeGlow {
  0%,
  100% {
    opacity: 0.88;
  }

  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .week-day.active .week-dot,
  .week-day.active .week-eye,
  .week-day.active .week-mouth,
  .week-day.milestone-century .week-milestone-badge {
    animation: none;
  }
}

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

.metric-card {
  min-height: 102px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.metric-value {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.45rem, 7vw, 2.2rem);
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

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

.effort-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.effort-row {
  min-width: 0;
  min-height: 74px;
  padding: 12px 8px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.effort-row span {
  min-width: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.76rem;
  line-height: 1.25;
  font-weight: 900;
  text-align: center;
}

.effort-row strong {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  color: #ffffff;
  font-size: clamp(1.55rem, 5vw, 2.1rem);
  line-height: 1;
  font-weight: 950;
  white-space: nowrap;
  text-align: center;
}

@media (max-width: 520px) {
  .effort-list {
    gap: 8px;
  }

  .effort-row {
    min-height: 68px;
    padding: 10px 4px;
  }

  .effort-row span {
    font-size: 0.68rem;
  }

  .effort-row strong {
    font-size: clamp(1.28rem, 6vw, 1.72rem);
  }
}

.home-progress-card {
  display: grid;
  gap: 12px;
}

.grammar-progress-card {
  display: grid;
  gap: 16px;
}

.category-progress-list {
  display: grid;
  gap: 12px;
}

.category-progress-list.expanded {
  gap: 14px;
}

.category-progress-row {
  min-height: 96px;
  display: grid;
  gap: 10px;
}

.category-progress-row.is-future {
  opacity: 0.58;
}

.category-progress-row.is-active .category-progress-label {
  color: #ffffff;
}

.category-progress-row.is-future .category-progress-label {
  color: rgba(255, 255, 255, 0.74);
}

.category-progress-row.is-future .category-track {
  background: rgba(255, 255, 255, 0.08);
}

.category-progress-head {
  min-height: 38px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.category-progress-label,
.category-progress-meta {
  margin: 0;
}

.category-progress-label {
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.25;
  font-weight: 950;
}

.category-progress-meta {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.72rem;
  font-weight: 850;
}

.category-progress-score {
  min-width: 64px;
  display: grid;
  justify-items: end;
  gap: 2px;
}

.category-progress-score strong {
  color: #ffffff;
  font-size: 1rem;
  line-height: 1;
  font-weight: 950;
}

.category-progress-score span {
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.category-track-set {
  display: grid;
  gap: 7px;
}

.category-track-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.category-track-row > span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7rem;
  font-weight: 900;
}

.category-track {
  position: relative;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.category-track span {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  transition: width 420ms ease;
}

.category-track-layer.stage-base,
.category-track-fill.stage-base {
  background: #2fd5b8;
  box-shadow: 0 0 22px rgba(47, 213, 184, 0.34);
}

.category-track-layer.stage-retention,
.category-track-fill.stage-retention {
  background: #ffd166;
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.26);
}

.category-track-layer.stage-stability,
.category-track-fill.stage-stability {
  background: #83a5ff;
  box-shadow: 0 0 18px rgba(131, 165, 255, 0.3);
}

.category-track-layer {
  opacity: 0.58;
}

.category-track-layer.current {
  opacity: 1;
}

.category-track-row.proficiency .category-track span {
  background: #2fd5b8;
  box-shadow: 0 0 22px rgba(47, 213, 184, 0.28);
}

.history-screen,
.admin-screen {
  grid-template-rows: auto 1fr;
  gap: clamp(18px, 4vh, 30px);
}

.history-topbar {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-button {
  position: relative;
}

.back-icon {
  position: relative;
  width: 22px;
  height: 22px;
  display: block;
}

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

.back-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  width: 13px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.history-dashboard,
.admin-dashboard {
  display: grid;
  align-content: start;
  gap: 12px;
}

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

.admin-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-summary-grid .metric-card {
  min-width: 0;
}

.admin-summary-grid .metric-value {
  overflow: hidden;
  font-size: clamp(1.05rem, 4.5vw, 1.75rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-graph-card {
  display: grid;
  gap: 18px;
}

.admin-insights-card {
  display: grid;
  gap: 16px;
}

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

.admin-hypothesis-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-exit-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-feedback-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-action-row,
.admin-empty-panel,
.admin-debug-panel {
  min-width: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
}

.admin-action-row {
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
  border-left: 4px solid rgba(255, 255, 255, 0.18);
}

.admin-feedback-row {
  grid-template-rows: auto;
}

.admin-feedback-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: start;
  cursor: pointer;
  list-style: none;
}

.admin-feedback-summary::-webkit-details-marker {
  display: none;
}

.admin-feedback-summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.62);
  border-bottom: 2px solid rgba(255, 255, 255, 0.62);
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.admin-feedback-row[open] .admin-feedback-summary::after {
  transform: rotate(225deg);
}

.admin-action-row.high {
  border-left-color: #ff5555;
}

.admin-action-row.medium {
  border-left-color: #f1b44c;
}

.admin-action-row.low {
  border-left-color: #2fd5b8;
}

.admin-action-head {
  display: flex;
  align-items: start;
  gap: 10px;
}

.admin-action-badge {
  min-width: 42px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  line-height: 1;
  text-align: center;
  font-weight: 950;
}

.admin-status-pill {
  min-width: 70px;
  padding: 5px 8px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.72rem;
  line-height: 1;
  text-align: center;
  font-weight: 950;
}

.admin-status-pill.pending {
  background: rgba(255, 85, 85, 0.28);
}

.admin-status-pill.investigating {
  background: rgba(241, 180, 76, 0.3);
}

.admin-status-pill.fixed {
  background: rgba(47, 213, 184, 0.24);
}

.admin-status-pill.wont_fix {
  background: rgba(255, 255, 255, 0.14);
}

.admin-action-row h3 {
  margin: 0;
  color: #ffffff;
  font-size: 0.92rem;
  line-height: 1.35;
  font-weight: 950;
}

.admin-action-metric,
.admin-action-detail,
.admin-action-next {
  margin: 0;
  line-height: 1.45;
  word-break: break-word;
}

.admin-action-metric {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  font-weight: 900;
}

.admin-action-detail {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.78rem;
  font-weight: 760;
}

.admin-action-next {
  padding-top: 2px;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
}

.admin-status-control {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 900;
}

.admin-status-control select {
  min-width: 0;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: #ffffff;
  font: inherit;
}

.admin-codex-brief {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.74rem;
  line-height: 1.45;
  font-weight: 760;
  word-break: break-word;
}

.admin-feedback-samples {
  margin: 0;
  padding-left: 18px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.74rem;
  line-height: 1.45;
  font-weight: 760;
}

.admin-feedback-samples li + li {
  margin-top: 4px;
}

.admin-empty-panel {
  grid-column: 1 / -1;
  min-height: 136px;
  padding: 18px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.admin-empty-panel strong,
.admin-empty-panel span {
  display: block;
}

.admin-empty-panel strong {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 950;
}

.admin-empty-panel span {
  max-width: 520px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.82rem;
  line-height: 1.5;
  font-weight: 760;
}

.admin-debug-panel {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.admin-debug-panel summary {
  color: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 950;
}

.admin-json {
  max-height: 320px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-graph {
  min-height: 184px;
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: end;
  gap: 7px;
}

.history-bar {
  min-width: 0;
  min-height: 166px;
  display: grid;
  grid-template-rows: 22px 1fr 18px;
  align-items: end;
  justify-items: center;
  gap: 6px;
}

.history-bar-value {
  min-height: 16px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.68rem;
  font-weight: 900;
}

.history-bar-fill {
  width: 100%;
  min-height: 4px;
  max-width: 28px;
  border-radius: 999px 999px 5px 5px;
  background: rgba(255, 255, 255, 0.16);
  transition: height 420ms ease;
}

.history-bar.active .history-bar-fill {
  background: linear-gradient(180deg, #ff7777, #ff5555);
  box-shadow: 0 0 24px rgba(255, 85, 85, 0.26);
}

.history-bar-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.66rem;
  font-weight: 900;
  white-space: nowrap;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 34;
  background: rgba(0, 0, 0, 0.56);
  opacity: 0;
  transition: opacity 220ms ease;
}

.home-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 35;
  width: min(82vw, 360px);
  padding: 28px 18px;
  background: rgba(13, 13, 16, 0.96);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 24px 0 70px rgba(0, 0, 0, 0.48);
  transform: translateX(-102%);
  transition: transform 220ms ease;
}

.drawer-open .drawer-overlay {
  opacity: 1;
}

.drawer-open .home-drawer {
  transform: translateX(0);
}

.drawer-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-account {
  margin: 4px 14px 14px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.78rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-smile {
  position: relative;
  width: 56px;
  min-width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
  color: #151050;
  box-shadow:
    0 0 0 5px rgba(255, 255, 255, 0.08),
    0 14px 32px rgba(0, 0, 0, 0.36);
  animation: faceIdle 5200ms ease-in-out infinite;
}

.drawer-smile .smile-face {
  border-width: 4px;
}

.drawer-smile .face-mouth {
  border-width: 4px;
  border-top: 0;
  border-left-color: transparent;
  border-right-color: transparent;
}

.drawer-smile .thinking-dots span {
  width: 4px;
  height: 4px;
}

.drawer-close {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.drawer-close::before,
.drawer-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

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

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

.drawer-item {
  width: 100%;
  min-height: 54px;
  margin-top: 6px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-weight: 900;
}

.drawer-item:hover,
.drawer-item.active {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.drawer-item.muted {
  color: rgba(255, 255, 255, 0.52);
}

.drawer-item:disabled {
  cursor: not-allowed;
}

.drawer-item:disabled:hover {
  background: transparent;
}

.drawer-separator {
  height: 1px;
  margin: 18px 14px 12px;
  background: rgba(255, 255, 255, 0.1);
}

.drawer-icon {
  position: relative;
  width: 24px;
  height: 24px;
  color: currentColor;
}

.home-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 16px;
  height: 11px;
  border: 2px solid currentColor;
  border-top: 0;
}

.home-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}

.play-icon-small::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 5px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
}

.reset-icon::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

.reset-icon::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 4px;
  width: 0;
  height: 0;
  border-left: 6px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: rotate(28deg);
}

.progress-icon::before,
.settings-icon::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.progress-icon::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.settings-icon::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 2px;
  width: 2px;
  height: 20px;
  background: currentColor;
  box-shadow:
    -7px 7px 0 currentColor,
    7px 7px 0 currentColor;
}

.logout-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 5px;
  width: 13px;
  height: 14px;
  border: 2px solid currentColor;
  border-right: 0;
}

.logout-icon::after {
  content: "";
  position: absolute;
  right: 3px;
  top: 11px;
  width: 14px;
  height: 2px;
  background: currentColor;
  box-shadow: 5px -4px 0 -1px currentColor, 5px 4px 0 -1px currentColor;
}

.smile-transition-clone {
  position: fixed;
  z-index: 80;
  margin: 0;
  pointer-events: none;
  transform-origin: 0 0;
}

@media (max-width: 520px) {
  .home-screen {
    gap: 20px;
  }

  .home-hero {
    grid-template-columns: 94px minmax(0, 1fr);
    gap: 16px;
  }

  .home-smile-button {
    width: 88px;
    min-width: 88px;
    height: 88px;
  }

  .start-button {
    width: clamp(172px, calc(100vw - 142px), 240px);
    max-width: 100%;
    min-height: 54px;
    padding: 0 18px 0 20px;
  }

  .home-card {
    padding: 16px;
  }

  .home-dashboard,
  .home-card,
  .metric-grid {
    width: calc(100vw - 20px);
    max-width: 100%;
  }

  .card-heading-row {
    display: grid;
    gap: 8px;
  }

  .card-side-note {
    padding-top: 0;
  }

  .metric-card {
    min-height: 94px;
    padding: 14px;
  }

  .week-dot {
    width: 30px;
    height: 30px;
  }

  .week-eye {
    top: 8px;
    width: 3px;
    height: 3px;
  }

  .week-eye.left {
    left: 8px;
  }

  .week-eye.right {
    right: 8px;
  }

  .week-mouth {
    bottom: 9px;
    width: 11px;
  }

  .week-day.active .week-mouth {
    bottom: 5px;
    width: 15px;
    height: 7px;
    border-width: 2px;
    border-top-width: 0;
  }

  .week-milestone-badge {
    font-size: 0.5rem;
  }

  .weekly-activity {
    width: min(calc(100vw - 70px), 320px);
  }

  .week-day {
    flex-basis: 0;
  }

  .category-progress-row {
    min-height: 92px;
  }

  .history-screen,
  .admin-screen {
    gap: 20px;
  }

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

  .history-graph {
    min-height: 168px;
    gap: 5px;
  }

  .history-bar {
    min-height: 148px;
    grid-template-rows: 20px 1fr 16px;
  }

  .history-bar-fill {
    max-width: 20px;
  }

  .history-bar-label {
    font-size: 0.58rem;
  }
}

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

.category-progress-row {
  min-height: 72px;
}

.category-progress-head {
  align-items: center;
}

.category-progress-score {
  min-width: 72px;
}

.category-track {
  width: 100%;
}

.history-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.history-graph {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 14px;
}

.history-chart-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  display: grid;
  gap: 12px;
}

.history-chart-panel h3 {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.86rem;
  line-height: 1.2;
  font-weight: 950;
}

.history-chart {
  min-height: 150px;
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: end;
  gap: 5px;
}

.history-chart .history-bar {
  min-height: 144px;
  grid-template-rows: 1fr 18px;
}

.history-chart .history-bar-value {
  display: none;
}

.history-chart .history-bar-fill {
  max-width: 22px;
}

.history-chart-panel.time .history-bar-fill {
  background: #ff5555;
}

.history-chart-panel.words .history-bar-fill {
  background: #2fd5b8;
  box-shadow: 0 0 20px rgba(47, 213, 184, 0.28);
}

.history-chart-panel.answers .history-bar-fill {
  background: #f1b44c;
  box-shadow: 0 0 20px rgba(241, 180, 76, 0.24);
}

@media (min-width: 721px) and (max-width: 899px) {
  body.view-home .app-shell,
  body.view-history .app-shell,
  body.view-admin .app-shell {
    width: min(100%, 840px);
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    padding: 28px;
  }

  .home-screen,
  .history-screen,
  .admin-screen {
    height: auto;
    min-height: calc(100vh - 56px);
    min-height: calc(100svh - 56px);
    overflow: visible;
  }
}

@media (min-width: 900px) {
  body.view-home .app-shell,
  body.view-history .app-shell,
  body.view-admin .app-shell {
    width: min(100%, 1180px);
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    padding: 32px;
  }

  .home-screen,
  .history-screen,
  .admin-screen {
    height: auto;
    min-height: calc(100vh - 64px);
    min-height: calc(100svh - 64px);
    overflow: visible;
  }

  .home-screen {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: start;
    column-gap: clamp(28px, 4vw, 52px);
    row-gap: 24px;
  }

  .home-topbar {
    grid-column: 1 / -1;
  }

  .home-hero {
    grid-template-columns: 1fr;
    align-content: start;
    justify-items: start;
    min-height: 0;
    gap: 24px;
    padding-top: 12px;
  }

  .home-smile-button {
    width: clamp(156px, 16vw, 220px);
    min-width: clamp(156px, 16vw, 220px);
    height: clamp(156px, 16vw, 220px);
  }

  .home-start-copy {
    gap: 18px;
  }

  .start-button {
    width: min(100%, 280px);
  }

  .home-dashboard {
    gap: 14px;
  }

  .home-card {
    padding: 20px;
  }

  .home-dashboard,
  .home-card,
  .metric-grid {
    width: 100%;
  }

  .grammar-progress-card h2 {
    font-size: 1.72rem;
  }

  .grammar-progress-card .category-progress-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 12px;
  }

  .grammar-progress-card .category-progress-row {
    min-height: 58px;
    gap: 8px;
  }

  .grammar-progress-card .category-progress-head {
    min-height: 30px;
    gap: 10px;
  }

  .grammar-progress-card .category-progress-label {
    font-size: 0.82rem;
  }

  .grammar-progress-card .category-progress-score {
    min-width: 46px;
  }

  .grammar-progress-card .category-progress-score strong {
    font-size: 0.9rem;
  }

  .grammar-progress-card .category-progress-score span {
    font-size: 0.66rem;
  }

  .grammar-progress-card .category-track {
    height: 7px;
  }

  .history-dashboard {
    gap: 14px;
  }

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

  .history-chart {
    min-height: 188px;
  }

  .history-chart .history-bar {
    min-height: 176px;
  }

  .admin-hypothesis-list,
  .admin-feedback-list,
  .admin-exit-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .metric-grid,
  .history-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .metric-grid .metric-card:last-child,
  .history-summary-grid .metric-card:last-child {
    grid-column: 1 / -1;
  }

  .history-summary-grid .metric-card:last-child {
    grid-column: auto;
  }

  .admin-summary-grid .metric-card:last-child {
    grid-column: auto;
  }

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

  .admin-action-head {
    display: grid;
  }

  .admin-feedback-summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-feedback-summary::after {
    grid-column: 2;
    grid-row: 1;
  }

  .admin-status-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

  .category-progress-row {
    min-height: 70px;
  }

  .history-graph {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .history-chart-panel {
    padding: 12px;
  }

  .history-chart {
    min-height: 128px;
    gap: 4px;
  }

  .history-chart .history-bar {
    min-height: 120px;
    grid-template-rows: 1fr 16px;
  }

  .history-chart .history-bar-value {
    display: none;
  }
}

.history-graph {
  min-height: 0;
  overflow-x: auto;
  display: block;
}

.history-bars-grid {
  min-width: 720px;
  display: grid;
  gap: 0;
}

.history-metric-row {
  min-height: 118px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: minmax(108px, 148px) 48px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
}

.history-metric-row:first-child {
  border-top: 0;
}

.history-metric-label {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 6px;
}

.history-metric-label h3,
.history-metric-label span {
  margin: 0;
}

.history-metric-label h3 {
  color: #ffffff;
  font-size: 0.92rem;
  line-height: 1.25;
  font-weight: 950;
}

.history-metric-label span {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.8rem;
  font-weight: 900;
}

.history-y-axis {
  height: 92px;
  align-self: center;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  align-items: center;
  justify-items: end;
}

.history-y-axis span {
  color: rgba(255, 255, 255, 0.46);
  font-size: 0.66rem;
  font-weight: 850;
  white-space: nowrap;
}

.history-metric-plot {
  align-self: center;
  display: grid;
  grid-template-rows: 92px 24px;
  gap: 6px;
}

.history-bars-track {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
}

.history-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.history-grid-line.line-0 {
  top: 0;
}

.history-grid-line.line-1 {
  top: 50%;
}

.history-grid-line.line-2 {
  bottom: 0;
}

.history-bar-column {
  position: relative;
  z-index: 1;
  min-width: 0;
  height: 100%;
  display: grid;
  align-items: end;
  justify-items: center;
}

.history-bar-column .history-bar-fill {
  width: min(100%, 26px);
  min-height: 0;
  max-width: 26px;
  border-radius: 6px 6px 2px 2px;
  background: rgba(255, 255, 255, 0.18);
  transition: height 420ms ease;
}

.history-bar-column.empty .history-bar-fill {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.history-bar-column.active .history-bar-fill {
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.12);
}

.history-metric-row.time .history-bar-fill {
  background: #ff5555;
}

.history-metric-row.words .history-bar-fill {
  background: #2fd5b8;
}

.history-metric-row.answers .history-bar-fill {
  background: #f1b44c;
}

.history-metric-row.accuracy .history-bar-fill {
  background: #8aa7ff;
}

.history-x-axis {
  min-height: 24px;
  display: block;
}

.history-x-axis-labels {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.history-x-axis-labels span {
  min-width: 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.64rem;
  line-height: 1.1;
  text-align: center;
  font-weight: 850;
  white-space: nowrap;
}

.history-x-axis-labels span.today {
  color: #ffffff;
}

@media (min-width: 900px) {
  .history-bars-grid {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .history-bars-grid {
    min-width: 680px;
  }

  .history-metric-row {
    grid-template-columns: 92px 42px minmax(0, 1fr);
    gap: 8px;
  }

  .history-metric-plot {
    grid-template-rows: 82px 24px;
  }

  .history-y-axis {
    height: 82px;
  }

  .history-metric-label h3 {
    font-size: 0.82rem;
  }

  .history-metric-label span {
    font-size: 0.72rem;
  }
}

.history-graph {
  min-height: 0 !important;
  display: block !important;
  grid-template-columns: none !important;
  overflow: hidden;
  padding-bottom: 0;
}

.progress-chart-list {
  min-width: 0;
  display: grid;
  gap: 0;
}

.progress-chart-panel {
  min-width: 0;
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 10px;
}

.progress-chart-panel:first-child {
  border-top: 0;
  padding-top: 4px;
}

.progress-chart-panel:last-child {
  padding-bottom: 2px;
}

.progress-chart-head {
  min-width: 0;
  display: block;
}

.progress-chart-head h3 {
  margin: 0;
  color: #ffffff;
  font-size: 0.96rem;
  line-height: 1.25;
  font-weight: 950;
}

.progress-chart-body {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
}

.progress-chart-scroll {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: grid;
  grid-template-rows: 124px 22px;
  gap: 6px;
  padding: 2px 0 6px;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.progress-chart-scroll::-webkit-scrollbar {
  height: 4px;
}

.progress-chart-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.progress-chart-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.progress-chart-scroll:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.24);
}

.progress-y-axis {
  height: 124px;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  align-items: center;
  justify-items: end;
}

.progress-y-axis span {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.66rem;
  line-height: 1;
  font-weight: 850;
  white-space: nowrap;
}

.progress-bars {
  position: relative;
  width: 100%;
  min-width: 680px;
  height: 124px;
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  padding-top: 16px;
}

.progress-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.progress-grid-line.line-0 {
  top: 18px;
}

.progress-grid-line.line-1 {
  top: calc(18px + (100% - 18px) / 2);
}

.progress-grid-line.line-2 {
  bottom: 0;
}

.progress-bar {
  position: relative;
  z-index: 1;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 18px 1fr;
  align-items: end;
  justify-items: center;
}

.progress-bar-value {
  min-width: 0;
  width: 100%;
  min-height: 16px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.58rem;
  line-height: 1;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-bar-fill {
  width: min(100%, 28px);
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: rgba(255, 255, 255, 0.22);
  transition: height 420ms ease;
}

.progress-bar.empty .progress-bar-fill {
  background: rgba(255, 255, 255, 0.13);
  box-shadow: none;
}

.progress-chart-panel.time .progress-bar-fill {
  background: #ff5555;
}

.progress-chart-panel.words .progress-bar-fill {
  background: #2fd5b8;
}

.progress-chart-panel.answers .progress-bar-fill {
  background: #f1b44c;
}

.progress-chart-panel.accuracy .progress-bar-fill {
  background: #8aa7ff;
}

.progress-chart-panel.time .progress-bar.active .progress-bar-fill {
  box-shadow: 0 0 18px rgba(255, 85, 85, 0.24);
}

.progress-chart-panel.words .progress-bar.active .progress-bar-fill {
  box-shadow: 0 0 18px rgba(47, 213, 184, 0.22);
}

.progress-chart-panel.answers .progress-bar.active .progress-bar-fill {
  box-shadow: 0 0 18px rgba(241, 180, 76, 0.2);
}

.progress-chart-panel.accuracy .progress-bar.active .progress-bar-fill {
  box-shadow: 0 0 18px rgba(138, 167, 255, 0.24);
}

.progress-x-axis {
  width: 100%;
  min-width: 680px;
  display: block;
}

.progress-x-axis-labels {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.progress-x-axis-labels span {
  min-width: 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: clamp(0.5rem, 1.9vw, 0.64rem);
  line-height: 1.1;
  text-align: center;
  font-weight: 850;
  white-space: nowrap;
}

.progress-x-axis-labels span.today {
  color: #ffffff;
}

@media (max-width: 520px) {
  .progress-chart-body {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
  }

  .progress-chart-scroll {
    grid-template-rows: 112px 20px;
    padding-bottom: 6px;
  }

  .progress-y-axis,
  .progress-bars {
    height: 112px;
  }

  .progress-bars,
  .progress-x-axis {
    min-width: 650px;
  }

  .progress-chart-head h3 {
    font-size: 0.86rem;
  }

  .progress-chart-head span {
    font-size: 0.7rem;
  }

  .progress-bar-value {
    font-size: 0.54rem;
  }
}

.history-screen .history-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-screen .admin-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 520px) {
  .history-screen .history-summary-grid,
  .admin-screen .admin-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
