/* pbz-tracker page (web version). Dark "ink and paper" wuxia theme, no external resources: the paper grain, the
   brush strokes and the seal marks are inline SVG data URIs (CSP img-src allows data:), coloured through
   CSS masks so one shape serves every colour. System fonts only: a serif stack for headings (calligraphy feel),
   the sans stack for body text. Layout, class names and ARIA are unchanged from the plain theme. */

:root {
  color-scheme: dark;
  /* ink (backgrounds) */
  --bg: #15120f;
  --panel: #1d1915;
  --panel-2: #262019;
  --border: #37302a;
  --border-strong: #4d4339;
  /* paper (text) */
  --text: #ede4d1;
  --text-soft: #cfc4ac;
  --muted: #a3967f;
  /* accents: amber ink, seal red (朱印), moss green */
  --accent: #e0a040;
  --accent-soft: rgba(224, 160, 64, 0.12);
  --accent-line: rgba(224, 160, 64, 0.45);
  --seal: #c23b2a;            /* the stamp itself (fills) */
  --seal-text: #ef7a66;       /* red on ink, readable (AA on --bg and --panel) */
  --seal-soft: rgba(194, 59, 42, 0.16);
  --seal-line: rgba(194, 59, 42, 0.55);
  --green: #93c48a;
  --green-soft: rgba(147, 196, 138, 0.12);
  --red: var(--seal-text);
  --red-soft: var(--seal-soft);
  --grey: #9d968a;
  --grey-soft: rgba(157, 150, 138, 0.12);
  --focus: #f2c46d;
  --font: "Segoe UI", system-ui, sans-serif;
  --serif: Georgia, "Noto Serif", "Noto Serif CJK SC", "Times New Roman", serif;
  --mono: "Cascadia Mono", Consolas, monospace;
  --radius: 6px;
  --gutter: 28px;
  /* Shapes (masks). A brush stroke: a horizontal stroke with a dry, tapered right end. A seal: a square with a
     slightly worn edge. A vertical brush stroke for card edges. */
  --brush-h: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'%3E%3Cpath d='M2 5.5C40 3 90 7.5 140 5.8 190 4 240 2.6 290 4.6c40 1.6 70 3.1 108 .9L400 7.6c-36 2.3-74 1-112 1.9-50 1.1-100 2.1-150 .6C90 8.7 42 9.4 4 8.2 1 8.1 0 7 0 6.6 0 6 .8 5.6 2 5.5Z'/%3E%3C/svg%3E");
  --brush-v: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 400' preserveAspectRatio='none'%3E%3Cpath d='M5.2 0c2.4 36 1.6 72 2.2 110 .6 42 2.4 84 1.2 126-1 40-.2 80-1.8 120-.5 14-1 30-2.2 44-1.6-14-1.2-30-2-44C1.6 318.5 2.4 278 1.6 238 .8 196 2.6 154 2 112 1.4 72 .4 34 2.4 0Z'/%3E%3C/svg%3E");
  --seal-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2.4 1.6 21.2 2c.9 0 1.3.5 1.3 1.3l-.4 18.6c0 .8-.5 1.4-1.3 1.4L3 22.6c-.9 0-1.4-.6-1.4-1.4L1.2 3c0-.9.4-1.4 1.2-1.4Z'/%3E%3C/svg%3E");
  --sword: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M46 10 54 10 54 18 27 45 19 37Z'/%3E%3Cpath d='M15 41 23 49 19 53 11 45Z'/%3E%3Cpath d='M13 51 9 55' stroke='%23000' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E");
  /* paper grain (fractal noise, warm, very light) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.93 0 0 0 0 0.86 0 0 0 0 0.70 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* ink wash in the top corner, paper grain over everything */
  background-image:
    var(--grain),
    radial-gradient(ellipse 90% 60% at 0% -10%, rgba(224, 160, 64, 0.07), transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 110%, rgba(194, 59, 42, 0.05), transparent 60%);
  background-attachment: fixed, fixed, fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, select { font: inherit; color: inherit; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.mono { font-family: var(--mono); font-size: 0.93em; }
.muted { color: var(--muted); }
.break { overflow-wrap: anywhere; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 26px; height: 26px; }
.icon-xl { width: 44px; height: 44px; stroke-width: 1.6; }

/* A shape coloured by the current colour (one SVG, every colour). */
.shape, .brand::before, .group-dot, .card-warn::before, .jsection-title::after, .set-title::after {
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  background-color: currentColor;
}

/* ---- Top bar ---- */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 var(--gutter);
  height: 56px;
  background: linear-gradient(to bottom, var(--panel-2), var(--panel));
  border-bottom: 1px solid var(--border);
  position: relative;
}
/* a thin ink line under the bar, brushed */
.topbar::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: linear-gradient(to right, transparent, var(--accent-line) 12%, var(--accent-line) 70%, transparent);
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask-image: var(--brush-h); mask-image: var(--brush-h);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
}
/* the seal: a red stamp carrying the sword mark */
.brand::before {
  content: "";
  width: 26px; height: 26px;
  color: var(--seal);
  -webkit-mask-image: var(--seal-shape); mask-image: var(--seal-shape);
  transform: rotate(-3deg);
  position: relative;
}
.brand::after {
  content: "";
  position: absolute;
  left: calc(var(--gutter) + 4px); top: 19px;
  width: 18px; height: 18px;
  background-color: var(--text);
  -webkit-mask-image: var(--sword); mask-image: var(--sword);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  transform: rotate(-3deg);
  opacity: 0.95;
  pointer-events: none;
}
.tabs {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 4px;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 15.5px;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
/* the active tab's mark: a short red brush stroke under the label */
.tab::after {
  content: "";
  position: absolute; left: 12px; right: 12px; bottom: 7px; height: 4px;
  background-color: var(--seal);
  -webkit-mask-image: var(--brush-h); mask-image: var(--brush-h);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  opacity: 0;
  transform: scaleX(0.6);
  transform-origin: left center;
  transition: opacity 140ms ease-out, transform 180ms ease-out;
}
.tab[aria-selected="true"]::after { opacity: 1; transform: none; }
.tab:focus-visible { outline-offset: -4px; }
.tab-key {
  font-family: var(--mono);
  font-size: 11px;
  min-width: 18px;
  padding: 0 4px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--muted);
  text-align: center;
  line-height: 16px;
}
.tab[aria-selected="true"] .tab-key { border-color: var(--seal-line); background: var(--seal-soft); color: var(--seal-text); }

.lang {
  flex: none;
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg);
}
.lang-btn {
  padding: 4px 11px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--border-strong); }
.lang-btn:hover { color: var(--text); }
.lang-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.lang-btn:focus-visible { outline-offset: -2px; border-radius: 0; }

/* ---- Content ---- */
.content {
  /* Containing block for absolutely positioned descendants (the journal rows' .sr-only spans): without it
     they are positioned against the viewport, escape this scroller and make the whole document scrollable. */
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-color: var(--border-strong) transparent;
}
.panel {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px var(--gutter) 32px;
}
.panel:focus-visible { outline-offset: -2px; }
.loading { color: var(--muted); }

.footer {
  flex: none;
  padding: 6px var(--gutter);
  border-top: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

/* Web version: "new version ready" bar (web/main.js inserts it above the footer when a new build is installed). */
.update-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px var(--gutter);
  background: var(--accent-soft);
  border-top: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 14px;
}
.update-text { flex: 1; min-width: 0; }
.update-close { padding: 4px 9px; color: var(--muted); border-color: transparent; }
.update-close:hover:not(:disabled) { color: var(--text); border-color: transparent; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a1408; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #eab25a; border-color: #eab25a; }
.btn-quiet { background: none; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.link-btn:hover { text-decoration-color: var(--accent); }

/* ---- Warnings ---- */
.error-box {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  margin-bottom: 22px;
  background: var(--red-soft);
  border: 1px solid var(--seal-line);
  border-radius: var(--radius);
  color: var(--red);
}
.error-body { flex: 1; min-width: 0; }
/* Web version: first-visit / permission / busy messages and their buttons. */
.error-box.setup-box {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.error-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.spinner.spinner-lg { width: 24px; height: 24px; border-width: 3px; margin-top: 2px; }
.error-text { margin: 2px 0 14px; color: var(--text); font-size: 17px; overflow-wrap: anywhere; }
.error-inline { color: var(--red); }

.header-block {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
}
.hdr-line { margin: 0 0 2px; overflow-wrap: anywhere; }
.hdr-line .mono { color: var(--text-soft); }
.hdr-strong { color: var(--text-soft); font-family: var(--serif); font-size: 15px; }
.hdr-untested { color: var(--accent); }
.hdr-notice { font-size: 13px; }
.sep { color: var(--border-strong); }

.norisk {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 56px 20px 48px;
  color: var(--green);
  text-align: center;
}
.norisk-text {
  margin: 0;
  max-width: 34ch;
  color: var(--text);
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.35;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
/* A warning card: a brush stroke down its left edge instead of a straight border. */
.card-warn {
  position: relative;
  padding: 16px 20px 18px 24px;
  background: linear-gradient(to right, var(--accent-soft), transparent 14%), var(--panel);
}
.card-warn::before {
  content: "";
  position: absolute; left: 3px; top: 8px; bottom: 8px; width: 7px;
  color: var(--accent);
  -webkit-mask-image: var(--brush-v); mask-image: var(--brush-v);
}
.card-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 17.5px;
  font-weight: 600;
  line-height: 1.35;
}
.card-title .icon { margin-top: 2px; }
.card-items { list-style: none; margin: 0; padding: 0 0 0 28px; }
.card-item { padding: 5px 0; border-top: 1px solid var(--border); }
.card-item:first-child { border-top: 0; }
.item-text { display: block; overflow-wrap: anywhere; }
.item-note { display: block; color: var(--muted); font-size: 13.5px; }
/* "What you lose" labels (stakes) under an item or an info tip: small quiet chips, the true-ending one in the accent. */
.stakes { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 2px; }
.stake {
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: nowrap;
}
.stake-trueEnding { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.stake-achievement { color: var(--text-soft); }
.info-body { min-width: 0; }
/* hintStarted of a started quest: what is left to do, under its name. */
.item-hint { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.4; }
/* Click-to-reveal of a warning card's place and boss names (a card that has a named variant): the whole card takes
   the click, the small text button at its lower right is the keyboard control. The vague text is never blurred;
   the named text is put into the card only while it is revealed (ui/app.js revealable). */
.card-revealable { cursor: pointer; }
.card-revealable:hover { border-color: var(--border-strong); }
.card-reveal {
  display: block;
  margin: 8px 0 0 auto;
  padding: 0 0 1px;
  background: none;
  border: 0;
  border-bottom: 1px dotted var(--border-strong);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}
.card-revealable:hover .card-reveal, .card-reveal:hover { color: var(--text-soft); border-bottom-color: var(--muted); }
.card-revealable.revealed, .card-revealable.revealed:hover { border-color: var(--accent-line); }
.card-revealable.revealed .card-reveal { color: var(--accent); border-bottom-color: var(--accent-line); }

/* Region groups of the warnings: the player's current region, other reached regions, "until the final bell", then "later". */
.group { margin-bottom: 24px; }
.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
/* the heading's mark: an ink dot, or for the current region a red seal */
.group-dot {
  flex: none; width: 10px; height: 10px;
  color: var(--border-strong);
  -webkit-mask-image: var(--seal-shape); mask-image: var(--seal-shape);
  transform: rotate(45deg) scale(0.8);
}
.group-current .group-title { color: var(--text); }
.group-current .group-dot {
  width: 16px; height: 16px;
  color: var(--seal);
  transform: rotate(-4deg);
  box-shadow: none;
}
.group-later .group-title, .group-endgame .group-title { color: var(--muted); }
.group-endgame .group-dot { color: var(--accent-line); }
.group .cards:last-child { margin-bottom: 0; }

.cards-info { grid-template-columns: 1fr; gap: 10px; }
.card-info {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 18px;
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}
.card-info .icon { margin-top: 2px; }
.info-text { margin: 0; color: var(--text-soft); font-size: 14px; }

/* Open map locks (State.mapLocks): one card, a line per reached region. */
.card-locks {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}
.card-locks .icon { margin-top: 2px; }
.locks-body { min-width: 0; }
.locks-title {
  margin: 0 0 6px;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.locks-list { list-style: none; margin: 0; padding: 0; }
.locks-row { padding: 3px 0; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.locks-region { color: var(--text); font-weight: 600; }
.locks-region::after { content: ": "; }
.locks-items { color: var(--text-soft); }

/* ---- Journal ---- */
.journal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 16px;
  margin-bottom: 24px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
}
.journal-notice {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text);
}
.journal-notice .icon { color: var(--accent); }
.journal-esc { color: var(--muted); font-size: 12.5px; font-family: var(--mono); }

.jsection { margin-bottom: 26px; }
/* Section heading with a brushed ink line under it (the stroke dries out to the right). */
.jsection-title {
  position: relative;
  margin: 0 0 10px;
  padding-bottom: 9px;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.jsection-title::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  color: var(--border-strong);
  -webkit-mask-image: var(--brush-h); mask-image: var(--brush-h);
}
.jrows { list-style: none; margin: 0; padding: 0; }
.jrow {
  display: grid;
  grid-template-columns: 118px 22px minmax(0, 1fr);
  align-items: baseline;
  gap: 14px;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 0;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
}
.jrow:hover { background: var(--panel); }
.jrow-plain { grid-template-columns: 22px minmax(0, 1fr); }
.jrow-plain.jrow-nokind { grid-template-columns: minmax(0, 1fr); }
/* Row kind (what the row is about): a small ink icon between the badge and the name. */
.jkind {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  color: var(--muted);
}
.jkind .icon { width: 16px; height: 16px; stroke-width: 1.8; }
.jkind-info { color: var(--accent); }
.jkind-flower { color: #c98aa8; }
.jkind-accessory { color: #8fb7c9; }
.jkind-chest, .jkind-item, .jkind-weapon { color: #b9a98a; }
.jtext {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  min-width: 0;
}
/* Step counter + note: their own block, so a readable name can keep its details blurred. */
.jdetail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  min-width: 0;
}
/* Blurred row part (the whole .jtext, or only .jdetail); the row's click reveals every part. */
.jrow .blur {
  filter: blur(6px);
  user-select: none;
  -webkit-user-select: none;
  transition: filter 120ms ease-out;
}
.jrow.revealed .blur { filter: none; user-select: text; -webkit-user-select: text; }
.jname { color: var(--text); overflow-wrap: anywhere; }
.jprogress { color: var(--text-soft); font-size: 13px; }
.jnote { color: var(--muted); font-size: 13.5px; }

/* Status badges, drawn like small stamps: a square-ish frame, uppercase letters; "missed" is the red seal. */
.badge {
  justify-self: start;
  display: inline-block;
  padding: 1px 8px;
  border: 1.5px solid transparent;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.6;
}
.st-open { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.st-done { background: var(--green-soft); border-color: rgba(147, 196, 138, 0.45); color: var(--green); }
.st-missed { background: var(--seal); border-color: var(--seal); color: #fff3ec; }
.st-notStarted { background: transparent; border-color: rgba(224, 160, 64, 0.4); border-style: dashed; color: #c9a467; }
.st-unknown { background: var(--grey-soft); border-color: rgba(157, 150, 138, 0.35); color: var(--grey); }
/* A blurred badge must not give its status away by colour: neutral until the row is revealed. */
.jrow:not(.revealed) .badge.blur { background: var(--grey-soft); border-color: rgba(157, 150, 138, 0.35); border-style: solid; color: var(--grey); }

.legend { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---- Settings / About ---- */
.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
  align-items: start;
}
.set-card {
  padding: 18px 20px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.set-title {
  position: relative;
  margin: 0 0 16px;
  padding-bottom: 8px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.set-title::after {
  content: "";
  position: absolute; left: 0; width: 72px; bottom: 0; height: 4px;
  color: var(--accent-line);
  -webkit-mask-image: var(--brush-h); mask-image: var(--brush-h);
}
.about-name { font-size: 19px; }

.path-row { padding: 12px 0; border-top: 1px solid var(--border); }
.path-row:first-of-type { border-top: 0; padding-top: 0; }
.path-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.path-value { margin-bottom: 10px; color: var(--text-soft); overflow-wrap: anywhere; font-size: 13px; }
.path-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.field-extra { margin: 4px 0 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.paths-note { margin-top: 10px; }

.chip {
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.chip-warn { border-color: var(--accent-line); color: var(--accent); }

.field-label { color: var(--muted); font-size: 13.5px; }
.field {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: start;
  gap: 8px 14px;
  margin-bottom: 14px;
}
.field > .field-label { padding-top: 6px; }
.field-stack { min-width: 0; }
select, input[type="number"] {
  width: 100%;
  max-width: 280px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}
input[type="number"] { max-width: 120px; font-family: var(--mono); }
select:hover, input[type="number"]:hover { border-color: var(--muted); }
select:focus-visible, input[type="number"]:focus-visible { border-radius: 4px; }
option { background: var(--panel); color: var(--text); }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 13.5px;
  overflow-wrap: anywhere;
}
.status-line.ok { color: var(--green); }
.status-line.error { color: var(--red); }
.status-line.muted, .status-line.waiting { color: var(--muted); }

.spinner {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .jrow .blur { transition: none; }
  .tab::after { transition: none; }
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 18px;
  margin: 0 0 12px;
}
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.config-path { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

/* Checkbox setting (exact names, timeline) */
.check-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check-row input[type="checkbox"] { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); cursor: pointer; }
.check-text { min-width: 0; }
.check-label { display: block; color: var(--text); }
.check-row .hint { margin-top: 2px; }
.field-check { margin: 4px 0 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Diagnostics (collapsible, bottom of Settings) */
.diag { margin-top: 16px; padding: 0; }
.diag-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  cursor: pointer;
  font-family: var(--serif);
  font-weight: 600;
  list-style: none;
}
.diag-summary::-webkit-details-marker { display: none; }
.diag-summary::before { content: "\25B8"; color: var(--muted); font-weight: 400; }
.diag[open] > .diag-summary::before { content: "\25BE"; }
.diag-summary:focus-visible { outline-offset: -2px; }
.diag-count {
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
}
.diag-count.warn { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.diag-body { padding: 0 20px 20px; }
.diag-list { margin: 0; padding: 0 0 0 18px; }
.diag-list li { padding: 1px 0; overflow-wrap: anywhere; }
.diag-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.diag-sub { margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); font-family: var(--serif); font-size: 14.5px; font-weight: 600; }
.copy-buffer { position: fixed; top: -1000px; left: -1000px; width: 1px; height: 1px; opacity: 0; }

.about-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}
.about-note .icon { color: var(--muted); margin-top: 2px; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { padding: 3px 0; }
.mono-ish { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--text-soft); }

/* ---- Narrow windows ---- */
@media (max-width: 900px) {
  :root { --gutter: 18px; }
  .topbar { gap: 12px; }
  .tab { padding: 0 10px; }
  .tab::after { left: 8px; right: 8px; }
  .set-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .tab-key { display: none; }
  .brand { font-size: 16px; }
  .cards { grid-template-columns: 1fr; }
  .field { grid-template-columns: 1fr; gap: 4px; }
  .field > .field-label { padding-top: 0; }
  .jrow { grid-template-columns: 96px 20px minmax(0, 1fr); gap: 10px; }
  .jrow-plain { grid-template-columns: 20px minmax(0, 1fr); }
  .norisk-text { font-size: 22px; }
}
@media (max-width: 480px) {
  .brand-text { display: none; }
  .brand::after { left: calc(var(--gutter) + 4px); }
  .lang-btn { padding: 4px 8px; }
  .jrow { grid-template-columns: 84px 20px minmax(0, 1fr); gap: 8px; padding: 7px 6px; }
  .badge { font-size: 10.5px; padding: 1px 5px; letter-spacing: 0.04em; }
}

/* ---- Maps (map completion per reached region) ---- */
.map-card {
  position: relative;
  margin-bottom: 18px;
  padding: 16px 20px 16px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.map-card::before {
  content: "";
  position: absolute; left: 3px; top: 10px; bottom: 10px; width: 7px;
  color: var(--accent);
  background-color: currentColor;
  -webkit-mask-image: var(--brush-v); mask-image: var(--brush-v);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.map-full::before { color: var(--green); }
.map-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 8px;
}
.map-name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.map-pct {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.map-pct-sign { margin-left: 2px; font-size: 16px; color: var(--muted); font-weight: 400; }
.map-full .map-pct { color: var(--green); }
.map-count { color: var(--muted); font-size: 13px; }
/* The bar: a <progress> styled as a thin ink line (value/max are attributes, no inline style). */
.map-bar {
  display: block;
  width: 100%;
  height: 6px;
  margin: 0 0 12px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 3px;
  background: var(--panel-2);
  overflow: hidden;
}
.map-bar::-webkit-progress-bar { background: var(--panel-2); border-radius: 3px; }
.map-bar::-webkit-progress-value { background: linear-gradient(to right, var(--accent-line), var(--accent)); border-radius: 3px; }
.map-bar::-moz-progress-bar { background: linear-gradient(to right, var(--accent-line), var(--accent)); border-radius: 3px; }
.map-full .map-bar::-webkit-progress-value { background: var(--green); }
.map-full .map-bar::-moz-progress-bar { background: var(--green); }
.map-cats {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.map-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.6;
}
.map-cat .icon { color: var(--muted); }
.map-cat-n { color: var(--text); }
.map-cat.cat-full { border-color: rgba(147, 196, 138, 0.35); color: var(--muted); }
.map-cat.cat-full .map-cat-n { color: var(--green); }
.map-missing-title {
  margin: 12px 0 4px;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.mrows { margin-left: -10px; }
.jrow.mrow { grid-template-columns: 22px minmax(0, 1fr); }
.jkind-map, .jkind-bell { color: var(--accent); }
.jkind-medicine { color: #9fc9a3; }
.jkind-challenge { color: var(--seal-text); }
.jkind-amber { color: #e0b060; }
.jkind-blackstone { color: #9a9aa6; }
.jkind-phantomEdge { color: #b9a98a; }
.map-complete {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  color: var(--green);
  font-size: 14px;
}
@media (max-width: 760px) {
  .map-pct { font-size: 26px; }
  .jrow.mrow { grid-template-columns: 20px minmax(0, 1fr); }
}
