﻿:root {
  --bg-night: #1f2536;
  --bg-dusk: #384a5c;
  --panel: #efe2b7;
  --panel-shadow: #c6a96c;
  --ink: #2a1f14;
  --accent: #cb5d3d;
  --accent-dark: #923821;
  --grass: #56753f;
  --grass-dark: #38512b;
  --sky-1: #ffcb80;
  --sky-2: #f18857;
  --sky-3: #6d4f81;
  --warning: #f2b84b;
  --danger: #dd5d4a;
  --good: #5dbb63;
  --border: #3b2b20;
  --wood: #8c5a35;
  --wood-dark: #60371d;
  --ui-scale: 4px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Trebuchet MS", Verdana, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 238, 180, 0.18), transparent 30%),
    linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 34%, var(--sky-3) 70%, var(--bg-night) 100%);
  image-rendering: pixelated;
}

button,
input {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.game-frame {
  width: min(1180px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.hud-group {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.stat-card,
.panel,
.integrity-panel,
.audio-card {
  background: var(--panel);
  border: 4px solid var(--border);
  box-shadow: 0 6px 0 var(--panel-shadow);
}

.stat-card {
  min-width: 92px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-transform: uppercase;
}

.audio-card {
  min-width: 126px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audio-label,
.stat-label,
.eyebrow,
.leaderboard-header span,
.result-card span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong,
.result-card strong {
  font-size: 1.05rem;
}

.audio-slider {
  width: 100%;
  accent-color: var(--accent);
}

.arena-shell {
  position: relative;
  background:
    linear-gradient(180deg, rgba(35, 41, 55, 0.12), rgba(35, 41, 55, 0.42)),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0));
  border: 4px solid var(--border);
  box-shadow: 0 8px 0 rgba(32, 22, 14, 0.55);
  overflow: hidden;
}

.integrity-panel {
  margin: 14px 14px 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.integrity-track {
  width: 100%;
  height: 18px;
  background: #422717;
  border: 3px solid var(--border);
  overflow: hidden;
}

.integrity-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--good), #a8de69);
  transition: width 120ms linear, background 120ms linear;
}

#gameCanvas {
  width: 100%;
  height: auto;
  display: block;
  cursor: crosshair;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0));
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(29, 19, 13, 0.7);
}

.overlay.visible {
  display: flex;
}

.panel {
  max-width: 760px;
  width: min(100%, 760px);
  padding: 24px;
}

.panel-large {
  display: grid;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2,
.pixel-button,
.stat-card strong,
.result-card strong {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 0.96;
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1;
}

.flavor-text {
  max-width: 62ch;
  line-height: 1.45;
}

.pixel-button {
  border: 4px solid var(--border);
  background: linear-gradient(180deg, #f3a25a 0%, var(--accent) 100%);
  color: #fff8e9;
  padding: 10px 14px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: 0 5px 0 var(--accent-dark);
}

.pixel-button:hover {
  transform: translateY(1px);
  box-shadow: 0 4px 0 var(--accent-dark);
}

.pixel-button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--accent-dark);
}

.button-small {
  width: 138px;
  min-width: 138px;
  min-height: 58px;
  padding: 12px 14px;
  text-align: center;
  white-space: nowrap;
}

.overlay-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.leaderboard-panel {
  background: rgba(255, 248, 231, 0.8);
  border: 4px solid var(--border);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.leaderboard-panel-tight {
  margin-top: 8px;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.leaderboard-list {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 8px;
}

.leaderboard-list li {
  padding: 6px 8px;
  background: rgba(67, 42, 23, 0.08);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.result-card {
  border: 4px solid var(--border);
  background: #f8efcf;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-form {
  display: grid;
  gap: 10px;
}

.score-form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.score-form input {
  flex: 1 1 220px;
  min-width: 0;
  border: 4px solid var(--border);
  background: #fffaf0;
  padding: 10px 12px;
}

.submit-message {
  min-height: 1.2em;
}

.submit-message.error {
  color: var(--danger);
}

.submit-message.success {
  color: var(--good);
}

@media (max-width: 980px) {
  .hud-bar,
  .hud-group {
    flex-wrap: wrap;
  }
}

@media (max-width: 820px) {
  .page-shell {
    padding: 12px;
  }

  .panel {
    padding: 18px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .score-form-row {
    flex-direction: column;
  }

  .button-small,
  .pixel-button,
  .score-form input,
  .audio-card {
    width: 100%;
  }
}



