:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  color: #27251f;
  background: #f8f7ef;
  --ink: #27251f;
  --paper: #fffcf4;
  --lime: #e5ed91;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button, select { touch-action: manipulation; }
button:not(:disabled), select { cursor: pointer; }
:focus-visible { outline: 3px solid #5546a3; outline-offset: 4px; }

.site-header {
  background: #fffdf5;
  border-bottom: 1px solid #dedbd0;
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 62px;
  max-width: 1300px;
  padding-inline: clamp(14px, 4vw, 48px);
  margin-inline: auto;
}

.logo, .app-name {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: #22231f;
  white-space: nowrap;
}

.logo {
  gap: 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.055em;
}

.logo-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: #e7ed98;
  background: #22231f;
}

.logo-mark svg { width: 23px; height: 23px; }

.app-name {
  padding-left: 15px;
  border-left: 1px solid #d8d4c9;
  min-height: 28px;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.3;
}

.audio-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-left: auto;
  min-height: 36px;
  padding: 3px 12px;
  background: transparent;
  border: 1px solid #d4d0c3;
  border-radius: 8px;
  white-space: nowrap;
  font-size: .82rem;
  font-weight: 650;
}

.audio-symbol { font-size: 1.1rem; line-height: 1; }
.audio-toggle[aria-pressed="false"] { background: #eeece4; }

main { padding: clamp(15px, 4vh, 36px) clamp(14px, 4vw, 48px) 24px; }
.screen { margin-inline: auto; max-width: 1100px; }

.setup {
  min-height: min(570px, calc(100svh - 118px));
  display: grid;
  grid-template-columns: 1fr minmax(335px, .88fr);
  align-items: center;
  gap: clamp(22px, 5vw, 80px);
}

.setup-copy h1 {
  font-size: clamp(2.45rem, 6.5vw, 5.25rem);
  font-weight: 780;
  letter-spacing: -.075em;
  line-height: 1.04;
  margin: 0;
}

.setup-copy p {
  color: #58524a;
  font-size: clamp(.95rem, 1.7vw, 1.1rem);
  line-height: 1.75;
  margin: 21px 0 0;
}

.settings {
  display: grid;
  gap: 19px;
  padding: clamp(17px, 3vw, 29px);
  margin: 0;
  background: var(--paper);
  border: 1px solid #d4d0c3;
  border-radius: 20px;
  box-shadow: 0 6px 0 #e8e4d8;
}

.selects {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 12px;
}

.selects label { display: grid; gap: 7px; min-width: 0; }
.selects label, legend { font-size: .88rem; font-weight: 650; }

select {
  width: 100%;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid #c5c0b0;
  border-radius: 8px;
  background: #fffefa;
  font-size: 1rem;
}

fieldset { padding: 0; border: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.durations { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.durations label { position: relative; cursor: pointer; }

.durations input, .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.durations span {
  display: grid;
  place-items: center;
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid #c5c0b0;
  background: #fffefa;
  font-weight: 650;
}

.durations input:checked + span { background: #efedff; border: 2px solid #625995; }
.durations input:focus-visible + span { outline: 3px solid #5546a3; outline-offset: 3px; }
#load-status { margin: 0; color: #6f3040; font-size: .86rem; line-height: 1.5; }

.raised {
  --face: var(--lime);
  --side: #a4aa61;
  --depth: 6px;
  border: 1.5px solid var(--ink);
  border-radius: 13px;
  box-shadow: 0 var(--depth) 0 var(--side), 0 calc(var(--depth) + 1.5px) 0 var(--ink);
  color: var(--ink);
  background: var(--face);
  font-weight: 700;
  transition: transform .08s ease-out, box-shadow .08s ease-out;
}

.raised:not(:disabled):active {
  transform: translateY(calc(var(--depth) - 1px));
  box-shadow: 0 1px 0 var(--side), 0 2.5px 0 var(--ink);
}

.primary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 61px;
  width: 100%;
  padding: 10px 16px;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
}

.primary span:last-child { font-size: 1.55em; line-height: .9; }

.play {
  display: grid;
  gap: clamp(11px, 2.9vh, 23px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: clamp(440px, calc(100svh - 133px), 660px);
  max-width: 1100px;
}

.scorebar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  gap: 6px;
}

.score {
  display: flex;
  align-items: baseline;
  gap: .3em;
  font-size: clamp(.8rem, 2.4vw, 1rem);
  font-weight: 650;
  white-space: nowrap;
}

.score strong { font-size: clamp(1.65rem, 4vw, 2.55rem); line-height: 1; }
.clock {
  width: max-content;
  justify-self: center;
  padding: 4px 14px;
  border-radius: 9px;
  background: #282520;
  color: #fffdf5;
  font-size: clamp(1.6rem, 4.7vw, 2.55rem);
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  line-height: 1.08;
}

.clock.last-seconds { background: #9c292c; }

.text-button {
  width: max-content;
  min-height: 40px;
  padding: 4px 1px;
  border: 0;
  color: #5a5248;
  background: transparent;
  font-size: .9rem;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: .2em;
}

.scorebar .text-button { justify-self: end; }

.prompt-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(5px, 2vh, 16px);
  min-height: 140px;
  padding: clamp(14px, 3vw, 36px);
  border: 1.5px solid #aaa0c7;
  border-radius: 24px;
  color: #302646;
  background: #efebfb;
  text-align: center;
  overflow-wrap: anywhere;
}

.prompt-label { font-size: clamp(.88rem, 2vw, 1.12rem); font-weight: 680; }
.prompt-card h1 {
  margin: 0;
  font-size: clamp(1.8rem, min(7.8vw, 11vh), 5rem);
  line-height: 1.16;
  letter-spacing: -.045em;
  font-weight: 760;
  text-wrap: balance;
}

.judges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(7px, 2vw, 22px);
  margin-bottom: 8px;
}

.judge {
  --depth: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .35em;
  min-height: clamp(64px, 14vh, 116px);
  padding: 6px 2px;
  white-space: nowrap;
  font-size: clamp(1rem, 3.3vw, 2rem);
}

.judge-icon { font-size: 1.28em; line-height: .9; }
.correct { --face: #ddeb9e; --side: #9aa75a; }
.incorrect { --face: #ffd9d1; --side: #d18f85; }
.pass { --face: #f4e0a4; --side: #bda160; }
.pass-count { font-size: .55em; font-weight: 650; }
.pass:disabled { --face: #e9e6dd; --side: #c6c1b5; color: #625e55; }

.result {
  min-height: min(530px, calc(100svh - 110px));
  display: grid;
  place-items: center;
}

.result-card {
  width: min(100%, 620px);
  padding: clamp(20px, 5vw, 50px);
  border: 1.5px solid #aaa0c7;
  border-radius: 24px;
  background: #efebfb;
  text-align: center;
}

.result-card h1 { font-size: clamp(2.1rem, 5vw, 3.55rem); margin: 0; line-height: 1.11; }
.result-score {
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: baseline;
  font-size: clamp(1.15rem, 3vw, 1.65rem);
  font-weight: 700;
  margin: 11px 0;
}

.result-score strong { font-size: clamp(4.75rem, 13vw, 8rem); line-height: .96; font-weight: 760; }
.result-details { margin: 10px 0 23px; color: #58524a; font-size: .9rem; }
.result-details [aria-hidden] { margin-inline: 3px; }
.result-actions { display: grid; justify-items: center; gap: 12px; width: min(100%, 330px); margin: auto; }

@media (max-width: 675px) {
  .site-header-inner { gap: 9px; min-height: 54px; }
  .logo { font-size: 21px; gap: 5px; }
  .logo-mark { width: 30px; height: 30px; }
  .logo-mark svg { width: 21px; height: 21px; }
  .app-name { font-size: 14px; min-height: 26px; padding-left: 9px; }
  .audio-toggle { padding-inline: 7px; gap: 3px; }
  .setup { grid-template-columns: 1fr; gap: 20px; max-width: 485px; min-height: 0; }
  .setup-copy h1 { font-size: clamp(1.9rem, 8vw, 3.4rem); }
  .setup-copy h1 br, .desktop-break { display: none; }
  .setup-copy p { margin-top: 7px; }
  .play { min-height: min(560px, max(365px, calc(100svh - 112px))); }
  .judges .judge { flex-direction: column; gap: 4px; }
}

@media (max-width: 355px) {
  .site-header-inner { padding-inline: 8px; gap: 6px; }
  .logo { font-size: 19px; }
  .app-name { padding-left: 6px; }
  .audio-symbol { display: none; }
  .selects { grid-template-columns: 1fr; }
}

@media (orientation: landscape) and (max-height: 550px) {
  .site-header-inner { min-height: 49px; }
  main { padding-top: 9px; padding-bottom: 10px; }
  .play { min-height: max(255px, calc(100svh - 72px)); gap: 9px; }
  .judge { min-height: 60px; }
  .prompt-card { min-height: 90px; padding: 9px; }
  .setup { min-height: 0; }
  .settings { gap: 11px; padding: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .raised { transition: none; }
}
