:root {
  color-scheme: dark;
  --bg: #143239;
  --card: #1c4249;
  --line: #41616a;
  --ink: #fbf5dc;
  --muted: #b5cdc9;
  --gold: #ffd16f;
  --bright: #ffe39c;
  --paper: #fff5d9;
  --paper-ink: #203d40;
  --paper-muted: #536b65;
  --paper-line: #c5cbb2;
  --sans: "Nunito", "Trebuchet MS", "Segoe UI", sans-serif;
  --serif: var(--sans);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background: radial-gradient(ellipse at 8% 8%, #285253 0%, transparent 50%), linear-gradient(140deg, #17383d, #123039 75%, #193e41);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
button:focus-visible, input:focus-visible, canvas:focus-visible {
  outline: 3px solid #ffb94f;
  outline-offset: 3px;
}
.shell, .creation {
  width: min(1320px, calc(100% - clamp(32px, 7vw, 100px)));
  margin-inline: auto;
}

.site-header {
  background: #13343b;
  border-bottom: 2px solid #426265;
  box-shadow: 0 4px 0 #0c293238;
}
.topbar { display: flex; align-items: center; gap: clamp(25px, 5vw, 78px); min-height: 68px; }
.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.brand img { width: 38px; height: 43px; filter: saturate(1.3); }
.brand > div { display: flex; flex-direction: column; gap: 3px; }
.wordmark { color: #ffe8a3; font: 900 25px/1 var(--sans); letter-spacing: -.055em; }
.brand small { color: #b7c7aa; font: 800 8px var(--sans); letter-spacing: .18em; }
.main-nav { display: flex; gap: 5px; }
.nav-item, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  color: #c9dfd8; background: transparent; border: 1px solid transparent; border-radius: 9px;
}
.nav-item { min-height: 36px; padding: 0 13px; font-size: 13px; font-weight: 700; }
.nav-item[hidden] { display: none; }
.nav-item.active, .nav-item:hover, .icon-button:hover { background: #315459; color: #ffdf8c; border-color: #4b7374; }
.header-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-sep { width: 1px; height: 18px; background: #4c6b6d; }
.session { display: flex; align-items: center; gap: 9px; color: #cbe0d9; font-size: 12px; }
.session i { width: 8px; height: 8px; border-radius: 50%; background: #94db9b; }
#session-name { max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { width: 35px; height: 35px; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ui-icon { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.creation { padding: clamp(20px, 3vw, 38px) 0 28px; }
.roster {
  display: grid; grid-template-columns: minmax(280px,.9fr) minmax(0,1.1fr);
  min-height: clamp(380px,57vh,540px); margin-block: clamp(22px,4vw,50px) 28px;
  overflow: hidden; border: 3px solid #102d32; border-radius: 18px;
  background: var(--paper); box-shadow: 0 5px 0 #0c2830;
}
.roster-cover {
  display: flex; align-items: flex-end; position: relative; isolation: isolate;
  padding: clamp(24px,3.5vw,54px); color: #ffedbe; background-color: #31664f;
  background-size: cover; background-position: 70% center;
}
.roster-cover::after {
  content: ""; position: absolute; pointer-events: none; z-index: -1;
  inset: 10px; border: 1px solid #ffe4a24a; border-radius: 8px;
}
.roster-location { display: inline-flex; align-items: center; gap: 6px; color: #fff0b9; font-size: 13px; font-weight: 750; }
.roster-location svg { width: 16px; height: 16px; }
.roster h1 {
  max-width: 11ch; margin: 8px 0 0; color: #fff5ce; font: 900 clamp(36px,3.8vw,60px)/1.02 var(--sans);
  letter-spacing: -.05em; text-shadow: 0 3px 0 #102c357a;
}
.roster-panel { min-width: 0; align-self: start; color-scheme: light; color: var(--paper-ink); padding: clamp(22px,3vw,44px); }
.roster-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.roster-toolbar h2 { margin: 0; font-size: clamp(20px,2vw,28px); line-height: 1.1; letter-spacing: -.035em; }
.roster-empty { color: var(--paper-muted); margin: 12px 0 19px; font-size: 14px; line-height: 1.5; }
.roster-panel .gold-button { white-space: nowrap; }
.roster-list { margin: 22px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.roster-card {
  display: flex; align-items: center; width: 100%; padding: 0; overflow: hidden;
  color: var(--paper-ink); text-align: left; border: 1px solid #b6c1a3; border-radius: 12px;
  background: #fffae8; box-shadow: 0 2px 0 #314c3d19;
}
.roster-card:hover, .roster-card:focus-visible { border-color: #a37e33; background: #fff0c3; }
.roster-portrait {
  flex: 0 0 clamp(80px,8vw,116px); width: clamp(80px,8vw,116px); min-height: 95px;
  display: grid; align-self: stretch; place-items: center; border-right: 1px solid #b6c1a3;
  background: radial-gradient(ellipse at 50% 40%,#f0f2cc,#c5d0ae 78%,#acbe9e);
}
.roster-portrait canvas { display:block; width: 100%; height:auto; }
.roster-info { display: flex; flex-direction: column; min-width: 0; padding: 12px clamp(10px,1.3vw,18px); gap: 3px; }
.roster-meta, .roster-progress { color: var(--paper-muted); font-size: 12px; font-weight: 650; line-height: 1.45; }
.roster-info strong { overflow-wrap: anywhere; font-size: clamp(19px,1.8vw,25px); letter-spacing: -.035em; line-height: 1.15; }
.roster-enter { display: grid; place-items: center; flex: none; width: 32px; height: 32px; margin-left: auto; margin-right: 12px; border: 1px solid #c0c7ae; border-radius: 50%; color: #406354; background: #e5efd6; }
.roster-enter svg { width: 16px; height: 16px; }
.roster-card:hover .roster-enter { background:#ffda83; border-color:#c5994b; }
.roster-back { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 12px; padding: 4px 0; border: 0; background: transparent; color:#d8e5d9; font-weight:700; font-size:13px; }
.roster-back:hover { color: var(--gold); }
.roster-back .ui-icon { width: 16px; height: 16px; }
.heading-row { margin-bottom: clamp(18px, 2vw, 26px); }
.creation-heading h1 {
  margin: 0 0 7px; color: #fff3c9; font-size: clamp(30px, 3.1vw, 48px); font-weight: 900;
  line-height: 1.02; letter-spacing: -.047em; text-shadow: 0 3px 0 #102c35;
}
.creation-heading p { margin: 0; font-size: 14px; line-height: 1.45; color: #cedeD3; }
.forge {
  display: grid; grid-template-columns: minmax(0, 1.33fr) minmax(340px, 1fr);
  gap: clamp(16px, 2vw, 28px); align-items: stretch;
}
.eyeline {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10px; line-height: 1.35; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.world-preview {
  display: flex; flex-direction: column; overflow: hidden; min-width: 0;
  border: 3px solid #102c33; border-radius: 18px; background: #21454b;
  box-shadow: 0 5px 0 #0c2830, inset 0 1px 0 #69928b70;
}
.preview-header { display: flex; gap: 12px; align-items: center; padding: 13px 18px 14px; }
.preview-location-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #6c8167; border-radius: 12px; color: #ffd16f; background: #355858; }
.preview-location-icon .ui-icon { width: 21px; height: 21px; }
.preview-header .eyeline { color: #b8d3bc; font-size: 9px; }
.preview-header h2 { font-size: clamp(17px, 1.6vw, 22px); letter-spacing: -.035em; margin: 1px 0 0; line-height: 1.1; }
.preview-stage {
  position: relative; flex: 1; overflow: hidden; min-height: 340px;
  border-block: 2px solid #102c33; background: #74a475;
}
#creation-world { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#creation-world:focus-visible { outline-offset: -4px; }
.preview-controls {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  column-gap: 12px; row-gap: 5px; padding: 12px 16px; color: #d1e2d9; font: 600 12px/1.35 var(--sans);
}
.preview-controls > span:first-child { display: inline-flex; align-items: center; gap: 5px; }
.preview-controls kbd {
  padding: 3px 6px; color: #f9f2dc; background: #355a60;
  border: 1px solid #66807a; border-bottom-width: 2px; border-radius: 5px; font: 800 10px var(--sans);
}

.wizard {
  color-scheme: light; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
  color: var(--paper-ink); background: var(--paper); border: 3px solid #123139; border-radius: 17px;
  box-shadow: 0 5px 0 #0c2830;
}
.steps { display: flex; gap: 9px; align-items: center; margin: 0; padding: 13px clamp(14px, 1.8vw, 25px); list-style: none; border-bottom: 1px solid #d0cbb1; background: #edeaca; }
.steps li { display: flex; align-items: center; gap: 9px; flex: 1; }
.steps li:last-child { flex: 0; }
.steps li:not(:last-child)::after { content: ""; height: 2px; border-radius: 2px; background: #c3c8ad; flex: 1; }
.step { display: inline-flex; align-items: center; gap: 6px; padding: 0; color: #53685d; border: 0; background: transparent; font: 800 12px var(--sans); }
.step:disabled { opacity: 1; }
.step b { display: grid; place-items: center; width: 23px; height: 23px; color: #52695c; border: 1px solid #a7b7a1; border-radius: 50%; font-size: 11px; }
.step.current { color: #234a46; }
.step.current b { background: #ebbc55; color: #263e35; border-color: #bf974b; }
.step.done b { background: #b7d5aa; color: #285748; border-color: #98b991; }
.step.done b .ui-icon { width: 13px; height: 13px; }
.wizard-body { flex: 1; container-type:inline-size; padding: 20px clamp(14px, 1.8vw, 25px) 0; }
.wizard h2, .codex-body h2 { font: 900 clamp(22px, 2vw, 30px)/1.15 var(--sans); letter-spacing: -.04em; margin: 0 0 5px; }
.section-desc { margin: 0 0 14px; color: var(--paper-muted); font: 14px/1.45 var(--sans); }

.races { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; margin-top:12px; }
.race-origin { margin:10px 0 0; color:var(--paper-muted); font:13px/1.45 var(--sans); }
@container (max-width:380px) { .races { grid-template-columns:repeat(2,minmax(0,1fr)); } }
.race-card {
  position: relative; isolation: isolate; padding: 0; overflow: hidden; min-width: 0;
  height: clamp(90px, 8vw, 124px); color: white; border: 2px solid #75928a; border-radius: 10px; background:linear-gradient(145deg,#a5b488,#426c62 80%);
}
.race-card img { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; object-fit: cover; object-position: center top; }
.race-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg,#0b3539f2 0%,#143c3c4d 30%,transparent 55%); }
.race-card .race-title { position:absolute; bottom:7px; left:2px; right:2px; text-align:center; white-space:nowrap; font:800 clamp(12px,3.4cqi,14px) var(--sans); text-shadow:0 2px 2px #123538; }
.race-card.selected { border-color: #cf852d; box-shadow: 0 0 0 1px #cf852d; }
.race-card:hover { border-color: #bf812d; }
.selected-check { position: absolute; display: grid; place-items: center; top: 5px; right: 5px; width: 19px; height: 19px; border: 1px solid #ad812c; border-radius: 50%; color: #30452e; background: var(--gold); }
.selected-check .ui-icon { width: 12px; height: 12px; stroke-width: 3; }
.sex-choice { margin: 13px 0; padding: 0; min-width: 0; border: 0; }
.sex-choice legend { margin: 0 0 5px; padding: 0; font-size: 13px; font-weight: 800; }
.sex-options { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; border: 1px solid var(--paper-line); background: #efe9d2; }
.sex-options label { position: relative; cursor: pointer; }
.sex-options input { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; opacity: 0; }
.sex-options span { display: block; padding: 6px 13px; border-radius: 5px; border: 1px solid transparent; font-size: 13px; font-weight: 750; color: var(--paper-muted); }
.sex-options input:checked + span { border-color: #b99c61; color: #2e483c; background: #ffdf97; }
.sex-options input:focus-visible + span { outline: 3px solid #537f70; outline-offset: -2px; }
.world-preview[hidden] { display:none; }
.forge.editing-appearance { grid-template-columns:minmax(0,1fr); max-width:810px; margin-inline:auto; }
.appearance-editor { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:center; gap:clamp(18px,4vw,40px); margin-top:16px; }
.look-preview { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.15fr); align-items:center; justify-items:center; margin:0; padding:14px; border:1px solid #b9b79a; border-radius:12px; background:radial-gradient(ellipse at 50% 62%,#faf6df,#dcdcc1); }
.look-preview img { width:min(100%,150px); aspect-ratio:1; object-fit:cover; object-position:center top; background:#d1d9bc; border:1px solid #acb797; border-radius:50%; }
.look-preview canvas { display:block; width:100%; height:auto; aspect-ratio:1; }
.look-preview figcaption { grid-column:1/-1; min-width:0; padding:4px 0; text-align:center; }
.look-preview strong,.look-preview figcaption span { display:block; }
.look-preview strong { font:800 21px/1.2 var(--sans); color:#30483d; overflow-wrap:anywhere; }
.look-preview figcaption span { margin-top:4px; color:#4e6152; font-size:13px; }
.look-options { min-width:0; }
.look-style,.look-colors legend { color:var(--paper-ink); font:800 14px/1.4 var(--sans); }
.look-style { display:block; margin:0 0 6px; }
#look-style { width:100%; min-height:44px; border:1px solid #95a58f; border-radius:7px; background:#fffcf0; padding:5px 8px; color:var(--paper-ink); font:600 14px var(--sans); }
.look-colors { margin:16px 0 0; padding:0; border:0; min-width:0; }
.look-colors legend { padding:0; display:flex; flex-wrap:wrap; gap:4px 9px; align-items:baseline; }
.look-colors legend span { color:#536257; font-weight:500; font-size:13px; }
.look-swatches { display:flex; align-items:center; flex-wrap:wrap; gap:0 2px; margin:3px -3px 0; }
.look-swatches label { display:grid; position:relative; place-items:center; width:44px; height:44px; cursor:pointer; }
.look-swatches input { position:absolute; inset:0; margin:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.look-swatches label > span { display:grid; place-items:center; width:32px; height:32px; border-radius:50%; border:1px solid #20372f5c; background:var(--swatch); pointer-events:none; }
.look-swatches .ui-icon { width:16px; height:16px; visibility:hidden; border-radius:50%; background:#284438; color:#fff; padding:2px; stroke-width:3; }
.look-swatches input:checked + span { outline:2px solid #315a49; outline-offset:2px; }
.look-swatches input:checked + span .ui-icon { visibility:visible; }
.look-swatches input:focus-visible + span { outline:3px solid #755520; outline-offset:3px; }
@media(max-width:600px) {
  .appearance-editor { grid-template-columns:minmax(0,1fr); gap:15px; margin-top:12px; }
  .look-preview { padding:5px 14px; column-gap:12px; }
  .look-preview img { width:min(100%,106px); }
  .look-preview canvas { width:min(100%,145px); }
  .look-preview figcaption { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:center; gap:0 8px; }
  .look-preview figcaption strong { font-size:17px; }
  #look-style { font-size:16px; }
  .look-colors { margin-top:12px; }
}
.passive { display: flex; gap: 11px; align-items: center; margin: 14px 0 16px; padding: 10px 12px; border: 1px solid #a5c1ae; border-radius: 10px; background: #e3edcf; }
.passive-mark { display: grid; place-items: center; width: 36px; height: 36px; flex: none; color: #3c7462; border: 1px solid #a5c4a2; border-radius: 11px; background: #cedfb8; }
.passive-mark .ui-icon { width: 23px; height: 23px; }
.passive small { display: block; color: #466b56; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.passive h3 { margin: 2px 0; font: 800 17px var(--sans); }
.passive p, .attr-row p { margin: 0; color: #466659; font: 12px/1.4 var(--sans); }
.name-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 800; }
.name-field { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 10px; background: #fffaf0; border: 1px solid #b2b9a6; border-radius: 8px; }
.name-field:focus-within { border-color: #537f70; box-shadow: 0 0 0 1px #6b9987; }
.name-field > span, .name-field .icon-button { color: #66816f; }
.name-field .icon-button:hover { background: #e6edda; border-color: transparent; }
.name-field input { width: 100%; min-width: 0; height: 39px; padding: 0; background: transparent; border: 0; color: var(--paper-ink); font-size: 13px; outline: none; }
.name-field input:focus-visible { outline: none; }
.name-field input::placeholder { color: #6a796f; }
.field-error { margin: 7px 0 0; color: #9b3e29; font: 700 12px/1.4 var(--sans); }
.field-error:empty { display: none; }
.wizard-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 17px clamp(14px, 1.8vw, 25px) 0; padding: 13px 0 17px; border-top: 1px solid #ced0b8; }
.next-note { color: var(--paper-muted); font: 700 12px var(--sans); }
.gold-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 41px; padding: 0 17px; border: 1px solid #ab792f; border-radius: 9px; color: #313c2f; background: #ffcd67; box-shadow: 0 2px 0 #a87c39; font: 850 14px var(--sans); }
.gold-button:hover { background: #ffda80; }
.gold-button .ui-icon { width: 16px; height: 16px; }
.back-button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 0; color: #46655c; background: none; border: 0; font-size: 13px; font-weight: 700; }
.attribute-summary { display: flex; justify-content: space-between; align-items: center; margin: 15px 0 4px; padding: 10px 13px; background: #e3edcf; border: 1px solid #adc5ab; border-radius: 9px; color: #395c49; font-size: 14px; font-weight: 700; }
.attribute-summary b { font-size: 21px; }
.attr-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; min-height: 60px; border-bottom: 1px solid #d1d1ba; }
.attr-icon { color: #6d8763; }
.attr-row h3 { margin: 0 0 3px; font: 800 16px var(--sans); }
.adjust { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.adjust button { width: 30px; height: 30px; padding: 0; color: #315548; background: #dfebce; border: 1px solid #9db8a1; border-radius: 8px; font-weight: 800; }
.adjust button:disabled { opacity: .38; }
.adjust output { min-width: 16px; text-align: center; font: 800 17px var(--sans); }
.starter-gear .passive-mark { width: 44px; height: 44px; background: #f6e5b6; border-color: #c9b783; }
.starter-gear svg { display: block; width: 40px; height: 40px; }
.summary-line { margin: 12px 0 0; color: var(--paper-muted); font: 13px/1.4 var(--sans); }

.site-footer { display: flex; gap: 13px; align-items: center; padding: 3px 0 19px; color: #b7cec4; font-size: 11px; }
.site-footer > span { display: inline-flex; gap: 6px; align-items: center; }
.site-footer .ui-icon { width: 13px; height: 13px; color: #a9c5ad; }
.footer-divider { flex: 1; height: 1px; background: #46635f; }
.site-footer i { font-style: normal; }
#codex-dialog { width: min(500px,calc(100% - 28px)); max-height: 85vh; padding: 0; color-scheme: light; color: var(--paper-ink); background: var(--paper); border: 3px solid #12383c; border-radius: 16px; box-shadow: 0 10px 0 #09262d55,0 22px 65px #081f2bd1; }
#codex-dialog::backdrop { background: #0a242bd4; backdrop-filter: blur(2px); }
.codex-body { padding: 21px; }
.codex-top { display: flex; align-items: center; justify-content: space-between; }
.codex-top .eyeline { color: #5a7862; }
.codex-top .icon-button { color: #476c60; }
.codex-top .icon-button:hover { color: #244940; background: #e6eaca; border-color: #bbcfb4; }
.codex-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin: 14px 0 15px; }
.codex-tabs button { padding: 7px 9px; color: #3b6255; border: 1px solid #b9c6ad; border-radius: 7px; background: #efeed5; font-size: 12px; font-weight: 700; }
.codex-tabs button[aria-pressed=true] { background: #fbd17c; border-color: #be954d; color: #334938; }
.guide-entry { padding: 11px 0; border-top: 1px solid #c8cdb6; }
.guide-entry h3 { margin: 0 0 4px; font: 800 17px var(--sans); }
.guide-entry p { margin: 0; color: #4b635b; font: 14px/1.45 var(--sans); }
#codex-dialog.with-gallery { width:min(780px,calc(100% - 24px)); }
.gallery-filters { display:flex; gap:5px; flex-wrap:wrap; margin:0 0 13px; padding-top:12px; border-top:1px solid #b9c6ad; }
.gallery-filters button { border:1px solid #829e8e; border-radius:6px; padding:6px 12px; background:#f8f6e4; color:#254d42; font:700 13px var(--sans); }
.gallery-filters button[aria-pressed=true] { background:#29594e; color:#fff9e4; border-color:#244d44; }
.gallery-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,158px),1fr)); gap:12px; list-style:none; padding:0; margin:0; }
.gallery-cards li { min-width:0; overflow:hidden; border:1px solid #b2bba4; border-radius:9px; background:#fff9e7; }
.gallery-cards figure { margin:0; }
.gallery-picture { height:clamp(145px,18vw,186px); padding:9px; background:radial-gradient(ellipse at 50% 87%,#d6d9bc,#e8ebd5 68%,#eef0df); border-bottom:1px solid #c7ceaf; }
.gallery-picture img { display:block; width:100%; height:100%; object-fit:contain; }
#gallery-scope { margin:12px 0; }
#gallery-scope label { display:block; font-weight:700; margin-bottom:4px; }
#gallery-chapter { width:100%; min-height:44px; padding:5px 9px; font:inherit; color:var(--paper-ink); background:#fff9e7; border:1px solid #94a68f; border-radius:7px; }
#gallery-ecology { margin:8px 0 14px; }
.gallery-cards figcaption { display:grid; gap:4px; padding:10px; line-height:1.25; }
.gallery-cards figcaption strong { color:var(--paper-ink); font:800 16px/1.15 var(--sans); }
.gallery-cards figcaption span { color:#425d4d; font-size:13px; }
.gallery-cards figcaption small { padding-top:4px; color:#4b5c49; font-size:12px; }
@media (max-width:575px) {
  #codex-dialog.with-gallery .codex-body { padding:14px; }
  .gallery-cards { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .gallery-cards figcaption { padding:8px; }
}
@media (max-width:320px) { .gallery-cards { grid-template-columns:minmax(0,1fr); } }
.origin-gallery { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom: 14px; overflow: hidden; border-radius: 8px; border: 1px solid #b3bba5; background: #eaf0d8; }
.origin-gallery figure { min-width: 0; margin: 0; }
.origin-gallery canvas { display: block; width: 100%; height: auto; }
.origin-gallery figcaption { padding: 5px 0; text-align: center; background: #dfe7ca; border-top: 1px solid #b3bba5; color: var(--paper-ink); font-size: 12px; font-weight: 800; }

@media (max-width: 900px) {
  .forge { grid-template-columns: minmax(0,1.12fr) minmax(300px,1fr); gap: 13px; }
  .topbar { gap: 18px; }
  .preview-controls { font-size: 11px; }
}
@media (max-width: 720px) {
  .roster { grid-template-columns: minmax(0,1fr); min-height: 0; }
  .roster-cover { min-height: 164px; padding: 24px; background-position: center 54%; }
  .roster h1 { max-width: none; font-size: clamp(32px,5vw,42px); }
  .roster-panel { padding: 20px; }
  .roster-toolbar h2 { font-size: 20px; }
  .roster-portrait { flex-basis: 84px; }
  .forge { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .preview-stage { min-height: 0; height: clamp(220px,54vw,340px); flex: none; }
  .preview-header { padding: 9px 14px; }
  .preview-controls { padding: 8px 12px; }
  .topbar { min-height: 58px; gap: 10px; }
  .brand img { width: 30px; height: 34px; }
  .wordmark { font-size: 21px; }
  .brand small { font-size: 7px; }
  .header-sep, .session { display: none; }
  .main-nav { margin-left: auto; }
  .header-tools { margin-left: 0; }
  .race-card { height: clamp(90px,20vw,128px); }
}
@media (max-width: 590px) {
  .main-nav { gap: 3px; }
  .nav-item { width: 34px; min-height: 34px; padding: 0; }
  .nav-label { display: none; }
}
@media (max-width: 490px) {
  .roster { margin-top: 18px; }
  .roster-panel { padding: 16px 12px; }
  .roster-panel .gold-button { min-height: 36px; padding: 0 10px; font-size:12px; gap:5px; }
  .roster-toolbar { gap: 9px; }
  .roster-toolbar h2 { font-size:18px; }
  .roster-portrait { flex-basis: 68px; min-height: 86px; }
  .roster-enter { width: 26px; height: 26px; margin-right: 7px; }
  .roster-list { margin-top: 14px; }
  .shell, .creation { width: calc(100% - 24px); }
  .creation { padding-top: 20px; }
  .creation-heading p { font-size: 13px; }
  .preview-controls { justify-content: flex-start; column-gap: 9px; }
  .preview-controls kbd { font-size: 9px; }
  .creation-heading h1 { font-size: 29px; }
  .attr-row { gap: 7px; }
  .adjust { gap: 5px; }
  .attr-row p { font-size: 11px; }
}
@media (max-width: 350px) {
  .steps, .steps li { gap: 4px; }
  .step { gap: 4px; font-size: 11px; }
  .races { gap: 5px; }
  .passive { padding: 8px; }
  .race-card .race-title { left: 5px; font-size: 14px; }
}

.guide-item-filters { display:grid; grid-template-columns:minmax(0,2fr) minmax(0,3fr); gap:10px; }
.guide-item-filters label { display:grid; gap:5px; color:#3b584e; font-size:12px; font-weight:700; }
.guide-item-filters select { width:100%; min-height:40px; min-width:0; padding:6px 4px; border:1px solid #aab9a1; border-radius:6px; background:#fbf9e9; color:var(--paper-ink); font:inherit; }
.guide-item-heading { margin:18px 0 4px; font-size:16px; }
#guide-editions { list-style:none; margin:0; padding:0; }
#guide-editions li { display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:9px; padding:8px 0; border-top:1px solid #c8cdb6; }
.guide-item-art { display:block; width:42px; height:42px; border:2px solid var(--edition-color); border-bottom-width:4px; border-radius:7px; background:#233c3b; }
#guide-editions li div { display:grid; gap:2px; font-size:13px; }
#guide-editions li strong { color:var(--paper-ink); }
#guide-editions li span, #guide-editions li small { color:#44594d; }
#guide-editions li small { text-align:right; font-size:12px; }
@media (max-width:480px) {
  .guide-item-filters { grid-template-columns:minmax(0,1fr); gap:8px; }
  #guide-editions li { grid-template-columns:42px 1fr; gap:0 9px; }
  .guide-item-art { grid-row:span 2; }
  #guide-editions li small { text-align:left; margin-top:2px; }
}

.j-game {
  --j-ink: #fff7e1;
  --j-muted: #c1d5ce;
  --j-honey: #ffd17e;
  --j-deep: #152b2d;
  --j-card: #234044;
  --j-line: #46605b;
  color: var(--j-ink);
  font-family: "Nunito", "Segoe UI", sans-serif;
  width: min(1380px, calc(100% - 64px));
  margin: 0 auto;
  padding: 19px 0 16px;
}
.j-game *, .j-game *::before, .j-game *::after { box-sizing: border-box; }
.j-game [hidden] { display: none !important; }
.j-game h1, .j-game h2, .j-game h3, .j-game p { margin: 0; }
.j-game button {
  font-family: inherit;
  font-weight: 680;
  touch-action: manipulation;
  color: inherit;
}
.j-game button:enabled { cursor: pointer; }
.j-game button:focus-visible, .j-game canvas:focus-visible { outline: 3px solid #ffdf90; outline-offset: 2px; }
.j-game button:disabled { opacity: .55; cursor: not-allowed; }
.j-game .j-icon { width: 19px; height: 19px; display: inline-block; flex: 0 0 auto; vertical-align: middle; }
.j-toolbar, .j-location, .j-tools, .j-tool, .j-purse, .j-hint, .j-turn, .j-actions-right, .j-combat-controls,
.j-vital-line, .j-vital-name, .j-dialog-heading, .j-command, .j-point-count, .j-panel-actions,
.j-route { display: flex; align-items: center; }
.j-toolbar { justify-content: space-between; gap: 15px; flex-wrap: wrap; margin-bottom: 14px; }
.j-location { gap: 11px; min-width: 0; }
#j-location-chapter { display: block; color: var(--j-muted); font-size: 12px; line-height: 1.3; }
.j-map-pin {
  color: #f4c370; background: #32423b; display: grid; place-items: center; width: 38px; height: 38px;
  border: 2px solid #776b47; border-radius: 12px; box-shadow: inset 0 1px #ffffff15;
}
.j-map-pin .j-icon { width: 23px; height: 23px; }
.j-location h1 { font: 750 clamp(22px, 2.3vw, 36px)/1.1 "Nunito", "Trebuchet MS", sans-serif; letter-spacing: -.035em; color: #f6edcf; }
.j-tools { gap: 8px; }
.j-purse { color: #f9d68d; gap: 6px; padding-right: 9px; font-size: 13px; }
.j-purse b { font-weight: 800; font-variant-numeric: tabular-nums; }
.j-purse .j-icon { width: 20px; height: 20px; stroke: #ffda8d; fill: #70522b; }
.j-tool, .j-command, .j-plus, .j-close {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid #526d66; border-radius: 9px; background: #2a4444;
  box-shadow: inset 0 1px #ffffff0c, 0 2px #101c1b; color: #f9f3df;
  min-height: 39px; padding: 7px 12px; font-size: 13px; line-height: 1.2;
}
.j-tool .j-icon { color: #e0c88e; width: 17px; height: 17px; }
.j-auto-controls { display:flex; align-items:stretch; flex-wrap:wrap; gap:4px; margin-left:auto; max-width:100%; }
.j-game .j-auto-tool { gap:8px; min-height:41px; }
.j-auto-choice {
  display:grid; align-content:center; gap:1px; min-width:0; padding:3px 8px;
  border:1px solid #526d66; border-radius:9px; background:#223a3c;
}
.j-auto-choice > span { color:var(--j-muted); font-size:10px; font-weight:650; }
.j-auto-choice select {
  width:100%; padding:0; border:0; background:transparent; color:var(--j-ink);
  font-family:inherit; font-size:13px; font-weight:700; line-height:1.2; color-scheme:dark; cursor:pointer;
}
.j-auto-choice option { color:var(--j-ink); background:var(--j-deep); }
.j-auto-choice:focus-within { outline:3px solid #ffdf90; outline-offset:2px; }
.j-auto-tool small { color: #c1d0c5; font-size: 11px; font-weight: 650; }
.j-auto-tool[aria-pressed="true"] { background: #385549; border-color: #9abc89; }
.j-auto-tool[aria-pressed="true"] small { color: #d4f1ae; }
.j-game .j-panel-auto { margin-left: auto; padding: 5px 8px; min-height: 34px; font-size: 11px; }
.j-badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px;
  background: #ffc977; color: #3e3520; border-radius: 6px; font-size: 11px; line-height: 1; font-weight: 850;
}
.j-tool:enabled:hover, .j-command:enabled:hover, .j-close:hover, .j-route:hover { background: #355456; border-color: #85a595; }
.j-frame {
  background: var(--j-deep); border: 3px solid #3b554d; border-radius: 14px; overflow: hidden;
  box-shadow: inset 0 1px #7f9980, 0 5px #0e1b1c, 0 12px 32px #0003;
}
.j-world { position: relative; isolation: isolate; background: #42674d; }
.j-canvas { display: block; width: 100%; height: clamp(375px, 62vh, 680px); touch-action: none; }
.j-game canvas:focus-visible { outline-offset: -3px; }
.j-vitals-wrap {
  pointer-events: none; position: absolute; z-index: 2; inset: 14px 15px auto;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.j-player-hud, .j-enemy {
  background: #192e32ee; color: #fff5d9; border: 2px solid #99a77b; border-radius: 11px;
  box-shadow: 0 3px 0 #1e2c288c; font-variant-numeric: tabular-nums;
}
.j-player-hud { display: flex; gap: 9px; align-items: center; padding: 7px 10px 7px 7px; max-width: 235px; }
.j-avatar {
  width: 42px; height: 46px; flex: 0 0 auto; border-radius: 7px; border: 1px solid #a8a879;
  position:relative; overflow:hidden; background:linear-gradient(145deg,#a9bd83,#45675a);
}
.j-avatar img { position:absolute; width:145%; max-width:none; height:auto; left:-22%; top:-5%; }
#j-vitals { width: 139px; min-width: 0; }
.j-vital-name { justify-content: space-between; gap: 7px; margin-bottom: 2px; }
.j-vital-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; }
.j-vital-name > span { color: #f9d481; font-size: 10px; font-weight: 800; flex: none; }
.j-vital-line { gap: 5px; }
.j-vital-line .j-icon { width: 11px; height: 11px; color: #e9a596; }
.j-experience .j-icon { color: #efd38b; }
.j-wielding { color: #dfd5b3; font-size: 10px; font-weight: 650; line-height: 1.3; margin-top: 3px; }
.j-secondary-item { margin-top: 1px; color: #bbd1c4; }
.j-vital-line small { width: 38px; text-align: right; font-size: 9px; line-height: 1.45; flex: none; color: #f4edd8; }
.j-meter {
  flex: 1; display: block; height: 6px; overflow: hidden; border-radius: 99px;
  background: #0e2126; border: 1px solid #49615e;
}
.j-meter > i { display: block; height: 100%; transition: width .2s; border-radius: inherit; }
.j-hp i { background: #9ed480; }
.j-xp i { background: #ffd27a; }
.j-enemy-hp i { background: #e98e75; }
.j-enemy { width: 215px; border-color: #b4937a; padding: 8px 10px; }
.j-enemy > strong { font-size: 13px; font-weight: 780; display: block; margin-bottom: 4px; }
.j-enemy > strong .j-icon { width: 13px; height: 13px; color: #ffcf80; }
.j-wave-context, .j-enemy-trait { display: block; font-size: 11px; line-height: 1.3; color: var(--j-muted); }
.j-wave-context { margin-bottom: 3px; color: #f5d99e; font-weight: 700; }
.j-enemy-trait { margin-top: 4px; }
.j-status-effect { display:block; margin-top:3px; color:#f9cd9c; font-size:11px; line-height:1.3; }
.j-enemy-xp { display: block; color: #f2d59c; font-size: 10px; margin-bottom: 3px; }
.j-targets { display:flex; align-items:center; gap:12px; padding:7px 15px; background:#192f33; border-top:1px solid #53716b; }
.j-targets[hidden] { display:none; }
.j-target-label { display:flex; align-items:center; gap:5px; color:var(--j-muted); font-size:12px; font-weight:700; }
.j-target-label .j-icon { width:16px; height:16px; }
.j-target-options { display:flex; flex-wrap:wrap; gap:6px; min-width:0; }
.j-target { display:flex; gap:7px; align-items:center; padding:5px 10px 5px 6px; min-height:40px; border:1px solid #57746b; border-radius:7px; background:#233e40; color:var(--j-ink); text-align:left; line-height:1.2; }
.j-target[aria-pressed="true"] { border-color:#edc680; background:#3c4840; }
.j-target:enabled:hover { background:#345052; }
.j-target-index { display:grid; place-items:center; width:22px; height:22px; flex:none; color:#e3efdf; font-size:12px; border:1px solid #7d9788; border-radius:50%; }
.j-target[aria-pressed="true"] .j-target-index { background:#f4d391; color:#2d3630; border-color:#f8e2b2; }
.j-target-index .j-icon { width:13px; height:13px; }
.j-target-copy { display:grid; gap:3px; }
.j-target-copy strong { font-size:12px; }
.j-target-copy small { color:var(--j-muted); font-size:10px; }
.j-target-health { display:block; height:3px; background:#0e2427; border-radius:5px; overflow:hidden; }
.j-target-health i { height:100%; display:block; background:#df957e; }
.j-target-down { opacity:.65; }
.j-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 71px; padding: 11px 17px; border-top: 2px solid #516652;
  background: linear-gradient(100deg,#243f40,#203739);
}
.j-hint, .j-turn { gap: 11px; min-width: 0; }
.j-hint-glyph, .j-item-icon {
  width: 35px; height: 35px; flex: none; display: grid; place-items: center; border-radius: 9px;
  color: #f7d293; background: #37504b; border: 1px solid #67765e;
}
.j-hint strong, .j-turn strong { display: block; font-size: 15px; font-weight: 780; }
.j-hint p { color: var(--j-muted); font-size: 12px; line-height: 1.45; margin-top: 3px; }
.j-turn small { color: #ecd092; font-size: 11px; font-weight: 700; }
.j-turn p { color: var(--j-muted); font-size: 12px; line-height: 1.35; margin: 3px 0 0; max-width: 55ch; }
.j-actions-right, .j-combat-controls, .j-panel-actions { gap: 8px; }
.j-battle-actions { flex:1; min-width:0; }
.j-basic-cycle {
  display:inline-grid; grid-template-columns:20px auto; color:#f2dcad; align-items:center;
  gap:4px 6px; font:700 12px/1.15 var(--sans); padding:5px 8px;
}
.j-basic-cycle .j-icon { width:18px; height:18px; }
.j-basic-cycle > span { grid-column:1/-1; height:4px; border-radius:8px; overflow:hidden; background:#536361; }
.j-basic-cycle i { display:block; height:100%; background:#f2c475; transform-origin:left; }
.j-game .j-touch-cooldown[hidden] { display:none; }
.j-game .j-skill-symbol { position:relative; }
.j-game .j-touch-cooldown:not([hidden]) {
  position:absolute; bottom:-3px; right:-4px; min-width:18px; height:18px; padding:1px 3px;
  display:grid; place-items:center; border-radius:8px; background:#263338; color:white; font:700 11px/1 system-ui;
}
@media (max-width:760px), (pointer:coarse) and (max-width:1024px) {
  .j-battle-actions .j-basic-cycle { align-self:center; margin-right:auto; font-size:10px; gap:3px; max-width:65px; }
}
.j-battle-row, .j-skills-caption { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.j-battle-skills { margin-top:9px; border-top:1px solid #48615b; padding-top:6px; }
.j-skills-caption { flex-wrap:wrap; gap:3px 8px; }
.j-skills-caption > div { display:flex; align-items:baseline; flex-wrap:wrap; gap:3px 9px; }
.j-skills-caption strong { color:var(--j-ink); font-size:12px; }
.j-skills-caption span { color:var(--j-muted); font-size:11px; }
.j-game .j-skills-caption .j-command {
  min-height:27px; padding:2px 5px; color:var(--j-honey); background:transparent; border:0; box-shadow:none;
}
.j-skills-caption .j-command > span { color:inherit; }
.j-skills-caption .j-command .j-icon { width:14px; height:14px; }
.j-skill-buttons { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(205px,100%),1fr)); gap:7px; margin-top:4px; }
.j-skill-button {
  width:100%; display:flex; align-items:flex-start; gap:8px; padding:8px; border:1px solid #638176;
  border-radius:8px; background:#284548; text-align:left; line-height:1.3;
}
.j-skill-button:enabled:hover { background:#355453; border-color:#b7c69f; }
.j-game .j-skill-button:disabled { opacity:.7; }
.j-game .j-skill-chosen { background:#3b5146; border-color:#e7c77c; }
.j-skill-symbol {
  flex:none; display:grid; place-items:center; width:28px; height:28px; border-radius:7px;
  background:#172e32; border:1px solid #52645d;
}
.j-skill-symbol .j-icon { width:17px; height:17px; }
.j-skill-copy { min-width:0; }
.j-skill-copy strong { display:block; font-size:13px; }
.j-skill-copy > span { display:block; color:#d1dcd1; font-size:11px; font-weight:450; margin-top:2px; }
.j-skill-copy small { color:var(--j-honey); font:inherit; }
.j-skill-button kbd { margin-left:auto; color:var(--j-honey); font:700 10px/1.45 "Segoe UI",sans-serif; border:1px solid #84937d; border-radius:4px; padding:0 4px; }
.j-result-actions { flex-wrap: wrap; justify-content: flex-end; }
.j-command { white-space: nowrap; }
.j-command .j-icon { width: 16px; height: 16px; }
.j-command kbd {
  color: #f7e3ab; border: 1px solid #a8aa8866; border-radius: 4px; background: #111d1b44;
  font: 700 9px/1.4 "Segoe UI",sans-serif; min-width: 15px; padding: 0 3px; text-align: center;
}
.j-game .j-bold, .j-game .j-plus {
  border-color: #e9bd70; color: #3b321f; background: #ffce7b;
  box-shadow: inset 0 1px #ffebaa, 0 2px #846532;
}
.j-game .j-bold:enabled:hover, .j-game .j-plus:enabled:hover { background: #ffe1a1; border-color: #f7d393; }
.j-bold kbd { background: #e9b161; color: #58432c; border-color: #ac874c; }
.j-note { color: #e9d8aa; font-size: 13px; line-height: 1.45; }
.j-game .j-note:not(:empty) { padding-top: 11px; }
.j-game .j-note:empty { display: none; }
.j-sr {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.j-game .j-dialog {
  width: min(505px,calc(100vw - 32px)); max-height: min(85vh,760px); padding: 0; overflow: auto;
  background: #223b3e; border: 2px solid #7e967b; border-radius: 15px; color: var(--j-ink);
  box-shadow: 0 6px 0 #101f20, 0 15px 75px #0008; overscroll-behavior: contain;
}
.j-game .j-dialog::backdrop { background: #102626af; backdrop-filter: blur(2px); }
.j-dialog-heading {
  position: sticky; top: 0; z-index: 1; gap: 12px; justify-content: space-between;
  background: #253f41; border-bottom: 1px solid var(--j-line); padding: 14px 19px;
}
.j-dialog-heading h2 { font: 800 24px/1.2 "Nunito","Trebuchet MS",sans-serif; letter-spacing: -.03em; }
.j-close { width: 34px; min-height: 34px; padding: 4px; }
#j-panel-body { padding: 16px 19px 18px; }
.j-dialog .j-note:not(:empty) { padding: 0 19px 15px; }
.j-game .j-dialog:has(.j-character-sheet) { width:min(834px,calc(100vw - 24px)); }
.j-character-sheet { display:grid; grid-template-columns:minmax(0,.88fr) minmax(0,1.12fr); gap:20px; }
.j-hero-painting {
  position:relative; isolation:isolate; overflow:hidden; align-self:stretch; margin:0;
  min-height:320px; border:1px solid #9a9874; border-radius:9px; background:#34483f;
}
.j-painting-land, .j-painting-figure { position:absolute; display:block; pointer-events:none; }
.j-painting-land { width:110%; height:110%; inset:-5%; object-fit:cover; filter:blur(3px) saturate(.72) brightness(.75); }
.j-painting-figure {
  bottom:-1%; right:-9%; width:118%; height:97%; object-fit:contain; object-position:bottom;
  transform-origin:50% 94%; animation:j-portrait-breathe 5s ease-in-out infinite;
}
.j-hero-painting::before {
  content:""; position:absolute; inset:0; background:linear-gradient(140deg,#b2ce9738,transparent 50%,#123a3e8c);
}
.j-hero-painting figcaption {
  position:absolute; inset:auto 0 0; display:grid; align-content:end; min-height:26%; padding:23% 16px 14px;
  color:#fff8df; background:linear-gradient(transparent,#142b2ced 94%); overflow-wrap:anywhere;
}
.j-hero-painting figcaption small { color:#f5d79f; font-weight:700; font-size:12px; }
.j-hero-painting figcaption strong { font-size:clamp(20px,3vw,30px); line-height:1.12; }
.j-sheet-values { min-width:0; }
.j-player-hud { position:relative; }
#j-level-rise {
  position:absolute; z-index:2; top:calc(100% + 4px); left:0; white-space:nowrap;
  padding:4px 10px; border:1px solid #f0c46e; border-radius:6px; background:#463b22; color:#ffebaf;
  box-shadow:0 0 12px #ffd47766; font-size:12px; font-weight:800;
}
@keyframes j-portrait-breathe {
  0%,100% { transform:translateY(0) scale(1); }
  50% { transform:translateY(-2px) scale(1.007,1.012); }
}
@media (max-width:600px) {
  .j-character-sheet { grid-template-columns:1fr; gap:12px; }
  .j-hero-painting { min-height:0; height:clamp(136px,24vh,192px); }
  .j-painting-figure { right:0; bottom:auto; top:2%; width:68%; height:155%; object-position:top; transform-origin:52% 60%; }
  .j-hero-painting figcaption { inset:0; padding:12px; background:linear-gradient(90deg,#152d2ee0,transparent 73%); }
  .j-hero-painting figcaption strong { max-width:53%; }
}
@media (prefers-reduced-motion:reduce) { .j-painting-figure { animation:none; } }
.j-point-count {
  gap: 10px; padding: 10px 12px; color: #ffe0a3; background: #3b4c41; border: 1px solid #68775b;
  border-radius: 8px; font-size: 14px; font-weight: 700;
}
.j-point-count strong { font-size: 22px; margin-left: auto; }
.j-level-progress { margin: 0 0 12px; }
.j-level-progress strong { color: var(--j-ink); font-size: 16px; }
.j-level-progress p { color: var(--j-muted); font-size: 12px; line-height: 1.5; }
.j-game .j-sub, .j-attr p, .j-route small { color: var(--j-muted); font-size: 12px; line-height: 1.5; }
.j-game .j-sub { margin: 9px 0 12px; }
.j-attr {
  display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; gap: 10px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--j-line);
}
.j-attr strong { font-size: 14px; font-weight: 750; }
.j-attr b { font-size: 18px; min-width: 20px; text-align: right; font-weight: 800; }
.j-plus { width: 38px; height: 38px; padding: 0; }
.j-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 14px; }
.j-stats div { background: #1c3134; border: 1px solid #465b55; border-radius: 7px; text-align: center; padding: 8px 3px; }
.j-stats small, .j-stats strong { display: block; }
.j-stats small { color: var(--j-muted); font-size: 11px; }
.j-stats strong { font: 800 17px "Nunito","Segoe UI",sans-serif; }
.j-game .j-dialog h3 { font-size: 17px; }
.j-game .j-dialog:is([data-panel="inventory"],[data-panel="chest"],[data-panel="mastery"],[data-panel="shop"]) {
  width: min(800px,calc(100vw - 24px));
}
.j-family-selector { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
.j-family-choice { display: grid; grid-template-rows: 32px 1fr auto; justify-items: center; min-width: 0; gap: 2px; padding: 6px 3px; color: var(--j-ink); background: #294648; border: 1px solid #536d65; border-radius: 8px; font-size: 11px; line-height: 1.2; text-align: center; }
.j-family-choice:hover { border-color: #bfaa73; }
.j-family-choice[aria-pressed="true"] { background: #415342; color: #ffdf99; border-color: #ddbd76; box-shadow: inset 0 0 0 1px #ddbd76; }
.j-family-choice small { color: var(--j-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.j-choice-icon { width: 34px; height: 32px; padding: 1px; border-radius: 5px; background: linear-gradient(140deg,#fbebbb,#c7c89f); }
.j-choice-icon svg { display: block; }
.j-gear-family { margin-top: 17px; }
.j-family-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.j-family-heading > span { color: #f6d893; font-size: 12px; }
.j-game .j-family-description { color: var(--j-muted); font-size: 12px; line-height: 1.45; margin-bottom: 5px; }
.j-family-mastery { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; font-size: 11px; color: var(--j-muted); }
.j-family-mastery .j-meter { width: 45px; flex: none; height: 5px; }
.j-family-mastery small { font: inherit; }
.j-game h3.j-skills-title { font-size:15px; margin:15px 0 4px; }
.j-mastery-skills { list-style:none; padding:0; margin:9px 0 0; display:grid; gap:6px; }
.j-mastery-skill { display:grid; grid-template-columns:auto 1fr; gap:9px; padding:10px; background:#1d3336; border:1px solid var(--j-line); border-radius:8px; }
.j-mastery-skill[data-learned="true"] { border-color:#7d946e; }
.j-mastery-skill-title { display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:3px 8px; }
.j-mastery-skill-title h4 { margin:0; color:var(--j-ink); font-size:14px; }
.j-mastery-skill-title small { color:#c2ccc5; font-size:11px; white-space:nowrap; }
.j-mastery-skill[data-learned="true"] .j-mastery-skill-title small { color:#c5e2ab; }
.j-mastery-skill-title .j-icon { width:12px; height:12px; margin-right:4px; }
.j-mastery-skill p { margin:3px 0; color:var(--j-muted); font-size:12px; line-height:1.4; }
.j-skill-requirement { color:#e6ce9e; font-size:11px; }
.j-rarity { display:inline-flex; align-items:center; gap:6px; width:fit-content; color:#e9ecdf; font-size:11px; line-height:1.5; font-weight:750; white-space:nowrap; }
.j-rarity::before, .j-wielding[style*="--item-rarity"]::before { content:""; display:inline-block; width:7px; height:7px; border-radius:1px; background:var(--item-rarity); transform:rotate(45deg); }
.j-wielding[style*="--item-rarity"]::before { width:5px; height:5px; margin:0 5px 1px 1px; }
.j-item-inspector > .j-rarity { margin-bottom:5px; }
.j-result-loot { display:flex; flex-wrap:wrap; gap:3px 8px; align-items:baseline; }
.j-result-loot b { color:var(--j-ink); }
.j-panel-actions { margin: 15px 0 2px; }
.j-storage-nav { display: flex; gap: 4px; padding: 4px; margin-bottom: 17px; border: 1px solid #47615b; border-radius: 10px; background: #192f32; }
.j-storage-nav button, .j-shop-filters button {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 39px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: #c6d4ca; font-size: 12px; line-height: 1.25;
}
.j-storage-nav button { flex: 1; padding: 5px 3px; font-size: 12px; }
.j-storage-nav button[aria-pressed="true"], .j-shop-filters button[aria-pressed="true"] { border-color: #ac9863; background: #405246; color: #ffe2a2; }
.j-storage-nav button:hover, .j-shop-filters button:hover { background: #344b45; }
.j-storage-nav small { color: #bcd2c6; font-size: 10px; font-variant-numeric: tabular-nums; }
.j-storage-nav .j-icon { width: 15px; height: 15px; }
.j-storage-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0,1fr); gap: 18px; align-items: start; }
.j-storage-head { display:flex; justify-content:space-between; align-items:baseline; gap:8px; margin: 0 0 10px; }
.j-storage-head > span, .j-item-inspector > small { color:#c5d2c5; font-size:11px; font-variant-numeric:tabular-nums; }
.j-cells { display:grid; gap:5px; grid-template-columns:repeat(5,minmax(0,1fr)); }
.j-cells-chest { grid-template-columns:repeat(10,minmax(0,1fr)); }
.j-cell {
  position:relative; display:grid; place-items:center; width:100%; aspect-ratio:1; min-width:0;
  border:1px solid #4b6461; border-radius:7px; background:#1a3235; box-shadow:inset 0 2px 3px #0b242850;
}
.j-cell small { position:absolute; left:4px; bottom:3px; color:#93aaa0; font:650 9px/1 "Nunito","Segoe UI",sans-serif; }
.j-cell-filled { background:linear-gradient(150deg,#607465,#324b46); border-color:#738575; padding:0; }
.j-cell-filled::after { content:""; position:absolute; bottom:4px; right:4px; width:6px; height:6px; border:1px solid #152b30; border-radius:1px; background:var(--item-rarity); transform:rotate(45deg); }
.j-cell-filled small { color:#ece6ca; text-shadow:0 1px 2px #18242a; }
.j-protection-badge { position:absolute; top:2px; left:2px; width:17px; height:17px; display:grid; place-items:center; border-radius:4px; background:#152c30ed; color:#ffe2a2; pointer-events:none; }
.j-protection-badge .j-icon { width:13px; height:13px; }
.j-protection-toggle { margin:8px 0; }
.j-protection-toggle[aria-pressed="true"] { border-color:#e3bb73; color:#ffe2a2; }
.j-protected-loot { margin:10px 0; padding:10px; border:1px solid #b49763; border-radius:8px; }
.j-weapon-comparison { margin:12px 0; padding:10px; border:1px solid #5f776c; border-radius:8px; background:#1a3234; }
.j-weapon-comparison h4 { margin:0 0 8px; }
.j-weapon-comparison p { margin:8px 0; font-size:12px; }
.j-weapon-comparison table { width:100%; border-collapse:collapse; font-size:12px; }
.j-weapon-comparison caption { text-align:left; color:#bacabd; margin:5px 0; }
.j-weapon-comparison th { text-align:left; font-weight:600; }
.j-weapon-comparison td { text-align:right; white-space:nowrap; }
.j-weapon-comparison th,.j-weapon-comparison td { padding:5px 3px; border-top:1px solid #3a514c; }
.j-comparison-hands { display:flex; gap:5px; }
.j-comparison-hands .j-command { min-height:32px; padding:5px 9px; font-size:12px; }
.j-comparison-hands [aria-pressed="true"] { border-color:#edc680; background:#405246; color:#ffe2a2; }
.j-stat-gain { color:#b3e1b2; }
.j-stat-loss { color:#ffb3a3; }
.j-stat-same { color:#b7c8bf; }
.j-buyback { margin:10px 0 14px; padding:10px; border:1px solid #ac9863; border-radius:8px; background:#1a3234; }
.j-buyback > div { display:flex; gap:10px; align-items:center; }
.j-buyback-art { width:48px; height:48px; flex:none; }
.j-buyback h4,.j-buyback p { margin:4px 0; }
.j-buyback small,.j-buyback p { font-size:12px; }
.j-cell-filled:hover { background:#5a7262; border-color:#ccb785; }
.j-cell-filled[aria-pressed="true"] { border:2px solid #f5c776; background:linear-gradient(150deg,#788464,#43594a); }
.j-cell-art { width:80%; height:80%; }
.j-cell-art svg, .j-inspect-art svg, .j-model-icon svg, .j-shop-illustration svg, .j-drop-art svg { display:block; width:100%; height:100%; }
.j-item-inspector { background:#1d3437; border:1px solid #53685e; border-radius:11px; padding:12px; }
.j-item-inspector { display:flex; align-items:flex-start; flex-direction:column; }
.j-inspect-art { display:grid; place-items:center; border-radius:8px; border:1px solid var(--item-rarity); background:radial-gradient(ellipse at 50% 30%,#a0ae8d,#5a7161); padding:4px; }
.j-inspect-art { width:78px; height:78px; margin-bottom:10px; }
.j-loot-card { display:flex; align-items:flex-start; gap:12px; margin:8px 0; padding:10px; border:1px solid #68796d; border-radius:9px; }
.j-loot-card .j-inspect-art { flex:none; width:54px; height:54px; margin:0; }
.j-loot-card h4,.j-loot-card p { margin:3px 0; }
.j-item-inspector h3 { margin:2px 0 5px; }
.j-item-inspector p { color:var(--j-muted); font-size:12px; line-height:1.5; }
.j-item-inspector .j-unmet { color:#f5c0a7; }
.j-item-actions { display:flex; flex-wrap:wrap; gap:6px; }
.j-item-actions { margin-top:13px; }
.j-item-actions .j-command { min-height:33px; padding:5px 9px; font-size:12px; white-space:normal; }
.j-slot-reason { display:block; width:100%; line-height:1.4; font-size:11px; color:#ead6ac; }
.j-empty-symbol { display:grid; place-items:center; width:43px; height:43px; margin:0 0 10px; border:1px solid #6a816d; border-radius:8px; color:#dbc392; background:#304741; }
.j-empty-symbol svg { width:23px; height:23px; }
.j-empty-chest { display:block; width:92px; height:78px; margin:0 0 8px; object-fit:contain; }
.j-discard { padding:4px 0; margin-top:9px; border:0; border-bottom:1px solid #987b6d; border-radius:0; color:#d9b6a5; background:transparent; font-size:11px; }
.j-discard-confirm { margin-top:12px; padding-top:10px; border-top:1px solid #7e695b; }
.j-discard-confirm p { margin-bottom:7px; }
.j-discard-confirm .j-command { margin:2px; min-height:30px; padding:4px 8px; font-size:11px; white-space:normal; }
.j-discard-confirm [data-action="discardItem"] { background:#69483f; border-color:#b48b78; }
.j-shop-bar { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px; margin-bottom:11px; }
.j-shop-bar > span { color:var(--j-honey); font-size:13px; font-weight:700; }
.j-shop-bar > span .j-icon { width:15px; height:15px; }
.j-shop-filters { display:flex; flex-wrap:wrap; gap:4px; }
.j-shop-filters button { border-color:#4b645d; min-height:33px; padding:5px 10px; font-size:12px; }
.j-shop-selectors { display:grid; grid-template-columns:minmax(0,.85fr) minmax(0,1fr); align-items:end; gap:10px 16px; margin-bottom:15px; }
.j-shop-selectors label, .j-shop-model-mobile { display:grid; gap:4px; color:var(--j-muted); font-size:12px; font-weight:700; }
.j-shop-selectors p { font-size:12px; line-height:1.4; color:var(--j-muted); align-self:center; }
.j-shop-selectors select, .j-shop-model-mobile select { width:100%; padding:8px; min-height:37px; border-radius:7px; border:1px solid #719084; background:#183338; color:var(--j-ink); font:700 14px "Nunito","Segoe UI",sans-serif; }
.j-shop-catalog { display:grid; grid-template-columns:minmax(0,.85fr) minmax(0,1fr); align-items:start; gap:16px; }
.j-shop-model-list h3 { display:flex; align-items:baseline; justify-content:space-between; margin:0 0 6px; }
.j-shop-model-list h3 small { color:var(--j-muted); font-size:12px; }
.j-shop-models { display:grid; gap:4px; }
.j-shop-model { display:flex; align-items:center; gap:9px; min-width:0; min-height:41px; padding:4px 8px; border-radius:7px; border:1px solid #52695f; background:#263f41; color:var(--j-ink); text-align:left; font-size:12px; line-height:1.25; font-weight:700; }
.j-shop-model:hover { background:#354f4a; }
.j-shop-model small { margin-left:auto; white-space:nowrap; color:var(--j-honey); }
.j-shop-model[aria-pressed="true"] { border-color:#ddbd76; background:#3f5044; color:#ffe3a5; }
.j-model-icon { flex:none; display:block; height:32px; width:32px; }
.j-shop-model-mobile { display:none; }
.j-shop-preview { display:grid; align-self:stretch; grid-template-rows:1fr auto; padding:15px; border:1px solid #60776b; border-radius:10px; background:#1b3437; }
.j-shop-piece { display:flex; flex-direction:column; align-items:center; text-align:center; gap:9px; }
.j-shop-illustration { display:grid; place-items:center; width:110px; height:110px; padding:10px; border:1px solid #778e7b; border-radius:12px; background:radial-gradient(ellipse at 48% 35%,#a2b199,#586f63); }
.j-shop-piece h3 { margin:0 0 3px; }
.j-shop-piece p { margin-top:3px; color:var(--j-muted); font-size:12px; line-height:1.35; }
.j-shop-piece .j-unmet { color:#f5c0a7; }
.j-shop-purchase { display:grid; justify-items:center; gap:4px; margin-top:12px; }
.j-shop-purchase small { color:#e4cba1; font-size:11px; }
.j-drops { margin-top:14px; }
.j-drops h4 { font-size:14px; margin:0 0 3px; }
.j-drops p { color:var(--j-muted); font-size:11px; line-height:1.4; }
.j-drops .j-drop-alert { color:#ffda9b; margin-top:7px; }
.j-drops ul { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr)); gap:5px; margin:7px 0 0; padding:0; list-style:none; }
.j-drops li { display:grid; grid-template-columns:30px minmax(0,1fr) auto; align-items:center; gap:7px; padding:5px 8px; border-radius:6px; border:1px solid #53695e; background:#1b3337; }
.j-drop-art { display:block; width:30px; height:30px; }
.j-drops li b { display:block; font-size:12px; line-height:1.25; }
.j-drops li strong { font-size:12px; font-variant-numeric:tabular-nums; color:#f0d191; }
.j-drops ul + h4 { margin-top:14px; }
.j-rune-modes { margin:12px 0 0; }
.j-rune-work { display:grid; gap:12px; padding:14px; border:1px solid #586e62; border-radius:9px; background:#1b3337; }
.j-forge-stats { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 14px; margin:0; }
.j-forge-stats dt { font-size:.8rem; color:#b9c9bb; }
.j-forge-stats dd { margin:2px 0 0; color:#ffe2a2; font-weight:700; }
.j-forge-origins summary { cursor:pointer; color:#f1dca6; }
.j-forge-origins ul { padding-left:1.2em; }
.j-rune-modes + .j-rune-work, .j-npc-intro + .j-rune-work { margin-top:10px; }
.j-rune-work > .j-command { justify-self:start; }
.j-rune-work .j-sub { margin:0; }
.j-work-label { display:grid; gap:5px; min-width:0; color:var(--j-muted); font-size:12px; font-weight:700; }
.j-work-label select { min-height:39px; width:100%; min-width:0; border:1px solid #719084; border-radius:7px;
  background:#183338; color:var(--j-ink); padding:6px 8px; font:700 14px "Nunito","Segoe UI",sans-serif; }
.j-workpiece { display:flex; gap:12px; align-items:center; }
.j-workpiece small, .j-workpiece > div > span, .j-sockets-count { color:var(--j-muted); font-size:12px; }
.j-work-art { display:grid; place-items:center; width:56px; height:56px; flex:none; padding:5px;
  border:1px solid var(--item-rarity); border-radius:9px; background:radial-gradient(ellipse at 45% 30%,#a2b199,#586f63); }
.j-work-art svg, .j-socket-gem svg { display:block; width:100%; height:100%; }
.j-rune-picker { display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px; align-items:end; }
.j-rune-picker .j-work-art { width:48px; height:48px; }
.j-inspect-art.j-gem-art, .j-work-art.j-gem-art { background:radial-gradient(ellipse at 52% 78%,#365354,#182c33 75%); border-color:var(--item-rarity,#64796e); }
.j-rune-picker .j-gem-art > .j-icon { width:22px; height:22px; color:#91aaa0; }
.j-fusion-recipe { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:start;
  gap:8px; padding:12px 8px; border-radius:8px; background:#172e32; border:1px solid #49605a; }
.j-fusion-recipe > div { display:grid; justify-items:center; gap:3px; text-align:center; }
.j-fusion-recipe .j-work-art { margin-bottom:4px; }
.j-fusion-recipe small, .j-fusion-recipe > div > span:last-child { color:var(--j-muted); font-size:12px; }
.j-fusion-recipe strong { font-size:14px; color:var(--j-ink); }
.j-fusion-arrow { align-self:start; padding-top:14px; color:var(--j-honey); font-size:21px; }
.j-sockets-count b { color:var(--j-ink); margin-left:4px; }
.j-sockets { display:flex; gap:5px; flex-wrap:wrap; }
.j-socket-cell { display:flex; align-items:center; gap:6px; padding:5px 8px; min-height:40px;
  border:1px solid #61776c; border-radius:7px; background:#273f41; color:var(--j-ink); text-align:left; }
.j-socket-cell[aria-pressed="true"] { border-color:var(--j-honey); background:#404d43; }
.j-socket-cell small, .j-socket-cell strong { display:block; }
.j-socket-cell small { font-size:10px; color:var(--j-muted); }
.j-socket-cell strong { font-size:12px; }
.j-socket-gem { display:grid; place-items:center; width:28px; height:28px; flex:none; }
.j-socket-gem i { height:13px; width:13px; transform:rotate(45deg); border:1px solid #b5bbb0; background:#162e2e; box-shadow:inset 2px 2px #0c2225; }
.j-work-chance { color:var(--j-muted); font-size:13px; line-height:1.5; }
.j-work-chance b { color:var(--j-honey); }
.j-cell .j-socket-badge { position:absolute; top:1px; right:1px; padding:1px 3px; border-radius:4px; background:#173034e8; color:#ffe7a5; font-size:9px; line-height:1.3; }
.j-cell[data-protected="true"] .j-socket-badge { top:auto; bottom:1px; }
.j-cell[data-protected="true"]:has(.j-socket-badge)::after { display:none; }
.j-socket-info, .j-socket-details { color:var(--j-muted); font-size:12px; line-height:1.45; }
.j-socket-details { list-style:none; padding:0; margin:5px 0; }
.j-socket-details li { display:flex; gap:6px; align-items:center; }
.j-socket-details b { color:var(--j-ink); }
.guide-rune-family { margin:0 0 12px; }
.guide-rune-family h3 { margin:0 0 5px; font:800 16px var(--sans); color:#304c40; }
.guide-runes { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); list-style:none; margin:0; padding:0; overflow:hidden; border:1px solid #758374; border-radius:9px; background:#f5efdb; }
.guide-runes li { display:flex; flex-direction:column; align-items:center; text-align:center; padding:0 0 7px; color:#29463d; font:600 13px/1.3 var(--sans); }
.guide-runes li + li { border-left:1px solid #bfc5ab; }
.guide-rune-art { width:100%; height:clamp(58px,17vw,76px); display:grid; place-items:center; margin-bottom:5px; background:radial-gradient(ellipse at 46% 43%,#36545a,#172d33 84%); }
.guide-rune-art > * { max-width:70px; max-height:90%; }
.guide-rune-art svg { width:100%; height:100%; display:block; }
.guide-runes strong { font-size:14px; }
.guide-runes small { margin:3px 1px 0; font:500 11px/1.2 var(--sans); }
.guide-runes small, #guide-sockets { color:#4b635b; }
#guide-sockets { font-size:13px; margin:8px 0; }
@media (max-width:690px) {
  .j-storage-nav button { flex-wrap:wrap; gap:3px; }
  .j-storage-nav small { width:100%; }
  .j-cells-chest { grid-template-columns:repeat(5,minmax(0,1fr)); }
}
@media (max-width:540px) {
  .j-storage-nav { gap:0; padding:3px; }
  .j-storage-nav button { padding:5px 1px; flex-direction:column; font-size:10px; gap:2px; }
  .j-storage-layout { grid-template-columns:1fr; gap:12px; }
  .j-storage-head > span { font-size:10px; }
  .j-cell { max-height:65px; }
  .j-cells-chest { grid-template-columns:repeat(5,minmax(0,1fr)); max-height:clamp(168px,30vh,260px); overflow:auto; padding:3px; }
  .j-item-inspector { display:block; min-height:78px; }
  .j-inspect-art { width:56px; height:56px; float:left; margin:0 10px 6px 0; }
  .j-item-actions { clear:both; margin-top:9px; }
  .j-shop-selectors, .j-shop-catalog { grid-template-columns:1fr; gap:8px; }
  .j-shop-selectors { margin-bottom:9px; }
  .j-shop-model-list { display:none; }
  .j-shop-model-mobile { display:grid; }
  .j-shop-filters button { padding:5px 7px; }
  .j-shop-piece { flex-direction:row; text-align:left; gap:12px; }
  .j-shop-illustration { width:76px; height:76px; flex:none; }
  .j-shop-purchase { justify-items:stretch; text-align:center; }
}
.j-route {
  width: 100%; text-align: left; background: #2c4646; border: 1px solid var(--j-line);
  border-radius: 9px; padding: 10px; gap: 12px; margin-top: 8px;
}
.j-route > .j-icon:last-child { margin-left: auto; }
.j-route small, .j-route strong { display: block; }
.j-route strong { font-size: 14px; }
.j-game .j-dialog[data-panel="campaign"] { width: min(680px,calc(100vw - 24px)); }
.j-chapter-nav { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 12px; }
.j-chapter-nav label { grid-column: 1 / -1; font-size: 12px; color: var(--j-muted); }
.j-chapter-nav select { width: 100%; min-width: 0; border: 1px solid #719084; border-radius: 7px; padding: 8px; background: #183338; color: var(--j-ink); font: 700 15px "Nunito","Segoe UI",sans-serif; }
.j-chapter-nav select:focus-visible { outline: 3px solid var(--j-honey); outline-offset: 2px; }
.j-chapter-nav > span, .j-chapter-status > span { color: var(--j-muted); font-size: 12px; }
.j-chapter-nav > span { align-self: center; }
.j-chapter-status { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 16px 0 7px; }
.j-stages { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
.j-stage { display: inline-flex; flex-direction:column; align-items: center; justify-content: center; gap: 2px; min-height: 45px; border: 1px solid #50665f; border-radius: 7px; background: #1b3234; font-size: 15px; }
.j-stage > span { display:flex; align-items:center; justify-content:center; gap:4px; }
.j-stage small { font-size:10px; line-height:1.1; font-weight:600; color:#c0cec2; }
.j-stage .j-icon { width: 13px; height: 13px; }
.j-stage[data-status="Bloqueado"] { color: #aabbb4; }
.j-stage[data-status="Concluído"] { background: #284b41; color: #d4ebae; }
.j-stage[data-status="Liberado"] { color: #ffe1a6; }
.j-stage:enabled:hover { background: #355452; }
.j-stage[aria-pressed="true"] { box-shadow: inset 0 0 0 1px #edc680; border-color: #edc680; }
.j-stage-preview { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--j-line); }
.j-town-preview {
  --town-shade:#29483d; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center;
  gap:14px; padding:14px; margin:12px 0 18px; border:1px solid #75866c; border-radius:10px;
  background:linear-gradient(110deg,var(--town-shade),#1c3337);
}
.j-town-preview[data-biome="cripta"] { --town-shade:#403853; }
.j-town-preview[data-biome="deserto"] { --town-shade:#5c4634; }
.j-town-preview[data-biome="pantano"] { --town-shade:#344c49; }
.j-town-preview[data-biome="gelo"] { --town-shade:#344e60; }
.j-town-preview[data-biome="vulcao"] { --town-shade:#583c37; }
.j-town-preview h3 { color:#ffe5ad; }
.j-town-preview .j-icon { width:17px; height:17px; }
.j-town-preview p,.j-town-preview small { display:block; margin-top:4px; font-size:12px; line-height:1.45; color:#e0e7d7; }
.j-town-preview small { color:#edce98; }
.j-town-actions,.j-quest-actions { display:flex; flex-wrap:wrap; gap:7px; }
.j-town-actions { flex-direction:column; align-items:stretch; }
.j-quest-actions { margin-top:12px; justify-content:flex-end; }
.j-delivery { display:flex; justify-content:space-between; gap:10px; align-items:center; margin-top:14px; padding:10px; border:1px solid #94865e; border-radius:8px; background:#3d463b; }
.j-npc-intro { display:grid; grid-template-columns:82px 1fr; align-items:center; gap:14px; }
.j-npc-portrait { display:block; width:82px; height:100px; object-fit:cover; object-position:50% 20%; border:2px solid #788c70; border-radius:8px; background:#384e44; }
.j-npc-intro b { font-size:12px; color:var(--j-honey); }
.j-npc-intro p { line-height:1.5; margin-top:4px; font-size:15px; }
.j-npc-mission,.j-quest-entry { padding:12px 14px; background:#1b3437; border:1px solid #536d61; border-radius:8px; }
.j-npc-mission { margin-top:16px; }
.j-npc-mission h3 { margin-top:5px; }
.j-quest-state { display:inline-flex; align-items:center; gap:5px; color:#cbdacd; font-size:11px; font-weight:750; }
.j-quest-state .j-icon { width:14px; height:14px; }
.j-quest-state[data-status="active"] { color:#a7d7e4; }
.j-quest-state[data-status="ready"] { color:#ffdb82; }
.j-quest-state[data-status="claimed"] { color:#b7dfa7; }
.j-game .j-quest-objective { margin:6px 0; font-size:13px; color:var(--j-muted); line-height:1.45; }
.j-quest-progress { display:flex; align-items:center; gap:9px; max-width:225px; font-size:11px; }
.j-quest-progress .j-meter i { background:#abc88c; }
.j-quest-reward { display:flex; flex-wrap:wrap; align-items:center; gap:5px; color:#f5d598; font-size:12px; }
.j-quest-reward .j-icon { width:14px; height:14px; }
.j-quest-reward .j-icon:not(:first-child) { margin-left:9px; }
.j-journal-select { display:grid; gap:5px; font-size:12px; color:var(--j-muted); }
.j-journal-select select { width:100%; min-height:40px; background:#192f32; color:var(--j-ink); border:1px solid #78917d; padding:5px 8px; border-radius:7px; font:inherit; }
.j-quest-list { list-style:none; margin:12px 0 0; padding:0; display:grid; gap:8px; }
.j-quest-title { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:2px 10px; }
.j-quest-entry > small { display:block; color:#ddc999; font-size:12px; }
.j-quest-entry .j-command { margin-top:9px; }
@media (max-width:540px) {
  .j-town-preview { grid-template-columns:1fr; gap:8px; padding:10px; }
  .j-town-actions { flex-direction:row; }
  .j-npc-intro { grid-template-columns:62px 1fr; gap:9px; }
  .j-npc-portrait { width:62px; height:82px; }
  .j-npc-intro p { font-size:13px; }
  .j-quest-entry { padding:9px; }
}
.j-stage-preview h3 > .j-icon { color: var(--j-honey); width: 16px; height: 16px; }
.j-stage-level { display:flex; flex-wrap:wrap; align-items:center; gap:5px; margin:5px 0; font-size:12px; color:#edcd92; }
.j-stage-level .j-icon { width:14px; height:14px; }
.j-stage-level span { padding-left:6px; margin-left:2px; border-left:1px solid #658079; color:var(--j-muted); }
.j-stage-preview .j-sub { margin: 4px 0 9px; }
.j-waves { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); list-style: none; gap: 6px; padding: 0; margin: 0; }
.j-wave { display: flex; flex-direction: column; align-items: center; padding: 7px 4px; border: 1px solid var(--j-line); border-radius: 8px; background: #193236; text-align: center; }
.j-wave small { color: #bdcfc5; font-size: 10px; font-weight: 750; }
.j-wave-group { display:flex; align-items:flex-end; justify-content:center; width:100%; height:56px; margin:4px 0; }
.j-wave-group img { display:block; width:70%; max-width:65px; height:100%; object-fit:contain; }
.j-wave-group[data-count="2"] img { width:51%; }
.j-wave-group[data-count="3"] img { width:35%; }
.j-wave-group img+img { margin-left:-3%; }
.j-wave strong { font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.j-wave strong > span { display:block; margin-top:2px; font-size:11px; color:#d1dfd8; font-weight:600; }
.j-wave > span { font-size: 11px; color: var(--j-muted); }
.j-wave .j-wave-loot { color: #e9cc91; margin-top: auto; padding-top: 5px; font-size: 10px; line-height: 1.25; }
.j-boss-wave { border-color: #bca46b; }
.j-boss-wave small { color: var(--j-honey); }
.j-boss-wave small .j-icon { width: 12px; height: 12px; }
.j-enter-stage { margin-top: 12px; display: flex; justify-content: flex-end; }
@media (max-width: 540px) {
  .j-chapter-nav { grid-template-columns: 1fr; }
  .j-chapter-status > span, .j-chapter-nav > span { font-size: 11px; }
  .j-waves { grid-template-columns: 1fr; gap: 4px; }
  .j-wave { display: grid; grid-template-columns: 38px 50px 1fr auto; grid-template-rows: auto auto; gap: 0 6px; align-items: center; padding: 4px 7px; text-align: left; }
  .j-wave > small, .j-wave-group, .j-wave .j-wave-loot { grid-row: 1 / 3; }
  .j-wave-group { height:36px; margin:0; }
  .j-wave > strong { align-self: end; }
  .j-wave > span:not(.j-wave-loot) { grid-column: 3; grid-row: 2; align-self: start; }
  .j-wave .j-wave-loot { grid-column: 4; padding-top: 0; margin-top: 0; text-align: right; }
  .j-result-actions { justify-content: flex-start; }
  .j-targets { gap:5px; padding:5px; }
  .j-target-label { font-size:11px; flex-direction:column; gap:1px; }
  .j-target-options { flex:1; display:grid; grid-auto-columns:minmax(0,1fr); grid-auto-flow:column; gap:3px; }
  .j-target { min-height:44px; gap:4px; min-width:0; padding:4px; }
  .j-target-index { width:17px; height:17px; font-size:10px; }
  .j-target-copy strong { font-size:10px; overflow-wrap:anywhere; }
}

@media (max-width: 840px) {
  .j-game { width: calc(100% - 32px); padding-top: 14px; }
  .j-actions { gap: 10px; padding: 10px; }
  .j-command kbd, .j-skill-button kbd { display: none; }
  .j-combat-controls { gap: 5px; }
  .j-combat-controls .j-command { padding-inline: 8px; }
}
@media (max-width: 600px) {
  .j-battle-row { flex-wrap:wrap; gap:6px; }
  .j-skill-buttons { grid-template-columns:1fr; gap:5px; }
  .j-skill-button { padding:6px 8px; }
  .j-game { width: calc(100% - 18px); padding-top: 10px; }
  .j-toolbar { gap: 8px; margin: 0 3px 9px; }
  .j-location { gap: 6px; }
  .j-location h1 { font-size: 21px; }
  .j-map-pin { width: 29px; height: 29px; border-radius: 8px; }
  .j-map-pin .j-icon { width: 18px; height: 18px; }
  .j-purse { padding: 0; gap: 3px; }
  .j-purse > span { display: none; }
  .j-tools { margin-left: auto; gap: 5px; }
  .j-tool { padding: 6px 8px; min-height: 34px; font-size: 11px; gap: 4px; }
  .j-tool .j-icon { width: 15px; height: 15px; }
  .j-world { display: flex; flex-direction: column; }
  .j-vitals-wrap { position: static; order: -1; background: #213b3b; gap: 5px; padding: 4px 7px; align-items: center; }
  .j-player-hud, .j-enemy { background: transparent; box-shadow: none; border: 0; padding: 2px; }
  .j-player-hud { max-width: 50%; gap: 5px; }
  .j-avatar { width: 29px; height: 35px; }
  #j-vitals { width: 116px; }
  .j-vital-line { gap: 3px; }
  .j-vital-line small { font-size: 8px; width: auto; }
  .j-vital-name strong { font-size: 12px; }
  .j-enemy { width: min(40%,140px); }
  .j-enemy > strong { font-size: 11px; margin-bottom: 2px; }
  .j-canvas { height: clamp(255px,51vh,450px); }
  .j-frame { border-width: 2px; border-radius: 11px; }
  .j-actions { flex-wrap: wrap; gap: 8px; min-height: 60px; }
  .j-actions-right { flex-wrap: wrap; }
  .j-command { min-height: 36px; font-size: 12px; }
  .j-hint-glyph { width: 27px; height: 27px; border-radius: 7px; }
  .j-hint, .j-turn { gap: 7px; }
  .j-hint strong, .j-turn strong { font-size: 13px; }
  .j-hint p { font-size: 11px; margin-top: 0; }
  .j-turn { width: 100%; }
  .j-turn div { display: flex; align-items: baseline; gap: 5px; }
  .j-combat-controls { flex-wrap: wrap; }
}
@media (max-width: 385px) {
  .j-toolbar { display: grid; }
  .j-tools { margin-left: 0; gap: 6px; }
  .j-purse { padding-right: 5px; }
  .j-game .j-dialog { width: calc(100vw - 16px); }
  .j-dialog-heading { padding: 10px 12px; }
  #j-panel-body { padding: 10px 12px 14px; }
  .j-attr { gap: 6px; }
  .j-item-icon { width: 27px; height: 29px; border-radius: 6px; }
  .j-item-icon .j-icon { width: 17px; height: 17px; }
  .j-combat-controls .j-command { font-size: 11px; min-height: 34px; }
}
@media (max-width: 520px) {
  .j-family-selector { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .j-family-mastery { gap: 4px; font-size: 10px; }
  .j-family-mastery .j-meter { width: 27px; }
}
@media (max-height: 610px) and (min-width: 601px) {
  .j-game { padding-top: 7px; }
  .j-toolbar { margin-bottom: 6px; }
  .j-canvas { height: clamp(215px,58vh,350px); }
  .j-actions { min-height: 49px; padding-block: 5px; }
}
@media (max-height:850px) and (min-width:601px) {
  .j-frame:has(.j-skill-buttons) .j-canvas { height:clamp(230px,calc(62vh - 80px),490px); }
}
@media (prefers-reduced-motion: reduce) {
  .j-meter > i { transition: none; }
}
@media (max-width: 940px) {
  .j-game .j-toolbar { display: flex; flex-wrap: wrap; }
  .j-toolbar .j-location { order: 0; }
  .j-toolbar .j-tools { order: 1; margin-left: auto; }
  .j-auto-controls { order:2; margin-left:0; }
}
@media (max-width: 600px) {
  .j-game .j-auto-tool { min-height: 36px; }
  .j-auto-choice select { font-size:11px; }
  .j-turn div { display: block; }
  .j-turn p { font-size: 11px; }
}


/* Keep worn pieces and carried items on the same spread, including in portrait. */
.j-inventory-board {
  container-type:inline-size;
  display:grid; grid-template-columns:minmax(0,1.06fr) minmax(0,1fr);
  gap:clamp(6px,1.3vw,12px); align-items:stretch;
}
.j-character-kit, .j-carried-items {
  --slot-height:clamp(40px,11.4cqw,65px);
  --slot-gap:clamp(3px,.7cqw,6px);
  min-width:0; padding:clamp(5px,1.3cqw,12px);
  border:1px solid #786e50; border-radius:10px;
  background:linear-gradient(155deg,#344844,#203736 80%);
  box-shadow:inset 0 1px #d8c38f26,0 2px 0 #13292a;
}
.j-character-kit { background:radial-gradient(ellipse at 50% 43%,#586454,#364943 52%,#233b38 100%); }
.j-inventory-board :is(.j-storage-head,header) {
  min-width:0; display:flex; align-items:baseline; justify-content:space-between;
  gap:4px; margin:0 0 clamp(6px,1.25cqw,12px);
}
.j-game .j-inventory-board h3 {
  min-width:0; color:#ffedc2; overflow-wrap:anywhere;
  font:800 clamp(12px,3.6cqw,20px)/1.15 "Nunito","Trebuchet MS",sans-serif;
}
.j-inventory-board :is(.j-storage-head,header) :is(small,span) {
  flex:none; font:700 clamp(9px,2.5cqw,12px)/1.2 "Nunito","Trebuchet MS",sans-serif;
  font-variant-numeric:tabular-nums; color:#d5d8bf;
}
.j-doll, .j-carried-items .j-cells-inventory {
  display:grid; grid-template-columns:repeat(4,minmax(0,1fr));
  grid-template-rows:repeat(5,var(--slot-height)); gap:var(--slot-gap);
}
.j-doll {
  grid-template-areas:"head hero hero shoulders" "chest hero hero back"
                      "main hero hero offhand" "hands hero hero legs" "neck ring1 ring2 feet";
}
.j-equipped-cell[data-key="head"]      {grid-area:head}
.j-equipped-cell[data-key="shoulders"] {grid-area:shoulders}
.j-equipped-cell[data-key="chest"]     {grid-area:chest}
.j-equipped-cell[data-key="back"]      {grid-area:back}
.j-equipped-cell[data-key="main"]      {grid-area:main}
.j-equipped-cell[data-key="offhand"]   {grid-area:offhand}
.j-equipped-cell[data-key="hands"]     {grid-area:hands}
.j-equipped-cell[data-key="legs"]      {grid-area:legs}
.j-equipped-cell[data-key="neck"]      {grid-area:neck}
.j-equipped-cell[data-key="ring1"]     {grid-area:ring1}
.j-equipped-cell[data-key="ring2"]     {grid-area:ring2}
.j-equipped-cell[data-key="feet"]      {grid-area:feet}
.j-hero-stand {
  grid-area:hero; min-width:0; min-height:0; position:relative;
  display:grid; place-items:center; align-self:stretch; margin:0;
  background:radial-gradient(ellipse closest-side at center,#d1c69725,transparent);
}
#j-loadout-portrait { display:block; width:100%; height:100%; min-width:0; min-height:0; object-fit:contain; }
.j-equipped-cell, .j-carried-items .j-cell {
  position:relative; display:grid; place-items:center; min-width:0; width:100%; height:100%;
  aspect-ratio:auto; max-height:none; padding:2px;
  border:1px solid #64766a; border-radius:clamp(4px,1.3cqw,8px);
  background:linear-gradient(155deg,#273f3c,#1b3131);
  box-shadow:inset 0 2px 3px #14292bb0,inset 0 -1px #9aab8b22;
}
.j-equipped-cell { grid-template-rows:minmax(0,1fr) auto; color:#c6d0b9; }
.j-equipped-art { height:100%; width:100%; display:grid; place-items:center; overflow:hidden; }
.j-equipped-art svg, .j-equipped-art img {
  display:block; width:100%; height:100%; min-height:0; object-fit:contain;
}
.j-equipped-art.j-slot-outline svg { width:72%; height:76%; filter:brightness(0) invert(.76) sepia(.2); opacity:.66; }
.j-equipped-name {
  display:block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font:700 clamp(8px,2.15cqw,11px)/1.15 "Nunito","Trebuchet MS",sans-serif;
}
.j-equipped-cell.has-piece, .j-carried-items .j-cell-filled {
  background:linear-gradient(145deg,#777c5c,#485e4f 63%,#364e46);
  border-color:#a2a185; box-shadow:inset 0 1px #d9d4aa4d,inset 0 -2px var(--item-rarity,#99a694);
}
.j-equipped-cell[aria-pressed="true"], .j-carried-items .j-cell[aria-pressed="true"] {
  border:1px solid #ffe8a5; color:#fff2c7;
  background:linear-gradient(150deg,#777a53,#475d4a 80%);
  box-shadow:inset 0 0 0 1px #e3b665,0 0 0 1px #0d292a;
}
.j-carried-items .j-cell:disabled { opacity:1; }
.j-carried-items .j-cell small { left:3px; bottom:2px; font-size:clamp(8px,2cqw,10px); }
.j-carried-items .j-cell-art { position:absolute; inset:4px; width:auto; height:auto; }
.j-cell-filled[data-rune-tier] { background:radial-gradient(ellipse at 52% 78%,#365354,#182c33 75%); }
.j-cell-filled[data-rune-tier]::after { content:attr(data-rune-tier); width:auto; height:auto; right:1px; bottom:1px;
  padding:0 2px; border:0; border-radius:2px; transform:none; background:#17292ceb; color:#ffedc4;
  font:700 9px/1.2 Georgia,serif; }
.j-kit-stats {
  display:flex; flex-wrap:wrap; justify-content:center; align-items:center;
  gap:6px clamp(16px,4vw,34px); margin:10px 0;
  font-size:14px; color:#cadbce; font-variant-numeric:tabular-nums;
}
.j-kit-stats > span { display:inline-flex; align-items:baseline; gap:6px; }
.j-kit-stats small { font-size:12px; }
.j-kit-stats b { color:#ffe0a0; }
.j-inventory-detail {
  display:flow-root; margin-top:10px; padding:clamp(9px,2.5vw,15px);
  border:1px solid #697b6a; border-radius:10px; background:linear-gradient(120deg,#273e3c,#1c3233);
}
.j-inventory-detail .j-inspect-art { float:left; width:54px; height:56px; margin:0 11px 5px 0; }
.j-inventory-detail small { font-size:11px; color:#c7d4c1; }
.j-inventory-detail h3 { color:#fff1cd; margin:2px 0 3px; }
.j-inventory-detail p { color:#d2dfd3; font-size:12px; line-height:1.45; }
.j-inventory-detail .j-item-actions { clear:both; padding-top:8px; }
@media (hover:hover) {
  .j-equipped-cell:hover, .j-carried-items .j-cell-filled:hover { border-color:#e8c884; }
}
@media (max-width:600px) {
  #j-dialog:has(.j-inventory-board) #j-panel-body { padding:9px 8px 12px; }
  #j-dialog:has(.j-inventory-board) .j-storage-nav { margin-bottom:9px; }
  #j-dialog:has(.j-inventory-board) .j-storage-nav button { flex-direction:row; gap:6px; font-size:12px; }
}
@media (max-width:355px) {
  #j-dialog:has(.j-inventory-board) #j-panel-body { padding-inline:5px; }
  .j-inventory-board { gap:4px; }
  .j-character-kit, .j-carried-items { padding:4px; }
  .j-equipped-cell { padding-inline:0; }
  .j-equipped-name { letter-spacing:-.02em; }
}
@media (min-width:600px) and (max-height:550px) {
  #j-dialog:has(.j-inventory-board) .j-dialog-heading { padding:3px 12px; }
  #j-dialog:has(.j-inventory-board) #j-panel-body { padding:5px 10px 10px; }
  #j-dialog:has(.j-inventory-board) .j-storage-nav { margin:0 0 5px; padding:2px; }
  #j-dialog:has(.j-inventory-board) .j-storage-nav button { min-height:34px; }
  .j-character-kit, .j-carried-items { --slot-gap:3px; --slot-height:clamp(28px,9.3dvh,43px); padding:5px; }
  .j-inventory-board .j-storage-head { margin-bottom:4px; }
  .j-game .j-inventory-board h3 { font-size:15px; }
  .j-equipped-name { font-size:9px; }
}

.j-toolbar .j-location { position:relative; }
.j-game .j-location-story {
  position:absolute; inset:0; width:100%; height:100%; min-height:44px;
  padding:0; border:0; border-radius:inherit; pointer-events:auto; background:transparent;
}
.j-location:has(.j-location-story:hover) .j-map-pin { color:#ffdf99; }
.j-game .j-story-cover {
  position:relative; isolation:isolate; display:flex; align-items:end; overflow:hidden;
  min-height:clamp(112px,25vh,190px); margin:0 0 14px; padding:14px 16px;
  border:1px solid #8e855f; border-radius:10px; background:#284041;
}
.j-story-cover > img,.j-story-cover::after { position:absolute; inset:0; width:100%; height:100%; z-index:-1; }
.j-story-cover > img { object-fit:cover; object-position:center 48%; }
.j-story-cover::after { content:""; background:linear-gradient(0deg,#101d21ed,#17272b11 72%); }
.j-story-cover small,.j-story-brief small { color:#ffdf9d; font-size:11px; font-weight:750; }
.j-game .j-dialog .j-story-cover h3 { margin:3px 0 0; color:#fff5db; font:800 clamp(19px,5vw,27px)/1.1 var(--sans); }
.j-story-prose { color:#f1eddb; font-size:15px; line-height:1.58; }
.j-story-prose h4 { margin:14px 0 4px; color:#ffe0a0; font-size:16px; }
.j-game .j-story-prose p,.j-game .j-story-record p { margin:5px 0 10px; }
.j-story-prose > small { display:block; color:var(--j-muted); font-size:12px; }
.j-story-objective,.j-story-brief { padding:9px 12px; background:#193235; border-left:3px solid #caa25d; border-radius:4px; }
.j-story-objective { margin-block:14px; }
.j-story-objective b { color:#e9cb94; font-size:12px; }
.j-game .j-story-objective p,.j-game .j-story-brief p { margin:2px 0; }
.j-story-brief { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:10px 0; }
.j-story-brief p,.j-game .j-actions .j-story-result { font-size:13px; line-height:1.45; }
.j-game .j-actions .j-story-result { max-width:62ch; color:#ffe1aa; margin-top:6px; }
.j-story-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }
.j-story-record { padding:6px 0; border-block:1px solid var(--j-line); }
.j-story-record summary { padding:9px 0; cursor:pointer; font-weight:750; color:#ffdf9a; }
.j-story-actions button,.j-story-brief button { min-height:44px; }
.guide-person { display:grid; grid-template-columns:56px 1fr; gap:12px; align-items:start; }
.guide-person img { max-width:100%; height:70px; object-fit:contain; }
.guide-vigias ol { margin:9px 0; padding:0; list-style:none; }
.guide-vigias li { padding:8px 0; border-top:1px solid var(--paper-line); font-size:13px; }
.guide-vigias summary { cursor:pointer; padding:6px 0; font-weight:700; }
.j-mission-journal { margin:16px 0 22px; }
.j-mission-panel > small,.j-main-mission > small { color:#e8c986; font-size:12px; }
.j-mission-panel > h3,.j-main-mission > h3 { margin:5px 0; }
.j-main-mission { border-left:3px solid #d2ac66; }
.j-main-mission > b,.j-main-mission > .j-command { display:block; }
.j-main-mission > .j-command { display:inline-flex; }
.j-mission-past { display:flex; align-items:center; gap:8px; padding:6px 2px; }
.j-mission-past > small { margin-left:auto; color:var(--j-muted); }
.j-mission-past > .j-icon,.j-mission-steps .j-icon,.j-mission-reward .j-icon { flex:none; width:15px; height:15px; }
.j-mission-steps,.j-mission-evidence { margin:10px 0; padding:0; list-style:none; }
.j-mission-steps li { display:flex; gap:8px; align-items:baseline; padding:4px 0; font-size:13px; color:var(--j-muted); }
.j-mission-steps .j-icon { align-self:center; }
.j-mission-steps .is-current { color:#ffe4a9; font-weight:700; }
.j-mission-steps .is-done { color:#acd3ad; }
.j-mission-steps b { margin-left:auto; white-space:nowrap; }
.j-mission-reward { display:flex; align-items:center; gap:7px; font-size:13px; color:#e4cf9e; }
.j-mission-dialogue,.j-mission-clue { margin:12px 0; padding:12px 14px; border-left:3px solid #d5b474; background:#182e32; border-radius:4px; }
.j-mission-dialogue strong { color:#ffe5ae; }
.j-mission-dialogue,.j-story-host { display:flex; align-items:flex-start; gap:12px; }
.j-story-host { align-items:center; }
.j-dialogue-face { flex:none; width:clamp(44px,12vw,58px); height:clamp(52px,14vw,68px); }
img.j-dialogue-face { object-fit:cover; object-position:50% 0; }
.j-mission-dialogue p { margin:6px 0; font-size:16px; line-height:1.5; }
.j-mission-dialogue small,.j-mission-clue { color:#d4ded0; }
.j-mission-evidence li { margin:8px 0; line-height:1.45; }
.j-mission-choices,.j-mission-answers { display:grid; gap:8px; margin:10px 0; padding:0; border:0; }
.j-mission-choices legend { margin-bottom:8px; }
.j-mission-choices .j-command,.j-mission-answers .j-command,.j-mission-panel .j-command { min-height:44px; white-space:normal; text-align:left; }
.j-mission-alert { flex-basis:100%; text-align:right; font-weight:700; color:#ffe099; }
.j-encounter-caption:has(.j-mission-alert) { flex-wrap:wrap; }
@media (max-width:540px) {
  .j-story-brief { flex-wrap:wrap; }
  .j-story-cover { padding:12px; }
  .j-story-record summary { min-height:44px; box-sizing:border-box; }
  .j-main-mission > .j-command { min-height:44px; white-space:normal; }
}

.session[hidden], #friend-count[hidden], #legacy-import[hidden], #account-exit-close[hidden] { display:none; }
#friend-count {
  padding:1px 5px; min-width:17px; border-radius:12px; font-size:11px;
  color:#23413b; background:var(--gold);
}
.account-entry {
  display:grid; grid-template-columns:minmax(0,1.06fr) minmax(320px,.94fr);
  min-height:clamp(430px,60vh,580px); margin-block:clamp(20px,4vw,50px) 28px;
  overflow:hidden; border:3px solid #102d32; border-radius:18px;
  background:var(--paper); box-shadow:0 5px 0 #0c2830;
}
.account-landscape {
  position:relative; background-position:48% center; background-size:cover; background-color:#325f4e;
}
.account-landscape::after {
  content:""; position:absolute; inset:10px; border:1px solid #ffedba60; border-radius:7px;
}
.account-paper {
  display:grid; align-items:center; color:var(--paper-ink); color-scheme:light;
  padding:clamp(24px,4vw,64px);
}
#account-form { width:100%; max-width:400px; margin:auto; }
#account-form h1 {
  margin:0 0 22px; line-height:1.1; letter-spacing:-.055em;
  font-size:clamp(26px,3vw,41px); font-weight:900;
}
#account-form label:not(.account-reveal), .friend-search label {
  display:block; margin:14px 0 6px; font-size:13px; font-weight:800;
}
#account-form input:not([type="checkbox"]), .friend-search input {
  width:100%; min-width:0; min-height:43px; border:1px solid #9ba997; border-radius:8px;
  padding:8px 12px; background:#fffcf0; color:var(--paper-ink); font-size:16px;
}
#account-form small { display:block; margin-top:5px; font-size:12px; color:var(--paper-muted); }
.account-reveal { display:inline-flex; align-items:center; gap:6px; margin:10px 0 0; color:var(--paper-muted); font-size:13px; cursor:pointer; }
.account-reveal input { accent-color:#376a59; }
.account-status, .friends-status { margin:8px 0; min-height:0; color:#90452e; font-weight:650; font-size:13px; }
.account-status:empty,.friends-status:empty { display:none; }
#account-form > .gold-button { width:100%; justify-content:center; margin:14px 0 0; }
.account-alternate { display:flex; justify-content:center; align-items:center; flex-wrap:wrap; gap:6px; padding-top:18px; font-size:13px; color:var(--paper-muted); }
.account-alternate button { border:0; background:none; color:#235e52; text-decoration:underline; font-weight:800; padding:4px; }
.account-google { display:flex;align-items:center;justify-content:center;width:100%;min-height:46px;border:1px solid #9ba997;border-radius:9px;background:#fffefa;color:#243e39;font:700 15px/1.4 var(--sans);padding:10px 12px;cursor:pointer; }
.account-google:disabled { opacity:.6;cursor:default; }
.account-divider { display:flex;align-items:center;gap:9px;margin:18px 0;color:var(--paper-muted);font-size:12px; }
.account-divider::before,.account-divider::after { content:"";height:1px;flex:1;background:#c9ccb6; }
.account-link { display:block;border:0;background:none;color:#235e52;font:700 14px/1.4 var(--sans);text-decoration:underline;text-underline-offset:3px;min-height:44px;padding:10px 4px;cursor:pointer; }
.account-link:disabled { color:#67766b;opacity:.7;cursor:default; }
#account-form > .account-link { margin:2px auto 0; }
#account-form p { line-height:1.5; }
#account-email-wrap[hidden],#account-security[hidden] { display:none; }
.account-notice { margin:14px auto;max-width:900px;padding:12px 16px;border:1px solid #92a67b;border-radius:10px;color:#f8f2db;background:#2a534b;line-height:1.5; }
#account-security-dialog { width:min(540px,calc(100% - 24px));max-height:calc(92dvh - env(safe-area-inset-top));overflow:auto;box-sizing:border-box;padding:22px;color:var(--paper-ink);color-scheme:light;background:var(--paper);border:3px solid #173b40;border-radius:16px; }
#account-security-dialog::backdrop { background:#0a242bc9;backdrop-filter:blur(2px); }
.account-security-heading { display:flex;align-items:center;justify-content:space-between;gap:15px; }
.account-security-heading h2 { margin:0;font-size:26px; }
.account-security-heading .icon-button { color:var(--paper-ink);font-size:24px;border-color:var(--paper-line);min-width:44px;min-height:44px; }
.account-security-user { color:var(--paper-muted);margin:2px 0 18px;overflow-wrap:anywhere; }
.account-security-section { padding:16px 0;border-top:1px solid #c5c6ad; }
.account-security-section h3 { margin:0 0 10px;font-size:18px; }
.account-security-section p { margin:8px 0;line-height:1.45;font-size:14px; }
.account-security-address { font-weight:750;overflow-wrap:anywhere; }
.account-security-section label { display:block;font-size:13px;font-weight:750;margin:12px 0 6px; }
.account-security-section input { width:100%;box-sizing:border-box;min-height:44px;padding:8px 12px;border:1px solid #9ba997;border-radius:8px;background:#fffcf0;color:var(--paper-ink);font-size:16px; }
.account-security-section form button { width:100%;margin-top:12px;min-height:44px;justify-content:center; }
.account-service-note { color:var(--paper-muted); }
.account-privacy { text-align:center;font-size:12px;margin:18px 0 0; }
.account-privacy a { display:inline-flex;align-items:center;min-height:44px;color:var(--paper-muted);text-underline-offset:3px; }
#account-security-status { position:sticky;bottom:-22px;background:var(--paper);padding:10px 0; }
#friends-dialog {
  width:min(570px,calc(100% - 24px)); max-height:85vh; overflow-y:auto; padding:0;
  color:var(--paper-ink); color-scheme:light; background:var(--paper); border:3px solid #173b40;
  border-radius:16px; box-shadow:0 10px 0 #09262d55,0 22px 65px #081f2bd1;
}
#friends-dialog::backdrop { background:#0a242bd4; backdrop-filter:blur(2px); }
#account-exit-dialog {
  width:min(420px,calc(100% - 24px)); padding:22px; color:var(--paper-ink); background:var(--paper);
  border:3px solid #173b40; border-radius:14px;
}
#account-exit-dialog h2 { margin:0 0 8px; }
#account-exit-note { margin:8px 0; color:var(--paper-muted); }
#account-exit-dialog::backdrop { background:#0a242bd4; }
.friends-body { padding:clamp(15px,3vw,32px); }
.friends-heading,.friends-list-heading { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.friends-heading h2 { margin:0; font-size:clamp(24px,3vw,33px); letter-spacing:-.045em; }
.friends-heading .icon-button { color:var(--paper-ink); border-color:var(--paper-line); }
.friends-heading .icon-button:hover { background:#e4ebd5; color:var(--paper-ink); }
.friend-search { padding-bottom:18px; border-bottom:1px solid var(--paper-line); }
.friend-search > div { display:flex; gap:6px; }
.friend-search .gold-button { flex:none; }
.friends-list-heading { margin-top:18px; }
.friends-body h3 { margin:18px 0 8px; font-size:16px; }
.friends-list-heading h3 { margin:0; }
.friends-empty { color:var(--paper-muted); margin:8px 0 12px; font-size:14px; }
.friend-rows { margin:8px 0 13px; padding:0; list-style:none; }
.friend-row {
  display:flex; align-items:center; flex-wrap:wrap; gap:7px; padding:9px 0;
  border-bottom:1px solid #d9dcc4;
}
.friend-initial {
  display:grid; place-items:center; flex:none; width:29px; height:29px; border-radius:50%;
  color:#216159; background:#dce8c9; font-weight:850;
}
.friend-row strong { overflow-wrap:anywhere; min-width:0; }
.friend-actions { margin-left:auto; display:flex; flex-wrap:wrap; gap:4px; }
.friend-hint { font-size:12px; color:var(--paper-muted); margin-left:auto; }
.friend-hint + .friend-actions:empty { display:none; }
.friend-action { border:1px solid #b5bca4; border-radius:7px; min-height:32px; padding:4px 8px; font-size:12px; font-weight:750; background:#f1f2da; color:#2e564d; }
.friend-action:hover { background:#e0eacb; border-color:#62816f; }
.friend-action[data-friend-action="requestFriend"],.friend-action[data-friend-action="acceptFriend"] { color:#fff5d9; background:#365f53; border-color:#27493e; }
body:not(:has(#roster-heading)) #legacy-import { display:none; }
#legacy-import .legacy-tools {
  margin-top:18px; padding:12px 16px; color:#e7edd9; background:#24474b;
  border:1px solid #58716e; border-radius:10px; line-height:1.45;
}
.legacy-tools summary { cursor:pointer; font-weight:750; font-size:14px; }
.legacy-tools p,.legacy-group,.legacy-status,.legacy-file { font-size:13px; }
.legacy-tools p { margin:7px 0; }
.legacy-group { display:flex; flex-wrap:wrap; align-items:center; gap:7px 12px; }
.legacy-tools button,.legacy-landing button:not(.gold-button) {
  min-height:32px; padding:5px 10px; border:1px solid #9baf96; border-radius:7px;
  background:#e4eccd; color:#244839; font-weight:750;
}
.legacy-file { max-width:100%; }
.legacy-status { font-weight:700; }
.legacy-landing p { line-height:1.5; }
@media(max-width:920px) {
  .topbar { gap:10px; }
  .main-nav { gap:2px; }
  .nav-item { padding-inline:8px; }
  .header-tools { gap:4px; }
  #session-name { max-width:10ch; }
}
@media(max-width:720px) {
  .account-entry { grid-template-columns:1fr; min-height:0; }
  .account-landscape { min-height:clamp(125px,26vw,190px); background-position:center 52%; }
  .account-paper { padding:26px 20px; }
  .main-nav .nav-label,.header-tools .nav-label { display:none; }
  .main-nav .nav-item,.header-tools .nav-item { width:32px; padding:0; }
  #friend-count { position:absolute; top:-3px; right:-2px; }
  #friends-nav { position:relative; }
}
@media(max-width:390px) {
  .topbar { gap:4px; }
  .main-nav .nav-item,.header-tools .nav-item,.header-tools .icon-button { width:28px; }
  .topbar .brand { gap:4px; }
  .topbar .brand img { width:23px; }
  .topbar .wordmark { font-size:18px; }
}
#afk-return {display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;margin-top:10px;background:#284c48;color:var(--ink);border:1px solid #6c8c75;border-radius:9px;}
#afk-return strong {color:var(--bright);font-size:15px;}
#afk-return p {line-height:1.4;font-size:14px;margin:3px 0 0;}
#afk-return button {flex:none;}
.release-update {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:8px;padding:8px 12px;background:#284c48;border:1px solid #6c8c75;border-radius:9px;color:var(--ink);font-size:14px;}
.release-update button {flex:none;min-height:44px;}

#guild-dialog {
  width: min(570px, calc(100% - 24px));
  max-height: 85vh;
  overflow-y: auto;
  padding: 0;
  color: var(--paper-ink);
  color-scheme: light;
  background: var(--paper);
  border: 3px solid #173b40;
  border-radius: 16px;
  box-shadow: 0 10px 0 #09262d55, 0 22px 65px #081f2bd1;
}
#guild-dialog::backdrop { background: #0a242bd4; backdrop-filter: blur(2px); }
.guild-toolbar { margin-top: 8px; text-align: right; }
.guild-banner, .guild-create {
  padding: 12px 16px;
  border: 1px solid var(--paper-line);
  border-radius: 9px;
  background: #e9ecd6;
}
.guild-banner h3 { margin: 0; font-size: 20px; }
.guild-banner p, .guild-entry p { margin: 4px 0; overflow-wrap: anywhere; }
.guild-entry { min-width: 0; }
.guild-entry small { display: block; color: var(--paper-muted); }
.guild-find label, .guild-create label { display: block; margin: 8px 0 4px; font-weight: 650; }
.guild-find > div { display: flex; gap: 8px; }
.guild-find input, .guild-create input {
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--paper-line);
  background: #fffdf1;
  color: var(--paper-ink);
  font: inherit;
}
.guild-create { margin-top: 18px; }
.guild-create summary { cursor: pointer; font-weight: 750; }
.guild-create button { margin-top: 10px; }
#guild-dialog .friend-row { flex-wrap: wrap; }

#coop-dialog {
  color:var(--paper-ink);background:var(--paper);border:2px solid #71938a;border-radius:16px;
  width:min(770px,calc(100vw - 20px));max-height:91dvh;padding:0;color-scheme:light;
  box-shadow:0 14px 58px #071f28aa;
}
#coop-dialog::backdrop {background:#09232ad1;}
#coop-content [data-coop="inspect"] {display:none;}
.coop-wrap {padding:clamp(14px,3vw,24px);}
.coop-heading,.coop-tools,.coop-row,.coop-headline,#coop-return {display:flex;align-items:center;justify-content:space-between;gap:10px;}
.coop-heading h2 {font:800 clamp(24px,4vw,32px)/1.15 var(--serif);margin:0;}
.coop-heading {border-bottom:1px solid var(--paper-line);padding-bottom:12px;margin-bottom:14px;}
.coop-heading .icon-button {color:var(--ink);background:#245158;width:34px;height:34px;}
#coop-content h3 {font:800 19px/1.2 var(--serif);margin:8px 0;}
#coop-content p {line-height:1.45;}
#coop-content input,#coop-content select {font:inherit;min-height:36px;border-radius:6px;border:1px solid #93a98f;background:#fff9e7;color:#253c35;padding:5px 8px;max-width:100%;}
#coop-content button,#coop-return button {background:#274f55;color:#fff3ce;border:1px solid #456c69;border-radius:7px;padding:7px 12px;font:700 13px/1.25 var(--sans);min-height:34px;}
#coop-content button:hover:enabled,#coop-content button:focus-visible {background:#366768;}
#coop-content button:disabled {opacity:.55;}
.coop-tools {margin-bottom:16px;align-items:end;}
.coop-tools label,#coop-search label {display:grid;gap:4px;font-weight:800;font-size:13px;}
.coop-cards,.coop-sides {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.coop-card {display:flex;align-items:end;min-height:220px;border-radius:11px;overflow:hidden;background-size:cover;background-position:center 50%;color:var(--ink);border:1px solid #8b9c80;}
.coop-card>div {width:100%;padding:48px 16px 16px;background:linear-gradient(transparent,#132f34ed 28%,#142f34 100%);}
#coop-content .coop-card h3 {font-size:25px;}
.coop-card p {font-size:14px;margin:6px 0 14px;}
.coop-buttons {display:flex;flex-wrap:wrap;gap:7px;}
#coop-content [data-coop="random"],#coop-content [data-coop="raid"],#coop-content [data-coop="start"],#coop-content [data-coop="attack"] {background:#ffd072;border-color:#ad7b34;color:#322c1d;}
#coop-content [data-coop="random"]:hover:enabled,#coop-content [data-coop="raid"]:hover:enabled,#coop-content [data-coop="start"]:hover:enabled,#coop-content [data-coop="attack"]:hover:enabled {background:#ffe3a6;}
.coop-row {flex-wrap:wrap;margin:6px 0 12px;}
.coop-headline {border-radius:9px;background:#254d51;color:#fff1c8;padding:12px 16px;}
.coop-headline small {color:#d4e4cc;font-size:13px;}
.coop-headline h3 {margin:5px 0 0 !important;}
.coop-roster,#coop-candidates {padding:0;list-style:none;display:grid;gap:5px;}
.coop-roster li,#coop-candidates li {display:flex;align-items:center;justify-content:space-between;gap:8px;background:#e9ecd4;padding:8px 10px;border-radius:6px;}
.coop-roster li span,.coop-hint {font-size:13px;color:#4a665f;}
#coop-search>div {display:flex;gap:6px;margin-top:6px;}
#coop-phase {font-size:14px;font-weight:750;margin:0 0 8px;}
#coop-order {margin-bottom:7px;}
#coop-moves {align-items:center;}
#coop-content #coop-moves .coop-command {
  box-sizing:border-box;flex:none;display:grid;align-content:center;justify-items:center;gap:1px;
  width:62px;height:62px;min-height:62px;padding:2px;border:2px solid var(--rim);border-radius:50%;
  --rim:#e6bf76;--light:#735d3d;--dark:#392f28;
  background:radial-gradient(circle at 38% 22%,var(--light),var(--dark) 75%);
  color:#fff4d9;font:750 11px/1.05 var(--sans);text-shadow:0 1px 2px #111;
  box-shadow:inset 0 0 0 2px #243032,0 0 0 1px #253536,0 2px 4px #061d2488;
  touch-action:manipulation;
}
#coop-content #coop-moves [data-coop="guard"] {--rim:#8accc0;--light:#4a7370;--dark:#213c41;}
#coop-content #coop-moves .coop-command svg {width:30px;height:30px;}
#coop-content #coop-moves .coop-command > * {pointer-events:none;}
#coop-content #coop-moves .coop-command:hover:enabled {filter:brightness(1.13);}
#coop-content #coop-moves .coop-command:focus-visible {outline:3px solid #fff2bb;outline-offset:2px;}
#coop-content #coop-moves .coop-command:active:enabled {box-shadow:inset 0 0 0 3px #192525,0 0 0 1px #253536;}
#coop-content #coop-moves .coop-command:disabled {opacity:1;filter:saturate(.25) brightness(.79);}
#coop-arena-wrap {position:relative;isolation:isolate;overflow:hidden;border-radius:9px;}
#coop-arena {display:block;width:100%;aspect-ratio:2.35;background:#25474b;border-radius:9px;border:1px solid #718f7c;}
#coop-signal {font-weight:800;margin-top:10px;}
.coop-sides {margin:6px 0 10px;}
#coop-content .coop-sides h3 {font-size:14px;margin:4px 0 6px;}
#coop-content .coop-unit {display:block;text-align:left;width:100%;min-height:0;opacity:1;padding:4px 7px;background:#e6ead5;color:var(--paper-ink);border:1px solid #b7c6ae;border-radius:6px;margin-bottom:3px;}
#coop-content .coop-unit.is-current {border-color:#657f4c;background:#dce6bc;}
#coop-content #coop-foes .is-current {border-color:#ae7136;background:#f5dfb2;}
#coop-content .coop-unit:enabled:hover {color:#fff;}
.coop-unit>span {display:flex;align-items:center;justify-content:space-between;gap:5px;font-size:12px;}
.coop-unit small {font-size:10px;white-space:nowrap;}
.coop-unit meter {display:block;width:100%;height:6px;accent-color:#4a885b;}
.coop-unit meter::-webkit-meter-optimum-value {background:#48835c;}
#coop-foes meter::-webkit-meter-optimum-value {background:#b66f3e;}
#coop-quit {background:#f3e1b8;padding:10px;margin-top:8px;border-radius:6px;}
#coop-quit p {margin:0 0 6px;}
.coop-history {font-size:13px;margin-top:12px;}
.coop-history summary {cursor:pointer;font-weight:700;}
.coop-history ol {padding-left:1.4em;}
#coop-status {margin:10px 0 0;line-height:1.3;font-weight:700;font-size:13px;}
#coop-status:empty {display:none;}
#coop-return {margin-top:6px;padding:6px 12px;border:1px solid #5f8174;background:#264d4a;border-radius:7px;font-size:14px;}
#coop-return[hidden],#coop-count[hidden] {display:none;}
#coop-nav {position:relative;}
#coop-count {border-radius:50%;background:#ffd176;color:#253937;font-size:10px;min-width:16px;position:absolute;right:-3px;top:-3px;}
@media(max-width:1080px) {
  .topbar {gap:10px;}
  .main-nav .nav-item {padding-inline:7px;}
}
@media(min-width:721px) and (max-width:950px) {
  .main-nav .nav-label {display:none;}
}
@media(max-width:540px) {
  .coop-cards {grid-template-columns:1fr;gap:8px;}
  .coop-card {min-height:144px;}
  .coop-card>div {padding:24px 12px 12px;}
  .coop-card p {margin:4px 0 8px;}
  #coop-arena {aspect-ratio:1.65;}
  .coop-unit>span {flex-wrap:wrap;}
  .coop-unit small {margin-left:auto;}
  .coop-sides {gap:6px;}
  .topbar .main-nav .nav-item {padding:0;}
}
@media(max-width:390px) {
  .topbar .brand small {display:none;}
  .topbar .brand .wordmark {font-size:15px;}
  .topbar .main-nav,.topbar .header-tools {gap:1px;}
}
@media (max-width:760px), (pointer:coarse) and (max-width:1024px) {
  #coop-dialog[data-screen="fight"] {
    --edge-top:calc(10px + env(safe-area-inset-top));
    --edge-bottom:calc(10px + env(safe-area-inset-bottom));
    --edge-left:calc(10px + env(safe-area-inset-left));
    --edge-right:calc(10px + env(safe-area-inset-right));
    --coop-glass:linear-gradient(150deg,#294644f5,#152d2ff5);
    position:fixed;inset:0;margin:0;width:100%;max-width:none;height:100vh;height:100dvh;
    max-height:none;padding:0;border:0;border-radius:0;overflow:hidden;color:#fff1ce;background:#243b3e;
  }
  #coop-dialog[data-screen="fight"] .coop-wrap {padding:0;}
  #coop-dialog[data-screen="fight"] .coop-heading {
    position:absolute;z-index:2;top:var(--edge-top);left:var(--edge-left);right:var(--edge-right);
    margin:0;padding:0;border:0;pointer-events:none;
  }
  #coop-dialog[data-screen="fight"] .coop-heading h2, #coop-content #coop-phase {
    width:fit-content;padding:5px 10px;color:#fff0cc;background:var(--coop-glass);
    border:1px solid #a28a5f;border-radius:10px;text-shadow:0 1px #132121;
  }
  #coop-dialog[data-screen="fight"] .coop-heading h2 {font-size:22px;}
  #coop-dialog[data-screen="fight"] #coop-close {
    width:44px;height:44px;border:1px solid #a28a5f;pointer-events:auto;background:var(--coop-glass);
  }
  #coop-content #coop-phase {position:absolute;z-index:1;top:calc(var(--edge-top) + 48px);left:var(--edge-left);font-size:12px;}
  #coop-content #coop-order {position:absolute;z-index:1;top:calc(var(--edge-top) + 82px);left:var(--edge-left);max-width:calc(100% - var(--edge-left) - var(--edge-right));margin:0;}
  #coop-content #coop-arena-wrap {position:absolute;inset:0;border-radius:0;}
  #coop-content #coop-arena {position:absolute;inset:0;width:100%;height:100%;border:0;border-radius:0;aspect-ratio:auto;touch-action:manipulation;}
  #coop-content .coop-turn, #coop-content #coop-moves {
    position:absolute;z-index:2;left:var(--edge-left);right:var(--edge-right);display:flex;align-items:center;gap:6px;
  }
  #coop-content #coop-moves {bottom:var(--edge-bottom);flex-wrap:nowrap;justify-content:flex-end;gap:9px;pointer-events:none;}
  #coop-content #coop-moves button {pointer-events:auto;}
  #coop-content #coop-moves [data-coop="leave"] {order:-1;margin-right:auto;min-height:44px;}
  #coop-content .coop-turn {bottom:calc(var(--edge-bottom) + 70px);justify-content:space-between;align-items:flex-end;pointer-events:none;}
  #coop-content .coop-turn > div:not(:has(#coop-signal:empty)) {
    min-width:0;padding:5px 8px;border-radius:9px;background:#102b2ce8;border:1px solid #75918b;
  }
  #coop-content #coop-signal {font-size:13px;margin:0;line-height:1.2;}
  #coop-content #coop-clock {display:block;font-size:10px;line-height:1.35;}
  #coop-content #coop-clock[hidden] {display:none;}
  #coop-content [data-coop="inspect"] {display:block;pointer-events:auto;flex:none;min-height:44px;border:1px solid #ab956c;background:var(--coop-glass);}
  #coop-content #coop-inspection {display:none;}
  #coop-content:has([data-coop="inspect"][aria-expanded="true"]) #coop-inspection,
  #coop-content #coop-quit:not([hidden]) {
    display:block;position:absolute;z-index:3;left:var(--edge-left);right:var(--edge-right);
    bottom:calc(var(--edge-bottom) + 120px);max-height:55%;overflow:auto;overscroll-behavior:contain;
    padding:10px;color:#fff1ce;background:var(--coop-glass);border:1px solid #b19b70;border-radius:12px;
  }
  #coop-content #coop-quit:not([hidden]) {z-index:4;}
  #coop-content .coop-sides {gap:7px;margin:0;}
  #coop-content .coop-unit {margin-bottom:4px;}
  #coop-content button.coop-unit, #coop-content #coop-quit button, #coop-content .coop-history summary {min-height:44px;}
  #coop-content .coop-history summary {display:flex;align-items:center;}
  #coop-dialog[data-screen="fight"] #coop-status:not(:empty) {
    position:absolute;z-index:3;top:calc(var(--edge-top) + 132px);left:var(--edge-left);right:var(--edge-right);
    width:fit-content;margin:0;padding:5px 8px;border-radius:6px;color:#fff2cf;background:#1c302ded;
  }
}
@media (orientation:landscape) and (max-height:550px) and (pointer:coarse) {
  #coop-content #coop-phase {top:calc(var(--edge-top) + 7px);left:calc(var(--edge-left) + 122px);}
  #coop-content #coop-order {top:var(--edge-top);left:auto;right:calc(var(--edge-right) + 50px);}
  #coop-content #coop-moves {left:auto;width:min(55%,430px);}
  #coop-content #coop-moves [data-coop="leave"] {margin-right:0;}
  #coop-content .coop-turn {bottom:var(--edge-bottom);width:calc(44% - var(--edge-left));}
  #coop-content:has([data-coop="inspect"][aria-expanded="true"]) #coop-inspection,
  #coop-content #coop-quit:not([hidden]) {bottom:calc(var(--edge-bottom) + 70px);right:auto;width:min(540px,80%);max-height:63%;}
}
@media (orientation:landscape) and (max-height:550px) and (max-width:650px) and (pointer:coarse) {
  #coop-content #coop-order:has(.turn-slot:nth-of-type(4)) {top:calc(var(--edge-top) + 46px);right:var(--edge-right);}
}
@media (orientation:landscape) and (max-height:550px) and (max-width:525px) and (pointer:coarse) {
  #coop-content #coop-order {top:calc(var(--edge-top) + 46px);right:var(--edge-right);}
}
@media (min-width:761px) and (pointer:fine), (min-width:1025px) {
  #coop-dialog[data-screen="fight"] #coop-content {display:flex;flex-direction:column;}
  #coop-content #coop-inspection {display:contents;}
  #coop-content .coop-history {order:1;}
}

#graphics-dialog {
  width: min(390px, calc(100% - 28px));
  max-height: 85vh;
  padding: 0;
  color-scheme: light;
  color: var(--paper-ink);
  background: var(--paper);
  border: 3px solid #12383c;
  border-radius: 16px;
  box-shadow: 0 12px 40px #081f2b7a;
}
#graphics-dialog::backdrop { background: #0a242bbc; }
#graphics-dialog form { padding: 20px; }
#graphics-dialog header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
#graphics-dialog h2 { margin: 0; font-size: 24px; }
#graphics-dialog .icon-button { color: var(--paper-ink); background: #e5e9d4; font-size: 25px; }
#graphics-dialog label, #graphics-dialog legend { font-size: 14px; font-weight: 750; }
#graphics-dialog label[for="graphics-profile"] { display: block; margin-bottom: 6px; }
#graphics-dialog select {
  width: 100%; min-height: 38px; padding: 5px 8px; border: 1px solid #96aa92; border-radius: 7px;
  color: var(--paper-ink); background: #fffcf1; font: 700 14px var(--sans);
}
#graphics-dialog select:focus-visible, #graphics-action-cutins:focus-visible { outline: 3px solid #b87416; outline-offset: 2px; }
#graphics-dialog .graphics-toggle {
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  min-height:44px; margin-top:14px; padding:8px 0; cursor:pointer;
}
#graphics-dialog .graphics-toggle small {
  display:block; margin-top:2px; font-size:12px; font-weight:500; line-height:1.4; color:var(--paper-muted);
}
#graphics-action-cutins {
  appearance:none; -webkit-appearance:none; flex:none; box-sizing:border-box;
  width:44px; height:26px; margin:0; padding:3px; border:1px solid #687c70; border-radius:15px;
  background:#687c70; cursor:pointer;
}
#graphics-action-cutins::before {
  content:""; display:block; width:18px; height:18px; border-radius:50%; background:#fffcf1;
}
#graphics-action-cutins:checked { border-color:#215b50; background:#215b50; }
#graphics-action-cutins:checked::before { transform:translateX(18px); }
@media (forced-colors:active) {
  #graphics-action-cutins { appearance:auto; }
  #graphics-action-cutins::before { display:none; }
}
#graphics-dialog fieldset {
  display: grid; grid-template-columns: 1fr 1.1fr; align-items: center; gap: 9px 14px; min-width: 0;
  margin: 20px 0 12px; padding: 10px 0 0; border: none; border-top: 1px solid var(--paper-line);
}
#graphics-dialog legend { padding: 0 8px 0 0; color: var(--paper-muted); }
#graphics-dialog p { margin: 12px 0 0; color: var(--paper-muted); font-size: 12px; line-height: 1.4; }
@media (min-width: 721px) and (max-width: 1350px) {
  .topbar { gap: 12px; }
  .topbar .header-tools { gap: 6px; }
  .topbar .nav-item { padding-inline: 8px; }
  #session-name { max-width: 12ch; }
  #graphics-nav { width: 34px; padding: 0; }
  #graphics-nav .nav-label { display: none; }
}
@media (min-width: 721px) and (max-width: 1000px) {
  .topbar .nav-label { display: none; }
  .topbar .nav-item { width: 36px; padding: 0; }
}
@media (max-width: 460px) {
  .topbar:has(#account-logout:not([hidden])) .brand > div {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  }
  .topbar .header-tools { gap: 2px; }
}

/* Phone navigation stays within thumb reach, including the home-indicator inset. */
#app-install:not([hidden]) {
  min-height:44px; padding:6px 8px; font:700 12px/1.25 var(--sans);
  border:0; background:transparent; color:#ffe3a1; text-decoration:underline; text-underline-offset:3px;
}
#app-install-help {
  width:min(365px,calc(100% - 32px)); padding:22px; border:1px solid #ae945e; border-radius:15px;
  color:#f8efd6; background:linear-gradient(145deg,#29484a,#162c32); box-shadow:0 12px 40px #091b22aa;
  max-height:85dvh; overflow:auto;
}
#app-install-help::backdrop { background:#07191ed4; }
#app-install-help h2 { margin:0; font:800 22px/1.2 var(--sans); color:#ffe8b5; }
#app-install-steps { margin:16px 0 20px; padding-left:24px; font:15px/1.45 var(--sans); }
#app-install-steps li + li { margin-top:9px; }
#app-install-help .gold-button { min-height:44px; }
@media (max-width:720px) {
  body { padding-inline:env(safe-area-inset-left) env(safe-area-inset-right); }
  .site-header { padding-top:env(safe-area-inset-top); }
  .topbar { min-height:48px; gap:6px; }
  .topbar .header-tools { margin-left:auto; }
  .topbar .header-tools :is(.nav-item,.icon-button),
  .topbar .main-nav .nav-item { min-height:44px; min-width:44px; }
  .topbar:has(#account-logout:not([hidden])) .brand > div {
    position:static; width:auto; height:auto; overflow:visible; clip-path:none;
  }
  body:has(#roster-nav:not([hidden])) { padding-bottom:calc(60px + env(safe-area-inset-bottom)); }
  .main-nav:has(#roster-nav:not([hidden])) {
    position:fixed; z-index:6; inset:auto 0 0; display:flex; align-items:center;
    margin:0; gap:0; padding:3px max(4px,env(safe-area-inset-right)) calc(3px + env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left));
    background:#15373d; border-top:1px solid #57766f; box-shadow:0 -3px 12px #10292c44;
  }
  .topbar .main-nav:has(#roster-nav:not([hidden])) .nav-item:not([hidden]) {
    display:flex; flex:1; flex-direction:column; gap:3px; width:auto; min-width:0; min-height:49px;
    padding:3px 1px; border-radius:8px;
  }
  .topbar .main-nav:has(#roster-nav:not([hidden])) .nav-label {
    display:block; font-size:clamp(10px,2.7vw,12px); line-height:1.1; white-space:normal; overflow-wrap:anywhere;
  }
  .topbar .main-nav .ui-icon { width:20px; height:20px; }
  #friend-count,#coop-count { right:10%; top:1px; }
  .name-field input,.friend-search input,.j-dialog select { font-size:16px; }
  .preview-controls > span:first-child { display:none; }
  .wizard .adjust button,.wizard-actions button,.roster-back,.roster-panel .gold-button,
  .sex-options span,.topbar .icon-button { min-height:44px; }
  .wizard .adjust button { min-width:44px; }
  .sex-options span { display:flex; align-items:center; }
  #creation-world,.j-canvas,#coop-arena { touch-action:pan-y pinch-zoom; }
}
@media (max-width:600px) {
  .j-game { width:calc(100% - 12px); padding-top:6px; }
  .j-game .j-toolbar { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; margin:0 1px 6px; }
  .j-toolbar .j-location { grid-column:1 / 3; grid-row:1; min-height:35px; }
  .j-toolbar .j-location h1 { font-size:19px; }
  .j-toolbar .j-map-pin { flex:none; }
  .j-toolbar .j-tools { display:contents; }
  .j-toolbar .j-purse { grid-column:3; grid-row:1; justify-self:end; }
  .j-toolbar .j-tools .j-tool { grid-row:2; min-width:0; min-height:44px; font-size:12px; }
  .j-toolbar .j-auto-controls { grid-column:1 / -1; grid-row:3; display:grid; grid-template-columns:minmax(0,1.12fr) minmax(0,1fr); }
  .j-toolbar .j-auto-tool { min-height:44px; padding:3px 6px; gap:5px; flex-wrap:wrap; }
  .j-toolbar .j-auto-tool small { font-size:10px; }
  .j-toolbar .j-auto-choice { position:relative; align-content:start; padding:4px 8px; }
  .j-toolbar .j-auto-choice select { position:absolute; inset:0; padding:14px 6px 1px; font-size:13px; }
  .j-canvas { height:clamp(165px,calc(100svh - 455px),460px); }
  .j-frame:has(.j-battle-actions) .j-canvas { height:clamp(165px,calc(100svh - 500px),400px); }
  .j-game .j-battle-row { align-items:stretch; }
  .j-battle-row .j-combat-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; }
  .j-frame :is(.j-command,.j-skill-button),.j-game .j-skills-caption .j-command,
  .j-dialog :is(.j-command,.j-plus,.j-close,.j-choice,.j-storage-nav button,.j-shop-filters button) { min-height:44px; }
  .j-dialog :is(.j-close,.j-plus) { min-width:44px; }
  .j-dialog .j-command { white-space:normal; }
  #j-dialog.j-dialog {
    inset:auto 0 0; margin:0 auto; width:100%; max-width:100%;
    max-height:calc(94dvh - env(safe-area-inset-top)); overflow:auto;
    border-radius:16px 16px 0 0; padding-bottom:env(safe-area-inset-bottom);
  }
  #j-dialog .j-dialog-heading { padding:8px 12px; }
  .j-game .j-actions { padding:8px; }
  .j-vitals-wrap .j-vital-line small { font-size:10px; }
}
@media (max-height:500px) and (orientation:landscape) and (pointer:coarse) {
  body { padding-inline:env(safe-area-inset-left) env(safe-area-inset-right); }
  #creation-world,.j-canvas,#coop-arena { touch-action:pan-y pinch-zoom; }
  .j-game .j-canvas { height:clamp(165px,55svh,240px); }
  .j-command,.j-tool,.j-close { min-height:44px; }
}

.j-mobile-auto, .j-joystick, .j-touch-cooldown, .j-turn-details { display:none; }

@media (max-width:760px), (pointer:coarse) and (max-width:1024px) {
  #app .j-game {
    --hud-left:calc(10px + env(safe-area-inset-left));
    --hud-right:calc(10px + env(safe-area-inset-right));
    --hud-top:calc(10px + env(safe-area-inset-top));
    --hud-bottom:calc(12px + env(safe-area-inset-bottom));
    --glass:linear-gradient(150deg,#263d3bf2,#132526ed);
    --bronze:#b39460;
    --relief:inset 0 1px #ffe6b93d,0 2px #251e19dc,0 3px 7px #10191c68;
    position:fixed; inset:0; width:100%; height:100vh; height:100dvh; max-width:none;
    margin:0; padding:0; overflow:hidden; isolation:isolate;
  }
  .j-game .j-frame, .j-game .j-world, #app .j-game #world-canvas {
    position:absolute; inset:0; display:block; width:100%; height:100%; margin:0;
    border:0; border-radius:0; box-shadow:none;
  }
  .j-game #world-canvas { touch-action:none; }
  .j-game #world-canvas:focus-visible { outline:0; }
  .j-game .j-frame { background:#2f4140; }
  .j-game .j-world::after {
    content:""; position:absolute; inset:0; pointer-events:none;
    background:linear-gradient(180deg,#07181c60,transparent 16%,transparent 76%,#0b1c2178);
  }
  .j-game .j-toolbar, .j-game .j-toolbar .j-tools, .j-game .j-vitals-wrap { display:contents; }
  .j-game .j-toolbar .j-auto-controls { display:none; }
  .j-game .j-player-hud, .j-game .j-toolbar .j-purse, .j-game .j-toolbar .j-location,
  .j-game .j-toolbar .j-tools .j-tool, .j-game .j-mobile-auto, .j-game .j-enemy {
    position:absolute; z-index:3;
  }
  .j-game .j-world { isolation:auto; }
  .j-game .j-player-hud {
    left:var(--hud-left); top:var(--hud-top); min-height:49px; width:min(48%,198px); max-width:none;
    display:flex; gap:6px; padding:3px 9px 3px 3px; pointer-events:none;
    background:var(--glass); border:1px solid var(--bronze); border-radius:13px 9px 9px 13px;
    box-shadow:var(--relief);
  }
  .j-game .j-avatar {
    width:40px; height:42px; border-radius:10px 4px 9px 9px; border:1px solid #ddba73;
    background:radial-gradient(circle at 40% 20%,#a9a176,#465a4e 90%);
  }
  .j-game #j-vitals { flex:1; width:auto; overflow:hidden; }
  .j-game .j-wielding { display:none; }
  .j-game .j-vital-name { gap:4px; margin-bottom:1px; line-height:1.18; }
  .j-game .j-vital-name strong { font-size:12px; }
  .j-game .j-vital-name > span { font-size:9px; }
  .j-game .j-vital-line { gap:3px; }
  .j-game .j-vital-line .j-icon { width:9px; height:9px; }
  .j-game .j-vital-line small { width:auto; font-size:9px; line-height:1.2; }
  .j-game .j-meter { height:6px; border-color:#081a24; box-shadow:0 1px #fff2; }
  .j-game .j-hp i { background:linear-gradient(#d1eb86,#65ad55); }
  .j-game .j-xp i { background:linear-gradient(#ffe39a,#e5a847); }
  .j-game .j-experience { margin-top:1px; }
  .j-game .j-toolbar .j-purse {
    top:calc(var(--hud-top) + 6px); right:calc(var(--hud-right) + 49px);
    height:31px; max-width:calc(48% - 58px); padding:2px 10px 2px 5px;
    justify-content:center; gap:3px; background:var(--glass); border:1px solid var(--bronze);
    border-radius:16px; box-shadow:var(--relief); pointer-events:none; font-size:13px;
  }
  .j-game .j-purse b { overflow:hidden; text-overflow:ellipsis; }
  .j-game .j-purse > span { display:none; }
  .j-game .j-toolbar .j-location {
    top:calc(var(--hud-top) + 55px); left:var(--hud-left);
    min-height:0; max-width:calc(100% - 96px - env(safe-area-inset-left) - env(safe-area-inset-right));
    padding:5px 12px 6px 6px; gap:6px; pointer-events:none; border-radius:6px 13px 13px 6px;
    border-left:2px solid #e7be70; background:linear-gradient(90deg,#182e2eee,#1d2c2bbd);
    box-shadow:0 2px 5px #1119;
  }
  .j-game .j-map-pin { width:24px; height:27px; background:none; border:0; box-shadow:none; }
  .j-game .j-map-pin .j-icon { width:22px; height:22px; }
  .j-game #j-location-chapter {
    font-size:9px; letter-spacing:.12em; text-transform:uppercase; font-weight:800;
    color:#f4cd86;
  }
  .j-game .j-location h1 { font-size:clamp(13px,3.6vw,17px); line-height:1.15; }
  .j-game .j-toolbar .j-tools .j-tool {
    --row:0;
    right:var(--hud-right); top:calc(var(--hud-top) + 56px + var(--row)*55px);
    display:flex; flex-direction:column; gap:1px; justify-content:flex-end;
    width:55px; height:49px; min-height:44px; padding:2px 2px 3px;
    background:var(--glass); border:1px solid var(--bronze); border-radius:12px;
    box-shadow:var(--relief); font-size:10px; font-weight:800; color:#fff1cb;
    text-shadow:0 1px 2px #000; line-height:1.25;
  }
  .j-game .j-toolbar .j-tools [data-key="attributes"] { --row:1; }
  .j-game .j-toolbar .j-tools [data-key="inventory"] { --row:2; }
  .j-game .j-tools .j-tool .j-icon { width:26px; height:26px; }
  .j-game #j-points {
    position:absolute; right:-3px; top:-4px; min-width:16px; height:16px; padding:0 3px;
    background:#ffcf74; color:#382514; border:1px solid #614423; border-radius:7px;
    font-size:9px; text-shadow:none;
  }
  .j-game .j-mobile-auto {
    left:var(--hud-left); bottom:var(--hud-bottom); display:flex; flex-direction:column;
    align-items:center; justify-content:center; gap:1px; width:49px; height:48px; padding:2px;
    background:var(--glass); color:#ffe7ab; border:1px solid var(--bronze); border-radius:12px;
    box-shadow:var(--relief); font-size:11px; font-weight:800; line-height:1.15;
  }
  .j-game .j-mobile-auto .j-icon { width:22px; height:22px; }
  .j-game .j-mobile-auto::after {
    content:""; position:absolute; right:4px; top:4px; width:6px; height:6px;
    background:#89978c; border-radius:50%; box-shadow:0 0 0 1px #142322;
  }
  .j-game .j-mobile-auto[data-enabled="true"] { border-color:#adce8a; }
  .j-game .j-mobile-auto[data-locked="true"] { color:#cdcfbd; border-color:#7a8276; }
  .j-game .j-mobile-auto[data-enabled="true"]::after { background:#a9eb7c; box-shadow:0 0 5px #a8e775; }
  .j-game[data-scene="town"] { --stick-size:clamp(96px,26vmin,116px); }
  .j-game[data-scene="town"] .j-joystick {
    position:absolute; z-index:3; left:calc(var(--hud-left) + 7px); bottom:calc(var(--hud-bottom) + 7px);
    display:grid; place-items:center; box-sizing:border-box; width:var(--stick-size); height:var(--stick-size);
    border:2px solid #bfa473b5; border-radius:50%; touch-action:none; user-select:none;
    -webkit-user-select:none; -webkit-touch-callout:none; -webkit-tap-highlight-color:transparent;
    background:radial-gradient(circle,#243c3d75 37%,#142d32a8 62%,#3b4948c9 73%);
    box-shadow:inset 0 0 0 3px #1b262d6b,0 2px 5px #11212b69; cursor:grab;
  }
  .j-joystick:focus-visible { outline:3px solid #ffda8a; outline-offset:2px; }
  .j-joystick .j-stick-marks { position:absolute; inset:0; width:100%; height:100%; color:#ffe2a9c7; pointer-events:none; }
  .j-stick-knob {
    box-sizing:border-box; display:grid; place-items:center; width:44%; aspect-ratio:1; border-radius:50%;
    border:2px solid #d4b780; pointer-events:none; transition:transform 100ms ease-out;
    background:radial-gradient(ellipse at 37% 25%,#58675d,#324e4c 53%,#1b3538 85%);
    box-shadow:inset 0 0 0 2px #293833,inset 0 3px 5px #f8e3b84a,0 3px 4px #13212494;
  }
  .j-stick-knob .j-icon { width:55%; height:55%; color:#e9ce95; opacity:.9; }
  .j-game[data-scene="town"] .j-joystick.is-held { cursor:grabbing; border-color:#f1cc89; }
  .j-joystick.is-held .j-stick-knob { transition:none; border-color:#ffe3a4; }
  .j-game[data-scene="town"] .j-mobile-auto {
    left:auto; bottom:auto; right:var(--hud-right); top:calc(var(--hud-top) + 221px); width:55px; height:49px;
  }
  .j-game .j-actions {
    position:absolute; z-index:2; left:var(--hud-left); right:var(--hud-right); bottom:var(--hud-bottom);
    display:flex; align-items:flex-end; justify-content:flex-end; flex-wrap:nowrap; gap:6px;
    min-height:0; margin:0; padding:0; border:0; background:none; pointer-events:none;
  }
  .j-game .j-actions :is(button,select) { pointer-events:auto; touch-action:manipulation; }
  .j-game .j-actions :is(kbd,.j-hint-glyph) { display:none; }
  .j-game .j-actions .j-command {
    min-height:46px; border:1px solid var(--bronze); color:#ffebbb; border-radius:11px;
    background:var(--glass); box-shadow:var(--relief); font-size:12px;
  }
  .j-game .j-actions .j-bold {
    background:linear-gradient(170deg,#ffe6a1,#edb851 74%,#ce9241);
    border-color:#fff0b5; color:#423420; box-shadow:inset 0 1px #fff6c3,0 2px #704c29,0 3px 8px #10141490;
  }
  .j-game .j-actions .j-actions-right { gap:6px; flex-wrap:wrap; justify-content:flex-end; }
  .j-game[data-scene="town"] .j-actions {
    left:calc(var(--hud-left) + var(--stick-size) + 18px); flex-direction:column; align-items:flex-end;
  }
  .j-game[data-scene="town"] .j-actions .j-actions-right { max-width:100%; }
  .j-game[data-scene="town"] .j-actions .j-command { min-height:48px; }
  .j-game[data-scene="town"] .j-actions [data-key="routes"] .j-icon { width:23px; height:23px; }
  .j-game[data-scene="town"] .j-actions .j-hint { display:none; }
  .j-game[data-scene="town"] .j-actions .j-context-hint,
  .j-game .j-turn {
    color:#fff2d0; border-radius:12px; background:#102525db; box-shadow:0 1px 4px #1118;
    font-size:11px; text-shadow:0 1px 2px #152125; line-height:1.3;
  }
  .j-game[data-scene="town"] .j-actions .j-context-hint {
    display:flex; align-items:center; padding:4px 9px; max-width:100%;
  }
  .j-game .j-context-hint strong { font-size:12px; }
  .j-game .j-context-hint p { display:none; }
  .j-game[data-scene="result"] .j-actions {
    left:calc(var(--hud-left) + 57px); flex-direction:column; align-items:stretch;
    max-height:38%; padding:8px; border-radius:13px; background:var(--glass); border:1px solid var(--bronze);
    overflow:auto; overscroll-behavior:contain; pointer-events:auto; box-shadow:var(--relief); justify-content:flex-start;
  }
  .j-game .j-result-actions .j-command { flex:1 1 94px; white-space:normal; }
  .j-game:is([data-scene="battle"],[data-scene="result"]) .j-toolbar .j-location { display:none; }
  .j-game .j-enemy {
    top:calc(var(--hud-top) + 55px); left:var(--hud-left); width:auto; min-width:130px;
    max-width:calc(100% - 100px - env(safe-area-inset-left) - env(safe-area-inset-right));
    padding:6px 10px; border-radius:7px 12px 12px 7px; border:1px solid #a5825e;
    border-left:3px solid #de9c76; background:var(--glass); box-shadow:var(--relief); pointer-events:none;
  }
  .j-game .j-wave-context { color:#f9d596; font-size:10px; line-height:1.15; margin:0 0 2px; }
  .j-game .j-enemy > strong { line-height:1.15; font-size:12px; margin-bottom:3px; }
  .j-game .j-enemy-trait, .j-game .j-status-effect { font-size:10px; margin:2px 0 0; }
  .j-game .j-enemy-xp { display:none; }
  .j-game .j-targets {
    position:absolute; z-index:2; top:calc(var(--hud-top) + 149px); left:var(--hud-left);
    display:flex; background:none; border:0; padding:0; gap:4px; pointer-events:none;
  }
  .j-game .j-target-label { display:none; }
  .j-game .j-target-options { display:flex; flex-wrap:nowrap; gap:2px; }
  .j-game .j-target {
    position:relative; display:grid; place-items:center; width:44px; min-height:44px; padding:0;
    background:none; border:none; pointer-events:auto;
  }
  .j-game .j-target-index {
    width:31px; height:31px; background:var(--glass); color:#fff6d9; border:1px solid #ae9770;
    box-shadow:var(--relief); font-size:12px;
  }
  .j-game .j-target[aria-pressed=true] .j-target-index { background:#fad48b; color:#392919; }
  .j-game .j-target-copy { display:none; }
  .j-game[data-scene="battle"] {
    --seal-size:clamp(44px,12.5vw,57px);
    --move-row:calc(var(--seal-size) + 42px);
    --move-gap:clamp(2px,.8vw,6px);
  }
  .j-game[data-scene="battle"] .j-world::after {
    background:linear-gradient(180deg,#07181c69,transparent 18%,transparent 60%,#1c29293b 79%,#101d24f2 100%);
  }
  .j-game .j-battle-actions {
    position:relative; width:100%; min-width:0; height:calc(var(--move-row) + 47px);
    display:flex; align-items:flex-end; justify-content:flex-end; gap:var(--move-gap);
  }
  .j-game .j-battle-row, .j-game .j-battle-row .j-combat-controls,
  .j-game .j-battle-skills, .j-game .j-skill-buttons { display:contents; }
  .j-game .j-skills-caption { display:none; }
  .j-game .j-turn {
    position:absolute; top:0; right:0; isolation:isolate; width:auto; min-height:44px;
    max-width:calc(100% - 115px); padding:3px 25px 3px 8px; border-radius:9px; background:none; box-shadow:none;
  }
  .j-game .j-turn::before {
    content:""; position:absolute; inset:8px 0; z-index:-1; background:#102525e6; border-radius:8px;
    box-shadow:0 1px 4px #1116;
  }
  .j-game .j-turn-details {
    position:absolute; inset:0; display:block; width:100%; height:100%; padding:0 6px 0 0;
    border:0; background:transparent; color:#ffdc8c; text-align:right; font-size:14px;
  }
  .j-game .j-turn > div { display:flex; align-items:baseline; gap:5px; flex-wrap:wrap; }
  .j-game .j-turn strong, .j-game .j-turn small { font-size:11px; }
  .j-game .j-turn p { display:none; }
  .j-game[data-scene="battle"] .j-mobile-auto {
    width:46px; height:44px; bottom:calc(var(--hud-bottom) + var(--move-row) + 3px);
  }
  .j-game .j-combat-controls [data-action="retreat"] {
    position:absolute; left:52px; top:0; min-height:44px; min-width:50px;
    display:flex; flex-direction:column; gap:2px; padding:3px 5px; font-size:10px;
  }
  .j-game .j-combat-controls [data-action="retreat"] .j-icon { width:17px; height:17px; }
  .j-game .j-actions .j-battle-actions [data-action="act"] {
    display:flex; flex-direction:column; align-items:center; justify-content:flex-start;
    flex:0 1 84px; width:auto; min-width:44px; height:var(--move-row); padding:3px 0 0; gap:5px;
    border:0; border-radius:12px; background:transparent; box-shadow:none;
    color:#fff1d3; text-align:center; white-space:normal; opacity:1;
    font-size:clamp(10px,2.8vw,12px); font-weight:750; line-height:1.08;
    text-shadow:0 1px 2px #10151a,0 0 4px #111923;
  }
  .j-game .j-battle-actions [data-action="act"] > :is(.j-icon,.j-skill-symbol) {
    --seal-rim:currentColor;
    position:relative; display:grid; place-items:center; flex:none; box-sizing:border-box;
    width:var(--seal-size); height:var(--seal-size); padding:6px;
    border-radius:50%; border:2px solid var(--seal-rim);
    background:radial-gradient(ellipse at 34% 20%,#576f70,#243d48 62%,#18242e);
    box-shadow:inset 0 0 0 2px #202b35,inset 0 0 0 3px #f7e4bc55,0 0 0 1.5px #372d31,0 3px 4px #142020aa;
  }
  .j-game .j-battle-actions [data-key="ataque"] > .j-icon {
    --seal-rim:#c5a477; background:radial-gradient(ellipse at 32% 20%,#8d724b,#533d32 68%,#362b2e);
  }
  .j-game .j-battle-actions [data-key="defesa"] > .j-icon {
    --seal-rim:#a6cbab; background:radial-gradient(ellipse at 32% 20%,#618980,#2e504c 68%,#213637);
  }
  .j-game .j-battle-actions .rpg-weapon-icon { width:100%; height:100%; transform:scale(1.20); }
  .j-game .j-battle-actions .j-skill-symbol:is([data-motion="strike"],[data-motion="guard"])::before {
    position:absolute; content:""; left:7%; right:7%; top:17%; bottom:18%; pointer-events:none;
    border-radius:50%; border-top:2px solid currentColor; border-left:1px solid transparent;
    transform:rotate(-35deg); opacity:.9;
  }
  .j-game .j-battle-actions .j-skill-symbol[data-motion="guard"]::before {
    inset:4% 8%; border-right:2px solid currentColor; border-top:2px solid transparent; transform:rotate(16deg);
  }
  .j-game .j-actions .j-battle-actions [data-action="act"]:is(.j-bold,.j-skill-chosen) > :is(.j-icon,.j-skill-symbol) {
    border-color:#ffdf7d; box-shadow:inset 0 0 0 2px #695631,inset 0 0 0 3px #ffedb58c,0 0 0 1.5px #663f29,0 0 9px #facb674d;
  }
  .j-game .j-battle-actions [data-cooling="true"] > .j-skill-symbol { background:#273438; border-color:#778889; }
  .j-game .j-battle-actions [data-cooling="true"] .j-skill-symbol svg { filter:grayscale(.86); opacity:.55; }
  .j-game .j-battle-actions [data-action="act"]:enabled:active > :is(.j-icon,.j-skill-symbol) { transform:translateY(2px); }
  .j-game .j-battle-actions .j-skill-symbol .j-icon { width:100%; height:100%; }
  .j-game .j-battle-actions .j-skill-copy { width:100%; }
  .j-game .j-battle-actions .j-skill-copy strong { font:inherit; line-height:1.08; text-wrap:balance; overflow-wrap:anywhere; }
  .j-game .j-skill-copy > span { display:none; }
  .j-game .j-touch-cooldown {
    display:grid; place-items:center; position:absolute; bottom:-2px; right:-3px; min-width:17px; height:17px; padding:0 3px;
    border-radius:50%; border:1px solid #beaf8d; background:#282b32; color:#fff1bd; font:800 11px/1 system-ui,sans-serif;
  }
  .j-game #j-notice:not(:empty) {
    position:absolute; bottom:calc(var(--hud-bottom) + 126px); left:var(--hud-left); right:var(--hud-right);
    z-index:3; margin:0 auto; width:fit-content; max-width:85%; padding:5px 9px;
    border-radius:8px; background:#192a2ce8; color:#fff0ce; line-height:1.25; font-size:11px; pointer-events:none;
  }
  .j-game:has(.j-skill-buttons) #j-notice:not(:empty) { bottom:calc(var(--hud-bottom) + 158px); }
  .j-game #j-dialog.j-dialog {
    position:fixed; inset:auto env(safe-area-inset-right) 0 env(safe-area-inset-left); margin:0 auto;
    max-width:calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height:calc(92dvh - env(safe-area-inset-top)); padding-bottom:env(safe-area-inset-bottom);
    border-radius:18px 18px 0 0; overscroll-behavior:contain;
  }
  .j-game .j-auto-settings { display:grid; gap:12px; }
  .j-auto-settings p { color:var(--j-muted); line-height:1.45; }
  .j-auto-settings label { color:var(--j-honey); font-weight:750; margin-bottom:-7px; }
  .j-auto-settings select { width:100%; min-height:44px; background:var(--j-deep); color:var(--j-ink); border:1px solid #799080; border-radius:7px; padding:7px; font:inherit; }
  .j-auto-settings #j-mobile-auto-switch { min-height:44px; }
  .j-game .j-auto-settings p:empty { display:none; }
  .j-game .j-tactics-detail { display:grid; gap:12px; }
  .j-tactics-detail p { color:var(--j-muted); line-height:1.45; }
}

@media (prefers-reduced-motion:reduce) {
  .j-joystick .j-stick-knob { transition:none; }
}

@media (orientation:landscape) and (max-height:550px) and (pointer:coarse) {
  .j-game .j-toolbar .j-tools .j-tool { right:calc(var(--hud-right) + var(--row)*60px); top:calc(var(--hud-top) + 48px); }
  .j-game[data-scene="battle"] { --seal-size:44px; --move-row:78px; }
  .j-game .j-battle-actions { height:var(--move-row); }
  .j-game .j-actions .j-battle-actions [data-action="act"] { flex-basis:min(11vw,76px); font-size:11px; }
  .j-game[data-scene="battle"] .j-mobile-auto { bottom:var(--hud-bottom); }
  .j-game .j-combat-controls [data-action="retreat"] { top:auto; bottom:0; }
  .j-game .j-turn { top:auto; bottom:46px; left:0; right:auto; max-width:33%; }
  .j-game .j-targets { top:auto; bottom:calc(var(--hud-bottom) + 56px); }
  .j-game[data-scene="town"] .j-mobile-auto { right:calc(var(--hud-right) + 180px); top:calc(var(--hud-top) + 48px); }
  .j-game[data-scene="result"] .j-actions { left:auto; max-width:65%; max-height:55%; }
  .j-game[data-scene="battle"] #j-notice:not(:empty) {
    left:var(--hud-left); right:auto; bottom:calc(var(--hud-bottom) + 94px);
    max-width:min(32%,250px); margin:0;
  }
}

#game-menu-button, .j-painted { display:none; }
.hud-art-library { position:absolute; width:0; height:0; overflow:hidden; pointer-events:none; }
#game-menu {
  color:#f8efd6; border:1px solid #ae945e; border-radius:16px; padding:0;
  background:linear-gradient(148deg,#314c4c,#172f36 56%,#13272e);
  box-shadow:inset 0 0 0 3px #31494c,0 14px 42px #091620a6;
  width:min(355px,calc(100% - 28px)); max-height:85vh; max-height:85dvh;
  overscroll-behavior:contain;
}
#game-menu::backdrop { background:#07191ed4; }
.game-menu-heading {
  display:flex; align-items:center; gap:9px; padding:11px 14px;
  border-bottom:1px solid #64715b;
}
.game-menu-heading h2 { font:800 21px/1.1 var(--sans); color:#ffe8b5; margin:0; flex:1; }
#game-menu-close { width:44px; height:44px; color:#fff0cb; background:#253d41; border-color:#56716b; }
#game-menu-body { padding:13px; }
#game-menu .topbar { display:grid; width:100%; gap:14px; }
#game-menu .brand, #game-menu .header-sep, #game-menu .session { display:none; }
#game-menu .main-nav, #game-menu .header-tools {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch;
  position:static; gap:6px; margin:0; padding:0; border:0; background:none; box-shadow:none;
}
#game-menu .topbar .main-nav:has(#roster-nav:not([hidden])) {
  position:static; inset:auto; display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px; margin:0; padding:0; background:none; border:0; box-shadow:none;
}
#game-menu .topbar .main-nav:has(#roster-nav:not([hidden])) .nav-item:not([hidden]) {
  flex-direction:row; align-items:center; justify-content:flex-start; gap:8px;
  padding:7px 9px; min-height:46px;
}
#game-menu .header-tools { border-top:1px solid #49605b; padding-top:12px; }
#game-menu .nav-label { display:inline; }
#game-menu .topbar button:not([hidden]) {
  position:relative; display:flex; flex-flow:row; align-items:center; justify-content:flex-start; gap:8px;
  width:100%; min-height:46px; height:auto; padding:7px 9px; text-align:left;
  color:#f4ead1; background:linear-gradient(#345152,#294449);
  border:1px solid #60756c; border-bottom-color:#3a504d; border-radius:8px;
  font:700 13px/1.2 var(--sans);
}
#game-menu .topbar .ui-icon { width:18px; height:18px; color:#edce88; flex:none; }
#game-menu #sound::after { content:"Som desligado"; }
#game-menu #sound[aria-pressed="true"]::after { content:"Som ligado"; }
#game-menu #friend-count,#game-menu #coop-count { top:1px; right:1px; }
#game-menu .site-footer {
  display:flex; flex-wrap:wrap; justify-content:space-between; width:100%; margin:11px 0 0;
  padding:9px 2px 0; color:#bdcfc6; border-top:1px solid #49605b; font-size:11px;
}
#game-menu .footer-divider {display:none;}
#game-menu #coop-return:not([hidden]) { width:100%; margin-top:10px; }
#game-menu .topbar button:active,#game-menu-close:active { background:#425e5a; }

@media (max-width:760px), (pointer:coarse) and (max-width:1024px) {
  html:has(#app .j-game), body:has(#app .j-game) { overflow:hidden; overscroll-behavior:none; }
  body:has(#app .j-game) { padding:0; min-height:0; }
  body:has(#app .j-game) > :is(.site-header,.site-footer,#coop-return) { display:none; }
  body:has(#app .j-game) #game-menu-button {
    position:fixed; display:grid; place-items:center; z-index:10;
    top:calc(env(safe-area-inset-top,0px) + 5px); right:calc(env(safe-area-inset-right,0px) + 7px);
    width:44px; height:44px; padding:3px; background:transparent; border:0; border-radius:10px;
    -webkit-tap-highlight-color:transparent;
  }
  #game-menu-button svg { width:35px; height:37px; filter:drop-shadow(0 2px 2px #192223ab); }
  #game-menu-button:active svg { transform:translateY(1px); }
  body:has(:is(#friend-count,#coop-count,#coop-return):not([hidden])) #game-menu-button::after {
    position:absolute; content:""; top:3px; right:2px; width:9px; height:9px; border-radius:50%;
    border:2px solid #4a301e; background:#ffc261;
  }
  body:has(#app .j-game) :is(.release-update,#afk-return) {
    position:fixed; z-index:14; left:50%; transform:translateX(-50%);
    width:min(410px,calc(100% - 24px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px)));
    top:calc(env(safe-area-inset-top,0px) + 108px); margin:0;
    box-shadow:0 4px 18px #142b2a8c;
  }
  body:has(#app .j-game):has(.release-update) #afk-return { top:calc(env(safe-area-inset-top,0px) + 175px); }
  .j-game :is(.j-tools,.j-map-pin,.j-actions-right,.j-combat-controls,.j-skill-symbol,.j-mobile-auto) .j-painted { display:inline; }
  .j-game :is(.j-tools,.j-map-pin,.j-actions-right,.j-combat-controls,.j-skill-symbol,.j-mobile-auto) .j-icon:has(.j-painted) .j-line-art { display:none; }
}

dialog.rpg-film {
  position:fixed; inset:0; box-sizing:border-box; width:100%; max-width:none;
  height:100%; height:100dvh; max-height:none; margin:0; padding:0; overflow:hidden;
  border:0; border-radius:0; background:#141c20; color:#fff7e2;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  isolation:isolate; overscroll-behavior:contain;
}
.rpg-film::backdrop { background:#11191d; }
.rpg-film-screen,.rpg-film-shade { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.rpg-film-screen { display:block; }
.rpg-film-shade {
  background:linear-gradient(180deg,rgba(10,18,21,.64),transparent 17%,transparent 43%,rgba(9,16,20,.34) 63%,rgba(8,15,19,.90) 94%,#0a1115),
             linear-gradient(90deg,rgba(10,18,22,.23),transparent 47%);
}
.rpg-film-header {
  position:absolute; inset:0 0 auto; display:flex; align-items:center; justify-content:space-between;
  gap:.65rem; padding:max(16px,env(safe-area-inset-top)) max(clamp(15px,4vw,64px),env(safe-area-inset-right))
  0 max(clamp(16px,5vw,80px),env(safe-area-inset-left));
}
.rpg-film-marker {
  font-size:clamp(.66rem,1.4vw,.82rem); font-weight:700; letter-spacing:.17em; text-transform:uppercase;
  color:#ffedbb; text-shadow:0 1px 5px #131713; line-height:1.4;
}
.rpg-film-marker::before {
  content:""; display:inline-block; width:.55em; height:.55em; margin-right:.8em; vertical-align:.12em;
  transform:rotate(45deg); border:1px solid #f3cc7c; box-shadow:0 0 0 3px #23302c55;
}
.rpg-film-controls { display:flex; align-items:center; gap:7px; flex:none; }
.rpg-film-controls button {
  display:inline-flex; height:44px; min-width:44px; align-items:center; justify-content:center;
  margin:0; padding:0; border:1px solid #fbebce96; border-radius:999px; box-shadow:none;
  background:#142025dc; color:#fff6de; text-shadow:none; font-family:inherit;
  -webkit-tap-highlight-color:transparent; touch-action:manipulation;
}
.rpg-film-controls button:focus-visible { outline:3px solid #ffe692; outline-offset:3px; }
.rpg-film-controls button:hover { background:#304342; color:white; }
.rpg-film-controls .rpg-film-skip { gap:9px; padding:0 16px; font-size:.87rem; font-weight:650; }
.rpg-film-skip::after {
  content:""; display:block; width:13px; height:12px; background:currentColor;
  clip-path:polygon(0 0,65% 46%,65% 0,83% 0,83% 100%,65% 100%,65% 54%,0 100%);
}
.rpg-film-pause::before { content:""; width:10px; height:13px; border-inline:3px solid currentColor; box-sizing:border-box; }
.rpg-film-pause[data-paused="true"]::before {
  border:0; width:11px; height:13px; background:currentColor; clip-path:polygon(0 0,100% 50%,0 100%);
}
.rpg-film-caption {
  position:absolute; right:0; bottom:0; left:0; margin:auto;
  padding:0 max(clamp(19px,6vw,96px),env(safe-area-inset-right)) max(clamp(24px,5.4vh,62px),calc(env(safe-area-inset-bottom) + 14px))
  max(clamp(19px,6vw,96px),env(safe-area-inset-left)); pointer-events:none;
}
.rpg-film .rpg-film-title {
  margin:0 0 .25em; max-width:28em; color:#fff1cf; text-shadow:0 2px 8px #131a1c;
  font:normal 500 clamp(1.6rem,3.8vw,3.1rem)/1.04 Georgia,"Times New Roman",serif; text-wrap:balance;
}
.rpg-film .rpg-film-line {
  min-height:2.75em; max-width:50ch; margin:0; color:#fff; font:500 clamp(1.03rem,1.82vw,1.4rem)/1.43 system-ui,-apple-system,"Segoe UI",sans-serif;
  text-shadow:0 1px 5px #131a1c; text-wrap:pretty;
}
.rpg-film-reel { display:flex; gap:5px; margin-top:13px; width:clamp(80px,15vw,165px); }
.rpg-film-segment { flex:1; height:3px; border-radius:2px; background:#e9dbb956; overflow:hidden; }
.rpg-film-fill { display:block; width:100%; height:100%; background:#f4d592; transform:scaleX(0); transform-origin:left; }
@media (max-aspect-ratio: 4/5) {
  .rpg-film-shade { background:linear-gradient(180deg,#101b2299,transparent 17%,transparent 50%,#111a2040 66%,#10191ee8 83%,#0e171c); }
  .rpg-film .rpg-film-title { font-size:clamp(1.45rem,6.6vw,2.5rem); max-width:23ch; }
  .rpg-film .rpg-film-line { min-height:3.85em; }
}
@media (max-height:500px) and (min-aspect-ratio:1/1) {
  .rpg-film-header { padding-top:max(5px,env(safe-area-inset-top)); }
  .rpg-film-caption { padding-bottom:max(9px,env(safe-area-inset-bottom)); }
  .rpg-film .rpg-film-title { font-size:clamp(1.2rem,3.2vw,1.75rem); }
  .rpg-film .rpg-film-line { font-size:1rem; line-height:1.25; min-height:1.25em; max-width:74ch; }
  .rpg-film-reel { margin-top:6px; }
}

.rpg-action-cutin {
  --cutin-accent:#ffcf76;
  --cutin-paint:#445863;
  --cutin-deep:#172632;
  position:absolute; inset:0; z-index:9; overflow:hidden; isolation:isolate;
  container-type:inline-size;
}
.rpg-action-cutin[data-kind="skill"] { --cutin-paint:#5e526c; --cutin-deep:#232237; }
.rpg-action-cutin[data-kind="guard"] { --cutin-accent:#a9efcf; --cutin-paint:#3b6c66; --cutin-deep:#142e31; }
.rpg-action-cutin[data-kind="boss"] { --cutin-accent:#ffba9c; --cutin-paint:#8f514d; --cutin-deep:#37242f; }
.j-game .rpg-action-cutin {
  inset:22% auto auto 50%; transform:translateX(-50%); width:min(64%,250px); height:66px;
}
.j-game .rpg-cutin-banner { height:54px; }
.j-game .rpg-cutin-copy { left:37%; right:5%; }
.j-game .rpg-cutin-title { font-size:clamp(13px,6.2cqw,17px); }
.j-game .rpg-cutin-name { font-size:9px; }
.j-game .rpg-cutin-weapon { width:22px; left:25%; bottom:14%; }
.j-game .rpg-cutin-skip::before, .j-game .rpg-cutin-hint { display:none; }
#coop-content .rpg-action-cutin .rpg-cutin-skip,
.rpg-action-cutin .rpg-cutin-skip {
  position:absolute; inset:0; box-sizing:border-box; width:100%; height:100%; display:grid; place-items:center;
  margin:0; padding:0; border:0; border-radius:0; min-height:0; max-width:none;
  background:transparent; box-shadow:none; cursor:pointer; text-align:left;
  font-family:inherit; -webkit-tap-highlight-color:transparent; touch-action:manipulation; user-select:none;
}
#coop-content .rpg-action-cutin .rpg-cutin-skip:hover:enabled,
#coop-content .rpg-action-cutin .rpg-cutin-skip:focus-visible { background:transparent; }
.rpg-cutin-hint {
  position:absolute; z-index:2; top:calc(50% + min(14.5cqw,105.5px) + 2px);
  right:max(calc((100% - 880px)/2 + 16px),16px,env(safe-area-inset-right));
  display:flex; align-items:center; gap:5px; padding:3px 7px;
  color:#fff4da; border:1px solid #ccb58766; border-radius:3px; background:#1c2829cf;
  font:650 10px/1.1 system-ui,sans-serif;
  animation:rpg-cutin-dim var(--cutin-time) linear both;
}
.rpg-cutin-hint::after {
  content:""; display:block; width:8px; height:7px; background:currentColor;
  clip-path:polygon(0 0,68% 43%,68% 0,90% 0,90% 100%,68% 100%,68% 57%,0 100%);
}
.rpg-cutin-skip::before {
  position:absolute; inset:0; content:""; pointer-events:none;
  background:linear-gradient(180deg,#17172219,#161d2a59 50%,#131e201c);
  animation:rpg-cutin-dim var(--cutin-time) linear both;
}
.rpg-cutin-banner {
  position:relative; display:block; width:min(100%,880px); height:clamp(134px,29cqw,211px);
  background:var(--cutin-accent); isolation:isolate;
  clip-path:polygon(0 10%,100% 0,100% 88%,0 100%);
  animation:rpg-cutin-reveal var(--cutin-time) cubic-bezier(.22,.80,.23,1) both;
}
.rpg-action-cutin[data-kind="boss"] .rpg-cutin-banner { animation-name:rpg-cutin-counter; }
.rpg-cutin-plate {
  position:absolute; inset:3px 0; display:block; overflow:hidden; isolation:isolate;
  clip-path:polygon(0 10%,100% 0,100% 88%,0 100%);
  background:
    radial-gradient(ellipse at 18% 54%,#fff2 0%,transparent 38%),
    linear-gradient(106deg,var(--cutin-paint) 4%,var(--cutin-deep) 53%,#13232c 100%);
}
.rpg-cutin-plate::before, .rpg-cutin-plate::after {
  content:""; position:absolute; inset:0; pointer-events:none;
}
.rpg-cutin-plate::before {
  opacity:.56; background:var(--cutin-accent);
  clip-path:polygon(0 22%,27% 16%,2% 26%,42% 18%,8% 30%,22% 28%,0 36%,0 73%,35% 64%,3% 76%,29% 71%,0 83%);
}
.rpg-cutin-plate::after {
  opacity:.38; background:var(--cutin-accent);
  clip-path:polygon(100% 12%,100% 19%,74% 25%,98% 18%,88% 19%,100% 15%,100% 66%,77% 74%,98% 70%,85% 78%,100% 72%);
}
.rpg-action-cutin[data-kind="boss"] .rpg-cutin-plate {
  background:radial-gradient(ellipse at 83% 63%,#ffbd752c,transparent 44%),
    linear-gradient(107deg,#281e2a 9%,var(--cutin-deep) 43%,var(--cutin-paint) 98%);
}
.rpg-cutin-face {
  position:absolute; left:0; bottom:0; height:99%; width:45%; display:block;
}
.rpg-cutin-face::before {
  content:""; position:absolute; width:81%; height:130%; left:0; top:-15%;
  transform:skewX(-19deg); border-right:1px solid #ffe6b977;
  background:linear-gradient(90deg,transparent 46%,#ffeaba17);
}
.rpg-cutin-portrait {
  position:absolute; left:2%; top:-3%; width:100%; max-width:none; height:128%;
  object-fit:cover; object-position:50% 10%;
  filter:hue-rotate(var(--cutin-hue,0deg)) drop-shadow(3px 2px 0 #17202b9c);
  animation:rpg-cutin-portrait var(--cutin-time) cubic-bezier(.18,.72,.26,1) both;
}
.rpg-action-cutin[data-kind="guard"] .rpg-cutin-portrait { animation-name:rpg-cutin-brace; }
.rpg-action-cutin[data-kind="boss"] .rpg-cutin-face { left:auto; right:0; width:47%; }
.rpg-action-cutin[data-kind="boss"] .rpg-cutin-face::before { left:auto; right:0; transform:scaleX(-1) skewX(-19deg); }
.rpg-action-cutin[data-kind="boss"] .rpg-cutin-portrait {
  left:auto; right:3%; height:109%; top:-1%; object-position:27% 15%;
  animation-name:rpg-cutin-foe;
}
.rpg-cutin-copy {
  position:absolute; z-index:1; left:45%; right:max(4.3%,env(safe-area-inset-right)); top:48%;
  display:flex; flex-direction:column; align-items:flex-start; transform:translateY(-50%);
}
.rpg-action-cutin[data-kind="boss"] .rpg-cutin-copy { left:max(6%,env(safe-area-inset-left)); right:47%; }
.rpg-cutin-name {
  font-size:clamp(10px,2.9cqw,15px); line-height:1.1; font-weight:750; letter-spacing:.06em;
  margin-bottom:.3em; color:var(--cutin-accent); overflow-wrap:anywhere;
}
.rpg-cutin-title {
  position:relative; display:block; max-width:100%; color:#fff6dd;
  font:bold italic clamp(20px,6.4cqw,43px)/.99 Georgia,"Times New Roman",serif;
  letter-spacing:-.035em; text-shadow:0 2px #24202a; text-wrap:balance; overflow-wrap:anywhere;
}
.rpg-cutin-cue { color:#fff1d8; font-size:clamp(10px,2.6cqw,14px); line-height:1.15; margin-top:4px; }
.rpg-cutin-weapon {
  position:absolute; z-index:2; bottom:14%; left:35%; width:clamp(32px,8cqw,61px); aspect-ratio:1;
  display:grid; place-items:center; border-radius:50%; border:1px solid #f9daa1;
  background:radial-gradient(ellipse at 30% 20%,#586664,#1d2d33 85%);
  box-shadow:0 2px 0 #27212a,0 0 0 3px #202a2bbd;
}
.rpg-cutin-weapon svg { width:89%; height:89%; }
.rpg-action-cutin .rpg-cutin-skip:focus-visible { outline:2px solid var(--cutin-accent); outline-offset:-4px; }
@container (min-width:640px) {
  .rpg-cutin-face { left:4%; width:38%; }
  .rpg-cutin-portrait { top:0; height:117%; }
  .rpg-cutin-name { letter-spacing:.10em; }
  .rpg-cutin-banner { height:clamp(150px,22cqw,211px); }
}
@keyframes rpg-cutin-dim {
  0%,100% { opacity:0; } 18%,78% { opacity:1; }
}
@keyframes rpg-cutin-reveal {
  0% { clip-path:polygon(0 48%,0 48%,0 51%,0 52%); }
  19%,79% { clip-path:polygon(0 10%,100% 0,100% 88%,0 100%); }
  100% { clip-path:polygon(100% 44%,100% 43%,100% 47%,100% 48%); }
}
@keyframes rpg-cutin-counter {
  0% { clip-path:polygon(100% 44%,100% 43%,100% 47%,100% 48%); }
  19%,79% { clip-path:polygon(0 10%,100% 0,100% 88%,0 100%); }
  100% { clip-path:polygon(0 48%,0 48%,0 51%,0 52%); }
}
@keyframes rpg-cutin-portrait {
  0% { transform:translateX(-28%) scale(1.13); } 23% { transform:translateX(0) scale(1.02); }
  83%,100% { transform:translateX(2%) scale(1.07); }
}
@keyframes rpg-cutin-brace {
  0% { transform:translate(-4%,12%); } 25% { transform:translate(1%,0); }
  83%,100% { transform:translate(0,-1%) scale(1.04); }
}
@keyframes rpg-cutin-foe {
  0% { transform:translateX(30%) scale(.96); } 24% { transform:translateX(0) scale(1.02); }
  83%,100% { transform:translateX(-4%) scale(1.08); }
}
@media (prefers-reduced-motion:reduce) {
  .rpg-action-cutin[data-kind] .rpg-cutin-banner, .rpg-action-cutin[data-kind] .rpg-cutin-portrait,
  .rpg-cutin-hint, .rpg-cutin-skip::before { animation:none; }
}

.turn-order {
  display:flex; align-items:center; width:max-content; max-width:100%; gap:2px;
  padding:2px 5px; border:1px solid #887752; border-radius:10px;
  background:linear-gradient(165deg,#253d3dea,#14282af2); color:#fff1d5;
  box-shadow:inset 0 1px #f4dcab24,0 2px 4px #15232266;
  font-family:inherit; pointer-events:none;
}
.turn-order[hidden] { display:none !important; }
.turn-order .turn-label {
  padding:0 3px; color:#eacc98; font-size:10px; font-weight:750; line-height:1;
}
.turn-order .turn-arrow { color:#c4af83; font:700 18px/1 Georgia,serif; }
.turn-order .turn-slot {
  --rim:#8ba9a3;
  position:relative; display:grid; place-items:center; width:40px; height:40px;
  flex:none; border:0; padding:0; background:transparent; color:#ffebc4;
  box-shadow:none; isolation:isolate;
}
.turn-order button.turn-slot { pointer-events:auto; touch-action:manipulation; cursor:pointer; }
.turn-order .turn-slot img {
  box-sizing:border-box; display:block; width:33px; height:33px; border-radius:50%; border:1px solid var(--rim);
  background:radial-gradient(ellipse at 40% 30%,#93977a,#334b4b 80%);
  box-shadow:0 0 0 2px #16282a; object-fit:cover; object-position:center 25%;
}
.turn-order .turn-foe { --rim:#b68c77; }
.turn-order .turn-foe img { background:radial-gradient(ellipse at 45% 32%,#a28f74,#514642 80%); object-fit:contain; }
.turn-order .turn-slot[aria-pressed="true"] img { border:2px solid #ffda82; box-shadow:0 0 0 2px #84602f; }
.turn-number {
  position:absolute; bottom:1px; right:0; padding:1px 4px; border-radius:7px;
  color:#ffefd3; background:#42382f; border:1px solid #b29772; font:750 9px/1.05 system-ui,sans-serif;
}
.turn-slot[aria-pressed="true"] .turn-number { background:#ffda82; color:#3b2817; }
.turn-life {
  position:absolute; left:5px; right:5px; bottom:1px; height:4px; border:1px solid #202a25;
  border-radius:3px; background:#131d1b; overflow:hidden;
}
.turn-foe .turn-life { right:12px; }
.turn-life i { display:block; height:100%; background:#92c2a2; }
.turn-foe .turn-life i { background:#e5a987; }
.turn-slot[aria-current="step"]::after {
  content:""; position:absolute; top:-1px; left:50%; width:10px; height:6px;
  transform:translateX(-50%); clip-path:polygon(0 0,100% 0,50% 100%); background:#a9f3dc;
}
.turn-slot[aria-current="step"] img { outline:2px solid #89d3bc; outline-offset:1px; }
.j-game .turn-order button:disabled { opacity:1; cursor:default; }
.turn-order .turn-down img { opacity:.42; }
.j-encounter-hud { display:contents; }
.j-game:is([data-scene="battle"],[data-scene="result"]) .j-world::before {
  content:""; position:absolute; z-index:1; inset:0 0 auto; height:97px; pointer-events:none;
  background:linear-gradient(180deg,#071b24db,#0a20297a 65%,transparent);
}
.j-game:is([data-scene="battle"],[data-scene="result"]) .j-vitals-wrap {
  position:absolute; z-index:3; inset:10px auto auto 14px; display:grid; align-items:center;
  grid-template-columns:minmax(0,1fr) auto; gap:2px 10px; width:min(355px,calc(100% - 32px));
  padding:0; background:none; color:#fff4d9; text-shadow:0 1px 3px #06151e,0 1px 1px #06151e;
}
.j-game:is([data-scene="battle"],[data-scene="result"]) .j-player-hud {
  grid-area:1 / 1; position:relative; inset:auto; display:flex; width:auto; max-width:none; min-width:0;
  min-height:44px; gap:8px; padding:0; border:0; border-radius:0; background:none; box-shadow:none;
}
.j-game:is([data-scene="battle"],[data-scene="result"]) .j-avatar {
  box-sizing:border-box; width:37px; height:37px; border-radius:50%; border:2px solid #b3b098;
  box-shadow:0 0 0 1px #102a30,0 2px 4px #0b1d26a6;
}
.j-player-hud[aria-current="step"] .j-avatar { outline:2px solid #96e4ce; outline-offset:1px; }
.j-player-hud[aria-current="step"]::before {
  content:""; position:absolute; top:-2px; left:14px; width:9px; height:5px; z-index:1;
  clip-path:polygon(0 0,100% 0,50% 100%); background:#adf4db;
}
.j-game:is([data-scene="battle"],[data-scene="result"]) #j-vitals {
  display:grid; gap:3px; flex:1; width:auto; max-width:158px; min-width:0; overflow:visible;
}
.j-fighter-name strong, .j-target-summary strong { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.j-fighter-name strong { font-size:14px; font-weight:800; line-height:1.1; }
.j-fighter-rank {
  position:absolute; left:24px; bottom:1px; border:1px solid #bf9c65; border-radius:5px;
  padding:0 3px; font:750 9px/1.3 system-ui,sans-serif; color:#ffe1a1; background:#293433; text-shadow:none;
}
.j-game #j-vitals .j-fighter-hp { font-size:10px; font-weight:700; line-height:1; color:#e4eddf; }
.j-game:is([data-scene="battle"],[data-scene="result"]) #j-vitals .j-hp {
  height:6px; flex:none; background:#122127; border-color:#567266;
}
.j-encounter-caption {
  grid-area:2 / 1 / auto / -1; display:flex; align-items:baseline; justify-content:space-between;
  gap:8px; min-width:0; font-size:11px; line-height:1.35; pointer-events:none;
}
.j-encounter-caption[hidden], .j-game[data-scene="result"] .j-target-summary { display:none; }
.j-stage-summary { flex:none; white-space:nowrap; font-weight:700; color:#e2d2ab; }
.j-target-summary { display:flex; align-items:center; justify-content:flex-end; gap:5px; min-width:0; }
.j-target-summary .j-icon { width:12px; height:12px; flex:none; color:#f7cc75; }
.j-target-summary strong { font-size:inherit; font-weight:700; color:#ffedd4; }
.j-target-summary small { white-space:nowrap; flex:none; font-size:10px; font-weight:650; color:#f8cfb3; }
.j-game #j-targets {
  grid-area:1 / 2; justify-self:end; margin:0; padding:0; gap:0;
  border:0; box-shadow:none; background:none; text-shadow:none;
}
.j-game #j-targets :is(.turn-label,.turn-arrow) { display:none; }
.j-game #j-targets .turn-slot { width:44px; height:44px; }
.j-game:is([data-scene="battle"],[data-scene="result"]) #j-level-rise { top:calc(100% + 20px); }

@media (max-width:760px), (pointer:coarse) and (max-width:1024px) {
  .j-game:is([data-scene="battle"],[data-scene="result"]) .j-vitals-wrap {
    inset:var(--hud-top) auto auto var(--hud-left);
    width:min(355px,calc(100% - var(--hud-left) - var(--hud-right) - 53px));
    gap:2px 7px;
  }
  .j-game:is([data-scene="battle"],[data-scene="result"]) .j-toolbar .j-purse { display:none; }
  .turn-order button.turn-slot { min-height:44px; width:44px; }
  .turn-order .turn-ally { width:33px; }
  .turn-order .turn-ally img { width:29px; height:29px; }
  .turn-order .turn-number { right:2px; bottom:2px; }
}
@media (orientation:landscape) and (max-height:550px) and (pointer:coarse) {
  .j-game[data-scene="battle"] .j-toolbar .j-tools .j-tool {
    right:var(--hud-right); top:calc(var(--hud-top) + 48px + var(--row)*51px);
  }
}

#j-auto-controls {
  display:inline-flex; align-items:center; flex:none; gap:3px; margin-left:auto;
  color:#fff2d3; font-family:inherit;
}
#j-auto-controls button {
  box-sizing:border-box; display:inline-flex; flex-direction:column; align-items:center; justify-content:center;
  gap:1px; min-width:44px; height:44px; padding:2px 5px; touch-action:manipulation;
  border:1px solid #92805e; border-radius:9px; color:inherit;
  background:linear-gradient(150deg,#294142ee,#162b2def);
  box-shadow:inset 0 1px #e8d3ab24,0 2px 4px #14232360;
  font-family:inherit; font-size:11px; font-weight:700; line-height:1.1;
}
#j-auto-controls [hidden] { display:none; }
#j-auto-controls button:enabled:hover { border-color:#d4bb86; }
#j-auto-controls button:enabled:active { transform:translateY(1px); }
#j-auto-controls button:disabled { opacity:.86; color:#c2c7bd; border-color:#6a7468; }
#j-auto-controls small { font-size:9px; line-height:1.1; font-weight:650; color:#c9ceb9; }
#j-auto-controls :is(#j-auto,#j-auto-mode) {
  position:relative; width:46px; padding:2px 0; gap:0; color:#ffe7ab;
  background:var(--glass,linear-gradient(150deg,#263d3bf2,#132526ed));
  border:1px solid var(--bronze,#b39460); border-radius:12px;
  box-shadow:var(--relief,inset 0 1px #ffe6b93d,0 2px #251e19dc,0 3px 7px #10191c68);
}
#j-auto > .j-icon, #j-auto-mode .j-mode-symbol .j-icon { width:22px; height:22px; }
#j-auto-controls :is(#j-auto,#j-auto-mode) .j-painted { display:inline; }
#j-auto-controls :is(#j-auto,#j-auto-mode) .j-line-art { display:none; }
#j-auto > span, #j-auto-mode .j-mode-label { font-size:11px; font-weight:800; line-height:1.15; }
#j-auto::after {
  content:""; position:absolute; top:4px; right:4px; width:6px; height:6px;
  border-radius:50%; background:#89978c; box-shadow:0 0 0 1px #142322;
}
#j-auto-controls #j-auto[aria-pressed="true"] { border-color:#adce8a; }
#j-auto[aria-pressed="true"]::after { background:#a9eb7c; box-shadow:0 0 5px #a8e775; }
#j-auto[data-state="paused"]::after { background:#edc477; box-shadow:0 0 4px #c09758; }
#j-auto[data-state="off"] small, #j-auto[data-state="on"] small {
  position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap;
}
#j-auto:is([data-state="locked"],[data-state="paused"]) > .j-icon { height:15px; }

#j-auto-mode .j-mode-symbol { display:flex; }
#j-auto-mode[data-mode="repeat"] .j-mode-symbol > :last-child,
#j-auto-mode[data-mode="advance"] .j-mode-symbol > :first-child { display:none; }
#j-auto-mode .j-mode-mark {
  display:grid; place-items:center; position:absolute; top:3px; right:3px;
  width:10px; height:10px; border-radius:50%; color:#332e20; background:#e2c589;
  box-shadow:0 0 0 1px #193031;
}
#j-auto-mode .j-mode-mark .j-icon { width:8px; height:8px; stroke-width:3.3; }
#j-auto[data-state="on"] + #j-auto-mode .j-mode-mark { color:#17352a; background:#adf19c; }
#j-auto-speed span { font-size:15px; font-variant-numeric:tabular-nums; }

@media (max-width:760px), (pointer:coarse) and (max-width:1024px) {
  #j-auto-controls { position:absolute; z-index:3; left:var(--hud-left); bottom:var(--hud-bottom); margin:0; }
  .j-game[data-scene="battle"] #j-auto-controls { bottom:calc(var(--hud-bottom) + var(--move-row) + 3px); }
  .j-game[data-scene="result"]:has(#j-auto-controls:not([hidden])) .j-actions { bottom:calc(var(--hud-bottom) + 51px); }
}
@media (orientation:landscape) and (max-height:550px) and (pointer:coarse) {
  .j-game[data-scene="result"]:has(#j-auto-controls:not([hidden])) .j-actions {
    bottom:var(--hud-bottom);
    max-width:min(65%,calc(100% - var(--hud-left) - var(--hud-right) - 150px));
  }
}
@media (orientation:landscape) and (max-height:550px) and (max-width:479px) and (pointer:coarse) {
  .j-game[data-scene="result"]:has(#j-auto-controls:not([hidden])) .j-actions { bottom:calc(var(--hud-bottom) + 51px); max-width:80%; }
}
@media (max-width:359px) {
  .j-game .j-battle-tools button.j-round-record { width:46px; padding-inline:1px; }
  .j-game .j-battle-tools button.j-round-record strong { font-size:11px; }
  .j-game .j-battle-tools .j-round-record > .j-icon { display:none; }
}
@media (orientation:landscape) and (max-height:550px) and (min-width:560px) and (pointer:coarse) {
  .j-game[data-scene="battle"] #j-auto-controls { bottom:var(--hud-bottom); }
}

.j-battle-tools { display:flex; align-items:center; gap:8px; }
.j-game .j-round-record {
  display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:44px;
  background:none; border:0; color:#ffedc9; padding:2px 7px; cursor:pointer;
}
.j-round-record > span { display:grid; gap:1px; text-align:left; }
.j-round-record strong { font:750 12px/1.15 var(--sans); }
.j-round-record small { font:600 10px/1.1 var(--sans); color:#d7c9a9; }
.j-round-record .j-icon { width:16px; height:16px; color:#e3c282; }

.j-record { display:grid; gap:16px; }
.j-record section > h3 { margin:0 0 8px; color:var(--j-honey); }
.j-record details > summary { cursor:pointer; padding:10px 0; font-weight:700; min-height:42px; }
.j-record-target, .j-record-wave { border-bottom:1px solid #5a7068; }
.j-record-target p { padding:0 0 6px 12px; font-size:13px; }
.j-record-wave > summary small { margin-left:4px; font-size:11px; color:var(--j-honey); }
.j-record-turns { list-style:none; margin:0; padding:0; }
.j-record-turns > li { border-bottom:1px solid #64817a55; }
.j-record-turns > li:last-child { border:0; }
.j-record-turns summary { font-size:13px; }
.j-record-turns ul { margin:0; padding:0 6px 10px 24px; font-size:13px; line-height:1.5; }
.j-record-turns ul li + li { margin-top:4px; }
.j-game .j-record > button { justify-self:start; }
#game-menu .battle-menu-actions { display:none; }

@media (max-width:760px), (pointer:coarse) and (max-width:1024px) {
  .j-game[data-scene="battle"] .j-toolbar .j-tools .j-tool { display:none; }
  body:has(.j-game[data-scene="battle"]) #game-menu .battle-menu-actions {
    display:flex; gap:8px; margin:12px 13px 0;
  }
  .battle-menu-actions button {
    flex:1; min-height:44px; color:#fff2d5; background:#294449;
    border:1px solid #73897a; border-radius:8px; font:700 13px var(--sans);
  }
  .j-game .j-battle-tools {
    position:absolute; top:0; right:0; gap:3px; min-height:44px; pointer-events:none;
  }
  .j-game .j-battle-tools button { pointer-events:auto; touch-action:manipulation; }
  .j-game .j-battle-tools .j-round-record, .j-game .j-battle-tools [data-action="retreat"] {
    display:flex; align-items:center; justify-content:center; min-height:44px; min-width:44px;
    border:1px solid #b0986b80; border-radius:9px; background:#172b2cdb; box-shadow:none;
    color:#ffedc9; padding:2px 5px; line-height:1.1;
  }
  .j-game .j-battle-tools [data-action="retreat"] { flex-direction:column; gap:2px; font-size:10px; }
  .j-battle-tools [data-action="retreat"] .j-icon { width:15px; height:15px; }
}
@media (orientation:landscape) and (max-height:550px) and (min-width:480px) and (pointer:coarse) {
  .j-game .j-battle-tools { top:auto; bottom:calc(100% + 3px); }
}

.pilot-entry{display:inline-flex;align-items:center;min-height:44px;margin:8px 0;color:#236252;font-weight:700;text-decoration:underline;text-underline-offset:3px}
html:has(.pilot-scene),body:has(.pilot-scene){height:100%;margin:0;overflow:hidden;background:#152d2b}
body:has(.pilot-scene)>:not(.pilot-scene):not(svg):not(script){display:none!important}
.pilot-scene{--cream:#fff4d2;--gold:#ebc172;--green:#173b38;position:fixed;inset:0;isolation:isolate;height:100dvh;color:var(--cream);background:#1b3531;font:600 14px/1.35 system-ui,sans-serif;overscroll-behavior:none;user-select:none}
.pilot-scene *{box-sizing:border-box}
.pilot-scene [hidden]{display:none!important}
.pilot-view{position:absolute;inset:0;width:100%;height:100%;touch-action:none}
.pilot-scene:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,#101f30a6,transparent 22%,transparent 71%,#081c27a6);pointer-events:none;z-index:0}
.pilot-top,.pilot-bottom,.pilot-sheet,.pilot-health,.pilot-track,.pilot-ready{position:absolute;z-index:1}
.pilot-top{top:max(14px,env(safe-area-inset-top));left:max(15px,env(safe-area-inset-left));right:max(15px,env(safe-area-inset-right));display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
.pilot-top small,.pilot-sheet small,.pilot-track small{display:block;letter-spacing:.13em;text-transform:uppercase;font-size:10px;font-weight:800;color:#f4dca7}
.pilot-top h1{font:700 clamp(21px,5.5vw,32px)/1.1 Georgia,serif;color:#fff9e6;margin:3px 0 0;text-shadow:0 2px 5px #081b20}
.pilot-scene button,.pilot-scene a.pilot-back{appearance:none;cursor:pointer;touch-action:manipulation;min-height:44px;background:#193631ed;border:1px solid #cad7bb88;border-radius:10px;color:var(--cream);font:700 13px/1.15 system-ui,sans-serif;padding:9px 13px;text-align:center;box-shadow:0 2px 7px #06191766}
.pilot-scene button:focus-visible,.pilot-back:focus-visible{outline:3px solid #fff3a4;outline-offset:3px}
.pilot-scene button:disabled{opacity:.55;cursor:default}
.pilot-scene button[aria-pressed=true]{border-color:#f1ca75;background:#385447;box-shadow:inset 0 -3px #e9bb69}
.pilot-scene button.primary{background:#f0cd82;color:#30291c;border-color:#ffe7ae}
.pilot-scene svg{height:23px;width:23px;vertical-align:middle;flex:none}
.pilot-top button{border-radius:50%;width:44px;padding:8px}
.pilot-top .menu-mark{display:block;position:relative;width:17px;height:12px;border-block:2px solid #f6ddb0;margin:auto}
.pilot-top .menu-mark:before{content:"";height:2px;background:#f6ddb0;position:absolute;left:0;right:0;top:3px}
.pilot-bottom{left:max(14px,env(safe-area-inset-left));right:max(14px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));display:flex;align-items:flex-end;justify-content:space-between;gap:12px;pointer-events:none}
.pilot-bottom>*{pointer-events:auto}
.pilot-stick{position:relative;width:94px;height:94px;border:2px solid #f4e5bd77;border-radius:50%;background:radial-gradient(circle,#20312f80 44%,#122e2bb0 66%,#f6e3ac55 68%,#18322cb0 71%);touch-action:none}
.pilot-stick .j-stick-knob{position:absolute;inset:0;margin:auto;width:42px;height:42px;border:2px solid #d8caa3;border-radius:50%;background:radial-gradient(at 40% 30%,#87927b,#40584c);box-shadow:0 3px 7px #06191780}
.pilot-controls{display:flex;gap:8px;align-items:flex-end;justify-content:flex-end;max-width:72%}
.pilot-controls button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:62px;min-height:58px;font-size:11px}
.pilot-sheet{bottom:max(12px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:min(460px,calc(100% - 22px));max-height:53dvh;overflow:auto;border-radius:16px;border:1px solid #9f9774;background:linear-gradient(135deg,#213f39fa,#132d2dfb);padding:15px;box-shadow:0 7px 25px #0c171a80}
.pilot-sheet h2{font:700 21px/1.15 Georgia,serif;color:#fff0c9;margin:3px 0 8px}
.pilot-sheet p{margin:5px 0 12px;color:#f0eddf;font-size:14px;line-height:1.44}
.pilot-row{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.pilot-row+.pilot-row,.pilot-kit+.pilot-row{margin-top:9px}
.pilot-sheet button{min-height:44px;font-size:12px}
.pilot-sheet .pilot-close{position:absolute;top:8px;right:9px;width:38px;padding:0;border-color:transparent;background:transparent;box-shadow:none;font-size:21px}
.pilot-kit{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:8px 0}
.pilot-kit button{display:flex;gap:5px;align-items:center;justify-content:center}
.pilot-kit [data-p=guard-kit]{grid-column:1/-1}
.pilot-scene a.pilot-back{display:inline-flex;align-items:center;text-decoration:none}
.pilot-health{left:max(15px,env(safe-area-inset-left));top:max(79px,calc(env(safe-area-inset-top) + 65px));border-radius:8px;background:#142c2fdc;padding:7px 12px;font-size:12px}
.pilot-health meter{display:block;margin-top:3px;width:94px;height:9px;accent-color:#96ce89}
.pilot-track{left:50%;transform:translateX(-50%);bottom:max(16px,env(safe-area-inset-bottom));width:min(440px,calc(100% - 24px));padding:11px 13px;background:#153532ed;border:1px solid #a2ad8d;border-radius:12px}
.pilot-track .pilot-row{flex-wrap:nowrap;justify-content:space-between;margin-top:6px}
.pilot-track button{font-size:12px;min-height:44px;padding:6px 10px}
.pilot-clock{display:flex;gap:8px;align-items:center;justify-content:space-between}
.pilot-clock button{min-width:72px;border:0;background:transparent;box-shadow:none;padding:3px 0;text-align:right}
.pilot-track input[type=range]{width:100%;height:28px;display:block;margin:3px 0 -4px;accent-color:#edc16c;touch-action:pan-y}
.pilot-ready{left:50%;top:51%;transform:translate(-50%,-50%);padding:10px 14px;background:#16362fea;border-radius:10px;font-size:14px}
.pilot-fps{color:#afc7b6;font-size:12px}
@media(min-width:760px){.pilot-bottom{left:max(24px,calc((100vw - 920px)/2));right:max(24px,calc((100vw - 920px)/2))}.pilot-top{left:24px;right:24px}.pilot-top h1{font-size:29px}}
@media(max-height:480px){.pilot-sheet{left:auto;right:12px;transform:none;width:min(42%,390px);max-height:72dvh}.pilot-top h1{font-size:22px}.pilot-stick{width:72px;height:72px}.pilot-bottom{bottom:8px}}

.helmet-pilot{box-sizing:border-box;width:min(94%,540px);max-height:90vh;max-height:90dvh;overflow:auto;padding:14px;border:1px solid #9b976f;border-radius:12px;background:#1a3738;color:#fff0cc;font:600 14px system-ui,sans-serif}
.helmet-pilot::backdrop{background:#102121d9}
.helmet-pilot header,.helmet-controls{display:flex;align-items:center;justify-content:space-between;gap:8px}
.helmet-pilot h2{font-size:19px;margin:0}
.helmet-legend{display:grid;grid-template-columns:repeat(3,1fr);margin-top:12px;text-align:center}
.helmet-grid{position:relative;margin:6px 0 12px}
.helmet-grid canvas{width:100%;height:auto;aspect-ratio:1;display:block}
.helmet-grid>span{position:absolute;left:4px;top:3px;color:#e0ecdb;font-size:11px}
.helmet-grid>span:nth-of-type(2){top:calc(33.3333% + 3px)}
.helmet-grid>span:last-child{top:calc(66.6667% + 3px)}
.helmet-pilot button,.helmet-pilot select{min-height:44px;padding:5px 10px;border:1px solid #7c9284;border-radius:6px;background:#263f40;color:inherit;font:inherit}
.helmet-pilot [data-wear]{width:100%;margin-top:8px;background:#f0cc84;color:#30291b;border-color:#f5d89d}
.helmet-controls{display:grid;grid-template-columns:minmax(0,1fr) auto auto}
.helmet-controls>label{display:flex;align-items:center;gap:3px}
@media(max-width:420px){.helmet-pilot .helmet-controls button,.helmet-pilot .helmet-controls select{font-size:12px;padding:4px 6px}.helmet-controls{gap:5px}}
.helmet-pilot [data-views]{margin:6px 0;color:#d5dfcf;font-size:12px;line-height:1.35}
.helmet-controls button[aria-pressed=true]{border-color:#f0cc84}

.codex-history{display:grid;gap:16px;max-width:780px;margin:0 auto;text-align:left}
.codex-history p{line-height:1.6;margin:10px 0;color:var(--paper-ink,#193938)}
.codex-history small{display:block;color:var(--paper-muted,#506463);line-height:1.5}
.codex-history .history-intro,.codex-history .history-chapter,.codex-history .history-navigation{border:1px solid #bbac83;border-radius:13px;padding:16px;background:#fffaf0}
.codex-history summary{cursor:pointer;font-weight:700;line-height:1.5;min-height:28px}
.codex-history details[open]>summary{margin-bottom:12px}
.codex-history h3{margin:5px 0 10px;font-size:1.3rem;color:#193938}
.codex-history h4{font-size:1.05rem;margin:18px 0 7px;color:#304e45}
.codex-history button{min-height:44px;padding:8px 14px;font:inherit}
.codex-history .history-navigation label{display:block;font-weight:700;margin-bottom:8px}
.codex-history select{width:100%;min-height:46px;padding:9px;border:1px solid #7a8a76;border-radius:8px;font:inherit;background:#fffdf6;color:#193938}
.codex-history .history-pages{display:flex;gap:10px;justify-content:space-between;margin-top:12px}
.codex-history .history-pages button{flex:1}
.codex-history .history-progress{font-size:.9rem;color:#516858;margin:8px 0 16px}
.codex-history .history-record{padding:12px 0;border-top:1px solid #d4c9ac}
.codex-history .history-record li{line-height:1.5;margin:6px 0}
.codex-history .history-record ul{padding-left:22px}
.codex-history .history-dialogue{border-left:3px solid #b2a371;padding-left:12px;margin:14px 0}
.codex-history .history-locked{padding:12px;background:#eae5d7;border-radius:8px;color:#52645c}
@media(max-width:600px){.codex-history{gap:12px}.codex-history .history-intro,.codex-history .history-chapter,.codex-history .history-navigation{padding:12px}.codex-history h3{font-size:1.18rem}.codex-history p{font-size:.98rem}}

.rpg-onboarding { position:fixed;inset:0;z-index:100000;pointer-events:none;font-family:var(--sans,system-ui,sans-serif); }
.rpg-onboarding[hidden] { display:none!important; }
.rpg-onboarding-mask { position:fixed;background:rgba(5,20,25,.56);pointer-events:auto;touch-action:none; }
.rpg-onboarding-ring {
  position:fixed;box-sizing:border-box;border:2px solid #ffe6a2;border-radius:12px;
  box-shadow:0 0 0 2px #1e3239,0 0 16px #ffce7799;pointer-events:none;
  animation:rpg-onboarding-pulse 1.6s ease-in-out infinite;
}
.rpg-onboarding-card {
  position:fixed;box-sizing:border-box;pointer-events:auto;max-width:390px;margin-inline:auto;
  max-height:calc(50dvh - 22px);overflow:auto;overscroll-behavior:contain;
  padding:15px 17px;border:2px solid #b99860;border-radius:14px;
  background:linear-gradient(135deg,#29474b,#172d35);box-shadow:0 4px 0 #132127,0 10px 30px #06151f70;
  color:#f7eed6;line-height:1.4;text-align:left;
}
.rpg-onboarding-card h2 { margin:4px 0 8px;color:#ffe4a4;font:800 19px/1.18 var(--sans,system-ui,sans-serif); }
.rpg-onboarding-card p { margin:0 0 8px;font-size:14px; }
.rpg-onboarding-card .rpg-onboarding-count { font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:#d7c99f;font-weight:800; }
.rpg-onboarding-card .rpg-onboarding-hint { font-size:12px;color:#c1d9cd; }
.rpg-onboarding-actions { display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px;margin-top:10px; }
.rpg-onboarding-card button {
  appearance:none;font:700 12px/1.2 var(--sans,system-ui,sans-serif);padding:9px 11px;min-height:40px;
  color:#f7edcd;background:#2f4b4d;border:1px solid #82927b;border-radius:8px;cursor:pointer;
}
.rpg-onboarding-card button[data-tutorial="done"] { color:#283333;background:#f0ce86;border-color:#ffe7ac; }
.rpg-onboarding-card button[hidden] { display:none!important; }
.rpg-onboarding-card button:focus-visible { outline:3px solid #fff1bc;outline-offset:3px; }
@keyframes rpg-onboarding-pulse { 0%,100% { border-color:#ffe6a2;box-shadow:0 0 0 2px #1e3239,0 0 10px #ffce7777; } 50% { border-color:#fff7d5;box-shadow:0 0 0 2px #1e3239,0 0 23px #ffe193cc; } }
@media (prefers-reduced-motion:reduce) { .rpg-onboarding-ring { animation:none; } }
@media (max-height:500px) {
  .rpg-onboarding-card { max-height:calc(58dvh - 18px);padding:10px 13px; }
  .rpg-onboarding-card h2 { font-size:16px;margin-bottom:5px; }
  .rpg-onboarding-card p { font-size:12px;margin-bottom:5px; }
  .rpg-onboarding-actions { margin-top:6px; }
}
