/* MagicAIl Table — styles: colors, fonts, page header, setup steps, copy fields, connection status.
   The styles are split into files in their old order (build 71, before: one style.css); index.html loads them in
   this order, so later rules still win over earlier ones. */

:root {
  --bg: #0d1310;
  --bg-glow: #16241c;
  --surface: #151e19;
  --surface-2: #1b2620;
  --border: #2a3a31;
  --text: #ebe6d6;
  --muted: #98a59c;
  --gold: #c9a24a;
  --gold-soft: rgba(201, 162, 74, 0.14);
  --green: #4fbf75;
  --green-glow: rgba(79, 191, 117, 0.45);
  --red: #e0795f;
  --radius: 14px;
  --card-w: 104px;
  /* Corner radius like a real card (about 3 mm of 63 × 88 mm): hides the light corners of scans. */
  --card-r: 4.8% / 3.4%;
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -10%, var(--bg-glow) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}

[hidden] { display: none !important; }

a { color: var(--gold); }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.muted { color: var(--muted); font-weight: 400; }
.center { text-align: center; }

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 16px 32px;
}

.page.wide {
  max-width: 1500px;
  padding-top: 20px;
}

.page.wide .masthead { margin-bottom: 16px; }
.page.wide .masthead h1 { font-size: 24px; }
.page.wide .tagline,
.page.wide .subtitle { display: none; }

/* ---------- Header ---------- */

.masthead {
  text-align: center;
  margin-bottom: 40px;
}

.masthead h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 6vw, 44px);
  letter-spacing: 0.06em;
  margin: 0;
  color: var(--gold);
}

/* Build 109: the subtitle right under the title (build 110: "… with your AI" — the player's own AI). */
.subtitle {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(13px, 2.4vw, 17px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.8;
}

.tagline {
  margin: 10px 0 0;
  color: var(--muted);
}

/* ---------- Steps ---------- */

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  transition: opacity 0.3s;
}

.step.locked { opacity: 0.45; }

.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 700;
  flex-shrink: 0;
}

.step h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.03em;
  margin: 0;
}

.step-intro {
  color: var(--muted);
  margin: 0 0 16px;
}

/* Collapsible step (step 1) */
.step-toggle {
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.step-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.03em;
}

.step-toggle-hint {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

.chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg);
  transition: transform 0.2s;
  margin: 0 4px 4px 0;
}

.step.collapsible:not(.collapsed) .chevron { transform: rotate(-135deg); margin-bottom: -4px; }
.step.collapsible .step-body { margin-top: 12px; }
.step.collapsible.collapsed .step-body { display: none; }
.step.collapsible.collapsed .step-head { margin-bottom: 0; }

.instructions {
  margin: 0 0 16px;
  padding-left: 22px;
}

.instructions li { margin-bottom: 10px; }
.instructions li::marker { color: var(--gold); }

.hint {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.fineprint {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0;
}

.warning {
  color: var(--red);
  font-size: 14px;
  margin: 10px 0 0;
}

/* Build 112: step 1 — the cost note, the address, and one folded box per AI (Claude, ChatGPT). */
.cost-note {
  margin: -6px 0 16px;
  padding: 8px 12px;
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  border-radius: 4px;
  font-size: 14px;
}
.address-label { margin: 0 0 8px; font-weight: 600; }
.setup-ai {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}
.setup-ai > summary {
  padding: 12px 16px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.setup-ai > summary::-webkit-details-marker { display: none; }
.setup-ai > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex: none;
}
.setup-ai[open] > summary::before { transform: rotate(45deg); }
.setup-ai > summary .recommended { color: var(--gold); font-size: 14px; font-weight: 500; }
.setup-ai > :not(summary) { margin-left: 16px; margin-right: 16px; }
.setup-ai > :last-child { margin-bottom: 14px; }
.setup-ai > .needs { margin-top: 0; margin-bottom: 12px; }

/* Build 118: the room note (hosted mode). */
.room-note { margin-top: 8px; }
.room-note[hidden] { display: none; }
/* Build 119: "Renew the room id" below the two AI boxes, and the note after a renewal. */
.room-renew { margin-top: 14px; }
.room-renew[hidden],
.room-renewed[hidden] { display: none; }

/* ---------- Copy fields ---------- */

.copy-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 10px 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.copy-field code,
.copy-field span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}


.btn-copy {
  flex-shrink: 0;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 5px 12px;
  font: 500 13px var(--font-body);
  cursor: pointer;
}

.btn-copy:hover { background: var(--gold-soft); }

.btn-link {
  background: none;
  border: none;
  color: var(--gold);
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.back-link {
  display: block;
  margin-top: 18px;
  font-size: 14px;
}

/* ---------- Connection status ---------- */

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 500;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #5c6a61;
  flex-shrink: 0;
}

.status[data-state="waiting"] .status-dot { animation: pulse 1.6s ease-in-out infinite; }

.status[data-state="connected"] {
  border-color: var(--green);
  color: var(--green);
}

.status[data-state="connected"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 12px var(--green-glow);
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* Build 143: the house at the top right of every layer (pre-game, building, ready, lobby) — back to the main menu. */
.step.layer { position: relative; }
.layer-home { position: absolute; top: 14px; right: 14px; }

/* Build 143: "Advanced" at the right of step 3's head — opens the opponents (more AIs). */
.advanced-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.advanced-toggle:hover { color: var(--text); }
.advanced-toggle[aria-expanded="true"] .chevron { transform: rotate(-135deg); margin-bottom: -4px; }

/* Build 143: the pre-game line in a frame like the example phrase, with a talking head in front. */
.talk-box { gap: 12px; }
.talk-box .talk-icon { flex: none; color: var(--text); }
.talk-box span { font-style: normal; }

/* Build 145: the notes under the game setup (deck size, budget, import, Commander) smaller and in italics. */
.setup-note { font-size: 12px; font-style: italic; }
