:root {
  --bg: #f4f2ed;
  --bg-soft: #efede7;
  --surface: #fbfaf7;
  --surface-raised: #fffefb;
  --surface-muted: #eeece6;
  --ink: #1f2622;
  --ink-2: #4c5751;
  --ink-3: #77817b;
  --line: #dedfd8;
  --line-strong: #c2c7bf;
  --accent: #2d5a4e;
  --accent-deep: #20443b;
  --accent-soft: #e4ece7;
  --accent-line: #a9c2b7;
  --warm: #8a6a3f;
  --warm-soft: #f4ede2;
  --warm-line: #d9c7a8;
  --danger: #8f3b32;
  --danger-soft: #f5e7e3;
  --danger-line: #c48e86;
  --red-cell: #8c3a31;
  --blue-cell: #34566e;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 1px 2px rgba(31, 38, 34, 0.05), 0 12px 32px rgba(31, 38, 34, 0.04);
  --font: "Helvetica Neue", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --num: "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.lead {
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink-2);
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f8fbf9;
}

.btn-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--ink-3);
  background: var(--surface-raised);
}

.btn-quiet {
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink-2);
}

.btn-quiet:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.btn-block {
  width: 100%;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 2px 0;
  color: var(--accent);
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 4px;
}

.btn-link:hover {
  color: var(--accent-deep);
  text-decoration-color: var(--accent-deep);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--ink-2);
  font-size: 22px;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.site-header {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 40px) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  border: 1px solid var(--ink);
  border-radius: 9px;
  flex: 0 0 auto;
}

.brand-mark i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink);
}

.brand-mark i:nth-child(1) {
  top: 8px;
  left: 8px;
}

.brand-mark i:nth-child(2) {
  top: 8px;
  right: 8px;
}

.brand-mark i:nth-child(3) {
  bottom: 8px;
  left: 8px;
}

.brand-mark i:nth-child(4) {
  bottom: 8px;
  right: 8px;
  background: var(--accent);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-text small {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.lobby-shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 40px) 72px;
}

.lobby-hero {
  padding: clamp(56px, 9vh, 104px) 0 clamp(48px, 7vh, 76px);
  max-width: 780px;
}

.lobby-hero h1 {
  margin-top: 18px;
  font-size: clamp(36px, 5.2vw, 58px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.lobby-hero .lead {
  margin-top: 22px;
  max-width: 600px;
}

.lobby-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 28px;
  color: var(--ink-3);
  font-size: 12px;
}

.lobby-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lobby-meta span::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-line);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-head span {
  color: var(--ink-3);
  font-size: 12px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 228px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.game-card.is-available {
  border-color: var(--accent-line);
  background: linear-gradient(165deg, #fbfcf9 0%, #f2f6f2 100%);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.game-card.is-available:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.game-card.is-available:active {
  transform: translateY(0);
}

.game-card.is-available::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 64px;
  height: 64px;
  background: radial-gradient(circle at 100% 0, var(--accent-soft), transparent 68%);
  pointer-events: none;
}

.game-card.is-locked {
  color: var(--ink-2);
  background: rgba(251, 250, 247, 0.55);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
}

.card-index {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 8px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  color: var(--accent);
  background: var(--surface-raised);
  font-size: 10px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.card-badge.is-muted {
  border-color: var(--line);
  color: var(--ink-3);
  background: transparent;
}

.game-card h3 {
  margin-top: 20px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.game-card.is-locked h3 {
  color: var(--ink-2);
}

.game-card p {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.65;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: auto;
  padding-top: 20px;
  color: var(--ink-3);
  font-size: 11px;
}

.card-enter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

.card-enter span {
  transition: transform 180ms ease;
}

.game-card.is-available:hover .card-enter span {
  transform: translateX(3px);
}

.site-footer {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px clamp(18px, 4vw, 40px) 36px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  color: var(--ink-3);
  font-size: 11px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 30, 26, 0.38);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 500px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(20, 28, 23, 0.18);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-head h2 {
  font-size: 20px;
  font-weight: 600;
}

.modal-copy {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.settings-list {
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.settings-row-copy {
  min-width: 0;
}

.settings-row-copy label {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.settings-row-copy p {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.6;
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

input[type="range"] {
  width: 118px;
  accent-color: var(--accent);
}

.range-value {
  width: 38px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
}

.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  transition: background-color 160ms ease, border-color 160ms ease;
  pointer-events: none;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  transition: transform 160ms ease, border-color 160ms ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
  border-color: var(--accent);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.game-page {
  background: var(--bg);
}

.game-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.game-topbar {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3.4vw, 40px);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: 0 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--ink-2);
  font-size: 13px;
  transition: color 140ms ease;
}

.back-link:hover {
  color: var(--ink);
}

.back-link span {
  color: var(--ink-3);
  font-size: 15px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.topbar-rule {
  width: 20px;
  height: 1px;
  background: var(--line-strong);
}

.game-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view {
  display: none;
  width: 100%;
}

.view.is-active {
  display: flex;
  flex-direction: column;
}

.intro-view.is-active {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(308px, 0.8fr);
  align-items: start;
  gap: clamp(36px, 6vw, 72px);
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(26px, 5vh, 62px) clamp(18px, 4vw, 40px) 60px;
}

.intro-title {
  margin-top: 16px;
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.intro-lead {
  margin-top: 16px;
  max-width: 540px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.8;
}

.rules-block {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.rules-head h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.rule-list {
  display: grid;
  gap: 15px;
  margin-top: 18px;
}

.rule-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.rule-index {
  padding-top: 1px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.rule-list strong {
  color: var(--ink);
  font-weight: 600;
}

.intro-footnote {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 26px;
  color: var(--ink-3);
  font-size: 11px;
}

.input-note {
  margin-top: 16px;
  color: var(--ink-3);
  font-size: 11px;
}

.start-card {
  position: sticky;
  top: 28px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.start-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.start-card-head h2 {
  margin-top: 6px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.level-sub {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 13px;
}

.level-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--line);
}

.level-fact {
  padding: 12px 14px;
  background: var(--surface-raised);
}

.level-fact span {
  display: block;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.level-fact strong {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  font-weight: 600;
}

.level-actions {
  margin-top: 20px;
  display: grid;
  gap: 9px;
}

.start-note {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--warm-line);
  border-radius: 10px;
  background: var(--warm-soft);
  color: var(--warm);
  font-size: 12px;
  line-height: 1.6;
}

.best-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 11px;
}

.best-line strong {
  color: var(--ink-2);
  font-weight: 500;
}

.level-options {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.level-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.level-option:hover {
  background: var(--surface-muted);
}

.level-option.is-active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.level-option-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

.level-option-copy {
  min-width: 0;
}

.level-option-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
}

.level-option-copy small {
  display: block;
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 10px;
}

.level-option-check {
  color: var(--accent);
  font-size: 12px;
  opacity: 0;
}

.level-option.is-active .level-option-check {
  opacity: 1;
}

.level-option-auto {
  margin-top: 4px;
  border-top: 1px dashed var(--line);
  border-radius: 0 0 10px 10px;
}

.practice-view.is-active {
  align-items: center;
  gap: 18px;
  padding: clamp(20px, 3.6vh, 44px) 16px 48px;
}

.practice-head {
  width: 100%;
  max-width: 580px;
  text-align: center;
}

.practice-head h1 {
  margin-top: 8px;
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.practice-head p {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.practice-status {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 42px;
}

.practice-status-label {
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.practice-target {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

.practice-target strong {
  color: var(--ink);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.practice-progress {
  padding-left: 20px;
  border-left: 1px solid var(--line);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
}

.practice-frame {
  max-width: 100%;
}

.practice-hint {
  min-height: 24px;
  max-width: 560px;
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
}

.practice-hint.is-error {
  color: var(--danger);
}

.practice-complete {
  width: 100%;
  max-width: 480px;
  margin-top: 12px;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.practice-complete h2 {
  margin-top: 8px;
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.practice-complete p {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.practice-complete .btn {
  margin-top: 22px;
}

.round-view.is-active {
  flex: 1 1 auto;
  align-items: center;
  padding: 2px clamp(12px, 3vw, 32px) 14px;
  min-height: 0;
}

.round-active {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

.round-active .game-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.round-active .game-main {
  min-height: 0;
}

.round-active .round-view {
  min-height: 0;
}

.hud {
  width: min(760px, 100%);
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 16px;
  padding: 6px 0 0;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hud-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
}

.hud-rule {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hud-target {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.hud-target-label {
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.hud-target strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.hud-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hud-time.is-low {
  color: var(--warm);
}

.hud-bar {
  grid-column: 1 / -1;
  height: 3px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.hud-bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
}

.hud-bar span.is-low {
  background: var(--warm);
}

.board-zone {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding-top: 8px;
}

.board-caption {
  width: min(760px, 100%);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding-bottom: 10px;
}

.next-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--ink-3);
  font-size: 12px;
}

.next-line strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 23px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}

.next-mark {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.next-mark.is-square {
  border-radius: 1px;
}

.next-mark.is-red {
  border-radius: 50%;
  background: var(--red-cell);
}

.next-mark.is-blue {
  border-radius: 1px;
  background: var(--blue-cell);
}

.l5-counters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.l5-counter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.4;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.l5-counter strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.l5-counter.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.counter-mark {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  background: currentColor;
}

.counter-mark.is-dot {
  border-radius: 50%;
  background: var(--red-cell);
}

.counter-mark.is-square {
  border-radius: 1px;
  background: var(--blue-cell);
}

.board-frame {
  flex: 0 0 auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  max-width: 100%;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}

.board-frame.is-complete {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.board-frame.is-wrong {
  border-style: dashed;
  border-color: var(--danger-line);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  grid-auto-rows: var(--cell);
  gap: var(--gap);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--cell);
  height: var(--cell);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-raised);
  color: var(--ink);
  font-family: var(--num);
  font-size: var(--cell-font);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 90ms ease, border-color 90ms ease, box-shadow 90ms ease;
}

.cell-value {
  display: block;
  pointer-events: none;
}

.cell-mark {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 4px;
  height: 4px;
  transform: translateX(-50%);
  background: currentColor;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.8;
}

.cell--red .cell-value {
  color: var(--red-cell);
}

.cell--blue .cell-value {
  color: var(--blue-cell);
}

.cell--blue .cell-mark {
  border-radius: 1px;
}

.cell--blank {
  color: var(--ink-3);
  background: var(--surface-muted);
}

.cell--blank .cell-value {
  font-size: 0.72em;
}

.cell.is-correct {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.cell.is-wrong {
  border-style: dashed;
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.cell.is-wrong::after {
  content: "×";
  position: absolute;
  top: 3px;
  right: 5px;
  color: var(--danger);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.cell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

@media (hover: hover) and (pointer: fine) {
  .cell:hover {
    border-color: var(--line-strong);
    background: #ffffff;
  }

  .cell--blank:hover {
    background: var(--surface-muted);
    border-color: var(--line);
  }
}

.countdown-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(244, 242, 237, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.countdown-inner {
  text-align: center;
}

.countdown-label {
  margin-bottom: 8px;
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.2em;
}

.countdown-number {
  display: block;
  color: var(--ink);
  font-size: clamp(76px, 18vw, 120px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.countdown-number.is-tick {
  animation: count-in 560ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.countdown-sub {
  margin-top: 16px;
  color: var(--ink-2);
  font-size: 13px;
}

@keyframes count-in {
  from {
    opacity: 0.15;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.overlay-layer {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(244, 242, 237, 0.88);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.overlay-card {
  width: 100%;
  max-width: 400px;
  padding: 30px 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(20, 28, 23, 0.14);
  text-align: center;
}

.overlay-card h2 {
  margin-top: 8px;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.overlay-card p {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.overlay-card .btn {
  margin-top: 20px;
}

.pause-meta {
  display: block;
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 11px;
}

.result-view.is-active {
  display: block;
  padding: clamp(16px, 3.4vh, 40px) clamp(16px, 4vw, 40px) 64px;
}

.result-wrap {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
}

.result-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.result-head h1 {
  margin-top: 7px;
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.result-head h1 span {
  margin-left: 4px;
  color: var(--ink-2);
  font-size: 0.42em;
  font-weight: 400;
  letter-spacing: 0;
}

.result-sub {
  margin-top: 9px;
  color: var(--ink-3);
  font-size: 12px;
}

.result-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 11px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  white-space: nowrap;
}

.result-tag.is-warn {
  border-color: var(--warm-line);
  background: var(--warm-soft);
  color: var(--warm);
}

.result-tag.is-muted {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--ink-2);
}

.notice-stack {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.notice {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.65;
}

.notice.is-warn {
  border-color: var(--warm-line);
  background: var(--warm-soft);
  color: var(--warm);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.metric {
  min-width: 0;
  padding: 18px 16px 16px;
  background: var(--surface);
}

.metric-label {
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.metric strong small {
  margin-left: 3px;
  color: var(--ink-2);
  font-size: 0.45em;
  font-weight: 400;
  letter-spacing: 0;
}

.metric-sub {
  display: block;
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.55;
}

.metric details {
  margin-top: 8px;
}

.metric summary {
  color: var(--accent);
  font-size: 11px;
  line-height: 1.5;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  list-style: none;
}

.metric summary::-webkit-details-marker {
  display: none;
}

.metric details[open] summary {
  color: var(--ink-2);
}

.detail-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.6;
}

.detail-list span {
  display: block;
}

.advice-card {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: linear-gradient(170deg, #f7faf7, #edf3ee);
}

.advice-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.advice-head h2 {
  margin-top: 5px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--accent);
  font-size: 10px;
  white-space: nowrap;
}

.advice-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.advice-list li {
  position: relative;
  padding-left: 14px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.advice-list li::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.advice-meta {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.6;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.result-actions .btn {
  min-width: 126px;
}

.trend-panel {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.trend-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.trend-head h2 {
  font-size: 16px;
  font-weight: 600;
}

.trend-legend {
  display: flex;
  gap: 14px;
  color: var(--ink-3);
  font-size: 10px;
}

.trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 10px;
  height: 4px;
  border-radius: 1px;
  background: var(--accent);
}

.legend-dot.is-median {
  background: var(--ink-3);
}

.trend-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 116px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.trend-meta {
  min-width: 0;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trend-meta strong {
  display: block;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 500;
}

.trend-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.trend-bar {
  width: 100%;
  height: 6px;
  border-radius: 2px;
  background: var(--surface-muted);
  overflow: hidden;
}

.trend-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.trend-bar.is-median i {
  background: var(--ink-3);
}

.trend-values {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  text-align: right;
  white-space: nowrap;
}

.trend-values span {
  display: block;
}

.trend-values span + span {
  color: var(--ink-3);
}

.trend-empty {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
}

.trend-foot {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.6;
}

@media (max-width: 1023px) {
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intro-view.is-active {
    gap: 40px;
  }
}

@media (max-width: 820px) {
  .intro-view.is-active {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
    padding-top: 22px;
  }

  .start-card {
    position: static;
  }

  .intro-title {
    font-size: clamp(34px, 8vw, 44px);
  }

  .intro-lead {
    font-size: 15px;
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-card {
    min-height: 206px;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding-top: 18px;
  }

  .lobby-hero {
    padding: 42px 0 38px;
  }

  .lobby-meta {
    gap: 8px 16px;
  }

  .game-grid {
    gap: 10px;
  }

  .game-card {
    min-height: 196px;
    padding: 16px;
  }

  .game-card h3 {
    margin-top: 16px;
    font-size: 18px;
  }

  .game-card p {
    font-size: 12px;
  }

  .card-meta {
    padding-top: 14px;
  }

  .site-footer {
    flex-direction: column;
  }

  .game-topbar {
    min-height: 52px;
    padding: 0 14px;
  }

  .topbar-rule,
  .topbar-meta .topbar-label {
    display: none;
  }

  .hud {
    gap: 5px 10px;
    padding-top: 2px;
  }

  .hud-level {
    min-width: 30px;
    height: 22px;
    font-size: 10px;
  }

  .hud-rule {
    display: none;
  }

  .hud-target strong {
    font-size: 23px;
  }

  .hud-target-label {
    font-size: 9px;
  }

  .hud-right {
    font-size: 14px;
  }

  .board-caption {
    padding-bottom: 8px;
    gap: 6px;
  }

  .next-line strong {
    font-size: 21px;
  }

  .l5-counter {
    min-height: 27px;
    padding: 2px 9px;
    font-size: 10px;
  }

  .l5-counter strong {
    font-size: 11px;
  }

  .board-frame {
    padding: 8px;
    border-radius: 14px;
  }

  .round-view.is-active {
    padding: 0 8px 10px;
  }

  .board-zone {
    padding-top: 4px;
  }

  .result-head h1 {
    font-size: 36px;
  }

  .metric {
    padding: 15px 13px;
  }

  .metric strong {
    font-size: 24px;
  }

  .advice-card,
  .trend-panel {
    padding: 17px;
  }

  .trend-row {
    grid-template-columns: 88px minmax(0, 1fr) 100px;
    gap: 9px;
  }

  .result-actions .btn {
    flex: 1 1 130px;
  }

  .practice-view.is-active {
    gap: 14px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .practice-frame {
    padding: 6px;
  }

  .modal {
    padding: 22px;
  }

  .settings-row {
    gap: 12px;
  }

  input[type="range"] {
    width: 96px;
  }
}

@media (max-width: 430px) {
  .game-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .game-card {
    min-height: 172px;
  }

  .game-card.is-locked {
    min-height: 150px;
  }

  .card-enter {
    margin-top: 12px;
    padding-top: 12px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric strong {
    font-size: 22px;
  }

  .metric-label {
    font-size: 10px;
  }

  .result-actions {
    gap: 8px;
  }

  .result-actions .btn {
    flex: 1 1 100%;
  }

  .settings-row {
    align-items: flex-start;
  }

  .settings-row .range-wrap {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .range-value {
    width: auto;
  }

  .start-card {
    padding: 20px;
  }

  .practice-head h1 {
    font-size: 25px;
  }
}

html.reduced-motion *,
html.reduced-motion *::before,
html.reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

html.hc {
  --bg: #ffffff;
  --bg-soft: #f4f4f4;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #f0f0f0;
  --ink: #000000;
  --ink-2: #1a1a1a;
  --ink-3: #3e3e3e;
  --line: #8a8a8a;
  --line-strong: #000000;
  --accent: #00483a;
  --accent-deep: #003229;
  --accent-soft: #e6f0ec;
  --accent-line: #00604c;
  --warm: #5f3d00;
  --warm-soft: #f7ecd8;
  --warm-line: #8a5a00;
  --danger: #7a0000;
  --danger-soft: #ffffff;
  --danger-line: #7a0000;
  --red-cell: #7a0000;
  --blue-cell: #003a66;
  --shadow: none;
}

html.hc .cell {
  border-width: 2px;
}

html.hc .cell.is-wrong,
html.hc .board-frame.is-wrong {
  border-width: 2px;
}

html.hc .game-card,
html.hc .start-card,
html.hc .metric-grid,
html.hc .advice-card,
html.hc .trend-panel,
html.hc .modal,
html.hc .overlay-card,
html.hc .board-frame {
  border-width: 2px;
}

html.hc .cell-mark {
  opacity: 1;
}

.layout-picker {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.layout-picker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-2);
  font-size: 11px;
}

.layout-picker-note {
  color: var(--ink-3);
  font-size: 10px;
  text-align: right;
}

.layout-chips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 9px;
}

.layout-chip {
  min-height: 44px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--ink-2);
  font-size: 12px;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.layout-chip:hover {
  border-color: var(--line-strong);
}

.layout-chip.is-active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-deep);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.practice-target strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.board-frame.is-free {
  padding: 6px;
}

.board-cloud {
  position: relative;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.cell--free {
  position: absolute;
  border-color: transparent;
  background: transparent;
  border-radius: 50%;
  transition: background-color 90ms ease, border-color 90ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .cell--free:hover {
    background: var(--surface-muted);
    border-color: var(--line);
  }
}

html.hc .cell--free {
  border-color: transparent;
}

.topbar-pause {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11px;
  transition: border-color 140ms ease, color 140ms ease;
}

.topbar-pause:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.board-layout-tag {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.practice-skip {
  margin-top: -4px;
  color: var(--ink-3);
  font-size: 12px;
}

.practice-skip:hover {
  color: var(--ink);
}

.board-detail {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px 18px;
}

.board-detail summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: 12px;
}

.board-detail-list {
  display: grid;
  gap: 2px;
  margin-top: 10px;
}

.board-detail-row {
  display: grid;
  grid-template-columns: 62px 56px minmax(0, 1fr) 76px;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
  color: var(--ink-2);
  font-size: 12px;
}

.board-detail-row:first-child {
  border-top: 0;
}

.board-detail-time {
  color: var(--ink);
  font-family: var(--mono);
}

.board-detail-meta {
  color: var(--ink-3);
  font-size: 11px;
  text-align: right;
}

@media (max-width: 430px) {
  .board-detail-row {
    grid-template-columns: 54px 48px minmax(0, 1fr) 64px;
    font-size: 11px;
  }
}

/* Stroop */
.stroop-zone {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 0;
  padding: 8px 12px 16px;
}

.stroop-stage {
  position: relative;
  width: min(760px, 100%);
  min-height: clamp(170px, 28vh, 250px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px 20px 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 90ms ease, box-shadow 90ms ease;
}

.stroop-stage.is-correct {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.stroop-stage.is-wrong {
  border-style: dashed;
  border-color: var(--danger-line);
}

.stroop-cue {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.stroop-cue.is-word {
  border-color: var(--warm-line);
  background: var(--warm-soft);
  color: var(--warm);
}

.stroop-word {
  font-family: var(--font);
  font-size: clamp(56px, 11vw, 104px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.stroop-shape {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: currentColor;
}

.stroop-shape--circle {
  border-radius: 50%;
}

.stroop-shape--square {
  border-radius: 3px;
}

.stroop-shape--triangle {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.stroop-shape--diamond {
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.stroop-window {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 11px;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-muted);
}

.stroop-window i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
}

.stroop-options {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 640px) {
  .stroop-options {
    grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  }
}

.stroop-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-raised);
  font-size: 16px;
  transition: background-color 90ms ease, border-color 90ms ease, box-shadow 90ms ease;
}

.stroop-option:hover {
  border-color: var(--line-strong);
}

.stroop-option kbd {
  position: absolute;
  top: 5px;
  right: 9px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
}

@media (max-width: 639px) {
  .stroop-option kbd {
    display: none;
  }
}

.stroop-swatch {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 5px;
}

.stroop-option.is-answer {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.stroop-option.is-picked {
  border-style: dashed;
  border-color: var(--danger);
}

.practice-feedback {
  min-width: 140px;
  color: var(--ink-3);
  font-size: 12px;
  text-align: right;
}

.practice-feedback.is-ok {
  color: var(--accent);
}

.practice-feedback.is-bad {
  color: var(--danger);
}

.assist-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
}

.assist-line input {
  margin: 3px 0 0;
}

.assist-line strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}

.assist-line small {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 10px;
}

.cond-card {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.cond-head h2 {
  margin-top: 5px;
  font-size: 17px;
  font-weight: 500;
}

.cond-table {
  display: grid;
  gap: 2px;
  margin-top: 14px;
}

.cond-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 56px 72px 78px;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--ink-2);
}

.cond-row:first-child {
  border-top: 0;
}

.cond-name strong {
  font-weight: 500;
  color: var(--ink);
}

.cond-name small {
  margin-left: 8px;
  color: var(--ink-3);
  font-size: 10px;
}

.cond-n {
  color: var(--ink-3);
  font-family: var(--mono);
}

.cond-acc {
  font-family: var(--mono);
  color: var(--ink);
}

.cond-rt {
  font-family: var(--mono);
  color: var(--ink-2);
  text-align: right;
}

.cond-foot {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.6;
}

@media (max-width: 430px) {
  .stroop-zone {
    gap: 14px;
    padding: 4px 8px 12px;
  }

  .stroop-stage {
    min-height: 150px;
    padding: 16px 14px 24px;
  }

  .stroop-option {
    min-height: 52px;
    font-size: 14px;
  }

  .cond-row {
    grid-template-columns: minmax(0, 1.2fr) 46px 62px 68px;
    gap: 6px;
    font-size: 11px;
  }

  .cond-name small {
    display: none;
  }

  .cond-card {
    padding: 17px;
  }
}

/* n-back */
.nback-zone {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 0;
  padding: 8px 12px 16px;
}

.nback-stage {
  position: relative;
  width: min(720px, 100%);
  min-height: clamp(190px, 30vh, 280px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 20px 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.nback-cue {
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.nback-digit {
  font-family: var(--num);
  font-size: clamp(84px, 18vw, 150px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.nback-digit.is-blank {
  color: transparent;
}

.nback-bar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 11px;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-muted);
}

.nback-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
}

.nback-action {
  width: min(720px, 100%);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  transition: transform 90ms ease, border-color 120ms ease, background-color 120ms ease;
}

.nback-action > span {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.nback-action > small {
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.nback-action.is-armed {
  border-color: var(--accent-line);
}

.nback-action.is-pressed {
  transform: scale(0.985);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.nback-note {
  color: var(--ink-3);
  font-size: 11px;
}

@media (max-width: 430px) {
  .nback-zone {
    gap: 12px;
    padding: 4px 8px 12px;
  }

  .nback-stage {
    min-height: 170px;
    padding: 14px 14px 24px;
  }

  .nback-action {
    min-height: 76px;
  }

  .nback-action > span {
    font-size: 18px;
  }
}

/* Auditory selective attention */
.audio-zone {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 0;
  padding: 8px 12px 16px;
}

.audio-stage {
  position: relative;
  width: min(720px, 100%);
  min-height: clamp(190px, 30vh, 270px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 20px 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.audio-ear {
  padding: 4px 13px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.audio-target {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-3);
  font-size: 12px;
}

.audio-target strong {
  color: var(--ink);
  font-family: var(--num);
  font-size: 40px;
  font-weight: 500;
  line-height: 1;
}

.audio-switch {
  padding: 3px 11px;
  border: 1px solid var(--warm-line);
  border-radius: 999px;
  background: var(--warm-soft);
  color: var(--warm);
  font-size: 12px;
}

.audio-hint {
  color: var(--ink-3);
  font-size: 11px;
}

.audio-action {
  width: min(720px, 100%);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  transition: transform 90ms ease, border-color 120ms ease, background-color 120ms ease;
}

.audio-action > span {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.audio-action > small {
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.audio-action.is-armed {
  border-color: var(--accent-line);
}

.audio-action.is-pressed {
  transform: scale(0.985);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.audio-note {
  color: var(--ink-3);
  font-size: 11px;
}

@media (max-width: 430px) {
  .audio-zone {
    gap: 12px;
    padding: 4px 8px 12px;
  }

  .audio-stage {
    min-height: 170px;
    padding: 14px 14px 22px;
  }

  .audio-target strong {
    font-size: 34px;
  }

  .audio-action {
    min-height: 76px;
  }

  .audio-action > span {
    font-size: 18px;
  }
}

.channel-test {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 11px;
}

.channel-test-actions {
  display: flex;
  gap: 14px;
}

.channel-test .btn-link {
  font-size: 11px;
  color: var(--ink-2);
}

.channel-test .btn-link:hover {
  color: var(--ink);
}

/* Bilateral mirror */
.mirror-window-note {
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.6;
}

.mirror-window-note strong {
  color: var(--ink-2);
  font-weight: 500;
}

.mirror-zone {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 0;
  padding: 4px 12px 14px;
}

.mirror-stage {
  position: relative;
  width: min(760px, 100%);
  flex: 1 1 auto;
  min-height: 180px;
  max-height: min(60vh, 460px);
  display: flex;
  flex-direction: column;
  padding: 12px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mirror-stage-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 10px;
}

.mirror-beats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mirror-beats i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background-color 90ms ease, transform 90ms ease;
}

.mirror-beats i.is-on {
  background: var(--accent);
  transform: scale(1.5);
}

.mirror-beats i.is-on.is-bar {
  background: var(--accent-deep);
}

.mirror-next {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mirror-grid {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.mirror-lane {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(238, 236, 230, 0.12), rgba(238, 236, 230, 0.6));
  overflow: hidden;
}

.mirror-lane-label {
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  z-index: 3;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-align: center;
}

.mirror-lane[data-hand="left"] .mirror-lane-label {
  color: var(--accent);
}

.mirror-lane[data-hand="right"] .mirror-lane-label {
  color: var(--warm);
}

.mirror-track {
  position: absolute;
  top: 26px;
  left: 0;
  right: 0;
  bottom: 24px;
}

.mirror-note {
  position: absolute;
  left: 50%;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 90, 78, 0.1);
  will-change: top;
  transition: transform 90ms ease, opacity 120ms ease, background-color 120ms ease;
}

.mirror-lane[data-hand="right"] .mirror-note {
  background: var(--warm);
  box-shadow: 0 0 0 4px rgba(138, 106, 63, 0.12);
}

.mirror-note::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}

.mirror-note.is-near {
  transform: scale(1.14);
}

.mirror-note.is-miss {
  background: var(--line-strong);
  box-shadow: none;
  opacity: 0.5;
}

.mirror-note.is-miss::after {
  background: transparent;
}

.mirror-note.is-hit {
  animation: mirror-note-hit 180ms ease-out forwards;
}

@keyframes mirror-note-hit {
  from {
    opacity: 1;
    transform: scale(1.15);
  }

  to {
    opacity: 0;
    transform: scale(1.9);
  }
}

.mirror-axis {
  position: absolute;
  top: 0;
  bottom: 24px;
  left: 50%;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--line-strong) 18%, var(--line-strong) 82%, transparent);
  opacity: 0.45;
  pointer-events: none;
}

.mirror-hitline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  z-index: 3;
  height: 2px;
  border-radius: 2px;
  background: var(--line-strong);
  pointer-events: none;
}

.mirror-hitline::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 4px;
  background: var(--accent);
  opacity: 0;
}

.mirror-hitline.is-pulse::before {
  animation: mirror-hitline-pulse 150ms ease-out;
}

@keyframes mirror-hitline-pulse {
  0% {
    opacity: 0.32;
  }

  100% {
    opacity: 0;
  }
}

.mirror-judge {
  position: absolute;
  left: 50%;
  bottom: 30px;
  z-index: 4;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 110ms ease;
  pointer-events: none;
}

.mirror-judge.is-on {
  opacity: 1;
}

.mirror-judge.is-good {
  color: var(--accent-deep);
}

.mirror-judge.is-bad {
  color: var(--danger);
}

.mirror-judge.is-soft {
  color: var(--warm);
}

.mirror-pads {
  width: min(760px, 100%);
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mirror-pad {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 80ms ease, background-color 100ms ease, border-color 100ms ease, box-shadow 100ms ease;
}

.mirror-pad[data-hand="left"] {
  border-bottom: 3px solid var(--accent-line);
}

.mirror-pad[data-hand="right"] {
  border-bottom: 3px solid var(--warm-line);
}

.mirror-pad.is-down {
  transform: scale(0.985);
}

.mirror-pad[data-hand="left"].is-down {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.mirror-pad[data-hand="right"].is-down {
  background: var(--warm-soft);
  border-color: var(--warm);
}

.mirror-pad.is-good {
  box-shadow: inset 0 0 0 2px var(--accent-line);
}

.mirror-pad.is-bad {
  box-shadow: inset 0 0 0 2px var(--danger-line);
}

.mirror-pad-hand {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.mirror-pad-key {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

@media (max-width: 560px) {
  .mirror-zone {
    gap: 10px;
    padding: 2px 8px 10px;
  }

  .mirror-stage {
    padding: 10px 10px 10px;
    border-radius: 18px;
  }

  .mirror-grid {
    gap: 0 8px;
  }

  .mirror-note {
    width: 20px;
    height: 20px;
    margin-left: -10px;
    margin-top: -10px;
  }

  .mirror-note::after {
    inset: 7px;
  }

  .mirror-pad {
    min-height: 80px;
    border-radius: 16px;
  }

  .mirror-pad-hand {
    font-size: 17px;
  }

  .mirror-judge {
    bottom: 28px;
    font-size: 10px;
  }

  .mirror-next {
    font-size: 10px;
  }
}

@media (max-height: 620px) {
  .mirror-stage {
    max-height: none;
  }

  .mirror-pad {
    min-height: 70px;
  }

  .mirror-pad-hand {
    font-size: 17px;
  }
}

.mirror-lane::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  z-index: 1;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(251, 250, 247, 0.55);
  pointer-events: none;
}

.mirror-hitline {
  background: linear-gradient(90deg, var(--line-strong), var(--ink-3) 50%, var(--line-strong));
}

#practice-layer .btn {
  width: 100%;
}

#practice-layer .btn-link {
  display: block;
  width: fit-content;
  margin: 12px auto 0;
  color: var(--ink-3);
  font-size: 12px;
}

#practice-layer .btn-link:hover {
  color: var(--ink);
}

/* Rule-based sorting */
.sort-zone {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 4px 12px 14px;
}

.sort-stage {
  position: relative;
  width: min(760px, 100%);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sort-stage-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
  gap: 10px;
  padding: 0 2px;
}

.sort-trial {
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.sort-change {
  padding: 3px 10px;
  border: 1px solid var(--warm-line);
  border-radius: 999px;
  background: var(--warm-soft);
  color: var(--warm);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.sort-keys {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.sort-key {
  position: relative;
  min-height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  touch-action: manipulation;
  transition: transform 90ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .sort-key:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
  }
}

.sort-key.is-picked {
  transform: scale(0.985);
}

.sort-key.is-correct {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-line);
}

.sort-key.is-wrong {
  border-color: var(--danger-line);
  border-style: dashed;
}

.sort-key.is-answer {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-line);
}

.sort-key-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.sort-key-num {
  position: absolute;
  right: 9px;
  bottom: 5px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.sort-face {
  display: grid;
  justify-content: center;
  align-content: center;
  gap: 5px;
  color: var(--shape-color, var(--ink));
}

.sort-face[data-count="1"] {
  grid-template-columns: 1fr;
  --shape-size: 30px;
}

.sort-face[data-count="2"] {
  grid-template-columns: repeat(2, auto);
  --shape-size: 24px;
}

.sort-face[data-count="3"] {
  grid-template-columns: repeat(3, auto);
  --shape-size: 18px;
}

.sort-face[data-count="4"] {
  grid-template-columns: repeat(2, auto);
  --shape-size: 22px;
}

.sort-key .sort-face[data-count="1"] {
  --shape-size: 40px;
}

.sort-key .sort-face[data-count="2"] {
  --shape-size: 27px;
}

.sort-key .sort-face[data-count="3"] {
  --shape-size: 19px;
}

.sort-key .sort-face[data-count="4"] {
  --shape-size: 23px;
}

.sort-target .sort-face[data-count="1"] {
  --shape-size: 58px;
}

.sort-target .sort-face[data-count="2"] {
  --shape-size: 42px;
}

.sort-target .sort-face[data-count="3"] {
  --shape-size: 32px;
}

.sort-target .sort-face[data-count="4"] {
  --shape-size: 36px;
}

.sort-shape {
  display: block;
  width: var(--shape-size);
  height: var(--shape-size);
  background: currentColor;
}

.sort-shape--circle {
  border-radius: 50%;
}

.sort-shape--square {
  border-radius: 2px;
}

.sort-shape--triangle {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.sort-shape--cross {
  clip-path: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%);
}

.sort-shape--star {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.sort-draw {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.sort-target-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.sort-target-label {
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.sort-target {
  display: flex;
}

.sort-target-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 190px;
  height: 132px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.sort-feedback {
  min-height: 24px;
  max-width: 300px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.6;
}

.sort-feedback.is-ok {
  color: var(--accent-deep);
}

.sort-feedback.is-bad {
  color: var(--danger);
}

@media (max-width: 560px) {
  .sort-zone {
    padding: 2px 8px 10px;
  }

  .sort-stage {
    gap: 8px;
    padding: 10px;
    border-radius: 18px;
  }

  .sort-keys {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .sort-key {
    min-height: 88px;
    padding: 6px;
    border-radius: 14px;
  }

  .sort-key .sort-face[data-count="1"] {
    --shape-size: 30px;
  }

  .sort-key .sort-face[data-count="2"] {
    --shape-size: 22px;
  }

  .sort-key .sort-face[data-count="3"] {
    --shape-size: 15px;
  }

  .sort-key .sort-face[data-count="4"] {
    --shape-size: 18px;
  }

  .sort-draw {
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
  }

  .sort-target-card {
    width: 150px;
    height: 104px;
  }

  .sort-target .sort-face[data-count="1"] {
    --shape-size: 46px;
  }

  .sort-target .sort-face[data-count="2"] {
    --shape-size: 32px;
  }

  .sort-target .sort-face[data-count="3"] {
    --shape-size: 25px;
  }

  .sort-target .sort-face[data-count="4"] {
    --shape-size: 28px;
  }

  .sort-feedback {
    min-height: 20px;
    max-width: 100%;
    font-size: 11px;
    text-align: center;
  }
}

/* Episodic associative memory */
.epi-zone {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 4px 12px 14px;
}

.epi-stage {
  width: min(760px, 100%);
  flex: 0 0 auto;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.epi-phase {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.epi-phase.is-active {
  display: flex;
}

.epi-eyebrow {
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-align: center;
}

.epi-scene {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.epi-scene.is-in {
  animation: epi-scene-in 240ms ease-out;
}

@keyframes epi-scene-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

.epi-token {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 78px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.epi-token[data-kind="place"] {
  border-left-color: var(--accent-line);
}

.epi-token[data-kind="person"] {
  border-left-color: var(--warm-line);
}

.epi-token-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--ink-3);
}

.epi-token[data-kind="place"] .epi-token-icon {
  color: var(--accent);
}

.epi-token[data-kind="person"] .epi-token-icon {
  color: var(--warm);
}

.epi-token-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.epi-token-copy small {
  display: block;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.epi-token-copy strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.epi-sentence {
  max-width: 620px;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1.7;
  text-align: center;
}

.epi-phase-foot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.epi-math {
  font-family: var(--num);
  font-size: clamp(34px, 6vw, 48px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.epi-math-actions {
  display: flex;
  gap: 12px;
}

.epi-math-btn {
  min-width: 124px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  transition: transform 80ms ease, border-color 120ms ease, background-color 120ms ease;
}

.epi-math-btn > strong {
  font-size: 18px;
  font-weight: 500;
}

.epi-math-btn > small {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
}

.epi-math-btn:hover {
  border-color: var(--accent-line);
}

.epi-math-btn:active {
  transform: scale(0.985);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.epi-mark {
  min-height: 22px;
  color: var(--ink-3);
  font-size: 13px;
}

.epi-mark.is-ok {
  color: var(--accent-deep);
}

.epi-mark.is-bad {
  color: var(--danger);
}

.epi-delay-track,
.epi-probe-track {
  width: min(420px, 100%);
  height: 3px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.epi-delay-track i,
.epi-probe-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
}

.epi-footnote {
  color: var(--ink-3);
  font-size: 11px;
}

.epi-given {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.epi-given .epi-token {
  min-height: 0;
  padding: 8px 12px;
  border-left-width: 2px;
  box-shadow: none;
}

.epi-given .epi-token-icon {
  width: 18px;
  height: 18px;
}

.epi-given .epi-token-copy strong {
  font-size: 15px;
}

.epi-question {
  max-width: 580px;
  font-size: 19px;
  line-height: 1.6;
  text-align: center;
}

.epi-options {
  width: 100%;
  max-width: 560px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.epi-option {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-raised);
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease, transform 80ms ease;
}

.epi-option:hover {
  border-color: var(--accent-line);
}

.epi-option:active {
  transform: scale(0.99);
}

.epi-option-copy small {
  display: block;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.epi-option-copy strong {
  display: block;
  margin-top: 1px;
  font-size: 17px;
  font-weight: 500;
}

.epi-option-key {
  flex: 0 0 auto;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
}

.epi-option.is-correct {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-line);
}

.epi-option.is-wrong {
  border-color: var(--danger-line);
  border-style: dashed;
}

.epi-option.is-dim {
  opacity: 0.45;
}

.epi-option:disabled {
  cursor: default;
}

.epi-feedback {
  min-height: 22px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.epi-feedback.is-ok {
  color: var(--accent-deep);
}

.epi-feedback.is-bad {
  color: var(--danger);
}

.epi-break-title {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 500;
  letter-spacing: -0.02em;
  text-align: center;
}

.epi-break-sub {
  color: var(--ink-2);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 560px) {
  .epi-zone {
    padding: 2px 8px 10px;
  }

  .epi-stage {
    min-height: 420px;
    padding: 18px 16px;
    border-radius: 18px;
  }

  .epi-phase {
    gap: 14px;
  }

  .epi-scene {
    gap: 8px;
  }

  .epi-token {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 92px;
    padding: 10px 11px;
  }

  .epi-token-copy strong {
    font-size: 16px;
  }

  .epi-sentence {
    font-size: 16px;
  }

  .epi-given .epi-token {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 0;
    padding: 7px 10px;
  }

  .epi-question {
    font-size: 17px;
  }

  .epi-options {
    gap: 8px;
  }

  .epi-option {
    min-height: 58px;
    padding: 8px 12px;
  }

  .epi-option-copy strong {
    font-size: 15px;
  }

  .epi-math-btn {
    min-width: 108px;
    min-height: 54px;
  }

  .epi-footnote {
    font-size: 10px;
  }
}

.epi-options .epi-option:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc(50% - 5px);
}

@media (max-width: 560px) {
  .epi-options .epi-option:last-child:nth-child(odd) {
    width: calc(50% - 4px);
  }
}

/* Media bar and video modal */
.media-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

.media-bar .btn-link {
  min-height: 30px;
  color: var(--ink-2);
  font-size: 12px;
  text-decoration-color: var(--line-strong);
  touch-action: manipulation;
}

.media-bar .btn-link:hover,
.media-bar .btn-link[aria-pressed="true"] {
  color: var(--accent-deep);
  text-decoration-color: var(--accent-line);
}

.media-bar > span[aria-hidden="true"] {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1;
  user-select: none;
}

.media-error {
  color: var(--danger);
  font-size: 11px;
  line-height: 1.5;
}

.media-modal-layer {
  z-index: 100;
  padding: 16px;
}

.media-modal {
  width: min(820px, calc(100vw - 32px));
  max-width: none;
  padding: 18px;
}

.media-modal .modal-head {
  padding: 2px 2px 12px;
}

.media-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  background: #000;
  object-fit: contain;
}

.media-caption {
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .media-bar {
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .media-modal-layer {
    padding: 12px;
  }

  .media-modal {
    width: calc(100vw - 24px);
    padding: 14px;
  }

  .media-video {
    aspect-ratio: 16 / 10;
  }
}
