:root {
  --brand: #5b3cc4;
  --brand-dark: #45299f;
  --accent: #ffb400;
  --ink: #1d1b2e;
  --muted: #625e78;
  --line: #e4e0f2;
  --bg: #f6f4fd;
  --card: #ffffff;
  --field: #fcfbff;
  --soft: #efeafd;
  --soft2: #e2dafc;
  --dark-chip: #1d1b2e;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(45, 30, 110, 0.08);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.6; }
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
kbd { font-family: inherit; font-size: 0.8em; background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
code { background: var(--soft); border-radius: 4px; padding: 0 4px; font-size: 0.92em; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 1.12rem; letter-spacing: -0.01em; }
.logo b { color: var(--brand); font-weight: 800; }
.tools-menu { position: relative; }
.tools-menu summary { white-space: nowrap; list-style: none; cursor: pointer; font-weight: 600; padding: 8px 14px; border-radius: 999px; background: var(--soft); color: var(--brand-dark); }
.tools-menu summary::-webkit-details-marker { display: none; }
.tools-menu summary::after { content: ' ▾'; }
.tools-menu ul { position: absolute; right: 0; top: calc(100% + 8px); margin: 0; padding: 8px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 230px; }
.tools-menu a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.tools-menu a:hover, .tools-menu a[aria-current] { background: var(--soft); color: var(--brand-dark); }

/* Buttons */
.btn { appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; color: #fff; background: var(--brand); padding: 11px 20px; border-radius: 999px; transition: background 0.15s, transform 0.1s; }
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn-small { padding: 7px 14px; font-size: 0.92rem; }
.btn-light { background: var(--soft); color: var(--brand-dark); }
.btn-light:hover { background: var(--soft2); }
.btn-ghost { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 0.9rem; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); }
.chip { appearance: none; border: 1px solid var(--line); background: var(--field); font: inherit; font-size: 0.85rem; padding: 4px 11px; border-radius: 999px; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }

/* Tool */
.tool { padding: 18px 0 28px; background: linear-gradient(180deg, var(--card) 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); }
.tool-head { text-align: center; margin: 4px auto 14px; max-width: 760px; }
.tool-head h1 { font-size: clamp(1.6rem, 3.6vw, 2.4rem); line-height: 1.15; margin: 0 0 6px; letter-spacing: -0.02em; }
.lead { margin: 0; color: var(--muted); font-size: 1.04rem; }
.tool-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.wheel-area { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wheel-box { position: relative; width: min(100%, 620px, 74vh); aspect-ratio: 1; }
.wheel-canvas { position: absolute; inset: 0; filter: drop-shadow(0 10px 24px rgba(45, 30, 110, 0.22)); }
.pointer { position: absolute; top: -6px; left: 50%; width: 0; height: 0; transform: translateX(-50%); border-left: 18px solid transparent; border-right: 18px solid transparent; border-top: 36px solid var(--ink); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); z-index: 2; pointer-events: none; }
.hub { position: absolute; left: 50%; top: 50%; width: 19%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 5px solid #fff; background: var(--ink); color: #fff; font: 800 clamp(0.8rem, 2.2vw, 1.15rem) var(--font); letter-spacing: 0.06em; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); z-index: 2; transition: transform 0.12s, background 0.15s; }
.hub:hover:not(:disabled) { background: var(--brand); transform: translate(-50%, -50%) scale(1.05); }
.hub:disabled { cursor: default; opacity: 0.85; }
.wheel-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.wheel-hint { margin: 0; font-size: 0.85rem; color: var(--muted); text-align: center; }
.wheel-area:fullscreen { background: var(--bg); justify-content: center; padding: 24px; }
.wheel-area:fullscreen .wheel-box { width: min(92vw, 86vh); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs [role='tab'] { flex: 1; appearance: none; font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 8px; background: var(--soft); color: var(--muted); cursor: pointer; }
.tabs [role='tab'][aria-selected='true'] { background: var(--brand); color: #fff; }
.count { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.25); font-size: 0.82em; }
.tabs [aria-selected='false'] .count { background: var(--soft2); }
.pane textarea { width: 100%; min-height: 240px; resize: vertical; font: 0.98rem/1.5 var(--font); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--ink); }
.pane textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tip { font-size: 0.82rem; color: var(--muted); margin: 8px 0 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; font-size: 0.85rem; color: var(--muted); }
.range-form { display: flex; gap: 8px; align-items: end; margin-bottom: 10px; flex-wrap: wrap; }
.range-form label, .select-row { display: flex; flex-direction: column; font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.range-form input, .select-row select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; width: 100px; background: var(--card); }
.select-row { margin-bottom: 10px; }
.select-row select { width: 100%; }
.results { margin: 0; padding-left: 1.6em; max-height: 300px; overflow: auto; }
.results li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.results time { float: right; color: var(--muted); font-size: 0.8rem; }
.empty { color: var(--muted); font-size: 0.92rem; }
.settings { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.settings summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.setting { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.92rem; }
.setting input[type='range'] { flex: 1; accent-color: var(--brand); }
.setting input[type='checkbox'] { accent-color: var(--brand); width: 18px; height: 18px; }

/* Result modal */
.modal { position: fixed; inset: 0; background: rgba(20, 14, 50, 0.55); display: grid; place-items: center; z-index: 900; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--card); border-radius: 20px; padding: 26px 24px 22px; width: min(480px, 100%); text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); animation: pop 0.25s ease-out; }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
.result-kicker { margin: 0; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }
.result-value { font-size: clamp(1.8rem, 6vw, 2.8rem); font-weight: 800; margin: 6px 0 4px; line-height: 1.15; word-break: break-word; color: var(--brand-dark); }
.result-extra { font-size: 1.1rem; margin: 6px 0 4px; }
.result-swatch { width: 84px; height: 84px; border-radius: 50%; margin: 12px auto 0; border: 4px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.result-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 0.92rem; transition: transform 0.25s, opacity 0.25s, visibility 0.25s; z-index: 950; max-width: calc(100% - 32px); text-align: center; opacity: 0; visibility: hidden; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* Team generator */
.team-controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-top: 10px; }
.team-controls label { display: flex; flex-direction: column; font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.team-controls select, .team-controls input { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.team-controls input { width: 90px; }
.team-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; }
.team-output { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.team-output:empty::before { content: 'Your teams will appear here.'; color: var(--muted); }
.team-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); animation: pop 0.3s ease-out both; animation-delay: var(--d); border-top: 5px solid var(--brand); }
.team-card:nth-child(4n + 2) { border-top-color: #ff5a5f; }
.team-card:nth-child(4n + 3) { border-top-color: #00a699; }
.team-card:nth-child(4n + 4) { border-top-color: #ffb400; }
.team-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.team-card small { color: var(--muted); font-weight: 500; }
.team-card ul { margin: 0; padding-left: 1.2em; }

/* Content */
.content { padding: 28px 0 40px; max-width: 860px; }
.is-info .content { min-height: 50vh; }
.content h1 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); line-height: 1.2; letter-spacing: -0.02em; }
.content h2 { font-size: 1.45rem; margin: 2em 0 0.5em; letter-spacing: -0.01em; }
.content h3 { font-size: 1.12rem; margin: 1.5em 0 0.3em; }
.content li { margin: 0.3em 0; }
.crumbs { font-size: 0.85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 44px; margin: 12px 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.feature-grid li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0; }
.feature-grid b { display: block; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 8px 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details div { margin-top: 8px; color: #3a3650; }
.more-tools { margin-top: 2.4em; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tool-card { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: var(--ink); font-weight: 700; }
.tool-card span { font-size: 1.4rem; }
.tool-card:hover { border-color: var(--brand); color: var(--brand-dark); }

/* Footer */
.site-footer { background: #1d1b2e; color: #cfcbe3; padding: 34px 0 18px; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: #fff; }
.footer-grid { display: grid; grid-template-columns: minmax(220px, 1.3fr) repeat(auto-fit, minmax(140px, 1fr)); gap: 24px; }
.footer-grid .footer-wheels.long { grid-column: span 2; }
.footer-grid .footer-wheels.long ul { columns: 2; column-gap: 24px; }
.site-footer h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: #8f8aa8; margin: 0 0 8px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 5px 0; }
.logo-footer { color: #fff; }
.logo-footer b { color: #b9a6ff; }
.copyright { font-size: 0.82rem; color: #8f8aa8; margin-top: 24px; }

@media (max-width: 900px) {
  .tool-main, .team-layout { grid-template-columns: 1fr; }
  .wheel-box { width: min(100%, 520px); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .tool { padding-top: 12px; }
  .lead { font-size: 0.95rem; }
  .pane textarea { min-height: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- v1 engine components ---------- */
.header-right { display: flex; align-items: center; gap: 8px; }
.theme-toggle { appearance: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; width: 38px; height: 38px; cursor: pointer; font-size: 1rem; }
.wheel-static { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hub, .toast { background-color: var(--dark-chip); }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font: 900 clamp(4rem, 14vw, 8rem) var(--font); color: #fff; text-shadow: 0 4px 18px rgba(0, 0, 0, 0.45); z-index: 3; pointer-events: none; }
.countdown[hidden] { display: none; }
.last-result { margin: 0; min-height: 1.5em; font-weight: 700; text-align: center; color: var(--ink); }
.action-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.ab-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.ab-item select, .ab-item input { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
.ab-item input { width: 64px; }
.ab-item[hidden] { display: none; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.view-toggle button { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.85rem; font-weight: 700; padding: 4px 14px; cursor: pointer; }
.view-toggle button[aria-pressed='true'] { background: var(--brand); color: #fff; }
.banner { background: var(--soft); border: 1px solid var(--soft2); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: 0.86rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.banner[hidden] { display: none; }
.banner select { font: inherit; max-width: 100%; }
.toolbar .icon { min-width: 34px; }
.more-menu { position: relative; }
.more-menu summary { list-style: none; display: inline-block; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu .menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 30; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 240px; display: grid; }
.more-menu .menu button { appearance: none; border: 0; background: none; text-align: left; font: inherit; font-size: 0.9rem; padding: 7px 10px; border-radius: 8px; color: var(--ink); cursor: pointer; }
.more-menu .menu button:hover { background: var(--soft); }
.list-editor { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--field); }
.list-editor[hidden] { display: none; }
.list-editor .row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 48px 40px 26px 26px 22px; gap: 4px; align-items: center; padding: 3px 2px; border-bottom: 1px solid var(--line); }
.list-editor .row.is-hidden .lbl { opacity: 0.45; text-decoration: line-through; }
.list-editor .drag { display: none; }
.list-editor .row { cursor: grab; }
.list-editor input[type='color'] { width: 26px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; }
.list-editor .lbl, .list-editor .wt { font: inherit; font-size: 0.92rem; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); min-width: 0; }
.list-editor .pct { font-size: 0.75rem; color: var(--muted); text-align: right; }
.list-editor .img-btn, .list-editor .img-x, .list-editor .eye, .list-editor .del { appearance: none; border: 0; background: none; cursor: pointer; font-size: 0.95rem; padding: 0; display: grid; place-items: center; color: var(--ink); }
.list-editor .img-x img { width: 26px; height: 26px; object-fit: cover; border-radius: 4px; }
.list-editor .del { font-size: 1.2rem; color: var(--muted); }
.add-entry { margin-top: 6px; }
.pane-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 6px 0; }
.scoreboard { margin: 0 0 8px; padding-left: 1.4em; }
.scoreboard li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.themes { border: 0; padding: 0; margin: 0 0 6px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.themes legend { font-weight: 700; color: var(--muted); margin-bottom: 6px; font-size: 0.9rem; }
.swatch { display: grid; justify-items: center; gap: 2px; cursor: pointer; font-size: 0.68rem; color: var(--muted); text-align: center; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + span { border-color: var(--brand); }
.swatch input:focus-visible + span { outline: 3px solid var(--accent); }
.swatch b { font-weight: 600; line-height: 1.1; }
.setting select { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.result-list { text-align: left; max-height: 40vh; overflow: auto; margin: 10px auto 0; padding-left: 1.6em; font-size: 1.15rem; font-weight: 700; color: var(--brand-dark); max-width: 340px; }
.result-list[hidden] { display: none; }

/* ---------- dark mode ---------- */
:root[data-theme='dark'] {
  --ink: #ecebf5;
  --muted: #a9a5c2;
  --line: #2f2b47;
  --bg: #13111d;
  --card: #1c1a2b;
  --field: #171524;
  --soft: #2a2542;
  --soft2: #3a3360;
  --brand-dark: #b9a6ff;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
:root[data-theme='dark'] .result-value, :root[data-theme='dark'] .logo b { color: #b9a6ff; }
:root[data-theme='dark'] .faq details div { color: var(--ink); }
:root[data-theme='dark'] .pointer { border-top-color: #ecebf5; }

@media (max-width: 480px) {
  .logo span { font-size: 0.98rem; }
  .logo img { width: 28px; height: 28px; }
  .tools-menu summary { padding: 7px 12px; font-size: 0.92rem; }
  .theme-toggle { width: 34px; height: 34px; }
}

/* ---------- A2: dialogs, library, present mode, embed ---------- */
.dialog-card { text-align: left; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.dialog-card h2 { margin: 0 0 12px; font-size: 1.3rem; }
.field { display: grid; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin: 10px 0 6px; }
.field input, .field textarea, .field select { font: inherit; font-size: 0.92rem; font-weight: 400; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; }
.field textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem; }
.field-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin: 14px 0 4px; }
.qr { width: 180px; background: #fff; border-radius: 10px; padding: 6px; margin-bottom: 6px; font-size: 0.85rem; color: #333; }
.qr svg { display: block; width: 100%; height: auto; }
.more-link { display: inline-block; margin-top: 8px; font-size: 0.9rem; }
.result-buttons.left { justify-content: flex-start; margin-top: 4px; }
.setting.stack { display: grid; gap: 4px; }
.setting.stack input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); }
.lib-list { list-style: none; padding: 0; margin: 12px 0 0; }
.lib-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lib-list li.current b::after { content: ' • open'; color: var(--brand); font-weight: 600; font-size: 0.8rem; }
.lib-list li > span:first-child { display: grid; min-width: 0; }
.lib-list small { color: var(--muted); font-size: 0.78rem; }
.lib-list .lib-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.lib-list .lib-actions button { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 0.8rem; border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.lib-list .empty { color: var(--muted); }
.present-title { margin: 0; font-size: clamp(1.4rem, 4vw, 2.6rem); font-weight: 800; text-align: center; }
.present-title[hidden] { display: none; }
.present-exit { position: fixed; top: 14px; right: 14px; z-index: 950; appearance: none; border: 0; border-radius: 999px; background: var(--dark-chip); color: #fff; font: 600 0.9rem var(--font); padding: 8px 14px; cursor: pointer; }
.present-exit[hidden] { display: none; }
body.presenting .site-header, body.presenting .site-footer, body.presenting .content, body.presenting .panel, body.presenting .tool-head, body.presenting .action-bar, body.presenting .wheel-actions, body.presenting .wheel-hint { display: none; }
body.presenting .tool { min-height: 100vh; display: grid; place-items: center; padding: 20px; border: 0; }
body.presenting .tool-main { grid-template-columns: 1fr; }
body.presenting .wheel-box { width: min(92vw, 78vh); }
body.presenting .last-result { font-size: 1.4rem; }

body.embed { background: var(--bg); min-height: 100vh; margin: 0; }
html.bg-transparent, html.bg-transparent body.embed { background: transparent; }
html.bg-green, html.bg-green body.embed { background: #00b140; }
html.bg-white, html.bg-white body.embed { background: #ffffff; }
.embed-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px; box-sizing: border-box; }
.embed-wrap .wheel-box { width: min(calc(100vw - 20px), calc(100vh - 110px)); }
.embed-title { margin: 0; font-weight: 800; font-size: 1.1rem; text-align: center; }
.embed-title[hidden] { display: none; }
.embed .credit { font-size: 0.78rem; color: var(--muted); text-decoration: none; }
html.obs .credit, html.obs .last-result { display: none; }
html.bg-transparent .last-result, html.bg-green .last-result { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.embed-builder { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.eb-preview-wrap { display: grid; place-items: center; background: repeating-conic-gradient(var(--soft) 0% 25%, transparent 0% 50%) 50% / 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-height: 420px; overflow: auto; }
.eb-preview-wrap iframe { border: 0; max-width: 100%; background: transparent; }
.eb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (max-width: 900px) {
  .embed-builder { grid-template-columns: 1fr; }
}

/* ---------- A3: lock + receipts + fairness tools ---------- */
.more-menu.is-disabled { pointer-events: none; opacity: 0.45; }
.toolbar button:disabled, .chip:disabled, .view-toggle button:disabled { opacity: 0.45; cursor: not-allowed; }
.lock-banner { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: center; background: var(--soft); border: 1px solid var(--soft2); border-radius: 12px; padding: 8px 12px; font-size: 0.88rem; max-width: 620px; text-align: center; }
.lock-banner[hidden] { display: none; }
.lock-banner code { font-size: 0.95em; letter-spacing: 0.04em; }
.lock-banner small { flex-basis: 100%; color: var(--muted); }
.receipt-summary { font-weight: 700; }
.receipt-draws { padding-left: 1.4em; max-height: 30vh; overflow: auto; }
.receipt-draws time { color: var(--muted); font-size: 0.82rem; margin-right: 6px; }
.checks { list-style: none; padding: 0; }
.checks li { padding: 8px 10px; border-radius: 10px; margin: 6px 0; background: var(--card); border: 1px solid var(--line); }
.checks li.pass::before { content: '✅ '; }
.checks li.fail::before { content: '❌ '; }
.verdict { font-size: 1.2rem; font-weight: 800; }
.verdict.pass { color: #1f9d55; }
.verdict.fail { color: #d64545; }
.sim-tool, .odds-tool, .verify-tool { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.sim-output, .odds-output, .verify-output { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-height: 300px; }
.bars { display: grid; gap: 6px; margin-top: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 140px) minmax(0, 1fr) 70px; gap: 8px; align-items: center; font-size: 0.85rem; }
.bar-row .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { position: relative; height: 18px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--brand); border-radius: 6px; }
.bar-expected { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.progress { height: 6px; background: var(--soft); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress span { display: block; height: 100%; width: 0; background: var(--brand); transition: width 0.15s; }
.odds-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.odds-table th, .odds-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.odds-table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.stat { background: var(--soft); border-radius: 10px; padding: 8px 12px; }
.stat b { display: block; font-size: 1.2rem; }
.stat small { color: var(--muted); }
@media (max-width: 900px) {
  .sim-tool, .odds-tool, .verify-tool { grid-template-columns: 1fr; }
}

.toast { pointer-events: none; }
.odds-table td.n { white-space: nowrap; }

/* ---------- A4: data wheels ---------- */
.data-panel { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; background: var(--field); }
.data-panel summary { cursor: pointer; font-weight: 700; font-size: 0.92rem; }
.filter { border: 0; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 5px; }
.filter legend { font-size: 0.8rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; width: 100%; }
.link-btn { appearance: none; border: 0; background: none; color: var(--brand); font: inherit; font-size: 0.78rem; cursor: pointer; padding: 0 0 0 6px; text-decoration: underline; }
.chip-check { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px 2px 6px; background: var(--card); cursor: pointer; }
.chip-check input { accent-color: var(--brand); margin: 0; }
#data-fill { margin-top: 10px; }
.season-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 0 0 10px; font-size: 0.86rem; }
.season-row .setting { margin: 0; }
.season-row input[type='number'] { width: 76px; font: inherit; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.draft-out { padding-left: 1.4em; margin: 8px 0; }
.table-wrap { overflow-x: auto; margin: 10px 0 18px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.data-table caption { text-align: left; font-weight: 700; padding: 6px 0; color: var(--muted); }
.data-table th, .data-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table thead th { background: var(--soft); }
.tabs [role="tab"] { white-space: nowrap; font-size: 0.9rem; padding: 8px 6px; }

/* ---------- A5: number generator, coin, dice, 8-ball, teams ---------- */
.num-tool, .rz-tool { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.num-display, .rz-stage { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 18px; text-align: center; min-height: 360px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.num-result { font: 900 clamp(4rem, 14vw, 8rem) / 1 var(--font); color: var(--brand-dark); letter-spacing: -0.03em; word-break: break-word; max-width: 100%; }
.num-result.long { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.3; }
.num-result.pop, .rz-result .dice-total { animation: pop 0.3s ease-out; }
.num-sub { margin: 0; color: var(--muted); }
.btn-big { font-size: 1.15rem; padding: 14px 40px; }
.num-actions { display: flex; gap: 8px; align-items: center; }
.num-history { width: 100%; text-align: left; }
.num-list { margin: 0; padding-left: 1.6em; max-height: 220px; overflow: auto; columns: 2; }
.wheel-box.small { width: min(100%, 360px); }
.num-wheel-wrap[hidden] { display: none; }
.range-links { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.range-links a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); text-decoration: none; font-weight: 600; }
.rz-result { margin: 0; font-size: 1.15rem; min-height: 1.6em; }
.dice-total { font-size: 2.6rem; color: var(--brand-dark); display: inline-block; vertical-align: middle; }
.crit { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 0.9rem; }
.crit.hit { background: #1f9d55; color: #fff; }
.crit.miss { background: #d64545; color: #fff; }
.coin-tray, .dice-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; perspective: 900px; min-height: 140px; align-items: center; }
.coin { width: 130px; height: 130px; position: relative; transform-style: preserve-3d; transition: transform 1.05s cubic-bezier(0.2, 0.7, 0.2, 1); }
.coin.small { width: 80px; height: 80px; }
.coin .face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font: 900 2.6rem var(--font); backface-visibility: hidden; box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.35), 0 6px 16px rgba(0, 0, 0, 0.25); }
.coin.small .face { font-size: 1.6rem; }
.coin .heads { background: radial-gradient(circle at 35% 30%, #ffe9a0, #e0a91c 60%, #b07d09); color: #6b4b00; }
.coin .tails { background: radial-gradient(circle at 35% 30%, #f1f3f6, #b9c0ca 60%, #858d99); color: #3c434d; transform: rotateY(180deg); }
.coin-history { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; padding: 0; margin: 0; justify-content: center; }
.coin-history li { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; font-weight: 800; }
.coin-history li.h { background: #f5c94a; color: #6b4b00; }
.coin-history li.t { background: #c6ccd5; color: #3c434d; }
.die { width: 84px; height: 84px; border-radius: 16px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15); display: grid; place-items: center; position: relative; color: var(--ink); }
.die.d6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 12px; background: #fff; }
.die.d6 span.pip { width: 14px; height: 14px; border-radius: 50%; background: #1d1b2e; place-self: center; }
.die b { font: 900 2rem var(--font); }
.die small { position: absolute; bottom: 4px; font-size: 0.62rem; color: var(--muted); }
.die.d20 { clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); border-radius: 0; background: var(--brand); color: #fff; border: 0; }
.die.d20 small, .die.d8 small, .die.d4 small { color: rgba(255, 255, 255, 0.8); }
.die.d8 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); border-radius: 0; background: #00a699; color: #fff; border: 0; }
.die.d4 { clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; background: #ff7a00; color: #fff; border: 0; padding-top: 24px; }
.die.d10, .die.d100 { border-radius: 40% 40% 50% 50%; background: #3d8bfd; color: #fff; border: 0; }
.die.d12 { clip-path: polygon(50% 0, 95% 30%, 80% 95%, 20% 95%, 5% 30%); border-radius: 0; background: #e84393; color: #fff; border: 0; }
.die.rolling { animation: roll 0.32s linear infinite; }
.die.dropped { opacity: 0.35; transform: scale(0.85); }
@keyframes roll { 0% { transform: rotate(0) translateY(0); } 50% { transform: rotate(180deg) translateY(-8px); } 100% { transform: rotate(360deg) translateY(0); } }
.dice-history, .ball-history { width: 100%; text-align: left; padding-left: 1.4em; max-height: 220px; overflow: auto; margin: 0; }
.dice-history small { color: var(--muted); }
.ball { width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #5a5a6a, #111 55%, #000); display: grid; place-items: center; cursor: pointer; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); }
.ball.shake { animation: shake 0.85s ease-in-out; }
@keyframes shake { 0%, 100% { transform: translate(0, 0) rotate(0); } 15% { transform: translate(-12px, -6px) rotate(-8deg); } 30% { transform: translate(12px, 4px) rotate(7deg); } 45% { transform: translate(-10px, 6px) rotate(-6deg); } 60% { transform: translate(8px, -6px) rotate(5deg); } 75% { transform: translate(-6px, 2px) rotate(-3deg); } }
.ball-window { width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, #0c1240, #050820); display: grid; place-items: center; }
.ball-answer { width: 96px; height: 84px; clip-path: polygon(50% 100%, 0 0, 100% 0); background: #2f3fbf; color: #e8ecff; font: 700 0.62rem/1.15 var(--font); display: grid; place-items: start center; padding: 10px 14px 0; text-align: center; text-transform: uppercase; transition: opacity 0.4s; }
.ball-answer.fade { opacity: 0; }
.team-summary { color: var(--muted); margin: 0 0 8px; }
@media (max-width: 900px) {
  .num-tool, .rz-tool { grid-template-columns: 1fr; }
}

/* ---------- Grouped menu, hub ---------- */
.tools-menu .menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 230px; max-height: calc(100vh - 90px); overflow: auto; }
.tools-menu .menu-panel ul { position: static; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; min-width: 0; list-style: none; }
.menu-groups { display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 4px 12px; }
.menu-groups h3 { margin: 6px 10px 2px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.menu-groups a { padding: 6px 10px; }
.menu-all { display: block; margin-top: 8px; padding: 9px 10px; border-top: 1px solid var(--line); font-weight: 600; color: var(--brand-dark); text-decoration: none; }
@media (max-width: 760px) {
  .menu-groups { grid-template-columns: 1fr 1fr; }
  .tools-menu .menu-panel { position: fixed; left: 12px; right: 12px; top: 64px; }
}
@media (max-width: 460px) { .menu-groups { grid-template-columns: 1fr; } }
.hub-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.hub-list li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.hub-list li > span { font-size: 1.5rem; line-height: 1; }
.hub-list a { font-weight: 700; }
.hub-list small { display: block; color: var(--muted); margin-top: 2px; }
.tool-card-all { font-weight: 700; }

/* ---------- Multi-wheel ---------- */
.multi { margin: 22px auto 0; }
.multi summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.multi summary span { color: var(--muted); font-size: 0.92rem; }
.multi-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 8px; }
.field.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.field.inline select { width: auto; }
.multi-grid { display: grid; grid-template-columns: repeat(var(--multi-n, 3), minmax(0, 1fr)); gap: 16px; }
.multi-col { display: grid; gap: 8px; align-content: start; min-width: 0; }
.multi-title { font: inherit; font-weight: 700; text-align: center; border: 1px solid transparent; background: transparent; color: var(--ink); border-radius: 8px; padding: 4px; }
.multi-title:hover, .multi-title:focus { border-color: var(--line); background: var(--field); }
.multi-list { font: inherit; font-size: 0.85rem; width: 100%; box-sizing: border-box; resize: vertical; background: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.multi-result { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 8px; margin: 6px 0 14px; }
.multi-result span { display: grid; text-align: center; background: var(--soft); border-radius: var(--radius); padding: 8px 16px; }
.multi-result small { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.multi-result b { font-size: 1.25rem; color: var(--brand-dark); }
.multi-history { margin: 14px 0 0; padding-left: 22px; color: var(--muted); font-size: 0.88rem; max-height: 160px; overflow: auto; }
@media (max-width: 760px) { .multi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.multi-col .wheel-box { width: 100%; margin: 0 auto; }
