:root {
  color-scheme: light;
  --ink: #1c2923;
  --ink-soft: #53615a;
  --muted: #778078;
  --paper: #f1f0e9;
  --panel: #fbfaf6;
  --line: #d9d8ce;
  --green: #315844;
  --green-dark: #17231e;
  --red: #9c3e37;
  --gold: #b58b4c;
  --shadow: 0 18px 46px rgb(26 38 31 / 8%);
  font-family: "DM Sans", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgb(53 73 61 / 5%) .65px, transparent .65px), linear-gradient(115deg, rgb(184 151 98 / 7%), transparent 45%);
  background-size: 9px 9px, 100% 100%;
}

button, input { font: inherit; }
button { color: inherit; }

.topbar {
  height: 72px;
  padding: 0 max(5vw, calc((100vw - 1320px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f7f5ed;
  background: var(--green-dark);
  border-bottom: 1px solid rgb(255 255 255 / 12%);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.wordmark small { display: block; margin-top: 3px; color: #a9b6a8; font-size: 9px; font-weight: 500; letter-spacing: 0; }
.wordmark-seal { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #b58b4c; border-radius: 50%; color: #e0c18c; font-family: "Playfair Display", Georgia, serif; font-size: 19px; }
.edition-status { display: flex; align-items: center; gap: 9px; color: #b8c0b6; font-size: 9px; font-weight: 700; letter-spacing: 0; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #84aa79; box-shadow: 0 0 0 4px rgb(132 170 121 / 14%); }

.page-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }
.page-heading { min-height: 190px; display: flex; align-items: center; justify-content: space-between; padding: 28px 10px 22px; animation: rise-in .48s ease both; }
.eyebrow { margin: 0 0 9px; color: var(--red); font-size: 9px; font-weight: 700; letter-spacing: 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-family: "Playfair Display", Georgia, serif; font-size: 43px; line-height: 1.05; font-weight: 600; letter-spacing: 0; }
h1 em { color: var(--red); font-weight: 600; }
.heading-copy { margin: 0; color: var(--ink-soft); font-size: 13px; }
.edition-stamp { display: grid; width: 125px; min-height: 100px; place-content: center; gap: 7px; transform: rotate(3deg); color: var(--red); border: 1px solid rgb(156 62 55 / 62%); outline: 1px solid rgb(156 62 55 / 24%); outline-offset: 4px; text-align: center; }
.edition-stamp span { font-size: 8px; font-weight: 700; letter-spacing: 0; }
.edition-stamp strong { font-family: "Playfair Display", Georgia, serif; font-size: 16px; line-height: 1.08; letter-spacing: 0; }

.edition-picker { display: flex; gap: 3px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.edition-tab { position: relative; display: flex; align-items: center; gap: 10px; min-height: 45px; padding: 0 15px; border: 0; background: transparent; color: #7d827a; font-size: 11px; font-weight: 600; }
.edition-tab.is-active { color: var(--green); }
.edition-tab.is-active::after { position: absolute; right: 14px; bottom: -1px; left: 14px; height: 2px; background: var(--green); content: ""; }
.edition-tab span { color: #969b92; font-size: 8px; letter-spacing: 0; }
.edition-tab.is-active span { color: var(--gold); }
.edition-tab:disabled { cursor: not-allowed; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .82fr); gap: 18px; align-items: start; padding: 22px 0 30px; }
.panel { overflow: hidden; background: var(--panel); border: 1px solid #e0dfd5; box-shadow: var(--shadow); }
.setup-panel, .composition-panel { animation: rise-in .52s ease both; }
.composition-panel { position: sticky; top: 18px; animation-delay: .08s; }
.panel-heading { display: flex; min-height: 77px; align-items: center; justify-content: space-between; padding: 15px 21px; border-bottom: 1px solid #e7e5dc; }
.panel-heading .eyebrow { margin-bottom: 4px; font-size: 8px; }
h2 { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: 22px; line-height: 1.1; font-weight: 600; letter-spacing: 0; }
.panel-mark { color: #c9c8be; font-family: "Playfair Display", Georgia, serif; font-size: 23px; }

.player-setting { padding: 18px 21px 17px; border-bottom: 1px solid #e7e5dc; }
.player-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.player-label-row label { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.player-label-row output { color: var(--green); font-family: "Playfair Display", Georgia, serif; font-size: 30px; font-weight: 700; line-height: 1; }
input[type="range"] { display: block; width: 100%; height: 5px; margin: 0; accent-color: var(--green); cursor: pointer; }
.range-ends { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 9px; }

.composition-block { padding: 17px 21px 16px; border-bottom: 1px solid #e7e5dc; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title-row h3 { margin: 0; font-size: 11px; font-weight: 700; }
.rule-tag { padding: 5px 7px; color: var(--green); background: #edf2ec; font-size: 7px; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.composition-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.count-cell { min-height: 59px; padding: 9px 10px; background: #f3f3ed; border-left: 2px solid var(--role-color, var(--green)); }
.count-cell span { display: block; color: var(--ink-soft); font-size: 9px; }
.count-cell strong { display: block; margin-top: 2px; color: var(--ink); font-family: "Playfair Display", Georgia, serif; font-size: 20px; line-height: 1; }
.composition-note { display: flex; align-items: center; gap: 7px; margin: 12px 0 0; color: var(--ink-soft); font-size: 9px; line-height: 1.4; }
.composition-note img { width: 19px; height: 19px; object-fit: contain; }
.composition-note span { min-width: 0; }
.baron-composition { display: flex; align-items: center; gap: 12px; margin-top: 13px; padding-top: 12px; border-top: 1px dashed #d9d8ce; }
#baron-composition[hidden], #special-composition[hidden] { display: none; }
.baron-label { color: var(--red); font-size: 8px; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.composition-grid.compact { flex: 1; gap: 5px; }
.composition-grid.compact .count-cell { min-height: 42px; padding: 6px 7px; }
.composition-grid.compact .count-cell span { font-size: 8px; }
.composition-grid.compact .count-cell strong { margin-top: 1px; font-size: 16px; }
.special-composition { margin-top: 13px; padding-top: 12px; border-top: 1px dashed #d9d8ce; }
.special-composition .section-title-row { margin-bottom: 9px; }
.modifier-select-label { display: block; margin-bottom: 5px; color: var(--ink-soft); font-size: 9px; font-weight: 600; }
.modifier-select { width: 100%; min-height: 34px; padding: 0 9px; border: 1px solid #deddd3; border-radius: 0; background: #fffefa; color: var(--ink); font-size: 10px; }
.modifier-select:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.special-variants { display: grid; gap: 5px; margin-top: 8px; }
.special-variant { display: flex; min-height: 30px; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; background: #f3f3ed; }
.special-variant span { color: var(--red); font-size: 8px; font-weight: 700; }
.special-variant strong { color: var(--ink-soft); font-size: 9px; font-weight: 500; text-align: right; }

.exclusions-block { padding: 18px 21px 21px; }
.exclusion-title-row { align-items: start; margin-bottom: 11px; }
.exclusion-title-row p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.text-button { padding: 2px 0; border: 0; background: transparent; color: var(--red); font-size: 9px; font-weight: 700; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.search-box { display: flex; height: 35px; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid #deddd3; background: #fffefa; }
.search-icon { position: relative; width: 13px; height: 13px; border: 1.5px solid #858d84; border-radius: 50%; }
.search-icon::after { position: absolute; right: -4px; bottom: -3px; width: 5px; height: 1.5px; transform: rotate(45deg); background: #858d84; content: ""; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 10px; }
.search-box input::placeholder { color: #979b93; }
.character-groups { display: grid; gap: 12px; margin-top: 15px; }
.character-group[hidden], .character-option[hidden] { display: none; }
.character-group h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 7px; color: var(--role-color); font-size: 8px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.character-group h4::after { height: 1px; flex: 1; background: #e6e4db; content: ""; }
.character-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.character-option { position: relative; display: flex; min-width: 0; min-height: 42px; align-items: center; gap: 6px; padding: 5px 7px; border: 1px solid #e4e2d9; background: #fffefa; cursor: pointer; transition: border-color .16s, background .16s, transform .16s; }
.character-option:hover { transform: translateY(-1px); border-color: #9eaa9c; }
.character-option:has(input:checked) { border-color: #bd7770; background: #f8eeeb; }
.character-option img { width: 28px; height: 28px; flex: 0 0 auto; object-fit: contain; }
.character-option span { overflow: hidden; color: #4d5851; font-size: 9px; line-height: 1.15; text-overflow: ellipsis; }
.character-option input { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; margin: 0; accent-color: var(--red); }
.no-search-results { margin: 1px 0 0; color: var(--muted); font-size: 10px; }

.lineup-count { color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: 0; }
.result-area { min-height: 275px; padding: 17px 17px 10px; }
.empty-state { display: grid; min-height: 248px; place-content: center; justify-items: center; text-align: center; }
.empty-seal { display: grid; width: 54px; height: 54px; place-items: center; margin-bottom: 13px; border: 1px solid #c8c8bd; border-radius: 50%; color: #92958b; font-family: "Playfair Display", Georgia, serif; font-size: 27px; }
.empty-state h3 { margin: 0 0 6px; font-family: "Playfair Display", Georgia, serif; font-size: 17px; font-weight: 600; }
.empty-state p { max-width: 200px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.result-groups { display: grid; gap: 13px; }
.result-group h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; color: var(--role-color); font-size: 8px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.result-group h3 span { color: #92968e; font-size: 8px; font-weight: 500; letter-spacing: 0; }
.result-characters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.result-character { display: flex; min-width: 0; min-height: 45px; align-items: center; gap: 7px; padding: 5px 7px; background: #f3f3ed; border: 1px solid #e8e7de; animation: reveal .22s ease both; }
.result-character img { width: 32px; height: 32px; flex: 0 0 auto; object-fit: contain; }
.result-character strong { overflow: hidden; font-size: 9px; font-weight: 600; text-overflow: ellipsis; }
.result-note { padding: 9px 17px; border-top: 1px dashed #deddd3; color: var(--red); font-size: 9px; font-weight: 600; }
.error-message { margin: 0 17px 10px; padding: 9px 10px; border-left: 2px solid var(--red); background: #f8eeeb; color: #773a35; font-size: 10px; line-height: 1.45; }
.action-row { display: flex; gap: 8px; padding: 0 17px 12px; }
.primary-button { display: flex; min-height: 43px; flex: 1; align-items: center; justify-content: center; gap: 9px; border: 0; background: var(--green); color: #fffdf6; font-size: 11px; font-weight: 700; cursor: pointer; transition: background .16s, transform .16s; }
.primary-button:hover:not(:disabled) { transform: translateY(-1px); background: #244632; }
.primary-button:disabled { cursor: not-allowed; opacity: .48; }
.button-spark { color: #e2c78e; font-size: 14px; }
.icon-button { display: grid; width: 43px; height: 43px; flex: 0 0 auto; place-items: center; border: 1px solid #d4d8cf; background: transparent; color: var(--green); cursor: pointer; }
.icon-button:hover:not(:disabled) { background: #edf2ec; }
.icon-button:disabled { color: #aeb3aa; cursor: not-allowed; }
.icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.copy-status { min-height: 15px; margin: 0 17px; color: var(--green); font-size: 9px; }
.fairness-note { margin: 0; padding: 11px 17px 15px; border-top: 1px solid #e7e5dc; color: var(--muted); font-size: 9px; line-height: 1.5; }
.page-footer { display: flex; justify-content: space-between; padding: 0 4px 25px; color: #81867d; font-size: 8px; font-weight: 600; letter-spacing: 0; }
.page-footer a { color: var(--green); font-size: 9px; letter-spacing: 0; text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }

@keyframes rise-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 850px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr) minmax(280px, .8fr); gap: 12px; }
  .panel-heading { padding-right: 16px; padding-left: 16px; }
  .player-setting, .composition-block, .exclusions-block { padding-right: 16px; padding-left: 16px; }
  .character-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .topbar { height: 61px; padding: 0 18px; }
  .page-shell { width: min(100% - 28px, 520px); }
  .page-heading { min-height: 158px; padding: 26px 3px 20px; }
  h1 { font-size: 34px; }
  .heading-copy { max-width: 290px; font-size: 11px; line-height: 1.5; }
  .edition-stamp { width: 91px; min-height: 82px; margin-right: 5px; }
  .edition-stamp strong { font-size: 13px; }
  .edition-picker { overflow-x: auto; padding: 0; }
  .edition-tab { min-height: 42px; flex: 0 0 auto; padding: 0 10px; font-size: 10px; }
  .edition-tab span { display: none; }
  .workspace-grid { grid-template-columns: 1fr; gap: 14px; padding-top: 15px; }
  .setup-panel { grid-row: 1; }
  .composition-panel { position: static; grid-row: 2; }
  .panel-heading { min-height: 70px; }
  .result-area { min-height: 188px; }
  .empty-state { min-height: 161px; }
  .result-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 10px; }
  .result-group:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .result-characters { grid-template-columns: 1fr; }
  .result-character { min-height: 42px; }
  .character-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-footer { padding-top: 1px; }
}

@media (max-width: 390px) {
  .page-shell { width: calc(100% - 20px); }
  .heading-copy { max-width: 230px; }
  .edition-stamp { width: 76px; margin-right: 2px; }
  .composition-grid { gap: 4px; }
  .count-cell { padding-right: 5px; padding-left: 6px; }
  .count-cell span { font-size: 8px; }
  .character-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.topbar-actions { display: flex; align-items: center; gap: 20px; }
.all-tools-link { color: #d4ddd2; font-size: 10px; font-weight: 600; text-decoration: none; }
.all-tools-link:hover { color: #fffdf6; text-decoration: underline; }
.all-tools-link span { margin-left: 4px; color: #d3b679; }
.portal-shell { width: min(980px, calc(100% - 48px)); margin: 0 auto; }
.portal-heading { min-height: 235px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 10px 22px; animation: rise-in .48s ease both; }
.portal-heading h1 { margin-bottom: 10px; }
.portal-heading .heading-copy { max-width: 390px; line-height: 1.5; }
.portal-count { display: grid; width: 108px; height: 108px; flex: 0 0 auto; align-content: center; justify-items: center; gap: 6px; border: 1px solid #c7c9bc; color: var(--green); }
.portal-count strong { font-family: "Playfair Display", Georgia, serif; font-size: 34px; line-height: 1; }
.portal-count span { color: var(--muted); font-size: 8px; font-weight: 700; }
.tools-section { padding: 0 0 34px; animation: rise-in .52s ease both; animation-delay: .07s; }
.tools-section-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 3px 10px; border-bottom: 1px solid var(--line); }
.tools-section-heading h2 { font-size: 20px; }
.tools-section-heading span { color: var(--muted); font-size: 9px; font-weight: 600; }
.tool-link { display: grid; grid-template-columns: 94px minmax(0, 1fr) auto; align-items: center; gap: 20px; margin-top: 14px; padding: 20px; border: 1px solid #dfded4; background: var(--panel); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: border-color .16s, transform .16s, box-shadow .16s; }
.tool-link:hover { transform: translateY(-2px); border-color: #9eaa9c; box-shadow: 0 20px 48px rgb(26 38 31 / 11%); }
.tool-art { position: relative; height: 94px; background: var(--green-dark); }
.tool-art img { position: absolute; object-fit: contain; }
.tool-icon-main { top: 21px; left: 8px; width: 47px; height: 53px; }
.tool-icon-side { top: 9px; right: 4px; width: 36px; height: 40px; }
.tool-icon-small { right: 4px; bottom: 5px; width: 32px; height: 32px; }
.tool-copy .eyebrow { margin-bottom: 5px; font-size: 8px; }
.tool-copy h3 { margin: 0 0 6px; font-family: "Playfair Display", Georgia, serif; font-size: 21px; font-weight: 600; }
.tool-copy > p:not(.eyebrow) { max-width: 540px; margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.tool-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 13px; color: #667168; font-size: 8px; font-weight: 600; }
.tool-meta span { display: inline-flex; align-items: center; gap: 6px; }
.tool-meta .status-dot { width: 6px; height: 6px; box-shadow: none; }
.tool-action { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 10px; font-weight: 700; white-space: nowrap; }
.tool-action b { color: var(--red); font-weight: 600; }
.portal-footer { display: flex; justify-content: space-between; padding: 0 4px 26px; color: #81867d; font-size: 9px; }

@media (max-width: 680px) {
  .topbar-actions { gap: 0; }
  .topbar-actions .edition-status { display: none; }
  .portal-shell { width: min(100% - 28px, 520px); }
  .portal-heading { min-height: 195px; padding: 24px 3px 20px; }
  .portal-heading h1 { font-size: 34px; }
  .portal-heading .heading-copy { max-width: 275px; font-size: 11px; }
  .portal-count { width: 72px; height: 72px; }
  .portal-count strong { font-size: 25px; }
  .portal-count span { font-size: 7px; }
  .tool-link { grid-template-columns: 64px minmax(0, 1fr); gap: 13px; padding: 14px; }
  .tool-art { height: 70px; }
  .tool-icon-main { top: 14px; left: 1px; width: 39px; height: 44px; }
  .tool-icon-side { top: 4px; right: 0; width: 27px; height: 31px; }
  .tool-icon-small { right: 0; bottom: 3px; width: 25px; height: 25px; }
  .tool-copy .eyebrow { font-size: 7px; }
  .tool-copy h3 { font-size: 17px; }
  .tool-copy > p:not(.eyebrow) { font-size: 10px; }
  .tool-meta { gap: 7px 10px; font-size: 7px; }
  .tool-action { grid-column: 2; justify-self: start; }
}

@media (max-width: 390px) {
  .portal-shell { width: calc(100% - 20px); }
  .portal-heading { gap: 8px; }
  .portal-heading .heading-copy { max-width: 220px; }
  .portal-count { width: 60px; height: 60px; }
  .portal-count strong { font-size: 22px; }
  .portal-count span { font-size: 6px; }
  .tool-link { grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 11px; }
  .tool-art { height: 58px; }
  .tool-icon-main { top: 11px; left: 0; width: 32px; height: 37px; }
  .tool-icon-side { width: 23px; height: 26px; }
  .tool-icon-small { width: 22px; height: 22px; }
}