:root {
  color-scheme: light;
  --paper: #f7f5ed;
  --ink: #20221e;
  --muted: #54574e;
  --lime: #e3f65a;
  --lilac: #e3dfff;
  --white: #fffefa;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 280px; margin: 0; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #5343cc; outline-offset: 4px; }
a { color: inherit; text-underline-offset: .2em; }
a:focus-visible { outline: 3px solid #5343cc; outline-offset: 4px; border-radius: 3px; }
h1, h2, h3, p { margin: 0; }

.shell { width: min(100% - 64px, 1040px); margin-inline: auto; }
.site-header { border-bottom: 1px solid #d9d8ce; }
.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1rem; font-weight: 820; letter-spacing: -.025em; line-height: 1.1; }
.brand-mark { flex: 0 0 34px; height: 34px; border: 1.5px solid var(--ink); border-radius: 9px; background: var(--lime); display: flex; align-items: center; justify-content: center; gap: 2px; }
.brand-mark i { width: 2px; height: 7px; border-radius: 2px; background: var(--ink); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 13px; }
.brand-mark i:nth-child(3) { height: 19px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.help-button, .reset-button, .language-picker select {
  min-height: 44px; display: inline-flex; white-space: nowrap; align-items: center; gap: 7px;
  padding: 7px 12px; border: 1px solid #d2d2c7; border-radius: 9px;
  background: transparent; font-size: .875rem; font-weight: 720;
}
.help-button:hover, .reset-button:enabled:hover, .language-picker select:hover { border-color: var(--ink); background: var(--white); }
.help-icon { width: 17px; height: 17px; border: 1.5px solid currentColor; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; line-height: 1; }
.language-picker { position: relative; }
.language-picker select { appearance: none; display: block; min-width: 105px; padding-inline-end: 30px; font-size: 1rem; font-family: inherit; color: var(--ink); cursor: pointer; }
.language-picker select:focus-visible { outline: 3px solid #5343cc; outline-offset: 4px; }
.language-picker::after {
  content: ""; position: absolute; inset-inline-end: 12px; top: calc(50% - 5px);
  width: 8px; height: 8px; border: solid var(--ink); border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg); pointer-events: none;
}

.hero { display: grid; grid-template-columns: 1.13fr 1fr; align-items: center; gap: clamp(24px, 5vw, 68px); padding-block: 47px 41px; }
.hero h1 {
  font-size: clamp(3.4rem, 7.45vw, 6.2rem); font-weight: 880; line-height: .91;
  letter-spacing: -.085em;
}
.hero-accent { background: linear-gradient(to bottom, transparent 70%, var(--lime) 70%, var(--lime) 89%, transparent 89%); padding-inline-end: .07em; }
:is(:lang(ja), :lang(ko)) .hero h1 { letter-spacing: -.055em; font-size: clamp(2.85rem, 6.3vw, 5.25rem); line-height: 1.08; }
.hero-copy p { margin-top: 24px; font-size: clamp(1rem, 2vw, 1.25rem); font-weight: 550; line-height: 1.45; }
.game-resources { margin-top: 12px; }
.game-resources a { text-underline-offset: .23em; }

.deck {
  background: radial-gradient(#25221e29 1px, transparent 1.25px) 2px 2px / 14px 14px, var(--lilac);
  border: 1.5px solid var(--ink); border-radius: 22px; box-shadow: 4px 4px 0 var(--ink);
  padding: 23px 16px 14px; min-width: 0; display: grid; justify-items: center; gap: 15px;
}
.cassette {
  width: min(100%, 276px); padding: 12px 13px 0; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--white); box-shadow: 4px 5px 0 #26222a; transform: rotate(-5deg);
}
.tape-label { display: flex; justify-content: space-between; gap: 5px; padding: 0 2px 8px; font-family: ui-monospace, monospace; font-size: .875rem; letter-spacing: .025em; font-weight: 800; text-transform: uppercase; }
.tape-time { font-variant-numeric: tabular-nums; }
.tape-window {
  display: grid; grid-template-columns: 27px minmax(0, 1fr) 27px; gap: 7px; align-items: center;
  border: 2px solid var(--ink); border-radius: 7px; min-height: 48px; padding: 0 8px;
  background: #262621; color: var(--lime);
}
.reel {
  height: 24px; width: 24px; margin-inline: auto; border: 3px solid #dddccb; border-radius: 50%;
  background: conic-gradient(#dddccb 0 13deg, transparent 13deg 120deg, #dddccb 120deg 133deg, transparent 133deg 240deg, #dddccb 240deg 253deg, transparent 253deg);
}
.tape-window canvas { display: block; width: 100%; height: 38px; }
.tape-bottom {
  display: flex; justify-content: space-between; align-items: center; width: 61%; min-height: 20px;
  margin: 9px auto 0; padding: 4px 16px 0;
  background: #e5e2d4; clip-path: polygon(10% 0, 90% 0, 100% 100%, 0 100%);
}
.tape-bottom i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.deck-status {
  display: flex; gap: 7px; align-items: center; min-height: 30px; padding: 5px 10px;
  border: 1px solid #aaa3d6; border-radius: 99px; background: #f6f4ff;
  font-size: .875rem; font-weight: 730; line-height: 1.2;
}
.deck-status > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: #6555be; flex: none; }
.deck[data-mode="recording"] .deck-status > span:first-child { background: #ad291f; animation: blink 1.7s ease-in-out infinite; }
.deck[data-mode="playing"] .reel { animation: spin 2s linear infinite; }
.deck[data-reversed="true"] .reel { animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .35; } }

.console { border: 1.5px solid var(--ink); border-radius: 22px; background: var(--white); box-shadow: 4px 4px 0 var(--ink); padding: 22px; }
.console-header { display: flex; align-items: center; justify-content: space-between; gap: 13px; margin-bottom: 15px; }
.console-header h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); font-weight: 850; line-height: 1.08; letter-spacing: -.055em; }
.reset-button:disabled { color: #6a6c60; border-color: #e3e2d8; }
.reset-button > span:first-child { font-size: 1.15rem; line-height: 1; }

.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; min-width: 0; }
.step {
  display: flex; align-items: center; gap: 13px; text-align: left; width: 100%; min-height: 105px;
  border: 1px solid #b8b8ad; border-radius: 13px; padding: 13px; background: var(--white);
}
.step:enabled:hover { border-color: var(--ink); background: #f0edff; }
.step:disabled { border-color: #dbdbd0; background: #f4f4ee; }
.step.is-next { background: var(--lime); border-color: var(--ink); box-shadow: inset 0 -2px 0 #1d211f20; }
.step.is-next:enabled:hover { background: #edfa87; }
.step.is-recording { background: #ffdfd9; border-color: #9b2c23; }
.step.is-recording:enabled:hover { background: #ffd2ca; border-color: #9b2c23; }
.step.is-playing { background: var(--lilac); border-color: var(--ink); }
.step-copy { display: grid; gap: 2px; }
.step-meta {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; text-transform: uppercase;
  font-size: .875rem; letter-spacing: .035em; font-weight: 650; line-height: 1.3; color: #494d3f;
}
.step-meta > span[aria-hidden] { padding-inline: 2px; }
.step-title { font-size: clamp(1.05rem, 2.2vw, 1.25rem); font-weight: 820; line-height: 1.16; letter-spacing: -.028em; }
.step-hint { color: var(--muted); font-size: .875rem; line-height: 1.3; }
.step-icon {
  width: 40px; height: 40px; flex: 0 0 40px; border: 1px solid var(--ink); border-radius: 9px;
  display: grid; place-items: center; background: var(--white); color: var(--ink);
}
.step:disabled .step-icon { border-color: #c9c9bd; background: #eeeee6; color: #626457; }
.step-icon::before { content: ""; display: block; background: currentColor; }
.record-icon::before { border-radius: 50%; width: 13px; height: 13px; }
.reverse-icon::before {
  width: 17px; height: 13px;
  clip-path: polygon(0 50%, 48% 0, 48% 44%, 100% 0, 100% 100%, 48% 56%, 48% 100%);
}
.stop-icon::before { border-radius: 2px; width: 12px; height: 12px; }

.error-message { margin-bottom: 11px; color: #7e221a; background: #fff0ec; border: 1px solid #eab6ad; padding: 12px; border-radius: 9px; line-height: 1.4; }
.reveal {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-top: 13px; padding: 14px; border: 1px solid #b4a8e3; border-radius: 13px; background: #efebff;
}
.reveal h3 { font-size: 1.12rem; line-height: 1.25; font-weight: 840; letter-spacing: -.025em; }
.reveal p { color: #494653; font-size: .9rem; line-height: 1.4; margin-top: 4px; }
.reveal-button {
  min-height: 44px; background: var(--ink); color: var(--white); border: 1px solid var(--ink); border-radius: 9px;
  padding: 9px 14px; font-size: .925rem; font-weight: 740;
}
.reveal-button:enabled:hover { background: #45483d; }
.reveal-button:disabled { opacity: .65; }

.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding: 16px 0 24px; margin-top: 14px; border-top: 1px solid #d9d8ce; }
.footer { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .875rem; line-height: 1.35; }
.site-links, .page-languages { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 14px; font-size: .875rem; font-weight: 720; }
.site-links a, .page-languages a { display: inline-flex; align-items: center; min-height: 36px; }
.site-links a[aria-current="page"], .page-languages a[aria-current="page"] { text-decoration-thickness: 2px; }
.lock { flex: 0 0 13px; height: 10px; border: 1.5px solid currentColor; border-radius: 2px; position: relative; }
.lock::before { content: ""; position: absolute; left: 1.5px; right: 1.5px; bottom: 7px; height: 7px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 6px 6px 0 0; }

dialog { width: min(100% - 32px, 510px); padding: 0; border: 1.5px solid var(--ink); border-radius: 18px; background: var(--white); color: var(--ink); box-shadow: 5px 5px 0 var(--ink); }
dialog::backdrop { background: #22222185; }
.rules { padding: 23px; line-height: 1.45; }
.rules h2 { line-height: 1.13; letter-spacing: -.045em; }
.rules ol { padding-left: 23px; }
.rules li + li { margin-top: 8px; }
.rules p { color: var(--muted); margin-bottom: 14px; }
.rules-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; font-weight: 720; }
.rules-actions a { display: inline-flex; align-items: center; min-height: 44px; }

.brand-link { text-decoration: none; }
.info-header { padding-block: 8px; }
.info-page { padding-top: clamp(26px, 5vw, 54px); }
.info-page article { display: grid; justify-items: start; gap: clamp(28px, 5vw, 49px); margin-bottom: 36px; }
.info-hero { width: 100%; display: grid; gap: 16px; padding: clamp(20px, 5vw, 44px); border: 1.5px solid var(--ink); border-radius: 22px; background: var(--lilac); box-shadow: 4px 4px 0 var(--ink); }
.info-hero h1 { font-size: clamp(2.05rem, 6vw, 4.3rem); line-height: 1.04; letter-spacing: -.055em; }
.info-hero p, .info-section p, .guide-steps p, .example-card p { max-width: 67ch; line-height: 1.6; }
.info-hero > a { justify-self: start; }
.button-link { display: inline-flex; align-items: center; text-decoration: none; }
.info-section { width: min(100%, 810px); display: grid; gap: 12px; }
.info-section h2 { font-size: clamp(1.45rem, 3vw, 2.1rem); line-height: 1.17; letter-spacing: -.04em; }
.info-section h3 { font-size: 1.1rem; line-height: 1.35; }
.guide-steps { display: grid; gap: 16px; margin: 0; padding-inline-start: 1.65rem; }
.guide-steps li { padding-inline-start: .22rem; }
.guide-steps li::marker { font-weight: 850; }
.guide-steps p, .info-section h3 + p { margin-top: 3px; }
.example-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.example-card { padding: 16px; border: 1px solid var(--ink); border-radius: 12px; background: var(--white); }
.example-card:nth-child(2) { background: #f3f0ff; }
.example-card:nth-child(3) { background: #f2f7cc; }
.example-card p { margin-top: 7px; font-size: .925rem; color: var(--muted); }
.phrase-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0; padding: 0; list-style: none; }
.phrase-list li { padding: 12px 14px; border: 1px solid #c9c7bc; border-radius: 9px; background: var(--white); font-weight: 680; line-height: 1.4; }
.voice-sample { margin: 0; padding: 18px; border: 1px solid var(--ink); border-radius: 12px; background: var(--white); }
.voice-sample figcaption { margin-bottom: 12px; font-size: 1.12rem; font-weight: 820; }
.voice-sample figcaption small { display: block; margin-top: 3px; color: var(--muted); font-size: .81rem; font-weight: 600; }
.audio-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.audio-pair span { display: block; margin-bottom: 5px; font-size: .875rem; font-weight: 720; }
.audio-pair audio { display: block; width: 100%; }
.info-footer { align-items: flex-start; }

@media (max-width: 740px) {
  .shell { width: calc(100% - 38px); }
  .hero { gap: 24px; padding-block: 32px; }
  .hero h1 { font-size: clamp(3.15rem, 8.4vw, 4.45rem); }
  .console { padding: 17px; }
  .step { padding: 10px; gap: 9px; }
  .step-icon { width: 35px; height: 35px; flex-basis: 35px; }
}
@media (max-width: 560px) {
  .header-inner { min-height: 60px; }
  .language-picker select { min-width: 93px; padding-inline-start: 9px; }
  .help-button { width: 44px; justify-content: center; padding-inline: 0; }
  .help-label { display: none; }
  .hero { grid-template-columns: 1fr; gap: 21px; padding-block: 25px 23px; }
  .hero h1 { font-size: clamp(3.1rem, 12vw, 4.75rem); }
  .hero-copy p { margin-top: 12px; }
  .deck { grid-template-columns: minmax(0, 1fr) minmax(95px, .9fr); gap: 9px; padding: 12px 9px; border-radius: 15px; align-items: center; }
  .cassette { padding: 6px 6px 0; transform: rotate(-3deg); box-shadow: 2px 3px 0 var(--ink); border-width: 1.5px; }
  .tape-label { padding-bottom: 4px; font-size: .75rem; }
  .tape-window { grid-template-columns: 14px minmax(0, 1fr) 14px; min-height: 24px; gap: 3px; padding: 0 4px; }
  .tape-window canvas { height: 20px; }
  .reel { width: 12px; height: 12px; border-width: 1.5px; }
  .tape-bottom { min-height: 8px; margin-top: 4px; padding: 1px 7px 0; }
  .tape-bottom i { width: 3px; height: 3px; }
  .deck-status { padding: 4px 7px; overflow-wrap: anywhere; }
  .console { padding: 12px; border-radius: 16px; }
  .console-header { margin-bottom: 8px; }
  .steps { grid-template-columns: 1fr; gap: 8px; }
  .step { min-height: 77px; }
  .footer { justify-content: flex-start; padding-inline: 4px; }
  .info-header { flex-wrap: wrap; gap: 5px 13px; }
  .example-grid, .audio-pair, .phrase-list { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .brand { gap: 7px; }
  .brand-name { font-size: .875rem; }
  .header-actions { gap: 6px; }
  :lang(de) .hero h1 { font-size: clamp(2.45rem, 11.7vw, 3.1rem); }
  .reset-button { white-space: normal; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
