:root {
  --gold: #c9962e;
  --gold2: #ffd978;
  --navy: #073b78;
  --navy-dark: #071b3d;
  --text: #111827;
  --muted: #536987;
  --line: rgba(7, 59, 120, 0.2);
  --surface: rgba(255, 255, 255, 0.9);
  --surface-2: rgba(247, 251, 255, 0.88);
  --red: #c5262f;
  --green: #0a6f72;
  --left-pinky: #d64654;
  --left-ring: #d37a3f;
  --left-middle: #c49c34;
  --left-index: #3b9d73;
  --thumb: #6b7890;
  --right-index: #2f9db5;
  --right-middle: #3b68b6;
  --right-ring: #6654b3;
  --right-pinky: #b83f87;
  --shadow: 0 18px 44px rgba(7, 27, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  overflow: hidden;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 217, 120, 0.25), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 244, 251, 0.98)),
    repeating-radial-gradient(circle at 30% 20%, #ffffff 0 1px, #eef4fb 1px 5px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 44%, rgba(7, 27, 61, 0.07));
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(92px, auto) auto auto minmax(250px, 1fr) clamp(220px, 38vh, 330px);
  gap: 6px;
  width: min(1440px, calc(100% - 24px));
  height: 100vh;
  margin: 0 auto;
  padding: 8px 0;
}

.site-header,
.brand,
.header-hero,
.hero-actions,
.mode-actions,
.translation-actions,
.lesson-head,
.translation-head,
.keyboard-head {
  display: flex;
  align-items: center;
}

.site-header,
.lesson-head,
.translation-head,
.keyboard-head {
  justify-content: space-between;
}

.site-header {
  gap: 24px;
  min-height: 0;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid rgba(201, 150, 46, 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 217, 120, 0.16), transparent 30%),
    linear-gradient(135deg, rgba(5, 10, 18, 0.96), rgba(7, 27, 61, 0.94) 48%, rgba(5, 5, 5, 0.92));
  box-shadow:
    0 18px 42px rgba(7, 27, 61, 0.18),
    inset 0 1px 0 rgba(255, 217, 120, 0.18);
}

.brand {
  flex: 0 0 auto;
  gap: 10px;
  color: #eadfc7;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 217, 120, 0.78);
  border-radius: 50%;
  background: #fffaf0;
  box-shadow:
    0 0 18px rgba(255, 217, 120, 0.22),
    0 8px 22px rgba(0, 0, 0, 0.28);
}

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

.brand strong {
  display: block;
  color: var(--gold2);
  font-size: 1.08rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-shadow:
    0 1px 0 rgba(61, 38, 7, 0.6),
    0 0 18px rgba(255, 217, 120, 0.28);
}

.brand small {
  color: #9f927b;
}

.brand-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-links a {
  color: #cfc1a4;
  text-decoration: none;
  white-space: nowrap;
}

.brand-links a:hover {
  color: var(--gold2);
}

@media (min-width: 1680px) {
  .app-shell {
    width: min(1760px, calc(100% - 56px));
    grid-template-columns: 1fr;
    grid-template-rows: minmax(104px, auto) auto auto minmax(320px, 1fr) clamp(280px, 34vh, 420px);
    gap: 10px;
    padding: 14px 0;
  }

  .practice-grid {
    grid-template-columns: 286px minmax(0, 1fr) 300px;
  }

  .header-hero h1 {
    font-size: clamp(1.8rem, 1.75vw, 3rem);
  }

  .header-hero p {
    font-size: 1rem;
  }

  .key {
    font-size: clamp(1rem, 0.9vw, 1.32rem);
  }
}

.header-hero p,
.keyboard-head p,
.hand > span,
.stats span,
.ood-card p,
.ood-card em {
  color: var(--muted);
}

.page-section,
.practice-card,
.coach-panel,
.command-panel,
.keyboard-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.header-hero {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: space-between;
  gap: 24px;
  align-self: stretch;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.header-hero > div:first-child {
  min-width: 0;
}

.header-hero .eyebrow {
  display: none;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-hero h1 {
  max-width: 820px;
  margin: 0 0 4px;
  color: #f8f1df;
  font-size: clamp(1.22rem, 2vw, 2.25rem);
  line-height: 1;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  text-shadow: 0 0 22px rgba(255, 217, 120, 0.12);
}

.title-shimmer {
  display: inline-block;
  color: var(--gold2);
  background: linear-gradient(95deg, #8b5a12 0%, #c9962e 26%, #fff0b8 48%, #c9962e 68%, #6f480d 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow:
    0 1px 0 rgba(61, 38, 7, 0.22),
    0 0 20px rgba(255, 217, 120, 0.22);
  animation: titleGoldFlow 4.8s ease-in-out infinite;
  -webkit-text-fill-color: transparent;
}

.header-hero p {
  max-width: 820px;
  margin: 0;
  color: #cfc1a4;
  font-size: 0.86rem;
  line-height: 1.34;
  overflow-wrap: anywhere;
}

.hero-rotator {
  display: grid;
  width: min(820px, 100%);
  min-height: 1.4em;
  color: #eadfc7;
  font-weight: 800;
}

.hero-rotator span {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  opacity: 0;
  transform: translateY(7px);
  overflow-wrap: normal;
  word-break: normal;
  text-wrap: balance;
  animation: heroPhraseFlow 24s ease-in-out infinite;
}

.hero-rotator span:first-child {
  color: var(--gold2);
  text-shadow: 0 0 18px rgba(255, 217, 120, 0.2);
}

.hero-rotator span:nth-child(2) {
  animation-delay: 4s;
}

.hero-rotator span:nth-child(3) {
  animation-delay: 8s;
}

.hero-rotator span:nth-child(4) {
  animation-delay: 12s;
}

.hero-rotator span:nth-child(5) {
  animation-delay: 16s;
}

.hero-rotator span:nth-child(6) {
  animation-delay: 20s;
}

.hero-actions {
  position: relative;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.language-tab,
.mode-pill,
.level-pill,
.translation-tab,
.reset-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-weight: 800;
}

.site-header .language-tab {
  border-color: rgba(201, 150, 46, 0.42);
  background: rgba(0, 0, 0, 0.22);
  color: #cfc1a4;
  box-shadow: inset 0 1px 0 rgba(255, 217, 120, 0.1);
}

.site-header .language-tab:hover {
  border-color: rgba(255, 217, 120, 0.72);
  color: var(--gold2);
}

.language-tab,
.mode-pill {
  min-height: 34px;
}

.language-tab {
  min-width: 96px;
  padding: 0 14px;
}

.language-more {
  position: relative;
}

.language-more-button {
  min-width: 42px;
  min-height: 34px;
  border: 1px solid rgba(201, 150, 46, 0.42);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--gold2);
  font-weight: 900;
  letter-spacing: 0.12em;
  box-shadow: inset 0 1px 0 rgba(255, 217, 120, 0.1);
}

.language-more-button:hover,
.language-more-button[aria-expanded="true"] {
  border-color: rgba(255, 217, 120, 0.78);
  background: rgba(255, 217, 120, 0.12);
}

.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: none;
  width: 230px;
  max-height: min(66vh, 520px);
  overflow: auto;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 217, 120, 0.58) rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 217, 120, 0.38);
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 217, 120, 0.16), transparent 35%),
    linear-gradient(145deg, rgba(5, 10, 18, 0.98), rgba(7, 27, 61, 0.96));
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.26);
}

.language-menu::-webkit-scrollbar {
  width: 8px;
}

.language-menu::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.language-menu::-webkit-scrollbar-thumb {
  border: 2px solid rgba(5, 10, 18, 0.96);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 217, 120, 0.78), rgba(201, 150, 46, 0.62));
}

.language-menu.open {
  display: grid;
  gap: 6px;
}

.language-menu strong {
  color: var(--gold2);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.language-menu button {
  min-height: 30px;
  border: 1px solid rgba(201, 150, 46, 0.26);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: #eadfc7;
  font-weight: 800;
  text-align: left;
}

.language-menu button:hover {
  border-color: rgba(255, 217, 120, 0.58);
  color: var(--gold2);
}

.language-menu button.selected {
  border-color: rgba(255, 217, 120, 0.82);
  background: linear-gradient(180deg, rgba(255, 217, 120, 0.18), rgba(201, 150, 46, 0.1));
  color: var(--gold2);
  box-shadow: inset 0 1px 0 rgba(255, 217, 120, 0.14);
}

.language-menu span {
  position: sticky;
  bottom: -10px;
  display: block;
  margin: 4px -10px -10px;
  padding: 9px 10px;
  border-top: 1px solid rgba(255, 217, 120, 0.24);
  background:
    linear-gradient(180deg, rgba(7, 27, 61, 0.72), rgba(5, 10, 18, 0.98)),
    rgba(5, 10, 18, 0.98);
  color: #cfc1a4;
  font-size: 0.72rem;
  line-height: 1.3;
  box-shadow: 0 -10px 18px rgba(5, 10, 18, 0.4);
}

.language-menu span.active {
  color: #eadfc7;
}

.language-tab.active,
.mode-pill.active,
.translation-tab.active {
  border-color: var(--navy);
  background: linear-gradient(180deg, #0b4d93, var(--navy));
  color: white;
}

.site-header .language-tab.active {
  border-color: rgba(255, 217, 120, 0.86);
  background: linear-gradient(180deg, rgba(255, 217, 120, 0.22), rgba(201, 150, 46, 0.14));
  color: var(--gold2);
  text-shadow: 0 0 14px rgba(255, 217, 120, 0.22);
}

.mode-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 7px 12px;
  overflow: visible;
  min-width: 0;
}

.quick-start {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 7px 12px;
  min-width: 0;
}

.quick-start-title {
  min-width: 0;
}

.quick-start-title strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.quick-start-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quick-start-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
}

.quick-start-steps b {
  display: inline-flex;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(212, 160, 57, 0.44);
  border-radius: 50%;
  color: #d4a039;
  background: rgba(255, 255, 255, 0.62);
}

.quick-start-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(212, 160, 57, 0.48);
  border-radius: 8px;
  padding: 0 14px;
  background: #0f4f94;
  color: white;
  font-weight: 900;
  text-decoration: none;
}

.mode-strip > div:first-child {
  flex: 1 1 170px;
  min-width: 0;
}

.mode-support {
  flex: 1 1 280px;
  min-width: 180px;
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.mode-support.support-active {
  color: var(--gold2);
  background: linear-gradient(95deg, #8b5a12 0%, #c9962e 26%, #fff0b8 48%, #c9962e 68%, #6f480d 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.96rem, 1.12vw, 1.16rem);
  letter-spacing: 0.03em;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.16),
    0 0 20px rgba(255, 217, 120, 0.22);
  animation: titleGoldFlow 4.8s ease-in-out infinite;
  -webkit-text-fill-color: transparent;
}

.mode-strip strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.mode-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mode-pill {
  padding: 0 16px;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shuffle-toggle {
  position: relative;
  display: inline-grid;
  width: 42px;
  min-width: 42px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(212, 160, 57, 0.5);
  border-radius: 8px;
  background:
    radial-gradient(circle at 44% 28%, rgba(255, 250, 214, 0.88), transparent 42%),
    linear-gradient(145deg, #fff1b2 0%, #d7a23a 48%, #8f5d14 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.44),
    inset 0 -8px 16px rgba(100, 61, 5, 0.16),
    0 5px 14px rgba(10, 20, 36, 0.12);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.shuffle-toggle:hover,
.shuffle-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 217, 120, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    inset 0 -8px 16px rgba(100, 61, 5, 0.12),
    0 8px 18px rgba(10, 20, 36, 0.18),
    0 0 18px rgba(255, 207, 91, 0.18);
}

.shuffle-toggle.is-active {
  border-color: rgba(255, 217, 120, 0.98);
  background:
    radial-gradient(circle at 44% 28%, rgba(255, 255, 226, 0.95), transparent 42%),
    linear-gradient(145deg, #fff6bf 0%, #e1ad42 42%, #9d6818 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    inset 0 -8px 16px rgba(100, 61, 5, 0.12),
    0 0 22px rgba(255, 205, 86, 0.28);
}

.shuffle-toggle.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.shuffle-toggle::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 50%;
  bottom: calc(100% + 10px);
  z-index: 20;
  max-width: 210px;
  padding: 7px 10px;
  border: 1px solid rgba(212, 160, 57, 0.5);
  border-radius: 8px;
  background: #101928;
  color: #ffe19a;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(4, 12, 24, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.shuffle-toggle:hover::after,
.shuffle-toggle:focus-visible::after {
  opacity: 1;
  transform: translate(50%, 0);
}

.shuffle-knot {
  width: 29px;
  height: 29px;
  overflow: visible;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35))
    drop-shadow(0 1px 2px rgba(63, 38, 5, 0.28));
}

.shuffle-knot path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.knot-red {
  stroke: #c91f1a;
  stroke-width: 8;
}

.knot-blue {
  stroke: #125f82;
  stroke-width: 6.6;
}

.knot-green {
  stroke: #4f7d38;
  stroke-width: 6.6;
}

.knot-light {
  stroke: #fff4bb;
  stroke-width: 3.2;
  stroke-dasharray: 10 138;
  stroke-dashoffset: 0;
  opacity: 0.86;
  filter:
    drop-shadow(0 0 3px rgba(255, 255, 220, 0.94))
    drop-shadow(0 0 5px rgba(99, 58, 5, 0.36));
  animation: knotLight 4.8s linear infinite;
}

.knot-light-blue {
  animation-duration: 3.9s;
  animation-delay: -0.9s;
}

.knot-light-green {
  animation-duration: 4.4s;
  animation-delay: -1.8s;
}

.shuffle-toggle.is-active .shuffle-knot {
  filter:
    drop-shadow(0 0 4px rgba(255, 217, 120, 0.28))
    drop-shadow(0 0 10px rgba(255, 217, 120, 0.18));
}

.shuffle-toggle.is-active .knot-light {
  stroke-width: 3.8;
  opacity: 1;
  animation-duration: 2.8s;
}

.shuffle-toggle.is-active .knot-light-blue {
  animation-duration: 2.35s;
}

.shuffle-toggle.is-active .knot-light-green {
  animation-duration: 2.65s;
}

@keyframes knotLight {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -148; }
}

.practice-grid {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 292px;
  gap: 12px;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.practice-card {
  display: grid;
  grid-template-rows: auto auto auto minmax(42px, 1fr) minmax(92px, 1.15fr);
  gap: 6px;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  padding: 12px;
}

.lesson-head {
  gap: 16px;
  min-width: 0;
}

.lesson-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.lesson-head > div:first-child {
  min-width: 0;
}

.lesson-head h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.lesson-source {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.reset-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--navy);
  font-size: 1.25rem;
}

.lesson-nav-button {
  display: grid;
  width: 34px;
  height: 38px;
  place-items: center;
  border-color: rgba(201, 150, 46, 0.34);
  color: #7b5511;
  font-size: 1.35rem;
  line-height: 1;
}

.lesson-nav-button:hover,
.reset-button:hover {
  border-color: rgba(201, 150, 46, 0.68);
  background: rgba(255, 217, 120, 0.12);
}

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

.level-pill {
  min-height: 30px;
  color: var(--muted);
  font-size: 0.76rem;
}

.level-pill.active {
  border-color: var(--gold);
  background: rgba(255, 217, 120, 0.28);
  color: #7b5511;
}

.translation-card,
.ood-card,
.stats div {
  border: 1px solid rgba(7, 59, 120, 0.16);
  border-radius: 8px;
  background: var(--surface-2);
}

.translation-card {
  padding: 8px 10px;
  min-width: 0;
  border-color: rgba(201, 150, 46, 0.3);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 217, 120, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(5, 10, 18, 0.94), rgba(7, 27, 61, 0.9));
  box-shadow:
    inset 0 1px 0 rgba(255, 217, 120, 0.12),
    0 10px 26px rgba(7, 27, 61, 0.1);
}

.translation-head {
  min-width: 0;
  gap: 10px;
}

.translation-card .label {
  color: var(--gold2);
  text-shadow: 0 0 14px rgba(255, 217, 120, 0.22);
}

.translation-actions {
  gap: 5px;
}

.translation-tab {
  min-width: 34px;
  min-height: 26px;
  border-color: rgba(201, 150, 46, 0.36);
  background: rgba(0, 0, 0, 0.2);
  color: #cfc1a4;
  font-size: 0.72rem;
  box-shadow: inset 0 1px 0 rgba(255, 217, 120, 0.08);
}

.translation-tab:hover {
  border-color: rgba(255, 217, 120, 0.68);
  color: var(--gold2);
}

.translation-tab.active {
  border-color: rgba(255, 217, 120, 0.86);
  background: linear-gradient(180deg, rgba(255, 217, 120, 0.22), rgba(201, 150, 46, 0.12));
  color: var(--gold2);
  text-shadow: 0 0 12px rgba(255, 217, 120, 0.2);
}

.translation-card p {
  margin: 5px 0 0;
  color: #eadfc7;
  font-size: 1.14rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.text-line {
  align-self: center;
  justify-self: stretch;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: center;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(1rem, 1.8vw, 1.62rem);
  line-height: 1.28;
}

.text-line span {
  border-bottom: 3px solid transparent;
}

.text-line .done {
  color: var(--navy);
}

.text-line .current {
  color: var(--text);
  border-color: var(--gold);
}

.text-line .wrong {
  color: var(--red);
  background: rgba(197, 38, 47, 0.1);
}

.typing-field {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 5px;
  min-height: 0;
}

.typing-field span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 56px;
  height: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 1.4rem;
  line-height: 1.35;
  overflow: hidden;
}

textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(7, 59, 120, 0.14);
}

.coach-panel {
  display: grid;
  grid-template-rows: minmax(86px, auto) minmax(0, 1fr);
  align-content: stretch;
  gap: 6px;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 9px;
}

.command-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 6px;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 9px;
}

.next-key-card {
  display: grid;
  grid-template-columns: minmax(44px, 0.34fr) minmax(124px, 1fr);
  grid-template-areas:
    "label label"
    "key cue";
  align-items: center;
  gap: 6px 10px;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  padding: 9px;
  border: 1px solid rgba(7, 59, 120, 0.24);
  border-radius: 8px;
  background: linear-gradient(180deg, #0b4d93, var(--navy));
  color: white;
}

.next-key-main {
  display: contents;
}

.next-key-card .label {
  grid-area: label;
  display: inline-block;
  max-width: max-content;
  color: #dbeafe;
  white-space: nowrap;
  overflow-wrap: normal;
  font-size: clamp(0.62rem, 0.78vw, 0.78rem);
  line-height: 1.05;
}

.next-key-card strong {
  grid-area: key;
  display: block;
  margin-top: 0;
  font-size: 2.1rem;
  line-height: 1;
}

.finger-cue {
  grid-area: cue;
  display: grid;
  gap: 5px;
  justify-items: end;
  min-width: 0;
}

.finger-cue span {
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  font-size: clamp(0.68rem, 0.74vw, 0.78rem);
  line-height: 1.12;
  font-weight: 800;
}

.press-hand {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  min-width: 0;
  width: 100%;
  max-width: 118px;
  padding: 0 7px 10px;
  justify-self: end;
}

.press-hand[data-side="right"] {
  flex-direction: row-reverse;
}

.next-key-card[data-hand-side="right"] .press-hand::after {
  right: 20px;
  left: 15px;
}

.press-hand i {
  display: block;
  width: 12px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  transition: transform 0.16s ease, background 0.16s ease;
}

.press-hand::after {
  content: "";
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 20px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 18px 18px 8px 8px;
  background: rgba(255, 255, 255, 0.16);
}

.press-hand i:nth-child(1) { height: 23px; }
.press-hand i:nth-child(2) { height: 32px; }
.press-hand i:nth-child(3) { height: 37px; }
.press-hand i:nth-child(4) { height: 34px; }
.press-hand i:nth-child(5) {
  width: 18px;
  height: 12px;
  margin-bottom: 7px;
  transform: rotate(-28deg);
}

.press-hand[data-side="right"] i:nth-child(5) {
  transform: rotate(28deg);
}

.press-hand i.active {
  background: var(--gold2);
  transform: translateY(6px);
}

.press-hand i:nth-child(5).active {
  transform: rotate(-28deg) translateY(6px);
}

.press-hand[data-side="right"] i:nth-child(5).active {
  transform: rotate(28deg) translateY(6px);
}

@keyframes titleGoldFlow {
  0% {
    background-position: 0% 50%;
    filter: brightness(1);
  }
  50% {
    background-position: 100% 50%;
    filter: brightness(1.16);
  }
  100% {
    background-position: 0% 50%;
    filter: brightness(1);
  }
}

@keyframes heroPhraseFlow {
  0%,
  13% {
    opacity: 1;
    transform: translateY(0);
  }

  17%,
  100% {
    opacity: 0;
    transform: translateY(-7px);
  }
}

.hands,
.hand {
  display: grid;
}

.hands {
  gap: 5px;
  min-height: 0;
}

.hand {
  gap: 4px;
}

.hand > span {
  font-size: 0.78rem;
  font-weight: 800;
}

.finger-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  min-width: 0;
}

.finger-row b {
  display: grid;
  height: clamp(34px, 5.2vh, 52px);
  min-width: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
}

.finger-row b.active {
  outline: 3px solid rgba(7, 59, 120, 0.16);
  transform: translateY(-2px);
}

[data-finger="left-pinky"] { --zone: var(--left-pinky); }
[data-finger="left-ring"] { --zone: var(--left-ring); }
[data-finger="left-middle"] { --zone: var(--left-middle); }
[data-finger="left-index"] { --zone: var(--left-index); }
[data-finger="left-thumb"],
[data-finger="right-thumb"] { --zone: var(--thumb); }
[data-finger="right-index"] { --zone: var(--right-index); }
[data-finger="right-middle"] { --zone: var(--right-middle); }
[data-finger="right-ring"] { --zone: var(--right-ring); }
[data-finger="right-pinky"] { --zone: var(--right-pinky); }

.finger-row b[data-finger],
.key[data-finger] {
  background: color-mix(in srgb, var(--zone) 18%, white);
  border-color: color-mix(in srgb, var(--zone) 48%, white);
}

.ood-card {
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.ood-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.04rem;
  line-height: 1.15;
}

.ood-card p,
.ood-card em {
  margin: 6px 0 0;
  font-size: 0.9rem;
  line-height: 1.25;
}

.ood-card p {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.ood-card em {
  display: block;
  font-style: normal;
  font-weight: 800;
}

.ood-card em[data-state="correct"] {
  color: var(--green);
}

.ood-card em[data-state="wrong"] {
  color: var(--red);
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-height: 0;
}

.stats div {
  min-width: 0;
  padding: 6px;
}

.stats strong {
  display: block;
  font-size: 1.08rem;
}

.stats span {
  font-size: 0.7rem;
  font-weight: 700;
}

.keyboard-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 5px;
  min-height: 0;
  padding: 10px 12px 12px;
  overflow: hidden;
  min-width: 0;
}

.keyboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.keyboard-foot {
  margin-top: 0;
}

.keyboard-head > div:first-child {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.keyboard-thumb-label {
  color: var(--muted);
  font-size: clamp(0.7rem, 0.86vw, 0.86rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.keyboard-head .label::after {
  content: "·";
  margin-left: 6px;
  color: var(--muted);
}

.keyboard-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
}

.keyboard-head p {
  max-width: min(58vw, 760px);
  margin: 0;
  font-size: 0.88rem;
  line-height: 1;
  justify-self: end;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.keyboard-finger-guide {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: clamp(4px, 0.8vh, 7px);
  min-width: 0;
  min-height: 24px;
  align-items: end;
}

.keyboard-finger-guide span {
  min-width: 0;
  color: var(--zone, var(--muted));
  font-size: clamp(0.64rem, 0.82vw, 0.86rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 1px 4px;
  border-bottom: 3px solid var(--zone, transparent);
}

.keyboard {
  display: grid;
  gap: clamp(4px, 0.8vh, 7px);
  height: 100%;
  align-content: stretch;
  min-width: 0;
  min-height: 0;
  padding-bottom: 14px;
}

.key-row {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: clamp(4px, 0.8vh, 7px);
  min-height: 0;
}

.key {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: clamp(28px, 4.6vh, 48px);
  place-items: center;
  border: 1px solid rgba(7, 59, 120, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #edf4fb);
  color: var(--text);
  font-size: clamp(0.84rem, 1.12vw, 1.08rem);
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 -5px 0 rgba(7, 27, 61, 0.08);
}

.key.dead-key {
  grid-template-rows: 1fr auto;
  gap: 0;
  padding-top: 0;
  padding-bottom: 5px;
  color: var(--navy);
  background:
    linear-gradient(180deg, rgba(255, 249, 226, 0.98), rgba(255, 232, 166, 0.9)),
    linear-gradient(90deg, var(--gold), var(--gold));
  border-color: rgba(201, 150, 46, 0.48);
}

.key.dead-key span {
  line-height: 1;
  transform: translateY(4px);
}

.key.dead-key small {
  max-width: 100%;
  color: #6a4a05;
  font-size: clamp(0.6rem, 0.89vw, 0.84rem);
  font-weight: 900;
  line-height: 1;
  transform: translateY(-4px);
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.key.accent-target::before {
  content: "´";
  position: absolute;
  top: 3px;
  right: 6px;
  color: var(--gold);
  font-size: 1.13rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.key.control {
  color: var(--muted);
  font-size: clamp(0.62rem, 0.85vw, 0.78rem);
}

.key.active {
  border-color: var(--zone, var(--navy));
  background: var(--zone, var(--navy));
  color: white;
  transform: translateY(-2px);
  box-shadow: inset 0 -5px 0 rgba(7, 27, 61, 0.16), 0 10px 22px rgba(7, 27, 61, 0.18);
}

.key.accent-step,
.key.base-step {
  position: relative;
}

.key.accent-step {
  border-color: var(--gold);
  outline: 3px solid rgba(201, 150, 46, 0.34);
  outline-offset: 2px;
  box-shadow:
    inset 0 -5px 0 rgba(7, 27, 61, 0.16),
    0 0 0 5px rgba(255, 217, 120, 0.16),
    0 10px 22px rgba(7, 27, 61, 0.18);
}

.key.base-step {
  outline: 3px solid rgba(7, 59, 120, 0.24);
  outline-offset: 2px;
}

.key.accent-step::after {
  content: "1";
  position: absolute;
  top: -9px;
  right: -7px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(7, 27, 61, 0.18);
}

.key.base-step::after {
  content: "2";
  position: absolute;
  top: -9px;
  right: -7px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: white;
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(7, 27, 61, 0.18);
}

.key.space {
  min-height: clamp(30px, 4.8vh, 50px);
  font-size: clamp(1rem, 1.36vw, 1.42rem);
  letter-spacing: 0.02em;
  align-content: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 237, 243, 0.96)),
    linear-gradient(90deg, var(--thumb), var(--thumb));
  border-color: rgba(110, 124, 140, 0.32);
}

@media (max-height: 760px) and (min-width: 921px) {
  .app-shell {
    grid-template-rows: minmax(86px, auto) auto minmax(300px, 1fr) clamp(205px, 30vh, 245px);
  }

  .quick-start {
    display: none;
  }

  .header-hero p,
  .keyboard-head p {
    display: none;
  }

  .translation-card {
    padding: 6px 8px;
  }

  .translation-card p {
    font-size: 1.02rem;
  }

  .practice-card {
    grid-template-rows: auto auto auto minmax(36px, 0.8fr) minmax(70px, 1fr);
    gap: 5px;
    padding: 10px;
  }

  .text-line {
    line-height: 1.18;
  }

  .key {
    min-height: clamp(25px, 4vh, 38px);
  }

  .coach-panel {
    grid-template-rows: minmax(78px, auto) minmax(0, 1fr);
    gap: 5px;
    padding: 8px;
  }

  .command-panel {
    gap: 5px;
    padding: 8px;
  }

  .next-key-card {
    grid-template-columns: minmax(42px, 0.34fr) minmax(116px, 1fr);
    padding: 8px;
  }

  textarea {
    min-height: 48px;
    font-size: 1.22rem;
  }

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

  .ood-card p,
  .ood-card em {
    font-size: 0.86rem;
  }

  .ood-card {
    overflow: auto;
  }

  .finger-row {
    gap: 4px;
  }

  .key.space {
    min-height: clamp(27px, 4.2vh, 40px);
  }
}

@media (max-height: 680px) and (min-width: 921px) {
  .app-shell {
    grid-template-rows: minmax(70px, auto) auto minmax(230px, 1fr) clamp(190px, 34vh, 260px);
    gap: 5px;
    padding: 6px 0;
  }

  .quick-start {
    display: none;
  }

  .header-hero {
    padding: 6px 10px;
  }

  .header-hero h1 {
    margin: 2px 0;
    font-size: clamp(1.2rem, 2.2vw, 2.4rem);
  }

  .mode-strip {
    padding: 5px 10px;
  }

  .keyboard-panel {
    padding: 8px 10px 10px;
  }
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-rows: auto;
    height: auto;
    min-height: 100vh;
    width: min(100% - 18px, 860px);
  }

  .header-hero,
  .practice-grid {
    grid-template-columns: 1fr;
  }

  .site-header,
  .header-hero {
    align-items: start;
    flex-direction: column;
  }

  .hero-actions {
    justify-content: start;
    justify-self: start;
  }

  .mode-strip,
  .quick-start,
  .keyboard-head {
    align-items: start;
    flex-direction: column;
  }

  .keyboard-head {
    grid-template-columns: 1fr;
  }

  .keyboard-thumb-label,
  .keyboard-head p {
    justify-self: start;
    text-align: left;
  }

  .quick-start {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quick-start-steps {
    grid-template-columns: 1fr;
  }

  .quick-start-link {
    width: 100%;
  }

  .mode-support {
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .coach-panel {
    grid-template-columns: minmax(220px, 0.88fr) minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: stretch;
    overflow: visible;
  }

  .command-panel {
    grid-template-columns: minmax(0, 1fr) minmax(230px, 0.7fr);
    grid-template-rows: auto;
    align-items: stretch;
    overflow: visible;
  }

  .stats {
    grid-template-columns: repeat(3, 1fr);
    align-content: stretch;
  }

  .command-panel .stats {
    grid-column: auto;
  }

  .finger-row b {
    height: 48px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .site-header {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }

  .header-hero {
    padding: 14px;
  }

  .brand-links {
    gap: 6px;
    font-size: 0.72rem;
  }

  .brand strong {
    font-size: 0.98rem;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .header-hero h1 {
    font-size: clamp(1.45rem, 8vw, 2.2rem);
    line-height: 1.05;
  }

  .header-hero p {
    font-size: 0.9rem;
  }

  .hero-actions {
    width: 100%;
  }

  .language-tab {
    flex: 1;
    min-width: 0;
  }

  .mode-actions,
  .level-strip,
  .translation-actions {
    width: 100%;
  }

  .mode-pill,
  .level-pill,
  .translation-tab {
    flex: 1 1 auto;
  }

  .level-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .translation-head {
    align-items: start;
    flex-direction: column;
  }

  .text-line {
    font-size: clamp(1.05rem, 6vw, 1.45rem);
  }

  .practice-card {
    min-height: 440px;
    padding: 18px;
  }

  .coach-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .command-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .finger-row b {
    height: 52px;
  }

  .keyboard-panel {
    overflow-x: auto;
  }

  .keyboard {
    min-width: 760px;
  }

  .keyboard-finger-guide {
    min-width: 760px;
  }

  .language-menu {
    right: auto;
    left: 0;
    width: min(86vw, 260px);
  }

  .key-row {
    gap: 4px;
  }

  .key {
    min-height: 42px;
    font-size: 0.78rem;
  }

  .key.control {
    font-size: 0.62rem;
  }
}

@media (min-width: 921px) and (max-width: 1180px) {
  .app-shell {
    width: min(100% - 18px, 1120px);
  }

  .practice-grid {
    grid-template-columns: 218px minmax(0, 1fr) 270px;
    gap: 8px;
  }

  .header-hero {
    gap: 14px;
  }

  .language-tab {
    min-width: 82px;
    padding: 0 10px;
  }
}

@media (max-width: 420px) {
  .app-shell {
    width: calc(100% - 12px);
    padding-top: 6px;
  }

  .site-header,
  .practice-card,
  .coach-panel,
  .command-panel,
  .keyboard-panel,
  .mode-strip {
    border-radius: 7px;
  }

  .hero-actions {
    gap: 6px;
  }

  .language-tab {
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .language-more-button {
    min-width: 36px;
  }

  .coach-panel {
    padding: 8px;
  }

  .command-panel {
    padding: 8px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto;
  }

  .keyboard-panel {
    min-height: 220px;
  }
}
