/* =========================================================================
   SI Widget Studio — gallery + embed builder
   Sports Interaction brand kit: off-white page, navy surfaces, orange accent.
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Saira+Condensed:ital,wght@0,600;0,800;1,900&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* SI brand kit */
  --si-sportsbook-orange: #FE4000;
  --si-stadium-navy: #0B2234;
  --si-off-side-teal: #027496;
  --si-yellow-card: #FFBC00;
  --si-paper-white: #FFFFFF;
  --si-off-white: #FBFAF7;
  --si-stadium-100: #F2EFE9;
  --si-stadium-200: #D7DDE2;
  --si-stadium-400: #5C6E7C;

  /* Roles — light page, navy surfaces (the bracket's dark cards on paper) */
  --page: var(--si-off-white);
  --ink: var(--si-stadium-navy);
  --ink-muted: #4A5B68;
  --ink-faint: var(--si-stadium-400);
  --accent: var(--si-sportsbook-orange);
  --teal: var(--si-off-side-teal);

  /* Navy card surfaces */
  --surface: var(--si-stadium-navy);
  --surface-2: #102C42;
  --surface-sunken: #081A28;
  --c-ink: var(--si-paper-white);
  --c-ink-muted: #9DB0BE;
  --line: rgba(11, 34, 52, 0.12);
  --line-card: rgba(215, 221, 226, 0.16);
  --line-card-strong: rgba(215, 221, 226, 0.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 88% -8%, rgba(254,64,0,0.07), transparent 60%),
    radial-gradient(820px 460px at -5% 0%, rgba(2,116,150,0.08), transparent 55%),
    var(--page);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid rgba(215, 221, 226, 0.30);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(10px);
  background: var(--si-stadium-navy);
}
.brand-lock { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-div { width: 1px; height: 26px; background: rgba(215, 221, 226, 0.16); flex-shrink: 0; }
.brand-kicker {
  font-family: 'Saira Condensed', sans-serif; font-weight: 800; font-style: italic;
  font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase;
  color: #9DB0BE;
  white-space: nowrap;
}
.topbar-link {
  display: flex; align-items: center; justify-content: center;
  font-family: 'Saira Condensed', sans-serif; font-weight: 800; font-style: italic;
  font-size: 14px; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px;
  white-space: nowrap; transition: all 120ms ease;
}
.topbar-link:hover { background: var(--accent); border-color: var(--accent); color: var(--si-paper-white); }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(28px, 6vw, 60px) clamp(16px, 4vw, 48px) clamp(18px, 4vw, 30px);
  max-width: 1280px; margin: 0 auto;
}
.hero h1 {
  font-family: 'Saira Condensed', sans-serif; font-weight: 900; font-style: italic;
  font-size: clamp(36px, 7.5vw, 76px); line-height: 0.92; letter-spacing: 0.005em;
  text-transform: uppercase; margin: 0 0 16px; color: var(--ink);
}
.hero h1 .accent { color: var(--accent); }
.hero p { color: var(--ink-muted); font-size: clamp(14px, 2vw, 17px); max-width: 660px; line-height: 1.55; margin: 0; }
.hero code { color: var(--teal); background: var(--si-stadium-100); padding: 1px 5px; border-radius: 3px; }

/* ---------- Layout ---------- */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  max-width: 1280px; margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 48px) 80px;
  align-items: start;
}
@media (max-width: 900px) { .studio { grid-template-columns: 1fr; } }

/* Panels = light cards on the off-white page */
.panel {
  /* Light surfaces scoped to panels (header stays dark, outside this scope) */
  --surface: var(--si-paper-white);
  --surface-2: var(--si-off-white);
  --surface-sunken: var(--si-stadium-100);
  --c-ink: var(--si-stadium-navy);
  --c-ink-muted: #4A5B68;
  --line-card: rgba(11, 34, 52, 0.12);
  --line-card-strong: rgba(11, 34, 52, 0.20);

  background: var(--surface);
  border: 1px solid var(--line-card-strong);
  border-radius: 6px;
  overflow: hidden;
  color: var(--c-ink);
  box-shadow: 0 18px 40px -28px rgba(11, 34, 52, 0.18);
}
.panel::before { content: none; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-card);
}
.panel-title {
  font-family: 'Saira Condensed', sans-serif; font-weight: 800; font-style: italic;
  font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-ink);
}
.panel-body { padding: 18px; }

/* ---------- Controls ---------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; margin-bottom: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--c-ink-muted);
}
.field select, .field input[type="text"] {
  width: 100%; padding: 11px 12px;
  background: var(--surface-2); color: var(--c-ink);
  border: 1px solid var(--line-card-strong); border-radius: 5px;
  font-family: 'Inter', sans-serif; font-size: 14px; appearance: none;
}
.field select:focus, .field input:focus { outline: none; border-color: var(--accent); }
.field select option { color: #0B2234; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto; min-width: 64px; padding: 9px 10px;
  background: var(--surface-2); color: var(--c-ink-muted);
  border: 1px solid var(--line-card-strong); border-radius: 5px;
  font-family: 'Saira Condensed', sans-serif; font-weight: 800; font-style: italic;
  font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase;
  cursor: pointer; transition: all 120ms ease; min-height: 40px;
}
.seg button:hover { color: var(--c-ink); }
.seg button.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(254,64,0,0.35);
}
/* Variant picker: 4 options on a tidy 2-col grid (longer labels) */
.seg-variant { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg-variant button { min-width: 0; font-size: 12px; }

/* ---------- Fixture list ---------- */
.fixture-search { margin-bottom: 12px; }
.fixture-list {
  max-height: 360px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; padding-right: 4px;
}
.fixture-list::-webkit-scrollbar { width: 8px; }
.fixture-list::-webkit-scrollbar-thumb { background: var(--line-card-strong); border-radius: 4px; }
.fx {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; min-height: 44px;
  background: var(--surface-2);
  border: 1px solid var(--line-card); border-radius: 5px;
  cursor: pointer; text-align: left; width: 100%; color: var(--c-ink);
  transition: border-color 120ms ease, background 120ms ease;
}
.fx:hover { border-color: var(--line-card-strong); }
.fx.active { border-color: var(--accent); background: rgba(254,64,0,0.10); }
.fx-flags { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; min-width: 44px; font-size: 16px; }
.fx-flag {
  width: 22px; height: 16px; object-fit: cover; border-radius: 2px;
  box-shadow: 0 0 0 1px var(--line-card);
  display: inline-block;
}
.fx-flag-emoji { width: auto; height: auto; box-shadow: none; line-height: 1; }
.fx-main { flex: 1; min-width: 0; }
.fx-teams {
  font-family: 'Saira Condensed', sans-serif; font-weight: 800;
  font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fx-meta { font-size: 11px; color: var(--c-ink-muted); font-family: 'JetBrains Mono', monospace; }
.fx-badge {
  flex-shrink: 0; font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 3px; font-family: 'JetBrains Mono', monospace;
}
.fx-badge.odds { background: rgba(255,188,0,0.18); color: var(--si-yellow-card); }
.fx-badge.noodds { background: rgba(92,110,124,0.25); color: var(--c-ink-muted); }

/* ---------- Preview ---------- */
.preview-wrap {
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 18px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 12px, transparent 12px 24px),
    var(--surface-sunken);
  min-height: 380px;
}
.preview-frame { width: 100%; border: 0; border-radius: 4px; background: transparent; }

/* ---------- Embed code ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button {
  padding: 7px 14px; min-height: 36px;
  background: transparent; color: var(--c-ink-muted);
  border: 1px solid var(--line-card-strong); border-radius: 5px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all 120ms ease;
}
.tabs button.active { background: var(--surface-2); color: var(--c-ink); border-color: var(--accent); }
.code-box { position: relative; }
.code-box pre {
  margin: 0; padding: 14px;
  background: var(--si-stadium-navy); border: 1px solid var(--line-card-strong); border-radius: 6px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.55;
  color: #BFD3DF; white-space: pre-wrap; word-break: break-all;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  padding: 6px 12px; min-height: 32px;
  background: var(--accent); color: #fff; border: 0; border-radius: 4px;
  font-family: 'Saira Condensed', sans-serif; font-weight: 800; font-style: italic;
  font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer; transition: filter 120ms ease;
}
.copy-btn:hover { filter: brightness(1.1); }
.copy-btn.copied { background: #1E9E57; }

.hint { margin-top: 12px; font-size: 11px; color: var(--c-ink-muted); line-height: 1.5; }
.hint code { background: var(--si-stadium-100); padding: 1px 5px; border-radius: 3px; font-size: 11px; color: var(--teal); }

.notice {
  margin: 0 0 18px; padding: 11px 14px;
  background: rgba(255,188,0,0.12);
  border: 1px solid rgba(255,188,0,0.36);
  border-radius: 6px;
  font-size: 12px; color: #8A6A00; line-height: 1.5;
}
.notice strong { color: #6E5400; }

.footer {
  text-align: center; padding: 28px 16px 40px;
  color: var(--ink-faint); font-size: 12px;
}
.footer span { color: var(--ink-muted); }
