:root {
  /* Minecraft Deepslate × Cozy Anime Cherry Palette */
  --obsidian: #131118;
  --deepslate: #221e2b;
  --deepslate-hi: #2f2a3b;
  --stone: #3a3547;
  --stone-btn: #585266;
  --stone-btn-hi: #6d667e;
  --wood: #4f3524;
  --wood-dark: #342116;
  --parchment: #e7d8b5;
  --parchment-ink: #2c2015;
  --slot-bg: #17141f;
  --border-dark: #09080c;
  --bevel-light: rgba(255, 245, 250, 0.22);
  --bevel-dark: rgba(0, 0, 0, 0.48);

  --text: #f7f1e8;
  --muted: #b6adc4;
  --sakura: #ff9ec7;
  --sakura-dark: #c95f8f;
  --emerald: #52e37d;
  --emerald-dark: #258d46;
  --gold: #ffca57;
  --aqua: #66d9ff;
  --lavender: #d1a3ff;
  --nether: #ff7755;
  --end: #cf82ff;
  --danger: #ff6b6b;

  --mc-font: "Minecraftia", "Silkscreen", "Press Start 2P", ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--obsidian);
  color: var(--text);
  font: 13px/1.45 ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  image-rendering: pixelated;
}

.pixel-art {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* 2-row grid: topbar sits ABOVE BlueMap so it NEVER overlaps BlueMap's native controls */
.app {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr 436px;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: var(--obsidian);
}
.app.collapsed {
  grid-template-columns: 1fr 0px;
}
.app.cinema-mode .mc-topbar {
  display: none;
}
.app.cinema-mode {
  grid-template-rows: 1fr;
}

/* Minecraft × Sakura Top Command Bar */
.mc-topbar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: max(7px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 7px max(12px, env(safe-area-inset-left));
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 158, 199, 0.04) 0px,
      rgba(255, 158, 199, 0.04) 8px,
      transparent 8px,
      transparent 16px
    ),
    linear-gradient(180deg, #2d2638 0%, #201b29 100%);
  border-bottom: 3px solid var(--border-dark);
  box-shadow: inset 0 2px 0 rgba(255, 190, 220, 0.18), inset 0 -2px 0 rgba(0, 0, 0, 0.45);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 9px; }
.brand-emblem {
  width: 32px; height: 32px; display: block;
  border: 2px solid var(--border-dark);
  box-shadow: inset 1px 1px 0 var(--bevel-light), 0 0 0 1px rgba(255, 158, 199, 0.45);
  background: #141224;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-size: 14px; letter-spacing: 0.09em; color: var(--sakura); text-shadow: 2px 2px 0 #120c18; }
.brand-sub { font-size: 11px; color: var(--muted); }

.hud-stats, .hud-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.mc-stat {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; font-size: 11px; font-weight: 700;
  background: var(--slot-bg); border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.6), inset -1px -1px 0 rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.stat-emerald { color: var(--emerald); }
.stat-gold { color: var(--gold); }
.stat-sakura { color: var(--sakura); }
.stat-aqua { color: var(--aqua); }
.stat-season { cursor: pointer; font-family: inherit; transition: border-color 180ms ease, box-shadow 180ms ease; }
.stat-season.season-spring { color: #ffb3d4; border-color: rgba(255, 158, 199, 0.45); }
.stat-season.season-summer { color: #ffd978; border-color: rgba(255, 202, 87, 0.45); }
.stat-season.season-autumn { color: #ffab66; border-color: rgba(255, 138, 71, 0.48); }
.stat-season.season-winter { color: #9de9ff; border-color: rgba(122, 226, 255, 0.48); }
.stat-season.is-festival { box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.55), 0 0 12px rgba(255, 202, 87, 0.45); border-color: var(--gold); color: #fff0b8; }
.stat-season:hover { filter: brightness(1.14); }
.stat-budget { color: var(--lavender); cursor: pointer; font-family: inherit; }
.stat-budget:hover { border-color: var(--lavender); color: #fff; }
.ai-budget-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-left: 3px solid var(--lavender);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 0 0 auto;
}
.ai-budget-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
  color: var(--muted);
}
.ai-budget-meta strong { color: var(--text); }
.badge-budget { background: #223b2c; color: var(--emerald); }
.badge-budget.throttled { background: #5c4311; color: var(--gold); }
.badge-budget.capped { background: #5a2026; color: #ff9c9c; }

.dot-live { width: 7px; height: 7px; background: var(--emerald); display: inline-block; box-shadow: 0 0 6px var(--emerald); }

/* Authentic 3D Beveled Minecraft Stone Buttons */
.mc-btn {
  padding: 5px 10px;
  font: 700 11px/1.2 var(--mc-font);
  letter-spacing: 0.03em; color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
  background: var(--stone-btn); border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark);
  cursor: pointer; user-select: none;
}
.mc-btn:hover { background: var(--stone-btn-hi); color: #fff8dc; }
.mc-btn:active { box-shadow: inset 2px 2px 0 var(--bevel-dark), inset -1px -1px 0 var(--bevel-light); transform: translateY(1px); }
.mc-btn-emerald { background: var(--emerald-dark); }
.mc-btn-emerald:hover { background: #2fa655; }
.mc-btn-sakura { background: var(--sakura-dark); }
.mc-btn-sakura:hover { background: #df74a5; }
.mc-btn-gold { background: #8f6218; }
.mc-btn-gold:hover { background: #ad7822; }
.mc-btn-danger { background: #9f3338; }
.mc-btn-danger:hover { background: #bd4046; }
.mc-btn-music {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mc-btn-music.is-playing {
  background: #266b47;
  color: #e8fff2;
  box-shadow: inset 2px 2px 0 rgba(190, 255, 220, 0.28), inset -2px -3px 0 var(--bevel-dark), 0 0 10px rgba(82, 227, 125, 0.28);
}
.mc-btn-music.is-playing:hover { background: #2f8257; }
.mc-btn-xs { padding: 3px 6px; font-size: 10px; }

/* Unobstructed 3D BlueMap Viewport */
.map-stage { position: relative; width: 100%; height: 100%; min-height: 0; background: #0d0c14; overflow: hidden; }
#mapFrame { width: 100%; height: 100%; border: 0; display: block; }
.season-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.mc-crosshair {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font: 700 24px/1 monospace; color: rgba(255, 255, 255, 0.85);
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  pointer-events: none; z-index: 12;
}

.pov-hud {
  position: absolute; left: 14px; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); max-width: 820px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px;
  background: rgba(24, 20, 34, 0.94); border: 3px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 158, 199, 0.25), inset -2px -2px 0 rgba(0, 0, 0, 0.65), 0 6px 20px rgba(0, 0, 0, 0.65);
  z-index: 15;
}
.pov-portrait-slot {
  width: 56px; height: 56px; flex-shrink: 0; background: var(--slot-bg);
  border: 2px solid var(--gold); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.7), 0 0 0 2px var(--border-dark);
  overflow: hidden;
}
.pov-portrait-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pov-info { flex: 1; min-width: 190px; display: flex; flex-direction: column; gap: 2px; }
.pov-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pov-live-tag {
  background: var(--sakura-dark); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border: 1px solid var(--border-dark); letter-spacing: 0.05em;
}
.pov-meta { font-size: 11px; color: var(--aqua); }
.pov-quote { font-size: 11px; color: #f4e6d2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 440px; }
.pov-controls { display: flex; flex-wrap: wrap; gap: 5px; }

/* Minecraft Inventory Sidebar */
.sidebar {
  position: relative;
  display: flex; flex-direction: column; height: 100%; min-height: 0;
  background: var(--deepslate); border-left: 3px solid var(--border-dark);
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.08); overflow: hidden;
  contain: layout style;
}

.tabs {
  display: grid; grid-template-columns: repeat(9, 1fr);
  background: #171320; border-bottom: 3px solid var(--border-dark);
}
.tab {
  padding: 9px 1px; background: #262133; border: 0; border-right: 2px solid var(--border-dark);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), inset -2px 0 rgba(0, 0, 0, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.45);
  color: var(--muted); font: 700 8.8px/1.2 var(--mc-font); letter-spacing: 0.01em; text-transform: uppercase; cursor: pointer;
}
.tab:last-child { border-right: 0; }
.tab:hover { color: #fff; background: #312b42; }
.tab.active {
  background: var(--deepslate); color: var(--sakura);
  box-shadow: inset 0 3px 0 var(--sakura), inset 2px 0 0 rgba(255, 255, 255, 0.12);
}

.panel {
  display: none; flex: 1; min-height: 0; overflow-y: auto; padding: 11px; gap: 9px;
  contain: layout style;
}
.panel.active { display: flex; flex-direction: column; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-head h2, .mc-card h3 {
  margin: 0; font-size: 13px; letter-spacing: 0.05em; color: var(--gold); text-shadow: 1px 1px 0 #09080c;
}
.hint-line { margin: -3px 0 2px; font-size: 11px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.warn { color: var(--gold); margin: 4px 0; }
.hidden { display: none !important; }

.ws-pill {
  padding: 2px 6px; font-size: 10px; font-weight: 700;
  background: var(--slot-bg); border: 2px solid var(--border-dark); color: var(--emerald);
}

/* Filter Pills & Search for 30+ Citizens */
.filter-row { display: flex; flex-wrap: wrap; gap: 4px; }
.filter-pill {
  padding: 3px 7px; font: 700 10px/1.2 var(--mc-font);
  background: var(--slot-bg); color: var(--muted);
  border: 2px solid var(--border-dark); cursor: pointer;
}
.filter-pill:hover { color: #fff; border-color: var(--sakura); }
.filter-pill.active { background: var(--sakura-dark); color: #fff; border-color: var(--border-dark); }

.search-input {
  width: 100%; padding: 5px 8px;
  background: var(--slot-bg); color: var(--text);
  border: 2px solid var(--border-dark); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.65);
  font: 11px/1.3 var(--mc-font);
}
.search-input:focus { outline: 2px solid var(--sakura); outline-offset: -2px; }

/* Minecraft Panel Cards */
.mc-card {
  background: var(--deepslate-hi); border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.1), inset -2px -2px 0 rgba(0, 0, 0, 0.45);
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}

/* Resident Inventory Slots with Anime Pixel Portraits & Live Goals */
.resident-list {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px;
  flex: 0 0 auto; min-height: 250px; max-height: 46vh; overflow-y: auto; padding-right: 2px;
}
.feed {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px;
  flex: 0 0 auto;
}

.resident-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 7px;
  background: var(--deepslate-hi); border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.1), inset -2px -2px 0 rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.resident-item:hover { border-color: var(--sakura); background: #362f46; }
.resident-item.watching { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold), inset -2px -2px 0 rgba(0, 0, 0, 0.45); }

.avatar-slot {
  width: 42px; height: 42px; flex-shrink: 0; background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.65), inset -1px -1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden; display: grid; place-items: center;
}
.avatar-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.res-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.res-top { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.res-name { font-weight: 700; color: #fff; font-size: 12px; text-shadow: 1px 1px 0 #09080c; }
.res-goal {
  font-size: 10px; color: #ffdba3; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.res-thought {
  font-size: 10px; color: #e2c6ff; font-style: italic; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.res-sub {
  font-size: 10px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.res-btns { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; }

.badge {
  font-size: 9px; padding: 1px 4px; font-weight: 700;
  border: 1px solid var(--border-dark); text-transform: uppercase;
}
.badge-java { background: #1f4870; color: var(--aqua); }
.badge-bedrock { background: #1c573c; color: var(--emerald); }
.badge-townie { background: #6b2d4d; color: var(--sakura); }
.badge-byoa { background: #4a2a6b; color: var(--lavender); }
.badge-king { background: #6e4e10; color: var(--gold); }
.badge-nether { background: #732215; color: var(--nether); }
.badge-end { background: #4f1c75; color: var(--end); }
.badge-arch { background: #262133; color: #d6cfe6; }

/* Slide-Over Individual Character Quest Dossier */
.dossier-overlay {
  position: absolute; inset: 39px 0 0 0; z-index: 25;
  background: var(--deepslate); display: flex; flex-direction: column;
  border-top: 2px solid var(--border-dark);
}
.dossier-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 10px; background: #191524; border-bottom: 2px solid var(--border-dark);
}
.dossier-head-actions { display: flex; gap: 4px; }
.dossier-body {
  flex: 1; overflow-y: auto; padding: 11px; display: flex; flex-direction: column; gap: 10px;
}
.dossier-hero {
  display: flex; gap: 10px; align-items: center;
  background: var(--deepslate-hi); border: 2px solid var(--border-dark); padding: 9px;
}
.dossier-portrait {
  width: 64px; height: 64px; flex-shrink: 0; border: 2px solid var(--gold);
  background: var(--slot-bg); overflow: hidden;
}
.dossier-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dossier-title { font-size: 15px; font-weight: 700; color: #fff; text-shadow: 1px 1px 0 #000; }
.dossier-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.dossier-stat {
  background: var(--slot-bg); border: 2px solid var(--border-dark); padding: 5px 7px; font-size: 11px;
}
.dossier-stat b { color: var(--gold); display: block; font-size: 10px; text-transform: uppercase; }
.quest-box {
  background: var(--slot-bg); border: 2px solid var(--border-dark); padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.quest-box h4 { margin: 0; font-size: 11px; color: var(--sakura); text-transform: uppercase; letter-spacing: 0.05em; }
.quest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.quest-item { font-size: 11px; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.quest-item.done { color: var(--emerald); }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.inv-chip {
  font-size: 10px; padding: 2px 6px; background: #262133;
  border: 1px solid var(--border-dark); color: #f2e8dc;
}
.biome-chip {
  font-size: 10px; padding: 2px 6px; background: #1d352d;
  border: 1px solid var(--border-dark); color: #8af0b6;
}
.journal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.journal-list li {
  font-size: 11px; padding: 4px 6px; background: #1c1828;
  border-left: 2px solid var(--sakura); color: #ebe2f2;
}

/* Kingdoms, Laws & World-First Milestones Tab */
.milestone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.milestone-card {
  padding: 7px 8px; background: var(--slot-bg); border: 2px solid var(--border-dark);
  display: flex; flex-direction: column; gap: 2px; font-size: 11px;
}
.milestone-card.unlocked {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(143, 98, 24, 0.28), rgba(23, 20, 31, 0.95));
}
.milestone-card strong { font-size: 11px; color: var(--muted); }
.milestone-card.unlocked strong { color: var(--gold); }

.kingdom-list, .law-list { display: flex; flex-direction: column; gap: 7px; }
.kingdom-card {
  background: var(--deepslate-hi); border: 2px solid var(--border-dark);
  border-left: 4px solid var(--gold); padding: 9px; display: flex; flex-direction: column; gap: 5px;
}
.kingdom-motto { font-size: 11px; color: #e2d5eb; font-style: italic; }
.law-card {
  background: var(--slot-bg); border: 2px solid var(--border-dark);
  border-left: 3px solid var(--aqua); padding: 8px; display: flex; flex-direction: column; gap: 3px;
}
.law-card.enacted { border-left-color: var(--emerald); }
.law-card.rejected { border-left-color: var(--danger); opacity: 0.72; }

/* Live Minecraft Feed */
.feed-item {
  padding: 6px 8px; background: var(--slot-bg); border: 2px solid var(--border-dark);
  border-left: 3px solid #524a66; font-size: 12px; word-break: break-word;
}
.feed-item.kind-chat { border-left-color: var(--sakura); }
.feed-item.kind-build { border-left-color: var(--emerald); }
.feed-item.kind-bounty { border-left-color: var(--gold); }
.feed-item.kind-join { border-left-color: var(--aqua); }
.feed-item.kind-politics { border-left-color: var(--gold); background: rgba(143, 98, 24, 0.14); }
.feed-item.kind-adventure { border-left-color: var(--end); background: rgba(120, 44, 180, 0.18); }
.feed-item.kind-world_event {
  border-left-color: #d66bff;
  background: linear-gradient(90deg, rgba(164, 70, 224, 0.18), rgba(23, 20, 31, 0.9));
}
.feed-time { color: var(--muted); font-size: 10px; margin-right: 6px; }

/* BossBar Live Event Banner */
.event-banner {
  background: linear-gradient(180deg, #3a1f4a 0%, #241530 100%);
  border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 175, 240, 0.25), inset -2px -2px 0 rgba(0, 0, 0, 0.55);
  padding: 8px 9px; display: flex; flex-direction: column; gap: 5px;
}
.event-top, .event-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.event-title { color: var(--gold); font-size: 12px; text-shadow: 1px 1px 0 #09080c; }
.event-timer { font-size: 11px; font-weight: 700; color: var(--sakura); background: var(--slot-bg); border: 1px solid var(--border-dark); padding: 1px 5px; }
.bossbar-track { height: 7px; background: #140b1a; border: 1px solid var(--border-dark); overflow: hidden; }
.bossbar-fill { height: 100%; background: repeating-linear-gradient(90deg, #d66bff 0px, #d66bff 18px, #b84ee3 18px, #b84ee3 20px); transition: width 0.5s linear; }
.event-desc { font-size: 11px; color: #f3e4fa; line-height: 1.3; }

/* Oak-Plank Notice Board Cards */
.notice-card {
  background: linear-gradient(180deg, #5d3f2a 0%, #48301f 100%);
  border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 220, 175, 0.2), inset -2px -2px 0 rgba(0, 0, 0, 0.45);
  padding: 9px 10px; margin-bottom: 8px; color: #fdf4e3;
}
.notice-meta { display: flex; justify-content: space-between; font-size: 11px; color: #e2ccb0; margin-top: 4px; }
.reward { color: var(--emerald); font-weight: 700; text-shadow: 1px 1px 0 #102014; }

/* Book & Quill Parchment Chronicle Cards */
.chronicle-card {
  background: var(--parchment); color: var(--parchment-ink);
  border: 3px solid #5c3d22; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.45), 0 0 0 2px var(--border-dark);
  padding: 12px; margin-bottom: 10px;
}
.chronicle-card strong { color: #3a1d0c; }
.chronicle-card .muted { color: #6e5237; }

/* Inputs & Forms */
.form { display: flex; flex-direction: column; gap: 8px; }
.form label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.form input {
  padding: 6px 8px; border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.65); background: var(--slot-bg);
  color: var(--text); font: 12px/1.3 var(--mc-font);
}
.form input:focus { outline: 2px solid var(--sakura); outline-offset: -2px; }
.row2 { display: grid; grid-template-columns: 1fr 84px; gap: 8px; }
.join-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mc-slot-box {
  background: var(--slot-bg); border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.65); padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.subtabs { display: flex; gap: 5px; flex-wrap: wrap; }
.subtab {
  padding: 4px 8px; border: 2px solid var(--border-dark);
  background: var(--slot-bg); color: var(--muted); font: 700 11px/1.2 var(--mc-font); cursor: pointer;
}
.subtab.active { background: var(--sakura-dark); color: #fff; }
.code {
  margin: 0; padding: 8px 9px; background: #100d16; border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.65); color: #f0e4f6;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; max-height: 210px; overflow-y: auto;
}
.msg { margin: 0; font-size: 11px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--emerald); }
.empty { color: var(--muted); font-size: 12px; padding: 6px 0; }
.token-box { border-top: 2px solid var(--border-dark); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }

/* Auto-Opening POV Quest, Inner Thoughts & Visual Minecraft Inventory Panel */
.pov-quest-panel {
  position: absolute;
  top: 56px;
  left: 12px;
  width: 334px;
  max-height: calc(100% - 154px);
  display: flex;
  flex-direction: column;
  background: rgba(24, 20, 34, 0.94);
  border: 3px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 158, 199, 0.22), inset -2px -2px 0 rgba(0, 0, 0, 0.65), 0 8px 24px rgba(0, 0, 0, 0.68);
  z-index: 16;
  overflow: hidden;
}
.pov-quest-panel.collapsed .pov-qp-body { display: none; }
.pov-qp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 7px 9px; background: #191525; border-bottom: 2px solid var(--border-dark);
}
.pov-qp-title-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.pov-qp-title-wrap strong { font-size: 12px; color: var(--gold); text-shadow: 1px 1px 0 #000; }
.pov-qp-body {
  padding: 9px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
}
.badge-morale { background: #223b2c; color: var(--emerald); }
.badge-morale.low { background: #5a2026; color: #ff9c9c; }
.badge-morale.high { background: #5c4311; color: var(--gold); }

.vitals-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: var(--slot-bg); border: 2px solid var(--border-dark); padding: 4px 7px; font-size: 11px;
}
.vital-hp { color: #ff6b7a; font-weight: 700; }
.vital-food { color: #f4a261; font-weight: 700; }
.vital-morale { color: var(--lavender); font-weight: 700; }

.thought-bubble-box {
  background: linear-gradient(180deg, rgba(84, 46, 128, 0.32), rgba(24, 18, 38, 0.92));
  border: 2px solid #7f54b3;
  box-shadow: inset 1px 1px 0 rgba(235, 200, 255, 0.25);
  padding: 7px 8px; display: flex; flex-direction: column; gap: 4px;
}
.thought-main { font-size: 12px; color: #f7ebff; font-style: italic; line-height: 1.35; }
.thought-prev { font-size: 10px; color: #b99fd4; border-top: 1px solid rgba(209, 163, 255, 0.18); padding-top: 3px; }

/* Authentic Minecraft Visual Inventory Grid */
.mc-inv-wrap {
  background: #272330;
  border: 2px solid var(--border-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.12), inset -2px -2px 0 rgba(0, 0, 0, 0.55);
  padding: 7px; display: flex; flex-direction: column; gap: 5px;
}
.mc-inv-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.mc-inv-armor { display: flex; align-items: center; gap: 3px; }
.mc-inv-armor .mc-inv-slot { width: 28px; height: 28px; min-width: 28px; flex: 0 0 28px; }
.slot-sep { width: 5px; display: inline-block; }
.mc-held-tag { font-size: 10px; color: var(--gold); font-weight: 700; text-transform: capitalize; }
.mc-inv-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.mc-inv-grid {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px;
}
.mc-inv-slot {
  position: relative; aspect-ratio: 1 / 1; min-width: 26px;
  background: #17141f;
  border: 2px solid #0b0910;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.72), inset -1px -1px 0 rgba(255, 255, 255, 0.14);
  display: grid; place-items: center;
}
.mc-inv-slot.active {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold), 0 0 6px rgba(255, 202, 87, 0.45);
  background: #2b2316;
}
.mc-inv-slot img { width: 82%; height: 82%; object-fit: contain; display: block; }
.slot-ghost { font-size: 11px; opacity: 0.34; user-select: none; }
.slot-count {
  position: absolute; right: 1px; bottom: 0px;
  font: 700 9px/1 var(--mc-font); color: #ffffff;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000;
  pointer-events: none;
}

/* Social Simulation Cards (Mind Stream, Relationships, Rumors, Movements) */
.thought-stream, .social-list { display: flex; flex-direction: column; gap: 6px; }
.thought-card {
  background: var(--slot-bg); border: 2px solid var(--border-dark);
  border-left: 3px solid var(--lavender); padding: 6px 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
}
.thought-card:hover { border-color: var(--sakura); background: #262035; }
.rel-card, .rumor-card, .movement-card {
  background: var(--deepslate-hi); border: 2px solid var(--border-dark);
  padding: 7px 8px; display: flex; flex-direction: column; gap: 3px; font-size: 11px;
}
.rel-card.stance-ally, .rel-card.stance-friend, .rel-card.stance-admire { border-left: 4px solid var(--emerald); }
.rel-card.stance-rival, .rel-card.stance-nemesis, .rel-card.stance-suspicious { border-left: 4px solid var(--danger); }
.rumor-card { border-left: 4px solid #ff9f1c; }
.movement-card { border-left: 4px solid var(--lavender); }
.feed-item.kind-social { border-left-color: var(--lavender); background: rgba(157, 78, 221, 0.14); }
.feed-item.kind-goal { border-left-color: var(--gold); background: rgba(255, 202, 87, 0.14); }

/* Human-Assigned Agent Goal Directive & Admin Goal Drawer */
.badge-directive { background: #5c3a11; color: #ffe08a; border: 1px solid rgba(255, 202, 87, 0.45); }
.badge-admin { background: #224634; color: #8af7bc; }
.directive-banner {
  background: linear-gradient(135deg, rgba(110, 74, 24, 0.42), rgba(46, 26, 56, 0.78));
  border: 2px solid var(--gold);
  box-shadow: inset 1px 1px 0 rgba(255, 232, 168, 0.28);
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.directive-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
}
.directive-text { font-size: 12px; color: #fff8e6; line-height: 1.4; font-weight: 600; }
.admin-goal-drawer {
  background: #1a1526;
  border-bottom: 2px solid var(--border-dark);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}
.admin-goal-drawer.hidden { display: none; }
.admin-goal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.admin-goal-head strong { font-size: 11px; color: var(--gold); }
.admin-goal-head-right { display: flex; align-items: center; gap: 5px; }
.admin-goal-body { display: flex; flex-direction: column; gap: 6px; }
.admin-goal-body.hidden, .admin-auth-form.hidden, .admin-goal-form.hidden { display: none; }
.admin-auth-form, .admin-goal-form { display: flex; flex-direction: column; gap: 6px; }
.admin-auth-row { display: flex; gap: 6px; align-items: center; }
.admin-auth-row input, .admin-goal-form textarea {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  background: #100d17;
  color: #f7f0ff;
  border: 2px solid var(--border-dark);
  padding: 6px 8px;
  font: 12px/1.35 var(--mc-font);
  resize: vertical;
}
.admin-auth-row input:focus, .admin-goal-form textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.goal-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.goal-preset-chip {
  padding: 3px 7px;
  background: #251e34;
  border: 1px solid rgba(255, 202, 87, 0.30);
  color: #f5dfb0;
  font: 10.5px/1.2 var(--mc-font);
  cursor: pointer;
}
.goal-preset-chip:hover { background: #372c4d; border-color: var(--gold); }
.admin-goal-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Shared 24/7 Cozy Cinema AI Narrated TV Overlay */
.narrator-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 18;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: hidden;
  animation: cozyOverlayIn 520ms cubic-bezier(0.22, 1, 0.36, 1);
}
.narrator-overlay.hidden { display: none; }
@keyframes cozyOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Soft warm hearth vignette + gentle scene-cut veil */
.narrator-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 44%, rgba(255, 226, 180, 0.0) 48%, rgba(22, 14, 30, 0.38) 84%, rgba(12, 8, 20, 0.62) 100%),
    linear-gradient(180deg, rgba(20, 14, 28, 0.32) 0%, transparent 18%, transparent 74%, rgba(16, 11, 24, 0.44) 100%);
  transition: opacity 420ms ease;
}
.narrator-vignette.beat-crossfade {
  animation: cozyCrossfade 760ms ease-out;
}
@keyframes cozyCrossfade {
  0% { background-color: rgba(255, 224, 178, 0.14); }
  100% { background-color: rgba(255, 224, 178, 0); }
}

/* Live fireflies / sakura petals / snow motes canvas */
.narrator-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.narrator-top {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.narrator-live-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(28, 20, 39, 0.90), rgba(19, 14, 29, 0.94));
  border: 1px solid rgba(255, 218, 165, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 238, 208, 0.22), 0 8px 24px rgba(8, 5, 16, 0.45);
  font-size: 11px;
  color: #fff6e8;
}
.dot-hearth {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c4, #ffae42 58%, #e85d3c 100%);
  box-shadow: 0 0 10px rgba(255, 178, 72, 0.9), 0 0 20px rgba(255, 140, 66, 0.45);
  display: inline-block;
  animation: cozyHearthPulse 2.4s ease-in-out infinite;
}
@keyframes cozyHearthPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.84); opacity: 0.72; }
}
.narrator-brand-tag {
  letter-spacing: 0.08em;
  color: #ffe8c2;
  font-weight: 700;
}
.narrator-chapter {
  padding: 2px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 198, 108, 0.24), rgba(255, 146, 178, 0.20));
  color: #ffd98e;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid rgba(255, 212, 138, 0.35);
}
.narrator-shot {
  color: #b7e9ff;
  font-weight: 600;
}
.narrator-track-pill {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(168, 230, 196, 0.14);
  border: 1px solid rgba(168, 230, 196, 0.30);
  color: #b8f2d0;
  font-size: 10.5px;
  animation: cozyChipIn 360ms ease-out;
}
.narrator-track-pill.hidden { display: none; }

.narrator-top-actions {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

/* Warm tactile rounded cozy control pills */
.cozy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: #fdf4e7;
  background: rgba(25, 18, 35, 0.88);
  border: 1px solid rgba(255, 224, 182, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 240, 214, 0.18), 0 6px 18px rgba(8, 5, 16, 0.38);
  cursor: pointer;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.cozy-pill:hover {
  transform: translateY(-1px);
  background: rgba(45, 33, 60, 0.88);
  border-color: rgba(255, 214, 148, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 244, 222, 0.26), 0 8px 22px rgba(8, 5, 16, 0.48);
}
.cozy-pill:active { transform: translateY(0); }
.cozy-pill-gold {
  background: linear-gradient(135deg, rgba(112, 74, 34, 0.84), rgba(66, 42, 34, 0.86));
  border-color: rgba(255, 206, 122, 0.45);
  color: #ffebc2;
}
.cozy-pill-exit {
  background: rgba(82, 32, 46, 0.78);
  border-color: rgba(255, 145, 168, 0.38);
  color: #ffd7df;
}
.cozy-pill-exit:hover {
  background: rgba(116, 40, 60, 0.88);
  border-color: rgba(255, 168, 188, 0.6);
}
.cozy-pill-music.is-playing,
.cozy-pill.is-active {
  background: linear-gradient(135deg, rgba(64, 108, 86, 0.86), rgba(38, 66, 62, 0.88));
  border-color: rgba(164, 240, 198, 0.58);
  color: #e2fff0;
  box-shadow: inset 0 1px 0 rgba(215, 255, 232, 0.3), 0 0 18px rgba(124, 228, 174, 0.25);
}

/* Live 4-bar cozy audio equalizer */
.cozy-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  width: 14px;
}
.cozy-eq i {
  display: block;
  width: 2.5px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 224, 182, 0.55);
  transition: height 220ms ease, background 220ms ease;
}
.cozy-pill-music.is-playing .cozy-eq i,
.mc-btn-music.is-playing .cozy-eq i {
  background: #a9f5cb;
  animation: cozyEqBar 1.15s ease-in-out infinite;
}
.cozy-pill-music.is-playing .cozy-eq i:nth-child(1),
.mc-btn-music.is-playing .cozy-eq i:nth-child(1) { animation-delay: 0ms; }
.cozy-pill-music.is-playing .cozy-eq i:nth-child(2),
.mc-btn-music.is-playing .cozy-eq i:nth-child(2) { animation-delay: 220ms; }
.cozy-pill-music.is-playing .cozy-eq i:nth-child(3),
.mc-btn-music.is-playing .cozy-eq i:nth-child(3) { animation-delay: 440ms; }
.cozy-pill-music.is-playing .cozy-eq i:nth-child(4),
.mc-btn-music.is-playing .cozy-eq i:nth-child(4) { animation-delay: 140ms; }
@keyframes cozyEqBar {
  0%, 100% { height: 3px; }
  45% { height: 12px; }
  75% { height: 6px; }
}

/* Warm Candlelit Storybook Lower-Third Card */
.narrator-lower {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  width: min(880px, 100%);
  margin: 0 auto;
  border-radius: 20px;
  background: linear-gradient(165deg, rgba(32, 23, 41, 0.92) 0%, rgba(20, 14, 28, 0.95) 100%);
  border: 1.5px solid rgba(255, 214, 156, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 200, 0.30),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    0 16px 36px rgba(8, 4, 16, 0.55);
  overflow: hidden;
}
.narrator-lower.beat-flash {
  animation: narratorBeatIn 480ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes narratorBeatIn {
  0% { opacity: 0.45; transform: translateY(10px) scale(0.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.narrator-lower-glow {
  position: absolute;
  top: -40px;
  left: 18%;
  width: 64%;
  height: 70px;
  background: radial-gradient(ellipse at center, rgba(255, 204, 128, 0.20), transparent 72%);
  pointer-events: none;
}

.narrator-lower-main {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 18px 12px;
}
.narrator-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  padding: 3px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 212, 128, 0.72), rgba(255, 164, 198, 0.58));
  box-shadow: 0 0 18px rgba(255, 196, 112, 0.30);
}
.narrator-avatar-slot {
  width: 60px;
  height: 60px;
  border-radius: 13px;
  background: var(--slot-bg);
  overflow: hidden;
  border: 2px solid rgba(20, 14, 28, 0.85);
}
.narrator-avatar-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.narrator-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.narrator-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  font-size: 11.5px;
}
.narrator-subject { color: #ffd98a; font-weight: 700; }
.narrator-dot { color: rgba(255, 224, 180, 0.42); }
.narrator-loc { color: #b5e6ff; }
.narrator-thought {
  color: #e4c7ff;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 440px;
  opacity: 0.92;
}
.narrator-headline {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.24;
  color: #fff8eb;
  text-shadow: 0 2px 10px rgba(10, 6, 18, 0.65);
  letter-spacing: 0.01em;
}
.narrator-text {
  margin: 2px 0 0;
  font-size: 13.5px;
  line-height: 1.52;
  color: #f2e8f9;
}
.cozy-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(3px);
  animation: cozyWordIn 360ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--wi, 0) * 26ms);
}
@keyframes cozyWordIn {
  to { opacity: 1; transform: translateY(0); }
}

.narrator-bullets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 9px;
  padding: 9px 18px 12px;
  background: rgba(12, 8, 20, 0.36);
  border-top: 1px solid rgba(255, 224, 182, 0.12);
}
.narrator-bullet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 218, 174, 0.09);
  border: 1px solid rgba(255, 210, 165, 0.18);
  font-size: 11px;
  color: #e6d8f2;
  opacity: 0;
  transform: translateY(4px);
  animation: cozyChipIn 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(180ms + var(--bi, 0) * 95ms);
}
.narrator-bullet::before { content: "✦"; color: #ffb3cb; font-size: 10px; }
@keyframes cozyChipIn {
  to { opacity: 1; transform: translateY(0); }
}

.narrator-progress-track {
  position: relative;
  height: 4px;
  width: 100%;
  background: rgba(255, 232, 200, 0.10);
}
.narrator-progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, #ff9ec7 0%, #ffc875 65%, #fff0b8 100%);
  box-shadow: 0 0 12px rgba(255, 198, 118, 0.55);
  transition: width 0.25s linear;
}
.narrator-progress-spark {
  position: absolute;
  right: -3px;
  top: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff8d6;
  box-shadow: 0 0 10px #ffd27d, 0 0 18px rgba(255, 186, 110, 0.85);
}

.narrator-season-pill {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 230, 196, 0.25);
  color: #fff3df;
  font-size: 10.5px;
  font-weight: 700;
}
.narrator-season-pill.is-festival {
  background: rgba(255, 196, 86, 0.24);
  border-color: rgba(255, 214, 118, 0.65);
  color: #fff2bd;
}

/* ===== Stardew-Style Living Calendar & Seasons Almanac ===== */
.season-hero {
  border: 2px solid var(--border-dark);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.16), inset -2px -2px 0 rgba(0, 0, 0, 0.45);
}
.season-hero.season-spring {
  background: linear-gradient(145deg, #3c2237 0%, #24352d 100%);
  border-left: 4px solid #ff9ec7;
}
.season-hero.season-summer {
  background: linear-gradient(145deg, #433219 0%, #1d3944 100%);
  border-left: 4px solid #ffca57;
}
.season-hero.season-autumn {
  background: linear-gradient(145deg, #4a2318 0%, #311d24 100%);
  border-left: 4px solid #ff8a47;
}
.season-hero.season-winter {
  background: linear-gradient(145deg, #1b2e44 0%, #201c33 100%);
  border-left: 4px solid #7ae2ff;
}
.season-hero-top { display: flex; align-items: center; gap: 11px; }
.season-emblem {
  width: 44px; height: 44px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 24px;
  background: rgba(12, 10, 18, 0.55);
  border: 2px solid var(--border-dark);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.2);
}
.season-hero-info { flex: 1; min-width: 0; }
.season-hero-title-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.season-hero-name { font: 800 16px/1.1 var(--mc-font); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.7); }
.season-year-badge {
  padding: 2px 7px; font-size: 10.5px; font-weight: 700;
  background: rgba(0, 0, 0, 0.42); border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffe8c2;
}
.season-hero-tagline { font-size: 11.5px; color: #e2d8ee; margin-top: 3px; }
.season-thermo-box, .season-daybar-wrap { display: flex; flex-direction: column; gap: 4px; }
.thermo-track {
  position: relative; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, #5cc8ff 0%, #6ee7c8 35%, #7ae870 55%, #ffca57 78%, #ff6b4a 100%);
  border: 1px solid rgba(0, 0, 0, 0.65);
}
.thermo-marker {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid #16131f;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.85);
  transition: left 350ms ease;
}
.season-buff-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.season-buff-chip {
  padding: 2px 7px; font-size: 10.5px; font-weight: 700;
  background: rgba(0, 0, 0, 0.36); border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f3eafb;
}

.festival-spotlight {
  background: linear-gradient(150deg, #2b1e36 0%, #1d1828 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--gold);
  padding: 10px 11px;
  display: flex; flex-direction: column; gap: 4px;
}
.festival-spotlight.is-live {
  background: linear-gradient(150deg, #432b16 0%, #2c1b34 100%);
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(255, 202, 87, 0.25);
}
.festival-card-title { font: 800 13.5px/1.25 var(--mc-font); color: #ffe699; }
.festival-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.badge-gold { background: #5a4212; color: #ffde80; }

.calendar-almanac-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.season-browser-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.season-tab-pill {
  padding: 5px 4px; font: 700 10.5px/1.2 var(--mc-font);
  background: #252033; color: var(--muted);
  border: 2px solid var(--border-dark); cursor: pointer;
}
.season-tab-pill:hover { color: #fff; background: #312b42; }
.season-tab-pill.active[data-cal-season="spring"] { background: #4b243c; color: #ffc6df; border-color: #ff9ec7; }
.season-tab-pill.active[data-cal-season="summer"] { background: #4d3b14; color: #ffe49c; border-color: #ffca57; }
.season-tab-pill.active[data-cal-season="autumn"] { background: #522814; color: #ffc199; border-color: #ff8a47; }
.season-tab-pill.active[data-cal-season="winter"] { background: #1a374f; color: #c4f2ff; border-color: #7ae2ff; }

.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  text-align: center; font-size: 10px; font-weight: 700; color: var(--muted);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day {
  position: relative;
  min-height: 44px; padding: 4px 3px;
  background: #221d2d; border: 2px solid #100d17;
  color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  font-family: inherit; transition: border-color 140ms ease, transform 120ms ease;
}
.cal-day:hover { border-color: rgba(255, 255, 255, 0.35); background: #2c263a; }
.cal-day-num { font-size: 10.5px; font-weight: 700; align-self: flex-start; opacity: 0.85; }
.cal-day-icon { font-size: 15px; line-height: 1; }
.cal-day.is-festival {
  background: linear-gradient(160deg, #3b2a1b 0%, #2c1e34 100%);
  border-color: rgba(255, 202, 87, 0.65);
}
.cal-day.is-today {
  border-color: var(--sakura);
  box-shadow: inset 0 0 0 1px var(--sakura), 0 0 10px rgba(255, 158, 199, 0.4);
  background: #36223c;
}
.cal-day.is-today::after {
  content: "NOW";
  position: absolute; top: 2px; right: 2px;
  font-size: 7.5px; font-weight: 800; color: #ffdf8c;
}
.cal-day.is-selected { outline: 2px solid #fff; outline-offset: -2px; }
.cal-day-detail {
  background: #1d1828; border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 9px; font-size: 11.5px; color: #e8dff3; line-height: 1.45;
}

.season-preview-card { padding: 10px; }
.season-preview-row { display: flex; flex-wrap: wrap; gap: 5px; }
.cal-admin-controls { display: flex; flex-direction: column; gap: 5px; }
.cal-admin-btn-row { display: flex; flex-wrap: wrap; gap: 5px; }
#calAdminFestivalSelect {
  flex: 1; min-width: 0;
  background: #171320; color: var(--text);
  border: 2px solid var(--border-dark); padding: 4px 6px;
  font: 11.5px ui-monospace, monospace;
}

/* ===== RPG Skills, Guild Hall & Level-Up Celebration UI ===== */
.levelup-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(64, 42, 16, 0.94), rgba(38, 22, 52, 0.94));
  border: 2px solid var(--gold);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55), 0 0 22px rgba(255, 202, 87, 0.38);
  color: #fff3c4;
  font: 700 12px/1.3 var(--mc-font);
  pointer-events: none;
  animation: cozyToastIn 360ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes cozyToastIn {
  from { opacity: 0; transform: translate(-50%, -10px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.badge-rpg { background: #3b2a17; color: #ffd984; border: 1px solid rgba(255, 202, 87, 0.35); }
.badge-emerald { background: #173a25; color: #7af2a1; border: 1px solid rgba(82, 227, 125, 0.32); }

.guild-hero-card {
  background: linear-gradient(145deg, #2d203d 0%, #1c2432 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--gold);
  padding: 11px;
  display: flex; flex-direction: column; gap: 9px;
}
.guild-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.guild-stat-tile {
  background: rgba(12, 10, 18, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 6px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.guild-stat-tile strong { font: 800 14px/1.1 var(--mc-font); color: #fff; }
.guild-champion-row {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 202, 87, 0.08);
  border: 1px solid rgba(255, 202, 87, 0.25);
  padding: 7px 9px; cursor: pointer;
}
.guild-champion-row:hover { background: rgba(255, 202, 87, 0.14); }

.skill-masters-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.skill-master-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-top: 3px solid var(--sk-col, var(--gold));
  padding: 8px 9px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  text-align: left; font-family: inherit; color: var(--text);
  transition: transform 120ms ease, border-color 140ms ease;
}
.skill-master-card:hover { background: #231d30; transform: translateY(-1px); }
.skill-master-card.active { outline: 2px solid var(--sk-col, var(--gold)); outline-offset: -2px; background: #271f36; }
.skill-master-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.skill-master-name { font: 800 11.5px/1.2 var(--mc-font); color: var(--sk-col, #fff); }
.skill-master-champ { font-size: 11.5px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skill-master-perk { font-size: 10px; color: var(--muted); line-height: 1.3; }

.skill-lb-list, .levelup-feed { display: flex; flex-direction: column; gap: 5px; }
.skill-lb-row {
  display: grid;
  grid-template-columns: 26px 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  cursor: pointer;
}
.skill-lb-row:hover { background: #241e31; border-color: rgba(255, 202, 87, 0.45); }
.skill-rank-num { font: 800 12px/1 var(--mc-font); text-align: center; color: var(--muted); }
.skill-rank-num.top1 { color: #ffd95e; font-size: 14px; }
.skill-rank-num.top2 { color: #dce7f5; font-size: 13px; }
.skill-rank-num.top3 { color: #e89c68; font-size: 13px; }
.skill-lb-avatar { width: 32px; height: 32px; border: 2px solid var(--border-dark); background: #14111d; }
.skill-lb-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.skill-lb-top { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.skill-lb-bar-track { height: 5px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.skill-lb-bar-fill { height: 100%; background: var(--gold); transition: width 250ms ease; }
.skill-lb-right { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.skill-lb-lvl { font: 800 12px/1 var(--mc-font); color: #ffe28a; }
.skill-lb-em { font-size: 10.5px; font-weight: 700; color: var(--emerald); }

.levelup-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px;
  background: #201a2d;
  border: 1px solid rgba(255, 202, 87, 0.25);
  border-left: 3px solid var(--gold);
  font-size: 11.5px;
}

.rpg-sheet-box {
  background: linear-gradient(160deg, #251c34 0%, #171422 100%);
  border: 2px solid var(--border-dark);
  border-left: 3px solid var(--gold);
  padding: 9px 10px;
  display: flex; flex-direction: column; gap: 7px;
}
.rpg-skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rpg-skill-cell {
  background: rgba(12, 10, 18, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 7px;
  display: flex; flex-direction: column; gap: 3px;
}
.rpg-skill-cell-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 11px; font-weight: 700; }
.rpg-xp-track { height: 5px; background: rgba(255, 255, 255, 0.10); overflow: hidden; }
.rpg-xp-fill { height: 100%; transition: width 260ms ease; }

.skill-guide-card { padding: 8px 10px; }
.skill-guide-card summary { cursor: pointer; font: 700 11.5px/1.3 var(--mc-font); color: #ffe29a; }
.skill-guide-body { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; font-size: 11px; }
.skill-guide-row { display: flex; justify-content: space-between; gap: 8px; padding-bottom: 5px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }

/* 3-Dimension Switcher, Floating Dimension Explorer & Realms Atlas (Incendium + Nullscape) */
.dim-switcher {
  display: inline-flex;
  align-items: center;
  background: #14101c;
  border: 2px solid var(--border-dark);
  padding: 1px;
  gap: 2px;
}
.dim-btn {
  padding: 4px 8px;
  font-size: 10.5px;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}
.dim-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.dim-btn.dim-world.active {
  background: #1f5c35; color: #d8ffea; border-color: rgba(82, 227, 125, 0.55);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.2), 0 0 8px rgba(82, 227, 125, 0.25);
}
.dim-btn.dim-nether.active {
  background: #7c2418; color: #ffe0d1; border-color: rgba(255, 119, 85, 0.65);
  box-shadow: inset 1px 1px 0 rgba(255, 210, 180, 0.25), 0 0 10px rgba(255, 107, 74, 0.35);
}
.dim-btn.dim-end.active {
  background: #4e227a; color: #f2deff; border-color: rgba(207, 130, 255, 0.65);
  box-shadow: inset 1px 1px 0 rgba(235, 200, 255, 0.25), 0 0 10px rgba(192, 132, 252, 0.35);
}
.dim-btn .dim-pill-cnt {
  display: inline-block; margin-left: 3px; padding: 0 4px; font-size: 9px;
  background: rgba(0, 0, 0, 0.45); border-radius: 2px; color: #fff;
}

.realm-explorer-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 7px 10px;
  background: rgba(22, 14, 28, 0.92);
  border: 2px solid var(--border-dark);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  z-index: 14;
}
.realm-explorer-bar.is-nether {
  background: linear-gradient(135deg, rgba(48, 16, 14, 0.93), rgba(26, 12, 16, 0.93));
  border-color: rgba(255, 119, 85, 0.6);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.65), 0 0 18px rgba(255, 107, 74, 0.22);
}
.realm-explorer-bar.is-end {
  background: linear-gradient(135deg, rgba(30, 14, 52, 0.93), rgba(16, 10, 34, 0.93));
  border-color: rgba(207, 130, 255, 0.6);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.65), 0 0 18px rgba(192, 132, 252, 0.24);
}
.realm-exp-badge {
  font: 800 10.5px/1.2 var(--mc-font);
  letter-spacing: 0.04em;
  color: #fff3d6;
  white-space: nowrap;
}
.realm-exp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
}
.realm-exp-chip {
  padding: 3px 7px;
  font: 700 10.5px/1.2 var(--mc-font);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
}
.realm-exp-chip:hover { background: rgba(255, 255, 255, 0.18); border-color: var(--gold); }

.realms-atlas-grid { display: flex; flex-direction: column; gap: 7px; }
.dim-portal-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--dim-accent, var(--emerald));
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dim-portal-card.dim-world { background: linear-gradient(145deg, #162820 0%, #161522 100%); }
.dim-portal-card.dim-world_the_nether { background: linear-gradient(145deg, #321614 0%, #1b1218 100%); }
.dim-portal-card.dim-world_the_end { background: linear-gradient(145deg, #241438 0%, #141022 100%); }
.dim-portal-card.is-viewing { outline: 2px solid var(--dim-accent, var(--gold)); outline-offset: -2px; }
.dim-portal-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.dim-portal-title { font: 800 12.5px/1.2 var(--mc-font); color: #fff; }
.dim-portal-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 10.5px; }
.dim-biome-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.dim-biome-chip {
  font-size: 9.5px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e6ddf2;
}

.realm-landmarks-list { display: flex; flex-direction: column; gap: 5px; }
.landmark-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-left: 3px solid var(--lm-col, var(--gold));
}
.landmark-card:hover { background: #231d31; }
.landmark-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.landmark-top { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.landmark-coords { font-size: 10.5px; color: var(--aqua); }

.dragon-squad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.squad-card {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-left: 3px solid var(--nether);
  cursor: pointer;
}
.squad-card:hover { background: #241d32; border-color: rgba(255, 119, 85, 0.55); }
.squad-avatar { width: 28px; height: 28px; border: 2px solid var(--border-dark); flex-shrink: 0; }
.squad-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.squad-name { font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Ideas #4-#10: Transit, Companions, Wall Art Gallery, Cozy Furniture, Marriages & BlueMap POI Layer */
.badge-pet { background: #26223f; color: #ffb7e0; border: 1px solid rgba(255, 158, 199, 0.35); }
.badge-family { background: #3e1d30; color: #ffafd0; border: 1px solid rgba(255, 130, 185, 0.42); }
.badge-aqua { background: #143344; color: var(--aqua); }
.badge-sakura { background: #462038; color: var(--sakura); }

.transit-list { display: flex; flex-direction: column; gap: 6px; }
.transit-card {
  background: linear-gradient(145deg, #1d2434 0%, #151422 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--tr-col, var(--aqua));
  padding: 8px 9px;
  display: flex; flex-direction: column; gap: 5px;
}
.transit-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.transit-stops { display: flex; flex-wrap: wrap; gap: 4px; }
.transit-stop-chip {
  font-size: 9.5px; padding: 2px 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e4def0; cursor: pointer;
}
.transit-stop-chip:hover { border-color: var(--gold); color: #fff; }

.poi-datapack-strip { display: flex; flex-wrap: wrap; gap: 4px; }
.poi-layer-toggles {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  padding: 6px 8px;
  background: var(--slot-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10.5px;
}
.poi-toggle { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #e8e2f5; }
.poi-toggle input { accent-color: var(--sakura); }

.townlife-block { display: flex; flex-direction: column; gap: 7px; }
.townlife-block.hidden { display: none; }

.family-card {
  background: linear-gradient(145deg, #321b2c 0%, #191423 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--sakura);
  padding: 8px 9px;
  display: flex; flex-direction: column; gap: 4px;
}
.family-vow { font-style: italic; color: #ffd9ec; font-size: 11px; }

.companions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.companion-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-top: 3px solid var(--sakura);
  padding: 7px 8px;
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer;
}
.companion-card:hover { background: #241e32; border-color: rgba(255, 158, 199, 0.55); }
.companion-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 11.5px; font-weight: 700; color: #fff; }
.companion-bar { height: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.companion-bar-fill { height: 100%; background: linear-gradient(90deg, var(--sakura), var(--gold)); }

.gallery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.art-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  padding: 6px;
  display: flex; flex-direction: column; gap: 5px;
  cursor: pointer;
}
.art-card:hover { background: #241d31; border-color: var(--gold); }
.art-frame {
  width: 100%; aspect-ratio: 1 / 1;
  border: 3px solid #6b4728;
  box-shadow: inset 0 0 0 2px #d9a75a;
  background: #1b1628;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; position: relative; padding: 6px; text-align: center;
}
.art-frame img { width: 100%; height: 100%; object-fit: cover; display: block; image-rendering: pixelated; }
.art-frame.theme-gazette { background: linear-gradient(160deg, #efe1be, #d7c396); color: #2b1d10; }
.art-frame.theme-dragon { background: linear-gradient(145deg, #2d124a, #5c1c38); color: #ffca8a; }
.art-frame.theme-sakura { background: linear-gradient(145deg, #33193b, #61294f); color: #ffd4ea; }
.art-title { font-size: 10.5px; font-weight: 700; color: #fff; line-height: 1.25; }

.furniture-quick-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.furniture-catalog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.furn-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-left: 3px solid var(--gold);
  padding: 6px 7px;
  display: flex; flex-direction: column; gap: 3px;
}
.furn-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 10.5px; font-weight: 700; color: #fff; }

/* Section B (#11-#19): Civic Hub, Schedules, Megaprojects, Market, Caravans, Court, Raids, Library/Museum, Dialogues & Emotes */
.stat-schedule {
  background: linear-gradient(135deg, #2b243f, #1e1930);
  color: #ffe299;
  border-color: rgba(255, 202, 87, 0.45);
  cursor: pointer;
}
.stat-schedule.is-tavern {
  background: linear-gradient(135deg, #52291c, #331914);
  color: #ffd37a;
  border-color: #ffb347;
  box-shadow: 0 0 10px rgba(255, 179, 71, 0.35);
}
.badge-emote { background: #3b2919; color: #ffe28a; border: 1px solid rgba(255, 202, 87, 0.42); }

.civic-block { display: flex; flex-direction: column; gap: 7px; }
.civic-block.hidden { display: none; }

.sched-hero {
  background: linear-gradient(145deg, #2a2138 0%, #171525 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--gold);
  padding: 9px 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.sched-hero.is-tavern {
  background: linear-gradient(145deg, #3c1f18 0%, #1d141c 100%);
  border-left-color: #ff9c47;
}
.sched-phases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.sched-pill {
  font-size: 9.5px; text-align: center; padding: 3px 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #b7afc8;
}
.sched-pill.active {
  background: rgba(255, 202, 87, 0.18);
  border-color: var(--gold);
  color: #fff6d6;
  font-weight: 700;
}

.mega-card {
  background: linear-gradient(145deg, #1b2824 0%, #151422 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--emerald);
  padding: 8px 9px;
  display: flex; flex-direction: column; gap: 5px;
}
.mega-card.is-voting { border-left-color: var(--gold); background: linear-gradient(145deg, #272219 0%, #151422 100%); }
.mega-card.is-completed { border-left-color: var(--aqua); }

.market-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stall-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-top: 3px solid var(--gold);
  padding: 6px 7px;
  display: flex; flex-direction: column; gap: 3px;
}
.stall-price { font: 800 11.5px/1.1 var(--mc-font); color: var(--emerald); }
.price-up { color: #ff8a6b; }
.price-down { color: #63e686; }
.market-tape {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 10px; color: #cbc2dc;
}
.market-tape-row {
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--gold);
}

.caravan-card {
  background: linear-gradient(145deg, #252019 0%, #161422 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid #f5b342;
  padding: 7px 9px;
  display: flex; flex-direction: column; gap: 4px;
}

.court-card {
  background: linear-gradient(145deg, #2e1b28 0%, #171422 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--sakura);
  padding: 8px 9px;
  display: flex; flex-direction: column; gap: 5px;
}
.court-card.settled { border-left-color: var(--aqua); }
.verdict-track {
  display: flex; height: 7px; overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.verdict-guilty { background: #ff6b6b; height: 100%; }
.verdict-innocent { background: #52e37d; height: 100%; }
.court-stmt { font-size: 10px; color: #e8dcf5; padding-left: 6px; border-left: 2px solid rgba(255, 158, 199, 0.45); }

.squad-detail-card {
  background: linear-gradient(145deg, #2b1822 0%, #161422 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--nether);
  padding: 8px 9px;
  display: flex; flex-direction: column; gap: 5px;
}
.squad-members-row { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.role-chip {
  font-size: 10px; padding: 4px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex; justify-content: space-between; align-items: center; gap: 4px;
}

.museum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.artifact-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  padding: 6px 7px;
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0.62;
}
.artifact-card.unlocked {
  opacity: 1;
  border-color: rgba(255, 202, 87, 0.55);
  background: linear-gradient(145deg, #292218 0%, #181626 100%);
}

.book-card {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-left: 3px solid var(--aqua);
  padding: 7px 9px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  cursor: pointer;
}
.book-card:hover { background: #241f34; border-color: var(--gold); }
.book-reader-box {
  background: linear-gradient(160deg, #f1e3c4 0%, #decba2 100%);
  color: #2b1d12;
  border: 3px solid #6b4728;
  box-shadow: inset 0 0 0 2px #c89a56;
  padding: 10px;
  display: flex; flex-direction: column; gap: 7px;
}
.book-reader-box.hidden { display: none; }
.book-reader-box .muted { color: #5b432b; }
.book-page-body {
  white-space: pre-wrap;
  font-size: 11.5px;
  line-height: 1.48;
  min-height: 74px;
  padding: 7px 8px;
  background: rgba(255, 250, 238, 0.55);
  border: 1px solid rgba(107, 71, 40, 0.25);
}

.conv-card {
  background: linear-gradient(145deg, #1d2236 0%, #151422 100%);
  border: 2px solid var(--border-dark);
  border-left: 4px solid var(--aqua);
  padding: 8px 9px;
  display: flex; flex-direction: column; gap: 5px;
}
.conv-turn {
  font-size: 11px; line-height: 1.35;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.045);
  border-radius: 3px;
}

/* Section C (#20-#24): 3D Layer Toggles, Map-Pick Banner & Interactive Sky Patron Panel */
.scene-layers-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 5px 7px;
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
}
.layer-chip {
  padding: 2px 6px;
  font: 700 9.5px/1.2 var(--mc-font);
  background: #1b1726;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
}
.layer-chip.active {
  background: #27374b;
  color: #dff5ff;
  border-color: var(--aqua);
}
.layer-chip:hover { color: #fff; border-color: var(--gold); }

.patron-drawer {
  border: 2px solid var(--border-dark);
  border-left: 3px solid var(--gold);
  background: #1b1628;
}
.patron-controls, .patron-rumor-form { display: flex; flex-direction: column; gap: 5px; }
.patron-controls.hidden { display: none; }
#patronEventSelect {
  flex: 1; min-width: 0;
  background: #100d17; color: var(--text);
  border: 2px solid var(--border-dark); padding: 4px 6px;
  font: 11px ui-monospace, monospace;
}
.patron-coord-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
}
.patron-coord-row label { display: inline-flex; align-items: center; gap: 3px; }
.patron-coord-row input {
  width: 66px; padding: 3px 5px;
  background: #100d17; color: #fff;
  border: 2px solid var(--border-dark);
  font: 11px ui-monospace, monospace;
}
.patron-rumor-form input {
  width: 100%; box-sizing: border-box;
  background: #100d17; color: #f7f0ff;
  border: 2px solid var(--border-dark); padding: 5px 7px;
  font: 11px ui-monospace, monospace;
}
#patronPickMapBtn.is-armed {
  background: #8f6218; color: #fff8dc; border-color: var(--gold);
}
.map-pick-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 25; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(34, 24, 14, 0.94);
  border: 2px solid var(--gold);
  color: #fff2c6; font: 700 11px/1.3 var(--mc-font);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}
.map-pick-banner.hidden { display: none; }
.feed-item.kind-patron {
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(255, 202, 87, 0.16), rgba(23, 20, 31, 0.92));
}

@media (prefers-reduced-motion: reduce) {
  .narrator-lower, .narrator-avatar-wrap, .dot-hearth, .cozy-pill-music.is-playing .cozy-eq i, .mc-btn-music.is-playing .cozy-eq i { animation: none !important; }
  .cozy-word, .narrator-bullet { opacity: 1; transform: none; animation: none !important; }
}

@media (max-width: 960px) {
  .narrator-overlay { padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom)) 10px; }
  .narrator-headline { font-size: 15.5px; }
  .narrator-text { font-size: 12.5px; }
  .narrator-avatar-slot { width: 46px; height: 46px; }
  .narrator-thought, .narrator-track-pill { display: none; }
  .cozy-pill { padding: 6px 10px; font-size: 11px; }
  .realm-explorer-bar {
    left: 6px;
    right: 6px;
    bottom: 6px;
    padding: 4px 6px;
    gap: 5px;
    flex-wrap: nowrap;
  }
  .realm-exp-badge { display: none; }
  .realm-exp-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .realm-exp-chips::-webkit-scrollbar { display: none; }
  .realm-exp-chip { white-space: nowrap; flex: 0 0 auto; padding: 3px 6px; font-size: 10px; }
  #realmExpHomeBtn { flex: 0 0 auto; white-space: nowrap; }
  .app.cinema-mode { grid-template-rows: 1fr 0; }
  .app.cinema-mode:not(.collapsed) { grid-template-rows: 52dvh 1fr; }
  .pov-quest-panel { width: calc(100% - 24px); max-height: 42%; top: 52px; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto 46dvh 1fr; }
  .app.collapsed { grid-template-rows: auto 1fr 0; }
  .sidebar { border-left: 0; border-top: 3px solid var(--border-dark); padding-bottom: env(safe-area-inset-bottom); }
  .pov-quote { max-width: 240px; }
}
