:root {
  --bg: #0f1210;
  --panel: #181c19;
  --panel-2: #20251f;
  --line: #2c332d;
  --text: #e8ebe6;
  --muted: #9aa39a;
  --accent: #f2a33a;
  --accent-ink: #1a1206;
  --danger: #e5534b;
  --ok: #6cc070;
  --radius: 14px;
  --tabbar-h: 64px;
  --topbar-h: 52px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; }

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 15px; }
.brand-icon { width: 22px; height: 22px; color: var(--accent); }
.net-status { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.net-status.offline { color: var(--accent); border-color: var(--accent); }

main {
  padding: calc(var(--topbar-h) + env(safe-area-inset-top)) 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  min-height: 100%;
}
.page { padding: 16px; max-width: 720px; margin: 0 auto; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 1000;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--panel); border-top: 1px solid var(--line);
}
.tabbar button {
  background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; cursor: pointer;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar button.active { color: var(--accent); }

h1 { font-size: 24px; margin: 4px 0 4px; }
h2 { font-size: 18px; margin: 24px 0 8px; }
h3 { font-size: 15px; margin: 16px 0 6px; color: var(--accent); }
p, li { line-height: 1.5; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.search {
  width: 100%; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 16px; margin: 8px 0 16px;
}
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 104px;
}
.card:active { background: var(--panel-2); }
.card .emoji { font-size: 26px; line-height: 1; }
.card .title { font-weight: 650; font-size: 15px; }
.card .sub { font-size: 12px; color: var(--muted); }
.card.urgent { border-color: var(--danger); }

.back { background: none; border: 0; color: var(--accent); padding: 6px 0; font-size: 15px; cursor: pointer; }
.guide-body ol, .guide-body ul { padding-left: 22px; }
.guide-body li { margin: 4px 0; }
.callout { border-left: 3px solid var(--accent); background: var(--panel); padding: 10px 12px; border-radius: 0 10px 10px 0; margin: 12px 0; }
.callout.warn { border-color: var(--danger); }
.callout p { margin: 0; }
.results .hit { display: block; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.results .hit b { color: var(--accent); }
mark { background: var(--accent); color: var(--accent-ink); border-radius: 3px; padding: 0 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; font-weight: 600; font-size: 15px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1; }

/* Map */
.map-wrap { position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top)); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); left: 0; right: 0; }
#map { position: absolute; inset: 0; background: #1c211d; }
.map-controls { position: absolute; z-index: 500; right: 12px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.map-controls .btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; background: var(--panel); box-shadow: 0 2px 8px #0008; }
.map-controls .btn svg { width: 22px; height: 22px; }
.map-info { position: absolute; z-index: 500; left: 10px; top: 10px; right: 10px; background: #181c19e6; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--muted); }
.map-info b { color: var(--text); font-variant-numeric: tabular-nums; }
.sheet { position: absolute; z-index: 600; left: 0; right: 0; bottom: 0; max-height: 60%; overflow: auto; background: var(--panel); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 16px; }
.wp { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wp:last-child { border-bottom: 0; }
.wp .meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.icon-btn { background: none; border: 0; color: var(--muted); padding: 8px; cursor: pointer; font-size: 18px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; }
.sheet h3 { margin-top: 18px; }
.sheet .progress { margin: 6px 0 0; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--panel-2); padding: 1px 4px; border-radius: 4px; }
#map { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 6px #f2a33a40, 0 1px 4px #0008; }
.wp-pin { display: flex; align-items: center; gap: 6px; pointer-events: none; }
.wp-pin i { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); border: 2px solid #0f1210; flex: none; }
.wp-pin span { background: #0f1210e6; color: var(--text); font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.maplibregl-ctrl-group { background: var(--panel) !important; border: 1px solid var(--line); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-top-left { top: 64px; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-scale { background: #ffffffcc; }

/* Tools */
.tool { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.tool h2 { margin-top: 0; }
.compass { width: 220px; height: 220px; margin: 8px auto 12px; position: relative; }
.compass svg { width: 100%; height: 100%; transition: transform .15s linear; }
.heading { text-align: center; font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.morse { font-family: ui-monospace, Menlo, monospace; font-size: 22px; letter-spacing: .12em; text-align: center; color: var(--accent); }
.strobe { position: fixed; inset: 0; z-index: 5000; background: #000; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 60px; }
.strobe.on { background: #fff; }
.strobe .btn { background: #222; color: #fff; }
.coords { font-family: ui-monospace, Menlo, monospace; font-size: 18px; text-align: center; line-height: 1.6; }

/* DIY */
.diy-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.state-pick { display: inline-flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; }
.state-pick select { background: transparent; color: var(--text); border: 0; font-size: 15px; padding: 6px 4px; max-width: 160px; }
.state-pick select option { background: var(--panel); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 14px; cursor: pointer; }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.row-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; }
.row-item .emoji { font-size: 24px; line-height: 1.2; }
.row-item .body { display: flex; flex-direction: column; gap: 3px; }
.row-item .title { font-weight: 650; }
.row-item .sub { font-size: 13px; color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-transform: capitalize; }
.tag.easy, .tag.ok { color: var(--ok); border-color: #6cc07055; }
.tag.medium { color: var(--accent); border-color: #f2a33a55; }
.tag.hard { color: var(--danger); border-color: #e5534b55; }
.needs { background: var(--panel); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.guide-body table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.guide-body th, .guide-body td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.guide-body th { background: var(--panel); }
.guide-body a[data-guide] { color: var(--accent); }
figure.fig { margin: 14px 0; background: #f6f3ec; border-radius: 12px; padding: 10px; color: #2b2b2b; }
figure.fig svg { display: block; width: 100%; height: auto; }
figure.fig figcaption { font-size: 13px; color: #444; margin-top: 6px; line-height: 1.4; }
figure.fig.photo { padding: 0; overflow: hidden; background: var(--panel); color: var(--text); }
figure.fig.photo figcaption { color: var(--muted); padding: 8px 10px 10px; }
.ph { display: block; width: 100%; object-fit: cover; background: var(--panel-2); }
.ph.thumb { aspect-ratio: 4 / 3; border-radius: 10px; }
.ph.big { max-height: 360px; border-radius: 12px; }
figure.photo .ph { max-height: 320px; }
.ph-none { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: var(--panel-2); color: var(--muted); font-size: 12px; border-radius: 10px; }
.credit { font-size: 10px; color: var(--muted); margin-top: 4px; }
.hero { margin: 8px 0 12px; }
.gallery { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 4px; }
.gallery figure { flex: 0 0 78%; margin: 0; scroll-snap-align: start; }
.gallery .ph { aspect-ratio: 4 / 3; border-radius: 10px; }
.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.pgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
@media (min-width: 560px) { .pgrid { grid-template-columns: repeat(3, 1fr); } }
.pcard { display: flex; flex-direction: column; gap: 4px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer; }
.pname { font-weight: 650; font-size: 14px; }
.platin { font-style: italic; font-size: 12px; color: var(--muted); }
.pcard .tag { align-self: flex-start; }
.install-tip { background: var(--panel-2); border: 1px dashed var(--accent); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-size: 14px; }

.save-status { font-size: 13px; padding: 6px 16px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--card, transparent); }
.save-status.done { color: #6fbf73; }

/* Find nearby */
.find-q { width: 100%; box-sizing: border-box; margin-top: 10px; padding: 12px 14px; font-size: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.find-chips { flex-wrap: nowrap; overflow-x: auto; margin: 10px 0 4px; padding-bottom: 4px; }
.find-chips .chip { white-space: nowrap; flex: none; padding: 6px 10px; font-size: 13px; color: var(--text); }
.chip.on { border-color: var(--accent); color: var(--accent); }
.row-add { display: flex; gap: 8px; margin: 8px 0; }
.row-add select { flex: 1; min-width: 0; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 15px; }
.wp-pin.target i { background: var(--accent); }
#map-info a { color: var(--accent); text-decoration: none; padding: 0 4px; }

/* Download-the-map prompts */
.map-cta { position: absolute; z-index: 550; left: 10px; right: 70px; bottom: 16px; background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; font-size: 14px; box-shadow: 0 2px 10px #0009; }
.map-cta .btn { margin-top: 8px; }
.map-cta .small { color: var(--muted); }
.map-cta-card { display: block; width: 100%; text-align: left; margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--accent); background: var(--panel); color: var(--text); font-size: 15px; cursor: pointer; }
.map-cta-card span { color: var(--muted); font-size: 13px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 6px 0; }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.pin-pop { color: #222; font-size: 14px; line-height: 1.4; }
.pin-pop span { color: #555; font-size: 12px; }
.pin-pop .btn { margin-top: 6px; padding: 6px 10px; font-size: 13px; }
.maplibregl-popup-content { border-radius: 10px; }
.pin-pop .btn:not(.primary) { background: #eee; color: #222; border: 1px solid #ccc; }

/* Feature plug-ins (Plan tab, extra tools) */
.feature-view { position: fixed; inset: 0; z-index: 900; background: var(--bg); overflow: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }
.feature-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--bg); border-bottom: 1px solid var(--line); font-weight: 650; }
.feature-bar .back { background: none; border: 0; color: var(--accent); font-size: 16px; padding: 6px 4px; cursor: pointer; }
.tools-more { margin-bottom: 18px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.night-btn { background: none; border: 1px solid var(--line); border-radius: 999px; width: 32px; height: 28px; font-size: 14px; cursor: pointer; }
/* Red night mode: everything rendered in dim red */
html.night { filter: grayscale(1) sepia(1) saturate(8) hue-rotate(-45deg) brightness(.55); }
html.night body { background: #000; }

/* ================= Look v2: plain, utilitarian, list-based ================= */
:root {
  --bg: #0d0e0c; --panel: #161815; --panel-2: #1e211d; --line: #262923;
  --text: #ecebe5; --muted: #8f938a; --accent: #e9a23b; --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
body { font-feature-settings: "tnum" 0; -webkit-font-smoothing: antialiased; }

/* Header */
.topbar { background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.brand { font-size: 13px; letter-spacing: .14em; font-weight: 800; gap: 7px; }
.brand-icon { width: 18px; height: 18px; }
.net-status { border: 0; padding: 4px 0 4px 14px; position: relative; font-size: 12px; font-weight: 600; }
.net-status::before { content: ""; position: absolute; left: 0; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--ok); }
.net-status.offline { color: var(--accent); }
.net-status.offline::before { background: var(--accent); }
.top-right { gap: 14px; }
.night-btn { border: 0; width: 34px; height: 34px; font-size: 15px; opacity: .8; }

/* Tab bar: 5 tabs */
.tabbar { grid-template-columns: repeat(5, 1fr); background: var(--bg); }
.tabbar button { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; }
.tabbar svg { width: 22px; height: 22px; }
.tabbar button.active { color: var(--text); }
.tabbar button.active svg { color: var(--accent); }

/* Type */
h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 6px 0 6px; }
h2 { font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
h3 { color: var(--text); font-size: 16px; font-weight: 750; }
.page > p.muted { margin-top: 0; }
/* section labels above a list */
h2:has(+ .grid), h2:has(+ .list), .page > h2.label {
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 28px 4px 8px;
}

/* Inputs */
.search, .find-q { background: var(--panel-2); border: 1px solid transparent; border-radius: 10px; }
.search:focus, .find-q:focus { outline: none; border-color: var(--accent); }

/* Card grids become grouped lists */
.grid { display: flex; flex-direction: column; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid[hidden] { display: none !important; }
.grid > .card {
  display: grid; grid-template-columns: 34px 1fr 10px; grid-template-areas: "icon title chev" "icon sub chev";
  column-gap: 14px; row-gap: 1px; align-items: center; min-height: 62px; padding: 11px 16px 11px 14px;
  background: transparent; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); position: relative;
}
.grid > .card:last-child { border-bottom: 0; }
.grid > .card:active { background: var(--panel-2); }
.grid > .card .emoji { grid-area: icon; align-self: center; width: 34px; height: 34px; display: grid; place-items: center; font-size: 18px; background: var(--panel-2); border-radius: 8px; }
.grid > .card .title { grid-area: title; font-size: 16px; font-weight: 650; align-self: end; }
.grid > .card .sub { grid-area: sub; font-size: 13px; align-self: start; }
.grid > .card .title:only-of-type { align-self: center; }
.grid > .card::after { content: ""; grid-area: chev; width: 7px; height: 7px; border-top: 2px solid #5c6058; border-right: 2px solid #5c6058; transform: rotate(45deg); justify-self: end; }
.grid > .card.urgent { border-color: var(--line); }
.grid > .card.urgent .emoji { box-shadow: inset 0 0 0 1.5px var(--danger); }
.grid > .card.urgent .title::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); margin-left: 8px; vertical-align: middle; }

/* Rows / photo cards / chips */
.row-item, .pcard, .results .hit { border-radius: 10px; }
.chip { background: var(--panel-2); border-color: transparent; font-weight: 600; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tag { text-transform: none; font-weight: 600; }

/* Buttons */
.btn { border-radius: 10px; font-weight: 650; }
.btn.primary { box-shadow: none; }

/* Notices */
.install-tip { border: 0; background: var(--panel); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; color: var(--muted); }
.install-tip b { color: var(--text); }
.map-cta-card { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; }
.callout { background: var(--panel); }

/* Bold back button, pinned top-left while scrolling */
.back {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 8px); z-index: 50;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: 0 0 10px;
  padding: 8px 16px 8px 11px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 4px 14px #000a;
  color: var(--text); font-size: 15px; font-weight: 800; letter-spacing: -.005em; cursor: pointer;
}
.back::before {
  content: ""; width: 9px; height: 9px; border-left: 3px solid var(--accent); border-bottom: 3px solid var(--accent);
  transform: rotate(45deg); margin-left: 3px; border-radius: 1px;
}
.back:active { background: var(--line); }

/* Feature screens sit between the header and tab bar */
.feature-view { top: calc(var(--topbar-h) + env(safe-area-inset-top)); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: 0; }
.feature-bar { padding: 10px 12px; gap: 12px; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.feature-bar .back { position: static; margin: 0; box-shadow: none; color: var(--text); font-size: 15px; padding: 8px 16px 8px 11px; }
.feature-title { font-weight: 700; font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Routes */
.route-bar { position: absolute; z-index: 560; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 10px 14px 12px; box-shadow: 0 -4px 16px #0008; max-height: 55%; overflow: auto; }
.map-wrap.rt-on .map-controls { bottom: calc(var(--rb-h, 180px) + 12px); }
.map-wrap.rt-on .map-cta { display: none; }
.map-wrap.rt-on .maplibregl-ctrl-bottom-left, .map-wrap.rt-on .maplibregl-ctrl-bottom-right { bottom: var(--rb-h, 180px); }
.rb-head { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.rb-head b { font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-tag { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rb-x { margin-left: auto; min-width: 44px; min-height: 44px; margin-right: -8px; }
.rb-dist { font-size: 22px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.rb-sub { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.rb-sub b { color: var(--text); font-variant-numeric: tabular-nums; }
.rb-sub span { font-size: 12px; }
.rb-hint { font-size: 14px; color: var(--muted); margin: 2px 0 4px; line-height: 1.4; }
.rb-note { font-size: 13px; margin-top: 6px; color: var(--muted); line-height: 1.35; }
.rb-note.warn { color: var(--accent); }
.rb-note.ok { color: var(--ok); }
.rb-opts { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 8px 12px; min-height: 40px; border-radius: 8px; font-size: 14px; font-weight: 650; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.rb-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; min-height: 44px; cursor: pointer; }
.rb-toggle input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.rb-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.rb-btns.two { grid-template-columns: 1fr 1fr; }
.rb-btns .btn { padding: 10px 4px; min-height: 46px; font-size: 14px; }
.rb-btns .btn:disabled { opacity: .4; cursor: default; }
.rt-pt { width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; touch-action: none; }
.rt-pt span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #1a1206; border: 3px solid var(--accent); font-size: 11px; font-weight: 800; box-shadow: 0 1px 4px #0009; }
.rt-pt.start span { background: var(--ok); border-color: #fff; color: #0d0e0c; }
.rt-pt.end span { background: var(--danger); border-color: #fff; color: #fff; }
.rt-pt.edit span { width: 26px; height: 26px; }
.rt-new { margin: 12px 0 4px; }
.rt-row { min-width: 0; }
.rt-row > div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-acts { display: flex; flex: none; }
.rt-acts .icon-btn { min-width: 44px; min-height: 44px; }
.rt-paste { margin: 12px 0 4px; }
.rt-paste summary { cursor: pointer; font-weight: 650; padding: 10px 0; min-height: 44px; }
.rt-paste textarea, .rt-text { width: 100%; box-sizing: border-box; margin: 4px 0 8px; padding: 10px 12px; font: 14px/1.4 ui-monospace, Menlo, monospace; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.rb-note.off { color: var(--danger); font-weight: 700; }
figure.fig .muted { color: #666; }

/* ================= Paid version: unlock screen, first-launch notice, About ================= */
.about-btn { font-size: 18px; color: var(--text); }
.grid > .card.locked .title::after { content: "Full version"; display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; font-weight: 650; color: var(--muted); vertical-align: 2px; }
.paywall .pw-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.paywall .pw-list > div { display: grid; grid-template-columns: 34px 1fr; column-gap: 14px; align-items: start; padding: 12px 16px 12px 14px; border-bottom: 1px solid var(--line); }
.paywall .pw-list > div:last-child { border-bottom: 0; }
.paywall .pw-list span { width: 34px; height: 34px; display: grid; place-items: center; font-size: 18px; background: var(--panel-2); border-radius: 8px; }
.paywall .pw-list p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
.paywall .pw-list b { color: var(--text); font-size: 15px; }
.pw-price { margin: 18px 4px 12px; color: var(--muted); font-size: 14px; }
.pw-price b { color: var(--text); font-size: 22px; font-weight: 800; margin-right: 4px; }
a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--accent-ink); }
.pw-form .search { margin: 0 0 10px; font-family: ui-monospace, Menlo, monospace; font-size: 16px; }
.pw-form .btn:disabled { opacity: .5; }
.pw-msg { min-height: 1.4em; margin: 10px 4px; }
.pw-msg.warn { color: var(--accent); }
.pw-msg.ok { color: var(--ok); }
.ns-gate { position: fixed; inset: 0; z-index: 4500; background: var(--bg); overflow: auto; -webkit-overflow-scrolling: touch; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.ns-gate .page { padding-top: 32px; padding-bottom: 32px; }
html.gated, html.gated body { overflow: hidden; }
.disc-list { padding-left: 20px; margin: 12px 0 20px; }
.disc-list li { margin: 8px 0; }
.about a { color: var(--accent); }
.about h2 { margin-top: 32px; scroll-margin-top: 64px; }
.about-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.about-toc a { background: var(--panel-2); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 650; color: var(--text); text-decoration: none; }
.credit-list { max-height: 340px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px; -webkit-overflow-scrolling: touch; }
.credit-list .cr { display: flex; flex-direction: column; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.35; }
.credit-list .cr:last-child { border-bottom: 0; }
.credit-list .cr b { font-size: 13px; font-weight: 650; }
.credit-list .cr span { color: var(--muted); overflow-wrap: anywhere; }
.credit-list .credit-count { margin: 6px 0; }
