:root {
  color-scheme: light;
  --ink: #392417;
  --muted: #664a34;
  --paper: #f8e8cb;
  --edge: #68462c;
  --teal: #305e58;
  --board: #39291c;
  --display: ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  font: 16px/1.4 system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #201811; }
main { display: flex; flex-direction: column; min-height: 100svh; max-width: 1920px; margin: auto; padding: 10px; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
button, input, select, summary { border-radius: 8px; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #266e80; outline-offset: 3px; }

.game-header {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 2px 4px 9px;
}
.game-header h1 {
  width: clamp(108px, 13vw, 150px);
}
.brand-mark img {
  display: block;
  width: 100%;
  height: auto;
}
.language-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.language-choice select {
  min-height: 44px;
  max-width: 100%;
  padding: 0 8px;
  color: #fff0d3;
  border: 1px solid #987352;
  background: #302015;
}
#connection { color: #f2dab1; font-size: .86rem; }
#connection::before {
  content: "";
  display: inline-block;
  width: .55em;
  height: .55em;
  margin-right: .5ch;
  border-radius: 50%;
  background: #e0b06a;
  vertical-align: .13em;
}
#connection[data-tone="live"]::before { background: #a8d38a; }
#connection[data-tone="error"]::before { background: #ff9f8a; }
.speaker-icon { position: relative; display: block; width: 22px; height: 18px; }
.speaker-icon::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 12px;
  background: currentColor;
  clip-path: polygon(0 33%, 37% 33%, 100% 0, 100% 100%, 37% 67%, 0 67%);
}
.speaker-icon::after {
  content: "";
  position: absolute;
  inset: 1px 1px 1px auto;
  width: 11px;
  border-right: 2px solid currentColor;
  border-radius: 50%;
}
#sound:is([aria-pressed="false"], [data-silent]) .speaker-icon::after {
  content: "×";
  inset: 0 0 0 auto;
  width: auto;
  border: 0;
  font: 700 14px/18px system-ui, sans-serif;
}

.paper {
  background: radial-gradient(ellipse at 24% 0%, #fff4de 0, transparent 65%),
    repeating-linear-gradient(112deg, #a06b3307 0 1px, transparent 1px 5px),
    var(--paper);
  border: 2px solid var(--edge);
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px #fff0d3a8, inset 0 0 17px #95613929;
}
#error { margin: 0 4px 8px; padding: 7px 12px; color: #702a20; background: #ffe0c9; border-radius: 7px; }
#error:empty { display: none; }
.name-field { max-width: 100%; min-width: 0; }
.name-input { position: relative; }
.name-input input { display: block; width: 100%; padding-inline-end: 49px; }
.name-input .icon-button {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 1;
  border: 1px solid transparent;
  color: var(--teal);
}
.name-input .icon-button:hover:not(:disabled) { background: #e9d7b9; }
.dice-icon {
  display: block;
  width: 19px;
  height: 19px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  background:
    radial-gradient(circle at 25% 25%, currentColor 1.4px, transparent 1.7px),
    radial-gradient(circle at 75% 25%, currentColor 1.4px, transparent 1.7px),
    radial-gradient(circle at 50% 50%, currentColor 1.4px, transparent 1.7px),
    radial-gradient(circle at 25% 75%, currentColor 1.4px, transparent 1.7px),
    radial-gradient(circle at 75% 75%, currentColor 1.4px, transparent 1.7px);
  transform: rotate(-12deg);
}

button {
  min-height: 44px;
  padding: .45rem .8rem;
  border: 1px solid #244641;
  color: #fff7e7;
  background: var(--teal);
  font-weight: 700;
}
button:hover:not(:disabled) { background-color: #234d47; }

main:has(#game:not([hidden])) {
  max-width: none;
  height: 100dvh;
  min-height: 0;
  padding: 0;
}
main:has(#game:not([hidden])) .game-header { display: none; }
#connection[data-tone="live"] { display: none; }
main:has(#game:not([hidden])) #error:not(:empty) {
  position: absolute;
  z-index: 6;
  inset: 34px 10px auto;
  width: fit-content;
  max-width: calc(100% - 20px);
  margin-inline: auto;
}
.layout {
  --hud-edge: clamp(8px, 1.5vw, 22px);
  --hero-hud-width: min(32vw, 264px);
  --target-hud-width: min(25vw, 238px);
  --expanded-map-width: min(440px, calc(100vw - 2 * var(--hud-edge)));
  position: relative;
  isolation: isolate;
  flex: 1;
  min-height: 0;
}
.stage { position: absolute; inset: 0; overflow: hidden; background: #394637; }
.stage iframe, .stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; }
.stage canvas { object-fit: contain; }
/* Keep the iframe laid out so WebKit can draw its first frame behind the loader. */
.stage:has(#scene-loader:not([hidden])) > #scene[src] { display: block !important; pointer-events: none; }
.scene-loader {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  background: #29251e;
  pointer-events: none;
}
.scene-loader > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene-loader-panel {
  position: relative;
  width: min(82%, 330px);
  padding: 20px 24px;
  border: 1px solid #b7915b;
  border-radius: 8px;
  color: #ffe8c1;
  background: #291e16f2;
  box-shadow: 0 10px 35px #1b120ed9;
  text-align: center;
  pointer-events: auto;
}
.scene-loader-panel strong { font: 700 clamp(1.5rem, 5vw, 2.5rem) / 1.1 "PT Serif", Georgia, serif; }
.scene-loader-panel p { margin: 8px 0; font-size: .9rem; }
.scene-loader-panel progress { display: block; width: 100%; height: 8px; accent-color: #dbac65; }
.scene-loader-panel button {
  margin-top: 12px;
  min-height: 44px;
  padding-inline: 14px;
  color: #ffe8c1;
  border: 1px solid #a78352;
  border-radius: 4px;
  background: #34271e;
}
.layout:has(#scene-loader:not([hidden])) > :is(.hero-hud, .navigation-hud, .hud-bottom, .possession-overlay) {
  visibility: hidden;
}
.stage:has(#intoxication-view:not([hidden])) > #scene {
  filter: blur(var(--intoxication-blur, 0px));
  transform: scale(1.015);
}
#intoxication-view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 56%, #67534047);
}
#intoxication-view i {
  position: absolute;
  left: var(--position);
  bottom: -36px;
  width: var(--size);
  height: var(--size);
  border: 1px solid #fff2ca9c;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fffff88c, #e1bd6d12 48%, #d8b56a4d);
  animation: intoxication-bubble var(--duration) linear var(--delay) infinite;
}
#intoxication-view i:nth-child(1) { --position: 15%; --size: 18px; --duration: 5s; --delay: -1.1s; }
#intoxication-view i:nth-child(2) { --position: 32%; --size: 12px; --duration: 4.6s; --delay: -3.3s; }
#intoxication-view i:nth-child(3) { --position: 70%; --size: 26px; --duration: 6.7s; --delay: -4s; }
#intoxication-view i:nth-child(4) { --position: 86%; --size: 14px; --duration: 5.5s; --delay: -2.4s; }
@keyframes intoxication-bubble {
  0% { transform: translate(0, 0); opacity: 0; }
  20% { opacity: .7; }
  68% { opacity: .38; }
  100% { transform: translate(22px, -70dvh); opacity: 0; }
}
#intoxication-view[data-still] i { animation: none; bottom: 15%; opacity: .45; }
.hero-dream {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-dream::before, .hero-dream::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 52%;
  background: #120d20;
  transition: transform 500ms ease-in-out;
}
.hero-dream::before { top: 0; transform: translateY(-101%); }
.hero-dream::after { bottom: 0; transform: translateY(101%); }
.hero-dream[data-sleeping]::before, .hero-dream[data-sleeping]::after { transform: translateY(0); }
.hero-dream > div {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at 32% 48%, #674862 0, transparent 36%),
              radial-gradient(ellipse at 71% 53%, #284653 0, #120d20 63%);
  background-size: 130% 130%;
}
.hero-dream[data-sleeping] > div { opacity: 1; transition: opacity 350ms 500ms; animation: dream-background 4s ease-in-out infinite alternate; }
.hero-dream[data-sleeping]::before, .hero-dream[data-sleeping]::after {
  animation: dream-lids 350ms 500ms forwards;
}
@keyframes dream-lids { to { opacity: 0; } }
@keyframes dream-background {
  from { background-position: 20% 0%, 70% 100%; }
  to { background-position: 80% 100%, 30% 0%; }
}
.hero-dream:not([data-possessed])::before, .hero-dream:not([data-possessed])::after { transition: none; }

.mobile-pad { display: none; }
.hud-ink {
  color: #fff1d7;
  background: #26241eeb;
  border: 1px solid #8a765a;
  border-radius: 4px;
}
.hud-paper {
  color: var(--ink);
  background: #f4e6ca;
  border: 1px solid #8a6f50;
  border-radius: 4px;
}
.hero-hud, .navigation-hud { position: absolute; top: var(--hud-edge); z-index: 2; }
.hero-hud { left: var(--hud-edge); width: var(--hero-hud-width); }
.navigation-hud {
  --radar-size: 154px;
  --map-caption-width: min(235px, calc(100% + 20px));
  right: var(--hud-edge);
  width: calc(var(--radar-size) + 48px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
}
.target-panel {
  position: absolute;
  top: 0;
  left: calc(100% + 8px);
  width: var(--target-hud-width);
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: start;
  gap: 5px 8px;
  padding: 8px;
  text-align: left;
}
.target-panel .health { grid-column: 1 / -1; }
#target-portrait {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border: 1px solid #8a765a;
  border-radius: 3px;
  background: #bba88f;
  color: #4e4032;
}
#target-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#target-portrait::after {
  position: absolute;
  inset: -1px;
  background: var(--rank-frame, none) center / 100% 100% no-repeat;
  pointer-events: none;
  content: "";
}
.target-panel h3 { font: 800 1rem/1.2 var(--display); overflow-wrap: anywhere; }
.target-panel p { font-size: .78rem; }
.target-details { display: flex; align-items: center; gap: .3rem; }
#target-rank {
  display: inline-flex;
  color: var(--rank-color);
}
#target-rank svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.target-panel h3 { color: var(--rank-color, inherit); }
.target-panel[data-rank="elite"] { --rank-color: #f3b591; --rank-frame: url("/art/rank-frames/elite.webp?v=114"); }
.target-panel[data-rank="rare"] { --rank-color: #a6d6f6; --rank-frame: url("/art/rank-frames/rare.webp?v=114"); }
.target-panel[data-rank="epic"] { --rank-color: #e5bcff; --rank-frame: url("/art/rank-frames/epic.webp?v=114"); }
.target-panel[data-rank="legendary"] { --rank-color: #ffdb8c; --rank-frame: url("/art/rank-frames/boss.webp?v=114"); }
.target-panel[data-rank="boss"] { --rank-color: #ffbd71; --rank-frame: url("/art/rank-frames/boss.webp?v=114"); }
.location {
  display: grid;
  place-items: center;
  width: var(--map-caption-width);
  height: calc(2lh + 10px);
  padding: 4px 9px;
  border: 1px solid #8b724e;
  border-radius: 5px 5px 2px 2px;
  background: #201e19f5;
  color: #ffe2ae;
  text-align: center;
  font: 700 .84rem/1.15 Georgia, serif;
  overflow-wrap: anywhere;
}
.location > span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  min-width: 0;
  overflow: hidden;
}
.location[data-possessed] { visibility: hidden; }
.hud-disclosure { position: relative; }
.hud-disclosure > summary {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 4px 8px;
  list-style: none;
  color: #fff1d7;
  background: #26241ef2;
  border: 1px solid #8a765a;
  border-radius: 3px;
  font-size: .78rem;
  font-weight: 700;
}
.hud-disclosure > summary::-webkit-details-marker { display: none; }
.hud-disclosure[open] { z-index: 3; }
.hud-disclosure[open] > summary { color: #2d2a21; background: #eadabc; }
.hud-disclosure > summary:hover { border-color: #d4bb8d; }
.map-detail {
  position: absolute;
  inset: calc(100% + 5px) auto auto 0;
  width: min(320px, calc(100vw - 2 * var(--hud-edge)));
  max-height: min(46dvh, 440px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px;
  text-align: left;
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  border-color: #dfbf897d;
  background: transparent;
  color: inherit;
}
.icon-button:hover:not(:disabled) { background: #f4deb023; }
.hud-bottom {
  position: absolute;
  z-index: 2;
  inset: auto var(--hud-edge) max(var(--hud-edge), env(safe-area-inset-bottom));
  display: grid;
  --event-height: min(156px, 32dvh);
  grid-template-columns: minmax(0, min(48vw, 640px));
  gap: 8px 42px;
  align-items: stretch;
  padding-bottom: clamp(8px, 2dvh, 24px);
  pointer-events: none;
}
.hud-bottom > * { pointer-events: auto; }
.hud-bottom:has(.hud-context > :not([hidden])) {
  grid-template-columns: minmax(0, min(48vw, 640px)) minmax(0, 360px);
}
.stage-events { min-width: 0; align-self: end; }
.hud-context {
  display: flex;
  flex-direction: column;
  align-self: end;
  gap: 6px;
  min-width: 0;
  max-height: min(54dvh, 360px);
  overflow: auto;
  overscroll-behavior: contain;
}
.hud-context:not(:has(> :not([hidden]))) { display: none; }
.hud-context > * { flex: none; min-width: 0; }
.event-dock { position: relative; display: flex; height: var(--event-height); padding: 5px 7px; }
#open-journal {
  position: absolute;
  top: -12px;
  left: calc(100% - 5px);
  height: 44px;
  border: 0;
  background: transparent;
}
#open-journal::before {
  content: "";
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
  border: 1px solid #8a765a;
  border-radius: 4px;
  background: #26241e;
}
#open-journal:hover::before { background: #59472f; }
#open-journal:focus-visible { outline: 0; }
#open-journal:focus-visible::before { outline: 2px solid #ffe2a3; outline-offset: 2px; }
#open-journal .book-icon { grid-area: 1 / 1; transform: scale(.5); }
.stage-events:has(#journal:not([hidden])) #open-journal { display: none; }
.stage-events:has(#journal:not([hidden])) .event-dock { margin-top: 5px; }
.event-feed {
  flex: 1;
  align-self: stretch;
  min-width: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  font: .81rem/1.35 system-ui, sans-serif;
  overflow-wrap: anywhere;
}
#event-empty { padding: 4px 5px; color: #e3d3b8; }
#resident-greeting { padding: 3px 5px; margin: 0; color: #ffe1a4; font-style: italic; }
#conversation-thread, #market-auction { margin: 4px 5px; padding: 3px 0; color: #f2dbb3; }
#conversation-thread > summary { cursor: pointer; font-weight: 600; }
#conversation-turns { padding-inline-start: 1.3em; margin-block: 4px; }
#conversation-promise { color: #f2c483; font-size: .82em; }
.event-sign-lesson { display: block; white-space: pre-line; opacity: 0.86; padding-inline-start: 0.5em; }
.event-sign-lesson[hidden] { display: none; }
.event-feed > ul { display: grid; gap: 4px; margin: 0; padding: 0 5px; list-style: none; }
.event-feed > ul > li + li { border-top: 1px solid #ad94775c; padding-top: 4px; }
.event-time { opacity: .8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.event-feed > ul > li { font-weight: 300; }
.trade-portrait { position: relative; flex: 0 0 36px; width: 36px; height: 36px; }
.trade-portrait img, .trade-portrait svg { width: 100%; height: 100%; }
.trade-portrait img { position: absolute; inset: 0; object-fit: cover; border: 1px solid #8a765a; border-radius: 3px; }
.trade-portrait svg { padding: 5px; stroke: currentColor; fill: none; }
.trade-item.sheet-row { padding: 6px; grid-template-columns: 40px minmax(0, 1fr); gap: 7px; }
.trade-item > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.trade-item .sheet-row-title { flex: 0 0 100%; }
.trade-item .sheet-note { margin: 0; font-size: .8rem; }
.trade-price { color: #ffe0a1; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.trade-price svg {
  width: 14px;
  height: 14px;
  margin-inline-end: 4px;
  fill: none;
  stroke: currentColor;
  vertical-align: -.2em;
}
.event-speech {
  display: block;
  margin-block: .12em .2em;
  padding-inline-start: .5em;
  border-inline-start: 2px solid currentColor;
  font-weight: 400;
}
.event-feed .event-speech { color: #ffdfa4; }
.journal-log .event-speech { color: #6b3818; }
.event-name, .event-item { font-weight: 400; }
.event-item { color: var(--quality-color, currentColor); }
.event-items { display: block; margin-top: .15em; }
.event-feed .event-item[data-item-rarity="gray"] { --quality-color: #d2c8b7; }
.event-feed .event-item[data-item-rarity="white"] { --quality-color: #fff0d5; }
.event-feed .event-item[data-item-rarity="green"] { --quality-color: #9cdaa5; }
.event-feed .event-item[data-item-rarity="blue"] { --quality-color: #a9d0ff; }
.event-feed .event-item[data-item-rarity="purple"] { --quality-color: #dfbbff; }
.event-feed .event-item[data-item-rarity="gold"] { --quality-color: #ffd47d; }
.divine-mark { white-space: nowrap; }
li[data-divine] { list-style: none; }
.event-gear-icon {
  color: #77501d;
  inline-size: 1.1em;
  block-size: 1.1em;
  vertical-align: -.17em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.event-feed li[data-kind="gear_choice"] {
  background: #c28a2f26;
  box-shadow: inset 2px 0 #dbb36e;
  border-radius: 2px;
  padding-inline: 4px;
}
.event-feed .event-gear-icon { color: #ffd591; }
.event-feed li[data-divine="positive"] { color: #ffe498; background: #c28a2f30; }
.event-feed li[data-divine="negative"] { color: #efcbff; background: #9c58c43d; }
.event-feed li[data-divine] { box-shadow: -2px 0 currentColor; padding-inline: 4px; border-radius: 2px; }
.book-icon { display: block; position: relative; width: 23px; height: 18px; }
.book-icon::before, .book-icon::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 11px;
  height: 16px;
  border: 1.5px solid currentColor;
  background:
    linear-gradient(currentColor, currentColor) center 4px / 4px 1px no-repeat,
    linear-gradient(currentColor, currentColor) center 7px / 4px 1px no-repeat;
}
.book-icon::before { left: 0; border-radius: 4px 1px 0 2px; transform: skewY(9deg); }
.book-icon::after { right: 0; border-radius: 1px 4px 2px 0; transform: skewY(-9deg); }

.influence {
  --sign-size: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, var(--sign-size));
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  padding: 6px;
  background: #25251feb;
}
.influence-meters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
#loot-showcase {
  --sheet-ink: #f5e9d6;
  --sheet-muted: #c9bba4;
  --sheet-edge: #61503b;
  display: flex;
  flex-direction: column;
  max-height: min(35dvh, 215px);
  padding: 0;
  overflow: hidden;
}
#sign-status:not(.visually-hidden) { grid-column: 1 / -1; font-size: .72rem; overflow-wrap: anywhere; }
.possession-overlay {
  position: absolute;
  z-index: 3;
  right: max(var(--hud-edge), env(safe-area-inset-right));
  bottom: max(var(--hud-edge), env(safe-area-inset-bottom));
  display: grid;
  justify-items: end;
  gap: 8px;
  pointer-events: none;
}
.possession-pad {
  --sign-size: 48px;
  display: grid;
  grid-template-columns: repeat(3, var(--sign-size));
  grid-template-rows: repeat(3, var(--sign-size));
  grid-template-areas: ". look ." "inspect exit unwind" ". hunt .";
  place-items: center;
  gap: 8px;
}
.possession-pad .sign-button, .possession-action {
  pointer-events: auto;
}
.possession-action .sign-button:disabled { pointer-events: none; }
.possession-pad .sign-icon, .possession-exit-icon {
  width: 50%;
  height: 50%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.possession-pad [data-petal="look"] { grid-area: look; }
.possession-pad [data-petal="inspect"] { grid-area: inspect; }
.possession-pad [data-petal="exit"] { grid-area: exit; }
.possession-pad [data-petal="unwind"] { grid-area: unwind; }
.possession-pad [data-petal="hunt"] { grid-area: hunt; }
.possession-pad [data-impulse="look"] { --sign-accent: #c7bdff; --sign-tint: #544675; }
.possession-pad [data-impulse="inspect"] { --sign-accent: #bde0aa; --sign-tint: #456442; }
.possession-pad [data-impulse="unwind"] { --sign-accent: #ffdb8e; --sign-tint: #65502d; }
.possession-pad [data-impulse="hunt"] { --sign-accent: #ffc5a0; --sign-tint: #734f39; }
#impulse-result {
  position: absolute;
  inset: auto 0 calc(100% + 5px) auto;
  inline-size: min(240px, 56vw);
  max-inline-size: calc(100vw - 30px);
  margin: 0;
  padding: 5px 7px;
  font-size: .79rem;
}
#possession-exit {
  --sign-accent: #ffd1c9;
  --sign-tint: #813f39;
  width: calc(var(--sign-size) + 8px);
  height: calc(var(--sign-size) + 8px);
}
.possession-toggle:focus-visible, .possession-pad button:focus-visible {
  outline: 2px solid #ffe2a3;
  outline-offset: 2px;
}
@media (max-width: 800px) {
  .possession-overlay { bottom: calc(var(--hud-edge) + min(156px, 32dvh) + 16px); }
}
@media (max-width: 800px) and (min-width: 540px) and (max-height: 470px) {
  .possession-overlay { bottom: max(var(--hud-edge), env(safe-area-inset-bottom)); }
  .possession-pad { --sign-size: 44px; }
  .layout:has(.possession-pad:not([hidden])) .hud-bottom { right: 172px; justify-content: start; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-dream::before, .hero-dream::after { transition: none; }
  .hero-dream[data-sleeping] > div { animation: none; transition: none; }
  .hero-dream[data-sleeping]::before, .hero-dream[data-sleeping]::after { animation: none; opacity: 0; }
}
.influence-meters label {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  font: 650 .65rem/1 var(--display);
  font-variant-numeric: tabular-nums;
}
meter { appearance: none; display: block; width: 100%; border: 0; border-radius: 100px; }
meter::-webkit-meter-bar { background: transparent; border: 0; border-radius: 100px; }
meter::-webkit-meter-optimum-value { background: var(--fill); border-radius: 100px; }
meter::-moz-meter-bar { background: var(--fill); border-radius: 100px; }
.influence-meters meter {
  --fill: #79bebd;
  height: 4px;
  background: #515653;
}
#divine-trust-meter { --fill: #c1a576; }
.sign-button {
  --sign-accent: #ffdb8e;
  --sign-tint: #65502d;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--sign-size);
  height: var(--sign-size);
  min-height: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--sign-accent) 65%, #29231d);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 28%, var(--sign-tint), #24211e 92%);
  color: var(--sign-accent);
  box-shadow: inset 0 0 0 2px #231e17, 0 1px 3px #17130f90;
}
#negative {
  --sign-accent: #e5c9ff;
  --sign-tint: #59436c;
}
.possession-toggle { --sign-accent: #b5e4d7; --sign-tint: #355e55; }
.possession-toggle[aria-pressed="true"] { --sign-tint: #4a8276; box-shadow: inset 0 0 0 2px #242b22, 0 0 6px #94d7c583; }
.possession-toggle::before {
  content: "";
  position: absolute;
  inset: 4px auto 4px -4px;
  border-left: 1px solid #ae987b60;
}
.possession-eye {
  position: relative;
  width: .85rem;
  height: .85rem;
  border: 1.5px solid currentColor;
  border-radius: 75% 18%;
  transform: rotate(45deg);
}
.possession-eye::after { content: ""; position: absolute; inset: 28%; border-radius: 50%; background: currentColor; }
.sign-button:hover:not(:disabled, [aria-disabled="true"]) { border-color: var(--sign-accent); background: var(--sign-tint); }
.sign-button:active:not(:disabled, [aria-disabled="true"]) { transform: translateY(1px); }
.sign-button:disabled {
  border-color: #6d6557;
  color: #a59c8b;
  background: #282720;
  box-shadow: inset 0 0 0 2px #211e19;
  cursor: default;
}
.sign-button:disabled::after { opacity: .35; }
#arena { --sign-accent: #ffce94; --sign-tint: #6f502f; --button-cooldown: 0turn; }
#arena:focus-visible { outline: 2px solid #ffe2a3; outline-offset: 2px; }
#arena .sign-icon { font-size: 1rem; line-height: 1; }
.arena-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  grid-column: 1 / -1;
  gap: 2px 6px;
  padding-block-start: 3px;
  border-block-start: 1px solid #8a765a68;
  color: #e9d7b9;
  font-size: .68rem;
  line-height: 1.2;
}
.arena-summary strong { color: #ffe0a1; }
#honor-dialog, #honor-profile {
  color-scheme: light;
  --sheet-edge: #a38552;
  width: min(35rem, calc(100% - 24px));
  max-height: min(88dvh, 43rem);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--sheet-edge);
  border-radius: 9px;
  background: #ebdfbd;
  color: #30271f;
  box-shadow: 0 0 0 3px #342718, 0 18px 70px #130a05b3;
}
#honor-dialog::backdrop, #honor-profile::backdrop { background: #171310a6; }
:is(#honor-dialog, #honor-profile) .settings-header { color: #f4dfb6; gap: 12px; }
:is(#honor-dialog, #honor-profile) .settings-header h2 { flex: 1; overflow-wrap: anywhere; }
.honor-emblem { flex: 0 0 52px; object-fit: contain; border-radius: 5px; }
.honor-festival { padding: 12px 18px; border-bottom: 1px solid #bfab83; background: #e0cca1; }
.honor-festival h3 { font: 700 1rem/1.3 "PT Serif", Georgia, serif; }
.honor-festival p { margin-top: 3px; color: #514331; font-size: .86rem; }
.honor-season-select { padding: 5px 14px; background: #211e19; border-bottom: 1px solid #a38552; }
.honor-content { padding: 13px 18px 16px; }
.honor-season-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px 12px;
  padding-bottom: 10px;
}
.honor-season-summary h3 { font: 700 1.19rem/1.2 "PT Serif", Georgia, serif; }
#honor-season-note { color: #554735; font-size: .8rem; }
.honor-columns, #honor-rows button {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(3ch, max-content) 14px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
}
.honor-columns {
  padding-block: 5px;
  color: #554735;
  font-size: .75rem;
}
.honor-columns span:last-child, .honor-score { text-align: right; }
#honor-rows { margin: 0; padding: 0; list-style: none; }
#honor-rows li + li { border-top: 1px solid #c2ae84; }
#honor-rows button {
  width: 100%;
  min-height: 49px;
  border: 0;
  border-radius: 4px;
  color: #30271f;
  background: transparent;
  text-align: left;
}
#honor-rows button[aria-current="true"] { background: #d9c591; }
#honor-rows button:hover { background: #e1cf9d; }
#honor-rows button:focus-visible {
  outline: 2px solid #714926;
  outline-offset: -2px;
}
.honor-rank { display: flex; justify-content: center; color: #594932; font-variant-numeric: tabular-nums; }
.honor-rank img { display: block; object-fit: contain; border-radius: 50%; }
.honor-name { overflow-wrap: anywhere; font: 700 1.06rem/1.2 "PT Serif", Georgia, serif; }
.honor-name small { margin-inline-start: 8px; color: #514331; font: 600 .74rem/1.2 system-ui, sans-serif; }
.honor-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.honor-arrow { width: 7px; height: 7px; border: solid #745c3c; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }
#honor-profile { width: min(39rem, calc(100% - 24px)); }
.honor-profile-rank { padding: 11px 16px 0; color: #62472f; font-weight: 700; }
.honor-profile-content { display: flex; flex-wrap: wrap; gap: 14px; padding: 12px 16px 17px; }
.honor-profile-view {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1 1 185px;
  min-width: 0;
  min-height: 235px;
  overflow: hidden;
  border: 1px solid #8e7451;
  border-radius: 5px;
  background: #30271c;
}
#honor-profile-portrait {
  position: relative;
  z-index: 1;
  width: min(82%, 144px);
  height: auto;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 0 0 220px #30271c;
}
#honor-profile-model { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.honor-profile-facts { flex: 1 1 220px; min-width: 0; }
.honor-profile-facts h3 { margin: 0 0 6px; font: 700 1.18rem/1.3 "PT Serif", Georgia, serif; }
.honor-profile-stats { margin: 0; }
.honor-profile-stats div {
  display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid #c2ae84;
}
.honor-profile-stats dt { display: flex; align-items: center; gap: 8px; }
.honor-profile-stats :is(img, svg) { flex: 0 0 24px; width: 24px; height: 24px; object-fit: contain; }
.honor-profile-stats .asset-picture { flex: 0 0 24px; inline-size: 24px; block-size: 24px; }
.honor-profile-stats svg { stroke: #655031; stroke-width: 1.5; fill: none; }
.honor-profile-stats dd { flex: none; margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.honor-profile-facts p { margin-top: 8px; color: #514331; font-size: .87rem; }
:is(#positive, #negative, #arena)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: conic-gradient(from calc(1turn - var(--button-cooldown, var(--sign-cooldown, 0turn))),
    #e7e8df85 var(--button-cooldown, var(--sign-cooldown, 0turn)), transparent 0);
  pointer-events: none;
}
#settings-dialog {
  color-scheme: dark;
  --sheet-ink: #f5e9d6;
  --sheet-edge: #61503b;
  --settings-top: max(12px, env(safe-area-inset-top));
  --settings-bottom: max(12px, env(safe-area-inset-bottom));
  --settings-left: max(12px, env(safe-area-inset-left));
  --settings-right: max(12px, env(safe-area-inset-right));
  inset: var(--settings-top) var(--settings-right) var(--settings-bottom) var(--settings-left);
  width: min(400px, calc(100% - var(--settings-left) - var(--settings-right)));
  max-width: none;
  height: max-content;
  max-height: calc(100dvh - var(--settings-top) - var(--settings-bottom));
  padding: 0;
  overflow: hidden;
  border: 1px solid #a4855e;
  border-radius: 8px;
  background: #1a1917;
  color: var(--sheet-ink);
  box-shadow: 0 0 0 3px #252019, 0 18px 70px #090705cf;
}
#settings-dialog[open] { display: flex; flex-direction: column; }
#settings-dialog::backdrop { background: #101318a6; }
#settings-dialog :focus-visible { outline: 2px solid #ffe0a1; outline-offset: -3px; }
.settings-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sheet-edge);
  background: radial-gradient(ellipse at 20% -20%, #533d2b, transparent 70%), #29231d;
}
.settings-header h2 { font: 700 1.5rem/1.2 Georgia, serif; }
.settings-header svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.settings-body {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding: 12px 14px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #936f4b #1a1917;
  font-size: .9rem;
}
.settings-section {
  min-width: 0;
  border: 1px solid var(--sheet-edge);
  border-radius: 5px;
  background: #24201a;
}
.settings-section > * + * { border-top: 1px solid var(--sheet-edge); }
.settings-section.language-choice { padding: 0 10px; }
.settings-section.language-choice select { border: 1px solid #987352; }
#settings-dialog #sound {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 5px 10px;
  border: 0;
  border-radius: 4px 4px 0 0;
  color: #ffe5b6;
  background: #33291f;
  text-align: start;
}
#settings-dialog #sound:hover { background: #483529; }
#sound-state { color: #e9c896; font-size: .78rem; }
.settings-slider, .settings-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 8px;
  margin: 0;
  padding: 6px 10px;
}
.settings-toggle { min-height: 44px; cursor: pointer; }
.settings-toggle input { width: 18px; height: 18px; }
.settings-body input { margin: 0; accent-color: #e6b776; }
.settings-slider input {
  grid-column: 1 / -1;
  width: 100%;
  height: 26px;
  cursor: pointer;
}
.settings-slider output { color: #e9c896; font-size: .82rem; font-variant-numeric: tabular-nums; }
.sign-icon { display: block; }
.sun { font: 24px/1 Georgia, serif; }
.bolt {
  width: 14px;
  height: 19px;
  background: currentColor;
  clip-path: polygon(43% 0, 100% 0, 69% 43%, 98% 43%, 24% 100%, 38% 57%, 5% 57%);
}

.hero-card {
  --portrait-size: 64px;
  position: relative;
  display: grid;
  grid-template-columns: var(--portrait-size) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  color: #fff1d7;
}
.portrait {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  border: 1px solid #8a765a;
  background: #34271f;
}
.portrait-picture {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}
[data-item-rarity="gray"] { --quality-color: #666257; }
[data-item-rarity="white"] { --quality-color: #3c2b20; }
[data-item-rarity="green"] { --quality-color: #2d6038; }
[data-item-rarity="blue"] { --quality-color: #225890; }
[data-item-rarity="purple"] { --quality-color: #6e3f91; }
[data-item-rarity="gold"] { --quality-color: #8c4b03; }
.hero-status { position: absolute; top: 0; right: 0; z-index: 1; }
#hero-status {
  display: grid;
  align-items: start;
  justify-items: end;
  width: 44px;
  height: 44px;
  padding: 4px 5px;
  border: 0;
  background: transparent;
}
#hero-status-icon {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid #ad9975;
  border-radius: 50%;
  background: #284e4a;
  color: #fff4d7;
  font: 800 10px/1 system-ui, sans-serif;
}
#hero-status:hover #hero-status-icon, #hero-status[aria-expanded="true"] #hero-status-icon { border-color: #ffe0ad; }
.hero-status[data-alert] #hero-status-icon { background: #754524; }
.status-tooltip {
  display: none;
  position: absolute;
  inset: calc(100% + 3px) 0 auto 0;
  z-index: 2;
  border: 1px solid #8b724e;
  border-radius: 4px;
  padding: 6px 8px;
  color: #fff7e7;
  background: #211c17;
  box-shadow: 0 3px 10px #18120b70;
  font-size: .8rem;
  overflow-wrap: anywhere;
}
.hero-card:has(.hero-status:not([data-dismissed]) #hero-status:focus-visible) > .status-tooltip,
.hero-card:has(#hero-status[aria-expanded="true"]) > .status-tooltip { display: block; }
@media (hover: hover) {
  .hero-card:has(.hero-status:not([data-dismissed]):hover) > .status-tooltip { display: block; }
}
.hero-stats {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 4px 6px 6px;
  border: 1px solid #856e4c;
  border-radius: 3px 9px 3px 3px;
  background: linear-gradient(105deg, #2e2b22, #151c1deb);
  box-shadow: 0 2px 5px #17130e74, inset 0 0 0 2px #171918;
}
.hero-stats h3 {
  margin-right: 20px;
  color: #ffe5b3;
  font: 700 1rem/1.12 Georgia, serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-class { display: flex; align-items: baseline; gap: .4em; min-width: 0; color: #f1ddbb; font-size: .72rem; line-height: 1.16; }
.hero-class .hero-class-icon { flex: none; color: #e4c18c; }
:is(.hero-class-icon, .dialogue-class) svg {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero-specialization { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health { display: grid; align-items: center; }
.health > * { grid-area: 1 / 1; }
.health meter {
  --fill: linear-gradient(#ae4c49, #882f2e);
  height: 21px;
  border: 1px solid #4c2d20;
  background: #5a3928;
}
.health span { position: relative; z-index: 1; padding-inline: 3px; text-align: center; color: #fff8e9; font-size: .74rem; font-weight: 800; }
.hero-stats .health meter {
  --fill: linear-gradient(#b95a4d, #8e332d);
  height: 16px;
  border-color: #573528;
  background: #341f1c;
}
.hero-stats .health span { font-size: .66rem; line-height: 1; }
.combat-pool { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .3rem; }
.combat-pool[data-kind="mana"] { color: #a9dafa; --pool-fill: linear-gradient(#619bd8, #425d9b); }
.combat-pool[data-kind="might"] { color: #f0c08b; --pool-fill: linear-gradient(#d59a51, #9d552e); }
.combat-pool meter { --fill: var(--pool-fill); height: 6px; border: 1px solid #655644; background: #28221f; }
.combat-pool > span { font-size: .64rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.combat-pool svg { width: .8rem; height: .8rem; display: block; fill: none; stroke: currentColor; stroke-width: 1.6; }
.hero-experience meter {
  --fill: linear-gradient(#90c6bf, #568c89);
  height: 6px;
  border: 1px solid #625644;
  background: #272f2b;
}
.activity {
  width: fit-content;
  max-width: 100%;
  block-size: calc(2lh + 6px);
  margin-top: 7px;
  padding: 3px 7px;
  border-inline-start: 2px solid #b69664;
  border-radius: 0 3px 3px 0;
  background: #1c201cdb;
  color: #f8e8ca;
  font-size: .74rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.activity:has(> p:empty) { visibility: hidden; }
.activity > p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.party-frames {
  display: grid;
  gap: 9px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
#scene-dialogue, #trade-receipt {
  --sheet-ink: #f5e9d6;
  --sheet-muted: #c9bba4;
  position: relative;
  min-width: 0;
  height: var(--event-height);
  background: #26211af5;
}
#trade-receipt { order: -1; height: auto; }
#trade-receipt .dialogue-scroll {
  height: auto;
  max-height: min(216px, 42dvh);
  padding-block: 6px;
}
.dialogue-scroll {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 9px 12px;
  overflow-wrap: anywhere;
}
.dialogue-scroll:focus-visible { outline: 2px solid #ffe2a3; outline-offset: -2px; }
.dialogue-speaker {
  display: flex;
  gap: 9px;
  align-items: center;
  padding-bottom: 7px;
  border-bottom: 1px solid #ad94775c;
}
.dialogue-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid #8a765a;
  border-radius: 3px;
  background: #34271f;
}
#dialogue-portrait { display: block; width: 100%; height: 100%; object-fit: cover; }
.dialogue-identity { min-width: 0; line-height: 1.15; }
#dialogue-speaker { font-size: .89rem; color: #ffe2aa; }
.dialogue-character {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: #e0d2bb;
  font-size: .75rem;
}
.dialogue-class { color: #ffe2aa; }
#dialogue-line, #trade-line { margin: 7px 0 0; font-size: .9rem; line-height: 1.4; }
#map-rares [data-rarity="epic"] { color: #69408d; }
#map-rares [data-rarity="legendary"] { color: #884708; }
#map-rares span { display: inline-block; margin-inline-end: .7em; }
[data-class-icon="0"] { color: #805019; }
[data-class-icon="1"] { color: #633783; }
[data-class-icon="2"] { color: #155c70; }
[data-class-icon="3"] { color: #2d6736; }
.map-adventurers { color: #285b60; font-size: .72rem; margin-top: 3px; }
.navigation-map {
  --radar-radius: calc(var(--radar-size) / 2);
  position: relative;
  width: 100%;
  min-height: var(--radar-size);
  margin-top: 5px;
}
.navigation-map > details { position: static; }
.active-effects {
  position: absolute;
  top: 0;
  right: calc(var(--map-caption-width) + 8px);
  display: grid;
  gap: 2px;
  width: 196px;
  max-height: min(42dvh, 19rem);
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  background: #25231ff5;
  box-shadow: 0 2px 5px #17130f66;
}
.active-effect { min-width: 0; --effect-color: #f5de98; }
.active-effect[data-kind="curse"] { --effect-color: #ebc6ff; }
.active-effect[data-tone="buff"] { --effect-color: #bce4ad; }
.active-effect[data-tone="debuff"] { --effect-color: #ffc0b0; }
.active-effect[data-tone="neutral"] { --effect-color: #ded8ca; }
.active-effect[data-inactive] { --effect-color: #beb6a7; }
.active-effect[data-overflow] { display: none; }
.active-effect-more { position: sticky; bottom: 0; justify-self: end; }
.active-effect-more button {
  min-width: 32px;
  min-height: 28px;
  padding: 2px 6px;
  border: 1px solid #8a7558;
  border-radius: 4px;
  color: #f9e1ae;
  background: #372e22;
  font-size: .74rem;
}
.active-effect-more button[aria-expanded="true"]::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-block-start: 1.5px solid currentColor;
  border-inline-start: 1.5px solid currentColor;
  transform: translateY(2px) rotate(45deg);
}
.journal-postcard { display: block; max-inline-size: 100%; margin-block: 5px; border: 1px solid #947d64; border-radius: 4px; }
.active-effect .effect-trigger {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 30px;
  padding: 3px 5px;
  border: 1px solid #7d6d555e;
  border-radius: 4px;
  background: #ffffff08;
  color: #f9ebd1;
  text-align: start;
}
.active-effect .effect-trigger:is(:hover, :focus-visible, [aria-describedby]) {
  background: #44392e;
  border-color: var(--effect-color);
}
.effect-icon {
  display: grid;
  place-items: center;
  inline-size: 22px;
  block-size: 22px;
  border-radius: 4px;
  color: var(--effect-color);
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.effect-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font: 600 .75rem/1.15 system-ui, sans-serif;
}
.effect-remaining {
  min-width: 2.7em;
  color: #efdbb4;
  text-align: end;
  font: 600 .69rem/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.effect-tooltip {
  position: fixed;
  z-index: 5;
  width: min(230px, calc(100vw - 16px));
  padding: 8px 10px;
  background: #26211bf7;
  box-shadow: 0 4px 12px #13100990;
  font-size: .8rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  overflow-y: auto;
  text-align: left;
}
.effect-tooltip strong { color: #f5de98; font-size: .89rem; }
.effect-tooltip[data-kind="curse"] strong { color: #ebc6ff; }
.effect-tooltip[data-tone="buff"] strong { color: #bce4ad; }
.effect-tooltip[data-tone="debuff"] strong { color: #ffc0b0; }
.effect-tooltip p { margin-top: 4px; }
#effect-tooltip-meta { color: #d8c8ad; font-size: .72rem; }
.effect-origin { display: inline-flex; align-items: center; gap: .3em; }
.effect-origin svg { width: 1.02em; height: 1.02em; fill: none; stroke: currentColor; stroke-width: 1.75; }
.map-detail { inset-inline: auto 0; top: calc(100% + 7px); z-index: 2; }
.navigation-map svg, .effect-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.navigation-map .radar-trigger {
  position: absolute;
  inset: 0 0 auto auto;
  width: var(--radar-size);
  height: var(--radar-size);
  padding: 4px;
  border: 1px solid #aa9067;
  border-radius: 50%;
  background: linear-gradient(145deg, #6b5d46, #302820 44%, #564733);
  box-shadow: inset 0 0 0 1px #201c17, 0 2px 7px #1b170fa6;
}
#radar {
  display: block;
  width: 100%;
  border: 1px solid #201c17;
  border-radius: inherit;
  background: #d6caab;
}
.radar-north, .radar-expand {
  --orbit-inset: 1px;
  color: #ffe3ac;
  border: 1px solid #ad915f;
  background: #201d18;
}
.radar-north {
  --orbit-angle: -90deg;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font: 700 .71rem/1 Georgia, serif;
}
.navigation-map .radar-expand {
  --orbit-angle: 57deg;
  width: 28px;
  height: 28px;
  padding: 5px;
  border-radius: 50%;
  box-shadow: 0 1px 3px #15110bc0;
}
.map-clock {
  --orbit-angle: -57deg;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #b3976c;
  border-radius: 50%;
  color: #ffdc8f;
  background: radial-gradient(circle at 38% 28%, #51422d, #211d18 75%);
  box-shadow: 0 1px 3px #15110bc0;
}
.map-clock[data-night] {
  color: #d4dcff;
  background: radial-gradient(circle at 38% 28%, #343e59, #1c2130 75%);
}
.map-clock:not([data-night]) .map-clock-moon,
.map-clock[data-night] .map-clock-sun { display: none; }
:is(.map-clock, .map-weather):focus-visible { outline: 2px solid #ffe2a3; outline-offset: 2px; }
.map-clock-tooltip {
  position: absolute;
  inset: calc(100% + 8px) 0 auto auto;
  visibility: hidden;
  padding: 4px 8px;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.map-clock:is(:hover, :focus) .map-clock-tooltip { visibility: visible; }
.navigation-map :is(.radar-north, .radar-expand, .map-clock, .map-weather),
.navigation-map > .map-action {
  position: absolute;
  top: calc(var(--radar-radius) * (1 + sin(var(--orbit-angle))) - var(--orbit-inset, 0px));
  right: calc(var(--radar-radius) * (1 - cos(var(--orbit-angle))) - var(--orbit-inset, 0px));
  transform: translate(50%, -50%);
}
.navigation-map .map-action {
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #ffe3ac;
  background: transparent;
}
.navigation-map .map-action::before {
  content: "";
  grid-area: 1 / 1;
  width: 30px;
  height: 30px;
  border: 1px solid #b3976c;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 28%, #39362b, #181c1b 75%);
  box-shadow: inset 0 0 0 2px #242119, 0 2px 3px #17130fa6;
}
.navigation-map .map-action svg { grid-area: 1 / 1; z-index: 1; width: 16px; height: 16px; }
.navigation-map .map-action:not([aria-disabled="true"]):hover, .navigation-map details[open] > .map-action {
  background: transparent;
  color: #fff1cc;
}
.navigation-map .map-action:not([aria-disabled="true"]):hover::before, .navigation-map details[open] > .map-action::before {
  border-color: #ffe2a3;
  background: #59472f;
}
.navigation-map details[open] > summary { border-color: #ffe2a3; }
.navigation-hud :is(summary, button):focus-visible, .hero-hud button:focus-visible {
  outline: 2px solid #ffe2a3;
  outline-offset: 2px;
}
.map-weather { --orbit-angle: -123deg; z-index: 3; }
.map-weather[data-festival] > .map-action::after {
  content: "";
  position: absolute;
  inset: 7px 7px auto auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f4bf69;
  box-shadow: 0 0 0 2px #282217;
}
.map-weather-popup {
  position: absolute;
  inset: calc(100% + 4px) auto auto 0;
  visibility: hidden;
  pointer-events: none;
  width: max-content;
  max-width: min(11rem, 30vw);
  padding: 6px 9px;
  font-size: .8rem;
  line-height: 1.3;
}
.map-weather:not([data-suppress-popup]):is(:hover, :focus-within) .map-weather-popup { visibility: visible; }
.navigation-map:has(.map-weather:is(:hover, :focus-within)) .map-clock-tooltip { visibility: hidden; }
.map-weather-popup p { margin: 3px 0 0; }
#weather-dialog {
  width: min(580px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid #9a805d;
  border-radius: 9px;
  background: #231e17;
  color: #f3e6d1;
}
#weather-dialog::backdrop { background: #0c0b09bc; }
.weather-card-cover { position: relative; display: grid; min-height: 160px; isolation: isolate; }
.weather-card-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.weather-card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #17130fed 0%, #17130f24 76%);
}
.weather-card-title {
  z-index: 1;
  align-self: end;
  padding: 92px 18px 16px;
  color: #fff3d7;
}
.weather-card-title p { margin: 0 0 4px; color: #ffe4ad; font-size: .8rem; }
.weather-card-title h2 { margin: 0; font: 700 clamp(1.55rem, 5vw, 2.2rem)/1.13 var(--display); }
.weather-card-cover form { z-index: 2; position: absolute; inset: 8px 8px auto auto; }
.weather-card-cover .sheet-close {
  width: 44px;
  height: 44px;
  border: 1px solid #a18c6a;
  background: #211b15ed;
  color: #fff2d6;
}
#weather-dialog svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.weather-card-cover .sheet-close svg { width: 22px; height: 22px; }
.weather-card-body { display: grid; gap: 12px; padding: 16px 18px 18px; line-height: 1.45; }
.weather-card-body p { margin: 0; }
.weather-card-benefits {
  padding: 10px 12px;
  border: 1px solid #665039;
  border-radius: 4px;
  background: #31271c;
}
.weather-card-benefits h3 { margin: 0 0 4px; color: #ffdea4; font: 700 1rem/1.3 var(--display); }
.weather-card-event-meta { display: grid; gap: 4px; color: #d3c2aa; font-size: .87rem; }
.weather-card-event-meta p:first-child { display: flex; align-items: center; gap: 6px; }
.weather-card-event-meta svg { width: 16px; height: 16px; flex: none; color: #f0ca8a; }
.navigation-map #honor-open { --orbit-angle: 0deg; }
.navigation-map #quest-heading { --orbit-angle: 180deg; }
.navigation-map #settings-open { --orbit-angle: 123deg; }
.map-detail { width: var(--expanded-map-width); background: #e3d7bb; border-color: #81705b; }
#minimap { display: block; width: 100%; height: auto; border: 1px solid #8c785d; border-radius: 2px; }
#quest-map-mark { padding: 7px 9px 3px; color: #733922; font-weight: 700; }

.quest-tracker {
  width: var(--map-caption-width);
  margin-top: 8px;
  text-align: left;
  color: #ffe6b4;
  background: linear-gradient(105deg, #201e18ed, #201e18b8 76%, #201e1870);
  border-radius: 3px;
}
.quest-tracker h2 {
  padding: 4px 7px 3px;
  border-bottom: 1px solid #9a7b4e;
  font: 700 .88rem/1.15 Georgia, serif;
}
.tracked-quests {
  display: grid;
  gap: 7px;
  max-height: min(52dvh, 32rem);
  margin: 0;
  padding: 6px 7px 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}
.quest-tracker-empty { padding: 6px 7px; color: #ddcaa6; font-size: .75rem; }
.tracked-quests:focus-visible { outline: 2px solid #ffe2a3; outline-offset: -2px; }
.tracked-quests li {
  display: grid;
  grid-template-columns: .65rem minmax(0, 1fr);
  column-gap: 2px;
  align-items: start;
  overflow-wrap: anywhere;
}
.quest-difficulty-mark {
  color: #e0b875;
  text-align: center;
  font: 700 .77rem/1.17 system-ui, sans-serif;
}
.tracked-quests strong { font-size: .77rem; line-height: 1.17; }
.tracked-quests [data-group="true"] strong { color: #9bd3ff; }
.tracked-quests [data-rarity="epic"] .quest-difficulty-mark { color: #dfb8fa; }
.tracked-quests [data-rarity="legendary"] .quest-difficulty-mark { color: #ffcf85; }
.tracked-quests p {
  grid-column: 2;
  margin-top: 3px;
  color: #fff0d8;
  font-size: .72rem;
  line-height: 1.2;
}
.tracked-quests [data-status="objective_complete"] p { color: #c3e3b5; }
.tracked-quests [data-status="available"] p { color: #ddcaa6; }
#journal {
  width: 100%;
  min-height: min(40dvh, 260px);
  max-height: min(63dvh, 620px);
  overflow: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  border: 1px solid #b29468;
  border-radius: 8px;
  color: #f5e5cb;
  background: #211e19;
  box-shadow: 0 0 0 3px #2d251b, 0 10px 36px #080706a6;
  color-scheme: dark;
}
.journal-tabs { display: flex; flex-wrap: wrap; gap: 2px 4px; padding: 4px 6px; }
.journal-tabs button {
  min-height: 36px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #ead8bb;
  background: transparent;
  font-size: .85rem;
}
.journal-tabs button:hover:not(:disabled) { background: #423628; }
.journal-tabs button:is([aria-selected="true"], [aria-pressed="true"]) {
  border-color: #bf9762; color: #ffedc7; background: #55402b;
}
.honor-season-select button:focus-visible { outline: 2px solid #ffe0a1; outline-offset: -2px; }
.journal-heading { position: sticky; top: 0; z-index: 1; }
#close-journal {
  border-color: transparent;
  color: inherit;
  background: transparent;
}
.journal-content {
  margin: 0 6px 6px;
  padding: 8px 10px;
  border: 1px solid #c3a071;
  border-radius: 4px;
  background: radial-gradient(ellipse at 46% 23%, #f9edcf, #ead4a8 92%);
  color: #382719;
  color-scheme: light;
}
.journal-log { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.journal-log > li {
  --journal-accent: #735536;
  border: 1px solid #b09065;
  border-inline-start: 3px solid var(--journal-accent);
  border-radius: 4px;
  background: #fff9e54a;
}
.journal-log > [data-category="battle"] { --journal-accent: #8b4235; }
.journal-log > [data-category="quest"] { --journal-accent: #3c664b; }
.journal-log > [data-category="smith"] { --journal-accent: #8f572a; }
.journal-log > [data-category="conversation"] { --journal-accent: #34656a; }
.journal-log > [data-category="trip"] { --journal-accent: #565e39; }
.journal-log > [data-category="chest"], .journal-log > [data-category="auction"],
.journal-log > [data-divine="positive"] { --journal-accent: #815719; }
.journal-log > [data-divine="negative"] { --journal-accent: #744788; }
.journal-row {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 6px;
}
.journal-episode > summary {
  cursor: pointer;
  list-style: none;
}
.journal-episode > summary::-webkit-details-marker { display: none; }
.journal-episode > summary::after {
  content: "";
  flex: 0 0 6px;
  height: 6px;
  margin-inline: 2px;
  border-block-end: 1.5px solid currentColor;
  border-inline-end: 1.5px solid currentColor;
  transform: rotate(-45deg);
}
.journal-episode[open] > summary::after { transform: rotate(45deg); }
.journal-episode > summary:hover { background: #f9e6be; }
.journal-row-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font: 700 .86rem/1.3 "PT Serif", Georgia, serif;
}
.journal-row-text .event-time { font: 400 .71rem/1 system-ui, sans-serif; }
.journal-mark, .journal-illustration { flex: none; width: 32px; height: 32px; border-radius: 4px; }
.journal-mark {
  padding: 6px;
  color: var(--journal-accent);
  background: color-mix(in srgb, currentColor 13%, transparent);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.journal-illustration { object-fit: cover; border: 1px solid #a58861; background: #ebd5ad; }
.journal-episode > ol { padding: 6px 8px; margin: 0; border-top: 1px solid #b0906580; list-style: none; }
.journal-episode > ol > li + li { margin-block-start: .35em; }
#older-journal {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  margin: 4px 0 0 auto;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #644726;
  background: transparent;
  font: 700 .84rem/1.25 "PT Serif", Georgia, serif;
}
#older-journal:hover:not(:disabled) { border-color: #b09065; background: #f9e6be; }
#older-journal svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(90deg);
}
#older-journal[data-retry] svg { display: none; }
#journal-status:not(:empty) { margin-bottom: 8px; }

.navigation-hud:has(details[open]) { z-index: 4; }

#absence-digest {
  --paper: #f5ebd3;
  --ink: #2c241b;
  --muted-ink: #634c37;
  --rule: #ad9778;
  --editorial: "PT Serif", Georgia, serif;
  box-sizing: border-box;
  width: min(736px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: clamp(12px, 3.5vw, 30px);
  border: 1px solid #847763;
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 55px #080706b5;
}
#absence-digest::backdrop { background: #11110ec4; }
.digest-masthead {
  position: relative;
  border-top: 4px solid #62402d;
  border-bottom: 3px double var(--ink);
}
.digest-masthead h2 {
  margin: 10px 43px 9px;
  color: #513224;
  text-align: center;
  font: 700 clamp(1.75rem, 5.8vw, 3.1rem)/1.04 var(--editorial);
  letter-spacing: -.042em;
  text-wrap: balance;
}
.digest-masthead form { position: absolute; right: 0; top: 0; }
#absence-digest .digest-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.digest-close svg { width: 21px; height: 21px; }
.digest-edition {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 3px 12px;
  padding: 6px 0 7px;
  border-top: 1px solid var(--rule);
  color: var(--muted-ink);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}
.digest-body {
  min-width: 0;
  font: 400 clamp(1rem, 2.7vw, 1.12rem)/1.4 Georgia, serif;
  overflow-wrap: anywhere;
}
#absence-digest-lead { margin: 14px 0 0; font-size: 1.12em; line-height: 1.38; }
#absence-digest-stories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0 0;
  column-gap: 21px;
}
#absence-digest-stories section { display: flow-root; padding: 9px 0; border-top: 1px solid var(--rule); }
#absence-digest-stories section:first-child,
#absence-digest-stories section:nth-child(2):last-child { grid-column: 1 / -1; }
#absence-digest-stories h3 { margin: 0 0 3px; font: 700 1.04em/1.2 var(--editorial); }
#absence-digest-stories p { margin: 0; }
.digest-engraving {
  float: right;
  width: clamp(59px, 12vw, 88px);
  height: auto;
  margin: 1px 0 3px 9px;
  mix-blend-mode: multiply;
  object-fit: contain;
}
#absence-digest .digest-reference {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #674129;
  font: inherit;
  vertical-align: baseline;
  font-weight: 700;
  text-align: start;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .16em;
  cursor: pointer;
}
#absence-digest .digest-reference:hover { color: #3d2519; text-decoration-thickness: 2px; }
#absence-digest :is(.digest-reference, .digest-close, .digest-footer button):focus-visible {
  outline: 2px solid #7c482c;
  outline-offset: 2px;
}
.digest-footer { display: flex; justify-content: end; margin-top: 12px; padding-top: 9px; border-top: 3px double var(--ink); }
#absence-digest .digest-footer button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}
#absence-digest .digest-footer button:hover { background: #49392b; }
#digest-reference {
  position: fixed;
  inset: auto;
  box-sizing: border-box;
  margin: 0;
  width: min(320px, calc(100vw - 16px));
  padding: 10px;
  border: 1px solid #7d654a;
  border-radius: 3px;
  box-shadow: 0 4px 15px #1b160e55;
  background: #fcf3df;
  color: #30251c;
  pointer-events: none;
}
#digest-reference:popover-open { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; align-items: start; }
#digest-reference > :is(img, svg, .asset-picture) {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #d9cbb1;
  border-radius: 2px;
}
#digest-reference > svg { padding: 8px; box-sizing: border-box; }
#digest-reference strong { font: 700 .97rem/1.2 "PT Serif", Georgia, serif; }
#digest-reference p { margin: 3px 0 0; font-size: .81rem; line-height: 1.3; }
@media (max-width: 520px) {
  #absence-digest { width: calc(100% - 16px); padding: 11px; }
  .digest-masthead h2 { margin: 7px 28px; font-size: clamp(1.45rem, 7vw, 1.85rem); }
  #absence-digest .digest-close { width: 36px; height: 40px; }
  #absence-digest-stories { grid-template-columns: minmax(0, 1fr); margin-top: 10px; }
  #absence-digest-stories section { padding: 6px 0; }
  #absence-digest-lead { margin-top: 9px; }
  .digest-footer { margin-top: 7px; padding-top: 7px; }
}
@media (max-width: 520px) and (max-height: 680px) {
  .digest-body { font-size: 1rem; line-height: 1.34; }
  #absence-digest-lead { font-size: 1.06em; }
  .digest-edition { font-size: .72rem; gap: 2px 7px; }
}
@media (max-width: 380px) and (max-height: 665px) {
  .digest-extra { display: none; }
  #absence-digest-stories section:not(:first-child) .digest-engraving { display: none; }
}
@media (max-width: 350px) and (max-height: 610px) {
  #absence-digest { width: calc(100% - 12px); max-height: calc(100dvh - 16px); padding: 9px; }
  .digest-edition { padding-block: 4px; }
  #absence-digest-stories { margin-top: 7px; }
  #absence-digest-stories section { padding-block: 5px; }
  .digest-engraving { display: none; }
}
@media (min-width: 521px) and (max-height: 470px) {
  #absence-digest { padding: 9px 18px; }
  .digest-masthead h2 { margin-block: 4px; font-size: 1.65rem; }
  .digest-edition { padding-block: 3px; }
  .digest-body { font-size: .94rem; line-height: 1.27; }
  #absence-digest-lead, #absence-digest-stories { margin-top: 6px; }
  #absence-digest-stories section { padding-block: 5px; }
  .digest-extra { display: none; }
  .digest-footer { margin-top: 5px; padding-top: 5px; }
}
.map-weather > .map-action[aria-disabled="true"] { cursor: default; }


#quest-book {
  width: min(752px, calc(100% - 24px));
  height: min(518px, 90dvh);
  max-width: none;
  padding: 0;
  border: 1px solid #b29468;
  border-radius: 8px;
  color: #f5e5cb;
  background: #211e19;
  box-shadow: 0 0 0 3px #2d251b, 0 16px 60px #080706c7;
  overflow: hidden;
}
#quest-book[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
#quest-book::backdrop { background: #10131899; }
.quest-book-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 15px;
  border-bottom: 1px solid #71593b;
  background: radial-gradient(ellipse at 25% 0, #48392b, #25211b 72%);
  color: #ffe4b5;
}
.quest-book-header h2 { font: 700 1.2rem/1.1 "PT Serif", Georgia, serif; }
.quest-book-header svg, #quest-rewards svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.quest-book-body {
  display: grid;
  grid-template-columns: minmax(0, 34%) minmax(0, 1fr);
  gap: 6px;
  padding: 6px;
  min-height: 0;
}
#quest-index, #quest-page { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
#quest-index {
  padding: 8px;
  border: 1px solid #564630;
  border-radius: 4px;
  background: #29241d;
  color-scheme: dark;
}
.quest-book-body:has(#quest-page[hidden]) #quest-index { grid-column: 1 / -1; }
#quest-groups section + section { margin-block-start: 12px; }
#quest-groups h3 {
  padding: 4px 7px;
  border-bottom: 1px solid #6b563b;
  color: #e7c18b;
  font: 700 .83rem/1.2 "PT Serif", Georgia, serif;
}
#quest-groups ul { display: grid; gap: 2px; margin: 4px 0 0; padding: 0; list-style: none; }
#quest-groups button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #f3e4cb;
  text-align: start;
  font-size: .82rem;
  font-weight: 550;
  line-height: 1.25;
}
#quest-groups button:hover { background: #423628; }
#quest-groups button[aria-pressed="true"] {
  border-color: #bf9762;
  background: #55402b;
  color: #ffedc7;
}
#quest-groups button .asset-picture {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 3px;
  background: #35291e;
}
.quest-index-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.quest-index-complete { color: #cde1b2; }
#quest-groups button:focus-visible, .quest-book-header button:focus-visible {
  outline: 2px solid #ffe0a1;
  outline-offset: -2px;
}
#no-quests { padding: 8px; color: #e4d4b7; font-size: .92rem; }
#quest-page {
  padding: clamp(14px, 2.5vw, 29px);
  border: 1px solid #c3a071;
  border-radius: 4px;
  background: radial-gradient(ellipse at 46% 23%, #f9edcf, #ead4a8 92%);
  color: #382719;
  font-size: .94rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#quest-page-title { font: 700 clamp(1.25rem, 3vw, 1.7rem)/1.15 "PT Serif", Georgia, serif; }
.quest-chapter-art {
  display: block;
  width: 100%;
  aspect-ratio: 800 / 398;
  margin-bottom: 13px;
  border: 1px solid #9b7e54;
  border-radius: 4px;
  overflow: hidden;
  background: #715638;
}
.quest-chapter-art .asset-picture,
#quest-groups .asset-picture { color: #efd6a5; }
.quest-chapter-art .asset-picture img,
#quest-groups .asset-picture img { object-fit: cover; }
.asset-picture {
  display: inline-grid;
  place-items: center;
  inline-size: 100%;
  block-size: 100%;
  min-inline-size: 0;
  min-block-size: 0;
  overflow: hidden;
}
.asset-picture img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: contain;
}
.asset-picture > :is(img, svg) { grid-area: 1 / 1; }
.asset-picture svg {
  inline-size: min(60%, 26px);
  block-size: min(60%, 26px);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.asset-picture.event-gear-icon { inline-size: 1.1em; block-size: 1.1em; }
.asset-picture.journal-illustration { inline-size: 32px; block-size: 32px; }
.asset-picture.digest-item-art { block-size: auto; }
.discovery-slot .asset-picture { inline-size: 36px; block-size: 36px; }
.ammo-items .asset-picture { inline-size: 23px; block-size: 23px; }
.settings-toggle small { display: block; margin-block-start: 2px; font-size: .75em; font-weight: 400; }
#quest-page-status { margin-bottom: 4px; color: #654729; font-size: .8rem; font-weight: 700; }
#quest-page[data-status="objective_complete"] #quest-page-status { color: #31563c; }
#quest-page section, #quest-page-locations { margin: 14px 0 0; }
#quest-page h4 { margin: 0 0 3px; color: #654729; font: 700 .98rem/1.3 "PT Serif", Georgia, serif; }
#quest-page-group { margin-top: 3px; font-weight: 650; }
#quest-page-locations {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 14px;
  font-size: .85rem;
}
#quest-page-locations:empty { display: none; }
#quest-page-locations dt { color: #654729; font-weight: 700; }
#quest-page-locations dd { margin: 0; }
#quest-page-locations a { color: #305242; text-decoration: underline; text-underline-offset: 2px; }
#quest-page-locations a:hover { color: #182f24; }
#quest-page-locations a:focus-visible { outline: 2px solid #704823; outline-offset: 3px; }
.quest-map-entrance { display: block; width: fit-content; }
#quest-page-rewards { padding-top: 10px; border-top: 1px solid #b89b6f; }
#quest-rewards { display: flex; flex-wrap: wrap; gap: 4px 17px; margin: 0; padding: 0; list-style: none; }
#quest-rewards li { display: flex; align-items: center; gap: 5px; font-weight: 650; }
#quest-rewards svg { width: 17px; height: 17px; color: #815126; }

@media (width > 800px) {
  .layout:has(.possession-pad:not([hidden])) .hud-bottom:has(.hud-context > :not([hidden])) {
    right: calc(max(var(--hud-edge), env(safe-area-inset-right)) + 172px);
  }
  .layout:has(#target-panel:not([hidden])) {
    --expanded-map-width: min(440px, calc(100vw - 2 * var(--hud-edge) - var(--hero-hud-width) - var(--target-hud-width) - 16px));
  }
}

@media (max-width: 960px) {
  .active-effects {
    position: static;
    width: 100%;
    margin-top: 7px;
  }
}

@media (max-width: 800px) {
  .layout { --hero-hud-width: min(49vw, 230px); }
  .navigation-hud {
    --radar-size: clamp(94px, 30vw, 138px);
    --map-caption-width: 100%;
    width: calc(var(--radar-size) + 40px);
  }
  .target-panel {
    position: static;
    width: 100%;
    margin-top: 5px;
    padding: 5px;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 4px;
  }
  .target-panel h3 { font-size: .83rem; }
  .tracked-quests { max-height: min(18dvh, 9rem); }
  .hud-bottom { grid-template-columns: min(100%, 410px); justify-content: center; padding-bottom: 0; }
  .stage-events:has(#journal[hidden]) { margin-inline-end: 40px; }
  .hud-bottom:has(.hud-context > :not([hidden])) {
    grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
    column-gap: 8px;
  }
  .stage-events:has(#journal:not([hidden])) .event-dock { display: none; }
  .hero-card { --portrait-size: 48px; gap: 4px; }
  .hero-stats h3 { font-size: .88rem; }
  .hero-class { font-size: .65rem; }
  .map-clock { width: 26px; height: 26px; }
  .map-clock svg { width: 16px; height: 16px; }
  .active-effect .effect-trigger, .active-effect-more button { min-height: 34px; }
  .active-effect .effect-icon svg { width: 15px; height: 15px; }
  .journal-heading { padding: 5px 8px; }
  .journal-content { padding: 7px 8px; }
  #journal { min-height: auto; max-height: 50dvh; }
}

@media (max-width: 560px) {
  .active-effects { max-height: clamp(76px, 21dvh, 9rem); }
}

@media (max-width: 560px) and (orientation: portrait) {
  .layout { --portrait-context-max: min(200px, 32dvh); }
  .layout:has(#trade-receipt:not([hidden])) {
    --portrait-context-max: min(220px, 38dvh);
  }
  .hud-bottom { --event-height: min(128px, 22dvh); }
  .hud-bottom:has(.hud-context > :not([hidden])) {
    grid-template-columns: minmax(0, 410px);
  }
  .hud-context { grid-row: 1; max-height: var(--portrait-context-max); }
  #trade-receipt .dialogue-scroll { max-height: min(216px, 38dvh); }
  .layout:has(.hud-context > :not([hidden])) .possession-overlay {
    bottom: calc(max(var(--hud-edge), env(safe-area-inset-bottom)) + min(128px, 22dvh) + var(--portrait-context-max) + 16px);
  }
}

@media (max-width: 560px) {
  #quest-book { height: min(650px, 90dvh); }
  .quest-book-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  #quest-index { max-height: min(28dvh, 180px); }
  #quest-groups button { min-height: 44px; }
  #quest-page { font-size: 1rem; }
}

@media (max-width: 350px) {
  .influence { --sign-size: 30px; column-gap: 2px; padding-inline: 3px; }
  .influence-meters label { gap: 0; font-size: .55rem; line-height: .65rem; letter-spacing: -.015em; }
  .influence-meters strong { font-size: .52rem; }
  .possession-toggle::before { left: -2px; }
}
@media (350px < width <= 430px) {
  .influence { column-gap: 4px; }
  .influence-meters label { font-size: .57rem; line-height: .65rem; }
}

.hero-portrait-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  min-height: 44px;
  padding: 3px;
  border: 1px solid #9f885d;
  border-radius: 45% 45% 39% 39%;
  background: linear-gradient(150deg, #ab8c58, #413827 45%, #7d6944);
  box-shadow: 0 2px 5px #160f0977, inset 0 0 0 1px #36281d;
}
.hero-sheet-trigger:hover:not(:disabled) { border-color: #ffe7b5; }
.hero-portrait-frame .portrait { display: block; border: 1px solid #36291c; border-radius: inherit; }
.hero-level {
  position: absolute;
  inset: auto auto -4px 50%;
  transform: translateX(-50%);
  min-width: 24px;
  padding: 1px 4px;
  border: 1px solid #a18553;
  border-radius: 8px 8px 10px 10px;
  background: #22231a;
  color: #ffdf9f;
  text-align: center;
  font: 700 .72rem/1.1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
#hero-sheet svg {
  flex: none;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#hero-sheet {
  color-scheme: dark;
  --sheet-ink: #f5e9d6;
  --sheet-muted: #c9bba4;
  --sheet-gold: #e8c089;
  --sheet-edge: #61503b;
  --sheet-serif: Georgia, "Times New Roman", serif;
  --sheet-top: max(12px, env(safe-area-inset-top));
  --sheet-bottom: max(12px, env(safe-area-inset-bottom));
  --sheet-left: max(12px, env(safe-area-inset-left));
  --sheet-right: max(12px, env(safe-area-inset-right));
  inset: var(--sheet-top) var(--sheet-right) auto var(--sheet-left);
  width: min(760px, calc(100% - var(--sheet-left) - var(--sheet-right)));
  max-width: none;
  max-height: min(720px, calc(100dvh - var(--sheet-top) - var(--sheet-bottom)));
  padding: 0;
  border: 1px solid #a4855e;
  border-radius: 9px;
  background: #1a1917;
  color: var(--sheet-ink);
  box-shadow: 0 0 0 3px #252019, 0 18px 70px #090705cf;
  overflow: hidden;
}
#hero-sheet[open] { display: flex; flex-direction: column; }
#hero-sheet::backdrop { background: #101318a6; }
#hero-sheet :focus-visible { outline: 2px solid #ffe0a1; outline-offset: -3px; }

.sheet-header {
  display: grid;
  flex: none;
  grid-template-columns: 56px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 17px 19px;
  background: radial-gradient(ellipse at 20% -20%, #533d2b, transparent 68%), #29231d;
  border-bottom: 1px solid var(--sheet-edge);
}
.sheet-header .portrait { border-color: #c2a173; box-shadow: 0 0 0 3px #171512; }
.sheet-identity h2 { font: 700 clamp(1.25rem, 3.7vw, 2rem)/1.12 var(--sheet-serif); overflow-wrap: anywhere; }
.sheet-identity p { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; color: var(--sheet-muted); font-size: .87rem; }
#sheet-class { color: var(--sheet-gold); }
#sheet-class[data-class-icon="1"] { color: #e2baff; }
#sheet-class[data-class-icon="2"] { color: #ace1ef; }
#sheet-class[data-class-icon="3"] { color: #b1e7b3; }
#sheet-experience { white-space: nowrap; }
.sheet-gold {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid #846740;
  border-radius: 5px;
  background: #1e1914;
  color: #ffe0a1;
  font-variant-numeric: tabular-nums;
}
.sheet-close {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--sheet-edge);
  border-radius: 5px;
  color: var(--sheet-ink);
  background: #211c18;
}
.sheet-close:hover:not(:disabled) { background: #483529; }

.sheet-tabs {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 5px 12px 0;
  background: #211d18;
  border-bottom: 1px solid var(--sheet-edge);
}
.discovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 5px;
  margin-block: 4px 10px;
}
.discovery-slot {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-block-size: 44px;
  padding: 2px;
  border: 1px solid color-mix(in srgb, currentColor 64%, #483a2b);
  border-radius: 4px;
  background: radial-gradient(ellipse, color-mix(in srgb, currentColor 29%, #211d18), #252018 78%);
  color: var(--quality-color, #ffe6b6);
}
.discovery-slot svg { inline-size: 22px; block-size: 22px; }
.discovery-slot img { inline-size: 36px; block-size: 36px; object-fit: contain; }
.discovery-slot:has(img:not([hidden]))::after {
  position: absolute;
  inset: calc(50% - 18px) auto auto calc(50% - 18px);
  inline-size: 36px;
  block-size: 36px;
  background: currentColor;
  mask: var(--discovery-image) center / contain no-repeat;
  opacity: .27;
  mix-blend-mode: color;
  pointer-events: none;
  content: "";
}
.discovery-slot:is([data-item-rarity="gray"], [data-item-rarity="white"]):has(img)::after { opacity: .12; }
.discovery-slot[data-unknown] { color: #51463a; background: #2b241e; border-color: #57493b; }
.discovery-slot[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--sheet-ink); }
.sheet-tabs button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 5px 5px 0 0;
  color: var(--sheet-muted);
  background: transparent;
  font-size: .86rem;
  font-weight: 700;
}
.sheet-tabs button:hover { background: #342a21; }
.sheet-tabs button[aria-selected="true"] {
  border-bottom-color: var(--sheet-gold);
  color: #ffe5b6;
  background: linear-gradient(#382d22, #2a241d);
}
.sheet-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #936f4b #1a1917;
  background: radial-gradient(ellipse at 50% 100%, #28231b, transparent 72%);
}
.sheet-body [role="tabpanel"] { min-height: 0; padding: 15px 18px; }
.sheet-body h3 { color: var(--sheet-gold); font: 700 1.12rem/1.25 var(--sheet-serif); }
.sheet-counter { color: var(--sheet-muted); font-size: .82rem; font-variant-numeric: tabular-nums; }

.item-grid, .ammo-items { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.worn-items { grid-template-rows: repeat(3, 1fr); }
.bag-items { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.item-grid > li {
  display: flex;
  min-width: 0;
  border: 1px solid #6e5640;
  border-radius: 6px;
  color: var(--sheet-ink);
  background: #29231d;
}
.item-grid > li[data-empty] { border-style: dashed; border-color: #514634; color: var(--sheet-muted); background: #181715; }
.item-tile {
  display: grid;
  grid-template-columns: clamp(36px, 10vw, 66px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 70px;
  padding: 6px 9px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: inherit;
  text-align: start;
}
button.item-tile:hover { background: #3d3024; }
.item-tile-picture {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--quality-color, var(--sheet-gold)), transparent 43%);
  border-radius: 4px;
  background: radial-gradient(ellipse at 42% 38%, #4c3d2e, #1c1916 82%);
  color: var(--quality-color, var(--sheet-gold));
}
.item-tile-picture .asset-picture, .sheet-pictogram .asset-picture { grid-area: 1 / 1; }
.item-tile-picture img { padding: 2px; }
.item-tile-picture .sheet-quantity { inset: auto -2px -2px auto; }
.bag-items .item-tile-picture[data-cooldown="healing"] { --item-cooldown: var(--healing-cooldown, 0%); }
.bag-items .item-tile-picture[data-cooldown]::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset-block-end: -1px;
  inset-inline-start: 0;
  inline-size: var(--item-cooldown, 0%);
  block-size: 3px;
  border-radius: 2px;
  background: #ffdb89;
  pointer-events: none;
}
.bag-items .item-tile-picture[data-cooldown]::after {
  --cooldown-edge: calc(100% - 1.12 * var(--item-cooldown, 0%));
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgb(30 30 30 / 22%);
  backdrop-filter: grayscale(1);
  mask-image: linear-gradient(to bottom, transparent var(--cooldown-edge), #000 calc(var(--cooldown-edge) + 12%));
  pointer-events: none;
}
.bag-items .item-tile-picture[data-cooldown] :is(.sheet-quantity, .item-tile-status) { z-index: 1; }
.item-grid [data-empty] .item-tile-picture { border-color: #5a4c3b; background: #211e19; color: #b29f85; }
.item-tile-copy { display: grid; gap: 3px; min-width: 0; }
.item-tile-name {
  display: -webkit-box;
  overflow: hidden;
  hyphens: auto;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--quality-color, inherit);
  font-size: .9rem;
  font-weight: 650;
  line-height: 1.2;
}
.item-tile-status {
  position: absolute;
  inset: 2px auto auto 2px;
  display: grid;
  place-items: center;
  padding: 1px;
  border-radius: 3px;
  background: #271a16;
  color: #ffbaaa;
}
#hero-sheet .item-tile-status svg { width: 14px; height: 14px; }
.bag-items .item-tile {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: clamp(42px, 9vw, 58px) 2.4em;
  justify-items: center;
  gap: 5px;
  padding: 5px 3px;
  font-size: .78rem;
  text-align: center;
}
.bag-items .item-tile-picture { height: 100%; }
.bag-items .item-tile-copy { width: 100%; }
.bag-items .item-tile-name { font-size: inherit; }
.bag-items [data-empty] .item-tile-picture { border-style: dashed; background: #1d1a16; }
.bag-capacity { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--sheet-gold); }
#ammunition-supplies {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 8px;
}
#ammunition-supplies h3 { margin: 0; font-size: .95rem; }
.ammo-items {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 7px;
  color: var(--sheet-muted);
  font-size: .78rem;
}
.ammo-items li {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid var(--sheet-edge);
  border-radius: 4px;
  background: #272119;
}
.ammo-items img { width: 23px; height: 23px; }
.ammo-items strong { color: var(--sheet-ink); font-variant-numeric: tabular-nums; }

.equipment-layout {
  display: grid;
  grid-template-columns: minmax(64px, 1fr) minmax(0, 1.76fr) minmax(64px, 1fr);
  align-items: center;
  gap: clamp(6px, 1.6vw, 14px);
}
.worn-items .item-tile {
  grid-template-columns: clamp(34px, 6vw, 58px) minmax(0, 1fr);
  min-height: 86px;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}
.equipment-bag { margin-top: 10px; }
.equipment-bag .bag-capacity { margin-bottom: 6px; }
.equipment-bag .bag-capacity h3 { margin: 0; font-size: .95rem; }
.equipment-bag .bag-items button { touch-action: manipulation; }
.equipment-preview {
  position: relative;
  display: grid;
  place-items: center;
  container-type: size;
  margin: 0;
  min-width: 0;
  height: clamp(214px, 42dvh, 342px);
  overflow: hidden;
  border: 1px solid var(--sheet-edge);
  border-radius: 6px;
  background: radial-gradient(ellipse, #584730, #251f18 76%);
}
#equipment-portrait { width: min(84cqw, 76cqh, 178px); }
#equipment-model, .equipment-drag { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#equipment-model { opacity: 0; pointer-events: none; }
.equipment-preview[data-ready] #equipment-model { opacity: 1; }
.equipment-drag { cursor: grab; touch-action: pan-y; }
.equipment-drag:active { cursor: grabbing; }
.equipment-drag:focus-visible { outline-offset: -4px; border-radius: 6px; }
#equipment-loading {
  position: absolute;
  inset: auto 4px 6px;
  text-align: center;
  color: var(--sheet-muted);
  font-size: .76rem;
}
.sheet-list {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.sheet-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 9px;
  border: 1px solid #534534;
  border-radius: 5px;
  background: linear-gradient(145deg, #30281f, #23201b);
  overflow-wrap: anywhere;
}
.sheet-pictogram {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--quality-color, #8e704c);
  border-radius: 5px;
  background: radial-gradient(ellipse at 40% 20%, #4b3d2f, #211e19 80%);
  color: var(--quality-color, #e9c896);
}
.sheet-pictogram svg {
  width: 25px;
  height: 25px;
  max-width: 100%;
  max-height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#hero-sheet .sheet-pictogram svg { width: 25px; height: 25px; }
#hero-sheet [data-item-rarity="gray"], :is(.sheet-row, .item-card)[data-item-rarity="gray"] { --quality-color: #c2bcaf; }
#hero-sheet [data-item-rarity="white"], :is(.sheet-row, .item-card)[data-item-rarity="white"] { --quality-color: #fbefe0; }
#hero-sheet [data-item-rarity="green"], :is(.sheet-row, .item-card)[data-item-rarity="green"] { --quality-color: #a8df9f; }
#hero-sheet [data-item-rarity="blue"], :is(.sheet-row, .item-card)[data-item-rarity="blue"] { --quality-color: #a6cff9; }
#hero-sheet [data-item-rarity="purple"], :is(.sheet-row, .item-card)[data-item-rarity="purple"] { --quality-color: #dfb9fc; }
#hero-sheet [data-item-rarity="gold"], :is(.sheet-row, .item-card)[data-item-rarity="gold"] { --quality-color: #ffd47d; }
.sheet-row[data-item-rarity="purple"] {
  border-color: #8d6aa7;
  box-shadow: inset 0 0 10px #b562f027, 0 0 7px #c995ff40;
}
.sheet-row[data-item-rarity="gold"] {
  border-color: #b58b45;
  box-shadow: inset 0 0 12px #ffc45a38, 0 0 9px #ffcb6f55;
  animation: legendary-item-glow 4s ease-in-out infinite alternate;
}
@keyframes legendary-item-glow {
  to { box-shadow: inset 0 0 17px #ffc45a53, 0 0 13px #ffcb6f70; }
}
body:has(#less-motion:checked) .sheet-row[data-item-rarity="gold"] { animation: none; }
.sheet-label { display: block; color: var(--sheet-muted); font-size: .75rem; }
.sheet-row-title { display: block; color: var(--quality-color, var(--sheet-ink)); font-size: .95rem; line-height: 1.25; }
.sheet-note, .sheet-restriction { color: var(--sheet-muted); font-size: .85rem; }
.sheet-row .sheet-note, .sheet-restriction { margin-top: 4px; }
.sheet-restriction { color: #ffb3a3; font-weight: 650; }
.sheet-quantity {
  position: absolute;
  inset: auto -4px -4px auto;
  border: 1px solid #806747;
  border-radius: 4px;
  padding: 0 4px;
  background: #1a1714;
  color: #fff1db;
  font-size: .75rem;
  font-weight: 750;
}
.sheet-list + .sheet-note { margin-top: 8px; }
#sheet-skills { display: grid; gap: 12px; }
#sheet-skills h3 { margin: 0 0 5px; }
.spell-overview:has(#spellbook-toggle:not([hidden])) {
  display: grid;
  padding: 0 .65rem;
  border: 1px solid #695741;
  border-radius: 5px;
  background: #252019;
}
.spell-overview:has(#spellbook-toggle:not([hidden])) #spell-cards .skill-card {
  padding-inline: 0;
  border: 0;
  background: transparent;
}
#spellbook-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .55rem;
  padding: .4rem .25rem;
  min-height: 44px;
  text-align: start;
  border: 0;
  border-top: 1px solid #584735;
  border-radius: 0;
  color: #f0d3a0;
  background: transparent;
}
#spellbook-toggle:hover { color: #ffe4ac; background: #f4ca8412; }
.spellbook-seal {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  color: #e9bc75;
}
.spellbook-seal svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.spellbook-enter { align-self: center; color: #dab47a; }
#spellbook-toggle .skill-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .65rem; }
#spellbook-toggle strong { font: 700 .98rem/1.2 var(--display); }
/* The spellbook uses an inset leather cover and two independent paper leaves. */
#spellbook {
  color-scheme: dark;
  position: fixed;
  width: min(880px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 26px);
  padding: .8rem clamp(.55rem, 2.2vw, 1.3rem);
  overflow: auto;
  border: 1px solid #a78456;
  border-radius: 10px 9px 11px 10px;
  color: #f5deaa;
  background: linear-gradient(105deg, #362820dd, #342017ee, #432c22e8), url("/art/branding/guild-wood.webp");
  box-shadow: inset 0 0 0 3px #241916, inset 0 0 0 6px #77583d, 0 14px 55px #100b08de;
}
#spellbook::backdrop { background: #100d0bc7; }
.spellbook-tools {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .65rem;
  padding: .3rem .4rem .75rem;
}
#spellbook-title { font: 700 clamp(1.2rem, 3vw, 1.75rem)/1.12 "PT Serif", Georgia, serif; text-align: center; }
.spellbook-progress { justify-self: end; text-align: end; font-size: .86rem; color: #e0c18c; }
.spellbook-spread { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.spellbook-page {
  --spell-icon-size: clamp(2.9rem, 6.6vw, 4rem);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, calc(var(--spell-icon-size) + 3.15rem));
  gap: .25rem .35rem;
  align-items: start;
  justify-items: stretch;
  list-style-type: none;
  margin: 0;
  padding: .95rem clamp(.32rem, 1.6vw, 1.25rem);
  color: #3a291c;
  border-block: 1px solid #c19d65;
  background: radial-gradient(ellipse at 40% 35%, #fbebc9 0%, #f1d6a1 63%, #d6aa72);
  box-shadow: 0 3px #ae8257, 0 5px #745036;
}
.spellbook-page:first-child {
  border-radius: 12px 2px 3px 7px;
  box-shadow: inset -18px 0 22px -13px #714723bb, inset 5px 0 6px -4px #9c6a40, 0 3px #ae8257, 0 5px #745036;
}
.spellbook-page:last-child {
  border-radius: 2px 12px 7px 3px;
  box-shadow: inset 18px 0 22px -13px #714723bb, inset -5px 0 6px -4px #9c6a40, 0 3px #ae8257, 0 5px #745036;
}
.spellbook-entry {
  display: grid;
  grid-template-rows: auto 2.35em;
  justify-items: center;
  align-content: start;
  width: 100%;
  min-width: 0;
  gap: .3rem;
  padding: .3rem .2rem;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #442b19;
  background: transparent;
  text-align: center;
  font: 700 .86rem/1.16 "PT Serif", Georgia, serif;
}
.spellbook-entry span {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
#spellbook .spellbook-entry:is(:hover, :focus-visible) { background: #945f2520; border-color: #a1713e; }
#spellbook .spellbook-entry:focus-visible { outline: 2px solid #794d2b; outline-offset: -2px; }
.spellbook-entry img {
  display: block;
  width: min(100%, var(--spell-icon-size));
  height: auto;
  aspect-ratio: 1;
  border-radius: 5px;
  border: 1px solid #a47a43;
  box-shadow: 0 1px 2px #52341869;
}
.spellbook-entry[data-unlearned] img { filter: grayscale(.88) sepia(.15) contrast(.72); opacity: .57; }
.spellbook-entry[data-unlearned] span { color: #6b5040; }
.spellbook-navigation { display: flex; align-items: center; justify-content: center; gap: 1.25rem; margin: .85rem 0 .18rem; }
.spellbook-control {
  min-width: 44px;
  min-height: 44px;
  padding-inline: .55rem;
  color: #efd5a4;
  border: 1px solid #9f7950;
  border-radius: 4px;
  background: #4b3326;
}
.spellbook-control:hover:not(:disabled) { background: #634631; }
.spellbook-control:disabled { opacity: .46; }
#spellbook-tooltip {
  position: absolute;
  z-index: 4;
  width: min(274px, calc(100% - 24px));
  padding: .75rem .85rem;
  border: 1px solid #a38354;
  border-radius: 4px;
  color: #fff0d4;
  background: linear-gradient(155deg, #38291e, #251b15 72%);
  box-shadow: 0 6px 20px #23150db0;
  pointer-events: none;
  font-size: .88rem;
}
#spellbook-tooltip > strong { font: 700 1.05rem/1.18 var(--display); color: #f7dda7; }
#spellbook-tooltip > p { margin-top: .25rem; color: #e8d7ba; }
.spellbook-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem .7rem;
  margin: .55rem 0 0;
  padding: .52rem 0 0;
  border-top: 1px solid #71563a;
}
.spellbook-stats dt { display: flex; align-items: center; gap: .3rem; font-size: .74rem; color: #d9bd92; }
.spellbook-stats dd { margin: .13rem 0 0 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.spellbook-stats > div:last-child:nth-child(odd) { display: flex; grid-column: 1 / -1; align-items: baseline; gap: .45rem; }
.spellbook-stats > div:last-child:nth-child(odd) dd { margin: 0; }
.spellbook-stats svg {
  width: .8rem;
  height: .8rem;
  flex: none;
  fill: none;
  stroke: #ebc07d;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#spellbook-status { padding: .45rem; }
@media (max-width: 535px) {
  .spellbook-tools { grid-template-columns: 1fr auto; gap: .25rem; }
  #spellbook-title { grid-row: 2; grid-column: 1 / -1; padding-block: .3rem; }
  .spellbook-spread { grid-template-columns: 1fr; gap: 7px; }
  .spellbook-page { --spell-icon-size: 2.45rem; padding-block: .4rem; }
  .spellbook-entry { font-size: .78rem; }
}
.skill-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  align-items: stretch;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
#aptitudes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#class-ability { grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); }
#guild-skills { grid-template-columns: repeat(auto-fit, minmax(min(100%, 84px), 1fr)); }
.skill-card {
  --skill-accent: var(--sheet-gold);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--skill-accent) 36%, #2c2620);
  border-radius: 5px;
  background: #252019;
}
.skill-card:is([data-skill="magic"], [data-skill="class_mage"]) { --skill-accent: #dcb9f4; }
.skill-card:is([data-skill="agility"], [data-skill="class_trickster"]) { --skill-accent: #a9dcec; }
.skill-card:is([data-skill="care"], [data-skill="class_healer"], [data-skill="class_hunter"]) { --skill-accent: #b1dfa8; }
.skill-card[data-skill-state="unlearned"] {
  --skill-accent: #a69b8a;
  background: #211e19;
  border-style: dashed;
  color: var(--sheet-muted);
}
.skill-card[data-skill-state="unlearned"] .skill-picture { filter: saturate(.2) brightness(.8); }
.skill-heading {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.skill-picture {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--skill-accent) 48%, transparent);
  border-radius: 4px;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--skill-accent) 26%, #241e18), #201a16 81%);
  color: var(--skill-accent);
}
.skill-picture img { width: 100%; height: auto; object-fit: contain; }
.skill-label { display: grid; min-width: 0; gap: 2px; line-height: 1.2; }
.skill-label > strong { font-size: .9rem; overflow-wrap: anywhere; }
.skill-label .sheet-counter { font-size: .73rem; }
.skill-score { min-width: 1.25ch; color: var(--skill-accent); font-variant-numeric: tabular-nums; text-align: end; }
.skill-card .skill-detail { margin: 0; font-size: .83rem; line-height: 1.3; }
#skill-guild { --skill-accent: var(--sheet-gold); display: grid; gap: 6px; }
#skill-guild > .skill-heading { grid-template-columns: 27px minmax(0, 1fr) auto; }
#sheet-skills #guild-skill-heading { margin: 0; }

.item-tooltip {
  position: fixed;
  inset: auto;
  margin: 0;
  width: max-content;
  max-width: min(18rem, calc(100vw - 16px));
  padding: 9px 11px;
  color: #f5e9d6;
  pointer-events: none;
}
.item-tooltip strong { display: block; color: #ffe1a8; }
.item-tooltip p { margin: 4px 0 0; font-size: .82rem; line-height: 1.35; }
.item-card .item-property-active { color: #fff2d9; font-weight: 700; }
.item-card .item-property-inactive { color: #978e80; }
.item-property-rare { color: #e3c4f3; }
.item-property-inactive .item-property-rare { color: inherit; }

.party-roster {
  --party-model-height: clamp(205px, 39dvh, 318px);
  position: relative;
  isolation: isolate;
  border: 1px solid var(--sheet-edge);
  border-radius: 6px;
  overflow: hidden;
}
.party-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
#party-models {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: var(--party-model-height);
  border: 0;
  pointer-events: none;
}
.party-slot { position: relative; min-width: 0; }
.party-slot + .party-slot { box-shadow: -1px 0 var(--sheet-edge); }
#party-interactions { margin-top: 14px; }
#party-interaction-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.party-interaction {
  display: grid;
  grid-template-columns: 15px auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--sheet-edge);
  border-radius: 4px;
  background: #29241c;
  color: var(--sheet-ink);
  text-align: left;
}
.party-interaction:hover { border-color: var(--sheet-gold); }
.party-interaction time { color: var(--sheet-muted); font-variant-numeric: tabular-nums; }
.party-interaction :is(svg, .party-interaction-journal) { color: var(--sheet-gold); }
.party-interaction-summary { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.party-interaction-journal { font-size: .8rem; }
.party-model {
  position: relative;
  display: grid;
  place-items: center;
  container-type: size;
  height: var(--party-model-height);
  margin: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--sheet-edge);
  background: radial-gradient(ellipse, #483827, #2c251c 76%);
}
.party-slot[data-model-ready] .party-model { background: transparent; }
.party-slot[data-model-ready] .party-portrait { display: none; }
.party-portrait { width: min(72cqw, 72cqh, 143px); }
.party-vacant-art { width: min(88cqw, 260px); height: 92cqh; object-fit: contain; }
.party-info { padding: 10px 12px 12px; background: #241e19; }
.party-info .party-name { overflow-wrap: anywhere; }
.party-class { margin-top: 3px; color: var(--sheet-muted); font-size: .79rem; }
.party-stats {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--sheet-muted);
  font-size: .79rem;
}
.party-stats > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 6px; }
.party-stats dd { margin: 0; color: var(--sheet-ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.party-stats .party-bar { grid-column: span 2; }
.party-bar meter { display: block; width: 100%; height: 6px; appearance: none; }
.party-bar meter::-webkit-meter-bar { border: 0; border-radius: 3px; background: #191614; }
.party-bar meter::-webkit-meter-optimum-value { border-radius: 3px; background: #bc765f; }
.party-bar .party-xp-meter::-webkit-meter-optimum-value { background: #c69e67; }
.party-effects {
  display: grid;
  gap: 7px;
  margin: 9px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--sheet-edge);
  list-style: none;
  font-size: .76rem;
}
.party-effects > li { display: flex; align-items: start; gap: 5px; overflow-wrap: anywhere; }
.party-effects svg { color: var(--sheet-gold); }
.party-effects p { margin-top: 2px; color: var(--sheet-muted); line-height: 1.3; }

#item-inspection {
  width: min(530px, calc(100% - 26px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid #a4855e;
  border-radius: 7px;
  background: #201b17;
  color: var(--sheet-ink);
  box-shadow: 0 16px 56px #090705cf;
  overflow: hidden;
}
#item-inspection[open] { display: flex; flex-direction: column; }
#item-inspection::backdrop { background: #100b08b3; }
.item-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  flex: none;
  padding: 11px;
  border-bottom: 1px solid var(--sheet-edge);
  background: linear-gradient(140deg, #372b21, #26211c 72%);
}
.item-card-identity {
  display: grid;
  grid-template-columns: clamp(40px, 12vw, 60px) minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}
.item-card-meta { margin: 0 0 3px; color: var(--sheet-muted); font-size: .74rem; line-height: 1.25; }
.item-card .item-card-title {
  margin: 0;
  color: var(--quality-color, var(--sheet-ink));
  font: 700 clamp(1rem, 3.5vw, 1.25rem)/1.2 var(--sheet-serif, Georgia, serif);
  overflow-wrap: anywhere;
}
.item-card-header .sheet-close {
  border-color: transparent;
  background: transparent;
}
.item-card-header .sheet-close:hover { border-color: var(--sheet-edge); background: #3b3025; }
.item-card-header .sheet-close:focus-visible { outline: 2px solid #ffe0a1; outline-offset: -3px; }
.item-card-header .sheet-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.item-card-body {
  display: grid;
  gap: 9px;
  min-height: 0;
  padding: 10px 12px 12px;
  color: var(--sheet-muted);
  font-size: .84rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.item-card-body > section + section { padding-top: 8px; border-top: 1px solid var(--sheet-edge); }
.item-card-body h4 { margin: 0 0 5px; color: var(--sheet-ink); font-size: .8rem; }
.item-card-body p { margin: 0; }
.item-card-body p + p { margin-top: 4px; }
.item-card-traces { margin: 0; padding-inline-start: 16px; }
.item-card-traces li + li { margin-top: 3px; }
.item-card-traces li::marker { color: #bb9462; }
.item-card-legend {
  margin: 0;
  padding: 6px 9px;
  border-inline-start: 2px solid #b58a56;
  border-radius: 0 4px 4px 0;
  background: #2d251e;
  color: #ead7b8;
  font: italic .95rem/1.45 var(--sheet-serif, Georgia, serif);
  text-wrap: pretty;
}
.item-card-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 78px), 1fr));
  gap: 5px;
  margin: 0;
}
.item-card-metrics > div {
  display: grid;
  align-content: start;
  gap: 1px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--sheet-edge);
  border-radius: 4px;
  background: #30271f;
}
.item-card-metrics dt { font-size: .72rem; }
.item-card-metrics dd {
  margin: 0;
  color: var(--sheet-ink);
  font-size: .9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#inspected-item, #loot-showcase-item { overflow: auto; overscroll-behavior: contain; }
#loot-showcase .item-card-header { padding: 5px 6px; }
#loot-showcase .item-card-identity { grid-template-columns: 39px minmax(0, 1fr); gap: 6px; }
#loot-showcase .item-card-title { font-size: .95rem; }
#loot-showcase .item-card-body { padding: 6px 8px; }

.sheet-body:has(#sheet-discoveries:not([hidden])) {
  display: flex;
  height: clamp(182px, calc(100dvh - 177px), 535px);
  overflow: hidden;
}
#sheet-discoveries {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  flex: 1;
  min-width: 0;
  padding: 0;
}
.discovery-catalog, .discovery-preview {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 14px;
  scrollbar-color: #936f4b #1a1917;
}
.discovery-preview { border-inline-start: 1px solid var(--sheet-edge); background: #211c17; }
#discovery-item { border: 1px solid var(--sheet-edge); border-radius: 5px; overflow: hidden; }
#discovery-item .item-card-header { padding: 8px; }
#discovery-item .item-card-identity { grid-template-columns: 46px minmax(0, 1fr); }
#discovery-item .item-card-title { font-size: 1.1rem; }
#discovery-domains h3 { font-size: .95rem; }

@media (max-width: 560px) {
  .sheet-header { grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 8px; padding: 10px; }
  .sheet-identity p { font-size: .8rem; }
  .sheet-gold { padding: 4px; font-size: .85rem; }
  .sheet-tabs { gap: 0; padding-inline: 3px; }
  .sheet-tabs button { flex-direction: column; gap: 2px; min-height: 50px; font-size: .76rem; }
  .sheet-body [role="tabpanel"] { padding: 10px; }
  .party-roster { --party-model-height: clamp(162px, 29dvh, 228px); }
  .party-info { padding: 8px 7px 9px; }
  .party-info .party-name { font-size: 1rem; }
  .party-class, .party-stats { font-size: .72rem; }
  .bag-items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .worn-items .item-tile {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 34px auto;
    justify-items: center;
    gap: 3px;
    min-height: 76px;
    padding: 4px;
    text-align: center;
  }
  .worn-items .item-tile-picture { height: 100%; }
  .worn-items .item-tile-copy { width: 100%; }
  .worn-items .item-tile-name { font-size: .8rem; }
  .worn-items .sheet-label { font-size: .69rem; }
  .equipment-preview { height: clamp(178px, 31dvh, 248px); }
  .equipment-bag .bag-items .item-tile {
    grid-template-rows: 38px 1.2em;
    gap: 3px;
    min-height: 61px;
    padding-block: 4px;
  }
  .equipment-bag .bag-items .item-tile-name { -webkit-line-clamp: 1; }
  #sheet-skills { gap: 7px; }
  #aptitudes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill-heading { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 5px; }
  .skill-card { gap: 5px; padding: 5px 6px; }
  .skill-card .skill-detail { font-size: .79rem; }
  #guild-skills .skill-heading { grid-template-columns: 24px minmax(0, 1fr); min-height: 2.2em; }
  #guild-skills .skill-label > strong { font-size: .79rem; }
  .sheet-body:has(#sheet-discoveries:not([hidden])) { height: clamp(185px, calc(100dvh - 134px), 550px); }
  #sheet-discoveries {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .discovery-preview {
    max-height: min(54dvh, 385px);
    border-inline-start: 0;
    border-block-start: 1px solid var(--sheet-edge);
  }
  .discovery-catalog, .discovery-preview { padding: 8px 10px; }
}
@media (max-width: 350px) {
  .sheet-tabs button { font-size: .7rem; }
  #item-inspection .item-card-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .worn-items .item-tile-name { font-size: .72rem; }
  #sheet-skills { padding-block: 6px; }
  #class-ability { grid-template-columns: minmax(0, 1fr); }
  #sheet-skills h3 { font-size: 1rem; }
  .bag-items .item-tile { grid-template-rows: 37px 2.4em; }
  .ammo-items { column-gap: 4px; }
  .ammo-items li { padding-inline: 3px; }
  .ammo-items img, #hero-sheet .ammo-items svg { width: 16px; height: 16px; }
  .ammo-items .asset-picture { inline-size: 16px; block-size: 16px; }
  #aptitudes .skill-label > strong { font-size: .8rem; }
}
@media (width > 560px) and (max-height: 480px) {
  .sheet-header { grid-template-columns: 42px minmax(0, 1fr) auto auto; padding-block: 8px; }
  .sheet-body [role="tabpanel"] { padding-block: 10px; }
  #sheet-discoveries { padding: 0; }
  .party-roster { --party-model-height: clamp(148px, 45dvh, 194px); }
  .equipment-preview { height: clamp(150px, 43dvh, 198px); }
  .worn-items .item-tile { min-height: 70px; }
  .bag-items .item-tile { grid-template-rows: 46px 2.4em; }
}

/* Character creation */
@font-face {
  font-family: PT Serif;
  src: url("/fonts/PTSerif-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
.creator-active .game-header { display: none; }
#welcome {
  --gold: #edc082;
  --light: #ffeed5;
  --quiet: #d1b79d;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  grid-template-rows: auto 1fr;
  width: min(100%, 1140px);
  min-height: clamp(540px, 87svh, 720px);
  margin: auto;
  border: 1px solid #795b43;
  border-radius: 16px;
  overflow: clip;
  background: #221912;
  color: var(--light);
  box-shadow: 0 16px 48px #10090799, 0 0 0 4px #2c2119;
}
#welcome :focus-visible { outline-color: #f4cf92; }
.welcome-brand {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px clamp(12px, 3vw, 24px);
  border-bottom: 1px solid #795b43;
}
.welcome-brand img {
  display: block;
  width: clamp(100px, 20vw, 164px);
  height: auto;
}
.creator-preview {
  position: relative;
  isolation: isolate;
  background: radial-gradient(ellipse at 50% 55%, #503a28, #241c17 73%);
  min-height: 440px;
}
.creator-preview::after {
  pointer-events: none;
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(#241a13b3, transparent 24%, transparent 76%, #241a13b3);
  z-index: 1;
}
#creator-portrait {
  pointer-events: none;
  position: absolute;
  z-index: 2;
  top: .85rem;
  left: .85rem;
  border-radius: 50%;
  border: 1px solid #b58755;
  object-fit: cover;
  background: #34271f;
}
#creator-scene, .creator-drag { position: absolute; inset: 68px 0 22px; width: 100%; height: calc(100% - 90px); border: 0; }
#creator-scene { pointer-events: none; opacity: 0; }
#creator-scene.creator-ready { opacity: 1; }
@media (prefers-reduced-motion: no-preference) { #creator-scene { transition: opacity .2s ease; } }
.creator-drag { z-index: 2; cursor: grab; touch-action: pan-y; }
.creator-drag:active { cursor: grabbing; }
.creator-drag:focus-visible { outline-offset: -5px; border-radius: 8px; }
.creator-loading {
  position: absolute;
  inset: 48% 1rem auto;
  text-align: center;
  color: var(--quiet);
}
#welcome button:not(.creator-submit) {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: .45rem .68rem;
  border: 1px solid #735640;
  border-radius: 8px;
  background: #352922;
  color: var(--light);
  box-shadow: none;
}
#welcome button:not(:disabled):hover { border-color: #d6a76c; }
#welcome button[aria-pressed="true"] {
  border-color: var(--gold);
  background: #5c3e28;
  color: #fff2dc;
}
#welcome button:disabled { opacity: .45; }
.creator-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(16px, 3vw, 30px);
  border-left: 1px solid #694b34;
  background: linear-gradient(155deg, #38271b, #221912 62%);
}
.creator-editor-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.creator-profiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.creator-sections { flex: 1; display: flex; align-items: center; gap: 4px; }
#welcome .creator-sections button { flex: 1; padding-inline: 5px; font-size: .9rem; }
.creator-options { flex: 1; }
.creator-option { margin: 0 0 12px; min-width: 0; border: 0; padding: 0; }
.creator-option legend, .creator-footer label {
  margin-bottom: 6px;
  color: var(--quiet);
  font-size: .9rem;
  font-weight: 650;
}
#creator-build legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.creator-values { display: flex; flex-wrap: wrap; gap: 6px; }
.creator-values button { flex: 1 1 auto; }
.creator-values.colors button { flex: 0 0 44px; }
.creator-values.colors span {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 1px solid #ffead480;
  background: var(--swatch);
}
.creator-details { border-top: 1px solid #624632; color: var(--quiet); }
.creator-details summary { min-height: 44px; padding: .7rem 0; }
.creator-footer { display: grid; gap: 12px; }
.creator-footer label { display: block; }
.creator-footer input {
  min-height: 44px;
  border: 1px solid #8e674b;
  padding: 6px 50px 6px 12px;
  background: #211812;
  color: var(--light);
}
.creator-footer input::placeholder { color: #b8a18a; }
#creator-error { color: #ffb7a3; }
#creator-error:empty { display: none; }
.creator-submit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border: 1px solid #f1ce96;
  background: #eac089;
  color: #301d10;
  font-weight: 800;
}
.creator-submit:hover:not(:disabled) { background: #f6d29f; color: #301d10; }
@media (max-width: 700px) {
  #welcome { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; margin: 8px auto; }
  .creator-preview { min-height: clamp(355px, 56svh, 490px); }
  .creator-editor { border-left: 0; border-top: 1px solid #694b34; }
}

.catalog-creator .creator-cards img { object-fit: contain; background: #30241e; }

.creator-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
#creator-style .creator-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#welcome .creator-cards button {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  min-width: 0;
  padding: 0;
  background: #2e2119;
  text-align: center;
  font-size: .81rem;
  font-weight: 650;
}
.creator-cards img {
  display: block;
  width: 100%;
  aspect-ratio: 1.36;
  object-fit: cover;
  object-position: center 10%;
  background: #38271f;
}
.creator-builds img { aspect-ratio: 1; object-position: center; }
.creator-cards button span { padding: 6px 3px; }
#welcome .creator-cards button[aria-pressed="true"] {
  border-color: var(--gold);
  background: #553923;
  box-shadow: 0 0 0 1px var(--gold);
}
.creator-cards button[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 100%;
  background: var(--gold);
  color: #2a1b11;
  line-height: 1;
}

:where(.auth-gate, #welcome, #settings-dialog) {
  --guild-brass: #bd9256;
  --guild-edge: #785737;
  --guild-ivory: #ffedc5;
  --guild-quieter: #dfc7a3;
  --guild-wood: url("/art/branding/guild-wood.webp");
  --guild-paper: url("/art/branding/guild-paper.webp");
  --guild-title: "PT Serif", Georgia, serif;
}

body.auth-active {
  background:
    linear-gradient(90deg, #1c1a1370, #1c1a131f 28%, #1b1c14b8 68%, #1c1812ed),
    linear-gradient(0deg, #1b1710ed 0%, transparent 33%, transparent 79%, #1719139c),
    #2c2e21 url("/art/branding/orakulovo-gate.webp") 42% 48% / cover no-repeat;
}
.auth-active .game-header { display: none; }
.auth-gate:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(350px, 425px);
  align-items: center;
  gap: clamp(2rem, 7vw, 7.25rem);
  width: min(calc(100% - 3rem), 1160px);
  min-height: calc(100svh - 20px);
  margin: 0 auto;
  padding-block: clamp(2.8rem, 10vh, 6rem);
}
.auth-landscape { display: grid; justify-items: center; gap: 1.15rem; }
.auth-brand {
  display: block;
  width: min(100%, 540px);
  height: auto;
  filter: drop-shadow(0 7px 9px #1d1209de);
}
.auth-place {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #ffebbd;
  font: 700 1.1rem/1.2 var(--guild-title);
  text-shadow: 0 2px 4px #21170d;
}
.auth-place::before, .auth-place::after {
  content: "";
  width: 1.6rem;
  height: 1px;
  background: #d1a261;
}
.auth-page {
  --rivet: radial-gradient(circle, #f5cf85 0 1px, #704824 1.5px 2.5px, transparent 3px);
  position: relative;
  color: var(--guild-ivory);
  padding: clamp(1.55rem, 4vw, 2.5rem);
  border: 1px solid #c29b61;
  border-radius: 3px;
  background:
    var(--rivet) left 7px top 7px / 8px 8px no-repeat,
    var(--rivet) right 7px top 7px / 8px 8px no-repeat,
    var(--rivet) left 7px bottom 7px / 8px 8px no-repeat,
    var(--rivet) right 7px bottom 7px / 8px 8px no-repeat,
    linear-gradient(154deg, #2b2118d9, #201811ea), var(--guild-wood) 0 0 / 210px repeat #272017;
  box-shadow: inset 0 0 0 6px #2e2118, inset 0 0 0 7px #9f79476e,
              0 0 0 4px #2a2117, 0 18px 44px #130e09c2;
}
.auth-heading {
  display: flex;
  align-items: center;
  gap: .72rem;
  padding: 0 0 .75rem;
  border-bottom: 1px solid var(--guild-edge);
  margin-bottom: .7rem;
}
.auth-heading svg, .auth-submit svg {
  width: 23px;
  height: 23px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-heading svg { color: #dfaf68; }
.auth-heading h2 {
  color: var(--guild-ivory);
  font: 700 clamp(1.55rem, 3.1vw, 2.15rem)/1.12 var(--guild-title);
}
.auth-form { display: grid; gap: .58rem; }
.auth-form label {
  color: var(--guild-quieter);
  font: 700 .94rem/1.25 var(--guild-title);
}
.auth-form p { color: var(--guild-quieter); font-size: .9rem; }
.auth-field {
  padding: 3px;
  background: #180f0b;
  border: 1px solid #876740;
}
.auth-form input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #624428;
  border-radius: 1px;
  padding: .52rem .7rem;
  color: #352219;
  font: 1.03rem/1.4 Georgia, serif;
  background: linear-gradient(#f9e9c7e0, #e8d0a7d9), var(--guild-paper) 0 0 / 150px repeat;
  box-shadow: inset 0 2px 5px #68411930;
}
.auth-form[data-step="code"] input {
  font: 700 1.25rem/1.4 ui-monospace, monospace;
  letter-spacing: .35em;
}
.auth-form input:focus { outline: 1px solid #503d26; outline-offset: -3px; }
.auth-field:focus-within { border-color: #efbf73; box-shadow: 0 0 0 1px #a97e49; }
.auth-form input[aria-invalid="true"] { border-color: #914c35; }
.auth-form #auth-error[data-tone="error"] { color: #ffbf9f; }
.auth-form [role="status"]:empty { display: none; }
.auth-submit, #welcome .creator-submit {
  min-height: 46px;
  border: 1px solid #c79b61;
  border-radius: 2px;
  color: #342215;
  background:
    linear-gradient(180deg, #f0c98aea, #c19155ee), var(--guild-wood) 0 0 / 180px repeat;
  box-shadow: inset 0 0 0 2px #653f2833, 0 2px 0 #1a130e;
  font: 700 1rem/1.2 var(--guild-title);
  text-shadow: 0 1px #f5d795;
}
.auth-submit {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .55rem;
  padding: .55rem .8rem;
  margin-top: .35rem;
}
.auth-submit:hover:not(:disabled), #welcome .creator-submit:hover:not(:disabled) { background-color: #f1c184; filter: brightness(1.1); }
.auth-form[aria-busy="true"] .auth-submit { opacity: .72; }
.auth-options { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem .65rem; }
.auth-options button {
  min-height: 44px;
  padding: .4rem 0;
  border: 0;
  background: transparent;
  color: #f3cb8e;
  font: 700 .86rem/1.25 var(--guild-title);
  text-align: start;
}
.auth-options button:hover { text-decoration: underline; text-underline-offset: .25em; }
.auth-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  border-top: 1px solid var(--guild-edge);
  margin-top: 1.35rem;
  padding-top: .75rem;
}
.language-switch { display: flex; gap: .3rem; }
.language-switch button, #welcome .language-switch button, .auth-tools .menu-sound,
#welcome .creator-tools button, .account-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .36rem;
  min-height: 44px;
  min-width: 44px;
  padding: .32rem .48rem;
  border: 1px solid var(--guild-edge);
  border-radius: 2px;
  color: var(--guild-quieter);
  background: linear-gradient(#443224, #2b2019);
  box-shadow: inset 0 -2px #150e0a75;
  font: 700 .78rem/1 var(--guild-title);
}
.language-switch button[aria-pressed="true"], #welcome .language-switch button[aria-pressed="true"],
.auth-tools .menu-sound[aria-pressed="true"] {
  color: var(--guild-ivory);
  border-color: var(--guild-brass);
  box-shadow: inset 0 -2px #be8b51;
}
.language-switch button:hover, .auth-tools .menu-sound:hover { border-color: #e3b679; }
.language-switch svg { width: 21px; height: 14px; }
.auth-tools .menu-sound, .creator-tools button { margin: 0; }
.menu-sound svg { width: 21px; height: 21px; }
.menu-sound[aria-pressed="false"] .sound-on,
.menu-sound[aria-pressed="true"] .sound-off { display: none; }
.auth-gate :focus-visible, .language-switch button:focus-visible {
  outline: 2px solid #ffe0a1;
  outline-offset: 2px;
}
.auth-form input:focus-visible { outline: 1px solid #503d26; outline-offset: -3px; }

#welcome {
  border-radius: 4px;
  border-color: var(--guild-brass);
  background: linear-gradient(#2d2319e8, #211911f2), var(--guild-wood) 0 0 / 210px repeat;
}
#welcome .creator-editor {
  background: linear-gradient(140deg, #3d2b1be9, #241a14f2), var(--guild-wood) 0 0 / 200px repeat;
}
#welcome button:not(.creator-submit) { border-radius: 3px; }
#welcome .creator-cards button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px #e2bf84; }
#welcome .creator-footer input, #welcome .creator-footer textarea {
  border-radius: 2px;
  border: 1px solid var(--guild-edge);
  color: var(--guild-ivory);
  background: #1f1712;
  font-family: Georgia, serif;
}
#welcome .creator-footer textarea { padding: .52rem .7rem; }
.settings-language {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .4rem .62rem;
}

@media (max-width: 760px) {
  body.auth-active {
    background:
      linear-gradient(0deg, #201811 2%, #201811cc 54%, #15181222 85%, #151812a3),
      #2c2e21 url("/art/branding/orakulovo-gate.webp") center top / auto min(75svh, 620px) no-repeat;
  }
  .auth-gate:not([hidden]) {
    grid-template-columns: minmax(0, 1fr);
    width: min(calc(100% - 1.35rem), 440px);
    min-height: 0;
    gap: 1.75rem;
    padding: clamp(1.1rem, 5vh, 2rem) 0 1.5rem;
  }
  .auth-landscape { gap: .8rem; }
  .auth-brand { width: min(80%, 310px); }
}
.account-logout, .menu-sound { display: block; margin: .35rem .65rem .35rem auto; }
.menu-sound { min-height: 44px; padding-inline: .8rem; }
.menu-sound[hidden] { display: none; }
.account-logout[hidden] { display: none; }
.hero-patron { display: flex; align-items: center; gap: .4em; min-width: 0; color: #e0c8a4; font-size: .69rem; }
.hero-patron-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-patron-icon { display: inline-flex; flex: 0 0 auto; color: #d6c7a8; }
.hero-patron-icon svg { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.6; }
.hero-patron[data-disposition="helpful"] .hero-patron-icon { color: #f7d489; }
.hero-patron[data-disposition="harsh"] .hero-patron-icon { color: #e9a5aa; }
.hero-patron[data-disposition="mixed"] .hero-patron-icon { color: #cdb3e9; }
.creator-backstory textarea { display: block; width: 100%; resize: vertical; min-height: 5rem; }
.creator-backstory-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.creator-backstory-heading label { margin-bottom: 0; }
#welcome #generate-backstory {
  min-height: 44px;
  padding-inline: .4rem;
  background: transparent;
  color: #ebcca0;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: .24em;
  font-size: .82rem;
}
#backstory-hint { margin: .35rem 0 0; color: var(--quiet); font-size: .79rem; }
#welcome .creator-preview {
  background: radial-gradient(ellipse at 34% 23%, #82967e 0%, #496362 43%, #253538 82%);
}

.creator-tools { display: flex; align-items: center; gap: .28rem; }
#welcome .welcome-brand { flex-wrap: wrap; }
.account-logout { --guild-edge: #785737; --guild-quieter: #dfc7a3; }
.account-logout svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.creator-tools #account-logout span { display: none; }
#settings-dialog .account-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  margin: 0 0 0 auto;
  border: 1px solid #785737;
  border-radius: 3px;
  background: #382a1e;
  color: #f4d8b0;
}
#settings-dialog .account-logout:hover { background: #4b3929; }
.settings-account:not(:has(#account-logout:not([hidden]), #connection:not([data-tone="live"]))) { display: none; }
#settings-connection:not(:has(#connection:not([data-tone="live"]))) { display: none; }
.creator-flat-preview .creator-preview {
  background: linear-gradient(#27211877, #302217a5), url("/art/branding/orakulovo-gate.webp") center / cover;
  min-height: clamp(255px, 42svh, 420px);
}
.creator-flat-preview .creator-loading { inset: auto 1rem 1.15rem; text-shadow: 0 1px 4px #1b130c; }
#settings-dialog .settings-header {
  background: linear-gradient(#413021dd, #302419ee), var(--guild-wood) 0 0 / 180px repeat;
}
#settings-dialog .settings-header h2 { font-family: var(--guild-title); }
#settings-dialog .settings-section { border-radius: 3px; }

#welcome {
  align-items: start;
  grid-template-rows: auto auto;
  min-height: 0;
}
#welcome .creator-preview {
  min-height: 0;
  height: clamp(390px, 62svh, 540px);
  background:
    linear-gradient(180deg, #2b2018aa, transparent 32%, #2b201871),
    url("/art/branding/orakulovo-gate.webp") center / cover;
}
#creator-scene, .creator-drag { inset: 0; height: 100%; }
.creator-loading {
  inset: auto 1rem 1.2rem;
  z-index: 2;
  padding: .45rem .65rem;
  width: fit-content;
  margin-inline: auto;
  color: #ffebc4;
  background: #261c13e8;
  border: 1px solid #977349;
  border-radius: 2px;
}
#welcome .creator-frame {
  position: absolute;
  right: .9rem;
  bottom: .85rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: .45rem;
  padding-inline: .65rem;
  font-size: .83rem;
  background: #2f2117ed;
}
.creator-frame svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
#welcome .creator-editor {
  min-width: 0;
  gap: 11px;
  padding: clamp(.8rem, 2.4vw, 1.4rem);
}
.creator-options {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.creator-options > div { grid-area: 1 / 1; min-width: 0; }
.creator-options > div[hidden] { display: block !important; visibility: hidden; }
.creator-option { margin-bottom: 9px; }
.creator-option legend { width: 100%; }
.creator-selection {
  float: inline-end;
  margin-inline-start: .35rem;
  color: #f3dba9;
  font-weight: 550;
}
#welcome .creator-portraits, #creator-style .creator-portraits {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}
#welcome .creator-portraits button {
  min-width: 0;
  grid-template-rows: 1fr;
}
.creator-portraits img { aspect-ratio: 1; max-height: 59px; object-fit: cover; }
.creator-portraits img:not([hidden]) + span { display: none; }
.creator-builds img { height: clamp(52px, 10svh, 80px); aspect-ratio: auto; object-fit: contain; }
.creator-cards button span { padding-block: 4px; }
.creator-footer { gap: 7px; border-top: 1px solid #725337; padding-top: .6rem; }
.creator-submit { min-height: 44px; padding: .4rem .65rem; }
@media (min-width: 701px) {
  #welcome .creator-preview { align-self: stretch; height: auto; min-height: clamp(410px, 70svh, 640px); }
}
@media (max-width: 700px) {
  #welcome { grid-template-rows: auto; }
  #welcome .welcome-brand { gap: .15rem .55rem; padding-block: .35rem; }
  #welcome .welcome-brand > .brand-mark { width: clamp(72px, 20vw, 100px); }
  #welcome .creator-preview { height: clamp(210px, 31svh, 275px); }
  #creator-portrait { width: 44px; height: 44px; top: .55rem; left: .55rem; }
  #welcome .creator-editor { gap: 8px; }
  #welcome .creator-frame { right: .55rem; bottom: .55rem; }
  #welcome .creator-sections button { padding-inline: .22rem; font-size: .8rem; }
}

#app-build {
  position: fixed;
  z-index: 6;
  right: max(.4rem, env(safe-area-inset-right));
  bottom: max(.3rem, env(safe-area-inset-bottom));
  padding: .08rem .28rem;
  color: #dfccac;
  background: #201912dc;
  border-radius: 2px;
  font-size: .68rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

:root[data-mobile-hud] {
  .layout {
    --mobile-pad-size: 156px;
    --mobile-bottom: max(8px, env(safe-area-inset-bottom));
    --mobile-right: max(8px, env(safe-area-inset-right));
    --mobile-left: max(8px, env(safe-area-inset-left));
    --hud-edge: 8px;
  }
  .hero-hud { width: min(43vw, 160px); }
  .hero-card { --portrait-size: 44px; }
  .hero-hud :is(.hero-class, .hero-patron, .hero-experience, .activity, .party-frames),
  #app-build, #party-interactions { display: none; }
  .hero-status { inset-inline-end: -7px; }
  .target-panel { max-width: 160px; }
  .navigation-hud { --radar-size: 44px; width: min(49vw, 172px); }
  .navigation-map {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    min-height: 44px;
  }
  .navigation-map :is(.map-action, #map-weather, #map-clock, .radar-trigger) {
    position: static;
    width: 44px;
    height: 44px;
    transform: none;
  }
  .navigation-map .radar-trigger { position: relative; }
  .navigation-map .radar-north, .navigation-map .radar-expand { display: none; }
  .navigation-map > :is(#map-weather, #honor-open, #quest-heading) { display: none; }
  .navigation-map .map-detail { inset: calc(100% + 4px) 0 auto auto; }
  .navigation-hud .location { width: 100%; margin: 0; font-size: .78rem; }
  .navigation-hud .quest-tracker, .stage-events .event-dock { display: none; }
  .active-effects {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 3px;
    width: auto;
    max-width: 100%;
    max-height: 6.2rem;
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .active-effect .effect-trigger, .active-effect-more button {
    display: grid;
    place-items: center;
    width: 44px;
    min-height: 44px;
    padding: 0;
    background: #27241df2;
  }
  .active-effect .effect-trigger :is(.effect-name, .effect-remaining) { display: none; }
  #effect-tooltip { max-width: calc(100vw - 16px); }
  .layout .influence { display: none; }
  .layout[data-mobile-influence] .influence {
    --sign-size: 44px;
    position: fixed;
    inset: auto var(--mobile-right) calc(var(--mobile-bottom) + var(--mobile-pad-size) + 8px) auto;
    display: grid;
    grid-template-columns: repeat(4, var(--sign-size));
    justify-content: space-between;
    gap: 4px;
    box-sizing: border-box;
    width: min(230px, calc(100vw - var(--mobile-right) - var(--mobile-left)));
    margin-top: 0;
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 6px 22px #17120ec9;
  }
  .influence-meters {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
  }
  .influence-meters label { grid-row: 1; }
  .influence-meters meter { grid-row: 2; }
  .arena-summary { margin-top: 0; padding-top: 3px; }
  .layout .possession-overlay,
  .layout:has(.hud-context > :not([hidden])) .possession-overlay {
    right: var(--mobile-right);
    bottom: var(--mobile-bottom);
    z-index: 3;
  }
  .mobile-pad {
    display: grid;
    grid-template: repeat(3, 48px) / repeat(3, 48px);
    grid-template-areas: ". character ." "journal center influence" ". quests .";
    gap: 6px;
    align-items: center;
    justify-items: center;
    pointer-events: auto;
  }
  .mobile-pad > i {
    grid-area: center;
    width: 28px;
    height: 28px;
    border: 1px solid #9b774d;
    border-radius: 5px;
    background: radial-gradient(circle, #5c4a32, #2c251b);
    box-shadow: inset 0 0 0 3px #2d241c;
    transform: rotate(45deg);
    pointer-events: none;
  }
  .mobile-pad button {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 2px;
    width: 48px;
    height: 48px;
    padding: 0 1px;
    border: 1px solid #ab8955;
    border-radius: 10px;
    color: #ffe8b5;
    background: linear-gradient(#403322, #271f17);
    box-shadow: 0 2px 6px #170f09a8;
    font: 550 .55rem/1 system-ui, sans-serif;
  }
  .mobile-pad button[aria-expanded="true"] { color: #2a2018; background: #e2c28c; }
  .mobile-pad button:focus-visible { outline: 2px solid #ffebbf; outline-offset: 2px; }
  .mobile-pad svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; }
  #mobile-character { grid-area: character; }
  #mobile-journal { grid-area: journal; }
  #mobile-influence { grid-area: influence; }
  #mobile-quests { grid-area: quests; }
  .layout .hud-bottom {
    inset: auto var(--mobile-right) calc(var(--mobile-bottom) + var(--mobile-pad-size) + 6px) var(--mobile-left);
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
    gap: 4px;
  }
  .layout .hud-bottom:has(#journal:not([hidden])) .hud-context,
  .layout[data-mobile-influence] .hud-context { display: none; }
  .layout .stage-events { margin-inline: 0; }
  .layout .hud-context { grid-row: 1; max-height: min(24dvh, 148px); pointer-events: none; }
  .layout .hud-context > * { pointer-events: auto; }
  #scene-dialogue {
    align-self: flex-end;
    box-sizing: border-box;
    inline-size: min(45vw, 22rem);
    height: auto;
  }
  #scene-dialogue .dialogue-scroll { height: auto; max-height: min(23dvh, 8rem); padding: 6px 8px; }
  #scene-dialogue .dialogue-speaker { gap: 5px; padding-bottom: 3px; }
  #scene-dialogue .dialogue-avatar { flex-basis: 26px; width: 26px; height: 26px; }
  #scene-dialogue .dialogue-character { display: none; }
  #dialogue-speaker, #dialogue-line { font-size: .75rem; }
  #dialogue-line { margin-top: 4px; line-height: 1.32; }
  .layout:has(#journal:not([hidden])) .hud-bottom { z-index: 6; }
  .layout #journal {
    position: fixed;
    inset: env(safe-area-inset-top) env(safe-area-inset-right)
      env(safe-area-inset-bottom) env(safe-area-inset-left);
    width: auto;
    min-height: 0;
    max-height: none;
    border-radius: 0;
  }
}
