:root {
  font: 15px/1.48 "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1:focus-visible { outline: none; }
button, input:not([type="checkbox"]), select { min-height: 44px; }

#prototype { display: flex; flex-direction: column; min-height: calc(100dvh - var(--header-height)); }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; border: 1px solid var(--rule); background: var(--surface); }
.steps button {
  display: flex; align-items: center; gap: 9px; text-align: left;
  min-width: 0; padding: 7px 10px; border: 0; border-right: 1px solid var(--rule);
  background: transparent; color: var(--ink); font-weight: 580;
}
.steps button:last-child { border-right: 0; }
.steps button:disabled { color: var(--muted); }
.steps button:not(:disabled):hover { background: var(--soft); }
.steps button[aria-current="step"] { background: var(--teal-soft); color: var(--teal-deep); box-shadow: inset 0 -2px var(--teal); }
.step-number {
  flex: none; font: 12px var(--mono); color: var(--muted);
}
[aria-current="step"] .step-number { color: var(--teal-deep); }
main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.page { width: 100%; max-width: var(--creator-width); margin-inline: auto; padding: 28px clamp(20px, 3.4vw, 48px) 25px; }
.intro { margin-bottom: 26px; }
.intro h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1.08; letter-spacing: -.05em; font-weight: 720; }
.intro p { color: var(--muted); font-size: 15px; margin-top: 10px; }
.stage-intro { margin-bottom: 16px; }
.stage-intro p { margin-top: 5px; color: var(--muted); }
.inline-action { display: inline-flex; gap: 8px; align-items: center; }
.character-list { display: grid; gap: 10px; }
.collection-title { align-items: start; margin-bottom: 12px; }
.collection-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.account-controls, .sync-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.account-controls { color: var(--muted); font-size: 13px; }
.sync-bar {
  justify-content: flex-end; width: min(100%, var(--creator-width)); margin-inline: auto;
  padding: 5px clamp(13px, 3.4vw, 48px) 0; color: var(--muted); font-size: 12px;
}
.sync-bar .secondary-button { min-height: 28px; }
.stage { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(282px, 1fr); align-items: start; gap: 22px; }
#stage-content { min-width: 0; display: grid; gap: 15px; }
#preview { min-width: 0; }
.card {
  min-width: 0; border: 1px solid var(--rule); border-radius: 15px; background: var(--surface);
  box-shadow: 0 2px 6px #20353b07;
}
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.title-row > span { color: var(--muted); font-size: 13px; }
h2 { font-size: 18px; line-height: 1.2; letter-spacing: -.022em; }
.muted { color: var(--muted); }
.inner-card, #stage-content > .card:not(.profession) { display: grid; gap: 13px; padding: 20px; }

.profession { overflow: clip; }
.catalogue-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding: 10px 14px 0; }
.catalogue-tabs { display: flex; flex-wrap: wrap; gap: 12px; padding-inline: 14px; border-bottom: 1px solid var(--rule); }
.catalogue-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 0 2px; font-weight: 600; }
.catalogue-tabs button[aria-pressed="true"] { border-color: var(--teal); color: var(--teal-deep); }
.profile-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.create-profession {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 9px;
  border: 0; border-radius: 6px; background: transparent; color: var(--teal-deep);
  font-size: 13px; font-weight: 650; line-height: 1.25;
}
.create-profession:hover { background: var(--teal-soft); }
.create-profession .ui-icon { inline-size: 16px; block-size: 16px; }
.secondary-button, .primary-button {
  padding: 7px 12px; border: 1px solid var(--rule); border-radius: 5px;
  color: var(--ink); background: var(--surface); font-weight: 630;
}
.secondary-button:hover { border-color: var(--teal); color: var(--teal-deep); }
.primary-button { background: var(--teal); border-color: var(--teal); color: #fff; }
.editor-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, .34fr); gap: 10px; }
.editor-add { display: flex; flex-wrap: wrap; gap: 7px; }
.editor-add > :is(.select-control, input) { flex: 1 1 160px; }
.editor-add button { flex: 0 0 auto; }
.custom-skills { display: grid; }
.custom-skill {
  display: grid; grid-template-columns: minmax(0, 1fr) 65px 50px 44px; gap: 8px; align-items: center;
  padding: 6px 0; border-top: 1px solid var(--rule);
}
.custom-skill strong { overflow-wrap: anywhere; }
.custom-skill small { display: block; color: var(--muted); }
.custom-score { text-align: right; font: 600 13px var(--mono); }
.points-tally { font: 600 13px var(--mono); }
.custom-error { color: var(--suite-accent); }
.custom-error:empty, .custom-skills:empty { display: none; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 190px); gap: 9px; padding: 14px; }
.search { position: relative; min-width: 0; }
.search > .ui-icon, .select-control > .ui-icon {
  position: absolute; inset-block-start: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.search > .ui-icon { inset-inline-start: 12px; }
.search input[type="search"] { width: 100%; padding-inline-start: 38px; }
input:not([type="checkbox"]), select, textarea {
  min-width: 0; border: 1px solid #cbd6da; border-radius: 8px; background: var(--surface); color: var(--ink); padding: 9px 11px;
}
.select-control { display: block; position: relative; min-width: 0; }
.select-control select {
  appearance: none; display: block; inline-size: 100%; block-size: 44px;
  padding-block: 0; padding-inline: 12px 39px; line-height: normal;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.select-control > .ui-icon { inset-inline-end: 12px; inline-size: 16px; block-size: 16px; }
input::placeholder { color: #5f6e75; opacity: 1; }
.list-label { display: flex; justify-content: space-between; padding: 8px 44px 8px 16px; border-block: 1px solid var(--rule); background: #f6f8f8; color: var(--muted); font-size: 12px; font-weight: 650; }
.jobs { max-height: min(57vh, 545px); overflow: auto; scrollbar-color: #bfcfca transparent; scrollbar-width: thin; }
.job {
  display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; gap: 11px; align-items: center; width: 100%; min-height: 62px;
  border: 0; border-bottom: 1px solid #e8eeee; background: transparent; text-align: left; color: var(--ink); padding: 8px 14px;
}
.job:last-child { border-bottom-color: transparent; }
.job:hover { background: #f4f8f6; }
.job:focus-visible { outline-offset: -3px; }
.job[aria-pressed="true"] { background: var(--teal-soft); box-shadow: inset 3px 0 var(--teal); }
.job-icon, .preview-icon {
  width: 35px; height: 35px; border-radius: 9px; display: grid; place-items: center;
  background: #e5eceb; color: #36534d; font-weight: 720; font-size: 12px;
}
.job-icon[data-family="0"] { background: #edeaf9; color: #584687; }
.job-icon[data-family="1"] { background: #e1efec; color: #155c49; }
.job-icon[data-family="2"] { background: #f5ecde; color: #72511f; }
.job-icon[data-family="3"] { background: #fae9e9; color: #853b49; }
.job-icon[data-family="4"] { background: #e9eff9; color: #40567c; }
.job-name strong, .job-name small { display: block; overflow-wrap: anywhere; }
.job-name strong { font-size: 14px; font-weight: 660; }
.job-name small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.job-end { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.job-indicator { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 16px; }
.job[aria-pressed="true"] .job-indicator { color: #fff; background: var(--teal); font-size: 11px; }
.empty { padding: 18px 14px; color: var(--muted); }

.dossier { overflow: clip; }
.preview-heading { display: flex; align-items: center; gap: 11px; padding: 16px 18px; background: #193b36; color: #fff; }
.preview-heading h2 { font-size: 14px; letter-spacing: 0; }
.preview-heading p { color: #c9ded8; font-size: 12px; margin-top: 1px; }
.preview-icon { width: 34px; height: 34px; background: #315a50; color: #dceee7; font-size: 20px; }
.preview-body { display: grid; gap: 15px; padding: 18px; }
.preview-body h3 { font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
.preview-body header p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.overview, .vitals { display: grid; gap: 7px; margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview > div, .vitals > div { background: var(--soft); border-radius: 9px; padding: 8px 10px; min-width: 0; }
dt { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
dd { margin: 0; color: #173e35; font-weight: 700; font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.preview-scores h4 { font-size: 13px; margin-bottom: 5px; }
.scores { list-style: none; padding: 0; margin: 0; }
.scores li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.scores li:last-child { border-bottom: 0; }
.scores strong { color: var(--teal-deep); flex: none; font-variant-numeric: tabular-nums; }
.skill-link {
  min-height: 24px; min-width: 0; padding: 0; border: 0; background: transparent;
  color: var(--teal-deep); text-align: start; text-decoration: underline;
  text-underline-offset: .2em; overflow-wrap: anywhere;
}
.skill-link:hover { text-decoration-thickness: 2px; }
.skill-dialog {
  width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 22px;
  border: 1px solid var(--rule); border-radius: 12px; color: var(--ink); background: var(--surface);
}
.skill-dialog::backdrop { background: rgb(10 19 24 / 65%); }
.skill-dialog p { margin-top: 12px; }
.preview-note { color: #435d53; background: var(--teal-soft); padding: 9px 10px; border-radius: 8px; font-size: 12px; }
.pill { background: var(--teal-soft); border-radius: 999px; padding: 4px 9px; color: var(--teal-deep) !important; white-space: nowrap; }
.stat-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr)); gap: 12px; }
.stat-input { display: grid; gap: 8px; border: 1px solid var(--rule); border-radius: 10px; padding: 10px; }
.stat-methods { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 4px; }
.stat-methods button {
  padding: 7px 12px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-weight: 600;
}
.stat-methods button[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-deep); }
.roll-scores { justify-self: start; }
.roll-pool { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; padding: 0; margin: 0; }
.roll-pool li {
  display: grid; justify-items: center; min-width: 62px; padding: 6px 8px;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--teal-soft);
  color: var(--teal-deep); font: 650 18px var(--mono);
}
.roll-pool li[data-assigned="true"] { background: var(--surface); color: var(--muted); }
.roll-pool li span { font: 11px/1.5 "Segoe UI", system-ui, sans-serif; }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 14px; }
.field input { width: 100%; }
.specialty-field { display: grid; gap: 5px; }
.specialty-field > button { justify-self: start; }
.links-title { padding-top: 9px; }
fieldset { margin: 0; padding: 6px 12px 9px; border: 1px solid var(--rule); border-radius: 9px; min-width: 0; }
legend { padding: 0 7px; color: var(--muted); font-size: 13px; font-weight: 650; }
.bond-fields { display: grid; gap: 10px; padding: 10px 12px 12px; }
.bond-identity { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.bond-fields textarea { width: 100%; min-width: 0; resize: vertical; }
.preview-bonds { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--rule); overflow-wrap: anywhere; }
.preview-bonds ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.bond-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.play-tabs { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0 18px; border-bottom: 1px solid var(--rule); }
.play-tabs button {
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); font-weight: 640; padding-inline: 8px;
}
.play-tabs button[aria-current="true"] { border-color: var(--teal); color: var(--teal-deep); }
.live-side, .live-vitals { display: grid; gap: 12px; }
.live-vitals { grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr)); }
.play-skill {
  display: grid; grid-template-columns: minmax(0, 1fr) 4ch auto; align-items: center;
  gap: 10px; min-height: 41px; border-bottom: 1px solid var(--rule);
}
.play-skill > strong { text-align: end; white-space: nowrap; font: 650 13px var(--mono); }
.failure-mark { display: flex; align-items: center; gap: 6px; min-height: 34px; padding-inline: 4px; cursor: pointer; }
.failure-mark input { margin: 0; width: 17px; height: 17px; accent-color: var(--teal); }
.failure-mark:has(:disabled) { color: var(--muted); cursor: default; }
.play-skill:has(input:checked) { background: var(--teal-soft); }
.session-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.session-form .field { flex: 1 1 215px; }
.session-history { list-style: none; display: grid; gap: 18px; padding: 0; margin: 0; }
.session-history > li { border-top: 1px solid var(--rule); padding-top: 12px; overflow-wrap: anywhere; }
.session-history time { color: var(--muted); font-size: 13px; }
.session-history .scores strong { white-space: normal; text-align: end; flex: 0 1 auto; }
.bonuses { max-height: 305px; overflow: auto; scrollbar-width: thin; scrollbar-color: #bfcfca transparent; }
.bonus-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--rule); }
.bonus-row > strong { min-width: 44px; text-align: end; font: 650 13px var(--mono); white-space: nowrap; }
.bonus-actions { display: flex; gap: 4px; }
.bonus-actions button { min-width: 44px; }
.bonus-actions button:disabled { opacity: .43; }
.bonus-specialty summary { cursor: pointer; color: var(--teal-deep); padding-block: 4px; }
.bonus-specialty .editor-add { margin-top: 8px; }
.bonus-specialty p:empty { display: none; }
.option { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 4px 8px; border-radius: 8px; font-size: 14px; }
.option:hover { background: #f4f8f6; }
.option:has(input:checked) { background: var(--teal-soft); }
.option:has(input:disabled) { color: var(--muted); }
.option input { flex: none; accent-color: var(--teal); width: 17px; height: 17px; margin: 0; }
.option strong { margin-left: auto; padding-right: 7px; white-space: nowrap; }

.actions {
  position: sticky; bottom: 0; z-index: 1; margin-top: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--rule); background: var(--surface); padding: 12px clamp(20px, 3.4vw, 48px);
}
.action-copy { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
#step-status { color: #724232; }
.action-buttons { display: flex; gap: 8px; flex-shrink: 0; }
.action-buttons button { padding: 8px 15px; border: 1px solid #cbd6da; background: var(--surface); color: var(--ink); border-radius: 8px; font-weight: 640; }
.action-buttons .accent { background: var(--teal); border-color: var(--teal); color: #fff; }
.action-buttons .accent:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.action-buttons button span { display: inline-block; margin-left: 9px; }

[data-theme="dark"] input:not([type="checkbox"]), [data-theme="dark"] select, [data-theme="dark"] textarea, [data-theme="dark"] .action-buttons button { border-color: #4a565e; }
[data-theme="dark"] input::placeholder { color: var(--muted); }
[data-theme="dark"] .list-label { background: #252d33; }
[data-theme="dark"] .job { border-bottom-color: #354047; }
[data-theme="dark"] .job:hover, [data-theme="dark"] .option:hover { background: #283237; }
[data-theme="dark"] .job[aria-pressed="true"], [data-theme="dark"] .option:has(input:checked) { background: var(--teal-soft); }
[data-theme="dark"] .job[aria-pressed="true"] .job-indicator { color: #10251e; }
[data-theme="dark"] .preview-heading { background: #243932; }
[data-theme="dark"] .preview-note, [data-theme="dark"] dd { color: var(--teal-deep); }
[data-theme="dark"] #step-status { color: var(--suite-accent); }
[data-theme="dark"] .action-buttons .accent, [data-theme="dark"] .primary-button { background: var(--teal); border-color: var(--teal); color: #10251e; }
[data-theme="dark"] .action-buttons .accent:hover, [data-theme="dark"] .primary-button:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.action-buttons button:disabled { opacity: .5; }

@media (max-width: 1060px) {
  .stage { gap: 14px; }
}
@media (max-width: 850px) {
  .steps button { gap: 6px; font-size: 12px; }
  .page { padding-top: 25px; }
}
@media (max-width: 660px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .steps button { display: grid; justify-items: center; text-align: center; align-content: start; line-height: 1.14; padding-inline: 2px; }
  .page { padding-inline: 13px; }
  .actions { padding-inline: 13px; }
  .actions .action-copy { font-size: 12px; }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .jobs { max-height: 370px; }
}
