:root {
  --paper: #f3efe5;
  --paper-deep: #e6dfcf;
  --ink: #17191b;
  --muted: #66625a;
  --line: #c8bfad;
  --red: #b21f2d;
  --red-dark: #7e1420;
  --navy: #1b2b38;
  --navy-soft: #2c4354;
  --white: #fffdf8;
  --shadow: 0 12px 30px rgba(27, 25, 21, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, #eee8dc, #f7f4ec 50%, #ece5d7); }
button, input { font: inherit; }
button { cursor: pointer; }
.topbar { height: 68px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: white; box-shadow: 0 3px 14px rgba(0,0,0,.25); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--red); border: 2px solid white; font-family: Georgia, serif; font-weight: 800; font-size: 24px; }
.brand strong { display: block; letter-spacing: .02em; }
.brand small { display: block; color: #cbd5db; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.save-state { font-size: 13px; color: #d5dfd9; }
.save-dot { display: inline-block; width: 8px; height: 8px; background: #73b884; border-radius: 99px; margin-right: 6px; }
.quiet-button, .primary-button { border: 0; border-radius: 4px; padding: 10px 15px; font-weight: 700; }
.quiet-button { color: white; background: rgba(255,255,255,.12); }
.quiet-button:hover { background: rgba(255,255,255,.2); }
.primary-button { color: white; background: var(--red); }
.primary-button:hover { background: var(--red-dark); }
main { width: min(1800px, 100%); margin: 0 auto; padding: 18px; }
.panel, .welcome-card { background: rgba(255,253,248,.94); border: 1px solid var(--line); box-shadow: var(--shadow); }
.welcome-card { max-width: 920px; margin: 8vh auto; padding: 34px; display: grid; gap: 30px; }
.welcome-card h1 { font: 700 42px/1.05 Georgia, serif; margin: 4px 0 12px; }
.welcome-card p { max-width: 65ch; color: var(--muted); }
.eyebrow { margin: 0 0 5px; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; color: var(--red); }
.new-form { display: grid; grid-template-columns: 1fr 220px auto; align-items: end; gap: 12px; padding: 18px; background: var(--paper-deep); border-left: 4px solid var(--red); }
.new-form label { font-size: 13px; font-weight: 700; }
.new-form label span { color: var(--muted); font-weight: 500; }
.new-form input, .text-response input { width: 100%; margin-top: 6px; border: 1px solid var(--line); background: var(--white); padding: 11px; border-radius: 3px; }
.session-list { display: grid; gap: 8px; }
.session-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); background: white; }
.session-row strong { display: block; }
.session-row small { color: var(--muted); }
.session-actions { display: flex; gap: 8px; align-items: center; }
.delete-button { border: 1px solid var(--red); border-radius: 4px; padding: 9px 13px; font-weight: 800; color: var(--red-dark); background: white; }
.delete-button:hover { color: white; background: var(--red-dark); }
.workspace { min-width: 0; }
.character-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 0 2px 9px; }
.character-tab { min-width: 150px; border: 1px solid var(--line); border-bottom: 3px solid transparent; background: #ded7c9; padding: 9px 12px; text-align: left; }
.character-tab.active { background: var(--white); border-bottom-color: var(--red); }
.character-tab strong, .character-tab small { display: block; }
.character-tab small { color: var(--muted); margin-top: 3px; }
.workspace-grid { display: grid; grid-template-columns: minmax(295px, 350px) minmax(460px, 1fr) minmax(300px, 380px); gap: 14px; align-items: start; }
.sheet-panel, .history-panel { padding: 17px; max-height: calc(100vh - 130px); overflow: auto; position: sticky; top: 88px; }
.sheet-title-row, .history-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.sheet-title-row h2, .history-heading h2 { margin: 0; font-family: Georgia, serif; }
.active-badge { padding: 4px 7px; font-size: 10px; font-weight: 900; letter-spacing: .08em; background: var(--red); color: white; }
.career-strip { margin: 12px 0; padding: 10px; background: var(--navy); color: white; font-size: 13px; }
.career-strip strong { display: block; font-size: 15px; }
.career-strip small { color: #c9d4dc; }
.characteristics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 12px 0 16px; }
.characteristic { border: 1px solid var(--line); background: white; text-align: center; padding: 8px 5px; }
.characteristic b { display: block; font-family: Georgia, serif; font-size: 24px; line-height: 1; margin: 4px 0; }
.characteristic small { color: var(--muted); }
details { border-top: 1px solid var(--line); padding: 11px 0 4px; }
summary { font-weight: 800; cursor: pointer; }
.skills-list { margin-top: 9px; display: grid; gap: 2px; }
.skill-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 6px; border-left: 2px solid transparent; }
.skill-row:nth-child(odd) { background: #f5f1e8; }
.skill-row .specialty { padding-left: 13px; color: #333; }
.skill-level { min-width: 24px; height: 24px; display: grid; place-items: center; background: var(--navy); color: white; font-weight: 800; }
.skill-limit-warning { margin-top: 7px; padding: 8px; border: 1px solid var(--red); background: #fff1f1; color: var(--red-dark); font-size: 12px; font-weight: 800; line-height: 1.35; }
.simple-list, .asset-list { display: grid; gap: 6px; margin-top: 9px; }
.simple-item { font-size: 13px; padding: 7px; background: #f5f1e8; }
.asset-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 5px 0; border-bottom: 1px dotted var(--line); }
.play-panel { min-width: 0; display: grid; gap: 14px; }
.event-art { aspect-ratio: 16 / 9; background: #15222c; border: 1px solid #0d171e; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.event-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; color: #c6d0d6; background: radial-gradient(circle at 40% 20%, #304a5d 0, #1b2b38 45%, #111b23 100%); }
.art-placeholder::before, .art-placeholder::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.08); inset: 9%; }
.art-placeholder::after { inset: 14%; border-style: dashed; }
.art-placeholder span { font: 700 28px Georgia, serif; letter-spacing: .12em; }
.art-placeholder small { opacity: .72; }
.event-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 20px; color: white; background: linear-gradient(transparent, rgba(0,0,0,.88)); }
.event-caption strong { font: 700 24px Georgia, serif; }
.event-caption p { margin: 5px 0 0; max-width: 80ch; line-height: 1.35; }
.request-card { padding: 24px; border-top: 5px solid var(--red); min-height: 280px; }
.request-card h1 { margin: 2px 0 8px; font: 700 34px/1.05 Georgia, serif; }
.request-prompt { color: #3f3d38; font-size: 17px; line-height: 1.5; }
.request-options { display: grid; gap: 9px; margin-top: 20px; }
.option-button { width: 100%; display: grid; grid-template-columns: 34px 1fr; gap: 12px; border: 1px solid var(--line); border-left: 4px solid var(--navy); background: white; text-align: left; padding: 13px; }
.option-button:hover { border-left-color: var(--red); background: #fbf6ec; transform: translateY(-1px); }
.option-index { width: 30px; height: 30px; display: grid; place-items: center; background: var(--navy); color: white; font-weight: 900; }
.option-text strong { display: block; font-size: 15px; }
.option-text small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.4; }
.text-response { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 20px; }
.idle-message { margin-top: 20px; padding: 16px; background: var(--paper-deep); }
.dice-pill { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; background: var(--paper-deep); padding: 5px 7px; }
.history-list { display: grid; gap: 8px; margin-top: 16px; }
.history-item { padding: 9px 10px; border-left: 3px solid var(--line); background: #f7f3ea; }
.history-item.roll { border-left-color: var(--red); }
.history-item.choice { border-left-color: var(--navy-soft); }
.history-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.history-item p { margin: 4px 0 0; font-size: 12px; line-height: 1.35; }
.toast { position: fixed; right: 22px; top: 82px; max-width: 480px; z-index: 50; padding: 13px 16px; color: white; background: #8d1d26; box-shadow: var(--shadow); }
@media (max-width: 1180px) {
  .workspace-grid { grid-template-columns: 310px minmax(0, 1fr); }
  .history-panel { position: static; max-height: none; grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  main { padding: 9px; }
  .topbar { padding: 0 12px; }
  .save-state { display: none; }
  .workspace-grid { display: block; }
  .sheet-panel, .history-panel { position: static; max-height: none; margin-bottom: 10px; }
  .play-panel { margin-bottom: 10px; }
  .new-form { grid-template-columns: 1fr; }
}

/* Party / round-robin GUI additions. */
.new-form { grid-template-columns: minmax(240px, 1fr) 180px 180px auto; }
.new-form textarea { width: 100%; min-height: 92px; margin-top: 6px; border: 1px solid var(--line); background: var(--white); padding: 11px; border-radius: 3px; resize: vertical; font: inherit; }
.character-tab.complete { opacity: .72; border-bottom-color: #6f8f72; }
.event-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.event-action { border: 1px solid rgba(255,255,255,.65); border-radius: 4px; padding: 8px 11px; background: var(--red); color: white; font-weight: 800; }
.event-action:hover { background: var(--red-dark); }
.quiet-event-action { background: rgba(27,43,56,.86); }
.benefit-option .option-index { background: var(--red-dark); }
@media (max-width: 980px) { .new-form { grid-template-columns: 1fr 1fr; } .new-form .names-field { grid-column: 1 / -1; } }
@media (max-width: 760px) { .new-form { grid-template-columns: 1fr; } .new-form .names-field { grid-column: auto; } }

.request-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.request-heading-row .eyebrow { margin: 0; }
.connection-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.connection-label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.connection-mini-button { border: 1px solid var(--red); background: transparent; color: var(--red-dark); border-radius: 3px; padding: 4px 7px; font-size: 11px; font-weight: 800; cursor: pointer; }
.connection-mini-button:hover { background: var(--red); color: white; }

/* Per-Traveller audit / dossier export. */
.sheet-title-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.export-button { border: 1px solid var(--navy); border-radius: 4px; padding: 7px 9px; background: white; color: var(--navy); font-size: 11px; font-weight: 800; }
.export-button:hover { background: var(--navy); color: white; }
.history-heading h2 { line-height: 1.15; }

/* Referee creation horizon. */
.term-limit-field { display: grid; gap: 6px; align-self: stretch; }
.term-limit-field > label:first-child { display: block; }
.term-limit-field small { color: var(--muted); font-size: 11px; }
.unlimited-toggle { display: flex !important; align-items: center; gap: 7px; font-size: 11px !important; font-weight: 700 !important; }
.unlimited-toggle input { width: auto !important; margin: 0 !important; }
.term-limit-field input:disabled { opacity: .55; background: #e8e3d8; }

/* Private multi-browser table access. */
.auth-card { max-width: 620px; margin: 8vh auto 0; padding: 28px; background: var(--paper); border-top: 5px solid var(--red); box-shadow: var(--shadow); }
.auth-card h1 { margin: 3px 0 8px; font: 700 34px/1.05 Georgia, serif; }
.auth-card p { line-height: 1.5; color: var(--muted); }
.site-login-form { display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 10px; align-items: end; margin-top: 18px; }
.site-login-form label { font-size: 13px; font-weight: 800; }
.site-login-form input { width: 100%; margin-top: 6px; border: 1px solid var(--line); background: white; padding: 11px; border-radius: 3px; }
.viewer-badge { padding: 5px 8px; border: 1px solid rgba(255,255,255,.35); border-radius: 3px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.share-panel { margin: 0 2px 12px; padding: 16px; border-top: 4px solid var(--navy); }
.share-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.share-heading h2 { margin: 0; font-family: Georgia, serif; }
.share-heading p:not(.eyebrow) { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.share-links { display: grid; gap: 7px; margin-top: 14px; }
.share-row { display: grid; grid-template-columns: minmax(130px, .6fr) minmax(220px, 1.8fr) auto auto; gap: 8px; align-items: center; padding: 8px; background: var(--paper-deep); border: 1px solid var(--line); }
.share-row strong { font-size: 13px; }
.share-url { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 8px; background: white; border: 1px solid var(--line); font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.copy-link-button, .regenerate-link-button { border: 1px solid var(--navy); border-radius: 3px; padding: 7px 9px; background: white; color: var(--navy); font-size: 11px; font-weight: 800; }
.copy-link-button:hover, .regenerate-link-button:hover { background: var(--navy); color: white; }
.regenerate-link-button { border-color: var(--red); color: var(--red-dark); }
.regenerate-link-button:hover { background: var(--red-dark); }
.readonly-note { margin-top: 12px; padding: 10px 12px; background: var(--paper-deep); border-left: 4px solid var(--navy); color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.4; }
.option-button:disabled, .connection-mini-button:disabled, .text-response button:disabled { opacity: .52; cursor: not-allowed; transform: none; }
.character-tab.owned { box-shadow: inset 0 0 0 2px rgba(46,79,99,.22); }
@media (max-width: 760px) {
  .site-login-form { grid-template-columns: 1fr; }
  .share-heading { display: block; }
  .share-heading > button { margin-top: 10px; }
  .share-row { grid-template-columns: 1fr auto; }
  .share-url { grid-column: 1 / -1; grid-row: 2; }
}

/* Persistent account gate inside the optional site-wide password gate. */
.account-card { max-width: 900px; margin: 6vh auto 0; padding: 28px; background: var(--paper); border-top: 5px solid var(--navy); box-shadow: var(--shadow); }
.account-card h1 { margin: 3px 0 8px; font: 700 34px/1.05 Georgia, serif; }
.account-card > div > p:not(.eyebrow) { color: var(--muted); line-height: 1.5; max-width: 75ch; }
.account-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; }
.account-form { display: grid; gap: 12px; align-content: start; padding: 18px; background: var(--paper-deep); border: 1px solid var(--line); }
.account-form h2 { margin: 0 0 2px; font: 700 22px Georgia, serif; }
.account-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 800; }
.account-form label span { color: var(--muted); font-size: 11px; font-weight: 600; }
.account-form input { width: 100%; border: 1px solid var(--line); background: white; padding: 11px; border-radius: 3px; }
@media (max-width: 760px) { .account-forms { grid-template-columns: 1fr; } }

/* Owner administration. */
.admin-panel { max-width: 1380px; margin: 24px auto; padding: 26px; }
.admin-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.admin-heading h1 { margin: 2px 0 8px; font: 700 36px/1.05 Georgia, serif; }
.admin-heading p:not(.eyebrow), .admin-note { color: var(--muted); max-width: 78ch; line-height: 1.45; }
.admin-heading-actions, .admin-row-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.quiet-light-button { border: 1px solid var(--navy); border-radius: 4px; padding: 9px 12px; background: white; color: var(--navy); font-weight: 800; }
.quiet-light-button:hover { background: var(--navy); color: white; }
.admin-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 9px; margin: 22px 0 28px; }
.admin-metric { padding: 13px; border: 1px solid var(--line); background: var(--paper-deep); }
.admin-metric strong { display: block; font: 700 25px Georgia, serif; }
.admin-metric span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.admin-section { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 22px; }
.admin-section h2 { margin: 0; font: 700 25px Georgia, serif; }
.admin-list { display: grid; gap: 7px; margin-top: 12px; }
.admin-row { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(260px, 2fr) auto; gap: 14px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); background: white; }
.admin-row-main strong { display: block; }
.admin-row-main small, .admin-row-meta { color: var(--muted); font-size: 11px; line-height: 1.45; }
.admin-row-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.admin-status { display: inline-block; margin-left: 7px; padding: 2px 5px; border-radius: 3px; font-size: 9px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; background: var(--paper-deep); }
.admin-status.disabled { background: #f8d8d8; color: var(--red-dark); }
.admin-status.admin { background: #dbe5ec; color: var(--navy); }
.admin-audit { display: grid; gap: 5px; margin-top: 12px; }
.admin-audit-row { padding: 8px 10px; border-left: 3px solid var(--navy-soft); background: #f7f3ea; font-size: 12px; }
.admin-audit-row small { display: block; color: var(--muted); margin-top: 2px; }
@media (max-width: 900px) {
  .admin-heading { display: block; }
  .admin-heading-actions { justify-content: flex-start; margin-top: 12px; }
  .admin-row { grid-template-columns: 1fr; }
  .admin-row-actions { justify-content: flex-start; }
}
