:root {
  --bg: #100c0e;
  --surface: #1a1417;
  --surface-2: #231b1f;
  --surface-3: #2d2328;
  --line: rgba(244, 232, 220, 0.08);
  --line-2: rgba(244, 232, 220, 0.16);
  --text: #f4ece4;
  --muted: #ab9b91;
  --faint: #76685f;
  --gold: #d6b274;
  --gold-soft: rgba(214, 178, 116, 0.14);
  --garnet: #8e2236;
  --ok: #a3c9a0;
  --warn: #e8b766;
  --info: #9dbbe0;
  --past: #e48f85;

  --c-red: #7a1a2e;
  --c-white: #d7b866;
  --c-rose: #e38c7f;
  --c-sparkling: #2d3a22;
  --c-sparkling-rose: #c37a70;
  --c-sparkling-red: #6a1435;
  --c-other: #4b1945;

  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.55 var(--sans);
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(142, 34, 54, 0.28), transparent 62%),
    radial-gradient(900px 520px at 105% 0%, rgba(214, 178, 116, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body.drawer-open { overflow: hidden; }
@media (min-width: 1280px) { body.drawer-open { overflow: auto; } }

a { color: var(--gold); }
a.icon-btn { text-decoration: none; }
code, kbd {
  font: 500 0.82em/1 ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.02em;
}
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1360px; margin: 0 auto; padding: 0 28px; }
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .stats.wrap { margin: 6px 16px 0; padding: 0; }
}

.muted { color: var(--muted); }
.link { background: none; border: 0; padding: 0; color: var(--gold); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: max(26px, env(safe-area-inset-top));
  padding-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; margin-right: auto; min-width: 0; flex: 1 1 0; }
.brand > span { min-width: 0; }
.brand-mark { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 4px 14px rgba(142, 34, 54, 0.6)); }
.brand-name { display: block; font: 600 30px/1 var(--serif); letter-spacing: 0.01em; }
.brand-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; background: var(--faint); vertical-align: 1px; }
.brand-sub[data-state='live']::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.brand-sub[data-state='busy']::before { background: var(--gold); animation: blink 1s infinite; }
.brand-sub[data-state='warn']::before { background: var(--warn); }
@keyframes blink { 50% { opacity: 0.3; } }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  color: var(--muted); font-weight: 500; font-size: 14px; transition: color 0.2s, background 0.2s;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-current] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

@media (max-width: 760px) {
  .masthead { flex-wrap: wrap; gap: 14px; padding-top: 18px; }
  .tabs { order: 3; width: 100%; justify-content: space-between; }
  .tabs button { flex: 1; padding: 8px 6px; }
  .brand-name { font-size: 26px; }
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  margin-top: 6px;
}
.stat {
  padding: 14px 18px;
  background: linear-gradient(180deg, var(--surface), rgba(26, 20, 23, 0.6));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat:first-child { border-left: 1px solid var(--line); border-radius: 14px 0 0 14px; }
.stat:last-child { border-right: 1px solid var(--line); border-radius: 0 14px 14px 0; }
.stat b { display: block; font: 600 30px/1.05 var(--serif); font-variant-numeric: lining-nums; }
.stat span { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.stat-ok b { color: var(--ok); }
.stat-gold b { color: var(--gold); }
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, 1fr); gap: 0; width: auto; margin: 6px 28px 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
  .stat, .stat:first-child, .stat:last-child { border: 0; border-radius: 0; padding: 10px 14px; }
  .stat b { font-size: 24px; }
  .stat span { font-size: 10.5px; }
}

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 14px; padding-bottom: 14px;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(16, 12, 14, 0));
}
@media (max-width: 760px) {
  .toolbar { position: static; }
  .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .chip { flex: none; }
}
.search {
  flex: 1 1 320px; display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.search:focus-within { border-color: rgba(214, 178, 116, 0.5); box-shadow: 0 0 0 4px var(--gold-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 15px; }
.search input::placeholder { color: var(--faint); }
.search kbd { padding: 3px 7px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--faint); }
@media (hover: none) { .search kbd { display: none; } }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 13.5px; cursor: pointer; transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.on { color: var(--text); background: var(--surface-3); border-color: rgba(214, 178, 116, 0.45); }

.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background 0.2s; margin: 0; }
.toggle input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 0.2s, background 0.2s; }
.toggle input:checked { background: rgba(163, 201, 160, 0.3); border-color: rgba(163, 201, 160, 0.6); }
.toggle input:checked::after { transform: translateX(14px); background: var(--ok); }
.toggle:has(input:checked) { color: var(--text); }

.ghost-btn, .btn {
  height: 38px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); font-size: 14px; font-weight: 500;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.ghost-btn { color: var(--gold); border-color: rgba(214, 178, 116, 0.35); background: transparent; }
.ghost-btn:hover, .btn:hover { background: var(--surface-3); }
.btn:active, .ghost-btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #a12a42, #7a1a2e); border-color: #b23a52; color: #fff; }
.btn.primary:hover { background: linear-gradient(180deg, #b22f4a, #861d33); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- dots / swatches ---------- */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); }
.st-red.dot, .st-red.swatch { background: var(--c-red); }
.st-white.dot, .st-white.swatch { background: var(--c-white); }
.st-rose.dot, .st-rose.swatch { background: var(--c-rose); }
.st-sparkling.dot, .st-sparkling.swatch { background: var(--c-sparkling); box-shadow: inset 0 0 0 2px var(--gold); }
.st-sparkling-rose.dot, .st-sparkling-rose.swatch { background: var(--c-sparkling-rose); box-shadow: inset 0 0 0 2px var(--gold); }
.st-sparkling-red.dot, .st-sparkling-red.swatch { background: var(--c-sparkling-red); box-shadow: inset 0 0 0 2px var(--gold); }
.st-other.dot, .st-other.swatch { background: var(--c-other); }

/* ---------- cellar ---------- */
.view { padding-bottom: 60px; }
.cellar-grid { display: grid; grid-template-columns: minmax(360px, 1fr) 1.12fr; gap: 22px; align-items: start; }
.cellar-side { display: grid; gap: 22px; }
@media (max-width: 1040px) { .cellar-grid { grid-template-columns: 1fr; } }

.unit {
  background: linear-gradient(180deg, var(--surface), rgba(26, 20, 23, 0.7));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
}
.unit-fridge { position: sticky; top: 84px; }
@media (max-width: 1040px) { .unit-fridge { position: static; } }
.unit-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.unit-head h2 { font: 600 24px/1.1 var(--serif); }
.unit-head p { font-size: 12.5px; color: var(--muted); }
.fill { text-align: right; min-width: 90px; }
.fill span { font: 600 20px/1 var(--serif); }
.fill small { font-size: 13px; color: var(--muted); }
.fill i { display: block; height: 3px; margin-top: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--gold) var(--p), var(--surface-3) var(--p)); }

.legend { margin-top: 8px; font-size: 12px; color: var(--faint); text-align: center; }
.key { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; font-size: 12.5px; color: var(--muted); }
.key span { display: inline-flex; align-items: center; gap: 7px; }

.map { display: block; width: 100%; height: auto; overflow: visible; user-select: none; -webkit-user-select: none; }
.map .shelf-num { fill: var(--faint); font: 600 15px var(--serif); text-anchor: middle; }
.map .shelf-num.small { font: 500 11px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; }
.map .shelf-rail { fill: rgba(255, 255, 255, 0.05); }
.map .col-nums text { fill: var(--faint); font: 500 10px var(--sans); text-anchor: middle; }
.map .fridge-temp { fill: #7ec8ff; font: 600 15px ui-monospace, Menlo, monospace; letter-spacing: 0.06em; }
.map .box-label { fill: #2a1d10; font: 700 13px var(--sans); letter-spacing: 0.14em; }
.map .box-count { fill: #3b2a18; font: 600 12px var(--sans); }
.map .box-grid line { stroke: rgba(180, 138, 90, 0.35); stroke-width: 1.5; }

.slot { transition: opacity 0.25s; }
.slot.empty circle { fill: rgba(255, 255, 255, 0.025); stroke: rgba(255, 255, 255, 0.13); stroke-width: 1.2; stroke-dasharray: 3 3; }
.bottle { cursor: pointer; outline: none; }
.bottle .glass { stroke: rgba(0, 0, 0, 0.55); stroke-width: 1.2; transition: filter 0.15s; }
.bottle .punt { fill: rgba(0, 0, 0, 0.32); stroke: rgba(255, 255, 255, 0.06); }
.bottle .foil { fill: none; stroke: var(--gold); stroke-width: 2.2; opacity: 0.85; }
.bottle .shine { fill: rgba(255, 255, 255, 0.28); pointer-events: none; }
.bottle .halo { fill: none; stroke: var(--gold); stroke-width: 2.5; opacity: 0; transition: opacity 0.2s; }
.bottle:hover .glass, .bottle:focus-visible .glass { filter: brightness(1.35) saturate(1.1); }
.bottle:focus-visible .halo { opacity: 0.8; stroke: #fff; }
.bottle.dim { opacity: 0.13; }
.bottle.hit .halo { opacity: 0.95; stroke: #fff1cf; }
.bottle.sel .halo { opacity: 1; stroke: var(--gold); }
.bottle.focus .halo { opacity: 1; stroke: #fff; animation: pulse 1.4s ease-in-out infinite; }
.slot.empty.focus circle { stroke: #fff; stroke-dasharray: none; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { stroke-width: 6; opacity: 0.55; } }

.placing .slot.empty { cursor: pointer; }
.placing .slot.empty circle { stroke: var(--gold); stroke-dasharray: none; fill: rgba(214, 178, 116, 0.08); animation: breathe 1.6s ease-in-out infinite; }
.placing .slot.empty:hover circle { fill: rgba(214, 178, 116, 0.35); }
.placing .bottle.moving .halo { opacity: 1; stroke: #fff; animation: pulse 1s infinite; }
.placing .bottle.swap:hover .halo { opacity: 1; stroke: var(--info); }
@keyframes breathe { 50% { fill: rgba(214, 178, 116, 0.18); } }

.boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.box { margin: 0; }
@media (max-width: 560px) { .boxes { grid-template-columns: repeat(2, 1fr); } }

.hit-line { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.hit-line b { color: var(--text); }

.tray {
  display: grid; gap: 14px; margin-bottom: 18px; padding: 14px 18px;
  border: 1px solid rgba(232, 183, 102, 0.3); border-radius: 14px; background: rgba(232, 183, 102, 0.06);
}
.tray h3 { font: 600 12px var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--warn); margin-bottom: 8px; }
.tray-items { display: flex; flex-wrap: wrap; gap: 8px; }
.tray-item { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; font-size: 13.5px; }
.tray-item em { color: var(--muted); font-style: normal; }
.tray-item:hover { border-color: var(--gold); }

/* ---------- collection ---------- */
.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--muted); font-size: 14px; }
.list-head b { color: var(--text); }
.select { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.select select { height: 34px; padding: 0 10px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line-2); color: var(--text); font: inherit; }

.wine-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.wine-list li + li { border-top: 1px solid var(--line); }
.wine-list.gone { opacity: 0.6; }
.wine-row {
  display: grid; grid-template-columns: 6px minmax(0, 1fr) 210px 170px 56px; gap: 18px; align-items: center;
  width: 100%; padding: 14px 18px 14px 0; text-align: left; background: none; border: 0; cursor: pointer;
  transition: background 0.15s;
}
.wine-row:hover, .wine-row.sel { background: var(--surface-2); }
.swatch { align-self: stretch; border-radius: 0 3px 3px 0; }
.wr-main { min-width: 0; }
.wr-name { display: block; font: 600 19px/1.2 var(--serif); }
.wr-sub { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-window { display: grid; gap: 4px; }
.wr-status { font-size: 12px; }
.wr-where { font-size: 12.5px; color: var(--muted); }
.wr-count { text-align: right; }
.wr-count b { display: block; font: 600 24px/1 var(--serif); }
.stars-mini { font-size: 11px; color: var(--gold); letter-spacing: 1px; }
@media (max-width: 860px) {
  .wine-row { grid-template-columns: 6px minmax(0, 1fr) 48px; row-gap: 6px; }
  .wr-window { grid-column: 2; }
  .wr-where { grid-column: 2; }
  .wr-count { grid-row: 1; grid-column: 3; }
}
.section-label { margin: 26px 0 10px; font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.empty-state { padding: 26px; color: var(--muted); text-align: center; }
.empty-state.big { max-width: 520px; margin: 40px auto; padding: 40px 30px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty-state.big h2 { font: 600 28px var(--serif); color: var(--text); margin-bottom: 10px; }

/* status colours */
.status, .wr-status { font-weight: 500; }
.st-young.status, .st-young.wr-status { color: var(--info); }
.st-ready.status, .st-ready.wr-status { color: var(--ok); }
.st-peak.status, .st-peak.wr-status { color: var(--gold); }
.st-late.status, .st-late.wr-status { color: var(--warn); }
.st-past.status, .st-past.wr-status { color: var(--past); }
.st-unknown.status, .st-unknown.wr-status { color: var(--faint); }

/* drinking-window bar */
.wbar { position: relative; padding-bottom: 20px; }
.wbar.compact { padding-bottom: 0; }
.wbar-track { position: relative; height: 6px; border-radius: 6px; background: var(--surface-3); }
.wbar.compact .wbar-track { height: 4px; }
.wbar-win { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, rgba(157, 187, 224, 0.75), rgba(163, 201, 160, 0.9) 35%, rgba(214, 178, 116, 1) 65%, rgba(232, 143, 133, 0.85)); }
.wbar-best { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; background: var(--gold); border: 2px solid var(--bg); transform: translate(-50%, -50%); }
.wbar.compact .wbar-best { width: 8px; height: 8px; border-width: 1.5px; }
.wbar-now { position: absolute; top: -5px; bottom: -5px; width: 2px; background: #fff; border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 8px rgba(255, 255, 255, 0.6); }
.wbar-labels span { position: absolute; top: 12px; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wbar-labels .best { color: var(--gold); }
.wbar-labels .now { top: -22px; color: #fff; font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- journal ---------- */
.journal { columns: 3 300px; column-gap: 16px; }
.entry {
  break-inside: avoid; margin-bottom: 16px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.entry.pending { border-style: dashed; }
.entry-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.entry-kind { padding: 1px 7px; border-radius: 999px; background: var(--surface-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.entry-wine { display: flex; align-items: baseline; gap: 8px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font: 600 20px/1.2 var(--serif); }
.entry-wine:hover { color: var(--gold); }
.entry-wine em { color: var(--muted); font-style: normal; font-size: 16px; }
.entry-wine .dot { transform: translateY(-2px); }
.stars { color: var(--gold); letter-spacing: 2px; font-size: 14px; }
.stars .off { color: var(--surface-3); }
.entry-food { font-size: 13px; color: var(--muted); font-style: italic; margin-top: 4px; }
.entry-notes { margin-top: 6px; white-space: pre-wrap; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5, 3, 4, 0.55); backdrop-filter: blur(2px); }
@media (min-width: 1280px) { .scrim { display: none; } }
.drawer {
  position: fixed; z-index: 50; top: 0; right: 0; bottom: 0;
  width: min(460px, 100vw); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-left: 1px solid var(--line-2); box-shadow: var(--shadow);
  animation: slide-in 0.25s ease-out;
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
@media (min-width: 1280px) { body.drawer-open main, body.drawer-open .toolbar, body.drawer-open .stats, body.drawer-open .masthead { padding-right: 488px; } }
@media (max-width: 640px) {
  .drawer { top: auto; height: 90vh; width: 100vw; border-left: 0; border-top: 1px solid var(--line-2); border-radius: 20px 20px 0 0; animation-name: slide-up; }
  @keyframes slide-up { from { transform: translateY(60px); opacity: 0; } }
}
.d-head { position: relative; padding: 28px 26px 22px; background: linear-gradient(180deg, rgba(142, 34, 54, 0.32), transparent); border-bottom: 1px solid var(--line); }
.d-head.st-white { background: linear-gradient(180deg, rgba(215, 184, 102, 0.22), transparent); }
.d-head.st-rose, .d-head.st-sparkling-rose { background: linear-gradient(180deg, rgba(227, 140, 127, 0.22), transparent); }
.d-head.st-sparkling { background: linear-gradient(180deg, rgba(214, 178, 116, 0.2), transparent); }
.d-head.st-other { background: linear-gradient(180deg, rgba(110, 40, 100, 0.3), transparent); }
.d-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; font-size: 14px; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.d-head h2 { margin: 8px 40px 6px 0; font: 600 32px/1.08 var(--serif); }
.d-region { font-size: 15px; }
.d-varietal { font-size: 13.5px; color: var(--muted); }
.d-body { padding: 8px 26px 40px; }
.d-body section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.d-body h3 { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin-bottom: 8px; }
.d-body section > p + h3 { margin-top: 16px; }
.d-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.d-row h3 { margin: 0; }
.d-window .wbar { margin-top: 26px; }
.status { font-size: 13.5px; }

.locs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.locs li { display: flex; gap: 6px; }
.locs li.focus .loc { border-color: rgba(214, 178, 116, 0.7); background: var(--gold-soft); }
.loc {
  flex: 1; display: flex; align-items: center; gap: 12px; padding: 9px 12px; text-align: left;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 13.5px;
}
.loc:hover { border-color: var(--line-2); }
.loc code, .radio code { padding: 4px 7px; border-radius: 6px; background: var(--bg); color: var(--gold); min-width: 58px; text-align: center; }
.loc-move { padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.loc-move:hover { color: var(--text); border-color: var(--line-2); }
.warn { margin-top: 10px; font-size: 13.5px; color: var(--warn); }

.d-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.d-actions .btn { height: 46px; font-size: 15px; }
.d-notes .entry { padding: 12px 14px; margin-bottom: 10px; background: var(--surface-2); }
.pre { white-space: pre-wrap; }

.teaser {
  position: relative; display: grid; gap: 4px; margin-top: 18px; padding: 20px 52px 20px 20px; border-radius: 16px;
  color: var(--text); text-decoration: none; overflow: hidden; border: 1px solid rgba(157, 187, 224, 0.22);
  background:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,.4), transparent 60%),
    radial-gradient(1px 1px at 85% 70%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(420px 180px at 100% 120%, rgba(214, 178, 116, 0.22), transparent 70%),
    linear-gradient(160deg, #0d1324, #120e18);
  transition: transform .2s, border-color .2s;
}
.teaser:hover { border-color: rgba(214, 178, 116, 0.55); transform: translateY(-1px); }
.teaser-kicker { font: 600 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--info); }
.teaser-title { font: 600 26px/1.1 var(--serif); }
.teaser-text { font-size: 13px; color: var(--muted); }
.teaser-go { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--gold); transition: transform .2s; }
.teaser:hover .teaser-go { transform: translate(4px, -50%); }

/* ---------- dialog / forms ---------- */
dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0;
  color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(5, 3, 4, 0.65); backdrop-filter: blur(3px); }
.form { display: grid; gap: 14px; padding: 26px; }
.form h2 { font: 600 28px/1.1 var(--serif); margin-top: -4px; }
.form h2 em { color: var(--muted); font-style: normal; }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form input:not([type='radio']), .form textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg);
  color: var(--text); font: inherit; font-size: 15px; outline: none;
}
.form input:focus, .form textarea:focus { border-color: rgba(214, 178, 116, 0.6); box-shadow: 0 0 0 3px var(--gold-soft); }
.form textarea { resize: vertical; min-height: 90px; }
.form fieldset { border: 0; margin: 0; padding: 0; }
.form legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.form-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; }
.choices { display: grid; gap: 6px; max-height: 210px; overflow-y: auto; }
.radio { display: flex !important; grid-template-columns: none; align-items: center; gap: 10px !important; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--text) !important; cursor: pointer; }
.radio:has(input:checked) { border-color: rgba(214, 178, 116, 0.6); background: var(--gold-soft); }
.radio input { accent-color: var(--gold); margin: 0; }
.radio span { font-size: 13.5px; }
.hint { font-size: 12.5px; color: var(--faint); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.form-extra { display: flex; gap: 10px; flex-wrap: wrap; }

.star-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.star-input legend { width: 100%; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 28px; line-height: 1; color: var(--surface-3); cursor: pointer; transition: color 0.1s, transform 0.1s; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: var(--gold); }
.star-input label:hover { transform: scale(1.12); }
.star-input input:focus-visible + label { outline: 2px solid var(--gold); border-radius: 4px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- floating bits ---------- */
.tooltip {
  position: fixed; top: 0; left: 0; z-index: 70; pointer-events: none;
  display: grid; gap: 2px; max-width: 280px; padding: 10px 12px;
  background: rgba(26, 20, 23, 0.96); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow);
  font-size: 12.5px; color: var(--muted);
}
.tooltip b { font: 600 16px/1.2 var(--serif); color: var(--text); }
.tooltip code { color: var(--gold); }

.placing-banner {
  position: fixed; z-index: 60; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; width: max-content; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 18px; border-radius: 14px; font-size: 14px;
  background: var(--surface-2); border: 1px solid rgba(214, 178, 116, 0.5); box-shadow: var(--shadow);
}
.placing-banner span { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.placing-banner code { color: var(--gold); }

.toast {
  position: fixed; z-index: 80; left: 50%; top: 18px; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  background: #f4ece4; color: #1a1417; box-shadow: var(--shadow); animation: drop 0.25s ease-out;
}
@keyframes drop { from { transform: translate(-50%, -10px); opacity: 0; } }

.foot { padding-bottom: 40px; font-size: 12.5px; color: var(--faint); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
