
:root {
  --bg: #08111f;
  --panel: rgba(17, 29, 49, .9);
  --panel-2: #101c30;
  --text: #eef5ff;
  --muted: #9eb0c8;
  --accent: #64ffb4;
  --accent-2: #6aa7ff;
  --danger: #ff7272;
  --warning: #ffd166;
  --border: rgba(255,255,255,.09);
  --shadow: 0 24px 70px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(70, 118, 255, .16), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(46, 229, 157, .10), transparent 26%),
    var(--bg);
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { max-width: 1180px; margin: 0 auto; padding: 28px; }

.topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  margin-bottom: 22px;
}
.eyebrow { color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .16em; margin: 0 0 8px; }
h1 { font-size: clamp(2rem, 5vw, 4rem); margin: 0; line-height: .95; letter-spacing: -.045em; }
.subtitle { color: var(--muted); margin: 14px 0 0; font-size: 1rem; }

.card {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(20,34,57,.96), rgba(11,21,36,.92));
  box-shadow: var(--shadow);
  border-radius: 26px;
}

.setup-card { padding: 28px; }
.setup-copy h2 { margin: 8px 0 6px; }
.setup-copy p { color: var(--muted); max-width: 760px; }
textarea {
  width: 100%;
  margin-top: 18px;
  resize: vertical;
  min-height: 200px;
  color: var(--text);
  background: #091422;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  outline: none;
}
textarea:focus { border-color: rgba(100,255,180,.55); box-shadow: 0 0 0 4px rgba(100,255,180,.08); }

.setup-actions, .finish-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap;
}
.switch-row { color: var(--muted); display: inline-flex; align-items: center; gap: 10px; }

.primary-btn, .secondary-btn, .ghost-btn {
  border-radius: 14px; padding: 13px 18px; font-weight: 800; border: 1px solid transparent;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.primary-btn { background: var(--accent); color: #06170f; }
.secondary-btn { background: #1b2a45; color: var(--text); border-color: var(--border); }
.ghost-btn { background: transparent; color: var(--muted); border-color: var(--border); }
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
.wide { width: 100%; }

.badge {
  display: inline-flex;
  color: #06170f;
  background: var(--accent);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: .78rem;
  font-weight: 900;
}
.label { color: var(--muted); text-transform: uppercase; letter-spacing: .11em; font-size: .72rem; font-weight: 800; margin: 0 0 8px; }

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, .7fr);
  gap: 20px;
}
.mission-card { padding: 28px; min-height: 560px; display: flex; flex-direction: column; }
.mission-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.mission-header h2 { margin: 8px 0 0; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.04em; }
.next-player-box {
  min-width: 150px; border: 1px solid var(--border); background: rgba(255,255,255,.03);
  padding: 14px 16px; border-radius: 16px; text-align: right;
}
.next-player-box span { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.next-player-box strong { display: block; margin-top: 5px; }

.mission-body { margin: auto 0; padding: 34px 0; }
.mission-body h3 { font-size: clamp(1.55rem, 3vw, 2.6rem); line-height: 1.18; margin: 0; letter-spacing: -.025em; }
.rule-note {
  margin-top: 24px; border-left: 3px solid var(--accent-2);
  background: rgba(106,167,255,.08); padding: 14px 16px; border-radius: 10px; color: #ccdaf0;
}

.progress-wrap { margin-top: auto; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .86rem; margin-bottom: 8px; }
.progress-track { height: 11px; border-radius: 999px; background: #07111e; overflow: hidden; }
.progress-bar { height: 100%; width: 4%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: inherit; transition: width .35s ease; }

.timer-card { padding: 28px; display: flex; flex-direction: column; align-items: center; }
.timer-circle {
  width: 220px; height: 220px; margin: 24px 0;
  border-radius: 50%;
  border: 11px solid var(--accent);
  display: grid; place-content: center;
  text-align: center;
  box-shadow: 0 0 40px rgba(100,255,180,.12), inset 0 0 40px rgba(100,255,180,.06);
}
.timer-circle span { font-size: 5rem; font-weight: 900; line-height: .9; font-variant-numeric: tabular-nums; }
.timer-circle small { color: var(--muted); margin-top: 8px; }
.timer-circle.warning { border-color: var(--warning); }
.timer-circle.danger { border-color: var(--danger); animation: pulse .7s infinite alternate; }
@keyframes pulse { to { transform: scale(1.025); } }

.timer-actions { width: 100%; display: grid; gap: 10px; margin-top: auto; }
.status-box {
  width: 100%; margin-top: 16px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.035);
  display: flex; justify-content: space-between; color: var(--muted);
}
.status-box strong { color: var(--text); }

.finish-card { padding: 44px; text-align: center; }
.finish-card .trophy { font-size: 4rem; }
.finish-card h2 { font-size: 2.5rem; margin: 12px 0 8px; }
.finish-card p { color: var(--muted); max-width: 680px; margin: 0 auto; }
.finish-actions { justify-content: center; }

.transition-overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgba(2,8,15,.86); backdrop-filter: blur(12px);
}
.transition-card {
  width: min(620px, calc(100vw - 32px));
  background: #101d31; border: 1px solid var(--border); border-radius: 28px;
  padding: 42px; text-align: center; box-shadow: var(--shadow);
}
.transition-card p { color: var(--danger); letter-spacing: .18em; font-weight: 900; }
.transition-card h2 { font-size: clamp(2rem, 6vw, 4rem); margin: 10px 0; }
.transition-card span { color: var(--muted); }
.hidden { display: none !important; }

@media (max-width: 820px) {
  .app-shell { padding: 18px; }
  .topbar { flex-direction: column; }
  .game-grid { grid-template-columns: 1fr; }
  .mission-card { min-height: auto; }
  .mission-body { margin: 30px 0; }
  .timer-circle { width: 180px; height: 180px; }
  .timer-circle span { font-size: 4rem; }
}
