@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../../assets/fonts/Fraunces144ptSoft-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../../assets/fonts/IBMPlexSans-Regular.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --night: #101a32;
  --night-deep: #081023;
  --panel: #172543;
  --line: #344b70;
  --paper: #f6f2e7;
  --muted: #a8b7d1;
  --ember: #ff7a3a;
  --ember-hot: #ffd08a;
  --signal: #f5bd4b;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  background: var(--night-deep);
  color: var(--paper);
  font-family: "IBM Plex Sans", Arial, sans-serif;
  margin: 0;
}
button { font: inherit; }
button:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.game-shell { margin: 0 auto; max-width: 1120px; padding: clamp(1rem, 3vw, 2rem); }
.game-header { align-items: end; display: flex; gap: 1rem; justify-content: space-between; margin-bottom: 1rem; }
.eyebrow { color: var(--ember); font-size: .7rem; font-weight: 600; letter-spacing: .14em; margin: 0 0 .35rem; text-transform: uppercase; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: Fraunces, Georgia, serif; font-weight: 600; }
h1 { font-size: clamp(2rem, 5vw, 3.6rem); line-height: .95; }
.scoreboard { display: flex; gap: clamp(.7rem, 3vw, 2rem); text-align: right; }
.scoreboard div { display: grid; gap: .15rem; }
.scoreboard span { color: var(--muted); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.scoreboard strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.play-wrap { display: grid; place-items: center; }
.stage-frame {
  background: var(--night);
  border: 2px solid var(--line);
  box-shadow: 8px 8px 0 #050a18;
  max-width: 960px;
  position: relative;
  width: 100%;
}
#cindertrail-canvas {
  display: block;
  height: auto;
  max-width: 100%;
  touch-action: none;
  width: 100%;
}
.start-card, .status-card {
  background: rgba(8, 16, 35, .94);
  border: 2px solid var(--ember);
  left: 50%;
  max-width: 31rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 2rem);
}
.start-card h2, .status-card h2 { font-size: clamp(1.7rem, 5vw, 2.6rem); margin-bottom: .75rem; }
.start-card p:not(.eyebrow), .status-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 auto 1.5rem;
  max-width: 34ch;
}
[hidden] { display: none !important; }
.primary-button {
  background: var(--ember);
  border: 2px solid var(--ember);
  color: var(--night-deep);
  cursor: pointer;
  font-weight: 600;
  padding: .7rem 1.15rem;
}
.primary-button:hover { background: var(--paper); border-color: var(--paper); }
.touch-controls {
  align-items: center;
  display: flex;
  gap: .8rem;
  justify-content: space-between;
  margin: 1.4rem 0 1.5rem;
}
.swipe-hint {
  color: var(--muted);
  font-size: .85rem;
  letter-spacing: .04em;
}
.touch-controls button {
  background: var(--panel);
  border: 2px solid var(--ember);
  color: var(--paper);
  cursor: pointer;
  min-height: 3rem;
  min-width: 6.5rem;
  padding: .5rem 1rem;
  touch-action: manipulation;
}
.touch-controls button:hover, .touch-controls button:active {
  background: var(--ember);
  color: var(--night-deep);
}
.instructions {
  align-items: start;
  background: var(--panel);
  border: 2px solid var(--line);
  display: grid;
  gap: 1rem 2rem;
  grid-template-columns: 1fr 1.4fr;
  padding: clamp(1rem, 3vw, 1.5rem);
}
.instructions h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.05; }
.control-list {
  display: grid;
  gap: .55rem 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}
.control-list div { align-items: center; display: flex; gap: .65rem; justify-content: space-between; }
.control-list dt { white-space: nowrap; }
.control-list dd { color: var(--muted); margin: 0; }
kbd {
  background: var(--night-deep);
  border: 1px solid var(--line);
  border-radius: .25rem;
  font-size: .78rem;
  padding: .18rem .4rem;
}
.instruction-note {
  border-left: 2px solid var(--ember);
  color: var(--muted);
  grid-column: 1 / -1;
  line-height: 1.45;
  padding-left: .8rem;
}
.footer-note { color: var(--muted); font-size: .75rem; margin: 1.5rem 0 0; text-align: center; }
.visually-hidden {
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
@media (max-width: 38rem) {
  .game-header { align-items: start; flex-direction: column; }
  .scoreboard { text-align: left; width: 100%; }
  .scoreboard div { flex: 1; }
  .touch-controls { flex-wrap: wrap; }
  .instructions { grid-template-columns: 1fr; }
  .control-list { order: 2; }
  .instruction-note { grid-column: auto; order: 3; }
}
