/* ==========================================================================
   After Hours — visual system v3
   Loaded last: it re-skins the shared parts and defines the new page shells.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --ink: #101a2b;
  --ink-2: #33415a;
  --ink-3: #66748c;
  --muted: #8b97ab;

  --paper: #ffffff;
  --canvas: #eef2fb;
  --line: rgba(24, 40, 70, .10);
  --line-2: rgba(24, 40, 70, .18);
  --tint: rgba(255, 255, 255, .72);

  --rose: #ef5f86;
  --sun: #f0a63c;
  --mint: #2fb7a6;
  --sky: #4b8bea;

  --accent: #4b62d8;
  --accent-ink: #2b3894;
  --accent-soft: #e9ecfe;
  --accent-wash: #f6f7ff;
  --accent-2: #8f7cf0;
  --accent-glow: rgba(75, 98, 216, .35);

  --night: #0e1526;
  --night-2: #16203a;
  --night-3: #1e2b48;

  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 38px;

  --sh-1: 0 1px 2px rgba(16, 26, 43, .05), 0 6px 16px -10px rgba(16, 26, 43, .18);
  --sh-2: 0 2px 6px rgba(16, 26, 43, .06), 0 18px 40px -22px rgba(16, 26, 43, .34);
  --sh-3: 0 8px 20px rgba(16, 26, 43, .10), 0 40px 90px -40px rgba(16, 26, 43, .48);

  --ease: cubic-bezier(.22, .68, .36, 1);
  --ease-out: cubic-bezier(.16, .84, .3, 1);
  --fast: .16s var(--ease);
  --base: .28s var(--ease);
  --slow: .55s var(--ease-out);

  --font: "Hiragino Sans", "PingFang SC", "Noto Sans SC", "Yu Gothic UI", system-ui, -apple-system, sans-serif;
  --font-display: "Hiragino Sans", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

/* unit palettes are injected from data/group_themes.json; these are fallbacks */
[data-unit="ln"] { --accent: #4b5fe0; --accent-2: #7f8bff; --accent-ink: #2c3596; --accent-soft: #e6e9ff; --accent-glow: rgba(75, 95, 224, .38); }
[data-unit="mmj"] { --accent: #6cb63f; --accent-2: #b6e56a; --accent-ink: #3a6f17; --accent-soft: #ecf8d9; --accent-glow: rgba(108, 182, 63, .38); }
[data-unit="vbs"] { --accent: #e23870; --accent-2: #ff7fa8; --accent-ink: #a01848; --accent-soft: #ffe3ec; --accent-glow: rgba(226, 56, 112, .38); }
[data-unit="wxs"] { --accent: #ef9315; --accent-2: #ffc95c; --accent-ink: #91500b; --accent-soft: #fff1d6; --accent-glow: rgba(239, 147, 21, .4); }
[data-unit="n25"] { --accent: #8a63c4; --accent-2: #bd9af0; --accent-ink: #5b3a8f; --accent-soft: #efe6fb; --accent-glow: rgba(138, 99, 196, .38); }
[data-unit="vs"] { --accent: #1fa8a0; --accent-2: #66e0d4; --accent-ink: #0f6d68; --accent-soft: #ddf8f3; --accent-glow: rgba(31, 168, 160, .38); }

/* ---------- page canvas ---------- */
body {
  color: var(--ink);
  background-color: #eaeffa;
  background-image:
    radial-gradient(1200px 700px at 6% -8%, #ffffff 0%, transparent 58%),
    radial-gradient(900px 600px at 98% 0%, color-mix(in srgb, var(--accent-soft) 80%, #ffffff) 0%, transparent 62%),
    radial-gradient(760px 520px at 50% 108%, color-mix(in srgb, var(--accent-soft) 62%, #f5f8ff) 0%, transparent 66%),
    linear-gradient(180deg, #f3f6fd 0%, #eef2fb 46%, #e9eefb 100%);
  background-attachment: fixed;
  transition: background-color .5s var(--ease);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  background-image:
    radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--accent) 12%, transparent) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 12%, color-mix(in srgb, var(--accent) 10%, transparent) 0 1.5px, transparent 3px),
    radial-gradient(circle at 88% 64%, color-mix(in srgb, var(--accent) 10%, transparent) 0 2px, transparent 3px);
  background-size: 420px 420px, 320px 320px, 520px 520px;
  mix-blend-mode: multiply;
}
.app { position: relative; z-index: 1; }

/* ---------- top bar ---------- */
.topbar {
  background: linear-gradient(180deg, rgba(14, 21, 38, .96), rgba(18, 27, 48, .92)) !important;
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
  box-shadow: 0 18px 40px -30px rgba(4, 10, 24, .9);
  color: #eef3ff;
  padding-top: 10px;
  padding-bottom: 10px;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 70%, transparent), transparent);
  opacity: .8;
}
.brand { color: #f4f8ff !important; }
.brand-mark {
  background: linear-gradient(150deg, var(--accent), var(--accent-2)) !important;
  color: #fff !important;
  box-shadow: 0 8px 22px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.4);
}
.brand-text b { color: #fff; }
.brand-text i { color: rgba(226, 235, 255, .62); }

/* ---------- nav ---------- */
.tabs { gap: 6px !important; }
.tabs button {
  color: rgba(226, 235, 255, .72) !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  border-radius: 999px !important;
  padding: 9px 15px !important;
  font-weight: 600;
  letter-spacing: .01em;
  transition: color var(--fast), background var(--fast), transform var(--fast), box-shadow var(--base);
}
.tabs button i { opacity: .85; font-style: normal; }
.tabs button:hover { color: #fff !important; background: rgba(255, 255, 255, .1) !important; transform: translateY(-1px); }
.tabs button.active {
  color: #fff !important;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent-2) 72%, var(--accent))) !important;
  box-shadow: 0 10px 26px -12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .35) !important;
}
.topbar-side .ghost-btn, .topbar-side .icon-btn, .now-chip {
  color: rgba(232, 240, 255, .86) !important;
  border-color: rgba(255, 255, 255, .16) !important;
  background: rgba(255, 255, 255, .08) !important;
}
.topbar-side .ghost-btn:hover, .topbar-side .icon-btn:hover, .now-chip:hover { background: rgba(255, 255, 255, .18) !important; color: #fff !important; }
.now-chip b { color: #fff; }
.now-chip span { color: rgba(220, 232, 255, .7); }

/* ---------- buttons ---------- */
button { -webkit-tap-highlight-color: transparent; }
.primary, button.primary {
  position: relative;
  border: 0 !important;
  color: #fff !important;
  font-weight: 700;
  letter-spacing: .01em;
  border-radius: 999px !important;
  padding: 11px 22px !important;
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent-2) 78%, var(--accent)) 100%) !important;
  box-shadow: 0 12px 26px -14px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .34);
  overflow: hidden;
  transition: transform var(--fast), box-shadow var(--base), filter var(--fast);
}
.primary::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.42) 46%, transparent 62%);
  transform: translateX(-120%);
  transition: transform .6s var(--ease-out);
}
.primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -16px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.4); }
.primary:hover::after { transform: translateX(120%); }
.primary:active { transform: translateY(0) scale(.98); }

.soft, button.soft {
  border-radius: 999px !important;
  border: 1px solid var(--line) !important;
  background: rgba(255, 255, 255, .78) !important;
  color: var(--ink-2) !important;
  font-weight: 600;
  padding: 10px 18px !important;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), box-shadow var(--fast), color var(--fast);
}
.soft:hover { background: #fff !important; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)) !important; color: var(--accent-ink) !important; transform: translateY(-1px); box-shadow: var(--sh-1); }
.soft:active { transform: translateY(0) scale(.985); }
.glass-button, .ghost-btn {
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, .34) !important;
  background: rgba(255, 255, 255, .14) !important;
  color: #fff !important;
  backdrop-filter: blur(10px);
  font-weight: 600;
  transition: background var(--fast), transform var(--fast), border-color var(--fast);
}
.glass-button:hover, .ghost-btn:hover { background: rgba(255, 255, 255, .26) !important; transform: translateY(-1px); }

.chip, .tag {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px;
  font-size: 12px; font-weight: 650; letter-spacing: .02em;
  padding: 5px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .8);
  color: var(--ink-2);
}
.tag { background: color-mix(in srgb, var(--accent-soft) 62%, #fff); color: var(--accent-ink); border-color: transparent; }

/* ---------- page heading ---------- */
.page-title { margin: 2px 0 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title h1, .page-title h2 { font-family: var(--font-display); letter-spacing: -.025em; color: var(--ink); }
.page-title h1 { font-size: clamp(26px, 3vw, 36px); }
.page-title p { color: var(--ink-3); }
.page-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .34em;
  color: color-mix(in srgb, var(--accent) 68%, var(--ink-3));
  margin-bottom: 5px;
  text-transform: uppercase;
}
/* the previous skin injected its own eyebrow / bullet through pseudo elements */
.page-title h1::before,
.page-title h2::before { content: none !important; display: none !important; }

/* ==========================================================================
   Character art system
   ========================================================================== */
.char-figure {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  flex: none;
  pointer-events: none;
  --char-accent: var(--accent);
}
.char-cast {
  position: absolute;
  inset: 0;
  pointer-events: none;
  filter: drop-shadow(0 14px 16px rgba(12, 20, 36, .22));
  transition: filter var(--base);
}
.char-body { position: absolute; pointer-events: none; }
.char-hit { position: absolute; inset: 0; pointer-events: auto; }
.char-body > .char-image {
  position: absolute;
  max-width: none;
  transform: none;
  margin: 0;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.char-figure:not(.art-ready) .char-image { opacity: 0; }
.char-figure.art-ready .char-image { opacity: 1; transition: opacity .3s var(--ease); }
.char-figure.is-missing { opacity: .5; }

.character-stage { display: block !important; padding: 0 !important; pointer-events: none; position: relative; }
.character-stage > .character-slot,
.character-stage > .character-slot-plain {
  position: absolute !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none;
  display: block;
  pointer-events: none;
  overflow: visible;
  transition: filter var(--base), opacity var(--base);
}
.character-slot > .char-figure { width: 100%; height: 100%; }
.character-slot > span {
  position: absolute !important;
  left: 50% !important;
  bottom: -6px !important;
  transform: translateX(-50%);
  margin: 0 !important;
  white-space: nowrap;
  pointer-events: none;
}

/* soft contact shadow, sized to the drawn art */
.character-stage[data-shadow="1"] .character-slot::before,
.stage-cast .character-slot::before {
  content: "";
  position: absolute;
  left: 50%; bottom: -10px;
  width: 72%; height: 20px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(8, 14, 26, .42) 0%, rgba(8, 14, 26, .16) 46%, transparent 72%);
  filter: blur(3px);
  opacity: .85;
  pointer-events: none;
  z-index: -1;
}
.stage-cast[data-unit] .character-slot::before { background: radial-gradient(ellipse at center, rgba(8, 14, 26, .5) 0%, rgba(8, 14, 26, .18) 46%, transparent 74%); }

/* interaction states */
.character-slot { cursor: pointer; }
.character-slot:hover .char-cast,
.character-slot:focus-visible .char-cast {
  filter: brightness(1.06) drop-shadow(0 0 12px rgba(255, 255, 255, .55)) drop-shadow(0 16px 18px rgba(12, 20, 36, .26));
}
.character-slot.speaking .char-cast,
.character-slot.is-focus .char-cast,
.character-slot[aria-pressed="true"] .char-cast {
  filter: brightness(1.09) saturate(1.06) drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 55%, transparent)) drop-shadow(0 18px 20px rgba(12, 20, 36, .3));
}
.character-slot.is-dim { filter: brightness(.82) saturate(.9); opacity: .92; }
.character-slot { transition: transform .32s var(--ease-out), filter var(--base); }
.character-slot:hover { transform: translateY(-4px); }
.character-slot.speaking { transform: translateY(-4px); }

/* a ring marking the selected actor */
.character-slot.is-focus::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -16px;
  width: 46%; height: 12px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--accent) 90%, #fff) 0%, transparent 70%);
  filter: blur(4px);
  opacity: .9;
  animation: focus-pulse 2.4s var(--ease) infinite;
}
@keyframes focus-pulse { 0%, 100% { opacity: .55; transform: translateX(-50%) scaleX(.86); } 50% { opacity: 1; transform: translateX(-50%) scaleX(1.06); } }

.focus-figure, .profile-art, .cast-figure { position: relative; }
.cast-figure .char-figure, .profile-art .char-figure, .focus-figure .char-figure { width: 100%; height: 100%; margin: 0; }

/* avatars */
.avatar-img { border-radius: 50%; object-fit: cover; object-position: 50% 16%; background: var(--accent-soft); }

/* ==========================================================================
   Home
   ========================================================================== */
.ah-home { display: flex; flex-direction: column; gap: 26px; }

.ah-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  min-height: clamp(420px, 56vh, 560px);
  border-radius: var(--r-xl);
  overflow: hidden;
  isolation: isolate;
  background: var(--night);
  box-shadow: 0 40px 90px -50px rgba(8, 14, 30, .8), 0 2px 0 rgba(255, 255, 255, .5) inset;
}
.ah-hero::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 5;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), inset 0 -120px 120px -80px rgba(0, 0, 0, .6);
}
.ah-hero-art { position: absolute; inset: 0; z-index: 0; }
.ah-hero-art img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.04) translate3d(var(--px, 0), var(--py, 0), 0);
  transition: transform 1.2s var(--ease-out);
  will-change: transform;
}
.ah-hero:hover .ah-hero-art img { transform: scale(1.07) translate3d(var(--px, 0), var(--py, 0), 0); }
.ah-hero-art::before {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(100deg, rgba(9, 15, 30, .94) 0%, rgba(9, 15, 30, .78) 34%, rgba(9, 15, 30, .26) 62%, rgba(9, 15, 30, .08) 100%),
    linear-gradient(0deg, rgba(9, 15, 30, .88) 0%, rgba(9, 15, 30, .1) 44%, transparent 72%),
    radial-gradient(120% 90% at 84% 30%, transparent 40%, rgba(6, 12, 26, .4) 100%);
}
.ah-hero-art::after {
  content: "";
  position: absolute; inset: 0; z-index: 2;
  background:
    radial-gradient(60% 50% at 76% 24%, color-mix(in srgb, var(--accent) 46%, transparent) 0%, transparent 62%),
    radial-gradient(40% 40% at 20% 80%, color-mix(in srgb, var(--accent-2) 26%, transparent) 0%, transparent 66%);
  mix-blend-mode: screen;
  opacity: .75;
}
.ah-hero-copy {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
  padding: clamp(24px, 3.2vw, 46px);
  max-width: 620px;
  color: #fff;
}
.ah-eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: .42em;
  color: color-mix(in srgb, var(--accent-2) 74%, #ffffff);
  text-transform: uppercase;
  display: flex; align-items: center; gap: 12px;
}
.ah-eyebrow::before { content: ""; width: 30px; height: 1px; background: currentColor; opacity: .8; }
.ah-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.ah-hero-meta .chip {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .26);
  color: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
}
.ah-hero-title {
  font-size: clamp(30px, 4.4vw, 56px);
  line-height: 1.1;
  letter-spacing: -.03em;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.ah-hero-title em {
  font-style: normal;
  background: linear-gradient(100deg, #fff 10%, color-mix(in srgb, var(--accent-2) 90%, #fff) 60%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ah-hero-text { color: rgba(236, 242, 255, .82); font-size: 14.5px; line-height: 1.8; max-width: 40em; }
.ah-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.ah-hero-actions .primary { padding: 13px 26px !important; }
.ah-hero-actions .glass-button { padding: 13px 22px !important; }

.ah-hero-cast { position: absolute; right: 0; left: 34%; top: 6%; bottom: 4%; z-index: 3; }
.ah-hero-cast .character-slot > span {
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(10, 16, 30, .5);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  padding: 3px 10px;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity var(--fast);
}
.ah-hero-cast .character-slot:hover > span,
.ah-hero-cast .character-slot:focus-visible > span { opacity: 1; }

/* floating ornaments */
.ah-hero-orbs { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.ah-hero-orbs i {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .9), transparent 70%);
  animation: orb-float 9s var(--ease) infinite;
  opacity: .5;
}
@keyframes orb-float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: .35; }
  50% { transform: translate3d(12px, -26px, 0) scale(1.15); opacity: .8; }
}

/* --- home rail (focus + agenda) --- */
.ah-rail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 22px; }

.ah-focus {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  min-height: 330px;
  padding: 26px 26px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46%;
  gap: 8px;
  color: #fff;
  isolation: isolate;
  background:
    radial-gradient(120% 100% at 90% 10%, color-mix(in srgb, var(--accent) 78%, #ffffff) 0%, transparent 58%),
    linear-gradient(150deg, color-mix(in srgb, var(--accent) 92%, #101a2b), color-mix(in srgb, var(--accent-2) 52%, #101a2b) 100%);
  box-shadow: var(--sh-2);
}
.ah-focus::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.35) 0 1.5px, transparent 2px),
    radial-gradient(circle at 68% 76%, rgba(255,255,255,.28) 0 1.5px, transparent 2px);
  background-size: 210px 210px, 260px 260px;
  opacity: .5;
  mix-blend-mode: overlay;
}
.ah-focus-copy { position: relative; z-index: 2; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.ah-focus-unit { font-size: 11px; letter-spacing: .3em; font-weight: 800; color: rgba(255, 255, 255, .8); display: flex; align-items: center; gap: 8px; }
.ah-focus-unit i { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px #fff; }
.ah-focus h3 { font-size: clamp(28px, 2.6vw, 38px); letter-spacing: -.02em; color: #fff; line-height: 1.15; }
.ah-focus .ah-focus-where { font-size: 13px; color: rgba(255, 255, 255, .78); }
.ah-focus-figure { position: relative; z-index: 1; height: 100%; min-height: 250px; }
.ah-focus-figure .char-figure { height: 100%; }
.ah-focus-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ah-focus-actions .primary { background: #fff !important; color: var(--accent-ink) !important; box-shadow: 0 12px 24px -14px rgba(0, 0, 0, .6); }
.ah-focus-actions .soft { background: rgba(255, 255, 255, .16) !important; border-color: rgba(255, 255, 255, .34) !important; color: #fff !important; }
.ah-focus-actions .soft:hover { background: rgba(255, 255, 255, .26) !important; color: #fff !important; }

.ah-agenda {
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--sh-2);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ah-agenda h3 { font-size: 16px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.ah-agenda h3::before { content: ""; width: 18px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.ah-agenda-list { display: flex; flex-direction: column; gap: 6px; }
.ah-agenda-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.ah-agenda-row:hover { background: color-mix(in srgb, var(--accent-soft) 60%, #fff); border-color: color-mix(in srgb, var(--accent) 24%, transparent); transform: translateX(3px); }
.ah-agenda-row b { font-size: 13.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ah-agenda-row .unit-dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent); }
.ah-agenda-row small { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.avatar-row { display: flex; }
.avatar-row .avatar-img, .avatar-row img { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; margin-left: -8px; box-shadow: 0 2px 6px rgba(16, 26, 43, .16); }
.avatar-row > :first-child { margin-left: 0; }
.avatar-row .more { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 10.5px; font-weight: 700; margin-left: -8px; border: 2px solid #fff; }

/* --- wallpaper wall --- */
.ah-wall { position: relative; }
.ah-wall-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.ah-wall-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 164px;
  gap: 14px;
}
.ah-wall-tile {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 0;
  padding: 0;
  cursor: pointer;
  isolation: isolate;
  box-shadow: var(--sh-1);
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out), flex-grow .35s;
}
.ah-wall-tile:nth-child(1),
.ah-wall-tile:nth-child(6) { grid-row: span 1; }
.ah-wall-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out); }
.ah-wall-tile::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(10, 16, 30, .82) 0%, rgba(10, 16, 30, .18) 46%, transparent 78%),
              radial-gradient(80% 60% at 70% 10%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%);
  opacity: .9;
  transition: opacity var(--base);
}
.ah-wall-tile:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--sh-2); }
.ah-wall-tile:hover img { transform: scale(1.07); }
.ah-wall-copy { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 2; text-align: left; color: #fff; }
.ah-wall-copy b { display: block; font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.ah-wall-copy small { font-size: 11px; color: rgba(255, 255, 255, .74); }
.ah-wall-tile .ah-wall-members { position: absolute; top: 12px; left: 14px; z-index: 2; display: flex; }
.ah-wall-tile .ah-wall-members img { position: relative; inset: auto; width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); margin-left: -7px; }
.ah-wall-tile .ah-wall-members img:first-child { margin-left: 0; }

/* --- places --- */
.ah-places { display: flex; flex-direction: column; gap: 14px; }
.ah-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ah-section-head h2 { font-size: clamp(19px, 1.9vw, 24px); letter-spacing: -.02em; }
.ah-section-head p { color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: rgba(255, 255, 255, .7); border: 1px solid var(--line); }
.segmented button { border: 0 !important; background: transparent !important; border-radius: 999px !important; padding: 8px 16px !important; font-size: 13px; color: var(--ink-3) !important; font-weight: 650; }
.segmented button.active { background: var(--ink) !important; color: #fff !important; box-shadow: var(--sh-1); }

.ah-place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.ah-place {
  position: relative;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  border-radius: 24px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  isolation: isolate;
  box-shadow: var(--sh-1);
  transition: transform .38s var(--ease-out), box-shadow .38s var(--ease-out);
}
.ah-place > .ah-place-art { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.ah-place > .ah-place-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out); }
.ah-place.missing-art > .ah-place-art { background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 40%, #1b2740), #0f1728); }
.ah-place::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(9, 15, 28, .9) 0%, rgba(9, 15, 28, .3) 42%, rgba(9, 15, 28, .04) 72%),
              linear-gradient(90deg, color-mix(in srgb, var(--accent) 34%, transparent), transparent 50%);
}
.ah-place:hover { transform: translateY(-5px); box-shadow: var(--sh-2); }
.ah-place:hover > .ah-place-art img { transform: scale(1.06); }
.ah-place-copy { position: absolute; left: 16px; right: 14px; bottom: 14px; z-index: 2; color: #fff; }
.ah-place-copy h4 { font-size: 16px; letter-spacing: -.01em; }
.ah-place-copy .ah-place-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 11.5px; color: rgba(255, 255, 255, .8); }
.ah-place-tag {
  position: absolute; top: 12px; left: 14px; z-index: 2;
  font-size: 10.5px; font-weight: 750; letter-spacing: .08em;
  padding: 4px 10px; border-radius: 999px;
  color: #fff; background: rgba(9, 15, 28, .46); border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(6px);
}
.ah-place-tag.here { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; box-shadow: 0 8px 18px -10px var(--accent-glow); }

/* ==========================================================================
   Cast index
   ========================================================================== */
.ah-cast { display: flex; flex-direction: column; gap: 18px; }
.ah-toolbar {
  position: sticky; top: 68px; z-index: 20;
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .92);
  box-shadow: var(--sh-1);
}
.ah-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.ah-chips::-webkit-scrollbar { display: none; }
.ah-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .8);
  color: var(--ink-2);
  font-size: 12.5px; font-weight: 650; white-space: nowrap;
  cursor: pointer;
  transition: all var(--fast);
  --chip: var(--ink-3);
}
.ah-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--chip); box-shadow: 0 0 0 3px color-mix(in srgb, var(--chip) 16%, transparent); }
.ah-chip:hover { border-color: color-mix(in srgb, var(--chip) 44%, var(--line)); transform: translateY(-1px); }
.ah-chip.active { background: var(--chip); border-color: transparent; color: #fff; box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--chip) 80%, transparent); }
.ah-chip.active i { background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .3); }
.ah-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ah-search { position: relative; flex: 1 1 220px; }
.ah-search input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.ah-search input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.ah-search::before { content: "⌕"; position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--muted); }
.ah-select {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px; color: var(--ink-2); font-weight: 600;
  cursor: pointer;
}

.ah-group-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  min-height: 168px;
  display: flex; align-items: flex-end;
  padding: 22px 26px;
  isolation: isolate;
  box-shadow: var(--sh-2);
}
.ah-group-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.ah-group-banner::after {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(96deg, color-mix(in srgb, var(--accent) 88%, #0b1220) 0%, color-mix(in srgb, var(--accent) 46%, transparent) 54%, transparent 84%),
              linear-gradient(0deg, rgba(8, 14, 26, .7), transparent 70%);
}
.ah-group-banner .ah-group-copy { position: relative; z-index: 2; color: #fff; }
.ah-group-banner small { font-size: 10.5px; letter-spacing: .38em; font-weight: 800; color: rgba(255,255,255,.8); }
.ah-group-banner h2 { font-size: clamp(24px, 2.6vw, 34px); color: #fff; letter-spacing: -.02em; margin: 4px 0 4px; }
.ah-group-banner p { font-size: 12.5px; color: rgba(255,255,255,.82); }

.ah-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 16px; }

.roster-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .9);
  background: linear-gradient(180deg, #fff 0%, #fbfcff 100%);
  box-shadow: var(--sh-1);
  cursor: pointer;
  isolation: isolate;
  transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out), border-color .3s;
}
.roster-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0;
  height: 62%;
  background:
    radial-gradient(90% 70% at 50% 112%, color-mix(in srgb, var(--card-accent, var(--accent)) 34%, transparent) 0%, transparent 68%),
    linear-gradient(180deg, color-mix(in srgb, var(--card-accent, var(--accent)) 12%, #ffffff) 0%, rgba(255, 255, 255, 0) 100%);
  z-index: 0;
  transition: opacity var(--base);
}
.roster-card::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
  pointer-events: none;
  z-index: 4;
}
.roster-card:hover { transform: translateY(-6px); box-shadow: 0 26px 50px -28px color-mix(in srgb, var(--card-accent, var(--accent)) 70%, #101a2b); border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 40%, #fff); }
.roster-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.roster-art {
  position: relative;
  z-index: 1;
  height: 262px;
  display: block;
}
.roster-art .char-figure { position: absolute; left: 6px; right: 6px; top: 14px; bottom: 4px; width: auto; height: auto; }
.roster-art::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 4px;
  width: 58%; height: 10px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--card-accent, var(--accent)) 42%, transparent), transparent 70%);
  filter: blur(4px);
  z-index: -1;
}
.roster-unit {
  position: absolute;
  bottom: 8px; left: 8px; z-index: 3;
  font-size: 9.5px; font-weight: 800; letter-spacing: .09em;
  padding: 3px 8px; border-radius: 999px;
  color: color-mix(in srgb, var(--card-accent, var(--accent)) 84%, #101a2b);
  background: rgba(255, 255, 255, .84);
  border: 1px solid rgba(255, 255, 255, .9);
  backdrop-filter: blur(4px);
}
.roster-star {
  position: absolute;
  top: 8px; right: 8px; z-index: 3;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .8);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  opacity: .55;
  transition: all var(--fast);
  backdrop-filter: blur(6px);
}
.roster-card:hover .roster-star, .roster-star.on { opacity: 1; }
.roster-star.on { color: #f5a623; }
.roster-star:hover { transform: scale(1.1) rotate(-8deg); background: #fff; }
.roster-here {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 3;
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
  padding: 3px 9px; border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--card-accent, var(--accent)), color-mix(in srgb, var(--card-accent, var(--accent)) 60%, #fff));
  box-shadow: 0 8px 18px -10px var(--card-accent, var(--accent));
}

.roster-body { position: relative; z-index: 2; padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.roster-body b { font-size: 17px; letter-spacing: -.02em; color: var(--ink); line-height: 1.3; }
.roster-body small { font-size: 11px; color: var(--ink-3); letter-spacing: .02em; }
.roster-quick { display: flex; gap: 6px; margin-top: 10px; }
.roster-quick button {
  flex: 1;
  padding: 8px 6px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 650;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .8);
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--fast);
}
.roster-quick button:hover { background: color-mix(in srgb, var(--card-accent, var(--accent)) 14%, #fff); border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 40%, transparent); color: color-mix(in srgb, var(--card-accent, var(--accent)) 82%, #101a2b); }

/* ==========================================================================
   Profile sheet
   ========================================================================== */
dialog.sheet { border-radius: 32px; }
.ah-profile { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); min-height: 620px; }
.ah-profile-side {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 22px;
  color: #fff;
  background: var(--night);
}
.ah-profile-side > img.ah-profile-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; filter: saturate(1.05); }
.ah-profile-side::before {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(0deg, rgba(5, 10, 20, .92) 0%, rgba(6, 11, 22, .35) 34%, rgba(6, 11, 22, .04) 68%),
    radial-gradient(90% 55% at 50% 104%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 74%);
}
.ah-profile-art { position: absolute; inset: 34px 0 108px; z-index: 2; }
.ah-profile-art .char-figure { height: 100%; }
.ah-profile-id { position: relative; z-index: 3; }
.ah-profile-id .tag { background: rgba(255, 255, 255, .2); color: #fff; border-color: rgba(255, 255, 255, .32); backdrop-filter: blur(6px); }
.ah-profile-id h2 { font-size: 30px; letter-spacing: -.03em; margin: 8px 0 2px; color: #fff; text-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.ah-profile-id p { font-size: 12px; color: rgba(255, 255, 255, .76); letter-spacing: .04em; }
.ah-profile-eyebrow { position: absolute; top: 22px; left: 22px; z-index: 3; font-size: 10px; letter-spacing: .34em; font-weight: 800; color: rgba(255, 255, 255, .72); }
.ah-profile-close { position: absolute; top: 16px; right: 16px; z-index: 4; }

.ah-profile-main { padding: 24px 26px 26px; display: flex; flex-direction: column; gap: 16px; background: #fff; }
.ah-profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ah-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ah-stat {
  padding: 12px 14px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent-soft) 56%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent);
}
.ah-stat span { font-size: 11.5px; color: var(--ink-3); font-weight: 650; }
.ah-stat b { float: right; font-size: 16px; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.ah-stat .stat-bar, .ah-stat > i { display: block; clear: both; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .8); margin-top: 8px; overflow: hidden; }
.ah-stat .stat-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .8s var(--ease-out); }

.ah-tabs { display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--tint); position: relative; }
.ah-tabs button {
  flex: 1;
  border: 0; background: transparent;
  padding: 9px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 650; color: var(--ink-3);
  cursor: pointer;
  transition: color var(--fast), background var(--fast), box-shadow var(--fast), transform var(--fast);
}
.ah-tabs button:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
.ah-tabs button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 10px 22px -14px var(--accent-glow);
}
.ah-profile-body { flex: 1; min-height: 0; overflow: auto; padding-right: 4px; }

/* ==========================================================================
   Scene (location exploration)
   ========================================================================== */
.ah-scene {
  position: relative;
  overflow: hidden;
  border-radius: 30px;
  min-height: min(88vh, 780px);
  isolation: isolate;
  background: var(--night);
  --floor: .78;
}
.ah-scene-bg { position: absolute; inset: 0; z-index: 0; }
.ah-scene-bg img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); }
.ah-scene-bg::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 11, 22, .72) 0%, rgba(6, 11, 22, .12) 26%, transparent 46%),
    linear-gradient(0deg, rgba(6, 11, 22, .88) 0%, rgba(6, 11, 22, .24) 30%, transparent 52%),
    radial-gradient(70% 60% at 50% 100%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 72%);
}
.ah-stage-cast {
  position: absolute !important;
  display: block !important;
  left: 2%; right: 2%;
  top: 11%;
  bottom: max(calc((1 - var(--floor, .78)) * 100%), 21%);
  z-index: 3;
}
.ah-scene-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  color: #fff;
}
.ah-scene-top h2 { font-size: clamp(22px, 2.4vw, 32px); letter-spacing: -.03em; color: #fff; text-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.ah-scene-top .chip { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .28); color: #fff; backdrop-filter: blur(8px); }
.ah-stage-cast .character-slot > span {
  bottom: -20px !important;
  font-size: 11.5px; font-weight: 700; color: #fff;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(8, 14, 26, .52);
  border: 1px solid rgba(255, 255, 255, .24);
  backdrop-filter: blur(6px);
  opacity: .9;
  transition: opacity var(--fast), transform var(--fast);
}
.ah-stage-cast .character-slot:hover > span,
.ah-stage-cast .character-slot:focus-visible > span,
.ah-stage-cast .character-slot.is-focus > span { opacity: 1; }
.ah-stage-cast .character-slot.is-focus > span { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }

.ah-scene-bar {
  position: absolute;
  left: 18px; right: 18px; bottom: 18px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  flex-wrap: nowrap;
  max-height: 40%;
  overflow: auto;
  padding: 14px 18px;
  border-radius: 24px;
  background: rgba(12, 19, 34, .58);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .9);
  color: #fff;
}
.ah-scene-desc { font-size: 13px; line-height: 1.7; color: rgba(236, 243, 255, .82); flex: 0 0 auto; min-width: 0; }
.ah-scene-desc b { color: #fff; }
.ah-scene-foot { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.ah-scene-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; margin-left: auto; }
.ah-scene-foot .scene-roster { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ah-scene-foot .scene-roster small { color: rgba(255,255,255,.6); font-size: 11px; }
.ah-scene-foot .scene-roster button { padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.1); color: #fff; font-size: 11.5px; cursor: pointer; }
.ah-scene-foot .scene-roster button:hover { background: rgba(255,255,255,.24); }
.ah-scene-actions .soft { background: rgba(255, 255, 255, .12) !important; border-color: rgba(255, 255, 255, .22) !important; color: #fff !important; }
.ah-scene-actions .soft:hover { background: rgba(255, 255, 255, .24) !important; color: #fff !important; }
.ah-scene-actions .event { color: #ffe0a3 !important; border-color: rgba(255, 214, 140, .4) !important; }

/* stage/actor wrappers ----------------------------------------------------- */
.ah-hero-cast {
  position: absolute !important;
  display: block !important;
  pointer-events: none;
}
.ah-stage-cast { position: absolute !important; display: block !important; }
.ah-hero-figure, .ah-actor {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
  display: block;
  pointer-events: auto;
}
.ah-hero-figure > span { pointer-events: none; }
.ah-actor { -webkit-tap-highlight-color: transparent; }
.ah-actor .char-figure { pointer-events: none; }
.ah-actor .char-hit { pointer-events: auto; }
.ah-scene-empty { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; }
.ah-scene-empty p { color: rgba(255, 255, 255, .82); font-size: 14px; background: rgba(8, 14, 26, .4); padding: 10px 20px; border-radius: 999px; backdrop-filter: blur(8px); }

/* story arc switcher ------------------------------------------------------- */
.ah-arcs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.ah-arc {
  position: relative;
  overflow: hidden;
  border: 0;
  padding: 0;
  min-height: 96px;
  border-radius: 20px;
  cursor: pointer;
  isolation: isolate;
  box-shadow: var(--sh-1);
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.ah-arc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: transform .7s var(--ease-out); }
.ah-arc::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(8, 14, 26, .9) 4%, rgba(8, 14, 26, .28) 58%, rgba(8, 14, 26, .1)),
              linear-gradient(120deg, color-mix(in srgb, var(--accent) 62%, transparent), transparent 70%);
}
.ah-arc span { position: absolute; left: 12px; right: 12px; bottom: 22px; z-index: 2; color: #fff; font-size: 12.5px; font-weight: 700; text-align: left; line-height: 1.3; }
.ah-arc small { position: absolute; left: 12px; right: 12px; bottom: 8px; z-index: 2; color: rgba(255, 255, 255, .66); font-size: 9px; letter-spacing: .14em; text-align: left; }
.ah-arc:hover { transform: translateY(-4px); box-shadow: var(--sh-2); }
.ah-arc:hover img { transform: scale(1.08); }
.ah-arc.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent), var(--sh-2); }
.ah-arc.on::before {
  content: "";
  position: absolute; inset: 0; z-index: 3;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
  border-radius: inherit;
}

/* encounter cards ---------------------------------------------------------- */
.ah-encounters { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ah-encounter {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--sh-1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  isolation: isolate;
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out), border-color var(--fast);
}
.ah-encounter::before {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: 4px;
  border-radius: 22px 0 0 22px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: .85;
}
.ah-encounter:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: color-mix(in srgb, var(--accent) 26%, #fff); }
.ah-encounter h3 { font-size: 16px; letter-spacing: -.01em; }
.ah-encounter p { font-size: 12.5px; line-height: 1.7; color: var(--ink-3); }
.ah-encounter .actions { margin-top: auto; padding-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.ah-encounter.zen { flex-direction: row; align-items: center; gap: 10px; padding: 14px 16px; }
.ah-encounter.zen b { font-size: 13.5px; }

/* messages ---------------------------------------------------------------- */
.ah-phone { display: flex; flex-direction: column; gap: 16px; }
.msg-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .8fr); gap: 16px; align-items: start; }
.ah-panel {
  border-radius: 24px;
  background: rgba(255, 255, 255, .84);
  border: 1px solid rgba(255, 255, 255, .92);
  box-shadow: var(--sh-1);
  backdrop-filter: blur(14px);
  padding: 16px;
}
.ah-msg-list { display: flex; flex-direction: column; gap: 6px; min-height: 300px; }
.ah-msg-list h4, .ah-msg-side h4 { font-size: 12px; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; margin: 14px 4px 8px; }
.ah-msg-side { display: flex; flex-direction: column; gap: 6px; }
.ah-msg-side .group-room {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: all var(--fast);
}
.ah-msg-side .group-room:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateX(2px); }
.ah-msg-side .group-room b { font-size: 13.5px; }

/* ==========================================================================
   Visual novel + group chat staging
   ========================================================================== */
.novel-cast,
.gchat-cast {
  position: absolute !important;
  display: block !important;
  left: 0; right: 0;
  padding: 0 10px;
}
.novel-cast { top: 7%; bottom: 30%; }
.gchat-cast { top: 9%; bottom: 40%; }
.novel-cast .character-slot > span,
.gchat-cast .character-slot > span {
  bottom: -14px !important;
  font-size: 11px; font-weight: 700; color: #fff;
  padding: 3px 11px; border-radius: 999px;
  background: rgba(8, 14, 26, .55);
  border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity var(--fast);
}
.novel-cast .character-slot.speaking > span { opacity: 0; }
.novel-cast .character-slot:hover > span,
.gchat-cast .character-slot:hover > span,
.gchat-cast .character-slot.is-focus > span { opacity: 1; }
.novel-cast .character-slot:not(.speaking) { filter: brightness(.82) saturate(.92); }
.novel-cast .character-slot.speaking { z-index: 4; }

.novel-stage { background: #0b1220; }
.novel-stage::after {
  background:
    linear-gradient(180deg, rgba(8, 15, 26, .6) 0%, rgba(8, 15, 26, .04) 24%, rgba(8, 15, 26, 0) 48%, rgba(8, 15, 26, .86) 100%),
    radial-gradient(120% 60% at 50% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 66%) !important;
}
.novel-top > div h2 { color: #fff; }
.novel-textbox {
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(248, 251, 255, .95)) !important;
  border-top: 3px solid color-mix(in srgb, var(--accent) 80%, #fff);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .85), inset 0 0 0 1px rgba(255, 255, 255, .8) !important;
}
.novel-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 4px 4px;
  margin-top: -34px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 10px 24px -16px rgba(0, 0, 0, .6);
}
.novel-name img {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .5);
  object-fit: cover;
  object-position: 50% 14%;
}
.novel-name-text { display: flex; align-items: center; gap: 8px; }
.novel-name b {
  padding: 4px 14px;
  border-radius: 999px;
  color: #fff;
  font-size: 13.5px;
  letter-spacing: .04em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 18px -12px var(--accent-glow);
}
.novel-reading { position: relative; padding-right: 34px; }
.novel-next-arrow {
  position: absolute;
  right: 8px; bottom: 8px;
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid var(--accent);
  animation: vn-next 1.5s var(--ease) infinite;
}
@keyframes vn-next {
  0%, 100% { transform: translateY(0); opacity: .5; }
  50% { transform: translateY(5px); opacity: 1; }
}
.novel-toolbar button { border-radius: 999px; }
.novel-choices .story-choice {
  border-left: 4px solid var(--accent) !important;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), box-shadow var(--fast);
}
.novel-choices .story-choice:hover { border-left-color: var(--accent-2) !important; box-shadow: 0 24px 50px -28px rgba(0, 0, 0, .9); }

.gchat-caption { border-top: 3px solid color-mix(in srgb, var(--accent) 80%, #fff); }
.gchat-name {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important;
  box-shadow: 0 8px 18px -12px var(--accent-glow) !important;
}
.gchat-dock { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
.gchat-form textarea { border-radius: 18px; }
.gchat-cast .character-slot:not(.speaking) { filter: brightness(.8) saturate(.9); opacity: .94; }

/* ==========================================================================
   Shared motion
   ========================================================================== */
@keyframes ah-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes ah-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ah-pop { 0% { opacity: 0; transform: scale(.96) translateY(10px); } 100% { opacity: 1; transform: none; } }

.page > * { animation: ah-rise .5s var(--ease-out) both; }
.page > *:nth-child(1) { animation-delay: .02s; }
.page > *:nth-child(2) { animation-delay: .07s; }
.page > *:nth-child(3) { animation-delay: .12s; }
.page > *:nth-child(4) { animation-delay: .17s; }
.page > *:nth-child(5) { animation-delay: .21s; }

[data-reveal] { opacity: 0; transform: translateY(22px); }
[data-reveal].in { animation: ah-rise .6s var(--ease-out) both; }

dialog.sheet[open], dialog.novel-dialog[open] { animation: ah-pop .32s var(--ease-out) both; }
dialog.sheet::backdrop, dialog.novel-dialog::backdrop { background: rgba(6, 12, 24, .62); backdrop-filter: blur(10px); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .ah-hero { grid-template-columns: 1fr; min-height: 540px; }
  .ah-hero-cast { left: 20%; top: 4%; bottom: 30%; }
  .ah-hero-copy { max-width: none; padding-top: 40%; }
  .ah-rail { grid-template-columns: 1fr; }
  .ah-profile { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
  .ah-arcs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .msg-layout { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .ah-hero { min-height: 520px; border-radius: 28px; }
  .ah-hero-cast { left: 0; right: 0; top: 3%; bottom: 34%; }
  .ah-hero-copy { padding: 260px 20px 22px; gap: 12px; }
  .ah-hero-title { font-size: 30px; }
  .ah-focus { grid-template-columns: 1fr; min-height: 300px; }
  .ah-focus-figure { position: absolute; right: -4%; top: 0; bottom: 40%; width: 52%; z-index: 1; opacity: .96; }
  .ah-focus-copy { justify-content: flex-start; gap: 8px; }
  .ah-focus-actions { margin-top: auto; }
  .ah-wall-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 132px; gap: 10px; }
  .ah-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .roster-art { height: 180px; }
  .roster-body b { font-size: 15px; }
  .ah-toolbar { top: 60px; padding: 10px; border-radius: 20px; }
  .ah-profile { grid-template-columns: 1fr; min-height: 0; }
  .ah-profile-side { min-height: 320px; }
  .ah-profile-art { inset: 10px 0 92px; }
  .ah-profile-main { padding: 18px 16px 22px; }
  .ah-scene { min-height: 88vh; border-radius: 24px; }
  .ah-scene-bar { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; border-radius: 20px; left: 12px; right: 12px; bottom: 12px; }
  .ah-scene-actions { justify-content: flex-start; }
  .ah-scene-desc { font-size: 12px; }
  .ah-stage-cast { left: 0; right: 0; }
  .ah-arcs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ah-arc { min-height: 84px; }
  .ah-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ah-stat { padding: 8px 10px; }
  .ah-stat b { font-size: 14px; }
  .ah-place-grid { grid-template-columns: 1fr; }
  .ah-hero-title { font-size: 27px; }
  .ah-hero-actions .primary, .ah-hero-actions .glass-button { flex: 1 1 auto; justify-content: center; text-align: center; }
}

/* ---------- performance fallbacks ---------- */html.low-effects .page > *,
html.low-effects [data-reveal] { animation: none !important; opacity: 1 !important; transform: none !important; }
html.low-effects .ah-hero-orbs { display: none; }
html.low-effects .character-slot.is-focus::after { animation: none; }
html.low-effects .ah-hero-art img { transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  .page > *, [data-reveal] { animation: none !important; opacity: 1 !important; transform: none !important; }
  .ah-hero-orbs, .character-slot.is-focus::after { display: none; }
  * { transition-duration: .01ms !important; }
}

/* ==========================================================================
   Mobile shell (the tab bar becomes a floating dock)
   ========================================================================== */
@media (max-width: 860px) {
  .topbar { background: rgba(11, 17, 31, .97) !important; backdrop-filter: none !important; }
  .topbar::after { opacity: .5; }
  .tabs {
    position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    margin: 0; padding: 6px; border-radius: 22px;
    background: rgba(12, 19, 34, .94);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(18px) saturate(150%);
    box-shadow: 0 24px 48px -26px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .1);
    justify-content: space-between; gap: 2px;
  }
  .tabs button {
    flex: 1; flex-direction: column; gap: 2px;
    padding: 7px 2px !important;
    font-size: 10px; font-weight: 650;
    border-radius: 16px !important;
    color: rgba(226, 235, 255, .6) !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .tabs button i { font-size: 16px; }
  .tabs button.active {
    color: #fff !important;
    background: linear-gradient(140deg, var(--accent), var(--accent-2)) !important;
    box-shadow: 0 10px 20px -14px var(--accent-glow) !important;
  }
  .page { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }

  /* stacked hero: illustration on top, copy on a solid night panel */
  .ah-hero { display: block; min-height: 0; border-radius: 26px; }
  .ah-hero-art { position: relative; height: 330px; inset: auto; }
  .ah-hero-art::before {
    background:
      linear-gradient(180deg, rgba(9, 15, 30, .5) 0%, rgba(9, 15, 30, .05) 30%, rgba(9, 15, 30, .2) 68%, rgba(9, 15, 30, .98) 100%);
  }
  .ah-hero-cast { position: absolute !important; left: 0; right: 0; top: 0; bottom: auto; height: 330px; }
  .ah-hero-copy {
    position: relative;
    margin-top: -26px;
    padding: 30px 18px 22px;
    max-width: none;
    gap: 10px;
    background: linear-gradient(180deg, rgba(9, 15, 30, 0) 0%, rgba(9, 15, 30, .92) 18%, rgba(9, 15, 30, .99) 100%);
  }
  .ah-hero-copy .ah-eyebrow { font-size: 9.5px; letter-spacing: .3em; margin-bottom: -2px; }
  .ah-hero-title { font-size: 28px; }
  .ah-hero-text { font-size: 13px; }
  .ah-hero-meta .chip { font-size: 10.5px; padding: 4px 10px; }
  .ah-hero-actions { gap: 8px; }
  .ah-hero-actions .primary, .ah-hero-actions .glass-button { flex: 1 1 46%; padding: 12px 10px !important; font-size: 13px; }

  /* cards */
  .roster-art { height: 210px; }
  .roster-body { padding: 8px 12px 12px; }
  .roster-quick button { padding: 8px 4px; font-size: 11.5px; }

  /* scene */
  .ah-stage-cast { left: 0; right: 0; top: 12%; bottom: max(calc((1 - var(--floor, .78)) * 100%), 26%); }
  .ah-scene-top { padding: 16px 18px; }
  .ah-scene-top h2 { font-size: 21px; }
  .ah-scene-bar { gap: 10px; padding: 12px 14px; border-radius: 20px; }
  .ah-scene-desc { font-size: 12px; }
  .ah-scene-actions { margin-left: 0; justify-content: flex-start; width: 100%; }

  /* novel */
  .novel-cast { top: 9%; bottom: 34%; }
  .novel-textbox { padding: 12px 14px 10px; border-radius: 20px; }
  .novel-name { margin-top: -30px; }
  .novel-name img { width: 34px; height: 34px; }
  .novel-toolbar button { font-size: 11.5px; padding: 5px 9px; }

  /* profile sheet */
  .ah-profile-side { min-height: 300px; }
  .ah-profile-art { inset: 8px 0 88px; }
  .ah-profile-id h2 { font-size: 25px; }

  .ah-focus-actions .primary, .ah-focus-actions .soft { padding: 9px 16px !important; font-size: 12.5px; }
}

/* the scene dialog is a full-bleed stage */
.scene-mode .ah-scene,
.scene-mode > .sheet-body > .ah-scene { height: 100dvh; min-height: 0; border-radius: 0; }
.scene-mode .ah-scene { width: 100vw; }
.gchat-mode .gchat { height: 100dvh; }

/* ---------- messages: richer rows ---------- */
.ah-msg-side .group-room {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent-soft) 58%, #fff), #fff 78%);
}
.ah-msg-side .group-room:hover { border-color: color-mix(in srgb, var(--accent) 46%, var(--line)); transform: translateX(3px); }
.ah-msg-side .group-room .avatar-row img { width: 26px; height: 26px; }
.ah-msg-side .group-room-body { display: flex; flex-direction: column; min-width: 0; }
.ah-msg-side .group-room-body b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ah-msg-side .group-room-body small { font-size: 10.5px; color: var(--ink-3); }
.ah-msg-side .group-room-go {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

.ah-msg-list .msg-start { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; margin-top: 6px; }
.ah-msg-list .msg-start-person {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px 8px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.ah-msg-list .msg-start-person:hover {
  background: color-mix(in srgb, var(--accent-soft) 54%, #fff);
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  transform: translateY(-2px);
}
.ah-msg-list .msg-start-person img {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 6px 14px -8px rgba(16, 26, 43, .5), 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
  object-fit: cover; object-position: 50% 14%;
}
.ah-msg-list .msg-start-person span { font-size: 11px; font-weight: 650; color: var(--ink-2); white-space: nowrap; }

.ah-msg-list .msg-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.ah-msg-list .msg-row:hover { background: color-mix(in srgb, var(--accent-soft) 40%, #fff); border-color: color-mix(in srgb, var(--accent) 18%, transparent); transform: translateX(2px); }
.ah-msg-list .msg-row img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: 50% 14%; border: 2px solid #fff; box-shadow: 0 6px 14px -10px rgba(16,26,43,.5); }
.ah-msg-list .msg-body b { font-size: 13.5px; }
.ah-msg-list .msg-body p { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ah-msg-list .msg-row aside { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ah-msg-list .msg-row aside time { font-size: 10.5px; color: var(--muted); }
.ah-msg-list .unread { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.ah-msg-list h4 { margin-top: 16px; }

/* ---------- direct message dialog ---------- */
.chat-dialog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 306px; gap: 18px; align-items: stretch; }
.chat-visual {
  position: relative;
  height: auto;
  min-height: 420px;
  border-radius: 24px;
  overflow: hidden;
  padding: 0;
  border: 0;
  background:
    radial-gradient(120% 80% at 50% 108%, color-mix(in srgb, var(--accent) 70%, #0b1220) 0%, transparent 62%),
    linear-gradient(165deg, var(--night-2), #0b1220 78%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.chat-visual::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(0deg, rgba(7, 12, 24, .8) 0%, transparent 46%),
    radial-gradient(70% 50% at 50% 0%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%);
  pointer-events: none;
}
.chat-visual > .char-figure { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.chat-visual > .char-figure .char-cast { filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .45)); }
.chat-shell { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.chat-log {
  flex: 1;
  min-height: 320px;
  max-height: min(56vh, 520px);
  overflow-y: auto;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(160deg, #f7f9ff, #ffffff 60%);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 6px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px -16px rgba(16, 26, 43, .5);
  font-size: 13.5px;
  line-height: 1.7;
}
.bubble.mine { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.bubble .zh { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.bubble.mine .zh { color: rgba(255, 255, 255, .78); }
.bubble-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.bubble-head img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; object-position: 50% 14%; }
.bubble-head small { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.bubble button { margin-top: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 11px; cursor: pointer; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; border-radius: 16px; padding: 12px 14px; border: 1px solid var(--line); resize: none; font: inherit; font-size: 13.5px; background: #fff; }
.chat-options { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chat-options button, .chat-options select { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 11.5px; cursor: pointer; }

/* group chat sits a little lower so feet meet the dock */
.gchat-cast { top: 9%; bottom: 28%; }
@media (max-width: 860px) {
  .chat-dialog-layout { grid-template-columns: 1fr; }
  .chat-visual { min-height: 220px; height: 220px; }
  .chat-log { min-height: 240px; max-height: 40vh; }
}

/* ---------- small-screen polish ---------- */
@media (max-width: 860px) {
  .ah-tabs { gap: 2px; padding: 4px; }
  .ah-tabs button { font-size: 11.5px; padding: 9px 2px; white-space: nowrap; letter-spacing: -.02em; }
  .ah-profile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .ah-profile-actions button { padding: 10px 8px !important; font-size: 12.5px; }
  .ah-profile-side { min-height: 344px; }
  .ah-profile-art { inset: 0 0 76px; }
  .ah-profile-eyebrow { text-shadow: 0 2px 12px rgba(0, 0, 0, .65); }
  .ah-toolbar { gap: 8px; padding: 10px 10px 12px; }
  .ah-tools { gap: 8px; }
  .ah-search { flex: 1 1 100%; }
  .ah-search input { padding: 9px 14px 9px 36px; font-size: 12.5px; }
  .ah-tools .soft, .ah-tools .ah-select { flex: 1 1 0; }
  .roster-quick { gap: 5px; }
  .roster-quick button { padding: 8px 2px; font-size: 11px; white-space: nowrap; }
  .ah-chip { padding: 7px 12px; font-size: 11.5px; }
  .msg-layout .ah-msg-side { order: -1; }
  .ah-msg-list .msg-start { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .ah-msg-list .msg-start-person img { width: 40px; height: 40px; }
}

/* ---------- final polish ---------- */
.page-title h1 {
  background: linear-gradient(118deg, var(--ink) 24%, color-mix(in srgb, var(--accent) 78%, var(--ink)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ah-focus-figure::before {
  content: "";
  position: absolute;
  inset: 6% 4% 2%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .36), transparent 62%);
  filter: blur(2px);
  pointer-events: none;
}
.ah-focus::after {
  content: "";
  position: absolute;
  right: -8%;
  top: -30%;
  width: 60%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 0 0 26px rgba(255, 255, 255, .06), 0 0 0 58px rgba(255, 255, 255, .04);
  pointer-events: none;
  z-index: 0;
}
.roster-card::after { transition: box-shadow var(--base); }
.roster-card:hover::after { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card-accent, var(--accent)) 55%, #fff); }
.roster-card .roster-art .char-figure { transition: transform .5s var(--ease-out); }
.roster-card:hover .roster-art .char-figure { transform: translateY(-4px) scale(1.025); }

.ah-group-banner::before {
  content: "";
  position: absolute;
  inset: auto -10% -60% 40%;
  height: 120%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-2) 46%, transparent), transparent 72%);
  z-index: 1;
  pointer-events: none;
}

/* scene: unit accent bar under the title */
.ah-scene-top > div::after {
  content: "";
  display: block;
  width: 54px; height: 3px;
  margin-top: 10px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px var(--accent-glow);
}

/* keep paired hero actions the same height when one label wraps */
.ah-hero-actions { align-items: stretch; }
.ah-hero-actions > button { display: inline-flex; align-items: center; justify-content: center; text-align: center; line-height: 1.25; }
@media (max-width: 860px) {
  .ah-hero-actions .primary, .ah-hero-actions .glass-button { font-size: 12.5px; padding: 12px 10px !important; min-height: 52px; }
}

/* scene bar buttons: readable on the dark glass at any accent */
.ah-scene-actions > button {
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, .26) !important;
  background: rgba(255, 255, 255, .12) !important;
  color: #fff !important;
  font-weight: 650;
  padding: 9px 18px !important;
  backdrop-filter: blur(10px);
  transition: background var(--fast), transform var(--fast), border-color var(--fast);
}
.ah-scene-actions > button:hover { background: rgba(255, 255, 255, .24) !important; transform: translateY(-1px); }
.ah-scene-actions > button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 14px 28px -16px var(--accent-glow);
}
.ah-scene-actions > button.event {
  background: rgba(74, 52, 18, .62) !important;
  border-color: rgba(255, 214, 140, .6) !important;
  color: #ffe6b8 !important;
}
.ah-scene-actions > button.event:hover { background: rgba(255, 214, 140, .3) !important; }

/* mobile two-row scenes: the back row keeps its feet, not its label */
@media (max-width: 860px) {
  .character-stage[data-layout="grid"] .character-slot[data-row="back"] > span { display: none; }
}
