:root {
  --page: #f2f5f7;
  --page-deep: #e5ecef;
  --surface: #ffffff;
  --surface-soft: #f4f8f7;
  --ink: #142f3f;
  --ink-soft: #405b68;
  --muted: #637985;
  --teal: #15766e;
  --teal-dark: #0b554f;
  --teal-light: #dcefeb;
  --orange: #b96b2d;
  --orange-dark: #84471c;
  --orange-light: #f8eee4;
  --yellow: #d2ad55;
  --red: #dc4e4e;
  --line: #d8e6e3;
  --shadow: 0 12px 34px rgba(39, 77, 83, 0.09);
  --radius-lg: 26px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(21, 118, 110, 0.08), transparent 30rem),
    radial-gradient(circle at 92% 22rem, rgba(20, 47, 63, 0.06), transparent 32rem),
    var(--page);
  font-family:
    "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-feature-settings: "palt";
}

button,
select,
input {
  font: inherit;
}

button,
select,
[tabindex] {
  outline-color: var(--orange);
  outline-offset: 4px;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(calc(100% - 40px), 1160px);
  margin: 26px auto 42px;
}

.site-header {
  min-height: 72px;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border: 1px solid rgba(24, 59, 78, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(61, 89, 88, 0.07);
  backdrop-filter: blur(10px);
}

.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-monogram {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 15px;
  color: #fff;
  background: var(--teal);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
  font: 800 12px/1 Georgia, serif;
}

.brand-monogram::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 28px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.38);
  transform: rotate(30deg);
}

.brand-monogram i {
  position: absolute;
  font-style: normal;
}

.brand-monogram i:first-child {
  top: 9px;
  left: 10px;
}

.brand-monogram i:last-child {
  right: 10px;
  bottom: 9px;
}

.brand-copy strong {
  display: block;
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.brand-copy small {
  display: block;
  margin-top: 5px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.header-center span {
  width: 28px;
  height: 2px;
  border-radius: 99px;
  background: var(--yellow);
}

.header-center p {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.header-actions {
  justify-self: end;
  display: flex;
  gap: 9px;
}

.header-button {
  min-height: 42px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.header-button:hover {
  border-color: var(--teal);
  background: var(--surface-soft);
}

.help-button {
  width: 42px;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
}

.help-button:hover {
  color: var(--ink);
}

.help-button span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.sound-wave {
  color: var(--orange-dark);
  font-size: 18px;
}

.game-shell {
  padding-top: 16px;
}

.control-deck {
  min-height: 78px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid rgba(24, 59, 78, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(61, 89, 88, 0.06);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 9px;
}

.control-group > label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.select-wrap,
.segmented-select {
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 2px solid #cfe2dd;
  border-radius: 13px;
  background: #fff;
  overflow: hidden;
}

.select-wrap > span {
  width: 43px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--teal);
  font-size: 13px;
  font-weight: 900;
}

.control-deck select {
  min-height: 42px;
  padding: 0 34px 0 12px;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

#courseSelect {
  min-width: 190px;
}

#layoutSelect {
  min-width: 155px;
}

.mode-note {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mode-note > span {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--teal-light);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.mode-note p {
  max-width: 200px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.shortcut-guide {
  margin-left: auto;
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.play-back-link {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c9dcd7;
  border-radius: 12px;
  color: var(--teal-dark);
  background: var(--surface-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.play-back-link:hover {
  border-color: var(--teal);
  background: #fff;
}

.selected-course-card {
  min-height: 54px;
  padding: 5px 7px 5px 5px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 2px solid #cfe2dd;
  border-radius: 15px;
  background: #fff;
}

.selected-course-card > span {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  color: #fff;
  background: var(--teal);
  font-size: 13px;
  font-weight: 900;
}

.selected-course-card > div {
  min-width: 150px;
}

.selected-course-card small,
.selected-course-card strong {
  display: block;
}

.selected-course-card small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.selected-course-card strong {
  margin-top: 2px;
  font-size: 14px;
}

.selected-course-card a {
  min-height: 34px;
  margin-left: 4px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 9px;
  color: var(--teal-dark);
  background: var(--teal-light);
  text-decoration: none;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.layout-card-group,
.duration-card-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.layout-card-group > span,
.duration-card-group > span {
  margin-right: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.layout-card-group button,
.duration-card-group button {
  min-width: 78px;
  min-height: 48px;
  padding: 6px 10px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 2px solid #d3e1de;
  border-radius: 12px;
  color: var(--ink-soft);
  background: #fff;
  cursor: pointer;
}

.layout-card-group button b,
.layout-card-group button small,
.duration-card-group button b,
.duration-card-group button small {
  display: block;
}

.layout-card-group button b,
.duration-card-group button b {
  font-size: 13px;
}

.layout-card-group button small,
.duration-card-group button small {
  font-size: 9px;
  font-weight: 700;
}

.layout-card-group button.active,
.duration-card-group button.active {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-light);
  box-shadow: 0 0 0 3px rgba(33, 138, 120, 0.1);
}

kbd {
  min-width: 31px;
  padding: 4px 7px;
  display: inline-block;
  border: 1px solid #bfd2ce;
  border-bottom-width: 3px;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font: 800 10px/1.1 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-align: center;
}

.typing-stage {
  position: relative;
  margin-top: 16px;
  overflow: hidden;
  border: 2px solid #bfe2da;
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.typing-stage:focus {
  outline: none;
}

.typing-stage:focus-visible {
  box-shadow:
    0 0 0 4px rgba(255, 132, 80, 0.22),
    var(--shadow);
}

.stage-decoration {
  position: absolute;
  right: 22px;
  bottom: 12px;
  left: 22px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(24, 59, 78, 0.32);
  pointer-events: none;
}

.stage-decoration span {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.stage-decoration i {
  height: 1px;
  flex: 1;
  background: rgba(24, 59, 78, 0.12);
}

.stage-header {
  position: relative;
  z-index: 2;
  min-height: 74px;
  padding: 15px 22px;
  display: grid;
  grid-template-columns: 1fr minmax(260px, 0.9fr) 1fr;
  align-items: center;
  border-bottom: 1px solid #cae5df;
  background: var(--surface-soft);
}

.lesson-title p {
  margin: 0 0 5px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.lesson-title h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
}

.session-progress {
  width: 100%;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.progress-copy strong {
  color: var(--ink);
  font-size: 12px;
}

.progress-track {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #dce9e6;
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #58c7aa);
  transition: width 180ms ease;
}

.status-badge {
  justify-self: end;
  min-width: 96px;
  min-height: 36px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #bcded6;
  border-radius: 999px;
  color: var(--teal-dark);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.status-badge i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4fc49f;
  box-shadow: 0 0 0 4px rgba(79, 196, 159, 0.15);
}

.status-badge[data-state="playing"] i {
  animation: statusPulse 1.1s infinite;
}

.status-badge[data-state="paused"],
.status-badge[data-state="imeBlocked"] {
  color: #a54a2c;
  border-color: #ffd1bd;
  background: var(--orange-light);
}

.status-badge[data-state="paused"] i,
.status-badge[data-state="imeBlocked"] i {
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(255, 132, 80, 0.16);
}

.status-badge[data-state="completed"] {
  color: #765300;
  border-color: #f1cc6c;
  background: #fff9df;
}

.status-badge[data-state="completed"] i {
  background: #edb526;
}

.stage-body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column-reverse;
}

.metric-rail {
  min-height: 66px;
  padding: 10px 22px 14px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  border-top: 1px solid #e1ece9;
  background: #fbfefd;
}

.metric-rail > div {
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: #eff7f5;
  text-align: center;
}

.metric-rail span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.metric-rail strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-rail strong b {
  font: inherit;
}

.metric-rail small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 10px;
}

.stage-content {
  min-width: 0;
}

.stage-panel {
  min-height: 224px;
  padding: 25px 34px 31px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ready-panel {
  gap: clamp(20px, 4vw, 48px);
}

.ready-mark {
  position: relative;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid #a8d9ce;
  border-radius: 24px;
  color: var(--teal-dark);
  background: var(--teal-light);
}

.ready-mark::before,
.ready-mark::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
}

.ready-mark::before {
  top: 6px;
  right: 10px;
}

.ready-mark::after {
  bottom: 8px;
  left: 10px;
  background: var(--yellow);
}

.ready-mark span {
  font-size: 25px;
  font-weight: 900;
}

.ready-copy {
  max-width: 520px;
}

.ready-copy p {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.65;
}

.ready-copy > span {
  display: block;
  margin-top: 11px;
  color: var(--muted);
  font-size: 13px;
}

.ready-copy b {
  color: var(--teal-dark);
}

.primary-button {
  min-height: 50px;
  padding: 0 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--orange);
  box-shadow: 0 5px 0 var(--orange-dark);
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  transition:
    transform 100ms ease,
    background 100ms ease,
    box-shadow 100ms ease;
}

.primary-button:hover {
  background: #ff9566;
  transform: translateY(-1px);
}

.primary-button:active {
  box-shadow: 0 2px 0 var(--orange-dark);
  transform: translateY(3px);
}

.primary-button kbd {
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.countdown-panel {
  flex-direction: column;
}

.countdown-panel p {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 15px;
  font-weight: 900;
}

.countdown-panel strong {
  color: var(--orange);
  font-size: 92px;
  line-height: 0.95;
  animation: countdownIn 0.45s ease;
}

.play-panel {
  position: relative;
  padding-inline: 145px;
  flex-direction: column;
  text-align: center;
}

.display-text {
  min-height: 50px;
  max-width: 760px;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: clamp(31px, 3.4vw, 46px);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.03em;
}

.reading-text {
  min-height: 24px;
  margin: 0 0 9px;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 700;
}

.target-text {
  min-height: 53px;
  max-width: 100%;
  color: var(--ink);
  font: 800 clamp(29px, 3.2vw, 43px)/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.045em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.target-text.lesson-keys {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: clamp(23px, 2.7vw, 38px);
}

.target-text .target-token {
  min-width: 50px;
  padding: 8px 11px;
  border: 2px solid #c8dcd8;
  border-radius: 12px;
  background: #f8fbfa;
}

.target-text .typed {
  color: #77a69d;
}

.target-text .target-token.typed {
  border-color: #b7e2d7;
  color: var(--teal);
  background: var(--teal-light);
}

.target-text .current {
  position: relative;
  color: var(--orange-dark);
}

.target-text .current::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 5px;
  border-radius: 99px;
  background: var(--orange);
}

.target-text .target-token.current {
  border-color: var(--orange);
  color: var(--orange-dark);
  background: var(--orange-light);
  box-shadow: 0 0 0 5px rgba(255, 132, 80, 0.12);
}

.target-text .target-token.current::after {
  display: none;
}

.target-text.miss {
  animation: missShake 0.22s linear;
}

.next-key-hint {
  position: absolute;
  top: 50%;
  right: 28px;
  width: 108px;
  padding: 10px 7px;
  transform: translateY(-50%);
  border: 1px solid #cfe2de;
  border-radius: 16px;
  background: #f8fcfb;
  text-align: center;
}

.next-key-hint > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.next-key-hint > strong {
  min-width: 47px;
  margin: 6px 0;
  padding: 8px 10px;
  display: inline-block;
  border: 2px solid #9bc9bf;
  border-bottom-width: 5px;
  border-radius: 10px;
  color: #fff;
  background: var(--teal);
  font: 800 19px/1 ui-monospace, Consolas, monospace;
}

.next-key-hint p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.pause-panel {
  gap: 25px;
}

.pause-symbol {
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid #ffc9b2;
  border-radius: 22px;
  background: var(--orange-light);
}

.pause-symbol i {
  width: 8px;
  height: 27px;
  border-radius: 4px;
  background: var(--orange);
}

.panel-kicker {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.pause-panel h2,
.result-summary h2 {
  margin: 0 0 8px;
  font-size: 25px;
  line-height: 1.2;
}

.pause-panel > div > span {
  color: var(--muted);
  font-size: 14px;
}

.panel-actions {
  margin-left: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.text-button {
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.ime-symbol {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 2px solid #ffc9b2;
  border-radius: 20px;
  color: var(--orange-dark);
  background: var(--orange-light);
  font-size: 31px;
  font-weight: 900;
}

.ime-panel .primary-button {
  margin-left: 18px;
}

.result-panel {
  gap: 24px;
}

.rank-block {
  width: 88px;
  height: 88px;
  display: grid;
  place-content: center;
  border: 3px solid #f0c54d;
  border-radius: 28px;
  color: #725100;
  background: #fff7d6;
  text-align: center;
}

.rank-block span {
  font-size: 10px;
  font-weight: 900;
}

.rank-block strong {
  display: block;
  margin-top: 3px;
  font-size: 38px;
  line-height: 0.9;
}

.result-summary {
  min-width: 180px;
}

.result-main-score span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.result-main-score strong {
  margin-left: 8px;
  color: var(--orange-dark);
  font-size: 25px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(85px, 1fr));
  gap: 8px;
}

.result-metrics > div {
  padding: 8px 11px;
  border-radius: 10px;
  background: #f0f7f5;
}

.result-metrics span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.result-metrics strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.typing-capture {
  position: absolute;
  right: 12px;
  bottom: 9px;
  width: 2px;
  height: 2px;
  padding: 0;
  border: 0;
  opacity: 0.01;
  clip-path: inset(50%);
}

.keyboard-section {
  margin-top: 18px;
  padding: 20px 22px 22px;
  overflow: hidden;
  border: 1px solid rgba(24, 59, 78, 0.12);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.keyboard-heading {
  min-height: 48px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}

.keyboard-heading > div:first-child > p,
.guide-copy > p {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.keyboard-heading h2,
.guide-copy h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}

.keyboard-message {
  padding: 9px 15px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.legend {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-key {
  width: 13px;
  height: 13px;
  display: inline-block;
  border: 2px solid #aebfbc;
  border-radius: 4px;
  background: #fff;
}

.legend-key.next {
  border-color: var(--orange);
  background: var(--orange-light);
}

.legend-key.pressed {
  border-color: var(--teal);
  background: var(--teal-light);
}

.legend-key.wrong {
  border-color: var(--red);
  background: #ffe7e7;
}

.keyboard {
  --key-unit: clamp(36px, 4.35vw, 59px);
  --key-height: clamp(39px, 4vw, 51px);
  --key-gap: 7px;
  max-width: 100%;
  margin-top: 16px;
  padding: 17px;
  overflow-x: auto;
  border: 1px solid #cfdcd9;
  border-radius: 20px;
  background:
    linear-gradient(180deg, #e8eeec, #dbe5e2);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -3px 0 rgba(24, 59, 78, 0.06);
}

.keyboard-board {
  position: relative;
  width: max-content;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--key-gap);
}

.keyboard-board[data-layout="jis"] {
  padding-right: calc(var(--key-gap) * 4);
}

.keyboard-row {
  display: flex;
  align-items: stretch;
  gap: var(--key-gap);
}

.key {
  position: relative;
  width: calc(var(--key-unit) * var(--width));
  height: var(--key-height);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid #adbfbb;
  border-bottom-width: 4px;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 2px 3px rgba(45, 66, 64, 0.09);
  font: 800 clamp(10px, 1vw, 15px)/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-align: center;
  transition:
    transform 90ms ease,
    border-color 100ms ease,
    background 100ms ease,
    box-shadow 100ms ease;
}

.key::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 3px;
  left: 5px;
  height: 4px;
  border-radius: 99px;
  background: var(--finger-color, #9badaa);
  opacity: 0.48;
}

.key > span:first-child {
  transform: translateY(-1px);
}

.key .shift-label {
  position: absolute;
  top: 5px;
  right: 6px;
  color: var(--muted);
  font-size: 9px;
}

.key.home-key {
  background: #f4fbf9;
}

.home-bump {
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 15px;
  height: 3px;
  border-radius: 99px;
  background: var(--teal);
  transform: translateX(-50%);
}

.key-enter-jis {
  position: absolute;
  top: calc(var(--key-height) + var(--key-gap));
  left: calc(var(--key-unit) * 13.7 + var(--key-gap) * 13);
  z-index: 3;
  width: calc(var(--key-unit) * 1.6);
  height: calc(var(--key-height) * 2 + var(--key-gap));
  border-radius: 9px 9px 14px 9px;
  color: #fff;
  background: var(--ink);
  border-color: #0d2937;
}

.key-enter-jis::after {
  background: #f1c966;
  opacity: 0.9;
}

.key.next {
  z-index: 4;
  border-color: var(--orange);
  color: #8d351a;
  background: #fff1e9;
  box-shadow:
    0 0 0 4px rgba(255, 132, 80, 0.18),
    0 4px 0 #dd6840;
  transform: translateY(-2px);
}

.key.next-alternative {
  z-index: 2;
  border: 2px dashed var(--orange);
  border-bottom-width: 4px;
  color: #8d351a;
  background: #fffaf6;
}

.key.shift-needed,
.key.modifier-required {
  border-color: #9279c2;
  color: #4f397c;
  background: #f4efff;
  box-shadow: 0 0 0 4px rgba(146, 121, 194, 0.14);
}

.key.pressed {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-light);
  animation: keyPressed 150ms ease;
}

.key.wrong {
  z-index: 5;
  border-color: var(--red);
  color: #8f2222;
  background: #ffe6e6;
  animation: keyWrong 220ms linear;
}

.key.home-return {
  animation: homeReturn 420ms ease;
}

.finger-guide {
  margin-top: 18px;
  padding: 20px 24px 13px;
  display: grid;
  grid-template-columns: 225px 1fr;
  align-items: center;
  border: 1px solid rgba(24, 59, 78, 0.12);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 72% 20%, rgba(255, 211, 106, 0.18), transparent 17rem),
    var(--surface);
  box-shadow: var(--shadow);
}

.guide-copy {
  padding-right: 22px;
}

.guide-copy > span {
  display: block;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.hands-visual {
  position: relative;
  height: 225px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(24px, 4vw, 58px);
  overflow: hidden;
}

.hand-figure {
  position: relative;
  width: 165px;
  height: 225px;
  flex: 0 0 auto;
  margin: 0;
}

.hand-figure img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center top;
  filter: drop-shadow(0 8px 6px rgba(43, 83, 72, 0.13));
  transition: transform 130ms ease;
}

.hand-figure.tap img {
  animation: handTap 150ms ease;
}

.hand-figure figcaption {
  position: absolute;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.86);
  font-size: 10px;
  font-weight: 900;
}

.hand-left figcaption {
  left: 4px;
}

.hand-right figcaption {
  right: 4px;
}

.finger-marker {
  position: absolute;
  top: var(--y);
  left: var(--x);
  z-index: 4;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid var(--finger-color, var(--ink-soft));
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 3px 7px rgba(35, 62, 55, 0.15);
  font-style: normal;
  transition:
    transform 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease;
}

.finger-marker span {
  color: var(--ink);
  font-size: 9px;
  font-weight: 900;
}

.finger-marker.active {
  transform: translate(-50%, -50%) scale(1.35);
  border-color: color-mix(in srgb, var(--finger-color) 82%, #3d2721);
  background: var(--finger-color);
  box-shadow:
    0 0 0 7px color-mix(in srgb, var(--finger-color) 20%, transparent),
    0 4px 8px rgba(81, 60, 45, 0.23);
  animation: fingerPulse 0.85s infinite alternate ease-in-out;
}

.finger-marker.active span {
  color: #fff;
}

.finger-marker.modifier-active {
  border-style: double;
  box-shadow:
    0 0 0 7px rgba(146, 121, 194, 0.2),
    0 4px 8px rgba(81, 60, 45, 0.2);
}

.finger-marker.pressed-correct {
  animation: fingerPressCorrect 150ms ease;
}

.finger-marker.pressed-wrong {
  animation: fingerPressWrong 230ms linear;
}

.finger-marker.home-return {
  animation: fingerHomeReturn 420ms ease;
}

.active-finger-card {
  width: 185px;
  align-self: center;
  padding: 15px 13px;
  border: 2px solid #cce2dc;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
  box-shadow: 0 8px 18px rgba(37, 74, 69, 0.07);
}

.active-finger-card > span {
  display: block;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
}

.active-finger-card strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.45;
}

.active-finger-card p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.active-finger-card p i {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--orange);
}

.finger-index {
  grid-column: 1 / -1;
  margin-top: 3px;
  padding-top: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr) 22px repeat(5, 1fr);
  gap: 6px;
  border-top: 1px solid #e1ece9;
}

.finger-index span {
  padding: 5px 2px;
  border: 1px solid color-mix(in srgb, var(--finger-color) 35%, #dce8e5);
  border-radius: 8px;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--finger-color) 8%, #fff);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.finger-index span.active {
  border-color: var(--finger-color);
  color: #fff;
  background: var(--finger-color);
  transform: translateY(-2px);
}

.finger-index > i {
  width: 1px;
  justify-self: center;
  background: #cbdcd8;
}

.finger-marker[data-finger="left-pinky"],
[data-finger-index="left-pinky"],
.key[data-finger="left-pinky"] {
  --finger-color: #ff5f91;
}

.finger-marker[data-finger="left-ring"],
[data-finger-index="left-ring"],
.key[data-finger="left-ring"] {
  --finger-color: #f5a524;
}

.finger-marker[data-finger="left-middle"],
[data-finger-index="left-middle"],
.key[data-finger="left-middle"] {
  --finger-color: #4c8dff;
}

.finger-marker[data-finger="left-index"],
[data-finger-index="left-index"],
.key[data-finger="left-index"] {
  --finger-color: #20c29a;
}

.finger-marker[data-finger="left-thumb"],
[data-finger-index="left-thumb"],
.key[data-finger="left-thumb"],
.finger-marker[data-finger="right-thumb"],
[data-finger-index="right-thumb"],
.key[data-finger="right-thumb"] {
  --finger-color: #9a70ff;
}

.finger-marker[data-finger="right-index"],
[data-finger-index="right-index"],
.key[data-finger="right-index"] {
  --finger-color: #20c29a;
}

.finger-marker[data-finger="right-middle"],
[data-finger-index="right-middle"],
.key[data-finger="right-middle"] {
  --finger-color: #4c8dff;
}

.finger-marker[data-finger="right-ring"],
[data-finger-index="right-ring"],
.key[data-finger="right-ring"] {
  --finger-color: #f5a524;
}

.finger-marker[data-finger="right-pinky"],
[data-finger-index="right-pinky"],
.key[data-finger="right-pinky"] {
  --finger-color: #ff5f91;
}

footer {
  min-height: 54px;
  padding: 16px 4px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  color: var(--muted);
}

footer p,
footer span {
  margin: 0;
  font-size: 12px;
}

footer p {
  color: var(--ink-soft);
  font-weight: 800;
}

.play-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 16px;
}

.play-footer nav a {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.play-footer nav a:hover {
  color: var(--teal-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

dialog {
  width: min(calc(100% - 32px), 560px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 30px 80px rgba(24, 59, 78, 0.28);
}

dialog::backdrop {
  background: rgba(24, 59, 78, 0.48);
  backdrop-filter: blur(4px);
}

dialog form {
  position: relative;
  padding: 30px;
}

.dialog-kicker {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

dialog h2 {
  margin: 0 0 18px;
  font-size: 28px;
}

dialog ol {
  margin: 0 0 18px;
  padding-left: 1.5em;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 2;
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  font-size: 21px;
}

.dialog-note {
  padding: 13px 15px;
  border-left: 5px solid var(--orange);
  border-radius: 8px;
  color: #7a3d25;
  background: var(--orange-light);
  font-size: 13px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 50;
  transform: translateX(-50%);
  max-width: min(90vw, 620px);
  padding: 13px 18px;
  border-radius: 13px;
  color: #fff;
  background: #9b4128;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 800;
}

noscript {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
}

@keyframes statusPulse {
  50% {
    opacity: 0.35;
    transform: scale(0.72);
  }
}

@keyframes countdownIn {
  from {
    opacity: 0;
    transform: scale(1.3);
  }
}

@keyframes missShake {
  25% {
    color: var(--red);
    transform: translateX(-6px);
  }
  75% {
    color: var(--red);
    transform: translateX(6px);
  }
}

@keyframes keyPressed {
  50% {
    transform: translateY(3px);
    border-bottom-width: 1px;
  }
}

@keyframes keyWrong {
  30% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(4px);
  }
}

@keyframes homeReturn {
  45% {
    border-color: var(--yellow);
    background: #fff7d8;
    box-shadow: 0 0 0 6px rgba(255, 211, 106, 0.22);
    transform: translateY(-3px);
  }
}

@keyframes handTap {
  45% {
    transform: translateY(5px) scale(0.985);
  }
}

@keyframes fingerPulse {
  to {
    transform: translate(-50%, -50%) scale(1.48);
  }
}

@keyframes fingerPressCorrect {
  50% {
    transform: translate(-50%, -50%) translateY(7px) scale(1.18);
  }
}

@keyframes fingerPressWrong {
  30% {
    transform: translate(-50%, -50%) translateX(-4px);
    background: var(--red);
  }
  70% {
    transform: translate(-50%, -50%) translateX(4px);
    background: var(--red);
  }
}

@keyframes fingerHomeReturn {
  45% {
    background: var(--yellow);
    box-shadow: 0 0 0 8px rgba(255, 211, 106, 0.24);
    transform: translate(-50%, -50%) scale(1.35);
  }
}

@media (max-width: 1080px) {
  .app-shell {
    width: min(calc(100% - 24px), 1000px);
  }

  .header-center,
  .mode-note {
    display: none;
  }

  .site-header {
    grid-template-columns: 1fr 1fr;
  }

  .play-back-link {
    display: none;
  }

  .control-deck {
    flex-wrap: wrap;
  }

  .selected-course-card {
    flex: 1 1 330px;
  }

  .layout-card-group {
    flex: 1 1 300px;
  }

  .shortcut-guide {
    grid-template-columns: 1fr 1fr;
  }

  .stage-header {
    grid-template-columns: 1fr minmax(230px, 0.8fr) auto;
  }

  .keyboard {
    --key-unit: clamp(32px, 4.25vw, 46px);
    --key-height: clamp(36px, 4vw, 44px);
    --key-gap: 5px;
  }

  .finger-guide {
    grid-template-columns: 190px 1fr;
  }

  .hands-visual {
    gap: 18px;
  }

  .hand-figure {
    width: 145px;
  }

  .active-finger-card {
    width: 160px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(calc(100% - 18px), 760px);
    margin-top: 12px;
  }

  .site-header {
    min-height: 64px;
    padding: 9px 12px;
  }

  .brand-copy strong {
    font-size: 21px;
  }

  .brand-copy small,
  .shortcut-guide,
  .legend {
    display: none;
  }

  .control-deck {
    gap: 12px;
  }

  .play-back-link {
    display: none;
  }

  .control-group {
    flex: 1 1 280px;
  }

  .select-wrap,
  .segmented-select {
    flex: 1;
  }

  .control-deck select {
    width: 100%;
  }

  .stage-header {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .session-progress {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .play-panel {
    min-height: 260px;
    padding: 28px 25px 92px;
  }

  .next-key-hint {
    top: auto;
    right: 50%;
    bottom: 14px;
    width: auto;
    min-width: 170px;
    padding: 7px 12px;
    transform: translateX(50%);
  }

  .next-key-hint > span,
  .next-key-hint p,
  .next-key-hint > strong {
    display: inline-block;
    margin: 0 5px;
    vertical-align: middle;
  }

  .metric-rail {
    grid-template-columns: repeat(5, minmax(76px, 1fr));
    overflow-x: auto;
  }

  .keyboard-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .keyboard-message {
    justify-self: stretch;
  }

  .keyboard {
    margin-inline: -8px;
  }

  .finger-guide {
    grid-template-columns: 1fr;
  }

  .guide-copy {
    padding: 0 0 12px;
    text-align: center;
  }

  .hands-visual {
    height: 220px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: calc(100% - 12px);
  }

  .brand-monogram {
    width: 40px;
    height: 40px;
  }

  .header-button {
    min-height: 38px;
    padding-inline: 10px;
  }

  .selected-course-card {
    width: 100%;
  }

  .selected-course-card > div {
    min-width: 0;
    flex: 1;
  }

  .layout-card-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .layout-card-group > span {
    width: 100%;
  }

  .layout-card-group button {
    flex: 1;
  }

  #soundLabel,
  footer span {
    display: none;
  }

  .typing-stage,
  .keyboard-section,
  .finger-guide {
    border-radius: 19px;
  }

  .stage-header {
    padding: 13px 16px;
  }

  .lesson-title h1 {
    font-size: 21px;
  }

  .stage-panel {
    padding-inline: 18px;
  }

  .ready-panel {
    flex-direction: column;
    text-align: center;
  }

  .display-text {
    font-size: 30px;
  }

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

  .keyboard-section {
    padding-inline: 12px;
  }

  .keyboard {
    --key-unit: 30px;
    --key-height: 36px;
    --key-gap: 4px;
    padding: 12px;
  }

  .key {
    border-radius: 7px;
    font-size: 9px;
  }

  .hands-visual {
    height: 190px;
    gap: 4px;
  }

  .hand-figure {
    width: 115px;
    height: 190px;
  }

  .active-finger-card {
    width: 130px;
    padding: 10px 8px;
  }

  .active-finger-card strong {
    font-size: 12px;
  }

  .finger-index {
    display: none;
  }

  footer {
    justify-content: center;
  }
}

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

/*
 * Desktop play view: the prompt, full keyboard and all ten fingers stay within
 * one viewport. Category pages retain their normal document scrolling.
 */
@media (min-width: 900px) {
  .play-body {
    height: 100dvh;
    min-height: 600px;
    overflow: hidden;
  }

  .play-body .app-shell {
    width: min(calc(100% - 16px), 1160px);
    height: min(100dvh, 900px);
    margin: max(0px, calc((100dvh - 900px) / 2)) auto;
    padding: 6px 0;
    display: grid;
    grid-template-rows: 52px minmax(0, 1fr);
    gap: 6px;
  }

  .play-body .site-header {
    min-height: 0;
    height: 52px;
    padding: 5px 12px;
    border-radius: 17px;
  }

  .play-body .brand {
    gap: 8px;
  }

  .play-body .brand-monogram {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .play-body .brand-monogram i:first-child {
    top: 7px;
    left: 8px;
  }

  .play-body .brand-monogram i:last-child {
    right: 8px;
    bottom: 7px;
  }

  .play-body .brand-copy strong {
    font-size: 20px;
  }

  .play-body .brand-copy small {
    margin-top: 2px;
    font-size: 9px;
  }

  .play-body .play-back-link {
    font-size: 12px;
  }

  .play-body .header-button {
    min-height: 34px;
    padding: 0 11px;
    border-radius: 11px;
    font-size: 11px;
  }

  .play-body .help-button {
    width: 34px;
  }

  .play-body .game-shell {
    min-height: 0;
    padding: 0;
    display: grid;
    grid-template-rows:
      48px
      minmax(158px, 0.85fr)
      minmax(210px, 1.2fr)
      minmax(104px, 0.62fr);
    gap: 6px;
  }

  .play-body .control-deck {
    min-height: 0;
    height: 100%;
    padding: 4px 10px;
    gap: 10px;
    flex-wrap: nowrap;
    border-radius: 14px;
  }

  .play-body .selected-course-card {
    min-height: 0;
    flex: 1 1 auto;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .play-body .selected-course-card > span {
    width: 31px;
    height: 31px;
    font-size: 10px;
  }

  .play-body .selected-course-card small,
  .play-body .layout-card-group > span {
    font-size: 9px;
  }

  .play-body .selected-course-card strong {
    font-size: 13px;
  }

  .play-body .selected-course-card a {
    padding: 5px 8px;
    font-size: 9px;
  }

  .play-body .layout-card-group {
    flex: 0 0 auto;
    gap: 4px;
  }

  .play-body .layout-card-group button {
    min-width: 62px;
    min-height: 34px;
    padding: 2px 8px;
    border-radius: 10px;
  }

  .play-body .layout-card-group button b {
    font-size: 11px;
  }

  .play-body .layout-card-group button small {
    font-size: 8px;
  }

  .play-body .mode-note {
    min-width: 190px;
    padding: 4px 9px;
  }

  .play-body .mode-note span {
    font-size: 9px;
  }

  .play-body .mode-note p {
    font-size: 9px;
  }

  .play-body .shortcut-guide {
    gap: 2px;
    font-size: 9px;
  }

  .play-body .shortcut-guide kbd {
    min-width: 27px;
    padding: 3px 5px;
    font-size: 8px;
  }

  .play-body .typing-stage,
  .play-body .keyboard-section,
  .play-body .finger-guide {
    height: 100%;
    min-height: 0;
    margin: 0;
    border-radius: 18px;
  }

  .play-body .typing-stage {
    display: grid;
    grid-template-rows: 44px minmax(0, 1fr);
  }

  .play-body .stage-header {
    min-height: 0;
    height: 44px;
    padding: 5px 13px;
    grid-template-columns: minmax(160px, 1fr) minmax(220px, 0.85fr) auto;
    gap: 14px;
  }

  .play-body .lesson-title p {
    margin-bottom: 1px;
    font-size: 8px;
  }

  .play-body .lesson-title h1 {
    font-size: 16px;
  }

  .play-body .progress-copy,
  .play-body .progress-copy strong {
    font-size: 9px;
  }

  .play-body .progress-track {
    height: 5px;
    margin-top: 3px;
  }

  .play-body .status-badge {
    min-width: 76px;
    min-height: 28px;
    padding: 0 9px;
    font-size: 9px;
  }

  .play-body .status-badge i {
    width: 7px;
    height: 7px;
  }

  .play-body .stage-body {
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 36px;
  }

  .play-body .stage-content {
    min-height: 0;
    grid-row: 1;
  }

  .play-body .metric-rail {
    min-height: 0;
    padding: 3px 10px;
    grid-row: 2;
    gap: 5px;
  }

  .play-body .metric-rail > div {
    padding: 2px 7px;
    border-radius: 8px;
  }

  .play-body .metric-rail span {
    font-size: 8px;
  }

  .play-body .metric-rail strong {
    margin-top: 1px;
    font-size: 13px;
  }

  .play-body .metric-rail small {
    font-size: 7px;
  }

  .play-body .stage-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 6px 24px;
  }

  .play-body .ready-panel {
    gap: clamp(14px, 3vw, 32px);
  }

  .play-body .ready-mark {
    width: 54px;
    height: 54px;
    border-radius: 17px;
  }

  .play-body .ready-mark span {
    font-size: 18px;
  }

  .play-body .ready-copy p {
    font-size: 15px;
    line-height: 1.4;
  }

  .play-body .ready-copy > span {
    margin-top: 4px;
    font-size: 10px;
  }

  .play-body .primary-button {
    min-height: 38px;
    padding: 0 15px;
    border-radius: 11px;
    font-size: 12px;
  }

  .play-body .play-panel {
    padding: 4px 130px 3px;
  }

  .play-body .display-text {
    min-height: 36px;
    max-width: 820px;
    margin-bottom: 1px;
    font-size: clamp(29px, 3.2vw, 44px);
    line-height: 1.12;
  }

  .play-body .reading-text {
    min-height: 17px;
    margin-bottom: 2px;
    font-size: 12px;
  }

  .play-body .target-text {
    min-height: 36px;
    font-size: clamp(25px, 2.8vw, 38px);
    line-height: 1.08;
  }

  .play-body .target-text.lesson-keys {
    gap: 5px;
    font-size: clamp(19px, 2.2vw, 29px);
  }

  .play-body .target-text .target-token {
    min-width: 36px;
    padding: 5px 7px;
    border-radius: 9px;
  }

  .play-body .next-key-hint {
    right: 13px;
    width: 104px;
    padding: 5px;
    border-radius: 12px;
  }

  .play-body .next-key-hint > span,
  .play-body .next-key-hint p {
    font-size: 8px;
  }

  .play-body .next-key-hint > strong {
    min-width: 38px;
    margin: 3px 0;
    padding: 5px 7px;
    font-size: 15px;
  }

  .play-body .countdown-panel p {
    margin-bottom: 2px;
    font-size: 11px;
  }

  .play-body .countdown-panel strong {
    font-size: 62px;
  }

  .play-body .pause-panel,
  .play-body .result-panel {
    gap: 12px;
  }

  .play-body .pause-symbol,
  .play-body .ime-symbol {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .play-body .pause-panel h2,
  .play-body .result-summary h2 {
    margin-bottom: 3px;
    font-size: 18px;
  }

  .play-body .pause-panel > div > span {
    font-size: 10px;
  }

  .play-body .rank-block {
    width: 58px;
    height: 58px;
    border-radius: 18px;
  }

  .play-body .rank-block strong {
    font-size: 27px;
  }

  .play-body .result-panel {
    padding-inline: 12px;
  }

  .play-body .result-metrics {
    gap: 4px;
  }

  .play-body .result-metrics > div {
    padding: 3px 7px;
  }

  .play-body .result-metrics strong {
    font-size: 11px;
  }

  .play-body .keyboard-section {
    padding: 6px 10px 8px;
    display: grid;
    grid-template-rows: 28px minmax(0, 1fr);
  }

  .play-body .keyboard-heading {
    min-height: 0;
    height: 28px;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }

  .play-body .keyboard-heading > div:first-child > p {
    display: none;
  }

  .play-body .keyboard-heading h2 {
    font-size: 14px;
  }

  .play-body .keyboard-message {
    padding: 4px 10px;
    font-size: 9px;
  }

  .play-body .legend {
    gap: 7px;
    font-size: 8px;
  }

  .play-body .legend-key {
    width: 10px;
    height: 10px;
  }

  .play-body .keyboard {
    --key-unit: clamp(40px, 4.1vw, 55px);
    --key-height: clamp(29px, 4.5vh, 38px);
    --key-gap: 4px;
    min-height: 0;
    height: 100%;
    margin-top: 4px;
    padding: 7px;
    overflow: hidden;
    border-radius: 14px;
  }

  .play-body .key {
    border-bottom-width: 3px;
    border-radius: 7px;
    font-size: clamp(8px, 0.8vw, 11px);
  }

  .play-body .key .shift-label {
    top: 3px;
    right: 4px;
    font-size: 7px;
  }

  .play-body .home-bump {
    bottom: 7px;
    width: 11px;
  }

  .play-body .finger-guide {
    padding: 2px 12px;
    display: block;
  }

  .play-body .guide-copy,
  .play-body .finger-index {
    display: none;
  }

  .play-body .hands-visual {
    width: 100%;
    height: 100%;
    gap: clamp(14px, 3vw, 42px);
  }

  .play-body .hand-figure {
    width: clamp(88px, 10vw, 132px);
    height: 100%;
  }

  .play-body .hand-figure figcaption {
    bottom: 2px;
    padding: 2px 6px;
    font-size: 8px;
  }

  .play-body .finger-marker {
    width: 19px;
    height: 19px;
  }

  .play-body .finger-marker span {
    font-size: 7px;
  }

  .play-body .active-finger-card {
    width: 176px;
    padding: 8px 10px;
    border-radius: 13px;
  }

  .play-body .active-finger-card > span,
  .play-body .active-finger-card p {
    font-size: 8px;
  }

  .play-body .active-finger-card strong {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.25;
  }

  .play-body .active-finger-card p {
    margin-top: 4px;
  }

  .play-body footer {
    display: none;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .app-shell {
    padding: 4px 0;
    grid-template-rows: 44px minmax(0, 1fr);
    gap: 4px;
  }

  .play-body .site-header {
    height: 44px;
  }

  .play-body .brand-monogram {
    width: 32px;
    height: 32px;
  }

  .play-body .brand-copy small,
  .play-body .mode-note,
  .play-body .shortcut-guide {
    display: none;
  }

  .play-body .game-shell {
    grid-template-rows:
      42px
      minmax(145px, 0.8fr)
      minmax(198px, 1.2fr)
      minmax(90px, 0.55fr);
    gap: 4px;
  }

  .play-body .control-deck {
    padding-block: 2px;
  }

  .play-body .typing-stage {
    grid-template-rows: 39px minmax(0, 1fr);
  }

  .play-body .stage-header {
    height: 39px;
    padding-block: 3px;
  }

  .play-body .stage-body {
    grid-template-rows: minmax(0, 1fr) 32px;
  }

  .play-body .metric-rail {
    padding-block: 2px;
  }

  .play-body .keyboard-section {
    padding-block: 4px 5px;
    grid-template-rows: 23px minmax(0, 1fr);
  }

  .play-body .keyboard-heading {
    height: 23px;
  }

  .play-body .keyboard {
    --key-height: clamp(27px, 4.4vh, 31px);
    --key-gap: 3px;
    margin-top: 3px;
    padding: 5px;
  }

  .play-body .hand-figure {
    width: clamp(78px, 9vw, 105px);
  }

  .play-body .active-finger-card {
    width: 158px;
    padding: 5px 8px;
  }

  .play-body .active-finger-card p {
    display: none;
  }
}

.content-load-error {
  position: fixed;
  z-index: 9999;
  top: 16px;
  right: 16px;
  left: 16px;
  max-width: 760px;
  margin: auto;
  padding: 16px 20px;
  border: 2px solid #c83d3d;
  border-radius: 14px;
  color: #7d1f1f;
  background: #fff4f4;
  box-shadow: var(--shadow);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.6;
}

/* Keep supporting text legible without weakening the one-screen desktop layout. */
.play-body .brand-copy small,
.play-body .selected-course-card small,
.play-body .selected-course-card a,
.play-body .layout-card-group > span,
.play-body .duration-card-group > span,
.play-body .layout-card-group button small,
.play-body .duration-card-group button small,
.play-body .mode-note span,
.play-body .mode-note p,
.play-body .shortcut-guide,
.play-body .shortcut-guide kbd,
.play-body .lesson-title p,
.play-body .progress-copy,
.play-body .progress-copy strong,
.play-body .metric-rail span,
.play-body .metric-rail small,
.play-body .next-key-hint > span,
.play-body .next-key-hint p,
.play-body .keyboard-message,
.play-body .legend,
.play-body .hand-figure figcaption,
.play-body .active-finger-card > span,
.play-body .active-finger-card p {
  font-size: 11px;
}

.play-body .key .shift-label {
  font-size: 9px;
}

.play-body .ready-copy > span,
.play-body .pause-panel > div > span,
.play-body .result-metrics span {
  font-size: 12px;
}

.play-body .active-finger-card strong,
.play-body .result-metrics strong {
  font-size: 14px;
}

/* v1.8: fixed hands, large fingertip indicators and compact session cards */
.finger-marker.active {
  transform: translate(-50%, -50%) scale(1.08);
  animation: none;
}

.finger-marker.pressed-correct {
  background: #31a979;
  animation: none;
}

.finger-marker.pressed-wrong {
  background: var(--red);
  animation: none;
}

.hand-pair-figure.tap img {
  animation: none;
}

@media (max-width: 899px) {
  .finger-marker {
    width: 36px;
    height: 36px;
  }

  .finger-marker span {
    font-size: 12px;
  }
}

@media (min-width: 900px) {
  .play-body .duration-card-group {
    gap: 3px;
  }

  .play-body .duration-card-group button {
    min-width: 54px;
    padding-inline: 5px;
  }

  .play-body .duration-card-group button small {
    display: none;
  }

  .play-body .keyboard-section {
    z-index: 6;
  }

  .play-body .finger-guide {
    z-index: 4;
    margin-top: -20px;
  }

  .play-body .hand-pair-figure {
    top: -54px;
  }

  .play-body .finger-marker {
    width: 42px;
    height: 42px;
    border-width: 3px;
  }

  .play-body .finger-marker span {
    font-size: 13px;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .finger-guide {
    margin-top: -18px;
  }

  .play-body .hand-pair-figure {
    top: -50px;
  }

  .play-body .finger-marker {
    width: 38px;
    height: 38px;
  }
}

.play-body .key .shift-label {
  font-size: 10px;
}

/* Compact time controls and one large, wrist-free pair of illustrated hands */
.hand-pair-figure {
  position: relative;
  width: min(100%, 820px);
  height: auto;
  aspect-ratio: 2143 / 734;
  flex: 0 0 auto;
  margin: 0;
}

.hand-pair-figure img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center top;
  filter: drop-shadow(0 8px 7px rgba(43, 83, 72, 0.13));
}

.hand-pair-figure.tap img {
  animation: handTap 150ms ease;
}

.hands-visual .active-finger-card {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 9%;
  transform: translateX(-50%);
}

@media (max-width: 1080px) {
  .duration-card-group {
    flex: 1 1 280px;
  }
}

@media (max-width: 620px) {
  .duration-card-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .duration-card-group > span {
    width: 100%;
  }

  .duration-card-group button {
    flex: 1;
  }
}

/* Keep the illustrated hands still; only fingertip markers react to input. */
.play-body .hand-pair-figure.tap img,
.play-body .hand-pair-figure img {
  animation: none;
}

@media (min-width: 900px) {
  .play-body .selected-course-card small,
  .play-body .layout-card-group > span,
  .play-body .duration-card-group > span {
    font-size: 9px;
  }

  .play-body .layout-card-group,
  .play-body .duration-card-group {
    flex: 0 0 auto;
    gap: 4px;
  }

  .play-body .layout-card-group button,
  .play-body .duration-card-group button {
    min-width: 58px;
    min-height: 34px;
    padding: 2px 7px;
    border-radius: 10px;
  }

  .play-body .layout-card-group button b,
  .play-body .duration-card-group button b {
    font-size: 11px;
  }

  .play-body .layout-card-group button small,
  .play-body .duration-card-group button small {
    font-size: 8px;
  }

  .play-body .game-shell {
    grid-template-rows:
      48px
      minmax(158px, 0.9fr)
      minmax(210px, 1.25fr)
      minmax(82px, 0.42fr);
  }

  .play-body .keyboard-section {
    position: relative;
    z-index: 2;
    overflow: visible;
  }

  .play-body .finger-guide {
    position: relative;
    z-index: 4;
    margin-top: -16px;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
  }

  .play-body .hands-visual {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: visible;
  }

  .play-body .hand-pair-figure {
    position: absolute;
    left: 50%;
    bottom: -5px;
    width: min(72vw, 760px);
    height: auto;
    aspect-ratio: 2172 / 724;
    transform: translateX(-50%);
  }

  .play-body .finger-marker {
    width: 23px;
    height: 23px;
  }

  .play-body .finger-marker span {
    font-size: 8px;
  }

  .play-body .hands-visual .active-finger-card {
    bottom: 5px;
    width: 180px;
    padding: 6px 9px;
    border-radius: 13px;
  }

  .play-body .hands-visual .active-finger-card > span,
  .play-body .hands-visual .active-finger-card p {
    font-size: 8px;
  }

  .play-body .hands-visual .active-finger-card strong {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.2;
  }

  .play-body .hands-visual .active-finger-card p {
    margin-top: 3px;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .duration-card-group {
    display: flex;
  }

  .play-body .game-shell {
    grid-template-rows:
      42px
      minmax(145px, 0.82fr)
      minmax(194px, 1.18fr)
      minmax(66px, 0.34fr);
  }

  .play-body .finger-guide {
    margin-top: -23px;
  }

  .play-body .hand-pair-figure {
    height: clamp(120px, 18vh, 145px);
  }

  .play-body .hands-visual .active-finger-card {
    width: 158px;
    padding: 5px 8px;
  }

  .play-body .hands-visual .active-finger-card p {
    display: none;
  }
}

/* v1.7: adult-focused game scale, tighter hand placement and neutral JIS Enter */
.key-enter-jis {
  color: var(--ink);
  background: #fff;
  border-color: #adbfbb;
}

.key-enter-jis::after {
  background: currentColor;
  opacity: 0.1;
}

.display-text,
.target-text {
  max-width: min(100%, 960px);
  overflow-wrap: anywhere;
}

@media (min-width: 900px) {
  .play-body .game-shell {
    grid-template-rows:
      48px
      minmax(165px, 0.96fr)
      minmax(210px, 1.22fr)
      minmax(72px, 0.34fr);
    gap: 4px;
  }

  .play-body .play-panel {
    padding: 3px 118px;
  }

  .play-body .display-text {
    min-height: 45px;
    font-size: clamp(36px, 4vw, 54px);
    line-height: 1.08;
  }

  .play-body .reading-text {
    min-height: 20px;
    margin-bottom: 3px;
    font-size: 14px;
  }

  .play-body .target-text {
    min-height: 43px;
    font-size: clamp(32px, 3.5vw, 47px);
    line-height: 1.08;
  }

  .play-body .selected-course-card small,
  .play-body .layout-card-group > span,
  .play-body .duration-card-group > span,
  .play-body .mode-note span,
  .play-body .mode-note p,
  .play-body .shortcut-guide {
    font-size: 12px;
  }

  .play-body .selected-course-card strong {
    font-size: 15px;
  }

  .play-body .layout-card-group button b,
  .play-body .duration-card-group button b {
    font-size: 13px;
  }

  .play-body .layout-card-group button small,
  .play-body .duration-card-group button small {
    font-size: 11px;
  }

  .play-body .metric-rail span {
    font-size: 11px;
  }

  .play-body .metric-rail strong {
    font-size: 15px;
  }

  .play-body .keyboard-heading h2 {
    font-size: 16px;
  }

  .play-body .keyboard-message {
    font-size: 12px;
  }

  .play-body .key {
    font-size: clamp(11px, 0.95vw, 14px);
  }

  .play-body .finger-guide {
    margin-top: -34px;
  }

  .play-body .hand-pair-figure {
    top: -96px;
    bottom: auto;
    width: min(72vw, 760px);
    height: auto;
    aspect-ratio: 2172 / 724;
  }

  .play-body .finger-marker {
    width: 25px;
    height: 25px;
    border-width: 2px;
  }

  .play-body .finger-marker span {
    font-size: 11px;
  }

  .play-body .hands-visual .active-finger-card {
    right: 10px;
    left: auto;
    bottom: -2px;
    width: 196px;
    transform: none;
  }

  .play-body .hands-visual .active-finger-card strong {
    font-size: 13px;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .game-shell {
    grid-template-rows:
      42px
      minmax(150px, 0.9fr)
      minmax(192px, 1.13fr)
      minmax(58px, 0.26fr);
  }

  .play-body .display-text {
    font-size: clamp(32px, 3.7vw, 47px);
  }

  .play-body .target-text {
    font-size: clamp(29px, 3.2vw, 42px);
  }

  .play-body .finger-guide {
    margin-top: -38px;
  }

  .play-body .hand-pair-figure {
    top: -100px;
    width: min(70vw, 700px);
    height: auto;
  }
}

/* v1.7 final type floor: later than every compact-height rule. */
.play-body .brand-copy small,
.play-body .selected-course-card small,
.play-body .selected-course-card a,
.play-body .layout-card-group > span,
.play-body .duration-card-group > span,
.play-body .layout-card-group button small,
.play-body .duration-card-group button small,
.play-body .mode-note span,
.play-body .mode-note p,
.play-body .shortcut-guide,
.play-body .shortcut-guide kbd,
.play-body .lesson-title p,
.play-body .progress-copy,
.play-body .progress-copy strong,
.play-body .metric-rail span,
.play-body .metric-rail small,
.play-body .next-key-hint > span,
.play-body .next-key-hint p,
.play-body .keyboard-message,
.play-body .legend,
.play-body .hand-figure figcaption,
.play-body .active-finger-card > span,
.play-body .active-finger-card p {
  font-size: 11px;
}

.play-body .ready-copy > span,
.play-body .pause-panel > div > span,
.play-body .result-metrics span {
  font-size: 12px;
}

.play-body .active-finger-card strong,
.play-body .result-metrics strong {
  font-size: 14px;
}

/* v1.8 true final overrides: the image stays behind keys; markers remain readable. */
.play-body .hand-pair-figure {
  aspect-ratio: 2143 / 734;
}

.play-body .hand-pair-figure img {
  animation: none;
}

@media (min-width: 900px) {
  .play-body .duration-card-group {
    gap: 3px;
  }

  .play-body .duration-card-group button {
    min-width: 54px;
    padding-inline: 5px;
  }

  .play-body .duration-card-group button small {
    display: none;
  }

  .play-body .keyboard-section {
    z-index: 6;
  }

  .play-body .finger-guide {
    z-index: auto;
  }

  .play-body .hand-pair-figure {
    right: 0;
    left: 0;
    margin-inline: auto;
    transform: none;
  }

  .play-body .hand-pair-figure img {
    position: relative;
    z-index: 4;
  }

  .play-body .finger-marker {
    z-index: 7;
    width: 42px;
    height: 42px;
    border-width: 3px;
  }

  .play-body .finger-marker span {
    font-size: 13px;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .finger-marker {
    width: 38px;
    height: 38px;
  }
}

/* v1.10: stable play layout, readable controls and fully visible illustrated hands */
.primary-button,
.text-button,
.panel-actions button,
dialog button {
  min-height: 44px;
  font-size: 14px;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

@media (min-width: 900px) {
  .play-body .app-shell {
    width: min(calc(100% - 20px), 1160px);
    height: 100dvh;
    margin: 0 auto;
    padding: 4px 0;
    grid-template-rows: 56px minmax(0, 1fr);
    gap: 6px;
  }

  .play-body .site-header {
    height: 56px;
    padding: 6px 12px;
  }

  .play-body .brand-monogram {
    width: 40px;
    height: 40px;
  }

  .play-body .brand-copy strong {
    font-size: 21px;
  }

  .play-body .brand-copy small {
    font-size: 11px;
  }

  .play-body .header-button {
    min-height: 42px;
    padding-inline: 13px;
    font-size: 13px;
  }

  .play-body .help-button {
    width: 42px;
  }

  .play-body .game-shell {
    padding: 0;
    grid-template-rows:
      58px
      minmax(176px, 0.95fr)
      minmax(192px, 1.08fr)
      minmax(126px, 0.72fr);
    gap: 4px;
  }

  .play-body .control-deck {
    height: 58px;
    padding: 5px 8px;
    flex-wrap: nowrap;
    gap: 8px;
    overflow: hidden;
  }

  .play-body .selected-course-card {
    min-width: 205px;
    padding-right: 4px;
  }

  .play-body .selected-course-card > span {
    width: 38px;
    height: 38px;
    font-size: 12px;
  }

  .play-body .selected-course-card > div {
    min-width: 105px;
  }

  .play-body .selected-course-card small,
  .play-body .layout-card-group > span,
  .play-body .duration-card-group > span {
    font-size: 11px;
  }

  .play-body .selected-course-card strong {
    font-size: 14px;
  }

  .play-body .selected-course-card a {
    min-height: 38px;
    padding-inline: 9px;
    font-size: 11px;
  }

  .play-body .layout-card-group,
  .play-body .duration-card-group {
    flex-wrap: nowrap;
    gap: 4px;
  }

  .play-body .layout-card-group button,
  .play-body .duration-card-group button {
    min-width: 54px;
    min-height: 40px;
    padding: 3px 7px;
    border-radius: 10px;
  }

  .play-body .layout-card-group button b,
  .play-body .duration-card-group button b {
    font-size: 13px;
  }

  .play-body .layout-card-group button small {
    font-size: 10px;
  }

  .play-body .typing-stage {
    display: grid;
    grid-template-rows: 42px minmax(0, 1fr);
    overflow: hidden;
  }

  .play-body .stage-header {
    height: 42px;
    min-height: 0;
    padding: 4px 12px;
    grid-template-columns: minmax(150px, 1fr) minmax(210px, 0.9fr) auto;
    gap: 12px;
  }

  .play-body .lesson-title p,
  .play-body .progress-copy,
  .play-body .progress-copy strong {
    font-size: 11px;
  }

  .play-body .lesson-title h1 {
    font-size: 17px;
  }

  .play-body .status-badge {
    min-width: 82px;
    min-height: 30px;
    font-size: 11px;
  }

  .play-body .stage-body {
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 34px;
  }

  .play-body .stage-content {
    min-height: 0;
    grid-row: 1;
    overflow: hidden;
  }

  .play-body .metric-rail {
    min-height: 0;
    height: 34px;
    padding: 3px 8px;
    grid-row: 2;
    gap: 5px;
  }

  .play-body .metric-rail > div {
    padding: 2px 6px;
  }

  .play-body .metric-rail span,
  .play-body .metric-rail small {
    font-size: 10px;
  }

  .play-body .metric-rail strong {
    margin-top: 1px;
    font-size: 14px;
  }

  .play-body .stage-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 5px 18px;
    overflow: hidden;
  }

  .play-body .ready-panel {
    gap: clamp(14px, 2.5vw, 28px);
  }

  .play-body .ready-mark {
    width: 54px;
    height: 54px;
    border-radius: 17px;
  }

  .play-body .ready-copy p {
    font-size: 16px;
    line-height: 1.4;
  }

  .play-body .ready-copy > span {
    margin-top: 5px;
    font-size: 11px;
  }

  .play-body .primary-button {
    min-height: 44px;
    padding-inline: 17px;
    font-size: 14px;
  }

  .play-body .play-panel {
    padding: 4px 124px 3px;
  }

  .play-body .display-text {
    min-height: 38px;
    margin-bottom: 2px;
    font-size: clamp(34px, 3.6vw, 48px);
    line-height: 1.08;
  }

  .play-body .reading-text {
    min-height: 18px;
    margin-bottom: 2px;
    font-size: 14px;
    line-height: 1.2;
  }

  .play-body .target-text {
    min-height: 38px;
    font-size: clamp(30px, 3.2vw, 43px);
    line-height: 1.08;
  }

  .play-body .next-key-hint {
    right: 12px;
    width: 104px;
    padding: 6px;
  }

  .play-body .next-key-hint > span,
  .play-body .next-key-hint p {
    font-size: 10px;
  }

  .play-body .next-key-hint > strong {
    margin: 4px 0;
    padding: 6px 8px;
    font-size: 17px;
  }

  .play-body .result-panel {
    gap: 10px;
  }

  .play-body .rank-block {
    width: 62px;
    height: 62px;
    border-radius: 19px;
  }

  .play-body .rank-block strong {
    font-size: 28px;
  }

  .play-body .result-summary h2 {
    font-size: 18px;
  }

  .play-body .result-metrics {
    grid-template-columns: repeat(4, minmax(74px, 1fr));
    gap: 4px;
  }

  .play-body .result-metrics > div {
    padding: 4px 7px;
  }

  .play-body .result-metrics span {
    font-size: 10px;
  }

  .play-body .result-metrics strong {
    font-size: 12px;
  }

  .play-body .keyboard-section {
    position: relative;
    z-index: 6;
    padding: 5px 9px 7px;
    display: grid;
    grid-template-rows: 30px minmax(0, 1fr);
    overflow: hidden;
  }

  .play-body .keyboard-heading {
    height: 30px;
    min-height: 0;
  }

  .play-body .keyboard-heading h2 {
    font-size: 15px;
  }

  .play-body .keyboard-message,
  .play-body .legend {
    font-size: 11px;
  }

  .play-body .keyboard {
    --key-unit: clamp(38px, 4.05vw, 54px);
    --key-height: clamp(28px, 4.2vh, 34px);
    --key-gap: 3px;
    height: 100%;
    margin-top: 3px;
    padding: 5px;
    overflow: hidden;
  }

  .play-body .key {
    font-size: clamp(10px, 0.9vw, 13px);
  }

  .play-body .finger-guide {
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 3px 8px;
    overflow: hidden;
    border: 1px solid rgba(24, 59, 78, 0.12);
    background: var(--surface);
    box-shadow: var(--shadow);
    pointer-events: none;
  }

  .play-body .hands-visual {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(0, 640px) minmax(150px, 1fr);
    align-items: center;
    gap: 8px;
    overflow: hidden;
  }

  .play-body .hand-pair-figure {
    position: relative;
    inset: auto;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: auto;
    max-width: 100%;
    height: min(calc(100% - 4px), 220px);
    margin: 0;
    grid-column: 2;
    justify-self: center;
    aspect-ratio: 2143 / 734;
    transform: none;
  }

  .play-body .hand-pair-figure img {
    position: static;
    z-index: auto;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .play-body .finger-marker {
    z-index: 3;
    width: 30px;
    height: 30px;
    border-width: 2px;
  }

  .play-body .finger-marker span {
    font-size: 10px;
  }

  .play-body .hands-visual .active-finger-card {
    position: static;
    width: min(100%, 190px);
    padding: 9px 10px;
    grid-column: 3;
    justify-self: center;
    transform: none;
  }

  .play-body .hands-visual .active-finger-card > span,
  .play-body .hands-visual .active-finger-card p {
    font-size: 10px;
  }

  .play-body .hands-visual .active-finger-card strong {
    font-size: 13px;
  }

  .play-body:is(
      [data-game-state="countdown"],
      [data-game-state="playing"],
      [data-game-state="paused"],
      [data-game-state="imeBlocked"]
    )
    .control-deck {
    display: none;
  }

  .play-body:is(
      [data-game-state="countdown"],
      [data-game-state="playing"],
      [data-game-state="paused"],
      [data-game-state="imeBlocked"]
    )
    .game-shell {
    grid-template-rows:
      minmax(194px, 1fr)
      minmax(216px, 1.08fr)
      minmax(152px, 0.86fr);
  }
}

@media (min-width: 900px) and (max-width: 1080px) {
  .play-body .shortcut-guide {
    display: none;
  }

  .play-body .selected-course-card {
    min-width: 185px;
  }

  .play-body .selected-course-card a {
    display: none;
  }

  .play-body .hands-visual {
    grid-template-columns: 145px minmax(0, 1fr) 165px;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .game-shell {
    grid-template-rows:
      54px
      minmax(170px, 0.95fr)
      minmax(188px, 1.05fr)
      minmax(124px, 0.7fr);
  }

  .play-body:is(
      [data-game-state="countdown"],
      [data-game-state="playing"],
      [data-game-state="paused"],
      [data-game-state="imeBlocked"]
    )
    .game-shell {
    grid-template-rows:
      minmax(188px, 1fr)
      minmax(208px, 1.08fr)
      minmax(140px, 0.78fr);
  }

  .play-body .hand-pair-figure {
    top: auto;
    height: calc(100% - 4px);
  }

  .play-body .finger-marker {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 899px) {
  .layout-card-group button,
  .duration-card-group button {
    min-height: 46px;
  }

  .finger-guide {
    overflow: visible;
  }

  .hands-visual {
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
  }

  .hand-pair-figure {
    position: relative;
    inset: auto;
    width: min(100%, 720px);
    height: auto;
    max-height: none;
    aspect-ratio: 2143 / 734;
    transform: none;
  }

  .hands-visual .active-finger-card {
    position: static;
    width: min(100%, 260px);
    margin-top: 8px;
    transform: none;
  }
}

/* v1.11: large hands overlap the keyboard base; keys always remain in front. */
@media (min-width: 900px) {
  .play-body .keyboard-section,
  .play-body .finger-guide {
    z-index: auto;
    overflow: visible;
  }

  .play-body .keyboard-heading {
    position: relative;
    z-index: 10;
  }

  .play-body .keyboard {
    position: relative;
    z-index: auto;
  }

  .play-body .key {
    position: relative;
    z-index: 9;
  }

  .play-body .finger-guide {
    margin-top: -18px;
    background: transparent;
    box-shadow: none;
  }

  .play-body .hands-visual {
    position: relative;
    display: block;
    overflow: visible;
  }

  .play-body .hand-pair-figure {
    position: absolute;
    z-index: 5;
    right: auto;
    bottom: -2px;
    left: 50%;
    width: min(76vw, 840px);
    max-width: none;
    height: auto;
    margin: 0;
    aspect-ratio: 2143 / 734;
    transform: translateX(-50%);
  }

  .play-body .hand-pair-figure img {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .play-body .finger-marker {
    z-index: 6;
    width: 38px;
    height: 38px;
    border-width: 3px;
  }

  .play-body .finger-marker span {
    font-size: 12px;
  }

  .play-body .hands-visual .active-finger-card {
    position: absolute;
    z-index: 10;
    right: 8px;
    bottom: 8px;
    width: min(190px, 20vw);
    transform: none;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .hand-pair-figure {
    width: min(72vw, 790px);
    height: auto;
  }

  .play-body .finger-marker {
    width: 34px;
    height: 34px;
  }
}

/* v1.14: the hand artwork occupies its own clipped row below the keyboard. */
@media (min-width: 900px) {
  .play-body .keyboard-section {
    z-index: 3;
    overflow: hidden;
  }

  .play-body .finger-guide {
    z-index: 2;
    margin-top: 0;
    overflow: hidden;
  }

  .play-body .hands-visual {
    overflow: hidden;
  }

  .play-body .hand-pair-figure {
    top: 0;
    right: auto;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
  }

  .play-body .metric-rail span,
  .play-body .next-key-hint > span,
  .play-body .next-key-hint p,
  .play-body .hands-visual .active-finger-card > span,
  .play-body .hands-visual .active-finger-card p {
    font-size: 11px;
  }

  .play-body .hands-visual .active-finger-card {
    min-width: 174px;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .finger-guide {
    padding-block: 2px;
  }

  .play-body .hand-pair-figure {
    top: 0;
    height: auto;
  }
}

/*
 * v1.16: align each guide with the painted nail, reuse the finger-zone color
 * on the next key and nail, and lift the fingertips into the empty keyboard
 * base without covering any key.
 */
.finger-marker {
  border-radius: 50% 50% 43% 43% / 58% 58% 42% 42%;
  background: color-mix(in srgb, var(--finger-color) 10%, #fffdf4);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.78),
    0 3px 7px rgba(35, 62, 55, 0.16);
}

.finger-marker.active {
  border-color: var(--finger-color);
  color: #102f3a;
  background: color-mix(in srgb, var(--finger-color) 82%, #fff);
  box-shadow:
    0 0 0 6px color-mix(in srgb, var(--finger-color) 20%, transparent),
    inset 0 2px 0 rgba(255, 255, 255, 0.42),
    0 4px 8px rgba(44, 67, 63, 0.2);
}

.finger-marker.active span {
  color: #102f3a;
}

.key.next,
.key.next-alternative,
.key.shift-needed,
.key.modifier-required {
  border-color: var(--finger-color);
  color: #102f3a;
  background: color-mix(in srgb, var(--finger-color) 82%, #fff);
}

.key.next {
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--finger-color) 22%, transparent),
    0 4px 0 color-mix(in srgb, var(--finger-color) 78%, #29434a);
}

.key.next-alternative {
  border-style: dashed;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--finger-color) 15%, transparent);
}

.key.shift-needed,
.key.modifier-required {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--finger-color) 18%, transparent);
}

.key.next::after,
.key.next-alternative::after,
.key.shift-needed::after,
.key.modifier-required::after {
  background: var(--finger-color);
  opacity: 1;
}

@media (min-width: 900px) {
  .play-body .keyboard-section {
    z-index: auto;
    overflow: visible;
  }

  .play-body .finger-guide {
    z-index: 4;
    overflow: visible;
  }

  .play-body .hands-visual {
    overflow: visible;
  }

  .play-body .hand-pair-figure {
    top: -36px;
  }

  .play-body .key {
    z-index: 9;
  }

  .play-body .finger-marker {
    width: 31px;
    height: 38px;
    border-width: 3px;
  }

  .play-body .finger-marker span {
    font-size: 11px;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .hand-pair-figure {
    top: -10px;
  }

  .play-body .finger-marker {
    width: 29px;
    height: 35px;
  }

  .play-body .finger-marker span {
    font-size: 10px;
  }
}

/*
 * v1.17: the practice stack is reading → prompt → keystrokes.
 * The hand artwork starts directly below the keyboard. Palm and finger bases
 * are cropped, while the entire finger assigned to the next key is tinted.
 */
.play-body .play-panel {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: center;
  justify-items: center;
  gap: 4px;
  overflow: hidden;
}

.play-body .reading-text {
  order: 1;
  min-height: 22px;
  margin: 0;
  color: #416276;
  font-size: clamp(15px, 1.25vw, 19px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.06em;
}

.play-body .display-text {
  order: 2;
  min-height: 42px;
  margin: 0;
  font-size: clamp(31px, 3.25vw, 48px);
  line-height: 1.12;
}

.play-body .target-text {
  order: 3;
  min-height: 38px;
  margin: 0;
  font-size: clamp(25px, 2.65vw, 39px);
  line-height: 1.1;
}

.play-body .next-key-hint {
  order: 4;
}

.finger-marker {
  isolation: isolate;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
}

.finger-marker::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -28px;
  left: 50%;
  width: clamp(38px, 4.3vw, 54px);
  height: clamp(130px, 14.5vw, 170px);
  transform: translateX(-50%);
  border: 2px solid transparent;
  border-radius: 48% 48% 28% 28% / 16% 16% 12% 12%;
  background: transparent;
  opacity: 0;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    opacity 120ms ease;
  pointer-events: none;
}

.finger-marker span {
  position: relative;
  z-index: 2;
  min-width: 24px;
  padding: 3px 4px;
  border: 1px solid color-mix(in srgb, var(--finger-color) 56%, #173f48);
  border-radius: 6px;
  color: #173f48;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 2px 5px rgba(27, 54, 59, 0.16);
  font-size: 11px;
  line-height: 1;
  text-align: center;
}

.finger-marker.active,
.finger-marker.modifier-active {
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
}

.finger-marker.active::before,
.finger-marker.modifier-active::before {
  border-color: color-mix(in srgb, var(--finger-color) 84%, #173f48);
  background: color-mix(in srgb, var(--finger-color) 66%, transparent);
  opacity: 0.86;
  mix-blend-mode: multiply;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.2),
    0 0 0 4px color-mix(in srgb, var(--finger-color) 14%, transparent);
}

.finger-marker.active span,
.finger-marker.modifier-active span {
  border-color: color-mix(in srgb, var(--finger-color) 80%, #173f48);
  color: #fff;
  background: color-mix(in srgb, var(--finger-color) 82%, #173f48);
}

.finger-marker[data-finger="left-thumb"]::before,
.finger-marker[data-finger="right-thumb"]::before {
  top: -20px;
  width: clamp(36px, 4vw, 50px);
  height: clamp(82px, 9.5vw, 112px);
  border-radius: 48% 48% 34% 34% / 22% 22% 16% 16%;
  transform-origin: 50% 12%;
}

.finger-marker[data-finger="left-thumb"]::before {
  transform: translateX(-50%) rotate(24deg);
}

.finger-marker[data-finger="right-thumb"]::before {
  transform: translateX(-50%) rotate(-24deg);
}

.finger-marker.pressed-correct,
.finger-marker.pressed-wrong,
.finger-marker.home-return {
  animation: none;
}

.finger-marker.pressed-correct::before {
  filter: brightness(1.08) saturate(1.12);
}

.finger-marker.pressed-wrong::before {
  border-color: #b93f3b;
  background: rgba(229, 86, 80, 0.68);
  opacity: 0.9;
}

@media (min-width: 900px) {
  .play-body .keyboard-section {
    position: relative;
    z-index: 6;
    overflow: visible;
  }

  .play-body .finger-guide {
    position: relative;
    z-index: 4;
    margin-top: -8px;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .play-body .hands-visual {
    display: block;
    overflow: visible;
  }

  .play-body .hand-pair-figure {
    position: absolute;
    top: -18px;
    left: 50%;
    width: min(76vw, 840px);
    max-width: none;
    height: auto;
    aspect-ratio: 2143 / 734;
    transform: translateX(-50%);
    clip-path: inset(0 0 38% 0);
  }

  .play-body .hand-pair-figure img {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .play-body .finger-marker {
    z-index: 3;
    width: 32px;
    height: 28px;
  }

  .play-body .finger-marker span {
    font-size: 11px;
  }

  .play-body .hands-visual .active-finger-card {
    display: none;
  }
}

@media (min-width: 900px) and (max-height: 700px) {
  .play-body .reading-text {
    min-height: 18px;
    font-size: 14px;
  }

  .play-body .display-text {
    min-height: 36px;
    font-size: clamp(27px, 3vw, 40px);
  }

  .play-body .target-text {
    min-height: 32px;
    font-size: clamp(22px, 2.45vw, 34px);
  }

  .play-body .hand-pair-figure {
    top: -14px;
    width: min(72vw, 790px);
  }
}

/*
 * v1.18: PC-first modal game window.
 * The whole 1180 x 760 play surface scales as one unit so the prompt,
 * keyboard and fingers never drift apart at different viewport sizes.
 */
:root {
  --practice-frame: #263f3d;
  --practice-surface: #f3f8f4;
  --practice-key-border: #78827f;
}

.play-body {
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(225, 240, 228, 0.96), rgba(186, 207, 197, 0.92)),
    #c6d8ce;
}

.play-body::before {
  content: "";
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgba(22, 39, 37, 0.48);
  backdrop-filter: blur(3px);
  pointer-events: none;
}

.play-body .app-shell {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  margin: 0;
  padding: 0;
}

.play-body .site-header {
  opacity: 0.56;
  filter: saturate(0.7);
  pointer-events: none;
}

.play-body .play-footer {
  display: none;
}

.play-body .game-shell,
.play-body:is(
    [data-game-state="countdown"],
    [data-game-state="playing"],
    [data-game-state="paused"],
    [data-game-state="imeBlocked"]
  )
  .game-shell {
  position: fixed;
  z-index: 50;
  top: var(--game-window-top, 8px);
  left: 50%;
  width: 1180px;
  min-width: 1180px;
  max-width: none;
  height: 760px;
  min-height: 760px;
  max-height: none;
  margin: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: 64px 278px 262px 120px;
  gap: 4px;
  overflow: hidden;
  border: 2px solid var(--practice-frame);
  border-radius: 18px;
  background: var(--practice-surface);
  box-shadow:
    0 28px 80px rgba(8, 25, 23, 0.46),
    0 0 0 5px rgba(255, 255, 255, 0.34),
    inset 0 1px 0 #fff;
  transform:
    translateX(-50%)
    scale(var(--game-window-scale, 1));
  transform-origin: top center;
}

.play-body .control-deck,
.play-body:is(
    [data-game-state="countdown"],
    [data-game-state="playing"],
    [data-game-state="paused"],
    [data-game-state="imeBlocked"]
  )
  .control-deck {
  min-width: 0;
  height: 64px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 220px 128px minmax(0, 1fr) 150px 120px;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid #b8c9c1;
  border-radius: 11px;
  background: #e8f1eb;
  box-shadow: inset 0 1px 0 #fff;
}

.play-body .selected-course-card {
  min-width: 0;
  padding: 0;
}

.play-body .selected-course-card > span {
  flex: 0 0 38px;
}

.play-body .selected-course-card > div {
  min-width: 0;
}

.play-body .selected-course-card strong {
  max-width: 126px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-body .selected-course-card a {
  min-width: 48px;
  padding-inline: 6px;
}

.play-body .layout-card-group,
.play-body .duration-card-group {
  min-width: 0;
  height: 50px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
  overflow: hidden;
}

.play-body .layout-card-group > span,
.play-body .duration-card-group > span {
  flex: 0 0 auto;
  font-size: 11px;
}

.play-body .layout-card-group button,
.play-body .duration-card-group button {
  min-width: 0;
  min-height: 38px;
  height: 38px;
  padding: 3px 6px;
  border-radius: 8px;
}

.play-body .layout-card-group button {
  flex: 1 1 0;
}

.play-body .duration-card-group button {
  flex: 1 1 0;
}

.play-body .layout-card-group button b,
.play-body .duration-card-group button b {
  font-size: 14px;
}

.play-body .layout-card-group button small,
.play-body .duration-card-group button small {
  display: none;
}

.play-body .mode-note {
  height: 48px;
  padding: 5px 7px;
  overflow: hidden;
}

.play-body .mode-note span,
.play-body .mode-note p {
  font-size: 11px;
  line-height: 1.25;
}

.play-body .shortcut-guide {
  min-width: 0;
  display: grid;
  gap: 4px;
  font-size: 11px;
}

.play-body .shortcut-guide span {
  white-space: nowrap;
}

.play-body .typing-stage {
  height: 278px;
  display: grid;
  grid-template-rows: 52px 226px;
  overflow: hidden;
  border: 2px solid var(--practice-frame);
  border-radius: 13px;
  background: #fff;
  box-shadow: none;
}

.play-body .stage-decoration {
  display: none;
}

.play-body .stage-header {
  height: 52px;
  padding: 6px 12px;
  grid-template-columns: minmax(330px, 1fr) minmax(480px, 1.25fr) 96px;
  gap: 12px;
  border-bottom: 1px solid #d1ddd7;
  background: #f5faf6;
}

.play-body .lesson-title p {
  font-size: 13px;
  line-height: 1.15;
}

.play-body .lesson-title h1 {
  font-size: 20px;
  line-height: 1.2;
}

.play-body .session-progress {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.play-body .progress-copy {
  min-width: 92px;
}

.play-body .progress-copy span {
  font-size: 12px;
}

.play-body .progress-copy strong {
  font-size: 16px;
}

.play-body .progress-track {
  height: 10px;
}

.play-body .header-time {
  min-width: 86px;
  display: grid;
  justify-items: end;
  line-height: 1;
}

.play-body .header-time span {
  color: #526b70;
  font-size: 12px;
  font-weight: 800;
}

.play-body .header-time strong {
  margin-top: 3px;
  color: #153b49;
  font: 900 25px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.02em;
}

.play-body .status-badge {
  min-height: 34px;
  padding-inline: 10px;
  font-size: 14px;
}

.play-body .stage-body {
  height: 226px;
  min-height: 0;
  display: grid;
  grid-template-rows: 182px 44px;
}

.play-body .stage-content {
  grid-row: 1;
  min-height: 0;
  overflow: hidden;
}

.play-body .metric-rail {
  grid-row: 2;
  height: 44px;
  min-height: 0;
  padding: 3px 8px;
  gap: 5px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #d1ddd7;
  background: #f4f8f5;
}

.play-body .metric-rail > div {
  padding: 2px 10px;
}

.play-body .metric-rail span {
  font-size: 12px;
}

.play-body .metric-rail strong {
  margin-top: 1px;
  font-size: 20px;
  line-height: 1;
}

.play-body .metric-rail small {
  font-size: 12px;
}

.play-body .stage-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 6px 54px;
  overflow: hidden;
}

.play-body .play-panel {
  padding: 6px 54px;
  display: grid;
  grid-template-rows: 30px 68px 68px;
  align-content: center;
  justify-items: center;
  gap: 2px;
}

.play-body .reading-text {
  min-height: 0;
  font-size: 19px;
  line-height: 30px;
  letter-spacing: 0.07em;
}

.play-body .display-text {
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 46px;
  line-height: 68px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-body .target-text,
.play-body .target-text.lesson-keys {
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 34px;
  line-height: 54px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-body .next-key-hint {
  display: none;
}

.play-body .keyboard-section {
  position: relative;
  z-index: 4;
  height: 262px;
  padding: 6px 12px 36px;
  display: grid;
  grid-template-rows: 28px 190px;
  overflow: hidden;
  border: 1px solid #aebfB6;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #e6f2e9 0%, #dcebe2 72%, #d2e2d8 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.86),
    inset 0 -3px 0 rgba(48, 72, 65, 0.08);
}

.play-body .keyboard-heading {
  height: 28px;
  min-height: 0;
  grid-template-columns: auto 1fr auto;
}

.play-body .keyboard-heading > div:first-child > p {
  display: none;
}

.play-body .keyboard-heading h2 {
  font-size: 17px;
}

.play-body .keyboard-message,
.play-body .legend {
  font-size: 12px;
}

.play-body .keyboard {
  --key-unit: 54px;
  --key-height: 35px;
  --key-gap: 3px;
  width: 100%;
  height: 190px;
  margin: 0;
  padding: 3px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

.play-body .keyboard-board[data-layout="jis"] {
  padding-right: 36px;
}

.play-body .key {
  padding: 3px;
  border: 2px solid var(--practice-key-border);
  border-bottom-width: 4px;
  border-radius: 8px;
  color: #46504e;
  background: #fff;
  box-shadow:
    inset 0 1px 0 #fff,
    0 1px 1px rgba(27, 44, 40, 0.12);
  font: 800 15px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.play-body .key .shift-label {
  top: 3px;
  right: 3px;
  font-size: 10px;
}

.play-body .key::after {
  display: none;
}

.play-body .key.home-key,
.play-body .key-enter-jis {
  color: #46504e;
  background: #fff;
  border-color: var(--practice-key-border);
}

.play-body .key-enter-jis::after {
  display: none;
}

.play-body .key-enter-jis {
  position: absolute;
  top: calc(var(--key-height) + var(--key-gap));
  left: calc(var(--key-unit) * 13.45 + var(--key-gap) * 13);
}

.play-body .home-bump {
  background: #6f7976;
}

.play-body .key.next,
.play-body .key.next-alternative {
  z-index: 7;
  border-color: color-mix(in srgb, var(--finger-color) 76%, #263f3d);
  color: #132d34;
  background: var(--finger-color);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--finger-color) 20%, transparent),
    0 4px 0 color-mix(in srgb, var(--finger-color) 76%, #263f3d);
  transform: translateY(-1px);
}

.play-body .key.shift-needed,
.play-body .key.modifier-required {
  border-color: color-mix(in srgb, var(--finger-color) 72%, #263f3d);
  color: #263f3d;
  background: color-mix(in srgb, var(--finger-color) 32%, #fff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--finger-color) 16%, transparent);
}

.play-body .key.pressed-wrong {
  border-color: #9e302d;
  color: #fff;
  background: #d85650;
}

.play-body .finger-guide {
  position: relative;
  z-index: 5;
  height: 120px;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.play-body .guide-copy,
.play-body .finger-index,
.play-body .hands-visual .active-finger-card {
  display: none;
}

.play-body .hands-visual {
  position: relative;
  width: 100%;
  height: 120px;
  display: block;
  overflow: visible;
}

.play-body .hand-pair-figure {
  position: absolute;
  z-index: 5;
  top: -34px;
  left: 50%;
  width: 1050px;
  max-width: none;
  height: auto;
  margin: 0;
  aspect-ratio: 2143 / 734;
  overflow: visible;
  clip-path: inset(0 0 50% 0);
  transform: translateX(-50%);
}

.play-body .hand-pair-figure img {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: grayscale(1) brightness(1.48) contrast(0.72);
  opacity: 0.98;
}

.play-body .finger-marker,
.play-body .finger-marker.active,
.play-body .finger-marker.modifier-active {
  z-index: 3;
  width: 32px;
  height: 28px;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%);
  animation: none;
}

.play-body .finger-marker span {
  display: none;
}

.play-body .finger-marker::before {
  top: -16px;
  width: 50px;
  height: 162px;
  border: 0;
  border-radius: 48% 48% 28% 28% / 16% 16% 12% 12%;
  background: transparent;
  opacity: 0;
  mix-blend-mode: normal;
  box-shadow: none;
}

.play-body .finger-marker[data-finger="left-index"]::before,
.play-body .finger-marker[data-finger="right-index"]::before,
.play-body .finger-marker[data-finger="left-pinky"]::before,
.play-body .finger-marker[data-finger="right-pinky"]::before {
  width: 54px;
}

.play-body .finger-marker.active::before,
.play-body .finger-marker.modifier-active::before {
  background: var(--finger-color);
  opacity: 0.84;
  box-shadow: none;
}

.play-body .finger-marker[data-finger="left-thumb"]::before,
.play-body .finger-marker[data-finger="right-thumb"]::before {
  top: -40px;
  width: 48px;
  height: 124px;
}

.play-body .finger-marker.pressed-correct::before {
  border-color: #276d55;
  background: rgba(77, 168, 131, 0.86);
}

.play-body .finger-marker.pressed-wrong::before {
  border-color: #9e302d;
  background: rgba(216, 86, 80, 0.88);
}

.play-body dialog {
  z-index: 80;
}

.play-body .toast {
  z-index: 90;
}

@media (prefers-reduced-motion: reduce) {
  .play-body .game-shell {
    transition: none;
  }
}

/*
 * v1.21: fixed desktop practice UI.
 * Readable labels, collision-free JIS Enter, compact results and finger-sized
 * highlights. The 1180 x 760 game window deliberately does not scale.
 */
.brand .brand-monogram {
  width: 48px;
  height: 48px;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 15px;
  color: transparent;
  background:
    radial-gradient(circle at 82% 18%, rgba(128, 232, 205, 0.26), transparent 42%),
    linear-gradient(145deg, #102f3c 0%, #10535b 100%);
  box-shadow:
    0 10px 24px rgba(14, 48, 58, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.brand .brand-monogram::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 20px;
  height: 23px;
  border-right: 4px solid #fff;
  border-bottom: 4px solid #fff;
  border-left: 4px solid #fff;
  border-radius: 0 0 11px 11px;
}

.brand .brand-monogram::after {
  content: "";
  position: absolute;
  right: 9px;
  bottom: 9px;
  width: 5px;
  height: 19px;
  display: block;
  border-radius: 99px;
  background: linear-gradient(180deg, #78e6c5 0%, #ffc16c 100%);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07);
}

.brand .brand-monogram i,
.brand .brand-monogram i:first-child,
.brand .brand-monogram i:last-child {
  display: none;
}

.brand .brand-copy strong {
  color: #112f3b;
  font-size: 23px;
  font-weight: 850;
  letter-spacing: -0.045em;
}

.brand .brand-copy small {
  margin-top: 6px;
  color: #4f777a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/*
 * The course page remains the browser document while practice runs in a
 * fixed desktop overlay. Opening and closing it never changes page history.
 */
body.practice-overlay-open {
  overflow: hidden;
}

.practice-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: start center;
  padding-top: 8px;
  overflow: hidden;
  background: rgba(8, 27, 35, 0.76);
  backdrop-filter: blur(7px);
}

.practice-overlay-window {
  width: 1180px;
  height: 760px;
  max-width: none;
  max-height: none;
  flex: 0 0 auto;
}

.practice-overlay-frame {
  width: 1180px;
  height: 760px;
  display: block;
  border: 0;
  border-radius: 18px;
  background: #f4f7f6;
  box-shadow: 0 30px 90px rgba(3, 21, 28, 0.42);
}

.practice-overlay-close {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: rgba(15, 47, 58, 0.9);
  box-shadow: 0 6px 18px rgba(3, 21, 28, 0.25);
  cursor: pointer;
  font: 700 24px/1 "Segoe UI", sans-serif;
}

.practice-overlay-close:hover {
  background: #c5524d;
}

.practice-overlay-frame {
  opacity: 0;
}

.practice-overlay.is-ready .practice-overlay-frame {
  opacity: 1;
}

.practice-overlay-loading {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: #163b47;
  background: #edf4f3;
}

.practice-overlay.is-ready .practice-overlay-loading {
  display: none;
}

.practice-overlay-loading span {
  width: 42px;
  height: 42px;
  border: 5px solid #c9dcd9;
  border-top-color: #16756c;
  border-radius: 50%;
  animation: practice-loading-spin 700ms linear infinite;
}

.practice-overlay-loading strong {
  font-size: 17px;
}

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

/*
 * Keep a clearly visible gap below the four live metric values without
 * changing the fixed 1180 x 760 practice window.
 */
.play-body .stage-body {
  grid-template-rows: 166px 54px;
}

.play-body .metric-rail {
  height: 54px;
  padding: 3px 8px 5px;
}

.play-body .metric-rail > div {
  padding: 2px 10px 6px;
}

.play-body .metric-rail strong {
  margin: 3px 0 0;
  line-height: 1;
}

.play-body .control-deck,
.play-body:is(
    [data-game-state="countdown"],
    [data-game-state="playing"],
    [data-game-state="paused"],
    [data-game-state="imeBlocked"]
  )
  .control-deck {
  grid-template-columns: 235px 110px minmax(0, 1fr) 220px 116px;
}

.play-body .selected-course-card {
  gap: 6px;
}

.play-body .selected-course-card strong {
  max-width: 132px;
  max-height: 48px;
  font-size: 14px;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

.play-body .selected-course-card small {
  display: none;
}

.play-body .selected-course-card {
  flex-wrap: nowrap;
  overflow: hidden;
}

.play-body .selected-course-card > div {
  min-width: 0;
  flex: 1 1 auto;
}

.play-body .selected-course-card strong {
  display: block;
  max-width: none;
  max-height: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-body .layout-card-group > span {
  display: none;
}

.play-body .duration-card-group > span {
  font-size: 12px;
}

.play-body .layout-card-group > span,
.play-body .duration-card-group > span {
  font-size: 12px;
}

.play-body .selected-course-card a,
.play-body .mode-note span,
.play-body .mode-note p,
.play-body .shortcut-guide {
  font-size: 12px;
}

.play-body .practice-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 5px;
}

.play-body .mode-note {
  height: 48px;
  padding: 6px 9px;
  overflow: visible;
}

.play-body .mode-note span {
  display: none;
}

.play-body .mode-note p {
  max-width: none;
  font-size: 13px;
  line-height: 1.3;
}

.play-body .practice-actions .header-button {
  min-width: 0;
  min-height: 42px;
  padding: 0 8px;
  gap: 5px;
  border-radius: 9px;
  font-size: 12px;
}

.play-body .practice-actions .help-button {
  width: 42px;
  padding: 0;
  font-size: 17px;
}

.play-body .typing-stage {
  grid-template-rows: 58px 220px;
}

.play-body .stage-header {
  height: 58px;
  padding: 6px 12px;
  grid-template-columns: minmax(320px, 1fr) minmax(490px, 1.28fr) 100px;
}

.play-body .lesson-title p {
  margin-bottom: 3px;
  font-size: 14px;
}

.play-body .lesson-title h1 {
  overflow: hidden;
  font-size: 20px;
  line-height: 1.14;
  text-overflow: clip;
  white-space: nowrap;
}

.play-body .progress-copy {
  min-width: 102px;
}

.play-body .progress-copy span {
  font-size: 14px;
}

.play-body .progress-copy strong {
  font-size: 17px;
}

.play-body .progress-track {
  height: 12px;
}

.play-body .header-time {
  min-width: 94px;
}

.play-body .header-time span {
  font-size: 14px;
}

.play-body .header-time strong {
  margin-top: 2px;
  font-size: 28px;
}

.play-body .status-badge {
  min-height: 38px;
  font-size: 15px;
}

.play-body .stage-body {
  height: 220px;
  grid-template-rows: 172px 48px;
}

.play-body .metric-rail {
  height: 48px;
  padding: 3px 8px;
}

.play-body .metric-rail > div {
  padding: 2px 10px;
}

.play-body .metric-rail span {
  font-size: 14px;
  line-height: 1.05;
}

.play-body .metric-rail strong {
  margin-top: 2px;
  font-size: 22px;
}

.play-body .metric-rail small {
  font-size: 13px;
}

.play-body .stage-panel {
  padding: 8px 28px;
}

.play-body .ready-panel {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 22px;
}

.play-body .ready-mark {
  width: 60px;
  height: 60px;
  border-radius: 17px;
}

.play-body .ready-mark span {
  font-size: 22px;
}

.play-body .ready-copy {
  max-width: none;
}

.play-body .ready-copy p {
  font-size: 18px;
  line-height: 1.4;
}

.play-body .ready-copy > span {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.play-body .primary-button {
  min-height: 48px;
  padding-inline: 20px;
  font-size: 16px;
}

.play-body .play-panel {
  padding: 6px 42px;
  grid-template-rows: 28px 64px 64px;
  gap: 2px;
}

.play-body .reading-text,
.play-body .display-text,
.play-body .target-text,
.play-body .target-text.lesson-keys {
  width: 100%;
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.play-body .reading-text {
  line-height: 28px;
}

.play-body .display-text {
  line-height: 64px;
}

.play-body .target-text,
.play-body .target-text.lesson-keys {
  line-height: 54px;
}

.play-body .reading-text.text-condensed,
.play-body .display-text.text-condensed,
.play-body .target-text.text-condensed {
  letter-spacing: 0.01em;
}

.play-body .target-text.lesson-keys {
  gap: 5px;
}

.play-body .target-text .target-token {
  min-width: 36px;
  padding: 5px 6px;
  border-radius: 9px;
}

.play-body .pause-panel,
.play-body .ime-panel {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 12px 30px;
}

.play-body .pause-symbol,
.play-body .ime-symbol {
  width: 62px;
  height: 62px;
}

.play-body .panel-kicker {
  margin-bottom: 4px;
  font-size: 13px;
}

.play-body .pause-panel h2,
.play-body .result-summary h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.play-body .pause-panel > div > span {
  font-size: 15px;
}

.play-body .panel-actions {
  margin-left: 0;
  gap: 10px;
}

.play-body .text-button {
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #9fb7b1;
  border-radius: 11px;
  color: #244c53;
  background: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.play-body .exit-button {
  min-width: 270px;
}

.play-body .result-panel {
  display: grid;
  grid-template-columns: 72px 186px minmax(0, 1fr) 128px;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
}

.play-body .rank-block {
  width: 68px;
  height: 68px;
  border-radius: 20px;
}

.play-body .rank-block span {
  font-size: 12px;
}

.play-body .rank-block strong {
  font-size: 34px;
}

.play-body .result-summary {
  min-width: 0;
}

.play-body .result-summary h2 {
  font-size: 20px;
  line-height: 1.25;
}

.play-body .result-main-score span {
  font-size: 13px;
}

.play-body .result-main-score strong {
  font-size: 28px;
}

.play-body .result-metrics {
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  gap: 6px;
}

.play-body .result-metrics > div {
  min-height: 49px;
  padding: 5px 8px;
}

.play-body .result-metrics > div:last-child {
  grid-column: span 2;
}

.play-body .result-metrics span {
  font-size: 13px;
  font-weight: 800;
}

.play-body .result-metrics strong {
  margin-top: 2px;
  font-size: 16px;
  line-height: 1.15;
  white-space: nowrap;
}

.play-body .result-metrics > div:last-child strong {
  font-size: 15px;
  white-space: normal;
}

.play-body .result-actions {
  display: grid;
  gap: 9px;
}

.play-body .result-actions .primary-button,
.play-body .result-actions .text-button {
  width: 100%;
  min-height: 44px;
  padding-inline: 10px;
}

.play-body[data-beginner-mode="true"] .result-panel {
  grid-template-columns: 96px minmax(0, 1fr) 170px;
  gap: 20px;
  padding: 12px 28px;
}

.play-body[data-beginner-mode="true"] .result-metrics {
  display: none;
}

.play-body[data-beginner-mode="true"] .rank-block {
  width: 88px;
  height: 88px;
  border-radius: 24px;
}

.play-body[data-beginner-mode="true"] .rank-block strong {
  font-size: 46px;
}

.play-body[data-beginner-mode="true"] .result-summary h2 {
  max-width: 580px;
  font-size: 21px;
}

.play-body[data-beginner-mode="true"] .result-main-score strong {
  font-size: 34px;
}

.play-body .keyboard-heading h2 {
  font-size: 18px;
}

.play-body .keyboard-message,
.play-body .legend {
  font-size: 13px;
}

.play-body .key {
  padding: 3px;
  font-size: 16px;
}

.play-body .key[data-code="Backspace"],
.play-body .key[data-code^="Control"],
.play-body .key[data-code^="Shift"],
.play-body .key[data-code="CapsLock"],
.play-body .key[data-code="NonConvert"],
.play-body .key[data-code="Convert"],
.play-body .key[data-code="KanaMode"] {
  font-size: 12px;
}

.play-body .keyboard-board[data-layout="jis"] {
  isolation: isolate;
}

.play-body .key-enter-jis {
  top: calc(var(--key-height) + var(--key-gap));
  left: calc(var(--key-unit) * 13.45 + var(--key-gap) * 13);
  z-index: 5;
  width: calc(var(--key-unit) * 1.6);
  height: calc(var(--key-height) * 2 + var(--key-gap));
}

.play-body .finger-marker::before {
  top: -16px;
  width: 48px;
  height: 162px;
  border-radius: 48% 48% 25% 25% / 15% 15% 9% 9%;
}

.play-body .finger-marker[data-finger="left-ring"]::before,
.play-body .finger-marker[data-finger="right-ring"]::before,
.play-body .finger-marker[data-finger="left-middle"]::before,
.play-body .finger-marker[data-finger="right-middle"]::before {
  width: 50px;
  height: 176px;
}

.play-body .finger-marker[data-finger="left-index"]::before,
.play-body .finger-marker[data-finger="right-index"]::before {
  width: 52px;
  height: 162px;
}

.play-body .finger-marker[data-finger="left-pinky"]::before,
.play-body .finger-marker[data-finger="right-pinky"]::before {
  width: 48px;
  height: 162px;
}

.play-body .finger-marker.active::before,
.play-body .finger-marker.modifier-active::before {
  background: var(--finger-color);
  opacity: 0.9;
}

.play-body .finger-marker.active.pressed-correct::before {
  background: var(--finger-color);
  filter: brightness(1.08) saturate(1.12);
}

.play-body .finger-marker.active.pressed-wrong::before {
  background: #f05a55;
  opacity: 0.94;
  filter: none;
}

.play-body .finger-marker[data-finger="left-thumb"]::before,
.play-body .finger-marker[data-finger="right-thumb"]::before {
  top: -10px;
  width: 44px;
  height: 98px;
  border-radius: 48% 48% 28% 28% / 19% 19% 13% 13%;
}

/*
 * v1.22: exact finger masking and final control polish.
 * Each active color layer uses the same PNG alpha mask as the hand artwork,
 * so the colored area cannot extend beyond the illustrated outline.
 */
.play-body .hand-pair-figure .finger-marker,
.play-body .hand-pair-figure .finger-marker.active,
.play-body .hand-pair-figure .finger-marker.modifier-active {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  isolation: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
  pointer-events: none;
}

.play-body .hand-pair-figure .finger-marker::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: var(--finger-color);
  opacity: 0;
  clip-path: var(--finger-clip);
  -webkit-mask-image: url("./assets/hand-pair-v3.png");
  mask-image: url("./assets/hand-pair-v3.png");
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  mask-mode: alpha;
  mix-blend-mode: multiply;
  box-shadow: none;
  transform: none;
  transition: opacity 90ms ease;
}

.play-body .hand-pair-figure .finger-marker.active::before,
.play-body .hand-pair-figure .finger-marker.modifier-active::before {
  background: var(--finger-color);
  opacity: 1;
  filter: none;
}

.play-body .hand-pair-figure .finger-marker.active.pressed-correct::before {
  background: var(--finger-color);
  opacity: 1;
  filter: none;
}

.play-body .hand-pair-figure .finger-marker.active.pressed-wrong::before {
  background: #f05a55;
  opacity: 0.96;
  filter: none;
}

.play-body .hand-pair-figure .finger-marker span {
  display: none;
}

.play-body .progress-copy {
  min-width: 82px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.play-body .progress-copy strong {
  margin: 0;
  white-space: nowrap;
}

.play-body .metric-rail {
  padding-bottom: 6px;
}

.play-body .metric-rail > div {
  padding: 1px 10px 5px;
}

.play-body .metric-rail strong {
  margin-bottom: 2px;
}

.play-body .practice-actions {
  grid-template-columns: 69px 42px;
}

.play-body .practice-actions .header-button {
  padding-inline: 5px;
}

.play-body #soundLabel {
  min-width: 3em;
  display: inline-block;
  flex: 0 0 auto;
  white-space: nowrap;
  word-break: keep-all;
  writing-mode: horizontal-tb;
}

.play-body .practice-actions .help-button {
  border-color: #91aba7;
  color: #173d49;
  background: #fff;
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 0 rgba(33, 68, 67, 0.16);
}

.play-body .practice-actions .help-button span {
  position: static;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  overflow: visible;
  clip: auto;
  color: inherit;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.play-body .practice-actions .help-button:hover {
  border-color: #2f8b7d;
  color: #0f6257;
  background: #effaf6;
}

.play-body .dialog-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #29484f;
  background: transparent;
  box-shadow: none;
  font: 500 28px/1 Arial, sans-serif;
}

.play-body .dialog-close:hover {
  color: #0f6257;
  background: transparent;
}

.play-body .dialog-close:focus-visible {
  outline: 2px solid #c56b2a;
  outline-offset: -2px;
}

.play-body .key .shift-label {
  top: 2px;
  right: 3px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.play-body .ready-mark .illustration-icon {
  width: 44px;
  height: 44px;
  display: block;
}

/*
 * v1.25: keep the active finger color above the hand artwork.
 * The PNG alpha mask still limits the color to the illustrated finger,
 * while normal blending keeps the guide color bright and unmistakable.
 */
.play-body .hand-pair-figure {
  isolation: isolate;
}

.play-body .hand-pair-figure img {
  z-index: 2;
}

.play-body .hand-pair-figure .finger-marker,
.play-body .hand-pair-figure .finger-marker.active,
.play-body .hand-pair-figure .finger-marker.modifier-active {
  z-index: 9;
}

.play-body .hand-pair-figure .finger-marker::before {
  z-index: 9;
  mix-blend-mode: normal;
  opacity: 0;
  filter: none;
}

.play-body .hand-pair-figure .finger-marker.active::before,
.play-body .hand-pair-figure .finger-marker.modifier-active::before,
.play-body .hand-pair-figure .finger-marker.active.pressed-correct::before {
  background-color: var(--finger-color);
  opacity: 0.96;
  filter: none;
}

.play-body .hand-pair-figure .finger-marker.active.pressed-wrong::before {
  background-color: #f05a55;
  opacity: 0.96;
}

/*
 * v1.26: dependable finger-color overlay.
 * Inline SVG paths avoid local-file image-mask differences and place an
 * opaque, key-matched color directly above each illustrated finger.
 */
.play-body .hand-pair-figure .finger-overlay {
  position: absolute;
  z-index: 12;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.play-body .hand-pair-figure .finger-overlay .finger-marker,
.play-body .hand-pair-figure .finger-overlay .finger-marker.active,
.play-body .hand-pair-figure .finger-overlay .finger-marker.modifier-active {
  position: static;
  inset: auto;
  width: auto;
  height: auto;
  border: 0;
  fill: transparent;
  stroke: transparent;
  opacity: 0;
  background: none;
  box-shadow: none;
  filter: none;
  transform: none;
  transition: none;
}

.play-body .hand-pair-figure .finger-overlay .finger-marker.active,
.play-body .hand-pair-figure .finger-overlay .finger-marker.modifier-active,
.play-body .hand-pair-figure .finger-overlay .finger-marker.active.pressed-correct {
  fill: var(--finger-color);
  opacity: 1;
}

.play-body .hand-pair-figure .finger-overlay .finger-marker.active.pressed-wrong {
  fill: #f05a55;
  opacity: 1;
}

/*
 * v1.27: the SVG paths follow the actual bright interior boundary measured
 * from hand-pair-v3.png. Keep the keyboard heading compact after removing
 * its legend and leave visible breathing room below the live metrics.
 */
.play-body .keyboard-heading {
  grid-template-columns: auto minmax(0, 1fr);
}

.play-body .keyboard-message {
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.play-body .romaji-input-note {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  color: #174d47;
  background: #eef9f5;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.play-body .metric-rail > div {
  padding: 1px 10px 7px;
}

.play-body .metric-rail strong {
  margin: 2px 0 0;
}

/*
 * v1.28: one control switches the finger, key-label and finger-use guidance
 * without changing the fixed 1180 x 760 practice layout.
 */
.play-body .control-deck,
.play-body:is(
    [data-game-state="countdown"],
    [data-game-state="playing"],
    [data-game-state="paused"],
    [data-game-state="imeBlocked"]
  )
  .control-deck {
  grid-template-columns: 235px 110px minmax(0, 1fr) 155px 186px;
}

.play-body .practice-actions {
  grid-template-columns: 69px 42px;
  gap: 5px;
}

.play-body .control-deck,
.play-body:is(
    [data-game-state="countdown"],
    [data-game-state="playing"],
    [data-game-state="paused"],
    [data-game-state="imeBlocked"]
  )
  .control-deck {
  grid-template-columns: 235px 110px minmax(0, 1fr) 220px 116px;
}

.play-body .keyboard-guide-toggle {
  position: absolute;
  z-index: 12;
  top: 92px;
  right: 14px;
  width: 96px;
  min-height: 64px;
  padding: 8px 7px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 2px solid #2b7f72;
  border-radius: 12px;
  color: #174d47;
  background: #fff;
  box-shadow:
    inset 0 1px 0 #fff,
    0 3px 0 rgba(39, 91, 83, 0.18);
  font: inherit;
  cursor: pointer;
}

.play-body .keyboard-guide-toggle span {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.play-body .keyboard-guide-toggle strong {
  min-width: 42px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  background: #258776;
  font-size: 14px;
  line-height: 1.1;
}

.play-body .keyboard-guide-toggle:hover {
  border-color: #17685d;
  background: #f3fbf8;
}

.play-body .keyboard-guide-toggle[aria-pressed="false"] {
  border-color: #9eafab;
  color: #526963;
  background: #edf2f0;
  box-shadow: inset 0 1px 0 #fff;
}

.play-body .keyboard-guide-toggle[aria-pressed="false"] strong {
  background: #71817e;
}

.play-body[data-guides="off"] .keyboard-heading,
.play-body[data-guides="off"] .hands-visual,
.play-body[data-guides="off"] .next-key-hint,
.play-body[data-guides="off"] .key > span {
  visibility: hidden;
}

/*
 * v1.50: preserve the 1180 x 760 practice composition at every resolution.
 * The parent page scales the complete iframe; the layout inside never
 * reflows. The large next-key guide sits in the keyboard's left margin.
 */
.practice-overlay-window {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
}

.practice-overlay-frame {
  transform-origin: top left;
}

.practice-overlay-controls {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 5;
  width: 1180px;
  height: 760px;
  pointer-events: none;
  transform-origin: top left;
}

.practice-overlay-result-hit-area {
  position: absolute;
  display: none;
  border: 0;
  background: transparent;
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
}

.practice-overlay.is-result .practice-overlay-result-hit-area {
  display: block;
}

.play-body .keyboard-section {
  position: relative;
}

.play-body .next-key-hint {
  position: absolute;
  z-index: 20;
  top: 54px;
  left: 12px;
  width: 108px;
  min-height: 116px;
  padding: 8px 7px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  place-items: center;
  gap: 3px;
  border: 1px solid rgba(44, 96, 82, 0.3);
  border-radius: 12px;
  color: #183f3a;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(27, 67, 58, 0.12);
  text-align: center;
  pointer-events: none;
}

.play-body .next-key-hint > span {
  color: #526c66;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.play-body .next-key-hint > strong {
  min-width: 58px;
  margin: 0;
  padding: 5px 8px;
  border: 2px solid #2d685c;
  border-radius: 10px;
  color: #153d36;
  background: #fff;
  box-shadow: 0 3px 0 rgba(35, 88, 77, 0.2);
  font: 900 34px/1 ui-monospace, Consolas, monospace;
}

.play-body .next-key-hint p {
  margin: 0;
  color: #294f47;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
}

.play-body .hand-pair-figure {
  width: 1050px;
}

.play-body[data-guides="off"] .key.next,
.play-body[data-guides="off"] .key.next-alternative,
.play-body[data-guides="off"] .key.shift-needed,
.play-body[data-guides="off"] .key.modifier-required {
  border-color: #71817d;
  color: #263d42;
  background: #fff;
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 0 #71817d;
}

.play-body[data-guides="off"] .key.pressed-wrong {
  border-color: #b63232;
  color: #fff;
  background: #f05a55;
}

/*
 * v1.36: reserve real space below the live metric values.
 * The practice window stays 1180 x 760; space comes from the keyboard
 * section's unused lower padding, so the problem, keys and hands do not move.
 */
.play-body .game-shell,
.play-body:is(
    [data-game-state="countdown"],
    [data-game-state="playing"],
    [data-game-state="paused"],
    [data-game-state="imeBlocked"]
  )
  .game-shell {
  grid-template-rows: 64px 290px 250px 120px;
}

.play-body .typing-stage {
  height: 290px;
  grid-template-rows: 58px 232px;
}

.play-body .stage-body {
  height: 232px;
  grid-template-rows: 172px 60px;
}

.play-body .metric-rail {
  height: 60px;
  padding: 3px 8px 6px;
}

.play-body .metric-rail > div {
  padding: 1px 10px 9px;
}

.play-body .metric-rail strong {
  margin: 2px 0 0;
}

.play-body .keyboard-section {
  height: 250px;
  padding-bottom: 24px;
}

/*
 * v1.39: PNG brand mark.
 * The previous CSS-drawn U-shaped monogram is intentionally disabled.
 */
.brand .brand-monogram,
.brand-monogram {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  color: transparent;
  background:
    url("./assets/brand-mark-v4.png?v=1.59.4")
    center / contain
    no-repeat;
  box-shadow: none;
}

.brand .brand-monogram::before,
.brand .brand-monogram::after,
.brand-monogram::before,
.brand-monogram::after {
  content: none;
  display: none;
}

.brand .brand-monogram i,
.brand-monogram i {
  display: none;
}

.play-body .ready-mark {
  background: linear-gradient(145deg, #f2f8f5, #fff);
}

.play-body .ready-mark .illustration-icon {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

/*
 * v1.44: the beginner practice window uses a flat pale-orange palette,
 * while preserving the fixed practice-window geometry.
 */
.play-body[data-beginner-mode="true"] {
  --page: #fff8e8;
  --page-deep: #f6e4ba;
  --surface: #fffdf7;
  --surface-soft: #fff2d0;
  --ink: #4b3a24;
  --ink-soft: #665436;
  --muted: #79674a;
  --teal: #d18a26;
  --teal-dark: #8f5b18;
  --teal-light: #ffe6ae;
  --orange: #e3a740;
  --orange-dark: #995f18;
  --orange-light: #fff0cf;
  --line: #e8c987;
  background: #fff6df;
}

.play-body[data-beginner-mode="true"] .game-window {
  border-color: #d29a3b;
  background: #fffdf7;
  box-shadow: 0 24px 64px rgba(105, 75, 25, 0.2);
}

.play-body[data-beginner-mode="true"] .control-deck {
  background: #fff8e8;
}

.play-body[data-beginner-mode="true"] .typing-stage {
  border-color: #e1bd77;
  background: #fffdf7;
}

.play-body[data-beginner-mode="true"] .stage-header {
  border-color: #e4c584;
  background: #fff1cb;
}

.play-body[data-beginner-mode="true"] .metric-rail {
  background: #fff8e8;
}

.play-body[data-beginner-mode="true"] .metric-rail > div {
  background: #ffefc8;
}

.play-body[data-beginner-mode="true"] .progress-track {
  background: #f0d8a8;
}

.play-body[data-beginner-mode="true"] .progress-track span {
  background: #d28a25;
}

.play-body[data-beginner-mode="true"] .keyboard-section {
  background: #f6e5bd;
}

.play-body[data-beginner-mode="true"] .ready-mark {
  background: #fff5db;
}

.play-body[data-beginner-mode="true"] .keyboard-guide-toggle {
  border-color: #cf8b28;
  color: #765019;
  background: #fffaf0;
}

.play-body[data-beginner-mode="true"] .keyboard-guide-toggle strong {
  background: #d18a26;
}

.play-body[data-beginner-mode="true"] .keyboard-guide-toggle:hover {
  border-color: #a86a15;
  background: #fff1cf;
}

.play-body[data-beginner-mode="true"] .romaji-input-note {
  color: #765019;
  background: #fff0c8;
}

/*
 * v1.45: results are a dedicated screen inside the fixed game window.
 * The live keyboard and hand guide remain mounted but are fully covered.
 */
.play-body .result-panel {
  position: absolute;
  z-index: 120;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 54px 68px 48px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  grid-template-rows: auto auto auto auto;
  align-content: center;
  align-items: center;
  gap: 16px 34px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  color: #18303a;
  background: #f5faf8;
}

.play-body .result-panel[hidden] {
  display: none !important;
}

.play-body .result-heading {
  grid-column: 2;
  align-self: end;
}

.play-body .result-heading .panel-kicker {
  margin-bottom: 8px;
  font-size: 16px;
  letter-spacing: 0.08em;
}

.play-body .result-heading h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.3;
}

.play-body .result-guidance {
  max-width: 720px;
  margin: 10px 0 0;
  color: #526b70;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.65;
}

.play-body .result-panel .rank-block {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  width: 166px;
  height: 166px;
  border-width: 4px;
  border-radius: 38px;
}

.play-body .result-panel .rank-block span {
  font-size: 16px;
}

.play-body .result-panel .rank-block strong {
  margin-top: 8px;
  font-size: 62px;
  line-height: 1;
}

.play-body .result-panel .result-main-score {
  grid-column: 2;
  align-self: start;
}

.play-body .result-panel .result-main-score span {
  display: block;
  font-size: 16px;
}

.play-body .result-panel .result-main-score strong {
  display: block;
  margin: 2px 0 0;
  font-size: 46px;
  line-height: 1.1;
}

.play-body .result-panel .result-metrics {
  grid-column: 1 / -1;
  align-self: center;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.play-body .result-panel .result-metrics > div {
  min-height: 108px;
  padding: 14px 17px 16px;
  display: grid;
  align-content: center;
  border: 1px solid #d6e4df;
  border-radius: 16px;
  background: #fff;
}

.play-body .result-panel .result-metrics > div:last-child {
  grid-column: auto;
}

.play-body .result-panel .result-metrics span {
  font-size: 15px;
  font-weight: 800;
}

.play-body .result-panel .result-metrics strong,
.play-body .result-panel .result-metrics > div:last-child strong {
  margin-top: 7px;
  font-size: 23px;
  line-height: 1.2;
  white-space: normal;
}

.play-body .result-panel .result-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.play-body .result-panel .result-actions .primary-button,
.play-body .result-panel .result-actions .text-button {
  width: 270px;
  min-height: 58px;
  padding: 0 22px;
  font-size: 17px;
}

.play-body[data-beginner-mode="true"] .result-panel {
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px 38px;
  padding: 50px 72px 46px;
  color: #4b3a24;
  background: #fffaf0;
}

.play-body[data-beginner-mode="true"] .result-panel .rank-block {
  width: 176px;
  height: 176px;
  border-color: #d9982d;
  color: #765019;
  background: #fff0c8;
}

.play-body[data-beginner-mode="true"] .result-panel .rank-block strong {
  font-size: 66px;
}

.play-body[data-beginner-mode="true"] .result-heading h2 {
  font-size: 34px;
}

.play-body[data-beginner-mode="true"] .result-guidance {
  color: #6f5b3b;
  font-size: 19px;
}

.play-body[data-beginner-mode="true"] .result-panel .result-main-score strong {
  color: #9b6218;
  font-size: 54px;
}

.play-body[data-beginner-mode="true"] .result-panel .result-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.play-body[data-beginner-mode="true"] .result-panel .result-metric-advanced {
  display: none;
}

.play-body[data-beginner-mode="true"] .result-panel .result-metrics > div {
  min-height: 92px;
  border-color: #ead09c;
  background: #fffdf7;
}

.play-body[data-beginner-mode="true"] .result-panel .result-actions .primary-button,
.play-body[data-beginner-mode="true"] .result-panel .result-actions .text-button {
  width: 310px;
  min-height: 64px;
  font-size: 19px;
}

/* Beginner mode is set synchronously before the window markup is parsed. */
.play-body[data-beginner-mode="true"] .lesson-title p,
.play-body[data-beginner-mode="true"] .header-time span,
.play-body[data-beginner-mode="true"] .metric-rail span {
  font-size: 15px;
}

.play-body[data-beginner-mode="true"] .lesson-title h1 {
  font-size: 22px;
}

.play-body[data-beginner-mode="true"] .progress-copy strong,
.play-body[data-beginner-mode="true"] .status-badge {
  font-size: 17px;
}

.play-body[data-beginner-mode="true"] .header-time strong {
  font-size: 28px;
}

.play-body[data-beginner-mode="true"] .metric-rail strong {
  font-size: 23px;
}

.play-body[data-beginner-mode="true"] .ready-copy p {
  font-size: 19px;
}

.play-body[data-beginner-mode="true"] .ready-copy > span,
.play-body[data-beginner-mode="true"] .pause-panel > div > span {
  font-size: 16px;
}

.play-body[data-beginner-mode="true"] .ready-panel .primary-button,
.play-body[data-beginner-mode="true"] .pause-panel .primary-button,
.play-body[data-beginner-mode="true"] .pause-panel .text-button {
  font-size: 17px;
}

.play-body[data-beginner-mode="true"] .keyboard-heading h2 {
  font-size: 20px;
}

.play-body[data-beginner-mode="true"] .keyboard-message,
.play-body[data-beginner-mode="true"] .romaji-input-note {
  font-size: 14px;
}

.play-body[data-beginner-mode="true"] .key {
  font-size: 17px;
}

/*
 * v1.46: keep the fixed practice window readable without letting the
 * beginner keyboard heading or pause actions collide.
 */
.play-body .pause-panel {
  gap: 20px;
}

.play-body .pause-panel > div:not(.panel-actions) {
  min-width: 0;
  flex: 1 1 auto;
}

.play-body .pause-panel h2 {
  white-space: nowrap;
}

.play-body .pause-panel > div > span {
  display: block;
  line-height: 1.45;
  white-space: nowrap;
}

.play-body .pause-panel .panel-actions {
  flex: 0 0 auto;
  margin-left: auto;
  gap: 10px;
}

.play-body .pause-panel .exit-button {
  min-width: 206px;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.play-body .pause-panel .exit-button span,
.play-body .pause-panel .exit-button strong {
  display: block;
  white-space: nowrap;
}

.play-body .pause-panel .exit-button strong {
  margin-top: 2px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.play-body[data-beginner-mode="true"] .keyboard-heading {
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 18px;
}

.play-body[data-beginner-mode="true"] .keyboard-message {
  min-width: 0;
  padding: 5px 10px 5px 16px;
  border-left: 1px solid #d9b66f;
  border-radius: 0 999px 999px 0;
}

.play-body[data-beginner-mode="true"] .keyboard-message > span {
  white-space: nowrap;
}

.play-body .result-panel,
.play-body .result-panel .result-actions,
.play-body #resultBackLink {
  pointer-events: auto;
}

.play-body #resultBackLink {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.play-body .stage-header {
  grid-template-columns: minmax(300px, 1fr) minmax(470px, 1.28fr) 130px;
}

.play-body .status-badge {
  min-width: 124px;
  white-space: nowrap;
}

.play-body .status-badge strong {
  white-space: nowrap;
}

/*
 * v1.50: remove redundant text around the keyboard guide and keep only the
 * large next-key value. Compact long control-key labels without clipping.
 */
.play-body .keyboard-section {
  grid-template-rows: 190px;
  padding-top: 6px;
}

.play-body .next-key-hint {
  top: 86px;
  width: 92px;
  min-height: 66px;
  padding: 6px;
  grid-template-rows: 1fr;
}

.play-body .next-key-hint > .next-key-caption {
  position: absolute;
  top: -23px;
  left: 0;
  width: 100%;
  display: block;
  color: #365d55;
  font-size: 12px;
  font-weight: 900;
  line-height: 16px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.play-body .next-key-hint > strong {
  min-width: 62px;
  font-size: 34px;
}

.play-body .key[data-code="Backspace"] {
  padding-inline: 1px;
  overflow: hidden;
  white-space: nowrap;
}

.play-body .key[data-code="Backspace"] > span:first-child {
  font-size: 10px;
  letter-spacing: -0.05em;
  transform: scaleX(0.94);
  transform-origin: center;
}

.play-body .pause-panel .exit-button strong {
  text-decoration: none;
}

/*
 * v1.55: maximize the main legend on the standard keyboard while preserving
 * room for control-key names and the secondary Shift legend.
 */
.play-body:not([data-beginner-mode="true"]) .key {
  font-size: 18px;
  line-height: 1;
}

.play-body:not([data-beginner-mode="true"]) .key[data-code="Backspace"] {
  font-size: 10px;
}

.play-body:not([data-beginner-mode="true"]) .key[data-code^="Control"],
.play-body:not([data-beginner-mode="true"]) .key[data-code^="Shift"],
.play-body:not([data-beginner-mode="true"]) .key[data-code="CapsLock"],
.play-body:not([data-beginner-mode="true"]) .key[data-code="NonConvert"],
.play-body:not([data-beginner-mode="true"]) .key[data-code="Convert"],
.play-body:not([data-beginner-mode="true"]) .key[data-code="KanaMode"] {
  font-size: 12px;
}

/*
 * v1.56: one-character beginner rows, compact hands and expanded keyboard.
 * The fixed 1180 x 760 practice geometry is preserved.
 */
.play-body .control-deck,
.play-body:is(
    [data-game-state="countdown"],
    [data-game-state="playing"],
    [data-game-state="paused"],
    [data-game-state="imeBlocked"]
  )
  .control-deck {
  grid-template-columns: 210px minmax(0, 1fr) 210px 163px;
}

.play-body .practice-actions {
  grid-template-columns: 69px 42px 42px;
  gap: 5px;
}

.play-body .practice-actions .settings-button,
.play-body .practice-actions .help-button {
  width: 42px;
  padding: 0;
  border-color: #91aba7;
  color: #173d49;
  background: #fff;
}

.play-body .practice-actions .settings-button span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  font-size: 20px;
  line-height: 1;
}

.play-body .practice-actions .settings-button:hover {
  border-color: #2f8b7d;
  color: #0f6257;
  background: #effaf6;
}

.play-body .game-shell,
.play-body:is(
    [data-game-state="countdown"],
    [data-game-state="playing"],
    [data-game-state="paused"],
    [data-game-state="imeBlocked"]
  )
  .game-shell {
  grid-template-rows: 64px 290px 300px 70px;
}

.play-body .keyboard-section {
  z-index: 6;
  height: 300px;
  padding: 6px 10px;
  grid-template-rows: 286px;
}

.play-body .keyboard {
  --key-unit: 54px;
  --key-height: 50px;
  --key-gap: 4px;
  width: 100%;
  height: 286px;
  padding: 4px;
}

.play-body .keyboard-board {
  box-sizing: border-box;
  margin-right: 0;
  margin-left: 112px;
  align-items: stretch;
}

.play-body .keyboard-board[data-layout="jis"] {
  width: calc(var(--key-unit) * 16.05 + var(--key-gap) * 14);
  padding-right: 0;
}

.play-body .keyboard-board[data-layout="us"] {
  width: calc(var(--key-unit) * 15 + var(--key-gap) * 13);
}

.play-body .keyboard-row {
  box-sizing: border-box;
  width: 100%;
  flex: 0 0 auto;
  justify-content: space-between;
}

.play-body .keyboard-board[data-layout="jis"] .keyboard-row:nth-child(2),
.play-body .keyboard-board[data-layout="jis"] .keyboard-row:nth-child(3) {
  padding-right: calc(var(--key-unit) * 1.6 + var(--key-gap));
}

.play-body .key-enter-jis {
  right: 0;
  left: auto;
}

.play-body .next-key-hint {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  overflow: visible;
}

.play-body .next-key-hint > strong {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}

.play-body .next-key-hint > .next-key-shift {
  position: static;
  flex: 0 0 34px;
  min-width: 40px;
  min-height: 34px;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  place-items: center;
  transform: none;
  border: 0;
  color: #17685d;
  background: transparent;
  font: 900 34px/1 "Segoe UI Symbol", "Segoe UI", sans-serif;
}

.play-body .next-key-hint > .next-key-shift[hidden] {
  display: none;
}

.play-body[data-beginner-mode="true"] .next-key-hint > .next-key-shift {
  color: #a86a15;
}

.play-body .key,
.play-body:not([data-beginner-mode="true"]) .key {
  padding: 3px;
  font-size: 22px;
}

.play-body[data-beginner-mode="true"] .key {
  font-size: 20px;
}

.play-body .key .shift-label {
  top: 3px;
  right: 4px;
  font-size: 15px;
}

.play-body .key[data-code="Backspace"],
.play-body:not([data-beginner-mode="true"]) .key[data-code="Backspace"],
.play-body .key[data-code^="Control"],
.play-body .key[data-code^="Shift"],
.play-body .key[data-code="CapsLock"],
.play-body .key[data-code="NonConvert"],
.play-body .key[data-code="Convert"],
.play-body .key[data-code="KanaMode"] {
  font-size: 13px;
}

.play-body .key[data-code="Backspace"] > span:first-child {
  font-size: 12px;
}

.play-body .finger-guide,
.play-body .hands-visual {
  height: 70px;
}

.play-body .finger-guide {
  z-index: 5;
}

.play-body .hand-pair-figure {
  top: -64px;
  width: 1050px;
  aspect-ratio: 2172 / 724;
  clip-path: none;
  transform: translateX(-50%) scaleY(0.5);
  transform-origin: top center;
}

.play-body .hand-pair-figure .finger-marker::before {
  -webkit-mask-image: url("./assets/hand-pair-v7.png");
  mask-image: url("./assets/hand-pair-v7.png");
}

.play-body .settings-dialog {
  width: 480px;
}

.play-body .settings-dialog-copy {
  margin: -6px 0 18px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.7;
}

.play-body .settings-layout-options {
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.play-body .settings-layout-options button {
  min-height: 76px;
  padding: 10px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 2px solid #c7d8d3;
  border-radius: 12px;
  color: #31534d;
  background: #fff;
  cursor: pointer;
}

.play-body .settings-layout-options button strong {
  font-size: 22px;
}

.play-body .settings-layout-options button span {
  font-size: 13px;
  font-weight: 800;
}

.play-body .settings-layout-options button.active {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-light);
  box-shadow: 0 0 0 3px rgba(33, 138, 120, 0.1);
}

.practice-overlay-loading {
  gap: 12px;
}

.practice-overlay-loading strong {
  font-size: 20px;
}

.practice-overlay-loading small {
  color: #53716f;
  font-size: 13px;
  font-weight: 700;
}

.practice-overlay-loading .practice-overlay-loading-track {
  width: min(420px, calc(100vw - 80px));
  height: 12px;
  overflow: hidden;
  border: 1px solid #bdd2cf;
  border-radius: 999px;
  background: #dceae8;
}

.practice-overlay-loading .practice-overlay-loading-track > span {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: inherit;
  background: #168276;
  transform: scaleX(0.04);
  transform-origin: left center;
  animation: practice-loading-progress 1s cubic-bezier(0.2, 0.78, 0.25, 1) forwards;
}

.practice-overlay.is-beginner .practice-overlay-loading {
  color: #654311;
  background: #fff7df;
}

.practice-overlay.is-beginner .practice-overlay-loading small {
  color: #805e26;
}

.practice-overlay.is-beginner .practice-overlay-loading-track {
  border-color: #dfbd73;
  background: #f6dfaa;
}

.practice-overlay.is-beginner .practice-overlay-loading-track > span {
  background: #e79a21;
}

@keyframes practice-loading-progress {
  0% {
    transform: scaleX(0.04);
  }
  48% {
    transform: scaleX(0.7);
  }
  100% {
    transform: scaleX(1);
  }
}

/*
 * v1.59.4: keep the palm-rest guide compact, use a one-second preparation
 * progress bar, and align the touching-finger artwork with its SVG colors.
 */
.play-body .duration-card-group > span {
  margin-right: 7px;
}

.play-body .game-shell,
.play-body:is(
    [data-game-state="countdown"],
    [data-game-state="playing"],
    [data-game-state="paused"],
    [data-game-state="imeBlocked"]
  )
  .game-shell {
  grid-template-rows: 64px 290px 320px 50px;
}

.play-body .keyboard-section {
  z-index: 4;
  height: 320px;
  padding: 6px 10px 36px;
  grid-template-rows: 276px;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background:
    linear-gradient(
      180deg,
      #e6f2e9 0%,
      #dcebe2 84%,
      #d3e3d9 84%,
      #cbded3 100%
    );
}

.play-body .keyboard {
  height: 276px;
}

.play-body .finger-guide,
.play-body .hands-visual {
  height: 54px;
}

.play-body .finger-guide {
  z-index: 7;
  margin-top: -4px;
  border: 1px solid #aebfb6;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #cbded3;
  box-shadow: inset 0 -3px 0 rgba(48, 72, 65, 0.08);
}

.play-body .hand-pair-figure {
  top: -80px;
  width: 850px;
  aspect-ratio: 2012 / 781;
  overflow: hidden;
  clip-path: inset(0 0 50% 0);
  transform: translateX(-50%);
  transform-origin: center center;
}

.play-body .hand-pair-figure img {
  filter: grayscale(1) brightness(0.93) contrast(0.95);
  opacity: 1;
}

.play-body .hand-pair-figure .finger-marker::before {
  -webkit-mask-image: url("./assets/hand-pair-v17.png?v=1.59.4");
  mask-image: url("./assets/hand-pair-v17.png?v=1.59.4");
}

.play-body .keyboard-guide-toggle {
  right: 4px;
}

/*
 * v1.57: make symbol legends readable and tie Shift guidance to the same
 * finger color system as the target key and hand overlay.
 */
.play-body .key.next,
.play-body .key.shift-needed,
.play-body .key.modifier-required {
  border-color: color-mix(in srgb, var(--finger-color) 86%, #172f36);
  color: color-mix(in srgb, var(--finger-color) 42%, #172f36);
  background: color-mix(in srgb, var(--finger-color) 18%, #fff);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--finger-color) 20%, transparent),
    0 4px 0 color-mix(in srgb, var(--finger-color) 68%, #6d4c3b);
}

.play-body .key.next-alternative {
  border-color: color-mix(in srgb, var(--finger-color) 78%, #172f36);
  color: color-mix(in srgb, var(--finger-color) 38%, #172f36);
  background: color-mix(in srgb, var(--finger-color) 10%, #fff);
}

.play-body .key .shift-label {
  top: 4px;
  right: 5px;
  padding: 0 1px;
  color: color-mix(in srgb, var(--ink-soft) 82%, #000);
  font-size: 18px;
  line-height: 1;
}

.play-body .key[data-code^="Control"] .shift-label,
.play-body .key[data-code^="Shift"] .shift-label,
.play-body .key[data-code="Backspace"] .shift-label,
.play-body .key[data-code="CapsLock"] .shift-label,
.play-body .key[data-code="NonConvert"] .shift-label,
.play-body .key[data-code="Convert"] .shift-label,
.play-body .key[data-code="KanaMode"] .shift-label {
  font-size: 13px;
}

.play-body[data-beginner-mode="true"] .finger-guide {
  border-color: #d8ac5c;
  background: #efd19b;
  box-shadow: inset 0 -3px 0 rgba(124, 81, 24, 0.08);
}

.play-body[data-beginner-mode="true"] .keyboard-section {
  background:
    linear-gradient(
      180deg,
      #fff3cf 0%,
      #f7dfae 84%,
      #efd19b 84%,
      #e8c78b 100%
    );
}
