/* Loch House Pipeline — shared styles (tokens, site nav, sub nav, controls, dialogs) */
:root {
  /* Brand palette — sampled from the Loch House Marketing logo */
  --ink: #13293d;
  --ink-900: #0c1d2b;
  --ink-soft: #4d5f6d;
  --ink-faint: #7b8a97;
  --teal: #1f5a6b;
  --teal-400: #4a7d88;
  --teal-200: #a9c6cc;
  --sage: #7d8f69;
  --gold: #e8ae55;
  --gold-600: #cf9238;
  --gold-ink: #8a5a14;
  --cream: #f6f3ec;
  --cream-2: #ece6d9;
  --paper: #fdfcf8;
  --line: rgba(19, 41, 61, .10);
  --line-strong: rgba(19, 41, 61, .18);

  /* Spacing tokens */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* Depth: base → elevated → raised → floating */
  --sh-elevated: 0 1px 1px rgba(19,41,61,.04), 0 2px 4px -1px rgba(19,41,61,.06), 0 6px 16px -8px rgba(31,90,107,.16);
  --sh-raised:   0 1px 2px rgba(19,41,61,.05), 0 8px 18px -6px rgba(19,41,61,.14), 0 18px 36px -18px rgba(31,90,107,.28);
  --sh-floating: 0 2px 4px rgba(12,29,43,.08), 0 18px 40px -10px rgba(12,29,43,.32), 0 40px 80px -24px rgba(31,90,107,.38);

  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  --sitenav-h: 64px;
  --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body: 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html:not([data-role="admin"]) [data-admin] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 0% 0%, rgba(74,125,136,.10), transparent 60%),
    radial-gradient(900px 500px at 100% 10%, rgba(232,174,85,.10), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(125,143,105,.12), transparent 60%),
    var(--cream);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
/* Board page: fixed-height app shell */
body.app-shell { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

.grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .07; mix-blend-mode: multiply;
}
body.grain::after { position: fixed; z-index: 0; }

button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ───────────── Row 1: site nav (one line) ───────────── */
.sitenav {
  position: sticky; top: 0; flex: none; isolation: isolate; overflow: hidden; z-index: 4;
  color: var(--cream);
  background:
    radial-gradient(500px 120px at 50% 100%, rgba(232,174,85,.14), transparent 70%),
    radial-gradient(700px 200px at 0% 0%, rgba(74,125,136,.40), transparent 60%),
    linear-gradient(180deg, var(--ink-900), var(--ink));
}
.sitenav.grain::after { opacity: .12; mix-blend-mode: overlay; z-index: -1; }
/* Table Mountain silhouette — right side, sized so the whole shape fits in the bar */
.sitenav-art {
  position: absolute; z-index: -1; right: calc(max(0px, (100% - 1600px) / 2) + 196px); bottom: 0;
  height: 50px; aspect-ratio: 1158 / 122;
  background: linear-gradient(180deg, #6a9aa3, #3a6a77);
  -webkit-mask: url("../brand-assets/table-mountain-mono-smooth.svg") bottom / 100% 100% no-repeat;
          mask: url("../brand-assets/table-mountain-mono-smooth.svg") bottom / 100% 100% no-repeat;
  opacity: .5;
}
/* Loch Ness monster — left side, drawn to match the logo's Nessie */
.sitenav::before {
  content: ""; position: absolute; z-index: -1; left: calc(max(0px, (100% - 1600px) / 2) + 222px); bottom: 2px; width: 118px; height: 46px; pointer-events: none;
  background: linear-gradient(180deg, #6a9aa3, #3a6a77);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 46'%3E%3Cpath fill-rule='evenodd' d='M2 40C16 35 34 31 52 32.5C60 33.2 66 34.5 72 34C80 33.3 84 27 86 18C88 10 92 5 98 5C103 5 107 7 109 9.5L104.5 11C100.5 10.3 97.5 11.5 96.3 14.5C94.5 22 93 32 92 40ZM100.6 6.6a1.1 1.1 0 1 0 0.01 0Z'/%3E%3Cpath d='M0 43.5h26M34 43.5h30M74 43.5h28M108 43.5h12' stroke='black' stroke-width='1.6' stroke-linecap='round' opacity='.55'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 46'%3E%3Cpath fill-rule='evenodd' d='M2 40C16 35 34 31 52 32.5C60 33.2 66 34.5 72 34C80 33.3 84 27 86 18C88 10 92 5 98 5C103 5 107 7 109 9.5L104.5 11C100.5 10.3 97.5 11.5 96.3 14.5C94.5 22 93 32 92 40ZM100.6 6.6a1.1 1.1 0 1 0 0.01 0Z'/%3E%3Cpath d='M0 43.5h26M34 43.5h30M74 43.5h28M108 43.5h12' stroke='black' stroke-width='1.6' stroke-linecap='round' opacity='.55'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .6;
}
@media (max-width: 1100px) { .sitenav::before { display: none; } .sitenav-art { right: 180px; opacity: .3; } }
.sitenav-inner {
  max-width: 1600px; margin: 0 auto; height: 64px; padding: 0 var(--s-5);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-4);
}
.sitenav-inner > :last-child { justify-self: end; }
.brand { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; color: inherit; justify-self: start; border-radius: 8px; transition: opacity .2s ease, transform .25s var(--spring); }
.brand:hover { opacity: .85; }
.brand:active { transform: scale(.98); }
.brand svg { width: 26px; height: 27px; }
.brand-word { line-height: 1; }
.brand-word strong { display: block; font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: .06em; text-transform: uppercase; }
.brand-word span { display: block; font-size: 9px; letter-spacing: .42em; text-transform: uppercase; color: var(--teal-200); margin-top: 3px; }

.nav {
  display: flex; gap: 2px; padding: 4px; border-radius: 14px;
  background: rgba(253,252,248,.07); border: 1px solid rgba(253,252,248,.12);
  backdrop-filter: blur(8px);
}
.nav a {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 16px; border-radius: 10px;
  color: rgba(246,243,236,.78); text-decoration: none; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, transform .25s var(--spring);
}
.nav a svg { width: 16px; height: 16px; opacity: .85; }
.nav a:hover { background: rgba(253,252,248,.10); color: var(--cream); }
.nav a:active { transform: scale(.96); }
.nav a[aria-current="page"] {
  background: var(--paper); color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 16px -8px rgba(0,0,0,.5);
}
.nav a[aria-current="page"] svg { color: var(--gold-600); opacity: 1; }

.user-chip {
  display: inline-flex; align-items: center; gap: var(--s-2); padding: 3px 12px 3px 3px; border-radius: 999px;
  background: rgba(253,252,248,.08); border: 1px solid rgba(253,252,248,.14); cursor: pointer; text-align: left;
  transition: transform .25s var(--spring), background-color .2s ease;
}
.user-chip:hover { background: rgba(253,252,248,.14); transform: translateY(-1px); }
.user-chip:active { transform: translateY(0) scale(.97); }
.user-chip .avatar { width: 28px; height: 28px; font-size: 10.5px; box-shadow: 0 0 0 2px rgba(253,252,248,.25); }
.user-chip b { font-weight: 600; font-size: 13px; display: block; line-height: 1.2; }
.user-chip .role-tag { display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-200); line-height: 1.2; }

/* News: unread badge on the nav tab */
.nav a { position: relative; }
.nav-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 800; line-height: 1; color: var(--ink-900); background: var(--gold);
  box-shadow: 0 0 0 2px var(--ink-900);
}
.nav a[aria-current="page"] .nav-badge { box-shadow: 0 0 0 2px var(--paper); }
.nav-badge.vital { color: #fff; background: #c4362c; animation: badgePulse 2s ease-in-out infinite; }
@keyframes badgePulse { 50% { transform: scale(1.12); } }

/* Vital message banner (shown under the sub nav on every page except News) */
.vital-banner { position: relative; z-index: 2; flex: none; background: linear-gradient(90deg, #a62a22, #c4362c 40%, #b52f26); color: #fff; box-shadow: 0 8px 20px -14px rgba(166,42,34,.8); }
.vb-inner { max-width: 1600px; margin: 0 auto; padding: 9px var(--s-5); display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.vb-inner > svg { width: 18px; height: 18px; flex: none; }
.vb-tag { flex: none; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); padding: 1px 7px; border-radius: 5px; }
.vb-inner b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vb-by { color: rgba(255,255,255,.75); font-size: 12px; white-space: nowrap; }
.vb-read { margin-left: auto; flex: none; color: #fff; font-weight: 700; text-decoration: none; padding: 4px 12px; border-radius: 8px; background: rgba(255,255,255,.16); transition: background-color .2s ease, transform .25s var(--spring); }
.vb-read:hover { background: rgba(255,255,255,.28); }
.vb-read:active { transform: scale(.96); }
.vital-banner .vb-x { color: rgba(255,255,255,.85); }
.vital-banner .vb-x:hover { color: #fff; background: rgba(255,255,255,.16); }
@media (max-width: 760px) {
  .vb-inner { padding: 8px 48px 8px var(--s-4); flex-wrap: wrap; row-gap: 6px; }
  .vb-inner b { white-space: normal; flex: 1 1 100%; order: 3; }
  .vb-by { display: none; }
  .vb-read { order: 2; }
  .vital-banner .vb-x { position: absolute; top: 6px; right: 8px; }
}
/* Narrow phones: make room for every nav tab (admins have five) */
@media (max-width: 440px) {
  .sitenav-inner { grid-template-columns: 1fr auto; padding: 0 10px; }
  .sitenav-inner .brand { display: none; }
  .nav { justify-self: start; }
  .nav a { padding: 0 8px; font-size: 12.5px; }
  .nav-badge { min-width: 16px; height: 16px; font-size: 9.5px; padding: 0 4px; }
}

/* Account menu */
.user-menu {
  position: fixed; z-index: 2200; width: 280px; padding: 8px; border-radius: 16px;
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--sh-floating);
  animation: pop .3s var(--spring);
}
.um-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.um-head b { display: block; font-size: 14px; line-height: 1.3; }
.um-head > div span { display: block; font-size: 12px; color: var(--ink-faint); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.um-head > div { min-width: 0; }
.um-role { display: flex; flex-direction: column; gap: 4px; margin: 0 4px 6px; padding: 10px; border-radius: 11px; background: rgba(19,41,61,.04); font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
.user-menu a, .user-menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 0; background: transparent;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13px; cursor: pointer; text-align: left;
  transition: background-color .15s ease, transform .2s var(--spring);
}
.user-menu a svg, .user-menu button svg { width: 16px; height: 16px; color: var(--ink-soft); }
.user-menu a:hover, .user-menu button:hover { background: rgba(19,41,61,.06); }
.user-menu a:active, .user-menu button:active { transform: scale(.98); }
.role-pill { align-self: flex-start; display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; line-height: 18px; padding: 0 8px; border-radius: 6px; }
.role-pill.r-admin { color: #fff; background: var(--ink); }
.role-pill.r-developer { color: var(--teal); background: rgba(74,125,136,.16); }
.role-pill.r-sales { color: var(--gold-ink); background: rgba(232,174,85,.24); }

/* ───────────── Row 2: page sub nav (one line) ───────────── */
.subnav {
  position: sticky; top: var(--sitenav-h); z-index: 3; flex: none;
  background: rgba(253,252,248,.86); backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 20px -16px rgba(19,41,61,.35);
}
.subnav-inner {
  max-width: 1600px; margin: 0 auto; min-height: 60px; padding: 10px var(--s-5);
  display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap;
}
.page-title { display: flex; align-items: baseline; gap: var(--s-3); min-width: 0; margin-right: auto; }
.page-title h1 { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: -0.03em; margin: 0; white-space: nowrap; }
.summary { margin: 0; color: var(--ink-faint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary b { color: var(--ink); font-weight: 700; }
.tools { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.tools .inp { width: auto; height: 38px; font-size: 13px; min-width: 140px; }

/* Sub-nav section links (in-page navigation) */
.jump { display: flex; gap: 2px; }
.jump a {
  height: 34px; padding: 0 12px; border-radius: 9px; display: inline-flex; align-items: center;
  color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, transform .25s var(--spring);
}
.jump a:hover { background: rgba(19,41,61,.06); color: var(--ink); }
.jump a:active { transform: scale(.96); }
.jump a.on { background: rgba(232,174,85,.18); color: var(--ink); }

.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-faint); pointer-events: none; }
.search input {
  width: 240px; height: 38px; padding: 0 12px 0 34px; border-radius: 11px;
  background: #fff; border: 1px solid var(--line-strong); font-size: 13px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.search input::placeholder { color: var(--ink-faint); }
.search input:hover { border-color: rgba(19,41,61,.3); }
.search input:focus { outline: none; border-color: var(--teal-400); box-shadow: 0 0 0 3px rgba(74,125,136,.18); }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: rgba(19,41,61,.05); border: 1px solid var(--line); }
.seg button {
  height: 30px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft);
  font-weight: 600; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, transform .25s var(--spring);
}
.seg button svg { width: 12px; height: 12px; }
.seg button:hover { background: rgba(19,41,61,.06); color: var(--ink); }
.seg button:active { transform: scale(.96); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--sh-elevated); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  font-weight: 600; font-size: 13.5px; white-space: nowrap; user-select: none; text-decoration: none;
  transition: transform .3s var(--spring), box-shadow .25s ease, background-color .2s ease, opacity .2s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-gold { background: linear-gradient(180deg, #f0bd6c, var(--gold)); color: var(--ink-900); box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 6px 16px -6px rgba(232,174,85,.7); }
.btn-gold:hover { box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 10px 22px -8px rgba(232,174,85,.85); }
.btn-ink { background: var(--ink); color: var(--cream); box-shadow: 0 6px 16px -8px rgba(19,41,61,.6); }
.btn-ink:hover { background: #1a3650; }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
.btn-ghost:hover { background: rgba(19,41,61,.04); color: var(--ink); }
.btn-danger { background: transparent; color: #a24a3c; border-color: rgba(162,74,60,.28); }
.btn-danger:hover { background: rgba(162,74,60,.07); }
.btn-danger.armed { background: #a24a3c; color: #fff; border-color: #a24a3c; }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.tools .btn { height: 38px; border-radius: 11px; }

.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 9px; border: 0; background: transparent;
  color: var(--ink-soft); cursor: pointer; transition: transform .25s var(--spring), background-color .2s ease, color .2s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: rgba(19,41,61,.07); color: var(--ink); }
.icon-btn:active { transform: scale(.9); }

.inp {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-strong); background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.inp:hover { border-color: rgba(19,41,61,.3); }
.inp:focus { outline: none; border-color: var(--teal-400); box-shadow: 0 0 0 3px rgba(74,125,136,.18); }
select.inp { appearance: none; cursor: pointer; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%234d5f6d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center no-repeat; padding-right: 32px; }

.avatar {
  width: 20px; height: 20px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  font-size: 8.5px; font-weight: 700; letter-spacing: .02em; color: #fff; background: var(--teal);
  box-shadow: 0 0 0 2px var(--paper); line-height: 1;
}

/* Stage chip (text stays in ink; the dot carries the colour) */
.stage {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.stage::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

/* Interest meter — single-hue sequential (gold), magnitude = number of lit bars */
.meter { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); line-height: 1; }
.meter-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.meter-bars i { width: 4px; border-radius: 2px 2px 1px 1px; background: rgba(19,41,61,.12); }
.meter-bars i:nth-child(1) { height: 4px; } .meter-bars i:nth-child(2) { height: 6px; } .meter-bars i:nth-child(3) { height: 8px; }
.meter-bars i:nth-child(4) { height: 10px; } .meter-bars i:nth-child(5) { height: 12px; }
.meter-bars i.on { background: var(--gold-600); }
.meter.l4 .meter-bars i.on, .meter.l5 .meter-bars i.on { background: #c0761a; }
.meter.l0 .meter-label { color: var(--ink-faint); font-weight: 500; }

/* Site tags */
.site-tag {
  flex: none; display: inline-flex; align-items: center; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 16px;
  padding: 0 6px; border-radius: 5px; color: var(--ink-faint); background: rgba(19,41,61,.06); white-space: nowrap;
}
.site-tag.lh { color: var(--gold-ink); background: rgba(232,174,85,.22); }

/* Page content (History / Stats) */
.page { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: var(--s-5) var(--s-5) var(--s-7); }
.panel {
  background: linear-gradient(180deg, rgba(253,252,248,.92), rgba(253,252,248,.78));
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-elevated);
}
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
.section-sub { color: var(--ink-faint); font-size: 13px; margin: 4px 0 0; }
.empty-state { text-align: center; padding: var(--s-7) var(--s-5); color: var(--ink-faint); }
.empty-state svg { width: 40px; height: 42px; color: var(--cream-2); margin-bottom: var(--s-3); }
.empty-state b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--ink); margin-bottom: 4px; }
mark { background: rgba(232,174,85,.35); color: inherit; border-radius: 3px; padding: 0 1px; }
a.link { color: var(--teal); text-decoration: none; font-weight: 600; border-radius: 4px; }
a.link:hover { text-decoration: underline; text-underline-offset: 2px; }
a.link:active { opacity: .7; }

/* ───────────── Dialogs ───────────── */
dialog {
  border: 0; padding: 0; border-radius: 22px; background: var(--paper); color: var(--ink);
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  box-shadow: var(--sh-floating);
}
dialog[open] { animation: pop .4s var(--spring); }
dialog::backdrop { background: rgba(12,29,43,.45); backdrop-filter: blur(4px); animation: fade .25s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

#whoDlg { width: min(440px, calc(100vw - 24px)); }
.who-body { padding: var(--s-6) var(--s-6) var(--s-5); text-align: center; }
.who-body svg.mark { width: 44px; height: 46px; color: var(--ink); }
.who-body h2 { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin: var(--s-3) 0 0; line-height: 1.1; }
.who-body p { color: var(--ink-soft); margin: var(--s-2) 0 var(--s-5); }

/* Toast + tooltip (floating layer) */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 2000; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--cream); padding: 10px 16px; border-radius: 12px; font-size: 13px; font-weight: 500;
  box-shadow: var(--sh-floating); transition: transform .4s var(--spring), opacity .25s ease; max-width: calc(100vw - 32px);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
/* Success popup — centred card over a warm glow, confetti between them */
.win-glow {
  position: fixed; inset: 0; z-index: 2400;
  background:
    radial-gradient(520px 380px at 50% 50%, rgba(232,174,85,.32), transparent 70%),
    rgba(12,29,43,.38);
  backdrop-filter: blur(2px);
  animation: glowIn .4s ease both;
}
.win-glow.out { animation: glowOut .35s ease both; }
@keyframes glowIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes glowOut { to { opacity: 0; } }
.win-pop {
  position: fixed; left: 50%; top: 50%; z-index: 2600; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 44px 36px 32px; border-radius: 28px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  background:
    radial-gradient(420px 220px at 50% 0%, rgba(232,174,85,.26), transparent 70%),
    radial-gradient(320px 160px at 100% 100%, rgba(37,107,60,.10), transparent 70%),
    var(--paper);
  border: 1px solid rgba(207,146,56,.4);
  box-shadow: 0 0 0 8px rgba(253,252,248,.18), var(--sh-floating), 0 30px 120px -20px rgba(232,174,85,.55);
  animation: winIn .7s var(--spring) both;
}
.win-pop.out { animation: winOut .3s ease both; }
@keyframes winIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.6); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes winOut { to { opacity: 0; transform: translate(-50%, -50%) scale(.94); } }
.win-x { position: absolute; top: 14px; right: 14px; }
.win-badge {
  position: relative; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-900);
  background: radial-gradient(circle at 40% 35%, #ffe2a6, var(--gold) 58%, var(--gold-600));
  box-shadow: 0 0 0 6px rgba(232,174,85,.22), 0 16px 34px -12px rgba(207,146,56,.9);
  animation: badgePop .9s var(--spring) .1s both;
}
.win-badge svg { position: relative; width: 40px; height: 42px; }
.win-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(232,174,85,.7); animation: ring 1.8s ease-out .3s infinite; }
.win-ring.r2 { animation-delay: 1.2s; }
@keyframes badgePop { from { transform: scale(.3) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ring { from { transform: scale(1); opacity: .8; } to { transform: scale(1.9); opacity: 0; } }
.win-kicker { margin: 22px 0 0; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-ink); }
.win-pop h2 { margin: 8px 0 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 6vw, 38px); line-height: 1.08; letter-spacing: -0.03em; color: var(--ink); }
.win-sub { margin: 12px 0 0; font-size: 15px; color: var(--ink-soft); line-height: 1.6; }
.win-sub strong { color: var(--ink); font-weight: 700; }
.win-ok { margin-top: 26px; min-width: 160px; height: 46px; }

.tip {
  position: fixed; left: 0; top: 0; z-index: 2100; pointer-events: none; opacity: 0;
  background: var(--ink-900); color: var(--cream); padding: 8px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.5;
  box-shadow: var(--sh-floating); max-width: 260px; transition: opacity .12s ease;
}
.tip.show { opacity: 1; }
.tip b { font-weight: 700; }
.tip .tip-sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

@media (max-width: 900px) {
  .user-chip .txt { display: none; }
  .user-chip { padding: 3px; }
}
@media (max-width: 760px) {
  .sitenav-inner { height: 56px; padding: 0 var(--s-4); gap: var(--s-2); grid-template-columns: auto 1fr auto; }
  .nav { justify-self: center; }
  .brand-word { display: none; }
  .nav a { padding: 0 10px; height: 32px; font-size: 13px; gap: 5px; }
  .sitenav-art { right: 0; height: auto; width: 100%; opacity: .22; }
  :root { --sitenav-h: 56px; }
  .tools.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-4) 2px; }
  .tools.scroll-x::-webkit-scrollbar { display: none; }
  .tools.scroll-x > * { flex: none; }
  .tools.scroll-x .search { flex: 1 0 190px; }
  .tools.scroll-x .inp { min-width: 150px; }
  .subnav-inner { padding: 10px var(--s-4); gap: var(--s-2) var(--s-3); }
  .page-title { width: 100%; }
  .page-title h1 { font-size: 22px; }
  .tools { width: 100%; }
  .tools > * { flex: 1 1 auto; }
  .search input { width: 100%; }
  .tools .inp { min-width: 0; }
  .jump { overflow-x: auto; scrollbar-width: none; }
  .page { padding: var(--s-4) var(--s-4) var(--s-6); }
}
@media (max-width: 400px) {
  .nav a svg { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
