/* Stumble Inn — Lantern After Dark
   One premium system. Not a Linear clone. Not Starnet amber. */

:root {
  --bg: #0b100f;
  --bg-deep: #070a09;
  --surface: rgba(20, 26, 24, 0.62);
  --surface-solid: #151c1a;
  --surface-lift: #1c2421;
  --line: rgba(230, 216, 176, 0.13);
  --line-strong: rgba(230, 216, 176, 0.28);
  --ink: #f4efe4;
  --ink-soft: #c7c0b3;
  --ink-mute: #b7b0a3;
  --brass: #d4b483;
  --brass-bright: #efe0bc;
  --moss: #8fb89a;
  --frost: #7eb8b4;
  --ember: #c97b6a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.28);
  --radius: 22px;
  --radius-sm: 14px;
  --max: 1180px;
  --nav-h: 72px;
  --ease: cubic-bezier(.25, .46, .45, .94);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Outfit", "Avenir Next", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-sans: var(--font-body);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
  max-width: 100%;
}
body {
  margin: 0;
  min-height: 100%;
  padding-bottom: 96px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  font-size: 16.5px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  overflow-x: clip;
  max-width: 100%;
}
body.nav-open {
  overflow: hidden;
  touch-action: none;
}

/* Layered atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: -56px 0;
  z-index: -2;
  transform: translate3d(0, var(--mesh-y, 0px), 0);
  will-change: transform;
  pointer-events: none;
  background:
    radial-gradient(980px 560px at 12% -8%, rgba(212, 180, 131, 0.28), transparent 58%),
    radial-gradient(760px 520px at 88% 6%, rgba(126, 184, 180, 0.20), transparent 52%),
    radial-gradient(680px 540px at 72% 78%, rgba(110, 61, 69, 0.22), transparent 56%),
    radial-gradient(560px 440px at 16% 90%, rgba(143, 184, 154, 0.16), transparent 52%),
    linear-gradient(180deg, #141a16 0%, var(--bg) 32%, #0c1211 70%, var(--bg-deep) 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: -56px 0;
  z-index: -1;
  transform: translate3d(0, var(--grain-y, 0px), 0);
  will-change: transform;
  pointer-events: none;
  opacity: 0.22;
  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='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

img { max-width: 100%; display: block; }
a { color: var(--brass-bright); text-decoration: none; }
a:hover { color: var(--ink); }
button, input, textarea, select {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.35;
  color: inherit;
}
button { cursor: pointer; }
a.btn, button.btn {
  font-family: var(--font-body) !important;
  font-size: 13.5px;
  line-height: 1.2;
}

.wrap {
  width: min(var(--max), calc(100% - 48px));
  margin-inline: auto;
}

/* ===== Nav ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  background: rgba(11, 16, 15, 0.55);
  /* blur lives on ::before so fixed mobile drawer uses the viewport */
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
  max-width: 100%;
}
.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: inherit;
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}
.topbar.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(11, 16, 15, 0.78);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(var(--max), calc(100% - 48px));
  max-width: 100%;
  min-width: 0;
  margin-inline: auto;
  box-sizing: border-box;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  flex: 1 1 auto;
  min-width: 0;
}
.brand > span {
  min-width: 0;
  overflow: hidden;
}
.brand h1, .brand p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 550;
  font-size: 17px;
  color: #1a140c;
  background:
    radial-gradient(circle at 30% 25%, #fff6d8, var(--brass) 55%, #9a7a48);
  box-shadow: 0 0 0 1px rgba(255, 236, 190, 0.35), 0 8px 20px rgba(212, 180, 131, 0.22);
}
.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 550;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.brand p {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}

.nav-primary {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  flex: 1;
}
.nav-backdrop {
  display: none;
}
.nav-primary a {
  font-family: var(--font-sans, "Segoe UI", system-ui, sans-serif);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.2;
  padding: 8px 12px;
  border-radius: 999px;
  transition: color .14s var(--ease), background .14s var(--ease);
}
.nav-primary a:hover,
.nav-primary a[aria-current="page"] {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
  max-width: 100%;
}
.subtle-link {
  color: var(--ink-mute);
  font-size: 14px;
  padding: 8px 10px;
}
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  padding: 0;
  flex: 0 0 auto;
  z-index: 46;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  position: relative;
  margin: 0 auto;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--brass-bright), var(--brass));
  color: #1a140c;
  font-family: var(--font-sans, "Segoe UI", system-ui, sans-serif);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 100%;
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 8px 22px rgba(212, 180, 131, 0.22);
  transition: transform .14s var(--ease), filter .14s var(--ease), background .14s var(--ease);
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); color: #1a140c; }
.btn.ghost {
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255,255,255,0.08); color: var(--ink); border-color: var(--line-strong); }
.btn.tiny {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  line-height: 1.2;
}
.account-bar .btn {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}
.card .btn.tiny,
.project .btn.tiny {
  font-size: 12.5px;
  height: 32px;
}

/* ===== Type ===== */
.kicker {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}
h2, .display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
}
.lede {
  margin: 16px 0 0;
  max-width: 36em;
  color: var(--ink-soft);
  font-size: 17.5px;
  line-height: 1.5;
}
.muted { color: var(--ink-mute); }
.tone-rest { color: #c4bdb0; font-weight: 450; font-style: italic; }

.section { padding: 96px 0 8px; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}
.section-head h2 {
  font-size: clamp(28px, 3.4vw, 42px);
  max-width: 16ch;
}
.section-head p {
  margin: 0;
  max-width: 34em;
  color: var(--ink-mute);
  font-size: 15.5px;
}

/* ===== Hero ===== */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  padding: 72px 0 28px;
  animation: rise .7s var(--ease) both;
}
.hero h2, .hero .display {
  font-size: clamp(42px, 5.6vw, 72px);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.inn-window {
  position: relative;
  border-radius: 28px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.03) inset;
  animation: fade-in .85s .08s var(--ease) both;
  transform: translate3d(0, var(--window-y, 0px), 0);
  will-change: transform;
}
.inn-window::before {
  content: "";
  position: absolute;
  inset: auto 18% -40px 18%;
  height: 70px;
  background: radial-gradient(ellipse at center, rgba(212,180,131,0.28), transparent 70%);
  filter: blur(8px);
  z-index: -1;
}
.window-chrome {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px 12px;
  color: var(--ink-mute);
  font-size: 12px;
}
.window-chrome i {
  width: 9px; height: 9px; border-radius: 99px; display: block;
  background: #3d4441;
}
.window-chrome i:nth-child(1) { background: #c97b6a; }
.window-chrome i:nth-child(2) { background: #d4b483; }
.window-chrome i:nth-child(3) { background: #8fb89a; }
.window-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  grid-template-rows: 150px 110px;
  gap: 10px;
}
.pane {
  border-radius: 16px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
}
.pane strong { font-size: 14px; display: block; }
.pane span { font-size: 12px; color: var(--ink-soft); }
.pane.a {
  background:
    linear-gradient(180deg, transparent 20%, rgba(7,10,9,0.55)),
    radial-gradient(320px 160px at 20% 0%, rgba(212,180,131,0.35), transparent 60%),
    #1b1510;
}
.pane.b {
  background:
    radial-gradient(200px 120px at 80% 0%, rgba(126,184,180,0.35), transparent 60%),
    #13201f;
}
.pane.c {
  background:
    radial-gradient(180px 100px at 10% 100%, rgba(143,184,154,0.28), transparent 60%),
    #142018;
}
.pane.d {
  background:
    radial-gradient(160px 90px at 90% 20%, rgba(201,123,106,0.25), transparent 55%),
    #1c1614;
}

/* ===== Bento ===== */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(150px, auto);
  gap: 14px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  color: var(--ink);
  overflow: hidden;
  backdrop-filter: blur(16px);
  transition: transform .16s var(--ease), border-color .16s var(--ease), background .16s var(--ease);
}
.tile:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: rgba(28, 36, 33, 0.82);
  color: var(--ink);
}
.tile h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 520;
  letter-spacing: -0.02em;
}
.tile p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }
.tile .go {
  margin-top: 10px;
  font-size: 13px;
  color: var(--brass);
  letter-spacing: 0.02em;
}
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-3 { grid-column: span 3; }
.tall { min-height: 240px; }
.tile.featured {
  background:
    linear-gradient(180deg, rgba(11,16,15,0.15), rgba(11,16,15,0.62)),
    radial-gradient(500px 240px at 90% 10%, rgba(212,180,131,0.22), transparent 55%),
    #171410;
  min-height: 280px;
}
.tile.frost {
  background:
    radial-gradient(280px 180px at 100% 0%, rgba(126,184,180,0.22), transparent 60%),
    var(--surface);
}
.tile.mossy {
  background:
    radial-gradient(280px 180px at 0% 100%, rgba(143,184,154,0.18), transparent 60%),
    var(--surface);
}

.ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  margin-bottom: auto;
  font-size: 16px;
}

/* ===== Cards ===== */
.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  position: relative;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(14px);
  transition: transform .16s var(--ease), border-color .16s var(--ease);
}
.card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.card h3 {
  margin: 10px 0 8px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 520;
  letter-spacing: -0.02em;
}
.note { color: var(--ink-soft); font-size: 14.5px; margin: 0; }
.card .btn { margin-top: 6px; }

/* video thumbnails: real YouTube image over a brand gradient (the gradient is the fallback) */
.thumb {
  height: 150px;
  border-radius: 14px;
  margin: -6px -6px 14px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #15201c, #2f5a4c);
  isolation: isolate;
}
.thumb.tone-brass { background: linear-gradient(145deg, #2a2218, #6a4d2e 40%, #1a1410); }
.thumb.tone-moss { background: linear-gradient(145deg, #15201c, #2f5a4c); }
.thumb-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* hqdefault is 4:3 with letterbox bars; a slight zoom crops them out of 16:9 boxes */
  transform: scale(1.02);
  z-index: 0;
}
.thumb.thumb-failed .thumb-img { display: none; }
.thumb.is-short .thumb-img { object-fit: cover; object-position: 50% 40%; }
.thumb.has-img::after { /* soft vignette so the badge + play button stay readable */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(7,10,9,0.18), transparent 35%, transparent 65%, rgba(7,10,9,0.35));
}
.thumb-badge {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  padding: 3px 8px; border-radius: 99px;
  background: rgba(8,10,9,0.62);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(244,239,228,0.88);
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  line-height: 1.4;
}
.thumb-play {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 99px;
  border: 1.5px solid rgba(255,255,255,0.6);
  background: rgba(8,10,9,0.38);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.thumb-play::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  margin: -8px 0 0 -5px;
  border-style: solid; border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent rgba(244,239,228,0.92);
}
.feat-video { display: grid; grid-template-columns: 1.45fr 0.9fr; gap: 14px; align-items: stretch; }
.feat-video.is-solo { grid-template-columns: minmax(0, 760px); }
/* lead card: the picture grows to fill the card, so there's no empty strip under the button */
.feat-video .card.lead { display: flex; flex-direction: column; }
.feat-video .card.lead .thumb { height: auto; min-height: 280px; aspect-ratio: 16 / 9; flex: 1 1 auto; }
.feat-video .card.lead .card-foot { flex: 0 0 auto; }
.feat-video .card.lead .card-foot h3 { margin-top: 4px; }
.feat-side { align-content: start; }
/* side column: compact horizontal cards (picture left, words right) */
.feat-side .card { display: grid; grid-template-columns: minmax(0, 46%) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 16px; align-items: start; padding: 14px; }
.feat-side .card .thumb { grid-row: 1 / span 3; height: auto; aspect-ratio: 16 / 9; margin: 0; }
.feat-side .card h3 { font-size: 17px; line-height: 1.25; margin: 2px 0 6px; }
.feat-side .card .note { font-size: 13px; }
.feat-side .card p:last-child { margin: 8px 0 0; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: rgba(255,255,255,0.04);
}
.badge.demo { color: var(--brass-bright); border-color: rgba(212,180,131,0.35); }
.badge.warn { color: #f0c2b6; border-color: rgba(201,123,106,0.45); background: rgba(201,123,106,0.12); }
.badge.ok { color: var(--sage, #c5d9c4); border-color: rgba(143,184,154,0.4); }
.pill {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.filters button {
  font-family: var(--font-sans, "Segoe UI", system-ui, sans-serif);
  font-size: 13px;
  line-height: 1.2;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.filters button[aria-pressed="true"],
.filters button:hover {
  background: rgba(212,180,131,0.14);
  color: var(--ink);
  border-color: rgba(212,180,131,0.35);
}

/* lists / rules / status */
.rule {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.rule:last-child { border-bottom: 1px solid var(--line); }
.idx {
  font-family: var(--font-mono);
  color: var(--ink-mute);
  font-size: 13px;
  padding-top: 4px;
}
.status-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 99px;
  background: var(--ink-mute);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.04);
}
.status-dot.placeholder { background: var(--brass); }
.status-dot.ok { background: #6fbf86; box-shadow: 0 0 0 3px rgba(111,191,134,.2); }
.status-dot.down { background: #c97b6a; box-shadow: 0 0 0 3px rgba(201,123,106,.2); }
.ow-join code { font-size: 1.05em; }
.ow-spark { color: var(--brass); display: block; margin: .5rem 0; opacity: .9; }
.channel-banner { width: 100%; max-height: 200px; object-fit: cover; border-radius: 12px; margin-bottom: 1rem; }
.channel-stats { display: flex; flex-wrap: wrap; gap: 1rem; margin: .75rem 0; }
.channel-stats .stat { min-width: 5rem; }
.channel-stats .stat strong { display: block; font-size: 1.25rem; }
.empty-editable { border-style: dashed; opacity: .92; }
.channel-socials, .channel-links { display: flex; flex-wrap: wrap; gap: .5rem; }


.gallery {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  grid-template-rows: 170px 170px;
  gap: 10px;
}
.shot {
  border-radius: 16px;
  border: 1px solid var(--line);
  display: grid;
  place-items: end start;
  padding: 14px;
  color: var(--ink-soft);
  font-size: 12px;
  overflow: hidden;
}
.shot:first-child { grid-row: span 2; }

.lock {
  text-align: left;
  padding: 40px;
  background:
    radial-gradient(400px 180px at 10% 0%, rgba(201,123,106,0.12), transparent 55%),
    var(--surface);
}

.role-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.field span { font-size: 13px; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  padding: 12px 14px;
  outline: none;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.35;
}
.field input:focus, .field textarea:focus {
  border-color: rgba(212,180,131,0.55);
  box-shadow: 0 0 0 4px rgba(212,180,131,0.12);
}
.field textarea { min-height: 120px; resize: vertical; }

/* modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(5, 8, 7, 0.62);
  backdrop-filter: blur(10px);
}
.modal.open { display: grid; }
.dialog {
  width: min(440px, 100%);
  border-radius: 24px;
  padding: 28px;
  background: #161d1b;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.dialog h2 { font-size: 32px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* pet + hunt */
/* ===== Inn moth (dock + flying pet) =====
   Skins: every colour of the sprite comes from the --moth-* variables below.
   Add a skin with  .moth-skinned[data-moth-skin="name"] { --moth-…: … }
   Patterns: [data-moth-pattern] chooses which wing pattern layers show. */
.pet-dock {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  width: 236px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px 10px 10px;
  border-radius: 20px;
  background: rgba(18, 24, 22, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
}
.pet-perch {
  position: relative;
  flex: 0 0 auto;
  width: 50px;
  height: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: none;
  color: inherit;
  cursor: pointer;
}
.pet-perch:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
/* folded dock (default on phones): just the lantern; tap it for Call home / Hide / Habitat */
.pet-dock.is-collapsed { width: auto; padding: 6px; gap: 0; }
.pet-dock.is-collapsed .pet-copy { display: none; }
/* little hanging inn lantern the moth sits on */
.pet-perch::before {
  content: "";
  position: absolute;
  left: 50%; top: 14px;
  width: 30px; height: 3px;
  margin-left: -15px;
  border-radius: 3px;
  background: linear-gradient(90deg, #6d5638, #b8945e 50%, #6d5638);
}
.pet-lamp {
  position: absolute;
  left: 50%; top: 17px;
  width: 22px; height: 30px;
  margin-left: -11px;
  border-radius: 7px 7px 9px 9px;
  border: 2px solid #8e7149;
  background: radial-gradient(circle at 50% 55%, #fff3cf 0, #f2c97a 30%, rgba(212, 150, 70, 0.5) 62%, rgba(40, 30, 18, 0.7) 100%);
  box-shadow: 0 0 18px 4px rgba(242, 196, 110, 0.28);
}
.pet-lamp::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -6px;
  width: 8px; height: 4px; margin-left: -4px;
  border-radius: 0 0 4px 4px;
  background: #8e7149;
}
.pet-dock.is-moth-hidden .pet-lamp { filter: saturate(.4) brightness(.6); box-shadow: none; }
.pet-copy { min-width: 0; }
.pet-dock strong { display: block; font-size: 13px; }
.pet-dock small { display: block; color: var(--ink-mute); font-size: 11.5px; line-height: 1.35; }
.pet-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pet-btn {
  font: inherit;
  font-size: 11px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
}
.pet-btn:hover { color: var(--ink); border-color: rgba(212, 180, 131, 0.5); }
.pet-btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.pet-btn[aria-pressed="true"] { color: var(--brass-bright); border-color: rgba(212, 180, 131, 0.55); }

.inn-moth, .moth-skinned {
  /* ---- appearance config (default skin: brass) ---- */
  --moth-wing: #d9b47a;
  --moth-wing-hi: #f6e6bf;
  --moth-wing-lo: #9c7446;
  --moth-wing-edge: rgba(92, 62, 34, 0.55);
  --moth-vein: rgba(120, 84, 46, 0.32);
  --moth-band: rgba(124, 82, 44, 0.42);
  --moth-hind: #c9965d;
  --moth-hind-hi: #e8c78f;
  --moth-spot: #6e3d45;
  --moth-spot-core: #f3dcae;
  --moth-fuzz: #e8d4aa;
  --moth-fuzz-hi: #fff8e8;
  --moth-ruff: rgba(255, 250, 236, 0.9);
  --moth-body: #c39a63;
  --moth-stripe: rgba(110, 74, 40, 0.5);
  --moth-eye: #1b140d;
  --moth-glint: #fffaf0;
  --moth-blush: rgba(201, 123, 106, 0.55);
  --moth-antenna: #8a6a43;
  --moth-leg: #b8915c;
  --moth-glow-color: rgba(246, 210, 140, 0.5);
  --moth-glow-base: 0;          /* resting glow strength (ghost/ember use it) */
  --moth-wing-alpha: 1;         /* wing fill opacity (ghost) */
  --moth-edge-w: 1.6;           /* wing rim thickness (donut dough, stained-glass lead) */
  --moth-vein-w: .9;
  --moth-star: #fff6d8;
  --moth-neb-a: #c58cff;
  --moth-neb-b: #6fd3ff;
  --moth-candy-a: #ffb3cf;
  --moth-candy-b: #b9f0d6;
  --moth-candy-c: #fff0a6;
  --moth-candy-line: rgba(255, 255, 255, 0.75);
  --moth-lead: #241a14;
  --moth-pane-1: #b8344d;
  --moth-pane-2: #2f6fb8;
  --moth-pane-3: #2e9a6a;
  --moth-pane-4: #e3a83a;
  --moth-ember: #ff8a3a;
  /* ---- size / motion (JS reads nothing from here except size) ---- */
  --moth-w: 60px;
  --flap: .15s;

}
.inn-moth {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 41; /* above sticky topbar (40) so it can sit on nav tabs; below nav backdrop (42), menu (50), modals/drawers (80/90) */
  width: var(--moth-w);
  height: calc(var(--moth-w) * 0.8333);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  pointer-events: none; /* only painted wing/body shapes catch clicks */
  -webkit-tap-highlight-color: transparent;
  display: none; /* moth.js shows it once it knows where home is */
}
.inn-moth.is-live {
  display: block;
  left: 0; top: 0; right: auto; bottom: auto;
  will-change: transform;
  transform-origin: 50% 97%;
}
.inn-moth.is-gone { display: none; }
.inn-moth.is-shy { opacity: 0; transition: opacity .2s; }
.inn-moth:focus { outline: none; }
.moth-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.moth-rig, .moth-glow { pointer-events: none; }
.moth-wing-shape, .moth-thorax, .moth-face, .moth-abdomen { pointer-events: visiblePainted; }

.moth-glow circle { opacity: var(--moth-glow-base); transition: opacity .4s; }
.inn-moth.is-near-light .moth-glow circle { opacity: .75; }

/* wing/body fills are url(#…) attributes in the sprite (gradients read the --moth-* variables) */
.moth-wing-shape, .moth-x-tail { fill-opacity: var(--moth-wing-alpha); }
.moth-wing-edge { fill: none; stroke: var(--moth-wing-edge); stroke-width: var(--moth-edge-w); stroke-linejoin: round; }
.moth-vein { fill: none; stroke: var(--moth-vein); stroke-width: var(--moth-vein-w); stroke-linecap: round; }
.moth-pat-bands { fill: none; stroke: var(--moth-band); stroke-width: 2.2; stroke-linecap: round; }
.moth-spot, .moth-spot-sm { fill: var(--moth-spot); }
.moth-spot-core { fill: var(--moth-spot-core); }
.moth-spot-glint { fill: var(--moth-glint); opacity: .8; }
.moth-antenna-shaft { fill: none; stroke: var(--moth-antenna); stroke-width: 1.5; stroke-linecap: round; }
.moth-antenna-barbs { fill: none; stroke: var(--moth-antenna); stroke-width: .8; stroke-linecap: round; opacity: .85; }
.moth-leg { fill: none; stroke: var(--moth-leg); stroke-width: 2.3; stroke-linecap: round; }
.moth-foot { fill: var(--moth-leg); }
.moth-abdomen { fill: var(--moth-body); }
.moth-stripe { fill: none; stroke: var(--moth-stripe); stroke-width: 1.6; stroke-linecap: round; }
/* fuzzy rim: a dashed thick stroke reads as fur at this size */
.moth-ruff { fill: none; stroke: var(--moth-ruff); stroke-width: 3; stroke-dasharray: 1.2 1.6; stroke-linecap: round; opacity: .75; }
.moth-eye { fill: var(--moth-eye); }
.moth-eye-glint { fill: var(--moth-glint); }
.moth-blush { fill: var(--moth-blush); }

/* pattern switches */
.moth-skinned[data-moth-pattern="eyespot"] .moth-pat-bands,
.moth-skinned[data-moth-pattern="bands"] .moth-pat-eyespot,
.moth-skinned[data-moth-pattern="plain"] .moth-pat { display: none; }

/* skins (same names as the habitat "Look" options) */
.moth-skinned[data-moth-skin="moss"] {
  --moth-wing: #9fbf98; --moth-wing-hi: #e2efd2; --moth-wing-lo: #5f7f62;
  --moth-hind: #87a983; --moth-wing-edge: rgba(46, 70, 50, 0.55); --moth-vein: rgba(52, 80, 56, 0.3);
  --moth-band: rgba(52, 80, 56, 0.42); --moth-spot: #4f3a2c; --moth-spot-core: #eaf2d6;
  --moth-hind-hi: #b8d3ae; --moth-fuzz: #e4ead2; --moth-body: #9bb08c; --moth-antenna: #5f6f4c; --moth-leg: #8fa27e;
  --moth-glow-color: rgba(176, 222, 170, 0.32);
}
.moth-skinned[data-moth-skin="frost"] {
  --moth-wing: #b6d6d4; --moth-wing-hi: #f2fbfa; --moth-wing-lo: #6f9c9a;
  --moth-hind: #a2c4c6; --moth-wing-edge: rgba(48, 82, 88, 0.5); --moth-vein: rgba(56, 92, 98, 0.28);
  --moth-band: rgba(56, 92, 98, 0.38); --moth-spot: #3c4f6a; --moth-spot-core: #f2fbff;
  --moth-hind-hi: #cfe6e6; --moth-fuzz: #eef6f4; --moth-body: #a9c6c4; --moth-antenna: #5d7f86; --moth-leg: #8fb2b6;
  --moth-glow-color: rgba(190, 236, 240, 0.32);
}

/* ---- decoration layers: hidden unless a skin switches them on ---- */
.moth-x { display: none; }
.moth-star { fill: var(--moth-star); }
.moth-sprinkle { stroke: none; }
.moth-spr-1 { fill: #ff6b8b; } .moth-spr-2 { fill: #ffd84d; } .moth-spr-3 { fill: #5fd0ff; }
.moth-spr-4 { fill: #8be07a; } .moth-spr-5 { fill: #ffffff; }
.moth-pane { stroke: var(--moth-lead); stroke-width: 1.5; stroke-linejoin: round; }
.moth-pane-1 { fill: var(--moth-pane-1); } .moth-pane-2 { fill: var(--moth-pane-2); }
.moth-pane-3 { fill: var(--moth-pane-3); } .moth-pane-4 { fill: var(--moth-pane-4); }
.moth-x-gloss { fill: #ffffff; opacity: .5; }
.moth-x-glowedge { fill: none; stroke: var(--moth-ember); stroke-width: 4.2; stroke-linejoin: round; opacity: .55; }

/* Exotic skins (all open for now; MOTH_SKIN_DEFS marks them unlockable for later hunt gating) */
.moth-skinned[data-moth-skin="galaxy"] {
  --moth-wing: #3b2a8c; --moth-wing-hi: #8a5cf0; --moth-wing-lo: #120d36;
  --moth-hind: #241a63; --moth-hind-hi: #6a46d8; --moth-wing-edge: rgba(190, 170, 255, 0.55);
  --moth-vein: rgba(200, 180, 255, 0.18); --moth-neb-a: #e07cff; --moth-neb-b: #5ad1ff; --moth-star: #fffbe8;
  --moth-fuzz: #cfc6f5; --moth-fuzz-hi: #fbf8ff; --moth-ruff: rgba(240, 236, 255, 0.85); --moth-body: #5a46b8;
  --moth-stripe: rgba(220, 210, 255, 0.45); --moth-antenna: #b9a8ff; --moth-leg: #a99be8; --moth-blush: rgba(255, 140, 210, 0.5);
  --moth-glow-color: rgba(150, 120, 255, 0.45); --moth-glow-base: .35;
}
.moth-skinned[data-moth-skin="galaxy"] .moth-x-nebula,
.moth-skinned[data-moth-skin="galaxy"] .moth-x-stars { display: inline; }
.moth-skinned[data-moth-skin="candy"] {
  --moth-wing: #ffd0e0; --moth-wing-hi: #ffffff; --moth-wing-lo: #ff9fc0; --moth-hind: #c8f3df; --moth-hind-hi: #ffffff;
  --moth-wing-edge: rgba(230, 110, 150, 0.7); --moth-vein: transparent; --moth-candy-a: #ffaecb; --moth-candy-b: #bff2da; --moth-candy-c: #fff2a8;
  --moth-fuzz: #fff1f6; --moth-fuzz-hi: #ffffff; --moth-body: #ffb8cf; --moth-stripe: rgba(255, 255, 255, 0.85);
  --moth-antenna: #e27aa0; --moth-leg: #f19bbb; --moth-glow-color: rgba(255, 190, 220, 0.45);
}
.moth-skinned[data-moth-skin="candy"] .moth-x-stripes,
.moth-skinned[data-moth-skin="candy"] .moth-x-gloss { display: inline; }
.moth-skinned[data-moth-skin="donut"] {
  --moth-wing: #ff9cc0; --moth-wing-hi: #ffd6e6; --moth-wing-lo: #f27aa6; --moth-hind: #ff9cc0; --moth-hind-hi: #ffc6dc;
  --moth-wing-edge: #c8843f; --moth-edge-w: 4.2; --moth-vein: transparent;
  --moth-fuzz: #e0a35c; --moth-fuzz-hi: #f6d39b; --moth-ruff: rgba(255, 236, 200, 0.8); --moth-body: #d3914b;
  --moth-stripe: rgba(120, 70, 30, 0.45); --moth-antenna: #9a6430; --moth-leg: #d3914b; --moth-glow-color: rgba(255, 180, 120, 0.4);
}
.moth-skinned[data-moth-skin="donut"] .moth-x-sprinkles,
.moth-skinned[data-moth-skin="donut"] .moth-x-gloss { display: inline; }
.moth-skinned[data-moth-skin="donut"] .moth-x-gloss { opacity: .35; }
.moth-skinned[data-moth-skin="ember"] {
  --moth-wing: #3a2a24; --moth-wing-hi: #6a3f2a; --moth-wing-lo: #1a1311; --moth-hind: #2c201c; --moth-hind-hi: #5a3424;
  --moth-wing-edge: #ffd27a; --moth-edge-w: 1.2; --moth-vein: rgba(255, 140, 60, 0.28); --moth-star: #ffb347; --moth-ember: #ff7a2a;
  --moth-fuzz: #d9a27a; --moth-fuzz-hi: #ffe2bf; --moth-body: #8a4a2c; --moth-stripe: rgba(255, 170, 90, 0.5);
  --moth-antenna: #e0904f; --moth-leg: #c9875a; --moth-glow-color: rgba(255, 140, 50, 0.5); --moth-glow-base: .45;
}
.moth-skinned[data-moth-skin="ember"] .moth-x-glowedge,
.moth-skinned[data-moth-skin="ember"] .moth-x-stars { display: inline; }
.moth-skinned[data-moth-skin="luna"] {
  --moth-wing: #bfe8b8; --moth-wing-hi: #f0fbe6; --moth-wing-lo: #86c493; --moth-hind: #b3e2ae; --moth-hind-hi: #e8f8de;
  --moth-wing-edge: rgba(150, 80, 110, 0.75); --moth-vein: rgba(80, 130, 90, 0.3); --moth-spot: #f2d36b; --moth-spot-core: #7b5a8a;
  --moth-fuzz: #f6f8ee; --moth-fuzz-hi: #ffffff; --moth-body: #e9efdc; --moth-stripe: rgba(150, 170, 140, 0.5);
  --moth-antenna: #b78a5a; --moth-leg: #b7a07a; --moth-glow-color: rgba(200, 255, 200, 0.4);
}
.moth-skinned[data-moth-skin="luna"] .moth-x-tail { display: inline; }
.moth-skinned[data-moth-skin="stained"] {
  --moth-wing: #3a2a20; --moth-wing-hi: #3a2a20; --moth-wing-lo: #3a2a20; --moth-hind: #3a2a20; --moth-hind-hi: #3a2a20;
  --moth-lead: #4a3826; --moth-wing-edge: #caa46a; --moth-edge-w: 2.4; --moth-vein: transparent;
  --moth-pane-1: #b5475a; --moth-pane-2: #3d74b0; --moth-pane-3: #3f9670; --moth-pane-4: #dba64a;
  --moth-fuzz: #e6d7b8; --moth-fuzz-hi: #fff8e6; --moth-body: #8f6b4a; --moth-antenna: #6a5038; --moth-leg: #a07e58;
  --moth-glow-color: rgba(255, 220, 150, 0.4);
}
.moth-skinned[data-moth-skin="stained"] .moth-x-panes,
.moth-skinned[data-moth-skin="stained"] .moth-x-gloss { display: inline; }
.moth-skinned[data-moth-skin="stained"] .moth-x-gloss { opacity: .22; }
.moth-skinned[data-moth-skin="ghost"] {
  --moth-wing: #dfe9f2; --moth-wing-hi: #ffffff; --moth-wing-lo: #a9bccd; --moth-hind: #d2deea; --moth-hind-hi: #ffffff;
  --moth-wing-alpha: .5; --moth-wing-edge: rgba(230, 245, 255, 0.7); --moth-vein: rgba(255, 255, 255, 0.35);
  --moth-fuzz: #eef4fa; --moth-fuzz-hi: #ffffff; --moth-ruff: rgba(255, 255, 255, 0.6); --moth-body: #dbe6f0;
  --moth-stripe: rgba(170, 190, 210, 0.5); --moth-eye: #1a2230; --moth-blush: rgba(170, 200, 255, 0.45);
  --moth-antenna: #c9d8e6; --moth-leg: #c9d8e6; --moth-glow-color: rgba(190, 225, 255, 0.55); --moth-glow-base: .5;
}
.moth-skinned[data-moth-skin="ghost"] .moth-body, .moth-skinned[data-moth-skin="ghost"] .moth-antenna { opacity: .9; }

/* tiny accents: stepped timing (few repaints/second), all off under reduced motion */
.moth-skinned[data-moth-skin="galaxy"] .moth-tw-a { animation: moth-twinkle 2.8s steps(4, end) infinite; }
.moth-skinned[data-moth-skin="galaxy"] .moth-tw-b { animation: moth-twinkle 3.6s steps(4, end) infinite reverse; }
.moth-skinned[data-moth-skin="ember"] .moth-x-glowedge { animation: moth-flicker 3.2s steps(8, end) infinite; }
.moth-skinned[data-moth-skin="ember"] .moth-tw-a { animation: moth-twinkle 2.2s steps(4, end) infinite; }
.moth-skinned[data-moth-skin="ghost"] .moth-glow circle { animation: moth-haunt 4s steps(8, end) infinite alternate; }
@keyframes moth-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes moth-flicker { 0% { opacity: .55; } 20% { opacity: .75; } 35% { opacity: .5; } 60% { opacity: .8; } 80% { opacity: .6; } 100% { opacity: .55; } }
@keyframes moth-haunt { from { opacity: .35; } to { opacity: .65; } }

/* rig transform origins are in sprite units (viewBox 0 0 120 100) */
.moth-forewing, .moth-hindwing, .moth-antenna, .moth-head, .moth-body, .moth-rig, .moth-leg, .moth-foot, .moth-eyes {
  transform-box: view-box;
}
.moth-forewing, .moth-hindwing { transform-origin: 56px 57px; transition: transform .35s var(--ease); }
.moth-wing-inner { transform-box: view-box; transform-origin: 56px 57px; }
.moth-antenna { transform-origin: 56px 37px; transition: transform .4s var(--ease); }
.moth-head { transform-origin: 60px 52px; }
.moth-body { transform-origin: 60px 90px; }
.moth-rig { transform-origin: 60px 97px; }
.moth-eyes { transform-origin: 60px 45px; }
.moth-leg, .moth-foot { transform-origin: 56px 66px; transition: transform .3s var(--ease); }

/* flying: wings beat, legs tuck a little */
.inn-moth.is-flying .moth-forewing .moth-wing-inner { animation: moth-flap var(--flap) ease-in-out infinite alternate; }
.inn-moth.is-flying .moth-hindwing .moth-wing-inner { animation: moth-flap-hind var(--flap) ease-in-out infinite alternate; animation-delay: calc(var(--flap) * -0.35); }
.inn-moth.is-flying .moth-leg, .inn-moth.is-flying .moth-foot { transform: rotate(14deg) scaleY(.86); }
.inn-moth.is-flying .moth-antenna { transform: rotate(6deg); }
.inn-moth.is-gliding { --flap: .32s; }
.inn-moth.is-excited { --flap: .09s; }

/* resting: wings fold back into a soft tent, antennae relax outward */
.inn-moth.is-resting .moth-forewing { transform: rotate(-22deg) scale(.74, .88); }
.inn-moth.is-resting .moth-hindwing { transform: rotate(-8deg) scale(.72, .8); }
.inn-moth.is-resting .moth-antenna { transform: rotate(-16deg); }
/* tucked: perched somewhere cramped (nav tabs) — antennae swept right back */
.inn-moth.is-resting.is-tucked .moth-antenna { transform: rotate(-42deg); }
.inn-moth.is-resting .moth-body { animation: moth-breathe 3.6s ease-in-out infinite; }

/* idle moments, toggled briefly by moth.js */
.inn-moth.is-blink .moth-eyes { animation: moth-blink .22s ease-in-out 1; }
.inn-moth.is-twitch .moth-left .moth-antenna { animation: moth-twitch .5s ease-in-out 1; }
.inn-moth.is-preen .moth-head { animation: moth-preen 1.4s ease-in-out 1; }
.inn-moth.is-preen .moth-left .moth-leg, .inn-moth.is-preen .moth-left .moth-foot { animation: moth-preen-leg 1.4s ease-in-out 1; }
.inn-moth.is-shuffle .moth-forewing .moth-wing-inner { animation: moth-shuffle .7s ease-in-out 1; }
.inn-moth.is-happy .moth-rig { animation: moth-happy .7s cubic-bezier(.3,1.6,.5,1) 1; }
.inn-moth.is-happy .moth-eyes { animation: moth-squint .7s ease-in-out 1; }

@keyframes moth-flap { from { transform: scaleX(1) rotate(0deg); } to { transform: scaleX(.18) rotate(8deg); } }
@keyframes moth-flap-hind { from { transform: scaleX(1); } to { transform: scaleX(.3) rotate(4deg); } }
@keyframes moth-breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.975); } }
@keyframes moth-blink { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.1); } }
@keyframes moth-twitch { 0%, 100% { transform: rotate(-16deg); } 30% { transform: rotate(-4deg); } 60% { transform: rotate(-22deg); } }
@keyframes moth-preen { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg) translateY(1px); } 55% { transform: rotate(7deg) translateY(1px); } }
@keyframes moth-preen-leg { 0%, 100% { transform: rotate(0); } 30%, 60% { transform: rotate(38deg) scaleY(.7); } }
@keyframes moth-shuffle { 0%, 100% { transform: scaleX(1); } 40% { transform: scaleX(.55) rotate(6deg); } }
@keyframes moth-happy { 0% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-10px) rotate(-10deg) scale(1.06); } 60% { transform: translateY(-4px) rotate(9deg); } 100% { transform: none; } }
@keyframes moth-squint { 0%, 100% { transform: scaleY(1); } 25%, 70% { transform: scaleY(.35); } }

/* sparkle dust on a happy click */
.moth-dust {
  position: fixed;
  left: 0; top: 0;
  z-index: 41;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6dc 0, #f1cf8a 55%, rgba(241, 207, 138, 0) 72%);
  pointer-events: none;
  animation: moth-dust .9s ease-out forwards;
}
@keyframes moth-dust {
  from { opacity: 1; transform: translate3d(var(--x0), var(--y0), 0) scale(1); }
  to { opacity: 0; transform: translate3d(var(--x1), var(--y1), 0) scale(.3); }
}

.hunt {
  position: absolute;
  font-size: 14px;
  color: rgba(212,180,131,0.22);
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.2em;
}
.hunt.a { top: 18%; left: 3%; }
.hunt.b { top: 62%; right: 4%; }
.hunt.c { bottom: 12%; left: 46%; }
.page-shell {
  position: relative;
  max-width: 100%;
  overflow-x: clip;
}


/* footer */
.site-footer {
  margin-top: 96px;
  padding: 48px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--ink-mute);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
}
.site-footer h3 {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  color: var(--ink-soft);
  font-weight: 500;
}
.site-footer a { display: block; color: var(--ink-mute); padding: 4px 0; font-size: 14px; }
.site-footer a:hover { color: var(--ink); }
.legal { margin-top: 32px; font-size: 12.5px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05) translateY(-1px); }
}

@media (max-width: 980px) {
  .hero, .feat-video, .section-head, .foot-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .gallery .shot:first-child { grid-row: span 1; min-height: 180px; }
  .bento { grid-template-columns: 1fr 1fr; }
  .span-7, .span-5, .span-4, .span-8, .span-6, .span-3 { grid-column: span 1; }
  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
  .nav-toggle { display: grid; place-items: center; order: 3; }
  .account-bar { order: 2; margin-left: auto; }
  .brand { order: 1; }
  /* Hide inline primary nav; drawer is fixed overlay — never expands the header row */
  .nav-primary {
    display: flex;
    position: fixed;
    top: var(--nav-h);
    right: 0;
    left: auto;
    width: min(20rem, 100vw);
    max-width: 100vw;
    height: calc(100dvh - var(--nav-h));
    height: calc(100vh - var(--nav-h));
    margin: 0;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 20px 16px 32px;
    background: rgba(11, 16, 15, 0.98);
    border-left: 1px solid var(--line);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.45);
    z-index: 45;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateX(105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .22s var(--ease), visibility 0s linear .22s;
  }
  .nav-primary a {
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 16px;
  }
  .account-bar .subtle-link { display: none; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 42;
    background: rgba(5, 8, 7, 0.72);
    /* Blur only the page behind; menu is in .topbar at z-index 50 when open */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s var(--ease), visibility 0s linear .22s;
  }
  body.nav-open .nav-primary {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform .22s var(--ease), visibility 0s linear 0s;
  }
  body.nav-open .nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .22s var(--ease), visibility 0s linear 0s;
  }
  body.nav-open .nav-toggle {
    border-color: rgba(212, 180, 131, 0.45);
    background: rgba(212, 180, 131, 0.12);
  }
  /* Raise the whole topbar stacking context above .nav-backdrop (z-index 42).
     .nav-primary lives INSIDE .topbar (z-index 40), so its own z-index:45 cannot
     escape — the backdrop was painting ON TOP of the menu and backdrop-filter
     blurred the menu itself (Edge narrow window / mobile side menu haze). */
  body.nav-open .topbar {
    z-index: 50;
  }
  /* Solid panel; no backdrop-filter on the menu (stays crisp above the dim). */
  body.nav-open .nav-primary {
    background: #0f1513;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .window-grid { grid-template-columns: 1fr 1fr; }
  .pet-dock {
    width: min(236px, calc(100% - 28px));
    right: 14px;
    left: auto;
    bottom: 14px;
    padding: 8px 10px 8px 8px;
  }
  .inn-moth { --moth-w: 52px; right: 14px; bottom: 14px; }
}

@media (max-width: 640px) {
  /* phones: smaller, calmer moth; dock gets compact */
  .inn-moth { --moth-w: 44px; }
  .pet-dock { width: auto; max-width: calc(100% - 28px); gap: 8px; }
  .pet-dock small[data-moth-status] { display: none; }
  .pet-perch { width: 44px; height: 48px; }
  .wrap, .topbar-inner { width: min(var(--max), calc(100% - 28px)); }
  .grid-4, .grid-3, .grid-2, .bento, .gallery, .window-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; gap: 28px; }
  .section { padding-top: 64px; }
  .feat-video .card.lead .thumb { min-height: 0; flex: none; }
  .dialog { padding: 22px; }
  .lock { padding: 24px; }
}

/* ===== Scroll motion (spacing unchanged: section padding stays 96px / 64px mobile) ===== */
.reveal {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes mesh-shift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, 24px, 0); }
}
@keyframes grain-shift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, -16px, 0); }
}

@supports (animation-timeline: scroll()) {
  body.js-scroll-timeline::before {
    animation: mesh-shift linear both;
    animation-timeline: scroll(root);
    animation-range: 0 180vh;
  }
  body.js-scroll-timeline::after {
    animation: grain-shift linear both;
    animation-timeline: scroll(root);
    animation-range: 0 180vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero, .inn-window { animation: none; }
  .inn-moth *, .moth-dust { animation: none !important; transition: none !important; }
  .reveal {
    opacity: 0;
    transform: none;
    transition: opacity .01s linear;
    transition-delay: 0ms !important;
  }
  .reveal.is-in { opacity: 1; }
  body::before,
  body::after,
  .inn-window {
    transform: none !important;
    animation: none !important;
    will-change: auto;
  }
}

@media (max-width: 980px) {
  .inn-window { will-change: auto; }
}

.project-empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--ink-soft);
  background: rgba(0,0,0,0.18);
}
.filters button[aria-pressed="true"] {
  border-color: var(--brass);
  color: var(--ink);
}

/* ===== Team Room / Admin Desk =====
   Scoped under [data-team] so marketing homepage .tile / .bento rules cannot
   restyle the board. Distinct .team-tile* class names avoid the collision that
   left Admin desk cards looking like full-width homepage bento tiles when the
   Team Room rules were missing (e.g. stale cached style.css without ?v=). */
body.is-team .wrap {
  width: min(1320px, calc(100% - 40px));
}
body.is-team .site-footer { margin-top: 48px; }

[data-team].team-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 18px 0 64px;
}
[data-team] .team-nav {
  position: sticky;
  top: calc(var(--nav-h) + 12px);
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
[data-team] .team-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.3;
}
[data-team] .team-nav a[aria-current="page"],
[data-team] .team-nav a:hover {
  background: var(--surface-lift);
  color: var(--ink);
}
[data-team] .team-nav-h {
  margin: 14px 0 6px;
  padding: 0 10px;
  font: 500 11px/1.2 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
[data-team] .team-nav-h:first-child { margin-top: 0; }
[data-team] .team-main { min-width: 0; }
[data-team] .team-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 18px;
}
[data-team] .team-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
}
[data-team] .team-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
[data-team] .count {
  display: inline-flex;
  min-width: 1.4em;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ember);
  color: #1a100c;
  font: 600 11px/1.6 var(--font-mono);
}
[data-team] .bell .count { margin-left: 4px; }
[data-team] .toast {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-lift);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
[data-team] .toast-err {
  border-color: rgba(201,123,106,.55);
  color: #f0d2cb;
}

/* Overview grid — never share the homepage .tile / .bento class names */
[data-team] .team-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
[data-team] .team-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 8px;
  min-height: 148px;
  color: var(--ink);
  box-shadow: none;
  transform: none;
  overflow: visible;
  backdrop-filter: none;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
[data-team] .team-tile:hover {
  transform: none;
  border-color: var(--line-strong);
  background: var(--surface-lift);
  color: var(--ink);
}
[data-team] .team-tile-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
[data-team] .team-tile-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 520;
  letter-spacing: -0.01em;
}
[data-team] .team-tile-head a { color: inherit; text-decoration: none; }
[data-team] .team-tile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
[data-team] .team-tile-list li {
  font-size: .95rem;
  color: var(--ink-soft);
}
[data-team] .team-tile-more {
  margin-top: auto;
  font-size: .9rem;
}
[data-team] .team-tile-figure {
  font: 500 1.5rem/1.2 var(--font-display);
  color: var(--brass-bright);
}

[data-team] .announce {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  background: linear-gradient(160deg, rgba(212,180,131,.08), transparent 55%), var(--surface);
  margin-bottom: 16px;
}
[data-team] .panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 16px 18px;
  margin: 0 0 14px;
}
[data-team] .panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
[data-team] .panel-head h3 { margin: 0; }
[data-team] .panel.detail .props {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 10px 0 14px;
}
[data-team] .panel.detail .props dt { color: var(--ink-mute); font-size: .85rem; }
[data-team] .panel.detail .props dd { margin: 0; }
[data-team] .pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font: 500 11px/1.6 var(--font-mono);
  color: var(--ink-soft);
}
[data-team] .pill-ok { border-color: rgba(143,184,154,.5); color: var(--moss); }
[data-team] .pill-warn { border-color: rgba(201,123,106,.55); color: #e9a899; }
[data-team] .pill-accent { border-color: rgba(212,180,131,.55); color: var(--brass-bright); }
[data-team] .row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
[data-team] .inline-form { display: inline; }
[data-team] .linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brass);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
[data-team] .view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--ink-soft);
}
[data-team] .view-switch a[aria-current="true"] { color: var(--ink); font-weight: 500; }
[data-team] .filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.18);
}
[data-team] .field.compact { min-width: 140px; flex: 1 1 140px; }
[data-team] .field.compact span { font-size: .8rem; }
[data-team] .field.check { flex-direction: row; align-items: center; gap: 8px; }
[data-team] .field-help { display: block; margin-top: 4px; color: var(--ink-mute); font-size: .8rem; }
[data-team] .field b { color: var(--ember); font-weight: 600; }
[data-team] .grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
[data-team] .kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
[data-team] .kanban-col {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.16);
  padding: 10px;
}
[data-team] .kanban-col h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
}
[data-team] .cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
[data-team] .card-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}
[data-team] .card-item .meta { grid-column: 2; margin: 0; color: var(--ink-mute); font-size: .85rem; }
[data-team] .card-link { color: inherit; text-decoration: none; }
[data-team] .bulk-bar {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}
[data-team] .bulk-check { margin: 0; }
[data-team] .week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
[data-team] .week .day {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: rgba(0,0,0,.14);
  min-height: 140px;
}
[data-team] .week .day h3 { margin: 0 0 6px; font-size: .9rem; }
[data-team] .week .day ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
[data-team] .slot {
  padding: 6px 8px;
  border-radius: 8px;
  border-left: 3px solid var(--brass);
  background: var(--surface);
  font-size: .85rem;
}
[data-team] .slot.c0{border-color:#d4b483}[data-team] .slot.c1{border-color:#8fb89a}[data-team] .slot.c2{border-color:#7eb8b4}
[data-team] .slot.c3{border-color:#c97b6a}[data-team] .slot.c4{border-color:#b5a0d4}[data-team] .slot.c5{border-color:#e0c07a}
[data-team] .slot-key {
  display: inline-block;
  margin: 0 8px 8px 0;
  padding: 2px 8px;
  border-left: 3px solid;
  background: var(--surface);
  border-radius: 6px;
  font-size: .85rem;
}
[data-team] .slot-key.c0{border-color:#d4b483}[data-team] .slot-key.c1{border-color:#8fb89a}[data-team] .slot-key.c2{border-color:#7eb8b4}
[data-team] .slot-key.c3{border-color:#c97b6a}[data-team] .slot-key.c4{border-color:#b5a0d4}[data-team] .slot-key.c5{border-color:#e0c07a}
[data-team] .week-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
[data-team] .legend { margin: 0 0 10px; }
[data-team] .lib-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
[data-team] .lib-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0,0,0,.14);
}
[data-team] .lib-card .meta,
[data-team] .inbox-list .meta {
  margin: 4px 0 0;
  color: var(--ink-mute);
  font-size: .85rem;
}
[data-team] .inbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
[data-team] .inbox-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0,0,0,.14);
}
[data-team] .table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
[data-team] table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
[data-team] table.data th,
[data-team] table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
[data-team] table.data th.num,
[data-team] table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
[data-team] table.data thead th {
  color: var(--ink-mute);
  font-weight: 500;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
[data-team] .figures {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0 0 14px;
}
[data-team] .fig {
  display: block;
  font: 500 1.6rem/1.1 var(--font-display);
  color: var(--brass-bright);
}
[data-team] .fig-label { color: var(--ink-mute); font-size: .85rem; }
[data-team] .comments,
[data-team] .history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
[data-team] .comment {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
[data-team] .comment-meta {
  margin: 0 0 4px;
  color: var(--ink-mute);
  font-size: .85rem;
}
[data-team] .history li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}
[data-team] .history li.unread { color: var(--ink); }
[data-team] .prose { line-height: 1.55; color: var(--ink-soft); }
[data-team] .mention { color: var(--brass-bright); font-weight: 500; }
[data-team] .chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  max-height: 55vh;
  overflow: auto;
}
[data-team] .chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
  position: sticky;
  bottom: 0;
  padding: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
}
[data-team] .chat-compose .field { margin: 0; }
[data-team] .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;
}
[data-team] .btn.danger {
  background: rgba(201,123,106,.2);
  border-color: rgba(201,123,106,.55);
  color: #f0d2cb;
}

/* Drawers — accessible slide-in (WAI-ARIA dialog). Works with :target without JS. */
.drawer { position: fixed; inset: 0; z-index: 80; display: none; }
.drawer:not([hidden]) { display: block; }
/* :target alone must NOT override [hidden] — that left drawers painted after navigate/back */
.drawer:target:not([hidden]) { display: block; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  cursor: default;
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--bg-deep);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: drawer-in .22s var(--ease);
}
.drawer.wide .drawer-panel { width: min(640px, 100%); }
@keyframes drawer-in {
  from { transform: translateX(18px); opacity: .6; }
  to { transform: none; opacity: 1; }
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-family: var(--font-display);
  font-weight: 500;
}
.drawer-x {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 4px 8px;
}
.drawer-body { padding: 16px 18px; overflow: auto; flex: 1; }
.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-solid);
  position: sticky;
  bottom: 0;
}
body.drawer-open { overflow: hidden; }

@media (max-width: 960px) {
  [data-team].team-shell { grid-template-columns: 1fr; gap: 16px; padding-top: 8px; }
  /* Compact top nav strip — horizontal scroll on narrow phones (~390px) */
  [data-team] .team-nav {
    position: static;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  [data-team] .team-nav-h {
    flex: 0 0 auto;
    margin: 0 4px 0 8px;
    padding: 0;
    white-space: nowrap;
  }
  [data-team] .team-nav-h:first-child { margin-left: 0; }
  [data-team] .team-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 12px;
    background: rgba(0,0,0,.22);
  }
  [data-team] .team-title { font-size: clamp(1.35rem, 5vw, 1.8rem); }
  [data-team] .team-tiles { grid-template-columns: 1fr; }
  [data-team] .kanban { grid-template-columns: 1fr; }
  [data-team] .week { grid-template-columns: 1fr 1fr; }
  [data-team] .table-wrap { margin-inline: -4px; }
  [data-team] table.data { font-size: .88rem; }
  [data-team] table.data th, [data-team] table.data td { padding: 8px; }
  .drawer-panel {
    width: 100%;
    border-left: 0;
    border-radius: 16px 16px 0 0;
    top: auto;
    bottom: 0;
    height: min(92vh, 100%);
    max-height: 92dvh;
    animation: sheet-in .22s var(--ease);
  }
  @keyframes sheet-in {
    from { transform: translateY(24px); }
    to { transform: none; }
  }
}
@media (max-width: 560px) {
  [data-team] .week { grid-template-columns: 1fr; }
  body.is-team .wrap { width: min(var(--max), calc(100% - 28px)); }
  body.is-team .hero, .page-shell .hero { padding-top: 28px; gap: 18px; }
  .page-shell .hero .display { font-size: clamp(28px, 8vw, 42px); }
  .page-shell .row-actions { display: flex; flex-wrap: wrap; width: 100%; gap: 8px; }
  .page-shell .row-actions .btn { flex: 1 1 auto; }
}

/* Workspace / team drawers paint above page chrome */
.drawer { z-index: 90; }

@media (prefers-reduced-motion: reduce) {
  .drawer-panel { animation: none; }
}

/* ===== Members expand panels (Windows-like maximize under the card) ===== */
.member-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.member-card {
  position: relative;
  padding: 0;
  overflow: visible;
}
.member-card-hit {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  width: 100%;
  margin: 0;
  padding: 22px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  border-radius: inherit;
}
.member-card-hit:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
.member-avatar {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-lift);
}
.member-avatar-fallback {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--brass-bright);
}
.member-card-text h3 { margin: 0 0 6px; }
.member-teaser { margin: 0; }
.member-panel {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 8px);
  z-index: 6;
  padding: 0 8px 8px;
}
.member-card.is-open {
  z-index: 7;
}
.member-card.is-open .member-panel {
  display: block;
}
.member-panel-inner {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  box-shadow: var(--shadow);
  padding: 16px 18px 18px;
  transform-origin: top center;
}
.member-card.is-open .member-panel-inner {
  animation: member-max .24s var(--ease) both;
}
.member-card.is-closing .member-panel-inner {
  animation: member-min .2s var(--ease) both;
}
@keyframes member-max {
  from { transform: scale(0.92) translateY(-14px); opacity: .55; }
  to { transform: none; opacity: 1; }
}
@keyframes member-min {
  from { transform: none; opacity: 1; }
  to { transform: scale(0.92) translateY(-14px); opacity: 0; }
}
.member-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.member-panel-head h3 { margin: 0; }
.member-bio { margin: 10px 0 14px; color: var(--ink-soft); line-height: 1.55; }
.member-facts {
  display: grid;
  gap: 6px 16px;
  grid-template-columns: max-content 1fr;
  margin: 0 0 14px;
  font-size: .92rem;
}
.member-facts dt { color: var(--ink-mute); }
.member-facts dd { margin: 0; }
.member-facts > div { display: contents; }
@media (max-width: 640px) {
  .member-grid { grid-template-columns: 1fr; }
  .member-panel { position: static; padding: 0 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .member-card.is-open .member-panel-inner,
  .member-card.is-closing .member-panel-inner { animation: none; }
}

/* ===== Front page live panes, room tiles, status lamps, 404 ===== */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 99px;
  margin-right: 7px; vertical-align: 1px; flex: none;
  background: #6f7471; box-shadow: 0 0 0 3px rgba(111,116,113,0.18);
}
.live-dot.is-online, .live-dot.is-ok { background: #8fd19e; box-shadow: 0 0 0 3px rgba(143,209,158,0.18), 0 0 10px rgba(143,209,158,0.55); }
.live-dot.is-offline, .live-dot.is-bad { background: var(--ember); box-shadow: 0 0 0 3px rgba(201,123,106,0.2); }
.live-dot.is-warn { background: var(--brass); box-shadow: 0 0 0 3px rgba(212,180,131,0.2); }

/* hero window panes are links now */
.pane-link { color: var(--ink); text-decoration: none; transition: border-color .16s var(--ease), transform .16s var(--ease); }
.pane-link:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.pane-link:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.pane-copy { position: relative; z-index: 2; display: block; min-width: 0; }
.pane-copy > * { display: block; }
.pane-copy strong { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.pane-copy > span { margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-kicker {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brass-bright); opacity: .85; margin-bottom: 3px;
}
.pane .thumb.thumb-pane { position: absolute; inset: 0; margin: 0; height: auto; border-radius: 0; z-index: 0; background: transparent; }
.pane.has-media::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(7,10,9,0.05) 15%, rgba(7,10,9,0.86) 92%);
}
.pane-live { display: flex !important; align-items: center; }
.pane .pane-art {
  position: absolute; right: 14px; top: 12px; z-index: 1;
  font-size: 30px; line-height: 1; color: rgba(126,184,180,0.75);
  text-shadow: 0 0 18px rgba(126,184,180,0.45);
}
.pane.d { padding-right: 84px; }
.moth-mini {
  position: absolute; right: 10px; top: 50%; z-index: 1;
  width: 66px; height: 55px; margin-top: -30px;
  display: block; pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
}
.moth-mini .moth-svg { width: 100%; height: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .moth-mini { animation: moth-mini-bob 4.8s ease-in-out infinite; }
  @keyframes moth-mini-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
}

/* tall room tiles: live info fills the middle */
.tile-live {
  display: flex; align-items: center; gap: 0; margin: auto 0 6px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-soft);
  padding: 7px 12px; border-radius: 99px; width: fit-content; max-width: 100%;
  background: rgba(8,10,9,0.38); border: 1px solid var(--line);
}
.tile-live > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-count {
  font-family: var(--font-display); font-size: 18px; color: var(--brass-bright);
  margin-right: 8px; line-height: 1;
}
.tile.tall .tile-live { margin: auto 0; font-size: 13.5px; padding: 9px 14px; }

/* status page */
.status-card .status-state { display: inline-flex; align-items: center; font-weight: 500; }
.status-card .status-state.is-ok { color: #b9e3c3; }
.status-card .status-state.is-bad { color: #f0b3a6; }
.status-card .status-state.is-warn { color: var(--brass-bright); }
.status-src {
  display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 99px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--line-strong); color: var(--brass-bright); vertical-align: 1px;
}
.status-crew { margin: 10px 0 0; color: var(--ink); font-size: 14.5px; }
.status-auto { margin-top: 10px; }
.status-time { margin: 12px 0 0; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-mute); }

/* 404 */
.lost-sign {
  justify-self: center; display: grid; place-items: center; text-align: center;
  width: min(340px, 100%); aspect-ratio: 1.15; border-radius: 28px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  background:
    radial-gradient(240px 160px at 50% 18%, rgba(212,180,131,0.28), transparent 65%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.015));
}
.lost-num { font-family: var(--font-display); font-size: clamp(72px, 12vw, 120px); line-height: .9; color: var(--brass-bright); letter-spacing: -0.04em; }
.lost-sub { font-family: var(--font-mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-mute); margin-top: -18px; }

@media (max-width: 980px) {
  .window-grid { grid-template-rows: 150px 120px; }
}
@media (max-width: 640px) {
  .window-grid { grid-template-rows: 170px repeat(3, minmax(96px, auto)); }
  .feat-video { grid-template-columns: 1fr; }
  .lost-sign { width: 100%; aspect-ratio: 2.2; }
}
.feat-side .thumb-badge { left: 6px; top: 6px; padding: 2px 6px; font-size: 9px; }
.feat-side .thumb-play { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
.feat-side .thumb-play::before { margin: -6px 0 0 -4px; border-width: 6px 0 6px 10px; }
@media (max-width: 640px) {
  .tile-live > span:last-child { white-space: normal; }
  .tile-live { border-radius: 16px; }
}

/* ---- Public desk forms (feedback / apply) ---- */
.public-form .field-help { display: block; margin-top: 4px; color: var(--ink-mute); font-size: .8rem; }
.public-form .field.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-alert { margin: 0 0 16px; padding: 12px 16px; border: 1px solid rgba(201, 123, 106, .55); border-radius: var(--radius-sm); background: rgba(201, 123, 106, .12); color: var(--ink); }
.form-alert p, .form-alert ul { margin: 0; }
.form-alert ul { padding-left: 1.1rem; }
.form-alert p + ul { margin-top: 6px; }
.card.sent { border-color: rgba(143, 184, 154, .45); }
.card.sent h3 { color: var(--moss); margin-top: 0; }
[data-team] .files-health { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---- Crew hunts ---- */
.hunt-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: 8px; vertical-align: middle; border-radius: 50%;
  border: 1px solid rgba(212, 180, 131, .45); background: radial-gradient(circle, rgba(239, 224, 188, .22), rgba(212, 180, 131, .05) 70%);
  color: var(--brass-bright); font-size: 14px; line-height: 1; cursor: pointer; opacity: .55; transition: opacity .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease); }
.hunt-mark:hover, .hunt-mark:focus-visible { opacity: 1; transform: scale(1.12); box-shadow: 0 0 18px rgba(239, 224, 188, .45); }
.hunt-mark:focus-visible { outline: 2px solid var(--brass-bright); outline-offset: 2px; }
.hunt-mark.found { opacity: .9; color: var(--moss); border-color: rgba(143, 184, 154, .55); cursor: default; }
.hunt-corner { margin-top: 24px; display: flex; align-items: center; gap: 6px; }
.hunt-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; padding: 10px 16px; border-radius: 999px;
  background: var(--surface-lift); border: 1px solid var(--line-strong); color: var(--ink); box-shadow: var(--shadow-soft); font-size: .92rem; transition: opacity .5s; }
.hunt-toast.out { opacity: 0; }
.hunt-toast a { color: var(--brass-bright); margin-left: 6px; }
.hunt-glyph { color: var(--brass-bright); }
.hunt-clues { padding-left: 1.2rem; display: grid; gap: 8px; }
.hunt-clues li.found span:first-child { color: var(--ink-mute); text-decoration: line-through; text-decoration-color: rgba(143, 184, 154, .6); }
.hunt-progress { margin: 6px 0 10px; color: var(--ink-soft); }
.hunt-reward { margin-top: 14px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid rgba(143, 184, 154, .45); background: rgba(143, 184, 154, .1); }
.hunt-card.done { border-color: rgba(143, 184, 154, .45); }
@media (prefers-reduced-motion: reduce) { .hunt-mark, .hunt-toast { transition: none; } }

/* ---- Party slate (shared canvas) ---- */
.slate-card { padding: 14px; }
.slate-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.slate-swatches, .slate-sizes { display: flex; gap: 6px; flex-wrap: wrap; }
.slate-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--sw); cursor: pointer; }
.slate-swatch.on { outline: 2px solid var(--brass-bright); outline-offset: 2px; }
.slate-size { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-solid); display: grid; place-items: center; cursor: pointer; }
.slate-size i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink-soft); }
.slate-size.on { border-color: var(--brass-bright); }
.slate-admin { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.slate-wrap { position: relative; }
.slate-canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: radial-gradient(circle at 30% 20%, #1b2420, #111715 70%); touch-action: none; cursor: crosshair;
  overscroll-behavior: contain; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.slate-canvas.is-locked { cursor: not-allowed; opacity: .8; }
.slate-locked { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(201, 123, 106, .2); border: 1px solid rgba(201, 123, 106, .55); color: var(--ink); font-size: .88rem; }
.slate-note { margin-top: 10px; }
.btn.danger { background: rgba(201, 123, 106, .18); border-color: rgba(201, 123, 106, .6); color: #f3d3ca; }
@media (max-width: 640px) { .slate-admin { margin-left: 0; width: 100%; } }

/* ---- STAGE14: Library storage meter (Admins) + party moderation ---- */
[data-team] .lib-usage { margin: 0 0 10px; }
[data-team] .lib-usage .note { margin: 0 0 6px; }
[data-team] .lib-meter { height: 8px; border-radius: 999px; background: rgba(239, 224, 188, .1); border: 1px solid rgba(212, 180, 131, .25); overflow: hidden; max-width: 420px; }
[data-team] .lib-meter i { display: block; height: 100%; background: var(--moss); border-radius: inherit; }
[data-team] .lib-usage.near .lib-meter i { background: var(--brass-bright); }
[data-team] .lib-usage.full .lib-meter i { background: #c97b6a; }
.party-feed { display: grid; gap: 6px; padding-left: 1.1rem; }
.party-feed .inline-form { display: inline; margin-left: 6px; }
.party-feed .party-del { padding: 2px 10px; min-height: 0; font-size: .8em; vertical-align: middle; }

/* Phone touch targets (Campaign Hub v1.1): the hub card button, footer links, account buttons and slate controls reach about 44px */
@media (hover: none) and (pointer: coarse) {
  .card .btn.tiny { min-height: 44px; display: inline-flex; align-items: center; }
  .account-bar .btn { min-height: 44px; }
  .site-footer a { padding: 12px 0; }
  .slate-swatches, .slate-sizes { gap: 8px; }
  .slate-swatch { width: 40px; height: 40px; }
  .slate-size { width: 44px; height: 44px; }
  .pet-btn { min-height: 40px; padding-left: 12px; padding-right: 12px; }
}
