:root {
  --bg: #000000;
  --bg-card: #111111;
  --bg-input: #1a1a1a;
  --accent: #3291ff;
  --accent-2: #0070f3;
  --fg: #eeeeee;
  --muted: #8b93a7;
  --good: #2dd4bf;
  --danger: #f87171;
  --border: #222222;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

body.task-active {
  overflow: hidden;
  background: var(--bg);
}

.hero {
  text-align: center;
  padding: 2.2rem 1rem 1rem;
}
.hero h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--fg);
}
.hero p { margin: 0.35rem 0; }
.subtle { color: var(--muted); font-size: 0.92rem; }

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
}
.card h2 {
  margin: 0 0 0.8rem;
  font-size: 1.15rem;
  color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.7rem 1.1rem;
  align-items: end;
}
label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
label.inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
  font-size: 0.9rem;
}
input[type="text"],
input[type="number"],
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  padding: 0.5rem 0.6rem;
  font-size: 0.95rem;
  width: 100%;
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[type="range"]:focus {
  outline: none;
  box-shadow: none;
}

/* Order list */
.order-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.order-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-weight: 600;
}
.order-btns button {
  background: var(--bg-card);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.2rem 0.55rem;
  margin-left: 0.3rem;
}

/* Tabs */
.tabs { display: flex; gap: 0.4rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.tab {
  background: var(--bg-input);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.panel { display: none; }
.panel.active-panel { display: block; }

/* Buttons */
button {
  font-family: inherit;
  font-size: 0.95rem;
}
.run-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.run-buttons button,
.continue-hint button {
  background: var(--bg-input);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
}
.primary { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; font-weight: 600; }
.primary:hover { background: var(--accent-2) !important; }
.big { font-size: 1.05rem; padding: 0.7rem 1.4rem; }
.danger { background: var(--danger) !important; border-color: var(--danger) !important; color: #fff !important; }

.status { color: var(--accent); font-style: italic; margin: 0.4rem 0 0; min-height: 1.2em; }
.status.error { color: var(--danger); }

footer { text-align: center; color: var(--muted); padding: 1.5rem 1rem 2.5rem; font-size: 0.85rem; }

/* ── Task overlay / stage ── */
.task-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  color: var(--fg);
  display: none;
  z-index: 100;
  overflow: auto;
}
.task-overlay.active { display: flex; }
.stage {
  margin: auto;
  width: 100%;
  max-width: 1040px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
}
.screen { max-width: 760px; }
.screen h2 {
  color: var(--fg);
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
.screen p, .screen li { font-size: 1.1rem; color: var(--fg); }
.continue-hint { margin-top: 1.6rem; display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }

/* Overlays (pause menu) */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.overlay-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.6rem 2rem;
  text-align: center;
}
.overlay-actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }
.overlay-actions button { padding: 0.6rem 1.1rem; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-input); color: var(--fg); cursor: pointer; }

/* Metrics shared */
.metrics { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin-bottom: 1rem; }
.metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  min-width: 90px;
}
.metric span { display: block; color: var(--muted); font-size: 0.75rem; }
.metric strong { font-size: 1.2rem; color: var(--fg); }

/* ── BART ── */
.bart-game { width: 100%; max-width: 760px; color: var(--fg); }
.bart-status-bar { display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; flex-wrap: wrap; margin-bottom: 0.5rem; color: var(--fg); }
.bart-stage {
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.balloon {
  position: relative;
  z-index: 1;
  border-radius: 50%;
  background: rgb(60, 200, 60);
  box-shadow: inset -10px -10px 30px rgba(0, 0, 0, 0.25);
  transition: width 0.08s linear, height 0.08s linear;
}
.balloon-preview {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: transparent;
  border: 3px dashed rgba(50, 145, 255, 0.55);
  box-sizing: border-box;
  pointer-events: none;
  transition: width 0.08s linear, height 0.08s linear;
  z-index: 0;
}
.bart-pop {
  position: absolute;
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  background: radial-gradient(circle, var(--danger), transparent 70%);
  padding: 2rem;
  border-radius: 50%;
  animation: popflash 0.6s ease-out;
}
@keyframes popflash { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.bart-instr { min-height: 1.4em; color: var(--accent); }
.bart-slider-wrap { margin: 0.5rem 0; }
.bart-slider-wrap input[type="range"] { width: 70%; accent-color: var(--accent); }
.bart-slider-wrap input[type="range"]:focus { outline: none; box-shadow: none; }
.bart-pumpcount { font-weight: 700; margin-top: 0.3rem; color: var(--fg); }
.bart-buttons { display: flex; gap: 1rem; justify-content: center; margin: 0.8rem 0; }
.bart-pump, .bart-collect {
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  color: #fff;
}
.bart-pump { background: var(--danger); }
.bart-collect { background: var(--good); }

/* ── PVT ── */
.pvt-game { width: 100%; max-width: 700px; color: var(--fg); }
.pvt-target {
  width: 320px;
  height: 320px;
  max-width: 80vw;
  margin: 0 auto;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  border: 3px solid var(--border);
}
.pvt-target.idle { background: var(--bg-card); color: var(--muted); }
.pvt-target.waiting { background: #0d1a2d; color: #5b9bd5; font-size: 1.6rem; border-color: #1a3050; }
.pvt-target.ready { background: #2a0d0d; color: #ff5555; font-size: 3.4rem; border-color: #5c2020; }
.pvt-target.false-start { background: #2a2008; color: #ffae42; font-size: 1.5rem; padding: 1rem; border-color: #4a3810; }
.pvt-countdown { font-size: 8rem; font-weight: 800; color: var(--fg); }
.pvt-countdown.go { color: var(--accent); font-size: 5rem; }

/* ── TMT ── */
.tmt-game { width: 100%; max-width: 1020px; color: var(--fg); }
#tmt-canvas {
  width: 100%;
  max-width: 1000px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0a122a;
  cursor: pointer;
}
.tmt-guide { color: var(--accent); }

/* ── Self report ── */
.self-report { max-width: 520px; text-align: left; }
.sr-row { flex-direction: row; align-items: center; gap: 0.8rem; color: var(--fg); margin: 0.6rem 0; }
.sr-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.sr-row input[type="range"]:focus { outline: none; box-shadow: none; }
.sr-row output { width: 1.5rem; text-align: center; font-weight: 700; }
.sr-notes { color: var(--fg); margin-top: 0.6rem; }
