/* ==========================================================================
   Unpunched Studio design system
   ========================================================================== */

:root {
  --bg: #f6f6fa;
  --surface: #ffffff;
  --surface-2: #f1f1f7;
  --surface-3: #e9e9f2;
  --ink: #12142a;
  --ink-2: #3c3f58;
  --muted: #6c7088;
  --line: #e5e5ee;
  --line-strong: #d4d4e0;
  --accent: #6d5efc;
  --accent-hover: #5b4bf0;
  --accent-ink: #ffffff;
  --accent-soft: #efedff;
  --accent-soft-ink: #4b3ed6;
  --ok: #10805b;
  --ok-soft: #e1f5ec;
  --warn: #9c5800;
  --warn-soft: #fff2db;
  --bad: #c3362b;
  --bad-soft: #fde7e4;
  --info: #2f5fd0;
  --info-soft: #e8f0ff;
  /* Charts: the warm side of a two-sided (diverging) chart; validated against the accent for colour-blind readers. */
  --chart-warm: #e0662f;
  --checker: #ececf3;
  --shadow-sm: 0 1px 2px rgba(18, 20, 42, 0.06);
  --shadow: 0 1px 2px rgba(18, 20, 42, 0.04), 0 10px 30px -14px rgba(18, 20, 42, 0.16);
  --shadow-lg: 0 24px 60px -24px rgba(18, 20, 42, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e16;
    --surface: #141725;
    --surface-2: #1b1f30;
    --surface-3: #242940;
    --ink: #eceef8;
    --ink-2: #c3c7da;
    --muted: #9095ae;
    --line: #252a3e;
    --line-strong: #323853;
    --accent: #8a7dff;
    --accent-hover: #9d92ff;
    --accent-ink: #0f0b2e;
    --accent-soft: #221e45;
    --accent-soft-ink: #c2bbff;
    --ok: #4bd39b;
    --ok-soft: #0f2a21;
    --warn: #f3b55c;
    --warn-soft: #2d2312;
    --bad: #ff7f72;
    --bad-soft: #341815;
    --info: #86a8ff;
    --info-soft: #172242;
    --chart-warm: #d95926;
    --checker: #1d2133;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

/* --- Base ------------------------------------------------------------------ */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: 28px; font-weight: 750; letter-spacing: -0.025em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 12px; }
code { font-family: var(--mono); font-size: 0.88em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.mt { margin-top: 16px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* --- Top bar --------------------------------------------------------------- */

/* The staging copy (BG_STUDIO_ENV=staging): a banner at the top, and an orange line that stays with the bar. */
.env-banner { padding: 7px 16px; background: #f59f00; color: #1f1400; font-size: 13px; line-height: 1.4; text-align: center; }
body.env-staging .topbar { border-top: 3px solid #f59f00; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16px; color: var(--ink); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
/* The logo's symbol ("Track Tile": a board track bent into the U of Unpunched, a token on the start space); master files in brand/. */
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: block;
  background: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='16%2016%20224%20224'%3E%3Cpath%20fill='%236d5efc'%20d='M16%2080%20A64%2064%200%200%201%2080%2016%20H176%20A64%2064%200%200%201%20240%2080%20V176%20A64%2064%200%200%201%20176%20240%20H80%20A64%2064%200%200%201%2016%20176%20Z'/%3E%3Cpath%20fill='%23ffffff'%20d='M46.00%2075.00%20A8.5%208.5%200%200%201%2054.50%2066.50%20H72.50%20A8.5%208.5%200%200%201%2081.00%2075.00%20V93.00%20A8.5%208.5%200%200%201%2072.50%20101.50%20H54.50%20A8.5%208.5%200%200%201%2046.00%2093.00%20Z%20M46.00%20118.00%20A8.5%208.5%200%200%201%2054.50%20109.50%20H72.50%20A8.5%208.5%200%200%201%2081.00%20118.00%20V136.00%20A8.5%208.5%200%200%201%2072.50%20144.50%20H54.50%20A8.5%208.5%200%200%201%2046.00%20136.00%20Z%20M46.00%20161.00%20A8.5%208.5%200%200%201%2054.50%20152.50%20H72.50%20A8.5%208.5%200%200%201%2081.00%20161.00%20V179.00%20A8.5%208.5%200%200%201%2072.50%20187.50%20H54.50%20A8.5%208.5%200%200%201%2046.00%20179.00%20Z%20M89.00%20161.00%20A8.5%208.5%200%200%201%2097.50%20152.50%20H115.50%20A8.5%208.5%200%200%201%20124.00%20161.00%20V179.00%20A8.5%208.5%200%200%201%20115.50%20187.50%20H97.50%20A8.5%208.5%200%200%201%2089.00%20179.00%20Z%20M132.00%20161.00%20A8.5%208.5%200%200%201%20140.50%20152.50%20H158.50%20A8.5%208.5%200%200%201%20167.00%20161.00%20V179.00%20A8.5%208.5%200%200%201%20158.50%20187.50%20H140.50%20A8.5%208.5%200%200%201%20132.00%20179.00%20Z%20M175.00%20161.00%20A8.5%208.5%200%200%201%20183.50%20152.50%20H201.50%20A8.5%208.5%200%200%201%20210.00%20161.00%20V179.00%20A8.5%208.5%200%200%201%20201.50%20187.50%20H183.50%20A8.5%208.5%200%200%201%20175.00%20179.00%20Z%20M175.00%20118.00%20A8.5%208.5%200%200%201%20183.50%20109.50%20H201.50%20A8.5%208.5%200%200%201%20210.00%20118.00%20V136.00%20A8.5%208.5%200%200%201%20201.50%20144.50%20H183.50%20A8.5%208.5%200%200%201%20175.00%20136.00%20Z%20M175.00%2075.00%20A8.5%208.5%200%200%201%20183.50%2066.50%20H201.50%20A8.5%208.5%200%200%201%20210.00%2075.00%20V93.00%20A8.5%208.5%200%200%201%20201.50%20101.50%20H183.50%20A8.5%208.5%200%200%201%20175.00%2093.00%20Z'/%3E%3Cpath%20fill='%236d5efc'%20d='M53.0%2084.0%20A10.5%2010.5%200%201%200%2074.0%2084.0%20A10.5%2010.5%200%201%200%2053.0%2084.0%20Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 14px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { opacity: 0.5; }
.crumbs .current { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .chip { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
.brand span:last-child { white-space: nowrap; }
@media (max-width: 520px) {
  .topbar-inner { padding: 8px 14px; gap: 10px; }
  .brand span:last-child { display: none; }
  .topbar .chip { font-size: 11px; padding: 2px 8px; }
}
.user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #ff8a5b, #e2499f);
}
.user-email { font-size: 13px; color: var(--ink-2); }
@media (max-width: 720px) { .user-email, .crumbs { display: none; } }

main { max-width: 1320px; margin: 0 auto; padding: 28px 20px 96px; }

/* --- Buttons --------------------------------------------------------------- */

button, .btn {
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; min-height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.05s;
  box-shadow: var(--shadow-sm);
}
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
button.primary, .btn.primary, .btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
button.primary:hover, .btn.primary:hover, .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost, button.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm, button.btn-sm { padding: 7px 10px; min-height: 32px; font-size: 13px; }
.btn-lg { padding: 13px 20px; min-height: 46px; font-size: 15px; border-radius: 12px; }
button.ok, .btn-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
button.ok:hover { background: var(--ok-soft); }
button.ok.active { background: var(--ok); border-color: var(--ok); color: #fff; }
button.warn, .btn-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
button.warn:hover { background: var(--warn-soft); }
button.warn.active { background: var(--warn); border-color: var(--warn); color: #fff; }
.icon-btn { padding: 0; width: 32px; min-height: 32px; height: 32px; box-shadow: none; border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--bad-soft); color: var(--bad); }

/* --- Forms ----------------------------------------------------------------- */

label, .label { display: block; font-size: 13px; font-weight: 650; color: var(--ink-2); margin: 14px 0 6px; }
.hint { font-weight: 450; color: var(--muted); }
input:not([type]), input[type="text"], input[type="password"], input[type="number"], input[type="email"], input[type="date"], textarea, select {
  font: inherit; font-size: 14px; width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, textarea:hover, select:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line-strong)); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
/* Date fields: the same height as the text fields beside them, and the browser's calendar button in the muted colour. */
input[type="date"] { min-height: 42px; line-height: 1.2; cursor: text; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
select { width: auto; padding: 8px 32px 8px 10px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236c7088'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 550; color: var(--ink); cursor: pointer; }
.switch-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; font-weight: 650; }
.inline-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-field label { margin: 0; }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; }
.input-prefix input { padding-left: 24px; width: 130px; }

/* Drag-and-drop file pickers */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px;
  min-height: 132px; padding: 18px; margin: 0; border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); color: var(--muted); cursor: pointer; font-weight: 500; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-soft-ink); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone .dz-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.dropzone strong { color: var(--ink); font-size: 14px; }
.dz-limits { display: grid; grid-template-columns: auto auto; gap: 3px 12px; margin: 4px 0 0; font-size: 12px; text-align: left; max-width: 420px; }
.dz-limits dt { color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.dz-limits dd { margin: 0; font-weight: 400; }
.dz-badge { display: inline-block; margin-right: 2px; padding: 0 6px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; background: var(--warn-soft); color: var(--warn); vertical-align: 1px; }
.dz-action { margin-top: 2px; }
@media (max-width: 520px) { .dz-limits { grid-template-columns: 1fr; } .dz-limits dd { margin-bottom: 4px; } }
.dz-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 4px; }
.dz-files span { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }

/* --- Cards ----------------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden;
}
.card-body { padding: 20px 22px 22px; }
.card-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; }
.card-head + .card-body { padding-top: 0; }
.card-head .titles { min-width: 0; flex: 1; }
.card-head .titles p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-soft-ink);
}
.section-icon.ok { background: var(--ok-soft); color: var(--ok); }
.section-icon.warn { background: var(--warn-soft); color: var(--warn); }
.section-icon.info { background: var(--info-soft); color: var(--info); }
.section-icon.pink { background: color-mix(in srgb, #e2499f 14%, var(--surface)); color: #d23c8f; }
.lead { color: var(--ink-2); font-size: 14px; max-width: 78ch; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

/* Collapsible cards: <details class="card collapsible"><summary class="card-head">… */
details.collapsible > summary { list-style: none; cursor: pointer; user-select: none; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary:hover { background: var(--surface-2); }
details.collapsible > summary .chev { transition: transform 0.2s; color: var(--muted); }
details.collapsible[open] > summary .chev { transform: rotate(180deg); }
details.collapsible[open] > summary { border-bottom: 1px solid var(--line); }
details.collapsible[open] > .card-body { padding-top: 18px; }
details.collapsible > summary .actions { cursor: auto; }

/* Chips & badges */
.chip, .pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650; line-height: 1.5; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.chip.ok, .pill.ok, .chip-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn, .pill.warn, .chip-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad, .pill.bad, .chip-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.accent, .chip-accent { background: var(--accent-soft); color: var(--accent-soft-ink); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.dot.accent { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }

/* Banners */
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px; border: 1px solid transparent; }
.banner .icon { margin-top: 1px; }
.banner.busy { background: var(--accent-soft); color: var(--accent-soft-ink); border-color: color-mix(in srgb, var(--accent) 20%, transparent); position: relative; overflow: hidden; }
.banner.busy::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: slide 1.6s ease-in-out infinite;
}
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.banner.error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.75s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Meter */
.meter { display: inline-block; width: 100%; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; vertical-align: middle; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 70%, #7be0b7)); }
.meter.warn > span { background: linear-gradient(90deg, var(--warn), #f5c26b); }
.meter.bad > span { background: linear-gradient(90deg, var(--bad), #ff8e83); }
.meter.inline { width: 120px; }
.meter.accent > span { background: linear-gradient(90deg, var(--accent), #b06cff); }
.meter.accent.done > span { background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 70%, #7be0b7)); }

/* Tables */
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th { text-align: left; font-weight: 650; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* File lists */
.file-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.file-list li:last-child { border-bottom: 0; }
.file-list .thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; display: grid; place-items: center; color: var(--muted); }
.file-list .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.file-list .empty { color: var(--muted); font-size: 13px; justify-content: center; }

/* --- Login ----------------------------------------------------------------- */

.login-wrap { min-height: calc(100vh - 160px); display: grid; grid-template-columns: 1.1fr 1fr; border-radius: 24px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-lg); background: var(--surface); }
.login-brand {
  padding: 48px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background: radial-gradient(120% 90% at 0% 0%, #8f7dff 0%, #6d5efc 38%, #3a2bb8 75%, #22186e 100%);
  position: relative; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; inset: auto -80px -120px auto; width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 65%);
}
.login-brand h1 { color: #fff; font-size: 34px; max-width: 14ch; }
.login-brand p { color: rgba(255, 255, 255, 0.82); max-width: 42ch; font-size: 15px; }
.login-brand ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 14px; color: rgba(255, 255, 255, 0.9); }
.login-brand li { display: flex; gap: 10px; align-items: center; }
.login-form { padding: 48px; display: flex; flex-direction: column; justify-content: center; max-width: 440px; width: 100%; margin: 0 auto; }
.login-form h2 { font-size: 24px; }
.error-text { color: var(--bad); font-size: 13px; margin: 10px 0 0; }
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { padding: 32px; }
  .login-form { padding: 32px 24px; }
}

/* --- Home ------------------------------------------------------------------ */

.hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin: 4px 0 28px; }
.hero h1 { font-size: 34px; }
.hero p { color: var(--muted); max-width: 62ch; margin: 8px 0 0; font-size: 15px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); min-width: 260px; }
.stat .label { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; }
.stat .value small { font-size: 13px; color: var(--muted); font-weight: 550; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } .hero h1 { font-size: 28px; } }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 32px; }
.project-card {
  display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.project-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.project-card .pc-top { display: flex; gap: 12px; align-items: center; }
.project-card .pc-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 750; font-size: 17px; flex: none; }
/* The game's logo as its picture: whole, on a light tile so dark and transparent logos both read. */
.project-card .pc-logo, .project-logo { object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 3px; }
.hero-title { display: flex; align-items: center; gap: 14px; }
.project-logo { width: 64px; height: 64px; border-radius: 14px; flex: none; }
.project-card h3 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-card .pc-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.progress span { height: 5px; border-radius: 999px; background: var(--surface-3); }
.progress span.on { background: var(--accent); }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--radius); margin-bottom: 32px; }

/* --- Project layout -------------------------------------------------------- */

.project-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; }
.sidebar { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.side-card h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 12px; font-weight: 700; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.stepper li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-size: 14px; color: var(--muted); position: relative; }
.stepper li .bullet { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 750; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-strong); flex: none; z-index: 1; }
.stepper li:not(:last-child)::after { content: ""; position: absolute; left: 14.5px; top: 28px; height: calc(100% - 20px); width: 1.5px; background: var(--line); }
.stepper li.done { color: var(--ink-2); }
.stepper li.done .bullet { background: var(--ok); border-color: var(--ok); color: #fff; }
.stepper li.done::after { background: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.stepper li.current { color: var(--ink); font-weight: 650; }
.stepper li.current .bullet { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-list button {
  width: 100%; justify-content: flex-start; gap: 10px; padding: 8px 10px; min-height: 36px; font-weight: 550; font-size: 14px;
  background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2);
}
.nav-list button:hover { background: var(--surface-2); color: var(--ink); }
.nav-list .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.nav-list .count.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.budget-line { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.budget-line strong { color: var(--ink); font-size: 18px; letter-spacing: -0.02em; }

.content, .sidebar > * { min-width: 0; }
@media (max-width: 1080px) {
  .project-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .sidebar { position: static; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
  .sidebar .side-nav { grid-column: 1 / -1; order: -1; padding: 10px; }
  .side-nav h4 { display: none; }
  .side-nav .nav-list { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: none; }
  .side-nav .nav-list li { flex: none; }
  .side-nav .nav-list button { width: auto; border: 1px solid var(--line); background: var(--surface); }
}
@media (max-width: 620px) {
  /* On phones the header card already shows where the project stands. */
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .sidebar .side-progress { display: none; }
  main { padding: 18px 14px 80px; }
  .card-head { padding: 16px; flex-wrap: wrap; }
  .card-head .actions { width: 100%; }
  /* The chevron stays on the title row; the buttons wrap below. */
  details.collapsible > summary .actions { order: 3; }
  .card-body { padding: 16px; }
  .project-hero { padding: 18px; }
  .project-hero h1 { font-size: 24px; }
  .project-logo { width: 48px; height: 48px; }
  .game-frame { height: 70vh; }
  .check-list li { flex-wrap: wrap; }
  .check-list li .msg { margin-left: 0; text-align: left; width: 100%; }
}

/* Project header */
.project-hero { padding: 24px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; background:
  radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 55%), var(--surface); }
.project-hero h1 { font-size: 30px; }
.project-hero .summary { color: var(--ink-2); margin: 8px 0 12px; max-width: 70ch; }
.next-step { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.next-step .xsmall { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--muted); }
@media (max-width: 760px) { .project-hero { grid-template-columns: 1fr; } .next-step { align-items: flex-start; text-align: left; } }

/* Questions */
.question { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin: 0 0 12px; background: var(--surface-2); }
.question .q-meta { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-soft-ink); margin-bottom: 6px; }
.question .q-text { font-weight: 650; font-size: 15px; margin-bottom: 4px; }
.question .q-why { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.question .options { margin: 8px 0 10px; }
.question .options button { min-height: 32px; padding: 6px 12px; font-size: 13px; border-radius: 999px; box-shadow: none; }
/* Questions and their answers can be long: they wrap inside the card instead of running past it. */
.question, .inline-q { min-width: 0; overflow-wrap: anywhere; }
.question .options button, .inline-q .options button { white-space: normal; text-align: left; max-width: 100%; height: auto; line-height: 1.35; border-radius: 16px; }
.question .options button.judgment, .inline-q .options button.judgment { white-space: nowrap; }
.question .options button.judgment { border-style: dashed; color: var(--muted); }
.answered { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.answered:last-child { border-bottom: 0; }

/* Spec */
.spec-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.spec-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.spec-box h3 { margin-bottom: 8px; }
.spec-box ol, .spec-box ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); }
.spec-box li { margin: 3px 0; }
.spec-components { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 14px; }
.spec-components .item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: var(--ink-2); }
.spec-components .item strong { display: block; color: var(--ink); font-size: 14px; }

/* Components */
.components { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.component { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; }
.component:hover { box-shadow: var(--shadow); }
.component.approved { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.component.needs_improvement { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.component .comp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 14px 14px 10px; }
.component .comp-top h3 { font-size: 15px; }
.component .comp-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.preview {
  margin: 0 14px; border-radius: 12px; min-height: 200px; display: flex; align-items: center; justify-content: center; padding: 14px;
  background: repeating-conic-gradient(var(--checker) 0 25%, var(--surface) 0 50%) 0 0 / 18px 18px; border: 1px solid var(--line);
}
.preview img { max-width: 100%; max-height: 320px; filter: drop-shadow(0 8px 16px rgba(18, 20, 42, 0.18)); }
.variants { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.variants img { height: 64px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; transition: transform 0.12s; }
.variants img:hover { transform: translateY(-2px); }
.variants img.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented button { box-shadow: none; min-width: 0; padding: 9px 8px; font-size: 13px; }
.feedback-note { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--ink-2); }
/* A component's design notes (UNP-53): what the studio remembers from the designer's feedback. */
.design-notes { font-size: 13px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--ink-2); margin-top: 8px; }
.design-notes.proposed { background: var(--surface-2); border: 1px dashed var(--line-strong); }
.design-notes .dn-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.design-notes .dn-head strong { display: inline-flex; align-items: center; gap: 6px; }
.design-notes .dn-head .btn-sm { margin-left: auto; }
.design-notes p { margin: 4px 0 6px; }
.design-notes ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.design-notes li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; border-radius: 6px; background: var(--surface, #fff); }
.design-notes li .icon-btn { flex: none; }

.notes { font-size: 13px; color: var(--muted); }

/* Game */
.frame-wrap { border-radius: 14px; border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); }
.frame-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.frame-bar .lights { display: flex; gap: 6px; }
.frame-bar .lights i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.frame-bar .lights i:nth-child(1) { background: #ff5f57; } .frame-bar .lights i:nth-child(2) { background: #febc2e; } .frame-bar .lights i:nth-child(3) { background: #28c840; }
.frame-bar .url { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.game-frame { display: block; width: 100%; height: 76vh; border: 0; background: #fff; }
.info-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14px; color: var(--ink-2); }
.info-box h3 { margin-bottom: 6px; }

/* Checks (BGA) */
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.check-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); }
.check-list li .path { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.check-list li .msg { color: var(--muted); margin-left: auto; text-align: right; }
.check-list li.bad { background: var(--bad-soft); }
.check-list li .icon.ok { color: var(--ok); } .check-list li .icon.bad { color: var(--bad); }

/* Screenshots on feedback */
.shots { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.shot { position: relative; margin: 0; width: 96px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-remove { position: absolute; top: 4px; right: 4px; width: 24px; min-height: 24px; height: 24px; padding: 0; border-radius: 50%; background: rgba(18, 20, 42, 0.72); color: #fff; border: 0; box-shadow: none; }
.shot-remove:hover { background: var(--bad); }
.shot-add { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 14px; min-height: 72px; border: 1.5px dashed var(--line-strong); border-radius: 10px; color: var(--muted); font-weight: 500; cursor: pointer; background: var(--surface-2); }
.shot-add:hover { border-color: var(--accent); color: var(--accent-soft-ink); background: var(--accent-soft); }
.shot-add strong { color: var(--ink); font-size: 13px; }
.shot-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.shot-thumbs img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* Component questions inside the card */
.inline-q { border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); background: var(--warn-soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.inline-q .q-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--warn); }
.inline-q .q-text { font-weight: 650; font-size: 14px; }
.inline-q .q-why { color: var(--muted); font-size: 12.5px; }
.inline-q .options button { min-height: 30px; padding: 5px 10px; font-size: 12.5px; border-radius: 999px; box-shadow: none; }
.inline-q .options button.judgment { border-style: dashed; color: var(--muted); }
.inline-q textarea { background: var(--surface); }

/* Look & feel */
.style-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 28px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; font-weight: 550; font-size: 13px; color: var(--ink-2); cursor: pointer; background: var(--surface); transition: border-color 0.15s, background 0.15s; }
.opt:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line-strong)); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-soft-ink); box-shadow: var(--ring); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.bg-opts .opt { flex-direction: column; gap: 6px; padding: 8px; width: 104px; }
.bg-swatch { width: 86px; height: 50px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); }
.bg-none { background: repeating-linear-gradient(45deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); }
.bg-plain { background: #e9e6df; }
.bg-felt { background: radial-gradient(circle at 30% 30%, #2f8a5a, #145236); }
.bg-wood { background: repeating-linear-gradient(100deg, #9b6a3f 0 6px, #8a5b33 6px 9px, #a7744a 9px 15px); }
.bg-parchment { background: radial-gradient(circle at 50% 40%, #f6ecd2, #e2cfa3); }
.bg-gradient { background: linear-gradient(135deg, #8a7dff, #ff9ec7); }
.bg-image { background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); position: relative; }
.bg-image::after { content: "🖼"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; }
.asset-opts .opt { padding: 4px; }
.asset-opts img { width: 84px; height: 56px; object-fit: cover; border-radius: 6px; display: block; }
.font-sample { font-size: 17px; font-weight: 700; line-height: 1; }
/* Table view choice: a tiny board, flat or tilted, with a stack of three discs. */
.view-opts .opt { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px; width: 150px; }
.view-opts .opt small { display: block; font-weight: 450; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.view-swatch { position: relative; display: block; width: 132px; height: 62px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); perspective: 260px; overflow: hidden; }
.view-swatch b { position: absolute; inset: 9px 22px; border-radius: 5px; background: linear-gradient(135deg, #c9b48a, #a88d5f); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.12); }
.view-swatch i { position: absolute; z-index: 1; left: 58px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.view-swatch i:nth-child(1) { top: 26px; } .view-swatch i:nth-child(2) { top: 24px; } .view-swatch i:nth-child(3) { top: 22px; }
.view-tilted b { transform: rotateX(42deg); transform-origin: 50% 70%; }
.view-tilted i { width: 15px; height: 9px; left: 58px; }
.view-tilted i:nth-child(1) { top: 34px; } .view-tilted i:nth-child(2) { top: 30px; } .view-tilted i:nth-child(3) { top: 26px; }
.font-modern { font-family: system-ui, sans-serif; } .font-classic { font-family: Georgia, "Times New Roman", serif; }
.font-playful { font-family: "Trebuchet MS", "Comic Sans MS", system-ui, sans-serif; } .font-elegant { font-family: "Didot", "Bodoni 72", Georgia, serif; font-weight: 400; font-style: italic; }
.font-none { opacity: 0.4; }
.color-field { display: flex; align-items: center; gap: 10px; }
input[type="color"] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); cursor: pointer; }
input[type="color"]:disabled { opacity: 0.35; cursor: not-allowed; }

/* Toast */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; align-items: center; gap: 10px;
  max-width: min(440px, calc(100% - 40px)); padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 550;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); animation: toast-in 0.22s ease-out;
}
.toast.error { background: var(--bad); color: #fff; }
.toast.success { background: var(--ok); color: #fff; }
/* Floating "Claude is working" indicator */
.ai-indicator {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 4px; max-width: min(560px, calc(100% - 32px)); padding: 5px;
  border-radius: 999px; background: var(--surface); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow: var(--shadow-lg); font-size: 14px; animation: ai-in 0.22s ease-out;
}
.ai-indicator:hover { border-color: var(--accent); }
.ai-link { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 10px 4px 9px; color: var(--ink); text-decoration: none; border-radius: 999px; }
.ai-link:hover { color: var(--ink); background: var(--surface-2); }
.ai-bell { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 0; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 650; background: var(--accent-soft); color: var(--accent-soft-ink); border: none; }
.ai-bell:hover { background: var(--accent); color: var(--accent-ink); }
.ai-dismiss { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 50%; background: none; border: none; color: var(--muted); }
.ai-dismiss:hover { background: var(--surface-2); color: var(--ink); }
.ai-indicator .spinner { color: var(--accent); }
.ai-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
.ai-text strong { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.ai-project { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.ai-more { flex: none; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-soft-ink); }
@keyframes ai-in { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
body.has-ai-indicator .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
body.has-ai-indicator main { padding-bottom: 72px; }
@media (max-width: 560px) {
  .ai-indicator { font-size: 13px; }
  .ai-bell span { display: none; }
  .ai-bell { width: 32px; padding: 0; justify-content: center; }
  .ai-text { flex-direction: column; align-items: flex-start; gap: 0; }
  .ai-text strong, .ai-project { max-width: 100%; }
  .ai-project { font-size: 12px; }
}

@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Designer's images matched to components ------------------------------- */
.art-panel { margin: 10px 0; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface); }
.art-panel > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; cursor: pointer; }
.art-panel > summary::-webkit-details-marker { display: none; }
.art-panel .link { color: var(--accent); font-weight: 650; white-space: nowrap; }
.art-panel[open] .link { visibility: hidden; }
.art-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.art-thumbs { display: inline-flex; gap: 4px; align-items: center; }
.art-thumbs img { width: 28px; height: 28px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); background: var(--checker); }
.art-form { padding: 0 10px 12px; border-top: 1px solid var(--line); }
.art-form select { width: 100%; }
.art-form .check { font-weight: 500; }
.art-variants { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 6px 10px; align-items: center; max-height: 260px; overflow: auto; }
.warn-text { color: var(--warn); font-weight: 600; }

/* --- Changing the rules ----------------------------------------------------- */
.change-rules { margin-top: 22px; padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.change-rules h3 { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.change-rules p { margin: 0 0 10px; }
/* The improved rulebook, under Rules as understood. */
.rb-improve { margin-top: 22px; padding: 16px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--radius-sm); background: var(--accent-soft); overflow-wrap: anywhere; }
.rb-improve h3 { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.rb-changes { margin: 0; padding-left: 22px; display: grid; gap: 8px; font-size: 14px; }
.rb-change-q { font-weight: 650; }
.rb-preview { margin-top: 12px; }
.rb-preview summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.rb-text { margin-top: 10px; max-height: 520px; overflow: auto; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; line-height: 1.6; }
.rb-text h2, .rb-text h3, .rb-text h4 { margin: 1em 0 0.4em; }
.rb-text table { border-collapse: collapse; margin: 8px 0; } .rb-text td, .rb-text th { border: 1px solid var(--line-strong); padding: 4px 8px; text-align: left; }
.rb-text blockquote { margin: 8px 0; padding-left: 10px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.rb-update { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.spec-edit-comp { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; background: var(--surface); }
.variants-table input { min-width: 90px; }
.variants-table td { vertical-align: middle; }
.new-field { max-width: 200px; }
.outdated-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0; padding: 8px 10px; border-radius: var(--radius-xs); background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.outdated-note .btn-sm { margin-left: auto; }

/* --- Pieces cut out of an image that shows several components ---------------- */
.file-list li.has-tools { flex-wrap: wrap; }
.piece-tools { flex-basis: 100%; padding-left: 52px; display: grid; gap: 8px; min-width: 0; }
.piece-tools .row { gap: 6px; }
.piece-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.piece { position: relative; margin: 0; width: 72px; }
.piece img { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: var(--checker); display: block; }
.piece img.unused { border-color: var(--warn); border-style: dashed; }
.piece figcaption { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
@media (max-width: 520px) { .piece-tools { padding-left: 0; } }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(12, 14, 22, 0.55); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(960px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 18px 20px; }
.modal-head { margin-bottom: 8px; }
.modal-head h3 { display: flex; align-items: center; gap: 8px; }
.crop-stage { position: relative; user-select: none; touch-action: none; cursor: crosshair; border-radius: 8px; overflow: hidden; background: var(--checker); line-height: 0; width: fit-content; max-width: 100%; margin: 0 auto; }
.crop-stage img { max-width: 100%; max-height: 60vh; width: auto; height: auto; display: block; pointer-events: none; }
.crop-box, .crop-new { position: absolute; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); pointer-events: none; }
.crop-box span { position: absolute; left: 0; top: 0; background: var(--accent); color: var(--accent-ink); font-size: 11px; line-height: 1.4; padding: 1px 6px; border-bottom-right-radius: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crop-new { border-style: dashed; border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.crop-actions { margin-top: 12px; }
.crop-actions .crop-label { flex: 1; min-width: 160px; }

/* --- Account: top bar navigation, credits, team, admin ---------------------- */
.account-nav { display: flex; align-items: center; gap: 2px; }
.account-nav a { padding: 6px 10px; border-radius: 8px; color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.account-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.credits-chip { white-space: nowrap; flex-shrink: 0; max-width: none !important; }
@media (max-width: 1040px) { .user-email { display: none; } }
.credits-chip:hover { text-decoration: none; filter: brightness(0.97); }
@media (max-width: 720px) { .avatar { display: none; } }
@media (max-width: 520px) {
  .account-nav a { padding: 6px 6px; font-size: 12.5px; }
  .topbar-right { gap: 6px; }
  .user { gap: 4px; }
}
@media (max-width: 420px) { .credits-chip { display: none; } }

.banner:not(.busy):not(.error):not(.ok):not(.warn) { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 20%, transparent); }
.banner.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.banner a { color: inherit; text-decoration: underline; }

.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.pack { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.pack-name { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.pack-credits { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.pack-credits small { font-size: 13px; color: var(--muted); font-weight: 550; }
.pack-price { font-size: 15px; color: var(--ink-2); font-weight: 600; margin-bottom: 8px; }
.pack-price small { font-size: 12px; color: var(--muted); font-weight: 550; }
.pack button { margin-top: auto; }

/* Sign-in providers, demo requests */
.providers { display: grid; gap: 10px; margin-top: 18px; }
.providers .btn { justify-content: center; width: 100%; gap: 10px; text-decoration: none; }
.provider-google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.provider-google:hover { background: #f8f9fa; }
.provider-apple { background: #000; color: #fff; border: 1px solid #000; }
.provider-apple:hover { background: #1a1a1a; }
.or { display: flex; align-items: center; gap: 10px; margin: 18px 0 2px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.demo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.demo-list li { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.demo-list li.handled { opacity: 0.6; }
.demo-list .demo-head { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.demo-list .demo-head .muted { margin-left: auto; }
.demo-list p { margin: 6px 0 8px; white-space: pre-wrap; }

/* Legal: footer, acceptance, purchase consent */
.site-footer { max-width: 1240px; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; color: var(--muted); font-size: 12.5px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--muted); }
/* Analytics consent (analytics.js): a card at the bottom until answered. */
.consent { position: fixed; left: 16px; bottom: 16px; z-index: 60; max-width: 420px; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13.5px; }
.consent[hidden] { display: none; }
.consent p { margin: 0 0 10px; color: var(--ink-2); }
.consent-actions { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 520px) { .consent { left: 12px; right: 12px; max-width: none; } }
.site-footer a:hover { color: var(--ink); }
.terms-check { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 0; font-weight: 500; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.terms-check input, .purchase-consent input { margin-top: 2px; flex-shrink: 0; }
.signup-terms .terms-check { margin-top: 18px; }
.plan .plan-cancel { display: block; margin: 10px auto 0; font-size: 13px; color: var(--muted); }
.plan .plan-cancel:hover { color: var(--bad); }
.plan .plan-next { margin: 0; text-align: center; }
.purchase-consent { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 13.5px; font-weight: 500; line-height: 1.5; color: var(--ink-2); transition: box-shadow 0.2s, border-color 0.2s; }
/* Purchase confirmation: what it is, the price, the consent, then go. */
.modal.purchase-modal { width: min(480px, 100%); padding: 22px 24px; }
.purchase-modal h3 { margin: 0; font-size: 19px; }
.purchase-price { margin: 12px 0 4px; font-size: 28px; font-weight: 750; letter-spacing: -0.02em; }
.purchase-price small { font-size: 14px; font-weight: 550; color: var(--muted); }
.purchase-lines { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 8px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.purchase-lines li { display: flex; gap: 8px; align-items: flex-start; }
.purchase-lines .icon { color: var(--ok); margin-top: 2px; flex: none; }
.purchase-modal .purchase-consent { margin: 0 0 16px; background: var(--surface-2); }
.purchase-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.purchase-actions .primary[disabled] { opacity: 0.5; }
.terms-modal { max-width: 520px; }
.terms-modal h3 { margin: 0 0 8px; }

/* Plans */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.plan { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-soft); }
.plan-price { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; }
.plan-price small { font-size: 13px; color: var(--muted); font-weight: 550; }
.plan-perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); flex: 1; }
.plan-perks li { display: flex; gap: 8px; align-items: flex-start; }
.plan-perks .icon { color: var(--ok); margin-top: 2px; flex-shrink: 0; }
.plan-status { margin: 0 0 14px; }
.plan .plan-billed { font-size: 12.5px; margin-top: -6px; }
.billing-toggle { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.billing-toggle button { border: 0; background: transparent; min-height: 32px; padding: 6px 14px; border-radius: 999px; font-weight: 600; color: var(--muted); box-shadow: none; }
.billing-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.billing-toggle .chip { margin-left: 4px; }
.auto-topup-fields { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 12px; }
.auto-topup-fields label { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 500; }
.auto-topup-fields input[type="number"] { width: 110px; }
.auto-topup-fields .nowrap { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.auto-topup-fields select { max-width: 100%; }
.billing-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.billing-card > div { flex: 1; min-width: 160px; }
.section-icon.accent { background: var(--accent-soft); color: var(--accent-soft-ink); }
.upgrade { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.upgrade > div { flex: 1; min-width: 200px; }
.upgrade .btn { margin-left: auto; }

.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row > div { flex: 1 1 200px; min-width: 0; }
.form-row > .form-row-btn { flex: 0 0 auto; }
.form-row label { margin-top: 0; }

.link-box { display: flex; gap: 8px; min-width: 0; }
.link-box input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; }
/* A pending invitation's link, under its email (UNP-57). */
.invite-link { margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.invite-link .link-box { flex: 1; min-width: 220px; }

table.data td.pos { color: var(--ok); font-weight: 650; }
table.data td.neg { color: var(--bad); font-weight: 650; }
.packs-table input { min-width: 80px; }
.packs-table td { vertical-align: middle; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- Playtesting Analytics ----------------------------------------------------------------------- */
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-soft-ink); text-decoration: underline; cursor: pointer; font: inherit; box-shadow: none; }
.link-btn:hover { background: none; color: var(--accent); }
table.data td.wrap { white-space: normal; min-width: 220px; }
.addon { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 10px; }
.addon.current { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.addon-text { flex: 1; min-width: 220px; }
.addon-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.pt-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.pt-filters select { width: auto; min-width: 140px; }
/* Bot simulations: the games play in frames nobody sees (kept in the viewport so browsers keep running them). */
.sim-frame { position: fixed; left: 0; top: 0; width: 1200px; height: 800px; border: 0; opacity: 0; pointer-events: none; z-index: -1; }
.sim-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.sim-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.sim-choices { display: flex; flex-wrap: wrap; gap: 6px 16px; border: 0; padding: 0; margin: 12px 0; }
.sim-choices legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: 6px; width: 100%; }
.sim-choices label { display: inline-flex; align-items: center; gap: 6px; }
.sim-progress { display: grid; gap: 12px; }
.sim-progress .meter { height: 8px; }
.pt-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pt-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.pt-tile .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.pt-tile .value { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.pt-tile .value small { font-size: 13px; color: var(--muted); font-weight: 550; }
.pt-tile.warn { border-left: 3px solid var(--warn); }
.pt-tile.bad { border-left: 3px solid var(--bad); }
.pt-meter { display: block; height: 6px; margin: 6px 0 4px; border-radius: 3px; background: color-mix(in srgb, var(--ok) 18%, var(--surface-2)); overflow: hidden; }
.pt-meter span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }

/* Playtests charts. Single series: the accent; a second series is a lighter step of it; outcomes use the status colours,
   always with their names beside them. Marks: bars at most 24px thick with 4px rounded ends, 2px gaps; recessive axes. */
.pt-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin: 0 0 10px; }
.pt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pt-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw.part, .sw.more { background: var(--accent); }
.sw.rest { background: color-mix(in srgb, var(--accent) 38%, var(--surface)); }
.sw.less { background: var(--chart-warm); }
.sw.ok { background: var(--ok); } .sw.warn { background: var(--warn); } .sw.bad { background: var(--bad); } .sw.info { background: var(--info); }
.pt-outcome { margin: 0 0 16px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.pt-outcome .pt-legend { margin: 10px 0 0; }
.pt-stack { display: flex; gap: 2px; height: 14px; }
.pt-stack .seg { min-width: 3px; }
.pt-stack .seg:first-child { border-radius: 4px 0 0 4px; } .pt-stack .seg:last-child { border-radius: 0 4px 4px 0; } .pt-stack .seg:only-child { border-radius: 4px; }
.seg.ok { background: var(--ok); } .seg.warn { background: var(--warn); } .seg.bad { background: var(--bad); } .seg.info { background: var(--info); }
.seg:hover { filter: brightness(1.12); }

.vc { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.vc-axis { display: flex; flex-direction: column; justify-content: space-between; height: 160px; font-size: 10.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; margin: -6px 0; }
.vc-plot { position: relative; height: 160px; }
.vc-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.vc-grid i { display: block; border-top: 1px solid var(--line); }
.vc-grid i:last-child { border-top-color: var(--line-strong); }
.vc-cols { position: absolute; inset: 0; display: flex; gap: 2px; align-items: flex-end; }
.vc-col { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.vc-bar { width: 100%; max-width: 24px; min-height: 1px; background: var(--accent); border-radius: 4px 4px 0 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.vc-bar.two { background: color-mix(in srgb, var(--accent) 38%, var(--surface)); }
.vc-bar.hi { background: var(--accent-soft-ink); }
.vc-part { width: 100%; background: var(--accent); }
.vc-col:hover .vc-bar { filter: brightness(1.12); }
.vc-x { display: flex; gap: 2px; margin-top: 4px; }
.vc-x span { flex: 1; min-width: 0; text-align: center; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: visible; }

.hbar-track { height: 10px; }
.dbars { display: grid; gap: 6px; }
.dbar { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.dbar-track { position: relative; height: 12px; }
.dbar-track .mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-strong); }
.dbar-fill { position: absolute; top: 0; bottom: 0; }
.dbar-fill.more { background: var(--accent); border-radius: 0 4px 4px 0; }
.dbar-fill.less { background: var(--chart-warm); border-radius: 4px 0 0 4px; }
.dbar:hover .dbar-fill { filter: brightness(1.12); }

.pt-mini { position: relative; display: inline-block; width: 64px; height: 8px; border-radius: 4px; background: var(--surface-2); vertical-align: middle; margin-right: 6px; }
.pt-mini > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.pt-mini > i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); }
.pt-players td { white-space: nowrap; }
.pt-tip { position: absolute; z-index: 90; max-width: 280px; padding: 7px 10px; border-radius: 8px; background: var(--ink); color: var(--surface); font-size: 12.5px; line-height: 1.35; pointer-events: none; box-shadow: var(--shadow); }
.pt-tip[hidden] { display: none; }
.sim-where { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 10px; border: 0; padding: 0; margin: 0 0 14px; }
.sim-where legend { font-weight: 650; margin-bottom: 8px; padding: 0; }
.sim-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.sim-option:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.sim-option input { margin-top: 3px; }
.why { margin-top: 4px; }
/* What players said */
.pt-feedback { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 24px; }
@media (max-width: 760px) { .pt-feedback { grid-template-columns: 1fr; } }
.pt-big { font-size: 32px; font-weight: 750; letter-spacing: -0.02em; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.pt-big small { font-size: 14px; font-weight: 550; color: var(--muted); }
.pt-comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pt-comments li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-xs); }
.pt-fun { flex: none; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-weight: 750; font-size: 12px; background: var(--accent-soft); color: var(--accent-soft-ink); }
/* Compare builds: build A a lighter step of the accent, build B the accent; the change says better or worse in words. */
.pt-compare td:first-child { white-space: nowrap; }
.pt-compare td:nth-child(2) { width: 60%; }
.pt-pair { display: grid; gap: 3px; min-width: 160px; }
.pt-pair-row { display: grid; grid-template-columns: 1fr 64px; align-items: center; gap: 8px; }
.pt-pair-bar { display: block; height: 8px; border-radius: 0 4px 4px 0; min-width: 0; }
.pt-pair-bar.a { background: color-mix(in srgb, var(--accent) 38%, var(--surface)); }
.pt-pair-bar.b { background: var(--accent); }
.pt-pair-val { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-pair-line { display: grid; grid-template-columns: minmax(70px, 30%) 1fr; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.pt-delta { font-size: 12.5px; font-weight: 650; white-space: nowrap; color: var(--ink-2); }
.pt-delta.ok { color: var(--ok); }
.pt-delta.bad { color: var(--bad); }
/* The designer's own feedback questions */
.pt-qpanel { margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.pt-qlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pt-qlist li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xs); font-size: 14px; }
.pt-qtext { flex: 1; min-width: 160px; }
.pt-qactions { display: flex; gap: 4px; margin-left: auto; }
.pt-qform { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pt-qlib { margin-top: 14px; }
.pt-qlib summary { cursor: pointer; font-weight: 650; margin-bottom: 8px; }
.pt-qresults { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.pt-qresult { min-width: 0; }
.why summary { cursor: pointer; color: var(--muted); }
/* Admin > organization > Customer value: labels wrap on narrow screens, amounts don't. */
table.value-table td:first-child { white-space: normal; }
.pt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.pt-grid > .card { margin-bottom: 0; }
.pt-grid + .card, .pt-grid + .pt-grid, .card + .pt-grid { margin-top: 16px; }
.pt-chart .card-head { padding-bottom: 4px; }
.cols { display: flex; align-items: flex-end; gap: 2px; height: 160px; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.col-track { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line-strong); }
.col-fill { width: 100%; max-width: 36px; margin: 0 auto; background: color-mix(in srgb, var(--accent) 45%, var(--surface)); border-radius: 4px 4px 0 0; display: flex; align-items: flex-end; min-height: 2px; }
.col-part { width: 100%; background: var(--accent); border-radius: 0; }
.col:hover .col-fill { outline: 2px solid var(--accent-soft-ink); outline-offset: 1px; }
.col-label { font-size: 10px; color: var(--muted); text-align: center; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.cols-scale { display: flex; justify-content: space-between; margin-top: 4px; }
.hbars { display: grid; gap: 6px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar-track { position: relative; height: 12px; background: var(--surface-2); border-radius: 4px; }
.hbar-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; min-width: 2px; }
.hbar-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); }
.hbar:hover .hbar-fill { background: var(--accent-hover); }
.hbar-value { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.meter-inline { display: inline-block; width: 70px; height: 8px; border-radius: 4px; background: var(--surface-2); vertical-align: middle; overflow: hidden; }
.meter-inline span { display: block; height: 100%; background: var(--accent); }
.pt-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pt-facts > div { display: flex; flex-direction: column; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-xs); }
.pt-facts strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.pt-report { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; }
.pt-report summary { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; cursor: pointer; font-weight: 650; font-size: 14px; }
.pt-summary { font-size: 15px; margin: 12px 0 4px; }
.pt-findings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; margin-top: 12px; }
.pt-findings { border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); border-top: 3px solid var(--line-strong); }
.pt-findings.ok { border-top-color: var(--ok); }
.pt-findings.warn { border-top-color: var(--warn); }
.pt-findings.info { border-top-color: var(--info); }
.pt-findings h4 { margin: 0 0 8px; }
.finding + .finding { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.finding p { margin: 4px 0 0; font-size: 14px; }
.finding .suggestion { color: var(--accent-soft-ink); }
.pt-modal { width: min(1100px, 100%); }
.pt-log { max-height: 65vh; overflow: auto; }
.pt-stack { font-size: 11px; white-space: pre-wrap; max-width: 640px; margin: 4px 0 0; }
.pt-danger { margin: 20px 0 0; display: flex; align-items: center; gap: 6px; }
.empty-note { display: flex; gap: 12px; align-items: flex-start; }
@media (max-width: 640px) {
  .hbar { grid-template-columns: minmax(70px, 30%) 1fr auto; }
  .addon-side { align-items: flex-start; width: 100%; }
}
.btn.locked { color: var(--muted); }
.btn.locked .chip { padding: 0 6px; font-size: 11px; }

/* --- Email confirmation and password reset ---------------------------------------------------------- */
.forgot-link { margin: 8px 0 0; text-align: right; font-size: 13px; }
.check-inbox { max-width: 520px; margin: 48px auto; text-align: center; }
.check-inbox .section-icon { margin: 4px auto 12px; }
.check-inbox h1 { font-size: 24px; margin: 0 0 10px; }

/* --- Guided tour and practice game ------------------------------------------------------------------- */
.help-btn { width: 32px; height: 32px; min-width: 32px; min-height: 32px; flex: none; aspect-ratio: 1; line-height: 1; padding: 0; border-radius: 50%; font-weight: 750; font-size: 15px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-soft-ink); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.help-btn:hover { background: var(--accent); color: var(--accent-ink); }
.chat-btn .icon { width: 16px; height: 16px; }
/* On small screens the chat is in the "?" menu. */
@media (max-width: 640px) { .chat-btn { display: none; } }
.help-menu { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 6px; min-width: 240px; display: grid; }
.help-menu button, .help-menu a { all: unset; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-xs); cursor: pointer; font-size: 14px; color: var(--ink); }
.help-menu button:hover, .help-menu a:hover, .help-menu button:focus-visible, .help-menu a:focus-visible { background: var(--surface-2); }
.help-sep { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px 10px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.practice-banner { background: var(--accent-soft); color: var(--accent-soft-ink); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
#tour { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.tour-shade { position: fixed; background: rgba(12, 14, 22, 0.55); pointer-events: auto; }
.tour-ring { position: fixed; border-radius: 12px; box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent); pointer-events: none; transition: all 0.18s ease; }
.tour-pop { position: fixed; width: min(380px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px 16px 12px; pointer-events: auto; transition: left 0.18s ease, top 0.18s ease; }
.tour-pop.docked { width: calc(100vw - 16px); max-height: 46vh; overflow: auto; }
.tour-top { display: flex; align-items: center; gap: 8px; }
.tour-chapter { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-soft-ink); font-weight: 700; }
.tour-count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tour-pop h3 { margin: 6px 0 6px; font-size: 17px; }
.tour-body p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; }
.tour-try { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 8px 10px; border-radius: var(--radius-xs); background: var(--accent-soft); color: var(--accent-soft-ink); margin: 4px 0 8px; }
.tour-try.done { background: var(--ok-soft); color: var(--ok); }
.tour-bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin: 8px 0 10px; overflow: hidden; }
.tour-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.2s; }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-actions > :last-child { margin-left: auto; }
.tour-back-ic { transform: rotate(180deg); }
.tour-chapters { position: relative; }
.tour-chapters summary { list-style: none; cursor: pointer; }
.tour-chapters summary::-webkit-details-marker { display: none; }
.tour-chapter-list { position: absolute; bottom: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 4px; display: grid; min-width: 200px; z-index: 1; }
.tour-chapter-list button { all: unset; padding: 7px 10px; border-radius: var(--radius-xs); font-size: 13px; cursor: pointer; }
.tour-chapter-list button:hover, .tour-chapter-list button:focus-visible { background: var(--surface-2); }
.tour-chapter-list button.on { font-weight: 700; color: var(--accent-soft-ink); }
@media (prefers-reduced-motion: reduce) { .tour-ring, .tour-pop, .tour-bar span { transition: none; } }

/* --- Arrange & select (the built game) -------------------------------------------------------------- */
.arrange-intro { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.arrange-bar { border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); color: var(--ink); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
.frame-wrap.arranging { outline: 3px solid var(--accent); outline-offset: 2px; }
.arrange-selection { margin-top: 10px; padding: 12px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: var(--radius-sm); background: var(--surface); }
.arrange-selection textarea { min-height: 64px; }

/* --- Plans: who each is for, value, badges ----------------------------------------------------------- */
.plan { position: relative; }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow); }
.plan-badge { position: absolute; top: -11px; left: 18px; font-size: 11px; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.plan-badge.max { background: var(--ink); color: var(--surface); }
.plan-line { margin: -4px 0 0; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.plan-value { font-size: 12.5px; line-height: 1.45; color: var(--ok); background: var(--ok-soft); border-radius: var(--radius-xs); padding: 6px 9px; }
.plan-value .icon { vertical-align: -2px; margin-right: 2px; }
.plan .plan-perks { align-content: start; }
.plan-promises { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 16px 0 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.plan-promises li { display: flex; gap: 6px; align-items: center; }
.plan-promises .icon { color: var(--ok); }
.bga-disclaimer { margin: 12px 0 0; line-height: 1.5; }
.bga-licence { margin: 0 0 16px; }
.plan-grid { padding-top: 6px; }

/* --- My account ------------------------------------------------------------------------------------ */
.topbar .user-link, .topbar .user-link:hover { text-decoration: none; }
.user-link { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; border-radius: 999px; padding: 2px 8px 2px 2px; }
.user-link:hover { background: var(--surface-2); }
button.danger { background: var(--bad); color: #fff; border-color: transparent; }
button.danger:hover { background: color-mix(in srgb, var(--bad) 85%, black); }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.arrange-bar.playing { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.arrange-mode button { min-width: 96px; }
.arrange-notes { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.arrange-notes h3 { margin: 0 0 8px; font-size: 14px; }
.note-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.note-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.note-list li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.note-num { flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #f59e0b; color: #1f1300; font: 700 12px/22px system-ui, sans-serif; text-align: center; }
.applied-notes { margin: 6px 0 0; padding-left: 18px; }
.check-note { margin: 6px 0 0; color: var(--muted); }
.check-note.ok { color: var(--ok); }
.check-note.warn { color: var(--warn); }
.check-note summary { cursor: pointer; }
.check-note .icon-sm { vertical-align: -2px; }
.test-findings { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); word-break: break-word; }

/* Playtest replays */
.pt-modal.pt-replay { width: min(1400px, 100%); }
.replay-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 16px; align-items: start; margin-top: 8px; }
.replay-frame { height: min(62vh, 640px); }
.replay-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.replay-controls .icon-btn.primary-ish { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.replay-range { flex: 1; min-width: 140px; accent-color: var(--accent); }
.replay-controls select { width: auto; min-height: 34px; padding: 4px 8px; }
.replay-pos { white-space: nowrap; font-variant-numeric: tabular-nums; }
.replay-log { max-height: min(72vh, 760px); overflow: auto; }
.pt-replay .replay-log { margin-top: 0; }
.replay-log tr[data-seq] { cursor: pointer; }
.replay-log tr.current td { background: var(--accent-soft); }
.replay-log tr.past td { color: var(--muted); }
@media (max-width: 980px) { .replay-grid { grid-template-columns: 1fr; } .replay-log { max-height: 40vh; } }
.replay-controls .icon-btn { color: var(--ink-2); }
.replay-controls .icon-btn:hover { background: var(--accent-soft); color: var(--accent-soft-ink); }
.replay-controls .icon-btn.primary-ish:hover { background: var(--accent-hover); color: var(--accent-ink); }

/* Public site (Game hosting) */
.host-address { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.host-address:focus-within { box-shadow: var(--ring); border-color: var(--accent); }
.host-prefix { display: flex; align-items: center; padding: 0 4px 0 12px; color: var(--muted); font-size: 14px; white-space: nowrap; background: var(--surface-2); border-right: 1px solid var(--line); padding-right: 8px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.host-address input { border: 0; box-shadow: none; border-radius: 0; min-width: 0; flex: 1; }
.host-address input:focus { box-shadow: none; }

/* Beta badge next to the logo (and on the sign-in page); opens what beta means. */
.beta-pill {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font: 700 11px/1.5 inherit; font-family: inherit;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; flex: none; box-shadow: none; min-height: 0;
}
button.beta-pill:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.beta-pill.on-dark { color: #fff; border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.14); }
.login-brand-row { display: flex; align-items: center; gap: 10px; }
.beta-modal { width: min(520px, 100%); padding: 22px 24px; }
.beta-modal h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.beta-modal h3 .beta-pill { cursor: default; }
.beta-modal ul { padding-left: 20px; margin: 8px 0 12px; }
.beta-modal li { margin: 4px 0; }

/* Tips for uploading art, under the art drop zones. */
.art-tips { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm, 10px); background: var(--surface-2, transparent); }
.art-tips summary { cursor: pointer; padding: 10px 14px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.art-tips summary::-webkit-details-marker { display: none; }
.art-tips summary::after { content: "Show"; margin-left: auto; font-weight: 500; font-size: 12px; color: var(--accent); }
.art-tips[open] summary::after { content: "Hide"; }
.art-tips ul { margin: 0; padding: 0 16px 12px 34px; font-size: 13.5px; color: var(--ink-2, var(--ink)); }
.art-tips li { margin: 6px 0; line-height: 1.5; }
.art-tips code { font-size: 12.5px; }
@media (max-width: 520px) {
  .topbar .beta-pill { font-size: 9px; padding: 1px 5px; letter-spacing: 0.04em; margin-left: -4px; }
}

/* Admin → AI instructions */
.instr-list { display: grid; gap: 10px; }
.instr { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.instr.open { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.instr-head { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 14px 18px; cursor: pointer; white-space: normal; }
.instr-head:hover { background: var(--surface-2); }
.instr-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.instr-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.instr-body { padding: 4px 18px 18px; overflow-wrap: anywhere; }
.instr-text { width: 100%; min-height: 360px; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.instr-history ul { list-style: none; margin: 0; padding: 0; }
.instr-history li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.instr-history h4 { margin: 16px 0 6px; }
.instr-diff { margin-top: 8px; }
.instr-diff summary { cursor: pointer; font-weight: 600; }
.diff { margin-top: 6px; max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); }
.diff > div { display: flex; gap: 8px; padding: 1px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff > div > span { flex: none; width: 1ch; color: var(--muted); }
.diff-add { background: var(--ok-soft); }
.diff-del { background: var(--bad-soft, #fde8e8); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.diff-skip { color: var(--muted); font-style: italic; background: var(--surface-2); }

/* Deleting a game */
.delete-game { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--line)); border-radius: var(--radius); }
.delete-game p { margin: 2px 0 0; }
.delete-game button.btn-sm.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.delete-game button.btn-sm.danger:hover:not(:disabled) { background: var(--bad-soft); }
.delete-game.clone-game { border-color: var(--line); margin-top: 24px; }
.delete-modal { width: min(500px, 100%); padding: 22px 24px; }
.delete-modal h3 { display: flex; align-items: center; gap: 8px; color: var(--bad); margin-bottom: 8px; }
.delete-list { margin: 8px 0 10px; padding-left: 20px; }
.delete-list li { margin: 4px 0; }

/* Renaming a game, next to its name */
.rename-btn { flex: none; width: 32px; min-height: 32px; height: 32px; padding: 0; border-radius: 50%; color: var(--muted); box-shadow: none; }
.rename-btn:hover { color: var(--accent); background: var(--accent-soft); }
.rename-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.rename-form input { flex: 1 1 240px; min-width: 0; font-size: 22px; font-weight: 700; padding: 6px 10px; }

/* Screen preview (public/screenpreview.js): the screen choices, and the preview's frame sized for the device */
.plan-choices { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 14px; }
.plan-choice { display: flex; flex-direction: column; gap: 4px; }
.plan-choice-label { font-size: 12px; font-weight: 650; color: var(--muted); }
.plan-choice .plan-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.plan-choice .plan-seg button { border: 0; border-radius: 0; min-height: 32px; padding: 4px 12px; font-size: 13px; box-shadow: none; background: var(--surface); }
.plan-choice .plan-seg button + button { border-left: 1px solid var(--line); }
.plan-choice .plan-seg button.on { background: var(--accent); color: #fff; }
.arrange-tip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-soft-ink); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.arrange-tip > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 280px; }
.preview-frame { margin: 0 auto; }
.preview-frame.phone { max-width: 420px; }
.preview-frame.phone .game-frame { aspect-ratio: 9 / 16; height: auto; }
.preview-frame.tablet { max-width: 1000px; }
.preview-frame.tablet .game-frame { aspect-ratio: 4 / 3; height: auto; }
.preview-frame.desktop .game-frame { aspect-ratio: 16 / 10; height: auto; }
.preview-new { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.preview-new summary { cursor: pointer; font-size: 14px; font-weight: 600; margin-bottom: 10px; }

/* Public site: own address and embedding (public/domains.js) */
.domain-box { margin-top: 14px; }
.domain-box h3 { display: flex; align-items: center; gap: 6px; }
.dns-table td { vertical-align: middle; white-space: normal; overflow-wrap: anywhere; }
.dns-table tr.dns-why td { border-bottom: 1px solid var(--line); padding-top: 0; }
.dns-table tr:not(.dns-why) td { border-bottom: 0; }
.domain-auto { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.domain-auto summary { cursor: pointer; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.embed-code { width: 100%; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Admin → AI calls */
.call-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.call-filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); margin: 0; }
.call-filters label.grow { flex: 1; min-width: 180px; }
table.data.calls tr.call-row { cursor: pointer; }
table.data.calls tr.call-row:hover td { background: var(--surface-2); }
.call-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 18px; font-size: 14px; }
.call-facts .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.call-block { border-top: 1px solid var(--line); padding: 10px 0; }
.call-block:first-child { border-top: 0; padding-top: 0; }
.call-block summary { cursor: pointer; }
.call-text { margin: 0; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--surface-2); border-radius: 8px; padding: 12px; }

/* Live progress of a running job */
.progress-line { margin-top: 4px; display: grid; gap: 4px; }
.progress-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; max-width: 360px; }
.progress-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 1.5s ease; }

/* Live games in the studio (Playtests page) */
.live-games { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.live-games h4 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; }
.live-games ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.live-games li { display: flex; align-items: center; gap: 10px; }
.live-games .who { flex: 1; min-width: 0; display: grid; }
.live-games .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5484d; margin-right: 8px; box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.6); animation: live-pulse 1.8s infinite; }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 8px rgba(229, 72, 77, 0); } 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* Tabletop Simulator / Screentop export */

/* Tabletop setup editor */
/* Tabletop export: three steps (what each component becomes, where things start, the files). */
#sec-tabletop .card-body { container-type: inline-size; }
.tt-status { margin: -2px 0 8px 38px; font-size: 12.5px; color: var(--muted); }
.tt-step { display: flex; align-items: flex-start; gap: 12px; margin: 22px 0 10px; }
.tt-step h4 { margin: 2px 0 2px; font-size: 15px; }
.tt-step p { margin: 0; font-size: 12.5px; color: var(--muted); }
.tt-num { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 750; font-size: 13px; }
.tt-locked { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-soft-ink); font-size: 13px; font-weight: 600; }

/* Step 1: a grid with headings when wide, a small card per component when narrow. */
.tt-comp-list { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.tt-comp-head, .tt-comp-row { display: grid; grid-template-columns: minmax(110px, 0.9fr) repeat(var(--tt-cols), minmax(0, 1fr)); gap: 8px; align-items: center; padding: 7px 12px; }
.tt-comp-head { background: var(--surface-2); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tt-comp-row { border-top: 1px solid var(--line); }
.tt-comp-row.joined { background: var(--surface-2); }
.tt-cname { display: grid; line-height: 1.25; min-width: 0; }
.tt-cname strong { overflow-wrap: anywhere; }
.tt-cname span { font-size: 12px; color: var(--muted); }
.tt-cell { min-width: 0; }
.tt-cell select { width: 100%; min-width: 0; min-height: 34px; padding: 5px 26px 5px 9px; font-size: 13px; background-position: right 7px center; text-overflow: ellipsis; }
.tt-cell-label { display: none; }
.tt-none { color: var(--muted); }
.tt-as { font-size: 12px; color: var(--muted); font-style: italic; }
@container (max-width: 640px) {
  .tt-comp-head { display: none; }
  /* Nothing to choose: left out on a small screen (a card type shuffled into a deck says so in its "In deck"). */
  .tt-cell:has(> .tt-none), .tt-cell:has(> .tt-as) { display: none; }
  .tt-comp-row { grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px; }
  .tt-cname { grid-column: 1 / -1; }
  .tt-cell-label { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 650; color: var(--muted); }
}

/* Step 2: the AI's help, then the board with its tools. */
.tt-ai { display: grid; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.tt-ai-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.tt-ai-ask label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 650; }
.tt-ai-ask-row { display: flex; gap: 8px; align-items: flex-start; }
.tt-ai-ask-row textarea { flex: 1; min-width: 0; resize: vertical; background: var(--surface); }
.tt-ai-ask-row .btn-sm { flex: none; }
@container (max-width: 640px) {
  .tt-ai-ask-row { flex-direction: column; align-items: stretch; }
}
.tt-report { margin: 10px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); border-left: 4px solid var(--ok); font-size: 13px; }
.tt-report.none { border-left-color: var(--warn); }
.tt-board-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0 10px; }
.tt-board-tools > select { width: auto; max-width: 100%; }
.tt-hands { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.tt-tools-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
.tt-hand { display: inline-flex; align-items: center; gap: 6px; min-height: 0; max-width: 100%; text-align: left; white-space: normal; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.tt-hand.selected { outline: 3px solid #fbbf24; outline-offset: 1px; }
/* On a narrow screen the board keeps a workable size and scrolls sideways. */
.tt-stage-scroll { overflow-x: auto; border-radius: var(--radius-sm); }
@container (max-width: 640px) {
  .tt-stage { min-width: 600px; }
}
.tt-hint { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.tt-hint .icon { flex: none; margin-top: 2px; }
.tt-selected { margin-top: 10px; padding: 10px 12px; border: 2px solid #fbbf24; border-radius: var(--radius-sm); background: var(--surface); }
.tt-selected-title { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tt-selected-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.tt-selected label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
.tt-selected input[type="number"] { width: 70px; }
.tt-selected input[type="text"] { width: 150px; }
/* Saving: always in view at the bottom while there are unsaved changes. */
.tt-savebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.tt-savebar-text { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: 13px; color: var(--muted); }
.tt-savebar:not(.dirty) .tt-savebar-text .icon { color: var(--ok); }
.tt-savebar.dirty { position: sticky; bottom: 10px; z-index: 5; border-color: var(--warn); background: var(--warn-soft); box-shadow: var(--shadow); }
.tt-savebar.dirty .tt-savebar-text { color: var(--ink); font-weight: 650; }

/* Step 3: the files. */
.tt-files { margin-top: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.tt-made { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; font-size: 13px; }
.tt-made .icon { color: var(--ok); vertical-align: -2px; }
.tt-downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tt-dl { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.tt-dl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tt-dl-badge { align-self: flex-start; margin-bottom: -2px; font-size: 11px; }
.tt-dl p { margin: 0; flex: 1; font-size: 12.5px; color: var(--muted); }
.tt-dl .btn { align-self: flex-start; }
.tt-how summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.tt-how p { margin: 6px 0 0; color: var(--ink-2); }
.tt-stage { padding: 6% 9%; border-radius: var(--radius-sm); background: radial-gradient(circle at 50% 40%, #3b6b52, #24402f); overflow: hidden; }
.tt-board { position: relative; user-select: none; }
.tt-board img { display: block; width: 100%; height: auto; border-radius: 8px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35); pointer-events: none; }
.tt-table { aspect-ratio: 1.6; border: 2px dashed rgba(255, 255, 255, 0.45); border-radius: 12px; display: grid; place-items: center; color: rgba(255, 255, 255, 0.75); font-weight: 650; }
.tt-marker { position: absolute; transform: translate(-50%, -50%); display: grid; gap: 1px; text-align: center; min-height: 0; max-width: 160px; padding: 4px 9px; border-radius: 10px; border: 2px solid #fff; background: rgba(20, 22, 52, 0.88); color: #fff; font-size: 11.5px; font-weight: 650; line-height: 1.2; cursor: grab; touch-action: none; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }
.tt-marker small { font-weight: 500; opacity: 0.8; }
.tt-marker.tt-deal { background: rgba(109, 94, 252, 0.92); }
.tt-marker.tt-place { background: rgba(16, 128, 91, 0.92); }
.tt-marker.selected { outline: 3px solid #fbbf24; outline-offset: 1px; z-index: 2; }
.tt-marker:active { cursor: grabbing; }
.check-inline input { width: auto; }
.tt-report.none { border-left-color: #d97706; }
.tt-report p { margin: 0 0 4px; }
.tt-report ul { margin: 2px 0 6px; padding-left: 20px; }
.tt-lock { border: 0; margin: 0; padding: 0; min-width: 0; }
.tt-lock[disabled] { opacity: 0.6; }
.tt-lock[disabled] .tt-marker { cursor: default; }
.tt-foot { position: absolute; transform: translate(-50%, -50%); border-radius: 6%; background: rgba(255, 250, 238, 0.85); border: 2px solid rgba(255, 255, 255, 0.95); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); pointer-events: none; }
.tt-foot.down { background: repeating-linear-gradient(135deg, #2b2d5c 0 6px, #3a3d78 6px 12px); }
.tt-foot.round { border-radius: 50%; background: rgba(246, 173, 85, 0.85); }
.tt-foot.tt-pile.round { background: rgba(109, 94, 252, 0.6); }

/* A tab left open across an update (app.js showUpdateNotice). */
.update-notice { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 10px 12px 10px 16px; border-radius: 12px; background: #1d1f45; color: #fff; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }

/* Expansions (public/expansions.js). */
.x-list { display: grid; gap: 12px; margin-bottom: 14px; }
.x-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.x-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.x-top h3 { margin: 0 0 2px; font-size: 15px; }
.x-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; font-size: 13px; }
.x-more { margin-top: 8px; font-size: 13px; }
.x-more summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.x-more ul { margin: 6px 0 0; padding-left: 20px; }
.x-combos { margin-top: 6px; }
.x-combos td:not(:first-child), .x-combos th:not(:first-child) { text-align: center; }
.x-tools { margin-top: 8px; gap: 4px; }
.x-add > summary { list-style: none; display: inline-flex; }
.x-add > summary::-webkit-details-marker { display: none; }
.x-play { align-items: center; gap: 6px 14px; margin: 0 0 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.x-form { margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.x-files-form { margin-top: 14px; }
.x-files .file-list a { color: inherit; }
.x-stale { color: var(--warn); font-weight: 600; }

/* Closed playtests: who may play the playtest link. */
.pt-access button { white-space: normal; line-height: 1.3; }
@media (max-width: 560px) { .pt-access { grid-template-columns: 1fr; } }

/* A component's cards as a spreadsheet (Rules as understood). */
.card-sheet { gap: 4px 12px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.card-sheet .link-btn { padding: 0; }
.card-lists p { margin: 6px 0 0; }

/* Admin → Revenue: the key numbers in a row of tiles. */
.rev-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 0 0 18px; }
.rev-tiles .stat { min-width: 0; }
.rev-tiles .value small, .hero .stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); }
/* Admin → Revenue: profit. A customer who costs more than they pay; the fixed costs list. */
.data tr.rev-loss td { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.rev-fixed-row { gap: 8px; margin-top: 6px; flex-wrap: nowrap; }
.rev-fixed-row input[name="fixedName"] { flex: 1 1 auto; min-width: 0; }
.rev-fixed-row input[name="fixedAmount"] { flex: 0 0 120px; width: 120px; }
table.data span.neg { color: var(--bad); font-weight: 650; }
.stat span.neg { color: var(--bad); }

/* Download buttons on uploaded files (Sources, an expansion's files). */
.icon-btn.file-download { display: inline-grid; place-items: center; flex: none; }
.icon-btn.file-download:hover { background: var(--accent-soft, var(--surface-2)); color: var(--accent); }
.sources-download { justify-content: flex-end; margin: 0 0 12px; }

/* Admin → Game page sections: the order, with up/down buttons. */
.section-order { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; max-width: 460px; }
.section-order li { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.section-order li:last-child { border-bottom: 0; }
.section-order-n { width: 22px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.section-order-name { flex: 1; font-size: 14px; }
.section-order .icon-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }

/* Admin → Invite a customer: setting up their account with the invitation. */
.invite-setup { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface-2); }
.invite-setup > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.invite-setup label { margin-top: 0; }
.invite-setup select { width: 100%; }

.clone-into { border: 1px solid var(--line, #ddd); border-radius: 10px; padding: 8px 12px 10px; margin: 0 0 12px; }
.clone-into label { display: flex; gap: 8px; align-items: baseline; margin-top: 6px; font-weight: 400; }
.clone-into input[type="radio"] { width: auto; min-height: 0; }

/* The learn-to-play tutorial (UNP-30): the setting next to "Build the game" and the bar over the playable game. */
.first-build-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: -4px 0 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.first-build-row .primary { margin-left: auto; }
.bots-choice { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.bots-choice label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: 500; cursor: pointer; }
.bots-choice input[type="radio"] { width: auto; min-height: 0; margin: 0; }
.tutorial-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; margin: 0; white-space: nowrap; }
.tutorial-check input[type="checkbox"] { width: auto; min-height: 0; margin: 0; }
.tutorial-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-2); }
.tutorial-bar .tutorial-check { margin-left: auto; }
.tutorial-notes { flex-basis: 100%; margin-top: 4px; }
.tutorial-notes summary { cursor: pointer; }
.tutorial-notes textarea { min-height: 70px; margin-top: 6px; background: var(--surface, #fff); }
.tutorial-first { margin-bottom: 16px; }

/* Admin → Email users (UNP-58). */
.broadcast-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 12px; }
.broadcast-who .check { margin: 0; }
.broadcast-preview { margin-top: 16px; }
.broadcast-preview iframe { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f6f6fa; }
