/* Simulator. Two visual layers:
   - TicketDay framing (practice flag, panel, brand screens)
   - a deliberately plain "ticket site" page (.ts-*) that prioritises functional familiarity over decoration. */
html:has(body.page-sim) { scroll-padding-top: 110px; scroll-padding-bottom: 24px; }
body.page-sim { background: #eef0f4; min-height: 100vh; }
.flag-long { display: none; }
@media (min-width: 600px) { .flag-long { display: inline; } }
.practice-flag { position: sticky; top: 0; z-index: 50; background: var(--ink); color: #fff; font-size: .78rem; letter-spacing: .04em; padding: 0 12px; min-height: 44px; display: flex; align-items: center; }
.practice-flag span { color: var(--accent); font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.practice-flag .flag-long { color: #cbd5e1; font-weight: 400; letter-spacing: .02em; }

.sim-layout { max-width: 1180px; margin: 0 auto; padding: 12px; display: grid; gap: 16px; }
.sim-browser { background: #fff; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid #dfe3ea; }
.sim-urlbar { border-radius: 12px 12px 0 0; background: #f1f3f7; border-bottom: 1px solid #dfe3ea; font-size: .78rem; color: var(--muted); padding: 8px 12px; display: flex; align-items: center; gap: 8px; }
.sim-urlbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.sim-page { padding: 18px 16px 28px; }
.sim-timer { position: sticky; top: 44px; z-index: 20; display: flex; justify-content: space-between; align-items: center; background: #1f2937; color: #fff; padding: 10px 16px; font-size: .92rem; }
.sim-timer strong { font: 700 1.25rem/1 ui-monospace, Menlo, monospace; letter-spacing: .04em; }
.sim-timer.urgent { background: #b91c1c; }

/* ---- plain ticket-site look ---- */
.ts-page { color: #1f2937; font-size: 16px; }
.ts-title { font-size: 1.35rem; font-weight: 700; letter-spacing: 0; border-bottom: 3px solid #1f2937; padding-bottom: 10px; margin-bottom: 16px; }
.ts-subtitle { font-size: 1.15rem; margin: 0 0 12px; letter-spacing: 0; }
.ts-box { border: 1px solid #d1d5db; background: #fafafa; padding: 18px 16px; border-radius: 4px; }
.ts-box h2 { margin-top: 0; font-size: 1.2rem; letter-spacing: 0; }
.ts-clock strong { font: 700 1.3rem ui-monospace, Menlo, monospace; }
.ts-warn { background: #fff7ed; border-left: 4px solid #f97316; padding: 10px 12px; font-weight: 600; font-size: .95rem; }
.ts-note { font-size: .9rem; color: #4b5563; }
.ts-progress-label { font-weight: 600; margin: 18px 0 6px; font-size: .95rem; }
.ts-progress { height: 22px; background: #e5e7eb; border-radius: 3px; overflow: hidden; border: 1px solid #cbd5e1; }
.ts-progress-fill { height: 100%; background: #16a34a; transition: width .9s linear; }
.ts-status { margin-top: 12px; font-weight: 600; }
.ts-updated { font-size: .85rem; color: #6b7280; }
.ts-alert { background: #fef2f2; border: 1px solid #fca5a5; border-left: 5px solid var(--bad); color: #7f1d1d; padding: 12px 14px; margin: 0 0 14px; font-weight: 600; border-radius: 3px; }
.ts-alert:focus { outline: 3px solid #fca5a5; }
.ts-row { border: 1px solid #d1d5db; border-radius: 4px; padding: 10px 12px 12px; margin: 0 0 10px; background: #fff; }
.ts-row legend { font-weight: 700; padding: 0 4px; font-size: .95rem; }
.ts-row .req { font-weight: 400; color: #6b7280; font-size: .85rem; }
.ts-row.has-error { border-color: var(--bad); background: #fff8f8; border-width: 2px; }
.ts-fields { display: grid; gap: 10px; }
.ts-fields label, .ts-block { display: grid; gap: 4px; font-size: .88rem; font-weight: 600; color: #374151; margin-bottom: 10px; }
.ts-page input[type="text"], .ts-page input:not([type]), .ts-page select { font: 16px/1.3 var(--font); padding: 11px 12px; border: 1px solid #9ca3af; border-radius: 3px; min-height: 46px; width: 100%; background: #fff; color: #111827; }
.ts-page input:focus, .ts-page select:focus { outline: 3px solid #93c5fd; border-color: #2563eb; }
.ts-page input[aria-invalid="true"] { border-color: var(--bad); }
.ts-field-error { color: var(--bad); font-weight: 600; font-size: .9rem; margin: 6px 0 0; }
.ts-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.ts-btn { font: 700 16px var(--font); min-height: 48px; padding: 12px 22px; border-radius: 4px; border: 1px solid #9ca3af; background: #fff; color: #111827; cursor: pointer; }
.ts-btn-primary { background: #15803d; border-color: #15803d; color: #fff; flex: 1 1 auto; max-width: 320px; }
.ts-btn-primary:hover { background: #166534; }
.ts-btn[disabled] { opacity: .7; cursor: progress; }
.ts-holders { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.ts-holder { display: flex; gap: 12px; align-items: center; border: 1px solid #d1d5db; border-radius: 4px; padding: 10px; background: #fff; }
.ts-photo { width: 56px; height: 70px; flex: none; background: #e5e7eb; border: 1px solid #cbd5e1; display: grid; place-items: center; color: #6b7280; font-weight: 700; }
.ts-lead { font-size: .75rem; background: #e0e7ff; color: #3730a3; padding: 2px 6px; border-radius: 3px; font-weight: 700; }
.ts-meta { font-size: .88rem; color: #4b5563; font-family: ui-monospace, Menlo, monospace; }
.ts-summary { border: 1px solid #d1d5db; border-radius: 4px; padding: 12px 14px; margin-bottom: 16px; background: #fafafa; }
.ts-summary h3 { margin: 0 0 8px; font-size: 1rem; letter-spacing: 0; }
.ts-summary table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ts-summary td { padding: 6px 0; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.ts-summary td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.ts-total td { font-weight: 800; font-size: 1.02rem; border-bottom: 0; }
.ts-group { border: 1px solid #d1d5db; border-radius: 4px; padding: 10px 12px; margin: 0 0 14px; }
.ts-group legend { font-weight: 700; padding: 0 4px; }
.ts-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ts-check { display: flex; gap: 10px; align-items: center; font-weight: 600; min-height: 44px; }
.ts-check input { width: 22px; height: 22px; }
.ts-coach-day { border: 1px solid #d1d5db; border-radius: 4px; padding: 8px 12px; margin: 0 0 10px; }
.ts-coach-day legend { font-weight: 700; padding: 0 4px; }
.ts-radio { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.ts-radio input { width: 20px; height: 20px; }
.ts-radio.sold { color: #9ca3af; text-decoration: line-through; }
.ts-processing { text-align: center; padding: 36px 16px; }
.ts-spinner { width: 42px; height: 42px; border: 4px solid #d1d5db; border-top-color: #15803d; border-radius: 50%; margin: 0 auto 16px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ts-spinner { animation-duration: 3s; } .ts-progress-fill { transition: none; } }

/* TicketDay notes inside the simulated page */
.td-inline-note { background: #eef2ff; border: 1px dashed #818cf8; color: #312e81; padding: 10px 12px; border-radius: 6px; font-size: .9rem; margin-bottom: 12px; }
.td-inline-note.alert { background: #fef2f2; border-color: #f87171; color: #7f1d1d; }
.td-card { padding: 8px 4px; }
.td-card h1 { font-size: 1.7rem; }

/* bank check overlay */
.bank-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: grid; place-items: center; z-index: 60; padding: 16px; }
.bank-modal { background: #fff; border-radius: 8px; width: 100%; max-width: 420px; padding: 0 18px 18px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); font-size: 16px; }
.bank-head { margin: 0 -18px 14px; padding: 12px 18px; background: #0f766e; color: #fff; font-weight: 700; border-radius: 8px 8px 0 0; font-size: .9rem; }
.bank-modal h2 { margin-top: 0; font-size: 1.25rem; }
.bank-modal input { font: 20px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .2em; padding: 12px; border: 1px solid #9ca3af; border-radius: 4px; width: 100%; }

/* ---- practice panel ---- */
.sim-panel { display: none; }
.panel-inner { padding: 16px; }
.panel-top { display: flex; justify-content: space-between; align-items: center; }
.panel-top h2 { margin: 0; font-size: 1.1rem; }
.panel-close { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 700; min-height: 44px; padding: 0 4px; cursor: pointer; }
.warn { font-size: .85rem; background: #fffbeb; border: 1px solid #fcd34d; color: #78350f; padding: 8px 10px; border-radius: 8px; margin: 10px 0; }
.people { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.person { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.person-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 2px; font-size: .95rem; }
.tag { font-size: .7rem; background: #eef2ff; color: var(--brand-ink); padding: 2px 6px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.kv { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; font-size: .88rem; }
.kv span { color: var(--muted); }
.kv code { font-size: 1rem; font-weight: 600; letter-spacing: .03em; user-select: all; }
.copy { font: 600 .82rem var(--font); border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px; min-height: 36px; min-width: 60px; padding: 4px 10px; cursor: pointer; color: var(--ink-2); }
.copy.copied { background: #ecfdf5; border-color: #6ee7b7; color: var(--good); }
.chat { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; }
.chat h3 { margin: 0 0 4px; font-size: .85rem; color: #166534; }
.msg { font-size: .92rem; padding: 4px 0; }
.practice-card { background: #f8fafc; border: 1px solid #c7d2fe; border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; }
.practice-card h3 { margin: 0; font-size: .95rem; }
.practice-card .kv { grid-template-columns: 96px 1fr auto; }
.panel-toggle { position: fixed; top: 0; right: 0; z-index: 55; height: 44px; padding: 0 16px; border: 0; background: var(--brand); color: #fff; font: 700 .9rem var(--font); cursor: pointer; }
.panel-toggle.has-new::after { margin-left: 8px; background: var(--accent); color: var(--ink); font-size: .75rem; padding: 3px 8px; border-radius: 999px; }
body.panel-open .sim-panel { display: block; position: fixed; left: 0; right: 0; bottom: 0; max-height: calc(100vh - 44px); max-height: calc(100dvh - 44px); overflow-y: auto; background: #fff; z-index: 45; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(15, 23, 42, .25); padding-bottom: env(safe-area-inset-bottom); -webkit-overflow-scrolling: touch; }
body.panel-open .panel-toggle { background: #334155; }
.panel-toggle.has-new::after { content: "New"; }

@media (min-width: 960px) {
    body.with-panel .sim-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; padding: 20px; }
  .sim-panel, body.panel-open .sim-panel { display: block; position: sticky; top: 44px; max-height: calc(100vh - 60px); overflow-y: auto; background: #fff; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); padding-bottom: 0; }
  .panel-toggle, .panel-close { display: none; }
  .sim-page { padding: 28px 32px 36px; }
  .ts-fields { grid-template-columns: 1fr 1fr; }
  .ts-fields label { margin-bottom: 0; }
}

/* ---- TicketDay brand screens: setup, paywall, results ---- */
.brand-screen { max-width: 620px; margin: 0 auto; padding: 20px 18px 48px; background: transparent; }
.brand-screen > .wordmark { display: inline-block; margin: 8px 0 18px; }
.brand-screen h1 { font-size: clamp(1.8rem, 6vw, 2.5rem); }
.setup-form fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.setup-form legend { font-weight: 750; margin-bottom: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--brand); background: #f5f5ff; }
.choice input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--brand); }
.choice span { display: grid; }
.choice small { color: var(--muted); font-size: .85rem; }
.size-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.size input { position: absolute; opacity: 0; }
.size span { display: grid; place-items: center; min-height: 50px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-weight: 800; cursor: pointer; }
.size input:checked + span { border-color: var(--brand); background: var(--brand); color: #fff; }
.size input:focus-visible + span { outline: 3px solid #a5b4fc; }
.free-note, .unlocked-note, .best { font-weight: 600; font-size: .95rem; }
.unlocked-note { color: var(--good); }
.fidelity { margin-top: 18px; }
.paywall { background: #fff; border-radius: 18px; padding: 24px 20px; box-shadow: var(--shadow); }
.paywall h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); }

.results { background: #fff; border-radius: 18px; padding: 24px 20px; box-shadow: var(--shadow); }
.results h1 { font-size: clamp(2rem, 9vw, 3rem); font-weight: 900; letter-spacing: -0.03em; }
.results.win h1 { color: var(--good); }
.results.lose h1 { color: var(--bad); }
.score { display: flex; align-items: baseline; gap: 4px; margin: 8px 0 16px; }
.score-num { font-size: 4rem; font-weight: 900; line-height: 1; letter-spacing: -0.04em; }
.score-of { font-size: 1.3rem; color: var(--muted); font-weight: 700; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0 0 18px; }
.stats-grid div { background: #fff; padding: 10px 12px; }
.stats-grid dt { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stats-grid dd { margin: 0; font-weight: 800; font-size: 1.1rem; }
.tips { background: var(--bg-2); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.tips h2 { margin: 0 0 6px; font-size: 1.05rem; }
.tips ul { margin: 0; padding-left: 1.2em; font-size: .95rem; }
.share-card { background: linear-gradient(135deg, #1e1b4b, #4f46e5); color: #fff; border-radius: 16px; padding: 20px; margin-bottom: 18px; }
.share-brand { font-weight: 850; font-size: 1.2rem; letter-spacing: -0.04em; }
.share-brand span { color: #fcd34d; }
.share-line { font-weight: 800; letter-spacing: .06em; margin: 10px 0; font-size: .95rem; }
.share-stats { font: 600 1rem/1.6 ui-monospace, Menlo, monospace; }
.share-cta { margin-top: 10px; font-weight: 700; color: #fcd34d; }
.result-actions { display: grid; gap: 10px; }
@media (max-width: 959px) { .practice-flag { padding-right: 170px; } }
