@font-face { font-family: "Grenze"; src: url("fonts/grenze.woff") format("woff"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --ink: #1a1620;        /* page */
  --vellum: #251f2e;     /* cards, rows */
  --raised: #30283b;     /* controls */
  --line: #3e344b;
  --bone: #ece3d2;       /* text */
  --ash: #ab9fb6;        /* secondary text */
  --tadpole: #e883b4;    /* warnings: things you can miss */
  --moss: #a3c178;       /* act one */
  --moon: #a3b6f2;       /* act two */
  --brass: #e6ac62;      /* act three */
  --act: var(--moss);
  --display: "Grenze", "Iowan Old Style", Georgia, serif;
  --text: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --rail: 232px;
}
[data-act="2"] { --act: var(--moon); }
[data-act="3"] { --act: var(--brass); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font: 400 17px/1.45 var(--text);
  font-variant-numeric: lining-nums;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- frame ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.rail { display: none; }
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { min-width: 0; flex: 1; }
.brand-name { font: 600 25px/1 var(--display); letter-spacing: 0.01em; }
.brand-sub { display: block; color: var(--ash); font-size: 14.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.acts { display: flex; gap: 4px; padding: 3px; background: var(--vellum); border: 1px solid var(--line); border-radius: 999px; }
.acts button {
  min-width: 44px; height: 38px; padding: 0 10px; border-radius: 999px; text-align: center;
  font: 500 20px/1 var(--display); color: var(--ash);
}
.acts button[aria-pressed="true"] { background: var(--act); color: var(--ink); font-weight: 700; }

.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--ash); }
.icon-btn:hover { color: var(--bone); background: var(--vellum); }
svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

#view { flex: 1; width: 100%; max-width: 780px; margin: 0 auto; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(8, 1fr);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--vellum) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tabbar button { display: grid; justify-items: center; gap: 1px; padding: 7px 0 5px; border-radius: 10px; color: var(--ash); font-size: 11.5px; min-width: 0; line-height: 1.2; }
.tabbar button[aria-current="page"] { color: var(--act); }

/* ---------- headings ---------- */
.title { font: 600 34px/1.05 var(--display); letter-spacing: 0.005em; }
.title + .lede { margin-top: 6px; }
.lede { color: var(--ash); max-width: 60ch; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 16px; margin-bottom: 18px; }
.group { margin-top: 28px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--act); }
.group-head h3 { font: 500 23px/1.1 var(--display); }
.count { color: var(--ash); font-size: 15px; font-variant-numeric: tabular-nums lining-nums; }

.meter { height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--act); border-radius: 2px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 16px; border-radius: 8px;
  background: var(--raised); border: 1px solid var(--line); font-weight: 500;
}
.btn:hover { border-color: var(--ash); }
.btn.primary { background: var(--act); border-color: var(--act); color: var(--ink); font-weight: 700; }
.btn.danger { color: var(--tadpole); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link { color: var(--act); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg button { min-height: 38px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ash); font-size: 15.5px; }
.seg button[aria-pressed="true"] { background: var(--raised); border-color: var(--act); color: var(--bone); font-weight: 500; }

input:not([type]), input[type="text"], input[type="password"], input[type="search"], input[type="number"], textarea, select {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  background: var(--ink); border: 1px solid var(--line); color: var(--bone);
}
textarea { min-height: 76px; resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--ash) 70%, transparent); }
label.field { display: block; }
label.field > span, .field-label { display: block; margin-bottom: 4px; color: var(--ash); font-size: 14.5px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tools input[type="search"] { flex: 1 1 180px; width: auto; }

/* ---------- rows (quests, loot, bonuses) ---------- */
.rows > li { display: grid; grid-template-columns: 48px 1fr; border-bottom: 1px solid var(--line); }
.mark { grid-column: 1; display: grid; place-items: center; min-height: 54px; align-self: start; color: var(--ash); }
.mark svg { width: 24px; height: 24px; }
.mark .shape { fill: none; stroke: currentColor; stroke-width: 1.6; }
.mark .fill, .mark .tick, .mark .cross { opacity: 0; }
.s1 .mark, .s2 .mark { color: var(--act); }
.s1 .mark .fill.half { opacity: 1; fill: currentColor; }
.s2 .mark .fill.full { opacity: 1; fill: currentColor; }
.s2 .mark .tick { opacity: 1; stroke: var(--ink); stroke-width: 2; fill: none; }
.s3 .mark .cross { opacity: 1; stroke: currentColor; stroke-width: 1.6; }
.row-main { grid-column: 2; display: block; width: 100%; padding: 12px 30px 12px 0; position: relative; }
.row-main::after {
  content: ""; position: absolute; right: 8px; top: 23px; width: 8px; height: 8px;
  border-right: 1.6px solid var(--ash); border-bottom: 1.6px solid var(--ash); transform: rotate(45deg); transform-origin: 70% 70%;
}
.open > .row-main::after { transform: rotate(225deg); }
.row-name { display: block; font: 500 20px/1.2 var(--display); }
.s2 .row-name { color: var(--ash); }
.s3 .row-name { color: var(--ash); text-decoration: line-through; text-decoration-thickness: 1px; }
.row-why { display: block; color: var(--ash); font-size: 16px; line-height: 1.3; margin-top: 2px; }
.row-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 3px; color: var(--ash); font-size: 14.5px; }
.tag-miss { color: var(--tadpole); }
.tag-near { display: inline-block; vertical-align: middle; margin-right: 6px; padding: 1px 7px; border: 1px solid var(--act); border-radius: 999px; color: var(--act); font: 600 12px/1.4 var(--text); letter-spacing: .04em; text-transform: uppercase; }
.sub-head { margin: 16px 0 2px; color: var(--ash); font-size: 14px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.sheet .note + .note { margin-top: 6px; }
.tag-miss::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; background: currentColor; transform: rotate(45deg) translateY(-1px); }
.rar::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--rar, var(--ash)); }
.rar-uncommon { --rar: #6fcf73; } .rar-rare { --rar: #6aa9f5; } .rar-very-rare { --rar: #e37fd0; } .rar-legendary { --rar: #e9b44c; } .rar-story { --rar: #ef8d5a; }
.row-body { grid-column: 2; padding: 2px 8px 18px 0; display: grid; gap: 14px; }
.sealed-name { display: inline-flex; align-items: center; gap: 8px; color: var(--ash); font-style: italic; font-family: var(--text); font-size: 17px; font-weight: 400; }
.sealed-name::before { content: ""; width: 72px; height: 13px; border-radius: 2px; background: var(--bone); opacity: .82; transform: skewX(-8deg); }

/* ---------- hidden details ---------- */
.secret-label { display: block; color: var(--ash); font-size: 14.5px; margin-bottom: 4px; }
.secret.warn .secret-label { color: var(--tadpole); }
.redact {
  display: grid; gap: 6px; width: 100%; max-width: 460px; padding: 10px 12px;
  border: 1px dashed var(--line); border-radius: 8px; position: relative;
}
.redact i { display: block; height: 13px; border-radius: 2px; background: var(--bone); opacity: .82; transform: skewX(-8deg); }
.redact span { position: absolute; right: 10px; bottom: 7px; padding: 1px 8px; border-radius: 999px; background: var(--ink); color: var(--act); font-size: 14px; font-weight: 500; }
.redact:hover { border-color: var(--act); }
.secret-text { max-width: 62ch; animation: wipe .35s ease-out; }
.secret-text .link { margin-left: 6px; white-space: nowrap; }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.options { display: grid; gap: 6px; max-width: 520px; animation: wipe .35s ease-out; }
.options button { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--ink); }
.options button::before { content: ""; flex: none; width: 12px; height: 12px; border: 1.6px solid var(--ash); transform: rotate(45deg); }
.options button[aria-pressed="true"] { border-color: var(--act); }
.options button[aria-pressed="true"]::before { background: var(--act); border-color: var(--act); }

/* ---------- cards ---------- */
.card { background: var(--vellum); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.cards { display: grid; gap: 12px; }
.card h3 { font: 500 23px/1.15 var(--display); }
.card-sub { color: var(--ash); font-size: 15.5px; }
.stack { display: grid; gap: 14px; }
.card .stack { margin-top: 12px; }
.card-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; }

.level { flex: none; display: grid; justify-items: center; min-width: 54px; padding: 4px 8px 6px; border: 1px solid var(--act); border-radius: 10px; }
.level b { font: 600 30px/1 var(--display); color: var(--act); }
.level small { font-size: 12.5px; color: var(--ash); line-height: 1.1; }
.name-input { font: 500 23px/1.15 var(--display) !important; padding: 2px 0 !important; border: 0 !important; border-bottom: 1px dashed var(--line) !important; border-radius: 0 !important; background: none !important; }
.name-input::placeholder { color: var(--bone); opacity: 1; }
.name-input:focus { outline: none; border-bottom-color: var(--act) !important; }

.save-card { border-color: var(--act); }
.save-shot { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 8px; margin-bottom: 12px; background: var(--ink); }
.score { color: var(--bone); font-weight: 500; }
.save-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: 16px; }
.save-facts dt { color: var(--ash); }
.save-facts dd { margin: 0; overflow-wrap: anywhere; }
.path { display: block; padding: 8px 10px; background: var(--ink); border-radius: 6px; font-size: 14.5px; color: var(--ash); overflow-wrap: anywhere; user-select: all; }
.note { color: var(--ash); font-size: 15.5px; max-width: 62ch; }
.empty { padding: 26px 16px; text-align: center; color: var(--ash); border: 1px dashed var(--line); border-radius: 12px; }
.drop-on .save-card { outline: 2px dashed var(--act); outline-offset: 4px; }

.check { display: grid; grid-template-columns: 28px 1fr; gap: 6px; align-items: start; padding: 7px 0; width: 100%; }
.check::before { content: ""; width: 18px; height: 18px; margin-top: 3px; border: 1.6px solid var(--ash); border-radius: 4px; }
.check[aria-pressed="true"] { color: var(--ash); }
.check[aria-pressed="true"]::before { background: var(--act) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4 9.5l3.2 3L14 5.5' fill='none' stroke='%231a1620' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain; border-color: var(--act); }

.tier { display: grid; gap: 4px; }
.tier input[type="range"] { width: 100%; accent-color: var(--act); height: 28px; }
.tier-read { display: flex; justify-content: space-between; gap: 10px; }
.tier-read b { font-weight: 500; }

.entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.entry-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--ash); font-size: 14.5px; }
.entry p { white-space: pre-wrap; max-width: 65ch; }

.banner { margin-bottom: 16px; padding: 10px 14px; border: 1px solid var(--tadpole); border-radius: 8px; color: var(--tadpole); }

/* ---------- settings sheet, toast ---------- */
dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--vellum); color: var(--bone); }
dialog::backdrop { background: rgba(10, 7, 14, .7); }
.sheet { padding: 20px; display: grid; gap: 22px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet h2 { font: 600 28px/1 var(--display); }
.sheet h3 { font: 500 21px/1.1 var(--display); margin-bottom: 8px; }
.switch { display: flex; align-items: start; gap: 12px; }
.switch input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--act); flex: none; }

.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: var(--bone); color: var(--ink); font-weight: 500; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.toast.bad { background: var(--tadpole); }

/* ---------- wide screens ---------- */
@media (min-width: 900px) and (min-height: 501px) {
  .shell { flex-direction: row; }
  .tabbar, .bar .brand, .bar .icon-btn { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 26px; flex: none; width: var(--rail);
    position: sticky; top: 0; height: 100dvh; padding: 24px 14px 18px; border-right: 1px solid var(--line); background: var(--vellum);
  }
  .rail .brand { flex: none; padding: 0 8px; }
  .rail .brand-name { font-size: 32px; }
  .rail nav { display: grid; gap: 2px; }
  .rail nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 10px; border-radius: 8px; color: var(--ash); font-size: 18px; }
  .rail nav button:hover { color: var(--bone); }
  .rail nav button[aria-current="page"] { background: var(--raised); color: var(--bone); box-shadow: inset 3px 0 0 var(--act); }
  .rail .rail-foot { margin-top: auto; }
  .main { flex: 1; min-width: 0; }
  .bar { justify-content: flex-end; padding: 14px 32px; border-bottom: 0; background: none; backdrop-filter: none; position: static; }
  #view { max-width: 1080px; margin: 0; padding: 0 32px 64px; }
  .title { font-size: 44px; }
  .narrow { max-width: 760px; }
  .cards.two { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
  .toast { bottom: 28px; left: calc(50% + var(--rail) / 2); }
}
.main { display: flex; flex-direction: column; flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .secret-text, .options { animation: none; }
}
.live-line::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--act); box-shadow: 0 0 0 3px color-mix(in srgb, var(--act) 25%, transparent); }
.live-build { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.live-classes { font: 500 17px/1.3 var(--display); }
.hp span { font-size: 15px; }
.hp .meter { margin-top: 6px; }
.abilities { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; text-align: center; }
.abilities div { display: grid; justify-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 4px 0 5px; }
.abilities dt { font-size: 12px; color: var(--ash); text-transform: uppercase; letter-spacing: .05em; }
.abilities dd { font: 600 19px/1.1 var(--display); margin: 0; text-align: center; justify-self: center; }
.abilities small { display: block; font: 13px/1.1 var(--text); color: var(--ash); text-align: center; }
.live-part .link { font-size: 15px; }
.live-list { margin-top: 6px; display: grid; gap: 3px; font-size: 15px; max-height: 320px; overflow-y: auto; }
.inv-search { margin-top: 6px; width: 100%; }
.map-tools { margin-top: 12px; flex-wrap: wrap; }
.map-frame { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: color-mix(in srgb, var(--vellum) 70%, var(--ink, #120f17)); }
#map-svg { display: block; width: 100%; height: min(62vh, 560px); touch-action: none; cursor: grab; }
#map-svg .map-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
#map-svg .map-trail { fill: none; stroke: var(--act); stroke-opacity: .55; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
#map-svg .map-member circle { stroke: var(--vellum); stroke-width: 2; vector-effect: non-scaling-stroke; }
#map-svg text { fill: var(--bone); font-family: var(--text); paint-order: stroke; stroke: var(--vellum); stroke-linejoin: round; }
#map-svg .map-pin path { fill: var(--tadpole); stroke: var(--vellum); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#map-svg .map-scale { stroke: var(--ash); stroke-width: 2; vector-effect: non-scaling-stroke; }
#map-svg .map-scale-text { fill: var(--ash); }
.map-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 15px; }
.map-key li { display: flex; align-items: center; gap: 6px; }
.map-key i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--vellum); box-shadow: 0 0 0 1px var(--line); }
.answer { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.answer-q { font-style: italic; }
.answer-list { display: grid; gap: 6px; padding-left: 18px; list-style: disc; }
#ask-model { width: 100%; }
.map-arts { margin-top: 12px; }
#map-art-pick { width: 100%; }
#map-svg .map-art { image-rendering: auto; }
#map-svg:has(.map-art) .map-grid { stroke-opacity: .35; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips button { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: var(--ash); background: none; }
.chips button[aria-pressed="true"] { color: var(--bone); border-color: var(--act); background: color-mix(in srgb, var(--act) 18%, transparent); }
.player-head { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.emblem { width: 72px; height: 72px; flex: none; border-radius: 14px; object-fit: contain; background: var(--raised); padding: 6px; }
.ico { width: 56px; height: 56px; border-radius: 8px; display: block; object-fit: contain; }
.ico-big { width: 96px; height: 96px; border-radius: 12px; flex: none; object-fit: contain; }
.ico-empty { background: var(--raised); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 12px; }
.tiles-small { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.tile { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--raised) 50%, transparent); text-align: center; color: var(--bone); }
.tile[class*="rar-"] { border-color: color-mix(in srgb, var(--rar, var(--line)) 60%, var(--line)); }
.tile-free { opacity: .5; }
.tile-name { font-size: 13px; line-height: 1.2; }
.tile-slot { font-size: 11.5px; color: var(--ash); }
.tile-count { position: absolute; top: 4px; right: 6px; font-size: 12px; color: var(--ash); }
.item-top { display: flex; gap: 14px; align-items: center; }
#item-title.rar-uncommon, #item-title.rar-rare, #item-title.rar-very-rare, #item-title.rar-legendary, #item-title.rar-story { color: var(--rar); }
#item-title::before { display: none; }

/* ---------- dashboard ---------- */
.dash { display: grid; gap: 16px; }
.dash > .card { min-width: 0; }
.dash-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 1px solid var(--act); }
.dash-head h3 { font: 500 23px/1.1 var(--display); }
.dash-members { display: grid; gap: 4px; }
.dash-member { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 6px; border-radius: 10px; text-align: left; color: inherit; background: none; }
.dash-member:hover { background: var(--raised); }
.dash-member .emblem { width: 52px; height: 52px; border-radius: 12px; padding: 4px; }
.dash-who { display: grid; gap: 2px; flex: 1; min-width: 0; }
.dash-name { font: 600 18px/1.2 var(--display); }
.dash-hp { display: grid; gap: 3px; margin-top: 2px; }
.dash-hp span:first-child { font-size: 14px; color: var(--ash); }
.dash-hp .meter { margin-top: 0; height: 6px; }
.dash-hp.low .meter i { background: var(--tadpole); }
.dash-gear { display: flex; gap: 4px; flex: none; }
.dash-ico { width: 40px; height: 40px; border-radius: 8px; background: var(--raised); }
.dash-map .map-frame { margin-top: 6px; }
.dash-map #map-svg { height: min(48vh, 420px); }
.dash-map-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.dash-map-foot .map-key { margin-top: 0; }
.dash-map-foot .btn-row { margin-top: 0; }
@media (max-width: 599px) {
  .dash-member { align-items: flex-start; }
  .dash-member .emblem { width: 44px; height: 44px; }
  .dash-gear { flex-direction: column; }
  .dash-ico { width: 32px; height: 32px; }
}
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 15px; }
@media (min-width: 900px) and (min-height: 501px) {
  #view.wide { max-width: 1480px; }
  .dash { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: 'party map' 'quests map'; align-items: start; }
  .dash-party { grid-area: party; }
  .dash-map { grid-area: map; position: sticky; top: 16px; }
  .dash-quests { grid-area: quests; }
  .dash-map #map-svg { height: min(72vh, 760px); }
}
#map-svg .map-me-ring { fill: none; stroke: var(--bone); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
#map-svg .map-me circle:not(.map-me-ring) { stroke-width: 3; }
.dash-member.is-me { background: color-mix(in srgb, var(--act) 10%, transparent); }
/* ---------- account ---------- */
.callout { display: grid; gap: 8px; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--act); border-radius: 10px; background: color-mix(in srgb, var(--act) 8%, transparent); }
.callout code, .share-box code { word-break: break-all; }
.problem { color: var(--tadpole); }
.share-box { display: grid; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.share-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
/* ---------- sign-in screen ---------- */
.gate { position: fixed; inset: 0; z-index: 50; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); background: radial-gradient(ellipse at top, color-mix(in srgb, var(--act) 14%, var(--ink)) 0%, var(--ink) 60%); }
.gate-card { width: 100%; max-width: 440px; display: grid; gap: 10px; padding: 28px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--vellum); box-shadow: 0 24px 60px rgb(0 0 0 / .35); }
.gate-brand { font: 600 40px/1 var(--display); color: var(--bone); }
.gate-sub { color: var(--ash); margin-top: -4px; }
.gate .title { font-size: 28px; margin-top: 10px; }
.gate .btn-row .btn.primary { flex: 1; }
/* Lists of things to manage (playthroughs, gaming PCs, accounts): no status mark, nothing to open. */
.rows.plain > li { grid-template-columns: 1fr; }
.rows.plain .row-main { grid-column: 1; padding-right: 0; }
.rows.plain .row-main::after { display: none; }
.rows.plain .row-meta { flex-wrap: wrap; }
/* ---------- phones on their side ----------
 * Short and wide: the tabs become a slim strip down the left (clear of the notch), the top bar gets compact,
 * and the dashboard puts the map beside the party and quests, filling the height and staying in view. */
@media (orientation: landscape) and (max-height: 500px) {
  .shell { padding-left: calc(60px + env(safe-area-inset-left)); }
  .tabbar {
    top: 0; right: auto; width: calc(60px + env(safe-area-inset-left));
    grid-template-columns: 1fr; grid-template-rows: repeat(8, minmax(0, 1fr));
    padding: calc(4px + env(safe-area-inset-top)) 2px calc(4px + env(safe-area-inset-bottom)) calc(2px + env(safe-area-inset-left));
    border-top: 0; border-right: 1px solid var(--line);
  }
  .tabbar button { padding: 2px 0; font-size: 10px; align-content: center; }
  .tabbar .ic { width: 20px; height: 20px; }
  .bar { padding: calc(5px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 5px 14px; gap: 8px; }
  .brand-name { font-size: 20px; }
  .brand-sub { display: none; }
  .acts button { min-height: 32px; }
  .icon-btn { width: 36px; height: 36px; }
  #view, #view.wide { max-width: none; padding: 10px calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) 14px; }
  .title { font-size: 26px; }
  .head { margin-bottom: 10px; }
  .toast { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-areas: 'party map' 'quests map'; align-items: start; gap: 12px; }
  .dash-party { grid-area: party; }
  .dash-quests { grid-area: quests; }
  .dash > .card { padding: 12px; }
  .dash-head { margin-bottom: 4px; }
  .dash-head h3 { font-size: 19px; }
  .dash-map { grid-area: map; position: sticky; top: 56px; }
  .dash-map #map-status { display: none; }
  #map-svg { height: calc(100dvh - 76px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); } /* Map tab: a screenful once scrolled to */
  .dash-top { display: none; } /* the act is in the top bar, the area under the map, the link status in Settings */
  .dash-map { top: 64px; }
  .dash-map #map-svg { height: calc(100dvh - 176px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 160px; }
  /* the follow and zoom buttons float on the map's top corner, so the key fits on one line below it */
  .dash-map-foot .btn-row { position: absolute; top: 62px; right: 20px; gap: 6px; }
  .dash-map #map-near { position: absolute; top: 62px; left: 20px; right: 196px; margin: 0; padding: 4px 8px; border-radius: 8px; font-size: 12.5px; line-height: 1.3; background: color-mix(in srgb, var(--vellum) 82%, transparent); backdrop-filter: blur(6px); pointer-events: none; }
  .dash-map-foot .btn.small { min-height: 34px; padding: 4px 10px; background: color-mix(in srgb, var(--vellum) 82%, transparent); backdrop-filter: blur(6px); }
  .dash-map-foot { gap: 6px; }
  .dash-map-foot .map-key { font-size: 13px; gap: 2px 10px; }
  .dash-member { padding: 6px 4px; gap: 10px; }
  .dash-member .emblem { width: 40px; height: 40px; }
  .dash-ico { width: 30px; height: 30px; }
  .dash-gear { flex-direction: column; }
}
/* ---------- map markers ---------- */
:root { --foe: #ef5f5f; --loot: #f0c45c; --trader: #e6ac62; --quest: #f2d16b; }
#map-svg .mk-person { fill: var(--ash); fill-opacity: .75; stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
#map-svg .mk-trader { fill: var(--trader); stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#map-svg .mk-foe { fill: var(--foe); fill-opacity: .7; stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
#map-svg .mk-loot { fill: var(--loot); fill-opacity: .85; stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
#map-svg .mk-quest circle { fill: var(--quest); stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#map-svg .mk-quest text { fill: var(--ink); stroke: none; font-weight: 800; text-anchor: middle; font-family: var(--text); }
#map-svg .nk-npc { fill: var(--bone); stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#map-svg .nk-foe { fill: var(--foe); stroke: var(--bone); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#map-svg .nk-fight { fill: none; stroke: var(--foe); stroke-width: 2; vector-effect: non-scaling-stroke; animation: nk-pulse 1.4s ease-in-out infinite; }
#map-svg .nk-dead { stroke: var(--ash); stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
#map-svg .nk-loot { fill: var(--loot); stroke: var(--bone); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
@keyframes nk-pulse { 50% { stroke-opacity: .25; } }
@media (prefers-reduced-motion: reduce) { #map-svg .nk-fight { animation: none; } }
.map-layers { margin-top: 12px; }
.chips .sw { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: 0; border-radius: 50%; border: 1px solid var(--ink); }
.sw-near { background: var(--foe); box-shadow: 0 0 0 2px color-mix(in srgb, var(--foe) 35%, transparent); }
.sw-quests { background: var(--quest); }
.sw-traders { background: var(--trader); }
.sw-people { background: var(--ash); }
.sw-foes { background: var(--foe); border-radius: 2px !important; transform: rotate(45deg) scale(.85); }
.sw-loot { background: var(--loot); border-radius: 3px !important; }
.map-frame { position: relative; }
.map-info { position: absolute; left: 10px; right: 10px; bottom: 10px; display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: color-mix(in srgb, var(--vellum) 92%, transparent); backdrop-filter: blur(6px); font-size: 15px; box-shadow: 0 8px 24px rgb(0 0 0 / .35); }
.map-info[hidden] { display: none; }
.map-info span { color: var(--ash); }
#map-near { margin-top: 8px; }
.map-info { gap: 8px; }
.map-info-row { display: grid; gap: 2px; }
.map-info-row + .map-info-row { padding-top: 8px; border-top: 1px solid var(--line); }
.map-info-row .map-info-src { display: none; }
.map-info-row:last-child .map-info-src { display: block; font-size: 13px; }

/* Around you: names on the map and the key under it */
#map-svg .nk-label { fill: var(--bone); font-family: var(--text); paint-order: stroke; stroke: var(--vellum); stroke-linejoin: round; pointer-events: none; }
#map-svg .nk-label-foe { fill: var(--foe); font-weight: 700; }
#map-svg .nk-label-loot { fill: var(--loot); }
.near-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: var(--ash); }
.near-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.lg { display: inline-grid; place-items: center; width: 10px; height: 10px; border-radius: 50%; font-style: normal; flex: none; }
.lg-foe { background: var(--foe); box-shadow: 0 0 0 1.5px var(--bone); }
.lg-npc { background: var(--bone); box-shadow: 0 0 0 1.5px var(--ink); }
.lg-fight { border: 2px solid var(--foe); }
.lg-dead { width: auto; height: auto; color: var(--ash); font-weight: 700; font-size: 15px; line-height: 10px; }
.lg-loot { width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg); background: var(--loot); box-shadow: 0 0 0 1.5px var(--bone); }
