/* Thermostat Panic — arcade skin, matching the AI Arcade hub (games/style.css).
   Only visual styling lives here; gameplay is untouched in script.js.
   Note: #gauge-container must keep a 300px content height (script.js's
   GAUGE_HEIGHT), so don't switch it to border-box sizing. */

:root {
  --arc-bg: #0b0a1f;
  --arc-bg-2: #15123a;
  --arc-grid: rgba(255, 64, 179, 0.3);
  --arc-pink: #ff40b3;
  --arc-cyan: #35f2ff;
  --arc-yellow: #ffe45c;
  --arc-green: #39ff88;
  --arc-red: #ff3b5c;
  --arc-blue: #3b8cff;
  --arc-text: #f4f1ff;
  --arc-dim: #9d98c7;
  --pixel: "Press Start 2P", ui-monospace, monospace;
}

html {
  min-height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 64, 179, 0.22), transparent 60%),
    linear-gradient(180deg, var(--arc-bg) 0%, var(--arc-bg-2) 100%) fixed;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--arc-text);
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  position: relative;
}

/* Synthwave floor */
body::before {
  content: "";
  position: fixed;
  left: -50%;
  right: -50%;
  bottom: 0;
  height: 45vh;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--arc-grid) 2px, transparent 2px),
    linear-gradient(90deg, var(--arc-grid) 2px, transparent 2px);
  background-size: 60px 60px;
  transform: perspective(300px) rotateX(60deg);
  transform-origin: 50% 100%;
  mask-image: linear-gradient(to top, #000 10%, transparent 90%);
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 90%);
  animation: floor-scroll 1.6s linear infinite;
}

@keyframes floor-scroll {
  from { background-position: 0 0; }
  to { background-position: 0 60px; }
}

/* CRT scanlines */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
}

#back-to-games {
  display: inline-block;
  margin-bottom: 18px;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--arc-pink);
  text-decoration: none;
  padding: 7px 10px;
  border: 1px solid rgba(255, 64, 179, 0.5);
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

#back-to-games:hover,
#back-to-games:focus-visible {
  background: var(--arc-pink);
  color: #fff;
  outline: none;
}

h1 {
  font-family: var(--pixel);
  font-size: clamp(20px, 5vw, 32px);
  line-height: 1.3;
  color: var(--arc-yellow);
  text-shadow:
    3px 3px 0 var(--arc-pink),
    5px 5px 0 rgba(53, 242, 255, 0.55),
    0 0 20px rgba(255, 228, 92, 0.4);
  margin: 0 0 10px;
}

#page-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 36px;
}

#game-panel {
  flex: 2;
}

/* Timer */
#time-left {
  font-family: var(--pixel);
  font-size: 48px;
  color: var(--arc-pink);
  text-shadow: 0 0 18px rgba(255, 64, 179, 0.7);
  margin: 14px 0 0;
  font-variant-numeric: tabular-nums;
}

/* Gauge: a glowing thermometer tube */
#gauge-container {
  position: relative;
  width: 60px;
  height: 300px;
  margin: 22px auto 16px;
  background:
    repeating-linear-gradient(180deg, transparent 0 29px, rgba(255, 255, 255, 0.08) 29px 30px),
    #07061a;
  border: 3px solid var(--arc-cyan);
  border-radius: 10px;
  box-shadow: 0 0 16px rgba(53, 242, 255, 0.45), inset 0 0 14px rgba(53, 242, 255, 0.15);
}

#comfort-zone {
  position: absolute;
  left: 0;
  width: 100%;
  background: rgba(57, 255, 136, 0.35);
  box-shadow: 0 0 14px rgba(57, 255, 136, 0.6);
  border-top: 2px solid var(--arc-green);
  border-bottom: 2px solid var(--arc-green);
  box-sizing: border-box;
}

#temp-needle {
  position: absolute;
  left: -12px;
  width: 84px;
  height: 4px;
  background-color: var(--arc-yellow);
  box-shadow: 0 0 10px var(--arc-yellow), 0 0 22px rgba(255, 228, 92, 0.6);
  border-radius: 2px;
  transition: bottom 0.2s ease;
}

#current-temp {
  font-family: var(--pixel);
  font-size: 18px;
  color: var(--arc-yellow);
  margin: 0;
}

/* Score + overcorrections */
#stats {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 22px 0;
}

#stats p {
  margin: 0;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--arc-dim);
  text-transform: uppercase;
}

#stats span {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  color: var(--arc-cyan);
  text-shadow: 0 0 10px rgba(53, 242, 255, 0.6);
}

/* Big round arcade buttons */
#controls {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 22px 0;
}

#controls button {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  font-family: var(--pixel);
  font-size: 26px;
  color: #fff;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}

#temp-down {
  background: radial-gradient(circle at 35% 30%, #7fb2ff, var(--arc-blue) 55%, #1d4fa8);
  box-shadow: 0 6px 0 #16397a, 0 0 18px rgba(59, 140, 255, 0.55);
}

#temp-up {
  background: radial-gradient(circle at 35% 30%, #ff8fa3, var(--arc-red) 55%, #a8182f);
  box-shadow: 0 6px 0 #7a1022, 0 0 18px rgba(255, 59, 92, 0.55);
}

#controls button:active {
  transform: translateY(5px);
}

#temp-down:active { box-shadow: 0 1px 0 #16397a, 0 0 18px rgba(59, 140, 255, 0.55); }
#temp-up:active { box-shadow: 0 1px 0 #7a1022, 0 0 18px rgba(255, 59, 92, 0.55); }

#controls button:focus-visible,
#start-btn:focus-visible {
  outline: 3px solid var(--arc-yellow);
  outline-offset: 4px;
}

/* Start button, same as the hub's PLAY button */
#start-btn {
  font-family: var(--pixel);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 22px;
  border: none;
  border-radius: 8px;
  background: var(--arc-yellow);
  color: #1a1400;
  box-shadow: 0 5px 0 #b39a10, 0 0 22px rgba(255, 228, 92, 0.35);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}

#start-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #b39a10;
}

#start-btn:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: var(--arc-dim);
  box-shadow: none;
  cursor: default;
}

/* Event pop-ups ("Storm hit!") */
#status-message {
  min-height: 1.5em;
  margin-top: 18px;
  font-family: var(--pixel);
  font-size: 13px;
  line-height: 1.6;
  color: var(--arc-pink);
  text-shadow: 0 0 12px rgba(255, 64, 179, 0.8);
}

#status-message:not(:empty) {
  animation: panic 0.35s ease-in-out 3;
}

@keyframes panic {
  0%, 100% { transform: translateX(0) scale(1); }
  25% { transform: translateX(-4px) scale(1.06); }
  75% { transform: translateX(4px) scale(1.06); }
}

/* High scores panel */
#leaderboard {
  flex: 1;
  min-width: 190px;
  text-align: left;
  margin-top: 20px;
  padding: 16px 16px 18px;
  border: 2px solid rgba(255, 64, 179, 0.6);
  border-radius: 10px;
  background: rgba(7, 6, 26, 0.75);
  box-shadow: 0 0 20px rgba(255, 64, 179, 0.25);
}

#leaderboard h2 {
  font-family: var(--pixel);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--arc-yellow);
  margin: 0 0 14px;
}

#leaderboard-list {
  list-style: decimal;
  font-size: 13px;
  color: var(--arc-text);
  padding-left: 22px;
  margin: 0;
}

#leaderboard-list li {
  margin-bottom: 8px;
}

#leaderboard-list li::marker {
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--arc-cyan);
}

#leaderboard-list:empty::before {
  content: "No scores yet. Be the first!";
  display: block;
  margin-left: -22px;
  font-size: 12px;
  color: var(--arc-dim);
}

@media (max-width: 640px) {
  #page-layout {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  #time-left { font-size: 40px; }
  #leaderboard { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  #status-message:not(:empty) {
    animation: none;
  }
}
