:root {
  color-scheme: light;
  --ink: #252321;
  --muted: #655f55;
  --paper: #fff8e8;
  --surface: #ffffff;
  --line: #d7cab2;
  --sky: #a8dce7;
  --grass: #2e7a57;
  --teal: #126c72;
  --teal-dark: #0a4f56;
  --coral: #c95c45;
  --gold: #e1ad39;
  --blue: #376d9d;
  --shadow: 0 18px 42px rgba(37, 35, 33, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(90deg, rgba(18, 108, 114, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(201, 92, 69, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 4px 4px 0 rgba(37, 35, 33, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.runner-shell {
  display: grid;
  gap: 18px;
  width: min(1180px, calc(100% - 36px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 34px;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: var(--teal-dark);
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  display: inline-block;
  width: 46px;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 62%, var(--ink) 0 5px, transparent 6px),
    #fffdf5;
  box-shadow: 5px 5px 0 var(--gold);
}

.brand-ear {
  position: absolute;
  top: -5px;
  width: 17px;
  height: 24px;
  border: 2px solid var(--ink);
  background: #f1eadc;
}

.brand-ear-left {
  left: 4px;
  border-radius: 14px 6px 11px 6px;
  transform: rotate(-22deg);
}

.brand-ear-right {
  right: 4px;
  border-radius: 6px 14px 6px 11px;
  transform: rotate(22deg);
}

.brand-eye,
.brand-nose {
  position: absolute;
  border-radius: 50%;
  background: var(--ink);
}

.brand-eye {
  top: 20px;
  width: 5px;
  height: 5px;
}

.brand-eye-left {
  left: 13px;
}

.brand-eye-right {
  right: 13px;
}

.brand-nose {
  left: 19px;
  top: 28px;
  width: 8px;
  height: 6px;
}

.title-lockup {
  min-width: 0;
}

.eyebrow,
.score-label,
.run-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 2px 0 0;
  font-size: 3rem;
  line-height: 0.98;
  letter-spacing: 0;
}

.action-row,
.touch-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.action-row button,
.touch-controls button {
  padding: 0 17px;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
}

.scorebar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.score-tile {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(37, 35, 33, 0.09);
}

.score-tile strong {
  overflow: hidden;
  font-size: 1.7rem;
  line-height: 1;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-panel {
  display: grid;
  gap: 12px;
}

.canvas-frame {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--sky);
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  min-height: 280px;
  max-height: 560px;
  aspect-ratio: 16 / 7;
}

.lower-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.run-status {
  min-height: 1.3em;
}

@media (max-width: 780px) {
  .runner-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .action-row,
  .touch-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .touch-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scorebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  canvas {
    min-height: 310px;
    aspect-ratio: 4 / 3;
  }

  .lower-bar {
    display: grid;
  }
}

@media (max-width: 430px) {
  .scorebar {
    gap: 8px;
  }

  .score-tile {
    padding: 12px;
  }

  .score-tile strong {
    font-size: 1.35rem;
  }
}
