:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #fff3e1;
  background: #141112;
  --game-muted: #e5cbb6;
  --game-gold: #ffce78;
  --game-line: #644633;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--game-gold); text-underline-offset: .18em; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
:focus-visible { outline: .2rem solid #ffe5b1; outline-offset: .22rem; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .3rem 1.2rem;
  flex-wrap: wrap;
  padding: .8rem max(1rem, calc((100% - 63rem) / 2));
  border-bottom: 1px solid #3b2e2b;
  background: #171316;
}
.game-header nav { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; }
.game-header a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.wordmark { text-decoration: none; font-family: Georgia, serif; font-weight: 700; letter-spacing: -.025em; }
.wordmark span { margin-left: .3rem; color: var(--game-muted); font-weight: 500; }
main { width: min(100% - 2rem, 63rem); margin: 1.4rem auto 3rem; }
.game-hero {
  --hero-shadow: #221c1a;
  --hero-color: #51272f;
  --hero-edge: #733943;
  --hero-light: #ba874c70;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 12rem;
  overflow: hidden;
  padding: clamp(.9rem, 4vw, 2.3rem);
  border: 1px solid var(--game-line);
  border-radius: 1.25rem;
  background:
    radial-gradient(ellipse at 88% 48%, var(--hero-light) 0, transparent 47%),
    linear-gradient(116deg, var(--hero-shadow) 12%, var(--hero-color) 62%, var(--hero-edge));
}
.game-hero[data-branch="weeze"] {
  --hero-shadow: #1d1d29;
  --hero-color: #292b50;
  --hero-edge: #493c58;
  --hero-light: #c89b5870;
}
.game-hero[data-branch="twisteden"] {
  --hero-shadow: #1c2823;
  --hero-color: #283b2c;
  --hero-edge: #535032;
  --hero-light: #c1a06170;
}
.game-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 46%, #ffe5b11a 55%, transparent 65%);
  background-size: 220% 100%;
  animation: scene-light 10s ease-in-out infinite alternate;
}
@keyframes scene-light { from { background-position: right; } to { background-position: left; } }
.hero-copy { position: relative; z-index: 1; }
h1 { margin: 0; max-width: 12ch; font-family: Georgia, serif; font-weight: 500; font-size: clamp(2.2rem, 6.5vw, 4.75rem); line-height: .98; letter-spacing: -.055em; }
.hero-copy p { max-width: 38rem; margin: .9rem 0 0; color: #fff1dd; }
.hero-teddy {
  position: relative;
  width: clamp(5rem, 24vw, 11rem);
  height: auto;
  align-self: end;
  border-radius: 1.1rem;
  box-shadow: 0 .6rem 2rem #21101780;
  animation: teddy-idle 4s ease-in-out infinite;
}
@keyframes teddy-idle { 50% { transform: translateY(-.25rem); } }
.game-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: .9rem; margin-top: .9rem; align-items: start; }
.game-panel, .ranking-panel { background: #23191a; border: 1px solid var(--game-line); border-radius: 1.1rem; padding: clamp(.85rem, 3vw, 1.35rem); }
.game-panel h2, .ranking-panel h2 { margin: 0 0 .65rem; font-family: Georgia, serif; font-weight: 500; font-size: 1.55rem; }
.round-settings { margin: 0 0 .9rem; padding: 0; min-inline-size: 0; border: 0; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .7rem; }
.game-control { display: grid; gap: .3rem; min-inline-size: 0; font-weight: 650; }
.game-control input, .game-control select {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: .45rem .7rem;
  border: 1px solid #91654a;
  border-radius: .55rem;
  background: #312223;
  color: #fff3e1;
  font: inherit;
}
.alias-control { margin-top: .8rem; }
.game-hint { margin: .35rem 0 0; color: var(--game-muted); font-size: .9rem; }
.round-meter { display: flex; gap: .45rem .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; color: var(--game-muted); }
.round-meter strong { color: #fff3e1; font-variant-numeric: tabular-nums; }
progress { width: 100%; height: .6rem; order: 1; accent-color: var(--game-gold); }
.target { display: grid; place-items: center; text-align: center; min-height: 4.3rem; padding: .45rem; border-radius: .7rem; margin: .85rem 0; background: #392526; font-weight: 850; font-size: clamp(1.15rem, 3.3vw, 1.65rem); }
.choices { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .5rem; }
.choices button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 3.25rem;
  overflow-wrap: anywhere;
  padding: .35rem .45rem;
  border-radius: .65rem;
  border: 1px solid #91654a;
  background: #462e28;
  color: #fff3e1;
  font-weight: 750;
}
.choices button:hover:not(:disabled) { background: #674334; }
.choices button:active:not(:disabled) { background: #8a4e33; }
.start-button { min-height: 2.75rem; border: 0; border-radius: .65rem; background: var(--game-gold); color: #221713; padding: .4rem .8rem; font-weight: 850; }
.feedback { margin: .65rem 0 0; color: var(--game-muted); }
.feedback:empty { margin: 0; }
#rank-period { margin-block: .65rem .45rem; color: var(--game-muted); }
#rank-list { padding-left: 1.7rem; margin-block: .45rem 1rem; }
#rank-list li { padding: .5rem .2rem; border-bottom: 1px solid #513833; overflow-wrap: anywhere; }
#rank-list li:first-child { color: var(--game-gold); font-weight: 800; }
.rank-entry { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; }
.rank-name { display: grid; }
.rank-branch { color: var(--game-muted); font-size: .85rem; font-weight: normal; }
.rank-result { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .game-hero::before, .hero-teddy { animation: none; }
}
@media (max-width: 46rem) {
  .game-grid { grid-template-columns: 1fr; }
}
@media (max-width: 28rem) {
  main { width: min(100% - 1.2rem, 63rem); }
  .choices { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .game-hero { min-height: 9rem; }
}
