:root {
  color-scheme: dark;
  --bg: #0c1017;
  --bg-2: #101721;
  --surface: #151b24;
  --surface-2: #1d2531;
  --surface-3: #263244;
  --ink: #f3f0e8;
  --muted: #97a3b3;
  --line: #303a49;
  --accent: #7dd3fc;
  --accent-2: #f4c95d;
  --accent-3: #9be7c2;
  --danger: #fb7185;
  --ok: #86efac;
  --panel-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  --inner-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(125, 211, 252, 0.09), transparent 300px),
    linear-gradient(120deg, rgba(244, 201, 93, 0.06), transparent 420px),
    linear-gradient(180deg, var(--bg), var(--bg-2) 48%, #0e1412),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

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

.app {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px clamp(22px, 4vw, 46px);
  border-bottom: 1px solid rgba(125, 211, 252, 0.12);
  background: rgba(12, 16, 23, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 96px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #071018;
  font-weight: 900;
}

.main-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.nav-button,
.segmented button,
.small-button,
.action-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.nav-button {
  padding: 0 14px;
  white-space: nowrap;
}

.nav-button:hover,
.segmented button:hover,
.small-button:hover,
.action-button:hover,
.icon-button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
}

.nav-button.active,
.segmented button.active {
  color: #071018;
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(125, 211, 252, 0.18);
}

.login-zone {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  max-width: 520px;
}

.login-zone.signed {
  min-width: 220px;
}

.login-input,
.game-input,
.typing-input {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #0f1620;
  outline: none;
}

.login-input {
  width: 104px;
  height: 38px;
  padding: 0 10px;
}

.login-input.password {
  width: 118px;
}

.small-button {
  display: inline-grid;
  min-width: 58px;
  place-items: center;
  padding: 0 12px;
  border-color: var(--line);
  text-decoration: none;
}

.small-button:not(.ghost) {
  color: #071018;
  background: var(--accent);
}

.small-button.ghost {
  border-color: rgba(125, 211, 252, 0.3);
}

.small-button:disabled,
.login-input:disabled {
  cursor: wait;
  opacity: 0.62;
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.user-name {
  max-width: 112px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-chip {
  min-height: 26px;
  padding: 5px 8px;
  border: 1px solid rgba(155, 231, 194, 0.26);
  border-radius: 8px;
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 800;
  background: rgba(155, 231, 194, 0.08);
}

.login-message {
  flex-basis: 100%;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-align: right;
}

.auth-page {
  display: grid;
  min-height: 560px;
  place-items: center;
}

.auth-panel {
  display: grid;
  gap: 18px;
  width: min(520px, 100%);
  padding: 26px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(125, 211, 252, 0.06), transparent 42%),
    rgba(21, 27, 36, 0.92);
  box-shadow: var(--panel-shadow);
}

.auth-head h1 {
  margin: 4px 0 0;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
}

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

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.auth-input {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #0f1620;
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.16);
}

.auth-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 4px;
}

.auth-note,
.auth-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.auth-note {
  color: var(--muted);
}

.auth-message {
  color: var(--danger);
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 26px clamp(22px, 4vw, 46px) 46px;
}

.short-layout,
.long-layout,
.game-layout {
  grid-template-columns: minmax(0, 1fr);
}

.workspace,
.side-panel {
  min-width: 0;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.view-head {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.view-head h1 {
  margin: 4px 0 0;
  font-size: 44px;
  line-height: 0.95;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.head-metrics {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.head-metrics span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.learn-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: -4px 0 14px;
}

.learn-summary span {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.learn-summary strong {
  margin-right: 6px;
  color: var(--ink);
  font-size: 20px;
}

.control-stack {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--inner-shadow);
}

.segmented.wide {
  grid-template-columns: repeat(4, minmax(76px, auto));
  grid-auto-flow: initial;
}

.segmented button {
  min-width: 58px;
  padding: 0 10px;
}

.learn-grid {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.lesson-map {
  display: grid;
  max-height: min(66vh, 710px);
  grid-template-columns: repeat(3, minmax(36px, 1fr));
  gap: 7px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid rgba(48, 58, 73, 0.68);
  border-radius: 8px;
  background: rgba(21, 27, 36, 0.58);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  scrollbar-color: rgba(125, 211, 252, 0.34) transparent;
  scrollbar-width: thin;
}

.lesson-map::-webkit-scrollbar,
.passage-list::-webkit-scrollbar,
.target-text::-webkit-scrollbar {
  width: 7px;
}

.lesson-map::-webkit-scrollbar-track,
.passage-list::-webkit-scrollbar-track,
.target-text::-webkit-scrollbar-track {
  background: transparent;
}

.lesson-map::-webkit-scrollbar-thumb,
.passage-list::-webkit-scrollbar-thumb,
.target-text::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.2);
}

.lesson-node {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid rgba(48, 58, 73, 0.62);
  border-radius: 999px;
  color: rgba(151, 163, 179, 0.72);
  background: rgba(21, 27, 36, 0.58);
  font-weight: 800;
  font-size: 12px;
}

.lesson-node.done {
  color: #071018;
  background: var(--accent-3);
}

.lesson-node.active {
  border-color: var(--accent-2);
  color: var(--ink);
  background: rgba(244, 201, 93, 0.1);
  box-shadow: 0 0 0 3px rgba(246, 189, 96, 0.16);
}

.lesson-node.locked {
  cursor: not-allowed;
  opacity: 0.24;
}

.lesson-detail {
  display: grid;
  gap: 10px;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lesson-meta span {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.practice-band {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.short-practice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.quote-context {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(125, 211, 252, 0.08), transparent 42%),
    rgba(21, 27, 36, 0.88);
  box-shadow: var(--panel-shadow);
}

.quote-context .eyebrow {
  align-self: center;
}

.quote-context h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.quote-counter {
  display: flex;
  align-items: baseline;
  gap: 6px;
  justify-self: end;
}

.quote-counter strong {
  color: var(--accent-2);
  font-size: 32px;
  line-height: 1;
}

.quote-counter span,
.quote-source-line {
  color: var(--muted);
}

.quote-source-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-self: end;
}

.quote-source-line span {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.long-workspace {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.long-practice-band {
  grid-template-columns: 270px minmax(0, 1fr);
  align-items: start;
}

.long-practice-band .passage-list {
  max-height: min(66vh, 710px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: rgba(125, 211, 252, 0.34) transparent;
  scrollbar-width: thin;
}

.phrase-list,
.passage-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.phrase-button,
.passage-button {
  display: grid;
  gap: 4px;
  min-height: 52px;
  padding: 12px;
  border: 1px solid rgba(48, 58, 73, 0.68);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.phrase-button.active,
.passage-button.active {
  border-color: var(--accent);
  background: rgba(125, 211, 252, 0.12);
}

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

.phrase-button span {
  color: var(--muted);
  font-size: 12px;
}

.empty-note {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.classic-pager {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 27, 36, 0.88);
  box-shadow: var(--inner-shadow);
}

.long-practice-band .classic-pager {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.classic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.long-practice-band .classic-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
}

.classic-meta strong {
  color: var(--accent-2);
}

.classic-meta a {
  color: var(--accent);
  text-decoration: none;
}

.pager-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.page-button {
  display: grid;
  min-width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.page-button.active {
  border-color: var(--accent);
  color: #071018;
  background: var(--accent);
}

.page-gap {
  display: grid;
  width: 22px;
  height: 36px;
  place-items: center;
  color: var(--muted);
}

.typing-panel,
.game-shell,
.stats-block,
.ranking-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 27, 36, 0.9);
  box-shadow: var(--panel-shadow);
}

.typing-panel {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.short-practice-layout .typing-panel,
.long-workspace .typing-panel {
  border-color: rgba(125, 211, 252, 0.24);
  background:
    linear-gradient(180deg, rgba(125, 211, 252, 0.045), transparent 34%),
    rgba(21, 27, 36, 0.94);
}

.short-practice-layout .typing-panel {
  min-height: 520px;
  gap: 8px;
}

.learn-layout .typing-panel {
  gap: 8px;
}

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

.practice-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.practice-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.practice-actions,
.game-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.action-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-color: var(--line);
  font-weight: 900;
}

.action-button {
  width: 48px;
  color: #071018;
  background: var(--accent);
}

.action-button.subtle {
  color: var(--ink);
  background: transparent;
}

.typing-surface {
  position: relative;
  min-width: 0;
  cursor: text;
}

.typing-surface:focus-within .target-text {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px rgba(125, 211, 252, 0.16),
    inset 4px 0 0 rgba(125, 211, 252, 0.2);
}

.target-text {
  min-height: 220px;
  max-height: 360px;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    #0f1620;
  color: #b1bac7;
  font-size: 34px;
  font-weight: 650;
  line-height: 1.65;
  letter-spacing: 0;
  white-space: pre-wrap;
}

.short-practice-layout .target-text {
  min-height: 300px;
  max-height: 360px;
  font-size: 32px;
  line-height: 1.45;
  border-color: rgba(244, 201, 93, 0.18);
}

.long-workspace .target-text {
  min-height: 260px;
  max-height: 300px;
  padding: 18px 20px;
  font-size: 22px;
  line-height: 1.68;
  border-color: rgba(125, 211, 252, 0.13);
}

.unit.correct {
  color: var(--ink);
}

.unit.pending {
  color: #aeb8c6;
}

.unit.wrong {
  color: var(--danger);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.unit.current {
  border-left: 3px solid var(--accent-2);
  background: rgba(244, 201, 93, 0.08);
  color: var(--ink);
  box-shadow: -6px 0 0 rgba(244, 201, 93, 0.1);
}

.unit.extra {
  background: rgba(255, 116, 104, 0.14);
}

.typing-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  min-width: 1px;
  height: 1px;
  min-height: 1px;
  overflow: hidden;
  resize: none;
  padding: 0;
  border: 0;
  opacity: 0;
  color: transparent;
  background: transparent;
  caret-color: transparent;
}

.short-practice-layout .typing-input {
  min-height: 1px;
}

.long-workspace .typing-input {
  min-height: 1px;
}

.typing-input:focus,
.login-input:focus,
.game-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.16);
}

.typing-status {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.typing-status strong {
  color: var(--accent-2);
}

.typing-status span:last-child {
  text-align: right;
}

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

.game-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.typing-metrics span,
.game-stats span,
.finish-line {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  text-align: center;
}

.typing-metrics strong,
.game-stats strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
}

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

.short-preview-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 92px;
  padding: 12px;
  border: 1px solid rgba(48, 58, 73, 0.5);
  border-radius: 8px;
  color: rgba(174, 184, 198, 0.7);
  text-align: left;
  background: rgba(21, 27, 36, 0.38);
  cursor: pointer;
}

.short-preview-button strong {
  color: rgba(244, 201, 93, 0.74);
}

.short-preview-button span {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.lesson-preview-button {
  display: grid;
  gap: 5px;
  min-height: 84px;
  padding: 11px;
  border: 1px solid rgba(48, 58, 73, 0.5);
  border-radius: 8px;
  color: rgba(174, 184, 198, 0.68);
  text-align: left;
  background: rgba(21, 27, 36, 0.36);
  cursor: pointer;
}

.lesson-preview-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.44;
}

.lesson-preview-button strong {
  color: rgba(244, 201, 93, 0.74);
}

.lesson-preview-button span,
.lesson-preview-button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-preview-button small {
  color: rgba(151, 163, 179, 0.64);
}

.finish-line {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: rgba(155, 231, 194, 0.14);
}

.finish-line strong {
  color: var(--accent-3);
}

.game-shell {
  display: grid;
  gap: 12px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(251, 113, 133, 0.06), transparent 42%),
    rgba(21, 27, 36, 0.92);
}

.game-toolbar,
.game-console {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.game-console {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(620px, 1.8fr);
}

.game-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}

.game-rules span {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.rain-canvas {
  width: 100%;
  height: min(64vh, 630px);
  min-height: 500px;
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: 8px;
  background: #0b1119;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.game-input {
  flex: 1;
  min-width: 160px;
  width: 100%;
  height: 64px;
  padding: 0 16px;
  font-size: 24px;
  border-color: rgba(125, 211, 252, 0.48);
  background:
    linear-gradient(90deg, rgba(125, 211, 252, 0.08), transparent 24%),
    #0b121c;
  box-shadow: inset 4px 0 0 rgba(125, 211, 252, 0.26);
}

.game-stats {
  width: 100%;
}

.stats-block,
.ranking-block {
  padding: 16px;
}

.stat-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-line:last-child {
  border-bottom: 0;
}

.stat-line span {
  color: var(--muted);
}

.stat-line strong {
  color: var(--ink);
  font-size: 24px;
}

.ranking-list {
  display: grid;
  gap: 4px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 70px 56px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  color: var(--muted);
}

.rank-num {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.rank-name {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    padding-inline: 18px;
  }

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

  .app-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .main-nav,
  .login-zone {
    justify-content: start;
  }

  .main-nav {
    flex-wrap: wrap;
  }

  .view-head,
  .game-toolbar,
  .game-console {
    align-items: stretch;
    flex-direction: column;
  }

  .view-head {
    flex-wrap: wrap;
  }

  .view-head h1 {
    font-size: 36px;
  }

  .control-stack {
    justify-items: start;
  }

  .learn-grid,
  .practice-band,
  .short-practice-layout,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .quote-context {
    grid-template-columns: 1fr;
  }

  .quote-counter,
  .quote-source-line {
    justify-self: start;
  }

  .long-practice-band .classic-meta,
  .game-console {
    grid-template-columns: 1fr;
  }

  .long-practice-band .passage-list {
    max-height: 220px;
  }

  .lesson-map {
    max-height: 280px;
    grid-template-columns: repeat(8, minmax(34px, 1fr));
  }

  .typing-metrics,
  .game-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .target-text {
    min-height: 150px;
  }

  .short-practice-layout .typing-panel {
    min-height: 0;
  }

  .long-workspace .target-text,
  .short-practice-layout .target-text {
    max-height: 300px;
  }

  .rain-canvas {
    height: min(44vh, 520px);
    min-height: 360px;
    order: 3;
  }

  .game-toolbar {
    order: 1;
  }

  .game-console {
    order: 2;
  }
}

@media (max-width: 420px) {
  .layout {
    padding-inline: 12px;
  }

  .segmented,
  .segmented.wide {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: initial;
  }

  .lesson-map {
    grid-template-columns: repeat(6, minmax(32px, 1fr));
  }

  .target-text {
    font-size: 23px;
  }
}
