@font-face {
  font-family: Barlow Condensed;
  src: url('/static/fonts/barlow-condensed-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: Source Sans 3;
  src: url('/static/fonts/source-sans-3.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --deep: #131419;
  --frost: #1b1c23;
  --ice: #38343a;
  --white: #f9f6ee;
  --ink: #f3eee5;
  --text: #d8d1c7;
  --muted: #bdb6ad;
  --line: #4c4649;
  --surface: #24242c;
  --accent: #e2b66c;
  --accent-ink: #1d1714;
  --danger: #f2a7a9;
  --notice: #492e37;
  --focus: #f8d69c;
  --heading: Georgia, 'Times New Roman', serif;
  --body: 'Source Sans 3', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: var(--frost); color: var(--ink); font: 400 1rem/1.5 var(--body); }
main { flex: 1; }
h1, h2, h3, p, dl { margin: 0; }
h1, h2, h3 { line-height: 1.05; }
h1, h2 { font-family: var(--heading); font-weight: 400; }
h1 { font-size: clamp(2.5rem, 5.3vw, 4.4rem); }
h2 { font-size: 2rem; }
h3 { font-size: 1.18rem; font-weight: 700; }
a { color: inherit; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
p { max-width: 65ch; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.frame { width: min(calc(100% - 3rem), 1190px); margin-inline: auto; }
.visually-hidden, .hero-motto { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 3; top: .75rem; left: 1rem; transform: translateY(-200%); background: var(--accent); color: var(--accent-ink); padding: .7rem 1rem; }
.skip-link:focus { transform: none; }

.topbar { color: var(--ink); background: var(--deep); border-bottom: 1px solid var(--line); }
.nav-wrap, .foot-wrap { display: flex; align-items: center; justify-content: space-between; gap: .65rem 1.25rem; min-height: 68px; }
.brand { font: 400 1.38rem/1 var(--heading); letter-spacing: .03em; text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: .35rem clamp(.6rem, 2vw, 1.35rem); font-weight: 600; }
.topbar nav a { text-decoration: none; padding-block: .42rem; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: .35em; }
.topbar nav .nav-account { border: 1px solid var(--line); border-radius: .22rem; padding-inline: .7rem; }
.foot { background: var(--deep); color: var(--muted); border-top: 1px solid var(--line); }
.foot-wrap { min-height: 85px; }
.foot .brand { font-size: 1.26rem; color: var(--ink); }
.foot p { font-size: .91rem; }

.button, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 43px; border-radius: .3rem; padding: .55rem .95rem; font-weight: 700; text-align: center; text-decoration: none; border: 1px solid transparent; }
.button.primary { background: var(--accent); color: var(--accent-ink); }
.button.primary:hover { background: color-mix(in srgb, var(--accent), var(--accent-ink) 12%); }
.button.subtle { border-color: var(--line); color: var(--ink); background: transparent; }
.button.subtle:hover { background: color-mix(in srgb, var(--ice), transparent 45%); }
.button.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.button.danger:hover { background: var(--notice); }
.text-button { min-height: 0; padding: 0; background: none; color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.back-link { display: inline-flex; align-items: center; gap: .5rem; width: fit-content; font-weight: 650; }
.back-link::before { content: ''; width: .44rem; height: .44rem; border: solid currentColor; border-width: 0 0 1.7px 1.7px; transform: rotate(45deg); }

.hero { background: var(--deep); }
.hero > img { display: block; width: min(100%, 1600px); height: auto; margin-inline: auto; }
.hero-intro { border-block: 1px solid var(--line); background: #202128; }
.hero-content { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem 1.3rem; padding-block: 1rem; }
.hero-content p { color: var(--text); }
.next-steps { padding-block: clamp(1.65rem, 4vw, 2.75rem); }
.quick-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; list-style: none; counter-reset: onboarding; padding: 0; margin: 1rem 0 1.5rem; }
.quick-steps li { counter-increment: onboarding; display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start; align-items: baseline; gap: .25rem .7rem; padding: 1rem; border: 1px solid var(--line); }
.quick-steps li::before { content: counter(onboarding); grid-row: 1 / 3; font: 400 1.55rem/1 var(--heading); color: var(--accent); }
.quick-steps a, .transfer-note a { font-weight: 700; }
.quick-steps p { color: var(--muted); }
.transfer-note { padding-top: .85rem; border-top: 1px solid var(--line); }

.interior { padding-block: clamp(2rem, 6vw, 4rem) clamp(3.25rem, 8vw, 6rem); }
.page-head { margin-bottom: clamp(1.45rem, 3vw, 2.25rem); }
.lead { margin-top: .8rem; color: var(--text); font-size: 1.16rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr); gap: clamp(.9rem, 2vw, 1.55rem); align-items: start; }
.account-split, .staff-split { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.panel { min-width: 0; padding: clamp(1rem, 2.7vw, 1.7rem); border: 1px solid var(--line); border-radius: .43rem; background: var(--surface); }
.panel h2, .panel > p, .form-panel > .button { margin-bottom: .95rem; }
.panel > :last-child { margin-bottom: 0; }
.form-panel { max-width: 44rem; }
.form-panel:has(.device-code) { max-width: 35rem; }
.form-panel:has(.pair-form) { max-width: 42rem; }
.notice { border-inline-start: 3px solid var(--danger); color: var(--ink); background: var(--notice); padding: .75rem .95rem; border-radius: 0 .25rem .25rem 0; }
.notice[role="status"] { color: var(--ink); border-color: var(--accent); background: var(--ice); }
.empty { padding-block: 1rem .45rem; color: var(--text); }
.empty h3 { color: var(--ink); }
.empty p { margin-block: .5rem 1rem; }
.steps { counter-reset: play-step; list-style: none; padding: 0; max-width: 58rem; margin: 0; border-top: 1px solid var(--line); }
.steps li { counter-increment: play-step; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; align-items: center; gap: .55rem 1.1rem; padding-block: 1.25rem; border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(play-step); display: grid; width: 2.3rem; aspect-ratio: 1; place-items: center; background: var(--ice); border-radius: 50%; color: var(--accent); font-weight: 700; }
.steps p { color: var(--text); margin-top: .36rem; }
.play-jump { display: flex; flex-wrap: wrap; gap: .4rem 1.35rem; margin-bottom: 1.7rem; color: var(--accent); }
.play-steps li { grid-template-columns: 2.5rem minmax(0, 1fr); align-items: start; scroll-margin-top: 1rem; }
.play-steps .button { margin-top: .75rem; }
.account-bar { display: grid; gap: .65rem; justify-items: start; }
.account-bar h2, .account-bar p { margin: 0; }
.account-bar p { color: var(--muted); }
.account-bar form { margin-top: .5rem; }
.roster header { display: flex; justify-content: space-between; gap: .6rem 1rem; align-items: center; flex-wrap: wrap; }
.roster header h2 { margin: 0; }
.roster header small { margin-left: .2rem; font: 650 1rem var(--body); color: var(--muted); }
.character { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding-block: .9rem; border-top: 1px solid var(--line); }
.character:first-of-type { margin-top: .85rem; }
.character:last-child { padding-bottom: 0; }
.character-title p, .character-title .status { font-size: .9rem; color: var(--muted); margin-top: .21rem; }
.character > details { flex: 0 1 auto; min-width: 0; text-align: end; }
.character > details[open] { text-align: start; flex-basis: 12rem; }
.delete-form { display: grid; gap: .45rem; }
.delete-form label { font-size: .88rem; }
.history { margin-top: 1.4rem; }
.history-row, .queue-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .8rem; border-top: 1px solid var(--line); padding-block: .75rem; }
.history-row > small { flex-basis: 100%; color: var(--muted); }
.queue-row { text-decoration: none; }
.queue-row:hover strong { text-decoration: underline; }
.history-row .status, .queue-row .status { margin-left: auto; }
.status { display: inline-block; width: fit-content; padding: .13rem .47rem; border-radius: .28rem; background: var(--ice); color: var(--ink); font-size: .87rem; font-weight: 650; }
.review-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1.2rem; }
.review-bar p { color: var(--muted); }
.policy { border-top: 1px solid var(--line); padding-block: .63rem; }
summary { cursor: pointer; font-weight: 650; }
summary small { font-weight: 400; margin-left: .4rem; color: var(--muted); }
.policy-form, .form-layout { display: grid; gap: .8rem; }
.policy .policy-form { margin-top: .75rem; }
.policy-form > button { justify-self: start; }
.form-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-full { grid-column: 1 / -1; }
.policy-form fieldset { margin: 0; border: 1px solid var(--line); border-radius: .32rem; }
.checks { display: grid; gap: .45rem .85rem; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.check { display: flex; align-items: start; gap: .42rem; font-weight: 500; }
.check input { min-width: 1rem; min-height: 1rem; margin: .22em 0 0; accent-color: var(--accent); }
label { font-weight: 650; }
label > input:not([type="checkbox"], [type="radio"]), label > select, label > textarea { display: block; width: 100%; min-height: 43px; margin-top: .31rem; padding: .51rem .69rem; border: 1px solid var(--line); border-radius: .3rem; background: var(--surface); color: var(--ink); font-weight: 500; }
textarea { resize: vertical; }
.pair-form { display: flex; align-items: end; flex-wrap: wrap; gap: .7rem; }
.pair-form input { letter-spacing: .06em; }
.device-code { width: fit-content; padding: .75rem 1rem; border-radius: .32rem; background: var(--ice); font: 700 2.1rem/1 'Barlow Condensed', sans-serif; letter-spacing: .1em; }
pre { max-width: 100%; overflow: auto; padding: .8rem; background: var(--frost); border-radius: .28rem; }
.import-layout { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(245px, 1fr); gap: clamp(1rem, 3vw, 2rem); align-items: start; }
.import-layout > .form-panel { position: sticky; top: 1rem; }
.import-create { margin-top: .8rem; }
.snapshot-sections { display: grid; gap: 1rem; min-width: 0; }
.snapshot-section { padding: clamp(.85rem, 2vw, 1.35rem); }
.snapshot-section h2 { font-size: clamp(1.4rem, 2.25vw, 1.85rem); }
.snapshot-table { overflow-x: auto; }
.snapshot-table table { width: 100%; border-collapse: collapse; text-align: left; }
.snapshot-table th, .snapshot-table td { padding: .45rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.snapshot-table th:first-child { padding-inline-start: 0; }
.snapshot-table thead { color: var(--muted); font-size: .88rem; }
.snapshot-table tbody th { font-weight: 650; }
.snapshot-table tbody tr:last-child > * { border-bottom: none; }
.snapshot-table td { font-variant-numeric: tabular-nums; }
.snapshot-table .custom-item, .import-warning h2 { color: var(--danger); }
.snapshot-table .custom-item { background: var(--notice); }
.import-warning { border-inline-start: 3px solid var(--danger); margin-bottom: 1rem; }
.import-warning .snapshot-table { overflow: visible; }
.import-warning table { table-layout: fixed; }
.import-warning th, .import-warning td { overflow-wrap: anywhere; }
.import-warning thead th:first-child { width: 34%; }
.snapshot-bag { border-top: 1px solid var(--line); padding: .55rem 0; }
.snapshot-bag .snapshot-bag { margin-inline-start: .75rem; }
.snapshot-bag summary { overflow-wrap: anywhere; }
.snapshot-bag .snapshot-table, .snapshot-bag .snapshot-sections { margin-top: .65rem; }
.snapshot-total { color: var(--muted); }
.import-empty { color: var(--muted); margin-block: .5rem; }

.creator-page { padding-top: 1.7rem; }
.creator-page > .back-link { margin-bottom: 1rem; color: var(--text); }
.creator-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(235px, 1fr); grid-template-areas: 'heading heading' 'editor preview'; gap: 1.3rem clamp(1rem, 4vw, 3rem); align-items: start; }
.creator-heading { grid-area: heading; }
.creator-preview { grid-area: preview; position: sticky; top: 1rem; padding: 1.1rem; border: 1px solid var(--line); background: var(--surface); }
.creator-preview h2 { font-size: 1.45rem; margin-bottom: .75rem; overflow-wrap: anywhere; }
.creator-editor { grid-area: editor; min-width: 0; align-self: start; }
.creator-editor > .creator-name { margin-bottom: 1rem; }
.creator-editor > .creator-error { margin-bottom: .9rem; }
.creator-steps { margin-bottom: 1.15rem; }
.creator-steps ol { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); list-style: none; padding: 0; margin: 0; }
.creator-steps button { display: flex; align-items: center; gap: .43rem; width: 100%; min-height: 46px; text-align: left; border: 0; border-bottom: 2px solid var(--line); background: transparent; color: var(--muted); font-weight: 650; padding: .3rem .35rem .55rem; }
.creator-steps button span { display: grid; place-items: center; width: 1.44rem; aspect-ratio: 1; background: var(--ice); color: var(--ink); border-radius: 50%; }
.creator-steps button[aria-current="step"] { color: var(--ink); border-bottom-color: var(--accent); }
.creator-steps button[aria-current="step"] span { color: var(--accent-ink); background: var(--accent); }
.creator-steps button:hover { color: var(--white); }
.creator-stage { display: grid; gap: .95rem; }
.creator-stage + .creator-stage { margin-top: 1rem; }
.creator-steps:not([hidden]) ~ .creator-stage { margin-top: 0; }
.creator-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.creator-field legend, .creator-name { color: var(--ink); font-size: 1.1rem; font-weight: 700; }
.creator-field legend { padding: 0 0 .45rem; }
.creator-name { display: block; }
.field-help { display: block; margin-top: .37rem; color: var(--muted); font-size: .91rem; font-weight: 400; }
.race-options, .face-options, .size-options, .job-options, .nation-options { display: grid; gap: .38rem; }
.race-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.face-options { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.size-options { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 20rem; }
.job-options, .nation-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.creator-option { position: relative; display: block; min-width: 0; }
.creator-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.option-card { display: flex; justify-content: center; align-items: center; height: 100%; min-height: 39px; padding: .36rem .4rem; border: 1px solid var(--line); border-radius: .29rem; background: var(--surface); color: var(--text); cursor: pointer; text-align: center; line-height: 1.2; }
.option-card:hover { border-color: var(--muted); }
.creator-option input:checked + .option-card { border-color: var(--accent); color: var(--white); background: #3b3230; box-shadow: inset 0 -2px var(--accent); }
.creator-option input:focus-visible + .option-card { outline: 3px solid var(--focus); outline-offset: 3px; }
.job-options .option-card, .nation-options .option-card { justify-content: start; text-align: start; align-items: start; min-height: 58px; padding: .55rem .65rem; }
.option-card small { display: block; margin-top: .19rem; color: var(--text); font-weight: 400; font-size: .86rem; }
.creator-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding-top: .2rem; }
.draft-stats { border-top: 1px solid var(--line); }
.draft-stats div { display: flex; justify-content: space-between; gap: .7rem; border-bottom: 1px solid var(--line); padding: .42rem .1rem; }
.draft-stats dt { color: var(--muted); }
.draft-stats dd { margin: 0; font-weight: 650; text-align: end; }
.creator-name input { max-width: 24rem; }

@media (max-width: 850px) {
  .creator-layout { column-gap: 1.25rem; }
  .face-options { gap: .25rem; }
  .face-options .option-card { padding-inline: .18rem; }
}

@media (max-width: 680px) {
  .frame { width: calc(100% - 2.1rem); }
  .nav-wrap { min-height: 59px; }
  .brand { font-size: 1.25rem; }
  .topbar nav { font-size: .9rem; }
  .topbar nav .nav-account { padding-inline: .45rem; }
  .hero-motto { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; margin-bottom: .35rem; font-family: var(--heading); }
  .quick-steps { grid-template-columns: 1fr; gap: .5rem; }
  .quick-steps li { padding: .65rem .75rem; }
  .split { grid-template-columns: 1fr; }
  .import-layout { grid-template-columns: minmax(0, 1fr); }
  .import-layout > .form-panel { position: static; grid-row: 1; }
  .creator-layout { grid-template-areas: 'heading' 'editor'; grid-template-columns: 1fr; }
  .creator-preview { display: none; }
  .race-options .option-card { font-size: .87rem; }
}

@media (max-width: 400px) {
  .brand { font-size: 1.14rem; }
  .topbar nav { gap: .2rem .45rem; font-size: .82rem; }
  .foot-wrap { min-height: 72px; }
  .foot p { font-size: .8rem; }
  .steps li { grid-template-columns: 2.3rem minmax(0, 1fr); }
  .creator-steps button { font-size: .91rem; gap: .28rem; }
}

@media (max-width: 355px) {
  .face-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
