/* ═══════════════════════════════════════════════════════════════════════════
   AUDIKUNG OWNER SANCTUARY (space.css · v6 · 2026-10-20)
   Follows impeccable/SKILL.md + DESIGN.md §3 Canonical Font Lock + index.html craft:
   - Headings / Display / Numbers: 'Outfit', 'Plus Jakarta Sans', sans-serif
   - Body / UI / Buttons / Badges: 'Plus Jakarta Sans', 'Sarabun', sans-serif
   - 16-bit sprites via assets/ak-pixel.js on EVERY section, tab & category heading
   - Soft Atmospheric Aurora Category Groups (.sk-cat with --cat-accent & --cat-rgb)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --font-display: 'AK Thai','Google Sans','Outfit', 'Plus Jakarta Sans', 'Sarabun', system-ui, sans-serif;
  --font-head: 'AK Thai','Google Sans','Outfit', 'Plus Jakarta Sans', 'Sarabun', system-ui, sans-serif;
  --font-body: 'AK Thai','Google Sans','Plus Jakarta Sans', 'Sarabun', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  --sp-font-head: var(--font-head);
  --sp-font-body: var(--font-body);
  --sp-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Dark mode tokens (North Star Observatory: deep midnight navy-indigo + champagne gold) */
  --sp-ink: #f0f2f8;
  --sp-ink-2: #b8c2d8;
  --sp-ink-muted: #8e9bb5;
  --sp-gold: #e2c98f;
  --sp-gold-bright: #f4e1b2;
  --sp-gold-deep: #7a5c18;
  --sp-gold-ink: #0a101d;
  --sp-panel-bg: radial-gradient(36rem 18rem at 8% 0%, rgba(226, 201, 143, 0.10), transparent 64%),
                 radial-gradient(32rem 18rem at 92% 100%, rgba(116, 197, 248, 0.08), transparent 62%),
                 linear-gradient(160deg, rgba(11, 20, 42, 0.94) 0%, rgba(6, 11, 26, 0.96) 100%);
  --sp-panel-border: rgba(226, 201, 143, 0.24);
  --sp-panel-ledge: rgba(16, 29, 58, 0.85);
  --sp-hairline: rgba(226, 201, 143, 0.16);
  --sp-chip-bg: rgba(255, 255, 255, 0.05);
  --sp-chip-border: rgba(226, 201, 143, 0.26);
  --sp-plaza-sky: radial-gradient(circle at 82% 22%, rgba(244, 225, 178, 0.28), transparent 42%),
                  linear-gradient(180deg, #0b142c 0%, #15244a 64%, #1e315c 100%);
  --sp-plaza-ground: linear-gradient(180deg, #273e6e 0%, #162444 100%);
}

html[data-theme="light"] {
  --sp-ink: #141c2b;
  --sp-ink-2: #475569;
  --sp-ink-muted: #64748b;
  --sp-gold: #d9b15f;
  --sp-gold-bright: #efd089;
  --sp-gold-deep: #7a5812;
  --sp-gold-ink: #1b1408;
  --sp-panel-bg: radial-gradient(32rem 16rem at 10% 0%, rgba(255, 236, 185, 0.45), transparent 65%),
                 linear-gradient(180deg, #ffffff 0%, #f8f5ee 100%);
  --sp-panel-border: #d5c29a;
  --sp-panel-ledge: #b89f6d;
  --sp-hairline: rgba(138, 106, 31, 0.18);
  --sp-chip-bg: #f4efe4;
  --sp-chip-border: #cbb484;
  --sp-plaza-sky: radial-gradient(circle at 82% 22%, rgba(255, 243, 176, 0.9), transparent 42%),
                  linear-gradient(180deg, #8fd3f4 0%, #bfe9ff 65%, #e6f7ff 100%);
  --sp-plaza-ground: linear-gradient(180deg, #7bc47f 0%, #4e9a55 100%);
}

html[data-theme="light"],
html[data-theme="light"] body {
  background: radial-gradient(60rem 28rem at 50% 0%, rgba(255, 236, 185, 0.52), transparent 68%),
              linear-gradient(180deg, #faf7f0 0%, #f1ece0 100%) !important;
  color: var(--sp-ink);
}

html[data-theme="light"] .ak-sky {
  background: radial-gradient(ellipse 60% 42% at 88% 6%, #fff3d1 0%, transparent 65%),
              linear-gradient(180deg, #faf7f0 0%, #f1ece0 100%) !important;
}

html[data-theme="light"] .ak-sky :is(.ak-star, .ak-dot, .ak-comet, .ak-north) {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 3000;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--sp-gold);
  color: var(--sp-gold-ink);
  font: 700 0.95rem/1.2 var(--font-body);
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 160ms var(--sp-ease);
}
.skip:focus {
  transform: translateY(0);
}

.space-main {
  width: min(100%, 1220px);
  margin: 0 auto;
  padding: clamp(22px, 2.5vw, 34px) clamp(16px, 3vw, 32px) 72px;
  color: var(--sp-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body:not([data-ak-baseline="0"]) .space-main {
  padding-top: calc(var(--ak-shell-height, 70px) + 22px);
}

/* ── 1. PRE-LOGIN SANCTUARY GATE (#space-lock) ──────────────────────────── */
.sanctuary-lock-wrap {
  min-height: calc(100dvh - 180px);
  display: grid;
  place-items: center;
  padding: 24px 0;
}
html.owner-ready #space-lock {
  display: none !important;
}

.sanctuary-lock-diary {
  width: min(100%, 540px);
  padding: clamp(24px, 4vw, 38px);
  text-align: center;
}

.pixel-plaza-window {
  position: relative;
  width: 100%;
  height: 118px;
  margin: 0 auto 20px;
  border-radius: 14px;
  background: var(--sp-plaza-sky);
  border: 2px solid #8a6a1f;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 14px;
}

.pixel-plaza-window::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px;
  background: var(--sp-plaza-ground);
  border-top: 2px solid rgba(255, 255, 255, 0.28);
}

.plaza-shrimp {
  position: relative;
  z-index: 2;
  width: 84px;
  height: 84px;
  object-fit: contain;
  image-rendering: pixelated;
  animation: spMascotBob 1.8s steps(2) infinite;
}

.plaza-bubble {
  position: relative;
  z-index: 2;
  margin-left: 10px;
  margin-bottom: 18px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #fffdf7;
  color: #2a2118;
  border: 2px solid #8a6a1f;
  font: 600 0.92rem/1.35 var(--font-body);
}

.sanctuary-lock-title {
  margin: 0 0 10px;
  font: 600 clamp(1.85rem, 3.5vw, 2.45rem)/1.2 var(--font-head);
  letter-spacing: -0.03em;
  color: var(--aku-lux-ink, #2a2118);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sanctuary-lock-sub {
  margin: 0 auto 18px;
  max-width: 44ch;
  font-size: 1rem;
  line-height: 1.65;
}

.sanctuary-status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(138, 106, 31, 0.14);
  border: 1px solid rgba(138, 106, 31, 0.42);
  font: 600 0.92rem/1.3 var(--font-body);
  color: #3e2810;
}

.sanctuary-lock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ── 2. TACTILE 3D BUTTONS ─────────────────────────────────────────────── */
.btn-gold-3d {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 12px;
  background: linear-gradient(135deg, #684812 0%, #3b2708 100%);
  color: #f8fafc;
  border: 1px solid #c59738;
  border-bottom: 4px solid #0b1322;
  box-shadow: 0 8px 20px rgba(16, 27, 45, 0.28);
  font: 700 0.98rem/1.3 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: translate 160ms var(--sp-ease), filter 160ms ease;
}

.btn-gold-3d:hover {
  translate: 0 -2px;
  filter: brightness(1.05);
}

.btn-gold-3d:active {
  translate: 0 2px;
}

.btn-quiet-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  border: 1.5px solid #8a6a1f;
  font: 600 0.92rem/1.3 var(--font-body);
  cursor: pointer;
  transition: translate 160ms var(--sp-ease), background 160ms ease;
}

.btn-quiet-outline:hover {
  background: rgba(138, 106, 31, 0.12);
  translate: 0 -2px;
}

/* ── 3. OWNER HERO & 16-BIT PIXEL COMMAND PLAZA ────────────────────────── */
.sanctuary-hero {
  margin-bottom: 24px;
}

.hero-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.owner-identity-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 4px 16px 4px 6px;
  border-radius: 999px;
  background: var(--sp-chip-bg);
  border: 1px solid var(--sp-chip-border);
}

.owner-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--sp-gold);
}

.owner-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ddc97;
  box-shadow: 0 0 8px rgba(61, 220, 151, 0.7);
}

.owner-name {
  font: 600 0.92rem/1.3 var(--font-body);
  color: var(--sp-ink);
}

.owner-top-Utilities {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn-tactile-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--sp-chip-bg);
  color: var(--sp-ink);
  border: 1px solid var(--sp-chip-border);
  font: 600 0.88rem/1.3 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: translate 160ms var(--sp-ease), border-color 160ms ease, background 160ms ease;
}

.btn-tactile-pill:hover {
  translate: 0 -2px;
  border-color: var(--sp-gold);
  background: rgba(226, 201, 143, 0.12);
}

.btn-tactile-pill:active {
  translate: 0 1px;
}

.btn-danger-pill {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

html[data-theme="light"] .btn-danger-pill {
  border-color: #c2410c;
  color: #9a3412;
}

.hero-plaza-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 490px);
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

.hero-eyebrow {
  margin: 0 0 8px;
  color: var(--sp-gold);
  font: 700 0.72rem/1.2 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

html[data-theme="light"] .hero-eyebrow {
  color: #8a6414;
}

.sanctuary-title {
  margin: 0;
  font: 600 clamp(2.1rem, 4vw, 3.1rem)/1.08 var(--font-head);
  letter-spacing: -0.035em;
  color: var(--sp-ink);
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-sub {
  margin: 10px 0 0;
  color: var(--sp-ink-2);
  font: 400 1rem/1.6 var(--font-body);
}

/* 16-bit Pixel Command Plaza Box */
.pixel-plaza-stage {
  position: relative;
  min-height: 112px;
  padding: 14px 16px 18px;
  border-radius: 16px;
  background: var(--sp-plaza-sky);
  border: 1.5px solid var(--sp-panel-border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.pixel-plaza-stage::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  background: var(--sp-plaza-ground);
  border-top: 2px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.plaza-celestial {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.celestial-orb {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff3b0;
  box-shadow: 0 0 14px rgba(255, 243, 176, 0.85);
  opacity: 0.85;
}

.celestial-cloud {
  position: absolute;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  animation: spCloudDrift 18s linear infinite;
}
html[data-theme="light"] .celestial-cloud {
  background: rgba(255, 255, 255, 0.78);
}
.celestial-cloud.c1 {
  width: 48px;
  top: 18px;
  left: 16%;
}
.celestial-cloud.c2 {
  width: 36px;
  top: 34px;
  left: 58%;
  animation-delay: -9s;
}

.plaza-actors {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
}

.actor-shrimp-btn {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 0;
  border-radius: 12px;
  transition: transform 180ms var(--sp-ease);
}

.actor-shrimp-btn:hover {
  transform: scale(1.06) translateY(-2px);
}

.actor-shrimp-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  image-rendering: pixelated;
  animation: spMascotBob 1.6s steps(2) infinite;
}

.actor-shrimp-img.is-jumping {
  animation: spMascotJump 420ms steps(4) 1;
}

.plaza-dialogue {
  position: relative;
  z-index: 2;
  min-width: 0;
  padding: 2px 26px 2px 16px;
  border-left: 1.5px solid rgba(226, 201, 143, 0.28);
}

html[data-theme="light"] .plaza-dialogue {
  border-left-color: rgba(138, 106, 31, 0.35);
}

.mascot-speech-bubble {
  margin: 0 0 5px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #f8f5ff;
  border: 0;
  box-shadow: none;
}

.mascot-speech-title {
  display: block;
  font: 600 1.02rem/1.3 var(--font-head);
  letter-spacing: -0.015em;
  color: var(--sp-gold-bright);
  margin-bottom: 3px;
}

.mascot-speech-sub {
  display: block;
  font: 400 0.88rem/1.48 var(--font-body);
  color: #dce6f5;
}

html[data-theme="light"] .mascot-speech-bubble {
  background: transparent;
  color: #1e1810;
  border-color: transparent;
}

html[data-theme="light"] .mascot-speech-title {
  color: #6b4c0e;
}

html[data-theme="light"] .mascot-speech-sub {
  color: #3d3122;
}

.mascot-poke-hint {
  display: block;
  font-size: 0.78rem;
  color: #c8d4e8;
}
html[data-theme="light"] .mascot-poke-hint {
  color: #2c3e55;
}

.mascot-poke-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--sp-gold-bright);
  border: 1px solid rgba(226, 201, 143, 0.45);
  font: 700 0.75rem/1.2 var(--font-mono);
}
html[data-theme="light"] .mascot-poke-hint kbd {
  background: #fff;
  color: #1e1810;
  border-color: #8a6a1f;
}

/* ── 4. BIG CHAPTER TABS (.ch-tabs, ≥84px desktop / ≥64px mobile) ──────── */
.ch-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}

.ch-tab {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 14px 18px;
  border-radius: 16px;
  text-align: left;
  cursor: pointer;
  color: var(--sp-ink);
  font: inherit;
  background: var(--sp-panel-bg);
  border: 1px solid var(--sp-panel-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.22);
  transition: translate 180ms var(--sp-ease), border-color 180ms ease, background 180ms ease;
}

.ch-tab:hover:not(.active) {
  translate: 0 -3px;
  border-color: var(--sp-gold);
}

.ch-tab:active {
  translate: 0 1px;
}

.ch-tab.active {
  background: linear-gradient(165deg, #f4e1b2 0%, #e2c98f 58%, #cca85e 100%);
  color: #0b1324;
  border-color: #f4e1b2;
  box-shadow: 0 12px 30px rgba(226, 201, 143, 0.22);
}

.ch-ic {
  flex: none;
  display: grid;
  place-items: center;
  line-height: 1;
}

.ch-ic [data-ak-px] {
  margin-right: 0;
}

.ch-t strong {
  display: block;
  font: 600 clamp(1.08rem, 1.5vw, 1.24rem)/1.25 var(--font-head);
  letter-spacing: -0.025em;
  color: inherit;
}

.ch-t small {
  display: block;
  margin-top: 3px;
  font: 400 0.86rem/1.45 var(--font-body);
  color: var(--sp-ink-2);
}

.ch-tab.active .ch-t small {
  color: #24344d;
}

[data-chapter][hidden] {
  display: none !important;
}

.sanctuary-chapter {
  animation: spTabFade 220ms var(--sp-ease);
}

/* ── 5. FRAMELESS CHAPTER STAGE (.sanctuary-panel — zero outer wrapper box) ── */
.sanctuary-panel {
  padding: 6px 0 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--sp-ink);
}

.wf-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wf-ic {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.wf-ic [data-ak-px] {
  margin-right: 0;
}

.wf-card-head h2 {
  margin: 0;
  font: 600 clamp(1.45rem, 2.4vw, 1.85rem)/1.2 var(--font-head);
  letter-spacing: -0.03em;
  color: var(--sp-ink);
}

.gr-for {
  margin: 4px 0 0 42px;
  font: 400 0.94rem/1.6 var(--font-body);
  color: var(--sp-ink-2);
  max-width: 70ch;
}

/* ── 6. SCREENSHOT DOORS (.kd-grid / .kd-door) ─────────────────────────── */
.space-doors-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 22px;
}

.kd-door {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--sp-ink);
  border-radius: 14px;
  transition: translate 220ms var(--sp-ease);
}

.kd-door img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 692;
  object-fit: cover;
  object-position: top;
  border-radius: 14px;
  border: 1px solid var(--sp-panel-border);
  background: #070d1e;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.kd-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 12px;
  padding: 12px 4px 4px;
}

/* Bare emoji, NEVER inside a box (rule 12d) */
.kd-ic,
.gr-ic {
  width: 40px;
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  line-height: 1;
  background: none !important;
  border: 0 !important;
  transition: transform 220ms var(--sp-ease);
}

.kd-row strong,
.gr-tile strong,
.sk-room-tile strong {
  display: block;
  font: 600 1.06rem/1.32 var(--font-head);
  letter-spacing: -0.02em;
  color: var(--sp-ink);
  transition: color 180ms ease;
}

.kd-row small,
.gr-tile small,
.sk-room-tile small {
  display: block;
  margin-top: 3px;
  font: 400 0.86rem/1.5 var(--font-body);
  color: var(--sp-ink-2);
}

.kd-arrow {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--sp-panel-border);
  background: var(--sp-chip-bg);
  color: var(--sp-ink);
  font: 600 0.95rem/1 var(--font-body);
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms var(--sp-ease);
}

.kd-door:is(:hover, :focus-visible) {
  translate: 0 -4px;
}

.kd-door:is(:hover, :focus-visible) img {
  border-color: var(--sp-gold);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.34), 0 0 24px rgba(226, 201, 143, 0.14);
}

.kd-door:is(:hover, :focus-visible) .kd-ic {
  transform: rotate(-6deg) scale(1.08);
}

.kd-door:is(:hover, :focus-visible) strong {
  color: var(--sp-gold-bright);
}

html[data-theme="light"] .kd-door:is(:hover, :focus-visible) strong {
  color: #7c580f;
}

.kd-door:is(:hover, :focus-visible) .kd-arrow {
  background: var(--sp-gold);
  border-color: var(--sp-gold);
  color: var(--sp-gold-ink);
  transform: translateX(3px);
}

/* ── 7. SOFT ATMOSPHERIC AURORA CATEGORY GROUPS (.fm-seg + .sk-cats / .sk-cat) ── */
.grouped-rooms-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--sp-hairline);
}

.gr-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--sp-hairline);
  font: 600 clamp(1.22rem, 1.9vw, 1.48rem)/1.25 var(--font-head);
  letter-spacing: -0.025em;
  color: var(--sp-ink);
}

.grouped-rooms-bar .gr-step {
  margin: 0;
  padding-top: 0;
  border-top: 0;
}

/* Slim Segmented Bar (.fm-seg) */
.fm-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(5, 10, 24, 0.65);
  border: 1px solid var(--sp-panel-border);
}

html[data-theme="light"] .fm-seg {
  background: #f3eee2;
  border-color: #cbb484;
}

.vault-cat-seg {
  margin-bottom: 14px;
}

.fm-seg button {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--sp-ink-2);
  font: 600 0.86rem/1.3 var(--font-body);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.fm-seg button:hover {
  color: var(--sp-ink);
}

.fm-seg button.active,
.fm-seg button[aria-pressed="true"] {
  background: linear-gradient(165deg, var(--sp-gold-bright) 0%, var(--sp-gold) 100%);
  color: var(--sp-gold-ink);
  font-weight: 700;
}

/* Soft Atmospheric Category Containers (inspired by index.html .workspace-group & .about-links) */
.sk-cats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

.pulse-cats {
  margin-top: 16px;
}

.sk-cat {
  --cat-accent: #e2c98f;
  --cat-rgb: 226, 201, 143;
  position: relative;
  padding: 22px 22px 20px;
  border-radius: 18px;
  background: radial-gradient(32rem 14rem at 0% 0%, rgba(var(--cat-rgb), 0.13), transparent 70%),
              linear-gradient(155deg, rgba(var(--cat-rgb), 0.05) 0%, rgba(9, 15, 34, 0.72) 65%);
  border: 1px solid rgba(var(--cat-rgb), 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 32px rgba(0, 0, 0, 0.22);
  color: var(--sp-ink);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

/* Glowing top category indicator bar (from index.html .workspace-group-head::before) */
.sk-cat::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 24px;
  width: 58px;
  height: 3px;
  border-radius: 999px;
  background: var(--cat-accent);
  box-shadow: 0 0 16px rgba(var(--cat-rgb), 0.65);
}

/* Soft pastel-luminous category palettes (from index.html lines 119-125) */
.sk-cat[data-k="finance"] {
  --cat-accent: #5fd9a2;
  --cat-rgb: 95, 217, 162;
}

.sk-cat[data-k="learn"] {
  --cat-accent: #b9a4f7;
  --cat-rgb: 185, 164, 247;
}

.sk-cat[data-k="content"],
.sk-cat[data-k="life"] {
  --cat-accent: #f0a6c8;
  --cat-rgb: 240, 166, 200;
}

.sk-cat[data-k="system"],
.sk-cat[data-k="work"] {
  --cat-accent: #74c5f8;
  --cat-rgb: 116, 197, 248;
}

.sk-cat[data-k="think"] {
  --cat-accent: #f4c56a;
  --cat-rgb: 244, 197, 106;
}

/* Light Mode Soft Atmospheric Category Pairs */
html[data-theme="light"] .sk-cat {
  background: radial-gradient(30rem 14rem at 0% 0%, rgba(var(--cat-rgb), 0.20), transparent 70%),
              linear-gradient(155deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.94) 100%);
  border-color: rgba(var(--cat-rgb), 0.48);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
  color: #141c2b;
}

html[data-theme="light"] .sk-cat[data-k="finance"] { --cat-accent: #0d9462; --cat-rgb: 16, 185, 129; }
html[data-theme="light"] .sk-cat[data-k="learn"]   { --cat-accent: #6d4aff; --cat-rgb: 139, 92, 246; }
html[data-theme="light"] .sk-cat[data-k="content"],
html[data-theme="light"] .sk-cat[data-k="life"]    { --cat-accent: #be185d; --cat-rgb: 236, 72, 153; }
html[data-theme="light"] .sk-cat[data-k="system"],
html[data-theme="light"] .sk-cat[data-k="work"]    { --cat-accent: #1d4ed8; --cat-rgb: 59, 130, 246; }
html[data-theme="light"] .sk-cat[data-k="think"]   { --cat-accent: #b45309; --cat-rgb: 245, 158, 11; }

.sk-cat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(var(--cat-rgb), 0.20);
}

.sk-ic {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.sk-ic [data-ak-px] {
  margin-right: 0;
}

.sk-cat-titles {
  min-width: 0;
  margin-right: auto;
}

.sk-cat-head h3 {
  margin: 0;
  font: 600 clamp(1.18rem, 1.7vw, 1.38rem)/1.22 var(--font-head);
  letter-spacing: -0.025em;
  color: var(--sp-ink);
  margin-right: auto;
}

.sk-cat-titles h3 {
  margin-right: 0;
}

.sk-cat-titles small {
  display: block;
  margin-top: 2px;
  font: 400 0.84rem/1.45 var(--font-body);
  color: var(--sp-ink-2);
}

.sk-n {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(var(--cat-rgb), 0.12);
  border: 1px solid rgba(var(--cat-rgb), 0.32);
  font: 600 0.78rem/1.2 var(--font-body);
  color: var(--cat-accent);
  white-space: nowrap;
}

.sk-room-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Soft Aurora Room Cards inside each Category Group (matches index.html .about-links a) */
.sk-room-tile {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto 34px;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--sp-ink);
  background: linear-gradient(135deg, rgba(var(--cat-rgb), 0.08), rgba(255, 255, 255, 0.02) 65%);
  border: 1px solid rgba(var(--cat-rgb), 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 220ms var(--sp-ease), border-color 200ms ease, background 200ms ease, box-shadow 220ms ease;
}

/* Left accent indicator bar */
.sk-room-tile::before {
  content: '';
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--cat-accent);
  opacity: 0.55;
  transition: opacity 200ms ease, top 220ms var(--sp-ease), bottom 220ms var(--sp-ease);
}

html[data-theme="light"] .sk-room-tile {
  background: linear-gradient(135deg, rgba(var(--cat-rgb), 0.08), rgba(255, 255, 255, 0.9) 70%);
  border-color: rgba(var(--cat-rgb), 0.28);
}

.sk-room-tile:is(:hover, :focus-visible) {
  transform: translateY(-3px);
  border-color: rgba(var(--cat-rgb), 0.52);
  background: linear-gradient(135deg, rgba(var(--cat-rgb), 0.16), rgba(255, 255, 255, 0.04) 68%);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24), 0 0 26px rgba(var(--cat-rgb), 0.10);
}

html[data-theme="light"] .sk-room-tile:is(:hover, :focus-visible) {
  background: linear-gradient(135deg, rgba(var(--cat-rgb), 0.15), #ffffff 75%);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.sk-room-tile:is(:hover, :focus-visible)::before {
  opacity: 1;
  top: 0;
  bottom: 0;
}

.sk-room-tile:is(:hover, :focus-visible) .gr-ic {
  transform: rotate(-6deg) scale(1.08);
}

.sk-room-tile:is(:hover, :focus-visible) strong {
  color: #ffffff;
}

html[data-theme="light"] .sk-room-tile:is(:hover, :focus-visible) strong {
  color: var(--cat-accent);
}

.room-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--cat-rgb), 0.09);
  border: 1px solid rgba(var(--cat-rgb), 0.26);
  color: var(--cat-accent);
  font: 600 0.72rem/1.2 var(--font-body);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.room-tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cat-accent);
  box-shadow: 0 0 8px rgba(var(--cat-rgb), 0.75);
}

.sk-cat .kd-arrow {
  width: 34px;
  height: 34px;
  background: rgba(var(--cat-rgb), 0.08);
  border-color: rgba(var(--cat-rgb), 0.30);
  color: var(--cat-accent);
}

.sk-room-tile:is(:hover, :focus-visible) .kd-arrow {
  background: var(--cat-accent);
  border-color: var(--cat-accent);
  color: #07101d;
  transform: translateX(3px);
}

html[data-theme="light"] .sk-room-tile:is(:hover, :focus-visible) .kd-arrow {
  color: #ffffff;
}

/* ── 8. CHAPTER 3: INLINE VAULT SHEETS & LIVE SEARCH ───────────────────── */
.vault-sheets-drawer {
  margin: 20px 0 22px;
}

.inline-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 16px;
  border-radius: 14px;
  background: rgba(5, 10, 24, 0.65);
  border: 1.5px solid var(--sp-panel-border);
  margin-bottom: 14px;
}

html[data-theme="light"] .inline-search-bar {
  background: #fffdf8;
  border-color: #cbb484;
}

.inline-search-bar:focus-within {
  border-color: var(--sp-gold);
}

.search-icon-bare {
  font-size: 1.35rem;
  line-height: 1;
}

#inline-room-search {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--sp-ink);
  font: 500 1.02rem/1.4 var(--font-body);
  outline: none;
}

#inline-room-search::placeholder {
  color: var(--sp-ink-muted);
}

.btn-clear-search {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--sp-panel-border);
  background: var(--sp-chip-bg);
  color: var(--sp-ink);
  font: 600 0.84rem/1.2 var(--font-body);
  cursor: pointer;
}

.sk-sort {
  margin: 6px 0 12px;
  font: 500 0.92rem/1.5 var(--font-body);
  color: var(--sp-ink-2);
}

/* ── 9. CHAPTER 2: NATIVE DAILY PULSE SLOTS & FOLDED MIRROR ────────────── */
.pulse-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pulse-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.pulse-stamp {
  font: 500 0.88rem/1.4 var(--font-body);
  color: var(--sp-ink-2);
}

.pulse-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.pulse-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--sp-panel-border);
  text-decoration: none;
  color: var(--sp-ink);
  transition: translate 180ms var(--sp-ease), border-color 180ms ease;
}

html[data-theme="light"] .pulse-slot {
  background: #fffdf8;
  border-color: #cbb484;
}

.pulse-slot:hover {
  translate: 0 -2px;
  border-color: var(--sp-gold);
}

.pulse-slot-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-slot-emoji {
  font-size: 1.65rem;
  line-height: 1;
}

.pulse-slot-top strong {
  font: 600 1.1rem/1.3 var(--font-head);
  letter-spacing: -0.02em;
  color: var(--sp-ink);
  margin-right: auto;
}

.pulse-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sp-chip-bg);
  border: 1px solid var(--sp-chip-border);
  font: 600 0.78rem/1.25 var(--font-body);
  color: var(--sp-gold-bright);
}

html[data-theme="light"] .pulse-badge {
  color: #6b4c0e;
}

.pulse-badge.is-good {
  background: rgba(61, 220, 151, 0.16);
  border-color: rgba(61, 220, 151, 0.45);
  color: #6ee7b7;
}
html[data-theme="light"] .pulse-badge.is-good {
  background: #dcfce7;
  border-color: #22c55e;
  color: #14532d;
}

.pulse-badge.is-warn {
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(251, 191, 36, 0.5);
  color: #fde68a;
}
html[data-theme="light"] .pulse-badge.is-warn {
  background: #fef3c7;
  border-color: #d97706;
  color: #78350f;
}

.pulse-slot-main {
  margin: 0;
  font: 500 0.96rem/1.55 var(--font-body);
  color: var(--sp-ink);
}

.pulse-slot-sub {
  font: 400 0.85rem/1.45 var(--font-body);
  color: var(--sp-ink-2);
}

.mirror-fold-details {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--sp-hairline);
}

.mirror-fold-details summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--sp-chip-bg);
  border: 1px solid var(--sp-chip-border);
  font: 600 0.88rem/1.3 var(--font-body);
  color: var(--sp-ink);
  cursor: pointer;
  list-style: none;
}

.mirror-fold-details summary::-webkit-details-marker {
  display: none;
}

.mirror-frame-shell {
  margin-top: 16px;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--sp-panel-border);
  background: #081326;
}

.mirror-frame-stage {
  width: 100%;
  min-height: 680px;
}

#owner-home-frame {
  display: block;
  width: 100%;
  height: 700px;
  border: 0;
  background: #081326;
}

/* ── 10. COMMAND LEDGER DIALOG (#space-inventory) ──────────────────────── */
.sanctuary-ledger-dialog {
  width: min(94vw, 920px);
  max-height: 86dvh;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.sanctuary-ledger-dialog::backdrop {
  background: rgba(8, 6, 18, 0.72);
  backdrop-filter: blur(6px);
}

html[data-theme="light"] .sanctuary-ledger-dialog::backdrop {
  background: rgba(220, 232, 248, 0.68);
}

.ledger-dialog-box {
  padding: clamp(20px, 3vw, 30px);
  max-height: 84dvh;
  overflow-y: auto;
}

.inventory-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(90, 60, 25, 0.25);
}

.ledger-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ledger-title-wrap h2 {
  margin: 0;
  font: 600 1.45rem/1.25 var(--font-head);
  letter-spacing: -0.025em;
}

.ledger-subhead {
  margin: 18px 0 10px;
  font: 600 1.12rem/1.3 var(--font-head);
}

.ledger-search-wrap input {
  width: 100%;
  min-height: 46px;
  padding: 8px 14px;
  border-radius: 10px;
  font: 500 1rem/1.4 var(--font-body);
}

.ledger-count {
  margin: 8px 0;
  font-size: 0.9rem;
}

.ledger-products-list,
.ledger-rooms-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.room {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(138, 106, 31, 0.35);
  background: rgba(255, 253, 247, 0.78);
  transition: translate 160ms var(--sp-ease), border-color 160ms ease;
}

.sanctuary-panel .room {
  background: var(--sp-chip-bg);
  color: var(--sp-ink);
  border-color: var(--sp-panel-border);
}

.room:hover {
  translate: 0 -2px;
  border-color: #8a6a1f;
}

.room strong {
  font: 600 1rem/1.35 var(--font-head);
}

.room small {
  font: 400 0.86rem/1.45 var(--font-body);
  opacity: 0.86;
}

/* ── 11. ANIMATIONS & REDUCED MOTION ───────────────────────────────────── */
@keyframes spMascotBob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

@keyframes spMascotJump {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-10px) scale(1.06); }
}

@keyframes spCloudDrift {
  0% { transform: translateX(-12px); }
  50% { transform: translateX(18px); }
  100% { transform: translateX(-12px); }
}

@keyframes spTabFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 960px) {
  .hero-plaza-grid {
    grid-template-columns: 1fr;
  }
  .space-doors-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .ch-tabs {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .ch-tab {
    min-height: 64px;
    padding: 12px 14px;
  }
  .space-doors-grid,
  .sk-room-grid,
  .pulse-cards-grid {
    grid-template-columns: 1fr;
  }
  .sk-room-tile .room-tag {
    display: none;
  }
  .sk-room-tile {
    grid-template-columns: 38px minmax(0, 1fr) 34px;
  }
  .gr-for {
    margin-left: 0;
  }
}

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

html[data-motion="paused"] *,
html[data-motion="paused"] *::before,
html[data-motion="paused"] *::after,
body.paused * {
  animation: none !important;
  transition: none !important;
}
