  :root {
    --accent-ink: var(--on-teal);
    --accent2: var(--brass);
    --warn: var(--danger);
  }

  .poe-page { padding: 26px clamp(16px, 2.2vw, 36px) 40px; }
  .poe {
    display: grid;
    grid-template-columns: 250px minmax(560px, 1fr) clamp(320px, 30vw, 620px);
    min-width: 1260px;
    align-items: start;
    border: 1px solid var(--rule);
    background: var(--ground);
  }
  .poe-scroll { min-width: 0; }

  .poe.is-wide { grid-template-columns: 250px minmax(390px, 1fr) clamp(460px, 48vw, 900px); }

  .poe-rail {
    border-right: 1px solid var(--rule);
    background: var(--panel);
    align-self: stretch;
    display: flex;
    flex-direction: column;
  }
  .poe-rail h2, .poe-side h2 {
    margin: 0;
    padding: 16px 16px 10px;
    font-family: var(--mono);
    font-size: 9.5px;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--faint);
  }
  .poe-nav { flex: 1; padding: 0 10px 14px; }
  .poe-nav button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    font-family: var(--display); font-style: italic;
    text-align: left;
    cursor: pointer;
  }
  .poe-nav button:hover { color: var(--ink); border-color: var(--rule); }
  .poe-nav button[aria-current="true"] {
    background: var(--panel-alt);
    border-color: var(--edge);
    color: var(--ink);
  }
  .poe-num {
    width: 20px;
    flex: none;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.14em;
    color: var(--faint);
  }
  .poe-label { flex: 1; font-size: 14.5px; }
  .poe-badge {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--faint);
    max-width: 82px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .poe-nav button[aria-current="true"] .poe-badge { color: var(--teal); }
  .poe-railfoot {
    padding: 14px 16px;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 10px;
    line-height: 1.7;
    color: var(--faint);
  }
  .poe-railfoot b { color: var(--ink); font-weight: 600; }

  .poe-main { min-width: 0; }
  .poe-body { max-width: 720px; padding: 28px 32px 60px; }
  .poe-step {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--brass);
  }
  .poe-body h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 8px 0; }
  .poe-lede {
    font-size: 15.5px;
    line-height: 1.65;
    color: var(--muted);
    margin: 0 0 26px;
    max-width: 60ch;
  }
  .poe-sec[hidden] { display: none; }

  .poe-group, .poe-fieldname {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--faint);
  }
  .poe-group {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--edge);
  }
  .poe-group + .poe-switch { border-top: 0; }
  .poe-group.later { padding-top: 30px; }

  .poe-switch {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 15px 2px;
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
    margin: 0;
  }
  .poe-switch > span:first-child { flex: 1; font-size: 15.5px; line-height: 1.4; }
  .poe-switch input {
    position: absolute;
    opacity: 0;
    width: 44px;
    height: 22px;
    margin: 0;
    cursor: pointer;
  }
  .poe-track {
    width: 44px;
    height: 22px;
    flex: none;
    background: var(--ground);
    border: 1px solid var(--edge);
    position: relative;
    transition: background 0.12s linear, border-color 0.12s linear;
  }
  .poe-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--faint);
    transition: left 0.12s ease, background 0.12s linear;
  }
  .poe-switch input:checked ~ .poe-track { background: var(--teal); border-color: var(--teal); }
  .poe-switch input:checked ~ .poe-track .poe-knob { left: 24px; background: var(--on-teal); }
  .poe-switch input:focus-visible ~ .poe-track { outline: 2px solid var(--teal); outline-offset: 2px; }
  .poe-state {
    width: 30px;
    flex: none;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--faint);
  }
  .poe-switch input:checked ~ .poe-state { color: var(--teal); }

  .poe-days {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 14px 16px;
    border-top: 1px solid var(--edge);
    padding-top: 18px;
  }
  .poe-days label {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted);
  }
  .poe-unit {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--faint);
  }
  .poe input[type="number"], .poe input[type="text"], .poe select {
    box-sizing: border-box;
    background: var(--panel);
    border: 1px solid var(--edge);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 15px;
    padding: 9px 10px;
  }
  .poe input[type="number"] { width: 96px; }
  .poe select { font-size: 13px; padding: 10px; }
  .poe input:focus-visible, .poe select:focus-visible, .poe button:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 1px;
  }

  .poe-bands {
    margin-top: 26px;
    border: 1px solid var(--edge);
    background: var(--panel);
    padding: 16px 18px;
  }
  .poe-band-row {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .poe-band-row span { padding: 7px 11px; border: 1px solid var(--edge); color: var(--muted); }
  .poe-band-row .resident { border-color: var(--teal); color: var(--teal); }
  .poe-band-row .citizen { border-color: var(--brass); color: var(--brass); }

  .poe-table { border: 1px solid var(--edge); }
  .poe-thead {
    display: grid;
    grid-template-columns: 1fr 90px;
    background: var(--panel);
    padding: 11px 16px;
    border-bottom: 1px solid var(--edge);
  }
  .poe-thead span:last-child { text-align: right; }
  .poe-trow {
    display: grid;
    grid-template-columns: 1fr 90px;
    align-items: center;
    padding: 13px 16px;
    border-bottom: 1px solid var(--rule);
    font-size: 15px;
  }
  .poe-trow .count {
    text-align: right;
    font-family: var(--mono);
    font-size: 14px;
    color: var(--teal);
  }
  .poe-note {
    padding: 13px 16px;
    font-family: var(--body);
    font-size: 14px;
    line-height: 1.65;
    color: var(--muted);
    max-width: 68ch;
  }
  .poe-note b, .poe-note strong { color: var(--ink); font-weight: 700; }

  .poe-memo {
    margin: 0 16px 12px;
    padding: 12px 14px;
    border: 1px solid #7d2f28;
    border-left: 3px solid #e2725b;
    border-radius: 6px;
    background: rgba(226, 114, 91, 0.07);
    font-family: var(--body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted);
    max-width: 68ch;
  }
  .poe-memo b, .poe-memo strong { color: #e2725b; font-weight: 700; }
  .poe-memo code {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--edge);
    border-radius: 3px;
    padding: 1px 6px;
  }
  .poe-memo p { margin: 8px 0 0; }
  .poe-memo p:first-child { margin-top: 0; }
  .poe-memo a { color: #e2725b; text-decoration: underline; }
  .poe-memo a:hover { color: var(--ink); }
  .poe-onbehalf {
    margin: 0 0 18px;
    padding: 12px 16px;
    border-left: 3px solid var(--danger, #e2725b);
    background: color-mix(in srgb, var(--danger, #e2725b) 10%, transparent);
    font-size: 14.5px;
    line-height: 1.6;
  }
  .poe-onbehalf a { margin-left: 4px; }

  .poe-modrow {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--rule);
  }
  .poe-modrow span:first-child { flex: 1; min-width: 0; font-size: 15px; }
  .poe-modrow.is-accord { flex-wrap: wrap; row-gap: 9px; }
  .poe-modmanager {
    display: flex; align-items: center; gap: 7px;
    font-size: 13px; letter-spacing: 0.04em;
    color: var(--muted); cursor: pointer; white-space: nowrap;
  }
  .poe-modmanager input { margin: 0; }

  .poe-btn, .poe-pill {
    font-family: var(--mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--edge);
    color: var(--muted);
  }
  .poe-btn { font-size: 10px; letter-spacing: 0.12em; padding: 6px 10px; }
  .poe-btn:hover { border-color: var(--teal); color: var(--teal); }
  .poe-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
  .poe-btn.big { font-size: 11px; padding: 10px 14px; }
  .poe-pill { font-size: 11px; padding: 9px 13px; background: var(--ground); }
  .poe-pill[aria-pressed="true"] {
    background: var(--teal);
    border-color: var(--teal);
    color: var(--on-teal);
  }
  .poe-primary {
    padding: 12px 20px;
    background: var(--teal);
    border: 1px solid var(--teal);
    color: var(--on-teal);
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
  }
  .poe-primary[disabled] { opacity: 0.45; cursor: default; }
  .poe-row { display: flex; gap: 8px; align-items: center; }
  .poe-row input[type="text"] { flex: 1; font-size: 14px; padding: 11px 12px; }

  .poe-stamp-wrap { display: flex; gap: 34px; align-items: flex-start; flex-wrap: wrap; }

  .poe-stamp-set { display: flex; gap: 20px; flex: none; align-items: flex-start; }
  .poe-strike { display: flex; flex-direction: column; align-items: center; gap: 14px; }
  .poe-strike .poe-fieldname { text-align: center; }

  .poe-stamp {
    width: 104px;
    height: 104px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--teal);
    color: var(--teal);
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.12em;
    transform: rotate(-8deg);
  }

  @media (max-width: 620px) {
    .poe-stamp-set { gap: 12px; }
    .poe-stamp { width: 76px; height: 76px; font-size: 16px; }
  }
  .poe-stamp-fields { flex: 1; min-width: 260px; display: grid; gap: 20px; }
  #stampLabel {
    width: 110px;
    font-size: 18px;
    letter-spacing: 0.14em;
    text-align: center;
    text-transform: uppercase;
  }

  .poe-countries {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
  }
  .poe-country {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--ground);
    border: 1px solid var(--edge);
    color: var(--muted);
    font-family: var(--display); font-style: italic;
    font-size: 14.5px;
    text-align: left;
    cursor: pointer;
  }
  .poe-country[aria-pressed="true"] { border-color: var(--teal); color: var(--ink); background: var(--panel-alt); }
  .poe-swatch { width: 26px; height: 26px; flex: none; border: 1px solid var(--edge); }
  .poe-colour-row { display: flex; align-items: center; gap: 14px; }
  .poe-colour-row > span:first-child {
    width: 70px;
    flex: none;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted);
  }
  .poe-colour-row .hex { font-family: var(--mono); font-size: 12px; color: var(--faint); width: 76px; }
  .poe-colour-row input[type="color"] {
    width: 34px;
    height: 26px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--edge);
    cursor: pointer;
  }
  .poe-chips { display: flex; gap: 6px; }
  .poe-chip { width: 22px; height: 22px; border: 1px solid var(--edge); cursor: pointer; padding: 0; }
  .poe-chip[aria-pressed="true"] { outline: 2px solid var(--teal); outline-offset: 1px; }

  .poe-scale {
    display: grid;
    grid-template-columns: 160px 1fr 52px;
    align-items: center;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rule);
  }
  .poe-scale > span:first-child {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted);
  }
  .poe-scale output { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--ink); }
  .poe input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: var(--edge);
    outline: none;
  }
  .poe input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    background: var(--teal);
    border: none;
    cursor: pointer;
  }
  .poe input[type="range"]::-moz-range-thumb {
    width: 13px;
    height: 13px;
    background: var(--teal);
    border: none;
    cursor: pointer;
  }

  .poe-ref { display: grid; gap: 12px; }
  .poe-ref > div { border: 1px solid var(--edge); background: var(--panel); }
  .poe-ref button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    background: transparent;
    border: none;
    color: var(--ink);
    text-align: left;
    padding: 15px 18px;
    cursor: pointer;
  }
  .poe-ref .cmd {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--teal);
  }
  .poe-ref .title { flex: 1; font-family: var(--display); font-style: italic; font-size: 15px; }
  .poe-ref .sign { font-family: var(--mono); font-size: 13px; color: var(--faint); }
  .poe-ref p {
    margin: 0;
    padding: 0 18px 18px;
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--muted);
    max-width: 62ch;
  }

  .poe-side {
    border-left: 1px solid var(--rule);
    background: var(--panel);
    align-self: stretch;
    display: flex;
    flex-direction: column;
  }

  .poe-sticky {
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
  .poe-side h2 { border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
  .poe-preview { padding: 18px; }
  .poe-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--edge);
    overflow: hidden;
    background: repeating-conic-gradient(var(--rule) 0% 25%, var(--panel) 0% 50%) 0 0 / 18px 18px;
  }
  .poe-canvas iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    border: 0;
    transform: scale(var(--poe-scale, 0.16));
    transform-origin: top left;
  }
  .poe-summary {
    padding: 0 18px 18px;
    display: grid;
    gap: 9px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    color: var(--muted);
  }
  .poe-summary div { display: flex; gap: 10px; border-bottom: 1px solid var(--rule); padding-bottom: 7px; }
  .poe-summary .k { color: var(--faint); text-transform: uppercase; letter-spacing: 0.12em; flex: 1; }
  .poe-summary .v { color: var(--ink); text-align: right; }
  .poe-save {
    margin-top: auto;
    position: sticky;
    bottom: 0;
    background: var(--panel);
    border-top: 1px solid var(--rule);
    padding: 16px 18px;
  }
  .poe-dirty {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--faint);
  }
  .poe-dirty.on { color: var(--brass); }
  .poe-save .poe-row { margin-top: 12px; }
  .poe-save .poe-primary { flex: 1; }
  .poe-savenote {
    font-family: var(--mono);
    font-size: 10px;
    line-height: 1.7;
    color: var(--faint);
    margin-top: 12px;
  }
  #status { font-family: var(--mono); font-size: 10.5px; color: var(--teal); margin-top: 10px; min-height: 14px; }

  .connect-btn {
    display: inline-block;
    background: var(--teal);
    color: var(--on-teal);
    padding: 12px 20px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid var(--teal);
  }
  .connect-btn:hover { text-decoration: none; }
  .switch-link {
    background: transparent;
    border: 0;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
  }
  .switch-link:hover { color: var(--danger); }
