:root {
  color-scheme: dark;
  --bg: #10171c;
  --panel: #171f25;
  --inset: #111a20;
  --line: #2c3b41;
  --text: #f2ebe1;
  --muted: #a0b1b4;
  --copper: #f2a86c;
  --green: #83c9a9;
  font: 16px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; background: radial-gradient(ellipse at 48% 6%, #1b2b32 0%, transparent 60%); }
.page { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.masthead { background: #111a20bb; border-bottom: 1px solid #303e43; }
.masthead-inner { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 13px; color: var(--text); text-decoration: none; font-weight: 760; font-size: .87rem; letter-spacing: .17em; white-space: nowrap; }
.brand b { color: var(--copper); }
.brand-mark { width: 33px; height: 33px; position: relative; background: #f2a86c16; border: 1px solid #886041; display: grid; place-items: center; }
.brand-mark::after { content: ''; width: 16px; height: 19px; background: var(--copper); clip-path: polygon(51% 0, 100% 0, 65% 42%, 100% 42%, 23% 100%, 41% 54%, 0 54%); }
.connection { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; color: var(--muted); font-size: .78rem; }
.connection i, .arena-caption span { background: #9f825d; width: 7px; height: 7px; display: inline-block; flex: none; transform: rotate(45deg); }
.connection[data-status='online'] i { background: var(--green); box-shadow: 0 0 11px #83c9a965; }
.connection[data-status='offline'] i { background: #e68670; }
.heading { padding: 40px 0 24px; }
.eyebrow, .hint-label { font: 700 .67rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow { color: var(--copper); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.55rem, 6vw, 4.65rem); line-height: 1.06; font-weight: 820; letter-spacing: -.062em; margin: 5px 0 7px; }
.heading p { color: var(--muted); }
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 335px); gap: 16px; align-items: start; padding-bottom: 34px; }
.panel { min-width: 0; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 12px 35px #05090c35; }
.panel-head { min-height: 54px; padding: 11px 16px; display: flex; gap: 9px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
h2 { font-size: 1rem; font-weight: 730; }
.tag { display: inline-flex; align-items: center; border: 1px solid #455359; color: var(--muted); background: #19262a; font-size: .72rem; line-height: 1.15; padding: 5px 8px; white-space: nowrap; }
.tag[data-state='running'] { color: var(--copper); border-color: #886041; background: #342821; }
.tag[data-state='won'] { color: var(--green); border-color: #527569; }
.tag[data-state='lost'] { color: #f6a58f; border-color: #86584d; }
.arena { position: relative; overflow: hidden; background: #1b303b; }
#arena { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.arena-caption { position: absolute; bottom: 10px; left: 13px; color: #f3d5ac; font: 700 .64rem/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .13em; display: flex; align-items: center; gap: 8px; padding: 5px 7px; background: #131d22da; border: 1px solid #ad774e75; }
.arena-caption span { width: 5px; height: 5px; background: var(--copper); }
.fight-hud { position: absolute; top: 12px; left: 14px; width: min(260px, calc(100% - 28px)); padding: 6px 9px 8px; background: #101a21dd; border: 1px solid #b47750a0; }
.enemy-name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .73rem; color: #ffceab; }
.enemy-name span { color: var(--text); font-variant-numeric: tabular-nums; }
progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 5px; border: 0; background: #2a3a3f; }
progress::-webkit-progress-bar { background: #2a3a3f; }
progress::-webkit-progress-value { background: var(--green); }
progress::-moz-progress-bar { background: var(--green); }
.enemy-hp::-webkit-progress-value { background: #d87c5b; }
.enemy-hp::-moz-progress-bar { background: #d87c5b; }
.expedition-footer { display: grid; grid-template-columns: 1fr 1fr .78fr; border-top: 1px solid var(--line); }
.expedition-footer > div { min-width: 0; padding: 10px 14px; }
.expedition-footer > div + div { border-left: 1px solid var(--line); }
.expedition-footer strong { display: block; font-size: .84rem; font-weight: 600; overflow-wrap: anywhere; }
.hint-label { display: block; color: var(--muted); margin-bottom: 3px; }
.crew { grid-column: 2; grid-row: 1; }
.crew-content, .secondary-content { padding: 13px 16px 16px; }
.muted { color: var(--muted); font-size: .81rem; }
.notice { margin-bottom: 11px; background: #3b2826; color: #ffc9b7; border: 1px solid #714940; padding: 9px 13px; }
.incoming { color: #ffceab; background: #332820; border-left: 2px solid var(--copper); padding: 7px 9px; margin-bottom: 10px; font-size: .81rem; }
form label:not(.class-choice), legend, .invite-share label { display: block; font-size: .79rem; font-weight: 650; margin-bottom: 5px; color: var(--muted); }
fieldset { padding: 0; border: 0; margin: 12px 0; min-width: 0; }
fieldset legend { padding: 0; }
input:not([type='radio']), select, button { font: inherit; color: inherit; border-radius: 0; border: 1px solid var(--line); background: var(--inset); }
input:not([type='radio']), select { width: 100%; min-width: 0; padding: 8px 9px; }
input::placeholder { color: #829498; opacity: 1; }
button { min-height: 37px; padding: 7px 10px; cursor: pointer; font-size: .81rem; font-weight: 720; transition: background-color .15s, border-color .15s; }
button:hover:not(:disabled) { background: #24343a; border-color: #587078; }
button:disabled { opacity: .52; cursor: default; }
button.primary { background: #eda467; color: #221910; border-color: #eda467; min-height: 41px; }
button.primary:hover:not(:disabled) { color: #21170d; background: #ffc38f; border-color: #ffc38f; }
button.wide { width: 100%; }
:focus-visible { outline: 2px solid #ffe0a9; outline-offset: 3px; }
.classes { display: flex; gap: 7px; }
.class-choice { position: relative; flex: 1; min-width: 0; cursor: pointer; }
.class-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.class-choice > span { display: flex; align-items: center; gap: 6px; justify-content: center; color: var(--muted); background: var(--inset); border: 1px solid var(--line); padding: 8px 3px; font-size: .76rem; line-height: 1.2; min-height: 39px; }
.class-choice input:checked + span { background: #2e2926; color: #ffca9e; border-color: #a57955; }
.class-choice input:focus-visible + span { outline: 2px solid #ffe0a9; outline-offset: 2px; }
.class-icon { --symbol: #ecac78; width: 16px; height: 17px; display: inline-block; background: var(--symbol); flex: none; }
.class-icon.guard { clip-path: polygon(13% 5%, 87% 5%, 87% 65%, 50% 96%, 13% 65%, 13% 5%, 32% 25%, 32% 60%, 50% 77%, 68% 60%, 68% 25%, 32% 25%); }
.class-icon.ranger { --symbol: #86d9b3; clip-path: polygon(82% 0, 98% 0, 98% 42%, 82% 24%, 32% 79%, 47% 79%, 20% 100%, 0 100%, 0 80%, 20% 53%, 20% 68%, 71% 15%, 52% 15%, 68% 0); }
.hero-profile { display: flex; align-items: center; gap: 9px; padding-bottom: 10px; margin-bottom: 11px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.hero-profile strong { display: block; line-height: 1.2; }
.hero-profile .class-icon { width: 24px; height: 25px; }
.join-form { margin-top: 10px; }
.input-action { display: flex; gap: 6px; }
.input-action button { flex: none; }
#accept-invite { margin-bottom: 7px; }
.members { padding: 0; margin: 0 0 9px; list-style: none; display: grid; gap: 5px; }
.member { display: grid; grid-template-columns: 17px minmax(0, 1fr) auto; align-items: center; column-gap: 8px; background: var(--inset); padding: 6px 7px; }
.member strong { min-width: 0; font-size: .83rem; overflow-wrap: anywhere; }
.member span { font-size: .73rem; color: var(--muted); }
.member[data-ready='true'] span { color: var(--green); }
.member progress { grid-column: 2 / -1; margin-top: 4px; }
.tactic-description { margin-top: 4px; font-size: .74rem; }
.party-actions { display: flex; gap: 6px; }
.party-actions button { flex: 1; }
.party-links { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin-top: 3px; }
.text-button { background: transparent; border: 0; padding-inline: 2px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover:not(:disabled) { color: var(--copper); background: transparent; }
.invite-share input { font-size: .78rem; }
.events { margin: 0; padding: 0; list-style: none; max-height: 260px; overflow: auto; }
.events li { display: flex; align-items: baseline; gap: 9px; padding: 6px 1px; font-size: .83rem; color: var(--muted); }
.events li + li { border-top: 1px solid var(--line); }
.events li::before { content: ''; width: 6px; height: 6px; display: block; background: #688188; transform: translateY(-1px); flex: none; }
.events li[data-kind='breach'], .events li[data-kind='warning'] { color: #ffc094; }
.events li[data-kind='combo'], .events li[data-kind='gear'], .events li[data-kind='win'] { color: #a4e3c4; }
.events li[data-kind='breach']::before, .events li[data-kind='warning']::before { background: var(--copper); }
.events li[data-kind='combo']::before, .events li[data-kind='gear']::before, .events li[data-kind='win']::before { background: var(--green); }
.resources { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.resources > span { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; }
.resource { display: inline-block; width: 10px; height: 10px; background: #dda161; transform: rotate(45deg); }
.resource.coil { border: 2px solid #83c9a9; background: transparent; border-radius: 50%; }
.forge-content { padding-top: 7px; }
.recipe { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 7px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recipe h3, .patrol strong { font-size: .84rem; font-weight: 680; }
.recipe p, .forge-caption { color: var(--muted); font-size: .72rem; }
.recipe button { font-size: .73rem; }
.item-mark { width: 21px; height: 22px; background: #d9b28a; }
.item-mark.cloak { clip-path: polygon(21% 14%, 42% 0, 60% 0, 81% 14%, 98% 89%, 71% 100%, 62% 88%, 14% 97%, 4% 89%); }
.item-mark.clamp { background: #c17450; clip-path: polygon(4% 0, 79% 0, 98% 20%, 98% 39%, 75% 39%, 75% 22%, 27% 22%, 27% 75%, 75% 75%, 75% 58%, 98% 58%, 98% 82%, 79% 100%, 4% 100%); }
.forge-caption { margin-top: 7px; }
.patrol { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.patrol p { line-height: 1.35; }

@media (max-width: 840px) {
  .page { width: calc(100% - 32px); }
  .heading { padding-top: 26px; }
  .dashboard { grid-template-columns: minmax(0, 1fr) minmax(255px, 285px); gap: 10px; }
  .expedition-footer > div { padding-inline: 8px; }
  .crew-content, .secondary-content { padding-inline: 11px; }
}

@media (max-width: 620px) {
  .page { width: calc(100% - 22px); }
  .masthead-inner { height: 57px; }
  .brand { font-size: .71rem; letter-spacing: .12em; gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }
  .connection { font-size: .7rem; gap: 5px; }
  .heading { padding-bottom: 15px; }
  .heading p { font-size: .87rem; }
  .dashboard { grid-template-columns: minmax(0, 1fr); }
  .crew { grid-area: auto; }
  .forge { grid-row: 3; }
  .arena-caption { left: 7px; bottom: 6px; font-size: .52rem; }
  .fight-hud { left: 7px; top: 6px; width: min(165px, calc(100% - 14px)); padding: 3px 6px 5px; }
  input:not([type='radio']), select { font-size: 16px; }
  button { min-height: 42px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
