:root {
  color-scheme: light;
  --ink: #15110c;
  --ink-soft: #241e17;
  --gold: #f7c548;
  --gold-soft: #fff4ce;
  --orange: #e88316;
  --orange-dark: #a95308;
  --paper: #f4f1eb;
  --surface: #ffffff;
  --surface-muted: #faf8f4;
  --line: #d9d2c7;
  --line-strong: #bcb2a4;
  --muted: #6b655d;
  --danger: #a62d2d;
  --success: #1f6b46;
  font-family: Inter, Aptos, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(232, 131, 22, .42); outline-offset: 3px; }

.topbar {
  position: relative;
  z-index: 10;
  color: #fff;
  background:
    linear-gradient(105deg, transparent 0 67%, rgba(247, 197, 72, .055) 67% 68%, transparent 68%),
    linear-gradient(90deg, #15110c, #201a13);
  border-bottom: 1px solid rgba(247, 197, 72, .38);
  box-shadow: 0 8px 30px rgba(21, 17, 12, .18);
}
.topbar::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; content: ""; background: linear-gradient(90deg, var(--orange), var(--gold) 42%, transparent 78%); opacity: .9; }
.topbar-inner { width: min(100% - 40px, 1180px); min-height: 88px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 18px; color: #fff; text-decoration: none; }
.brand-lockup { display: block; width: 202px; height: 56px; object-fit: contain; object-position: left center; }
.brand-rule { width: 1px; height: 30px; background: rgba(255, 255, 255, .2); }
.brand-context { color: #c9c2b9; font-size: 13px; font-weight: 650; letter-spacing: .035em; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 7px; min-height: 27px; padding: 5px 10px; border: 1px solid #e8c86f; border-radius: 999px; background: var(--gold-soft); color: #6d4300; font-size: 12px; font-weight: 800; letter-spacing: .015em; }
.pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; opacity: .78; }
.pill.dark { border-color: rgba(247, 197, 72, .38); background: rgba(247, 197, 72, .09); color: #f7cf68; }
.pill.slate { border-color: #d3ccc2; background: #efebe5; color: #5d574f; }
.pill.amber { border-color: #f0bd72; background: #fff0d8; color: #8c4905; }

.page-grid {
  min-height: calc(100vh - 88px);
  background:
    linear-gradient(90deg, rgba(21, 17, 12, .035) 1px, transparent 1px),
    linear-gradient(rgba(21, 17, 12, .035) 1px, transparent 1px),
    radial-gradient(circle at 84% 8%, rgba(247, 197, 72, .23), transparent 25rem),
    linear-gradient(180deg, #f8f6f2 0, var(--paper) 38%);
  background-size: 48px 48px, 48px 48px, auto, auto;
}
.container { width: min(100% - 40px, 1180px); margin: auto; padding: 52px 0 76px; }
.eyebrow { margin: 0 0 10px; color: var(--orange-dark); font-size: 13px; font-weight: 850; letter-spacing: .17em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; color: var(--ink); font-size: clamp(35px, 5vw, 56px); line-height: 1.02; letter-spacing: -.042em; }
h2 { margin: 0; letter-spacing: -.015em; }
.lede { max-width: 740px; margin: 18px 0 0; color: #5e5850; font-size: 18px; line-height: 1.65; }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 1.55; }
.section-code { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; color: #766d62; font: 750 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.section-code::before { width: 22px; height: 2px; background: linear-gradient(90deg, var(--orange), var(--gold)); content: ""; }

.card { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: 0 24px 70px rgba(38, 29, 18, .09); }
.card-accent { height: 5px; background: linear-gradient(90deg, var(--orange), var(--gold) 55%, #ffe8a0); }
.card-body { padding: clamp(26px, 4vw, 46px); }
.side-card { padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .92); box-shadow: 0 14px 45px rgba(38, 29, 18, .065); }
.side-card.dark { position: relative; overflow: hidden; border-color: #3f3529; background: var(--ink-soft); color: #fff; }
.side-card.dark::after { position: absolute; right: -48px; bottom: -60px; width: 150px; height: 150px; border: 30px solid rgba(247, 197, 72, .07); border-radius: 38px; content: ""; transform: rotate(18deg); }
.layout { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(290px, .58fr); gap: 26px; align-items: start; }
.stack { display: grid; gap: 18px; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 32px 0; border: 1px solid var(--line); background: var(--surface-muted); }
.fact { min-height: 92px; padding: 17px 18px; border-left: 1px solid var(--line); }
.fact:first-child { border-left: 0; }
.fact-label { margin: 0; color: #7a7268; font-size: 11px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.fact-value { margin: 9px 0 0; font-weight: 800; }

.notice { padding: 20px; border: 1px solid #e8c86f; border-left: 5px solid var(--orange); border-radius: 8px; background: #fffaeb; }
.notice h2 { font-size: 18px; }
.notice p { margin: 7px 0 0; color: #625540; font-size: 14px; line-height: 1.6; }
.error { padding: 14px 16px; border: 1px solid #efb8b8; border-left: 4px solid var(--danger); border-radius: 8px; background: #fff1f1; color: var(--danger); font-size: 14px; line-height: 1.5; }
.success { padding: 14px 16px; border: 1px solid #a8d2ba; border-left: 4px solid var(--success); border-radius: 8px; background: #eff9f3; color: #155637; font-size: 14px; line-height: 1.5; }

.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid #b85d0a; border-radius: 7px; background: linear-gradient(180deg, #ef942c, var(--orange)); color: #17110b; cursor: pointer; font-weight: 850; text-decoration: none; box-shadow: 0 7px 16px rgba(232, 131, 22, .19); transition: filter .16s, border-color .16s, transform .08s, box-shadow .16s; }
.button:hover { filter: brightness(.96); box-shadow: 0 9px 22px rgba(232, 131, 22, .26); }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; filter: grayscale(.5); opacity: .58; }
.button.secondary { border-color: var(--line-strong); background: #fff; color: var(--ink); box-shadow: none; }
.button.secondary:hover { border-color: var(--orange); background: #fff9ec; }
.button.small-button { min-height: 36px; padding: 7px 11px; font-size: 13px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.start-button { margin-top: 18px; }
.full-button { width: 100%; margin-top: 20px; }

.timer { position: relative; margin-top: 30px; padding: 28px; overflow: hidden; border: 1px solid #3e3427; border-radius: 10px; background: linear-gradient(135deg, #15110c, #2b2117); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
.timer::after { position: absolute; top: 0; right: 0; width: 118px; height: 100%; background: linear-gradient(115deg, transparent 30%, rgba(247, 197, 72, .05)); content: ""; }
.timer-label { position: relative; z-index: 1; color: var(--gold); font-size: 12px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.timer-value { position: relative; z-index: 1; margin: 9px 0 0; color: #fff; font: 700 clamp(38px, 6vw, 62px)/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: -.06em; }
.timer-meta { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 15px; margin-top: 13px; color: #c4bbae; font-size: 12px; }
.progress { position: relative; z-index: 1; height: 7px; margin-top: 24px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, .13); }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--gold)); transition: width .3s linear; }

.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 20px; }
.action-box { display: block; min-height: 148px; padding: 20px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: inherit; cursor: pointer; text-decoration: none; transition: border-color .16s, background .16s, transform .16s; }
.action-box:hover { border-color: var(--orange); background: #fffaf0; transform: translateY(-1px); }
.action-icon { width: 34px; height: 34px; display: grid !important; place-items: center; margin: 0 !important; border-radius: 7px; background: var(--ink); color: var(--gold) !important; font-size: 20px !important; font-weight: 800; }
.action-box strong { display: block; margin-top: 14px; }
.action-box > span:last-of-type { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.history { margin: 18px 0 0; padding: 0; list-style: none; }
.history li { padding: 15px 0; border-top: 1px solid #e9e3db; }
.history li:first-child { border-top: 0; padding-top: 0; }
.filename { margin: 0; font-size: 14px; font-weight: 800; }
.metadata { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.side-title { font-size: 18px; }
.protocol-label { color: var(--gold); }
.protocol-copy { position: relative; z-index: 1; margin-bottom: 0; color: #d7d0c7; }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 28px 0; }
.metric { position: relative; overflow: hidden; padding: 19px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.metric::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; background: linear-gradient(90deg, var(--orange), var(--gold)); content: ""; }
.metric-label { margin: 0; color: var(--muted); font-size: 13px; }
.metric-value { margin: 9px 0 0; font-size: 31px; font-weight: 800; letter-spacing: -.04em; }
.admin-title { font-size: clamp(34px, 5vw, 48px); }
.admin-layout { display: grid; grid-template-columns: minmax(280px, .65fr) minmax(0, 1.6fr); gap: 26px; align-items: start; }
.panel-title { font-size: 20px; }
.field { display: grid; gap: 8px; margin-top: 18px; }
.field label { color: #4f4942; font-size: 13px; font-weight: 750; }
.field input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #c7beb2; border-radius: 7px; outline: none; color: var(--ink); background: #fff; }
.field input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232, 131, 22, .15); }
.invite-list { margin: 0; padding: 0; list-style: none; }
.invite { padding: 20px 24px; border-top: 1px solid #e9e3db; }
.invite:first-child { border-top: 0; }
.invite-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.invite-name { margin: 0; font-weight: 800; }
.invite-email { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.invite-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 12px; color: #786f64; font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.created-link { margin-top: 18px; }
.created-link code { display: block; margin: 10px 0; padding: 10px; overflow-wrap: anywhere; border-radius: 6px; background: rgba(255, 255, 255, .65); font-size: 12px; }
.admin-error { margin-top: 16px; }
.timeline-head { padding-bottom: 20px; }
.admin-loading { min-height: 220px; display: grid; place-items: center; }
.admin-empty { padding: 0 24px 28px; }

.center-page { min-height: calc(100vh - 88px); display: grid; place-items: center; padding: 40px 20px; }
.empty-panel { position: relative; width: min(100%, 690px); padding: 48px; overflow: hidden; text-align: left; }
.empty-panel::before { position: absolute; top: 0; bottom: 0; left: 0; width: 7px; background: linear-gradient(180deg, var(--gold), var(--orange)); content: ""; }
.empty-panel::after { position: absolute; right: -60px; bottom: -78px; width: 230px; height: 230px; border: 44px solid rgba(232, 131, 22, .05); border-radius: 54px; content: ""; transform: rotate(14deg); }
.entry-mark { position: absolute; top: 26px; right: 30px; width: 76px; height: 76px; object-fit: contain; opacity: .14; }
.empty-panel h1 { position: relative; z-index: 1; max-width: 540px; font-size: clamp(32px, 6vw, 48px); }
.empty-panel p { position: relative; z-index: 1; max-width: 530px; margin: 17px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.entry-meta { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 18px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); color: #766e63; font: 700 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; letter-spacing: .06em; }
.footer-note { margin-top: 26px; color: #847b70; font-size: 12px; letter-spacing: .025em; text-align: center; }

dialog { width: min(calc(100% - 32px), 470px); padding: 0; border: 1px solid #514334; border-radius: 10px; color: var(--ink); box-shadow: 0 34px 100px rgba(0, 0, 0, .28); }
dialog::backdrop { background: rgba(21, 17, 12, .62); backdrop-filter: blur(3px); }
.dialog-body { padding: 27px; }
.dialog-body h2 { font-size: 23px; }
.dialog-body p { color: var(--muted); line-height: 1.65; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 17px 25px; border-top: 1px solid var(--line); background: #f5f1eb; }
.spinner { width: 30px; height: 30px; border: 3px solid #ded5c8; border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 850px) {
  .layout, .admin-layout { grid-template-columns: 1fr; }
  .facts, .metric-grid { grid-template-columns: 1fr; }
  .fact { border-top: 1px solid var(--line); border-left: 0; }
  .fact:first-child { border-top: 0; }
}
@media (max-width: 650px) {
  .topbar-inner, .container { width: min(100% - 28px, 1180px); }
  .topbar-inner { min-height: 76px; }
  .page-grid, .center-page { min-height: calc(100vh - 76px); }
  .brand-lockup { width: 165px; height: 48px; }
  .brand-rule, .brand-context { display: none; }
  .topbar .pill { font-size: 11px; }
  .container { padding-top: 34px; }
  .action-grid { grid-template-columns: 1fr; }
  .action-box { min-height: 132px; }
  .timer { padding: 22px; }
  .timer-meta, .invite-head { align-items: flex-start; flex-direction: column; }
  .card-body { padding: 23px; }
  .empty-panel { padding: 34px 30px 36px; }
  .entry-mark { top: 20px; right: 20px; width: 58px; height: 58px; }
}
@media (max-width: 420px) {
  .topbar .pill { display: none; }
  .brand-lockup { width: 174px; }
  .timer-value { font-size: 34px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
