/* ==========================================================================
   Pages — home / cast / profile / scene / novel / messages
   ========================================================================== */

/* ---------- page heading ---------- */
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-title h1 { font-size: clamp(24px, 2.6vw, 31px); letter-spacing: -.02em; }
.page-title h2 { font-size: clamp(19px, 1.9vw, 22px); letter-spacing: -.01em; }
.page-title p { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.page-title .title-side { display: flex; align-items: center; gap: 10px; }

/* ==========================================================================
   HOME
   ========================================================================== */
.home { display: flex; flex-direction: column; gap: 20px; }

.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl);
  min-height: clamp(360px, 46vh, 470px);
  box-shadow: var(--sh-2);
  isolation: isolate;
  background: #1d2b41;
}
.hero .illustration { position: absolute; inset: 0; z-index: 0; }
.hero .illustration > img { transform: scale(1.02); transition: transform 8s linear; }
.hero:hover .illustration > img { transform: scale(1.06); }
.hero-veil {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(96deg, rgba(12, 22, 38, .78) 0%, rgba(12, 22, 38, .5) 42%, rgba(12, 22, 38, .06) 72%, rgba(12, 22, 38, .28) 100%),
    linear-gradient(0deg, rgba(12, 22, 38, .72) 0%, rgba(12, 22, 38, 0) 46%);
}
.hero-inner {
  position: relative; z-index: 3;
  display: flex; flex-direction: column; gap: 14px;
  padding: clamp(24px, 3.4vw, 40px);
  max-width: min(620px, 74%);
  height: 100%;
  justify-content: flex-end;
  min-height: inherit;
}
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-meta .chip { background: rgba(255,255,255,.92); border-color: transparent; color: var(--ink-2); backdrop-filter: blur(8px); box-shadow: 0 6px 16px -12px rgba(0,0,0,.6); }
.hero-meta .chip b { font-weight: 700; }
.hero-title {
  color: #fff; font-size: clamp(26px, 3.4vw, 40px); line-height: 1.22;
  letter-spacing: -.02em; text-shadow: 0 4px 26px rgba(0,0,0,.4);
}
.hero-text { color: rgba(255,255,255,.86); font-size: 14.5px; line-height: 1.75; max-width: 46em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

.hero-people {
  position: absolute; right: clamp(16px, 3vw, 34px); bottom: clamp(18px, 3vw, 30px);
  z-index: 2; display: flex; gap: 10px; align-items: flex-end;
  max-width: 46%;
  flex-wrap: wrap; justify-content: flex-end;
}
.hero-person {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 5px 7px 7px; border-radius: 16px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px -16px rgba(0,0,0,.7);
  transition: transform var(--base), background var(--base), box-shadow var(--base);
}
.hero-person:hover { transform: translateY(-4px); background: #fff; box-shadow: 0 14px 26px -14px rgba(0,0,0,.6); }
.hero-person img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: center 12%; background: var(--tint); }
.hero-person span { color: var(--ink-2); font-size: 11px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }

.home-row { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 20px; margin-top: 20px; }

/* focus card */
.focus-panel {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--accent-wash), var(--accent-soft) 62%, #fff);
  border: 1px solid var(--line); box-shadow: var(--sh-1);
  min-height: 310px; display: flex; flex-direction: column; justify-content: space-between;
  isolation: isolate;
}
.focus-panel::after {
  content: ""; position: absolute; right: -30px; top: -40px; width: 220px; height: 220px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.9), rgba(255,255,255,0) 70%);
  z-index: 0;
}
.focus-top { position: relative; z-index: 2; padding: 20px 22px 0; }
.focus-top .who { display: flex; flex-direction: column; gap: 4px; }
.focus-top .unit-line { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--accent-ink); letter-spacing: .06em; }
.focus-top h3 { font-size: 23px; }
.focus-top .where { font-size: 12.5px; color: var(--ink-3); }
.focus-figure {
  position: absolute; right: 0; bottom: 0; z-index: 1;
  height: 94%; width: 74%;
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding-right: 6px;
}
.focus-actions { position: relative; z-index: 2; padding: 0 22px 20px; display: flex; flex-wrap: wrap; gap: 8px; }

/* agenda */
.agenda { display: flex; flex-direction: column; padding: 20px 22px; }
.agenda-list { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.agenda-row {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: 14px; border: 0; background: transparent;
  cursor: pointer; text-align: left; transition: background var(--fast), transform var(--fast);
}
.agenda-row:hover { background: var(--tint); transform: translateX(2px); }
.agenda-row .unit-dot { width: 9px; height: 9px; border-radius: 50%; }
.agenda-row b { font-size: 14px; font-weight: 700; }
.agenda-row .where { font-size: 12.5px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.agenda-row .avatar-row img { width: 26px; height: 26px; }
.agenda-foot { margin-top: auto; padding-top: 12px; }

/* places */
.places { display: flex; flex-direction: column; }
.place-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.place-tile {
  position: relative; overflow: hidden; border-radius: var(--r-md);
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  box-shadow: var(--sh-1); transition: transform var(--base), box-shadow var(--base);
  text-align: left;
}
.place-tile:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.place-tile .illustration { position: relative; aspect-ratio: 16 / 9; }
.place-tile .illustration > img { transition: transform .5s var(--ease); }
.place-tile:hover .illustration > img { transform: scale(1.05); }
.place-tile .tile-tag {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.9); color: var(--ink-2); backdrop-filter: blur(6px);
}
.place-tile .tile-tag.here { background: var(--accent); color: #fff; }
.place-tile .tile-body { padding: 11px 13px 12px; display: flex; flex-direction: column; gap: 5px; }
.place-tile h4 { font-size: 15px; }
.place-tile .tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.place-tile .tile-foot small { font-size: 12px; color: var(--ink-3); }

/* ==========================================================================
   CAST
   ========================================================================== */
.cast-toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.unit-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 13.5px; font-weight: 600; transition: all var(--fast);
}
.unit-chip .unit-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0,0,0,.03); }
.unit-chip:hover { border-color: var(--line-2); transform: translateY(-1px); }
.unit-chip.active { background: var(--chip-soft, var(--accent-soft)); border-color: transparent; color: var(--chip-ink, var(--accent-ink)); box-shadow: var(--sh-1); }
.cast-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cast-tools .search-field { position: relative; flex: 1; min-width: 180px; max-width: 340px; }
.cast-tools .search-field::before {
  content: "⌕"; position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 17px; line-height: 1; pointer-events: none;
}
.cast-tools input[type="search"] { width: 100%; border-radius: 999px; padding-left: 36px; }
.cast-tools select { border-radius: 999px; padding-top: 9px; padding-bottom: 9px; }

.cast-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.cast-card {
  position: relative; overflow: hidden; cursor: pointer; text-align: left;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: linear-gradient(172deg, var(--accent-soft) 0%, color-mix(in srgb, var(--accent-soft) 52%, #fff) 48%, #fff 100%);
  box-shadow: var(--sh-1);
  transition: transform var(--base), box-shadow var(--base), border-color var(--base);
  aspect-ratio: 3 / 4.3;
  display: flex; flex-direction: column;
}
.cast-card:hover { transform: translateY(-5px); box-shadow: var(--sh-2); border-color: color-mix(in srgb, var(--accent) 26%, var(--line)); }
.cast-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cast-figure { position: relative; flex: 1; min-height: 0; padding-bottom: 4px; display: flex; align-items: flex-end; justify-content: center; }
.cast-figure::before {
  content: ""; position: absolute; left: 50%; bottom: 2%; width: 64%; height: 16%;
  transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent 72%);
  filter: blur(3px); opacity: .55;
}
.cast-card .cast-star {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.82); color: var(--ink-3); font-size: 14px;
  display: grid; place-items: center; backdrop-filter: blur(6px);
  transition: all var(--fast); opacity: 0;
}
.cast-card:hover .cast-star, .cast-card .cast-star.on { opacity: 1; }
.cast-card .cast-star.on { color: #eda33f; }
.cast-card .cast-star:hover { background: #fff; transform: scale(1.08); }
.cast-here {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  background: var(--accent); color: #fff; box-shadow: 0 4px 10px -6px var(--accent);
}
.cast-name {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; gap: 1px;
  padding: 9px 13px 11px;
  background: linear-gradient(0deg, rgba(255,255,255,.98) 30%, rgba(255,255,255,.86) 72%, rgba(255,255,255,0));
}
.cast-name b { font-size: 15px; letter-spacing: -.01em; }
.cast-name small { font-size: 11px; color: var(--ink-3); letter-spacing: .02em; }
.cast-quick {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; gap: 6px; padding: 9px 11px;
  background: linear-gradient(0deg, rgba(255,255,255,.98), rgba(255,255,255,.92));
  transform: translateY(102%); opacity: 0;
  transition: transform var(--base), opacity var(--base);
}
.cast-card:hover .cast-quick, .cast-card:focus-within .cast-quick { transform: translateY(0); opacity: 1; }
.cast-quick button {
  flex: 1; padding: 7px 8px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 12px; font-weight: 700; transition: all var(--fast);
}
.cast-quick button:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-wash); }

/* ==========================================================================
   PROFILE
   ========================================================================== */
.profile-mode .sheet-head { display: none; }
.profile-mode .sheet-body { padding: 0; }

.profile { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 620px; }
.profile-side {
  position: relative; overflow: hidden;
  background: linear-gradient(170deg, var(--accent-wash), var(--accent-soft) 55%, #fff);
  display: flex; flex-direction: column; justify-content: flex-end;
  border-right: 1px solid var(--line);
}
.profile-side::before {
  content: ""; position: absolute; inset: -20% -30% 40%; z-index: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.95), rgba(255,255,255,0) 62%);
}
.profile-art { position: absolute; inset: 0 0 92px 0; z-index: 1; display: flex; align-items: flex-end; justify-content: center; }
.profile-id { position: relative; z-index: 2; padding: 16px 20px 20px; background: linear-gradient(0deg, rgba(255,255,255,.98) 40%, rgba(255,255,255,.7) 80%, rgba(255,255,255,0)); }
.profile-id h2 { font-size: 26px; }
.profile-id p { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; letter-spacing: .04em; }
.profile-id .tag { margin-bottom: 8px; }
.profile-close { position: absolute; top: 14px; right: 14px; z-index: 5; }

.profile-main { display: flex; flex-direction: column; min-width: 0; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 24px 6px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 12px 24px 8px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-top { display: flex; align-items: baseline; gap: 7px; }
.stat-top span { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.stat-top b { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-bar { height: 6px; border-radius: 99px; background: #edf1f8; overflow: hidden; }
.stat-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff)); transition: width .5s var(--ease); }

.profile-tabs {
  display: flex; gap: 4px; padding: 10px 24px 0; margin-top: 4px;
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.profile-tabs::-webkit-scrollbar { display: none; }
.profile-tabs button {
  position: relative; padding: 10px 14px 12px; border: 0; background: none; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--ink-3); white-space: nowrap;
  transition: color var(--fast);
}
.profile-tabs button::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2.5px;
  border-radius: 3px; background: var(--accent); transform: scaleX(0); transition: transform var(--base);
}
.profile-tabs button.active { color: var(--accent-ink); }
.profile-tabs button.active::after { transform: scaleX(1); }
.profile-body { padding: 20px 24px 26px; overflow-y: auto; flex: 1; }
.profile-body h4 { font-size: 12.5px; color: var(--accent-ink); font-weight: 700; letter-spacing: .05em; margin: 4px 0 6px; }
.profile-body > h4:not(:first-child) { margin-top: 18px; }

.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.fact { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.fact:last-child { border-bottom: 0; }
.fact dt { flex: 0 0 74px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.fact dd { margin: 0; font-size: 14px; color: var(--ink); line-height: 1.6; }
.prose-block { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.prose-block:last-child { border-bottom: 0; }
.prose-block h4 { font-size: 12.5px; color: var(--accent-ink); font-weight: 700; letter-spacing: .04em; }
.prose-block p { font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.confidence {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 6px;
  padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  background: #fff5e6; color: #a5691a; vertical-align: 1px;
}
.confidence.official { background: #e8f6f1; color: #14786c; }

.rel-group { margin-bottom: 18px; }
.rel-group > h4 { font-size: 12.5px; color: var(--ink-3); font-weight: 700; letter-spacing: .06em; margin-bottom: 8px; }
.rel-card {
  display: flex; gap: 12px; padding: 13px 14px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--tint); margin-bottom: 8px;
  transition: border-color var(--fast), background var(--fast);
}
.rel-card:hover { border-color: var(--line-2); background: #fff; }
.rel-card img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; object-position: center 15%; flex-shrink: 0; background: #fff; }
.rel-card .rel-avatar-fallback { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); font-size: 12px; color: var(--ink-3); flex-shrink: 0; }
.rel-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rel-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rel-head b { font-size: 14.5px; }
.rel-head span { font-size: 11.5px; color: var(--ink-3); }
.rel-summary { font-size: 12.8px; color: var(--ink-2); line-height: 1.6; }
.rel-address { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.rel-address span {
  font-size: 11.5px; padding: 1px 8px; border-radius: 7px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2);
}
.rel-address em { font-style: normal; color: var(--ink-3); font-size: 11.5px; }
.rel-shared { font-size: 11.5px; color: var(--accent-ink); }

.memory-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; color: var(--ink-2); }
.memory-item time { flex: 0 0 62px; font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.memory-empty { padding: 24px 0; color: var(--ink-3); font-size: 13.5px; text-align: center; }

/* ==========================================================================
   SCENE (immersive location)
   ========================================================================== */
.scene-mode { width: 100vw !important; height: 100dvh !important; max-width: none !important; max-height: none !important; border-radius: 0 !important; }
.scene-mode .sheet-head { display: none; }
.scene-mode .sheet-body { padding: 0; height: 100%; overflow: hidden; }
.scene-mode::backdrop { background: rgba(10, 18, 30, .72); }

.scene { position: relative; width: 100%; height: 100%; overflow: hidden; background: #101c2c; isolation: isolate; }
.scene-bg { position: absolute; inset: 0; z-index: 0; }
.scene-bg > img { width: 100%; height: 100%; object-fit: cover; animation: scene-in 1.1s var(--ease); }
@keyframes scene-in { from { transform: scale(1.05); opacity: .4; } }
.scene-scrim {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(180deg, rgba(9,18,30,.62) 0%, rgba(9,18,30,.08) 26%, rgba(9,18,30,.06) 54%, rgba(9,18,30,.78) 100%),
    radial-gradient(120% 70% at 50% 100%, rgba(9,18,30,.55), rgba(9,18,30,0) 62%);
}
.scene-top {
  position: relative; z-index: 4;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: clamp(16px, 2.6vw, 28px) clamp(16px, 3vw, 34px);
}
.scene-top h2 { color: #fff; font-size: clamp(22px, 2.6vw, 30px); text-shadow: 0 3px 20px rgba(0,0,0,.5); margin-top: 7px; }
.scene-top .chip { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: #fff; backdrop-filter: blur(10px); }
.scene-top .close-btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: #fff; backdrop-filter: blur(10px); }
.scene-top .close-btn:hover { background: rgba(255,255,255,.3); color: #fff; }

.scene-cast {
  position: absolute; left: 0; right: 0; top: 6%; bottom: 16%; z-index: 3;
  display: flex; align-items: flex-end; justify-content: center; gap: clamp(4px, .7vw, 12px);
  padding: 0 clamp(4px, .8vw, 12px);
  pointer-events: none;
}
.scene-actor {
  pointer-events: auto; position: relative;
  height: 100%; width: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  border: 0; background: none; cursor: pointer; padding: 0;
  transition: transform var(--base), filter var(--base), opacity var(--base);
}
.scene-actor:hover { transform: translateY(-6px); }
.scene-actor > span {
  margin-top: 8px;
  padding: 4px 14px; border-radius: 999px; white-space: nowrap;
  background: rgba(255,255,255,.92); color: var(--ink); font-size: 12.5px; font-weight: 700;
  box-shadow: 0 6px 16px -8px rgba(0,0,0,.6);
  transition: background var(--fast), color var(--fast);
}
.scene-actor:hover > span { background: #fff; }

.scene-empty { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; }
.scene-empty p { color: rgba(255,255,255,.8); font-size: 14px; }

.scene-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; flex-direction: column; gap: 12px;
  padding: 22px clamp(16px, 3vw, 34px) clamp(18px, 2.4vw, 26px);
  background: linear-gradient(0deg, rgba(9,18,30,.9), rgba(9,18,30,.55) 55%, rgba(9,18,30,0));
}
.scene-desc { color: rgba(255,255,255,.88); font-size: 14px; line-height: 1.7; max-width: 62em; }
.scene-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.scene-actions button {
  padding: 9px 17px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.34); background: rgba(255,255,255,.14);
  color: #fff; font-size: 13.5px; font-weight: 600;
  backdrop-filter: blur(10px); transition: all var(--fast);
}
.scene-actions button:hover { background: rgba(255,255,255,.3); transform: translateY(-1px); }
.scene-actions button.primary { border-color: transparent; background: linear-gradient(135deg, var(--accent), #7a6bd8); }
.scene-actions button.primary:hover { filter: brightness(1.06); }
.scene-actions button.event { border-color: rgba(255,214,140,.6); background: rgba(255,214,140,.2); }
.scene-collapse { position: absolute; right: clamp(16px, 3vw, 34px); top: 50%; z-index: 5; }

/* ==========================================================================
   NOVEL — visual novel staging
   ========================================================================== */
.novel-dialog {
  border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none;
  background: #0d1626; overflow: hidden;
}
.novel-dialog[open] { display: block; }
.novel-dialog::backdrop { background: #0a1220; }
.novel-stage { position: relative; width: 100%; height: 100%; overflow: hidden; }
.novel-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: scene-in 1s var(--ease); }
.novel-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(8,15,26,.55) 0%, rgba(8,15,26,.05) 22%, rgba(8,15,26,0) 46%, rgba(8,15,26,.82) 100%);
}
.novel-top {
  position: relative; z-index: 6; display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: clamp(14px, 2.2vw, 24px) clamp(16px, 3vw, 32px);
}
.novel-top h2 { color: #fff; font-size: clamp(17px, 2vw, 22px); text-shadow: 0 3px 18px rgba(0,0,0,.55); }
.novel-top small { display: block; color: rgba(255,255,255,.66); font-size: 11.5px; margin-bottom: 3px; letter-spacing: .04em; }

.novel-cast {
  position: absolute; left: 0; right: 0; top: 6%; bottom: 29%; z-index: 3;
  display: flex; align-items: flex-end; justify-content: center; gap: clamp(6px, 2.2vw, 42px);
  padding: 0 clamp(8px, 3vw, 40px);
}
.novel-actor {
  position: relative; height: 100%; width: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  transition: filter .35s var(--ease), opacity .35s var(--ease), transform .35s var(--ease);
}
.novel-actor:not(.speaking) { filter: brightness(.78) saturate(.92); }
.novel-actor.speaking { z-index: 4; }
.novel-actor > span {
  position: relative; margin-top: 6px;
  padding: 3px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: rgba(255,255,255,.82); color: var(--ink-2); white-space: nowrap;
  opacity: .85; transition: opacity var(--fast), background var(--fast);
}
.novel-actor.speaking > span { opacity: 0; }
.novel-actor:not(.speaking):hover > span { opacity: 1; background: #fff; }

.novel-textbox {
  position: absolute; left: 50%; bottom: clamp(12px, 2vw, 24px); transform: translateX(-50%);
  z-index: 7; width: min(1040px, calc(100% - clamp(20px, 4vw, 60px)));
  border-radius: 26px; padding: 16px 20px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(252,254,255,.93));
  box-shadow: 0 26px 60px -28px rgba(0,0,0,.7), inset 0 0 0 1px rgba(255,255,255,.7);
  backdrop-filter: blur(12px);
}
.novel-name {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 14px 3px 4px; margin-top: -30px; margin-bottom: 6px;
  border-radius: 999px; background: #fff;
  box-shadow: 0 6px 18px -12px rgba(0,0,0,.5);
}
.novel-name b {
  padding: 3px 13px; border-radius: 999px; color: #fff; font-size: 13.5px; letter-spacing: .04em;
  background: linear-gradient(135deg, var(--accent), #7a6bd8);
  box-shadow: 0 6px 14px -10px var(--accent);
}
.novel-name small { font-size: 11px; color: var(--ink-3); }
.novel-reading { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer; padding: 2px 2px 4px; }
.novel-ja { font-size: clamp(15px, 1.5vw, 17.5px); line-height: 1.85; color: var(--ink); letter-spacing: .01em; min-height: 1.85em; }
.novel-zh { font-size: clamp(12.5px, 1.2vw, 13.5px); line-height: 1.7; color: var(--ink-3); margin-top: 3px; min-height: 1.7em; }
.novel-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.novel-toolbar > span { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }
.novel-toolbar button {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-3); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all var(--fast);
}
.novel-toolbar button:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-wash); }
.novel-toolbar button.primary { border-color: transparent; background: var(--accent); color: #fff; }
.novel-toolbar button.primary:hover { filter: brightness(1.06); background: var(--accent); color: #fff; }

.novel-choices {
  position: static; width: 100%; margin-top: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.novel-textbox.with-choices { padding-bottom: 16px; }
.novel-textbox.with-choices .novel-toolbar { opacity: .55; }
.novel-choices .story-choice {
  padding: 15px 22px; border-radius: 18px; cursor: pointer; text-align: left;
  border: 1px solid rgba(255,255,255,.7); background: rgba(255,255,255,.95);
  color: var(--ink); font-size: 14.5px; font-weight: 700;
  box-shadow: 0 20px 44px -26px rgba(0,0,0,.8);
  transition: transform var(--fast), background var(--fast);
  backdrop-filter: blur(10px);
}
.novel-choices .story-choice:hover { transform: translateY(-2px); background: #fff; }
.novel-choices .story-choice::before { content: "◇  "; color: var(--accent); }

.novel-history {
  position: absolute; z-index: 9; right: clamp(12px, 3vw, 40px); top: clamp(60px, 9vh, 86px); bottom: clamp(150px, 26vh, 260px);
  width: min(420px, calc(100% - 24px)); overflow-y: auto;
  border-radius: 20px; padding: 12px;
  background: rgba(255,255,255,.97); box-shadow: var(--sh-3);
  display: flex; flex-direction: column; gap: 6px;
}
.novel-history .history-line {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; text-align: left;
  border: 0; border-radius: 12px; background: var(--tint); padding: 9px 12px; cursor: pointer;
  transition: background var(--fast);
}
.novel-history .history-line:hover { background: var(--accent-wash); }
.novel-history .history-line b { grid-row: span 2; font-size: 11.5px; color: var(--accent-ink); align-self: start; }
.novel-history .history-line span { font-size: 12.5px; color: var(--ink-2); }
.novel-history .history-line small { font-size: 12px; color: var(--ink-3); }

/* ==========================================================================
   MESSAGES
   ========================================================================== */
.msg-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.msg-list { display: flex; flex-direction: column; gap: 4px; }
.msg-row {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 13px; align-items: center;
  padding: 11px 12px; border: 0; border-radius: 16px; background: transparent; cursor: pointer;
  text-align: left; transition: background var(--fast), transform var(--fast);
}
.msg-row:hover { background: var(--tint); transform: translateX(2px); }
.msg-row img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; object-position: center 15%; background: var(--accent-soft); }
.msg-body { min-width: 0; }
.msg-body b { font-size: 14.5px; display: block; }
.msg-body p { font-size: 12.8px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-side { display: flex; flex-direction: column; gap: 8px; }
.msg-side h4 { font-size: 12.5px; color: var(--ink-3); letter-spacing: .06em; margin-top: 6px; }
.msg-list h4 { font-size: 12.5px; color: var(--ink-3); letter-spacing: .06em; margin: 18px 0 8px; }
.msg-start { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.msg-start-person {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px; border: 1px solid transparent; border-radius: 14px;
  background: transparent; cursor: pointer; transition: all var(--fast);
}
.msg-start-person:hover { background: var(--tint); border-color: var(--line); }
.msg-start-person img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: center 15%; background: var(--accent-soft); }
.msg-start-person span { font-size: 11.5px; color: var(--ink-2); font-weight: 600; text-align: center; line-height: 1.3; }
.unread {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--rose); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.msg-row time { font-size: 11px; color: var(--muted); }
.group-room {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 13px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left;
  font-size: 13.5px; font-weight: 600; transition: all var(--fast);
}
.group-room:hover { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1180px) {
  .cast-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .place-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .home-row { grid-template-columns: 1fr; }
  .cast-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .msg-layout { grid-template-columns: 1fr; }
  .profile { grid-template-columns: 260px minmax(0, 1fr); }
  .profile-art { inset: 0 0 84px 0; }
}
@media (max-width: 860px) {
  .hero { min-height: 400px; border-radius: var(--r-lg); }
  .hero-inner { max-width: 100%; padding: 20px 18px 88px; }
  .hero-people { right: 12px; left: 12px; bottom: 12px; max-width: none; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; scrollbar-width: none; }
  .hero-people::-webkit-scrollbar { display: none; }
  .hero-person { flex-shrink: 0; padding: 4px; }
  .hero-person img { width: 42px; height: 42px; }
  .hero-person span { font-size: 10.5px; }
  .focus-panel { min-height: 250px; }
  .focus-figure { width: 55%; height: 82%; }
  .focus-top h3 { font-size: 20px; }
  .place-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cast-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cast-card { aspect-ratio: 3 / 4.55; }
  .cast-name b { font-size: 14px; }
  .cast-quick { transform: none; opacity: 1; position: static; padding: 0 10px 10px; background: none; }
  .cast-quick button { padding: 8px 6px; font-size: 12px; }
  .cast-card .cast-star { opacity: 1; }
  .cast-figure { min-height: 0; }
  .unit-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .unit-chips::-webkit-scrollbar { display: none; }
  .unit-chip { flex-shrink: 0; padding: 7px 13px; font-size: 12.5px; }
  .cast-tools .search-field { flex: 1 1 100%; max-width: none; }
  .cast-tools input[type="search"] { max-width: none; min-width: 0; }
  .cast-tools { gap: 8px; }
  .profile { grid-template-columns: 1fr; min-height: 0; }
  .profile-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-art { position: relative; inset: auto; height: 300px; }
  .profile-id { padding: 10px 18px 16px; }
  .profile-id h2 { font-size: 22px; }
  .profile-actions { padding: 14px 16px 0; }
  .profile-stats { padding: 10px 16px 6px; gap: 8px; }
  .profile-tabs { padding: 8px 16px 0; }
  .profile-body { padding: 16px; }
  .fact-grid { grid-template-columns: 1fr; }
  .scene-actor { width: clamp(92px, 26vw, 120px); height: 30vh; }
  .scene-cast { min-height: 46%; gap: 2px; }
  .scene-bar { padding: 16px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .scene-desc { font-size: 12.8px; }
  .scene-actions button { padding: 8px 13px; font-size: 12.5px; }
  .novel-cast { inset: 6% 0 30%; }
  .novel-actor { width: clamp(100px, 30vw, 150px); }
  .novel-textbox { border-radius: 20px; padding: 12px 14px 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .novel-name { margin-top: -26px; }
  .novel-toolbar { gap: 4px; }
  .novel-toolbar button { padding: 5px 9px; font-size: 11px; }
  .novel-history { right: 10px; left: 10px; width: auto; top: 56px; bottom: auto; max-height: 56vh; }
}


/* ==========================================================================
   GROUP SCENE CHAT
   ========================================================================== */
.gchat { position: relative; width: 100%; height: 100%; overflow: hidden; isolation: isolate; background: #101c2c; }
.gchat .illustration { position: absolute; inset: 0; z-index: 0; }
.gchat .illustration > img { width: 100%; height: 100%; object-fit: cover; }
.gchat-scrim {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(9,18,30,.62) 0%, rgba(9,18,30,.06) 26%, rgba(9,18,30,.18) 52%, rgba(9,18,30,.82) 100%);
}
.gchat .scene-top { position: relative; z-index: 5; }
.gchat-top { display: flex; align-items: center; gap: 8px; }
.gchat-top .glass-button { padding: 7px 14px; font-size: 12.5px; }

.gchat-cast {
  position: absolute; left: 0; right: 0; top: 7%; bottom: 34%; z-index: 3;
  display: flex; align-items: flex-end; justify-content: center;
  gap: clamp(6px, 1.6vw, 26px); padding: 0 clamp(10px, 2vw, 28px);
}
.gchat-cast[data-count="1"] { --cast-fill: 1; }
.gchat-cast[data-count="2"] { --cast-fill: .96; }
.gchat-cast[data-count="3"] { --cast-fill: .9; }
.gchat-cast[data-count="4"] { --cast-fill: .84; }
.gchat-actor {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  border: 0; background: none; cursor: pointer; padding: 0;
  transition: filter var(--base), opacity var(--base), transform var(--base);
}
.gchat-actor .char-figure { --art-h: calc(100% * var(--cast-fill, .86)); }
.gchat-actor > span {
  margin-top: 8px; padding: 4px 14px; border-radius: 999px; white-space: nowrap;
  background: rgba(255,255,255,.9); color: var(--ink); font-size: 12.5px; font-weight: 700;
  box-shadow: 0 6px 16px -8px rgba(0,0,0,.6); transition: all var(--fast);
}
.gchat-cast:not(.idle) .gchat-actor:not(.speaking) { filter: brightness(.72) saturate(.88); opacity: .9; }
.gchat-echo {
  width: min(880px, 100%); margin: 0 auto; padding: 6px 14px; border-radius: 999px;
  max-width: min(880px, 100%);
  font-size: 12.5px; color: rgba(255,255,255,.86);
  background: rgba(255,255,255,.14); backdrop-filter: blur(8px);
  text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gchat-actor.speaking { transform: translateY(-4px); }
.gchat-actor.speaking > span { background: #fff; color: var(--accent-ink); }

.gchat-dock {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px clamp(14px, 3vw, 34px) calc(18px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(0deg, rgba(9,18,30,.95) 20%, rgba(9,18,30,.66) 62%, rgba(9,18,30,0) 100%);
}
.gchat-caption {
  position: relative; width: min(880px, 100%); margin: 0 auto;
  padding: 12px 18px 14px; border-radius: 18px;
  background: rgba(255,255,255,.95); color: var(--ink);
  box-shadow: 0 20px 44px -30px rgba(0,0,0,.9);
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.gchat-caption[hidden] { display: none; }
.gchat-name {
  display: inline-block; padding: 2px 13px; margin-bottom: 6px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent, #4b62d8), #7a6bd8); color: #fff;
  font-size: 12.5px; letter-spacing: .04em;
  box-shadow: 0 6px 14px -10px var(--accent, #4b62d8);
}
.gchat-caption[data-unit] { --accent: #4b62d8; }
.gchat-caption[data-unit="ln"] { --accent: #4b62d8; }
.gchat-caption[data-unit="mmj"] { --accent: #eda33f; }
.gchat-caption[data-unit="vbs"] { --accent: #e2556c; }
.gchat-caption[data-unit="wxs"] { --accent: #2fb7a6; }
.gchat-caption[data-unit="n25"] { --accent: #9579ca; }
.gchat-caption[data-unit="vs"] { --accent: #3aa8bd; }
.gchat-ja { font-size: 16px; line-height: 1.8; min-height: 1.8em; }
.gchat-zh { font-size: 13px; color: var(--ink-3); line-height: 1.7; min-height: 1.7em; }

.gchat-log {
  width: min(880px, 100%); max-height: 30vh; overflow-y: auto; margin: 0 auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; border-radius: 16px;
  background: rgba(18, 28, 44, .82); backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.gchat-line { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: 12px; background: rgba(255,255,255,.08); }
.gchat-line.mine { background: rgba(255,255,255,.18); align-self: flex-end; max-width: 80%; }
.gchat-line b { font-size: 11.5px; color: #a9c6ff; }
.gchat-line.mine b { color: #ffe0a8; }
.gchat-line p { font-size: 12.8px; color: rgba(255,255,255,.92); line-height: 1.6; }
.gchat-line .gchat-line-zh { font-size: 11.8px; color: rgba(255,255,255,.62); }

.gchat-status { width: min(880px, 100%); margin: 0 auto; min-height: 18px; font-size: 12px; color: rgba(255,255,255,.7); }
.gchat-status.thinking { color: #ffe0a8; }
.gchat-status.error { color: #ffb4b4; display: flex; align-items: center; gap: 10px; }
.gchat-status .soft { padding: 4px 12px; font-size: 12px; background: rgba(255,255,255,.9); border-color: transparent; }

.gchat-form { display: flex; gap: 10px; width: min(880px, 100%); margin: 0 auto; align-items: flex-end; }
.gchat-form textarea {
  flex: 1; min-height: 44px; max-height: 120px; padding: 11px 15px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.96);
  resize: none; font-size: 14px;
}
.gchat-form button.primary { height: 44px; padding: 0 24px; }

.gchat-mode::backdrop { background: rgba(9, 16, 26, .8); }

@media (max-width: 860px) {
  .gchat-cast { top: 6%; bottom: 38%; }
  .gchat-cast[data-count="3"] .gchat-actor + .gchat-actor { margin-left: -22px; }
  .gchat-cast[data-count="4"] .gchat-actor + .gchat-actor { margin-left: -30px; }
  .gchat-actor > span { font-size: 11px; padding: 3px 10px; }
  .gchat-cast[data-count="1"] { --cast-fill: .92; }
  .gchat-cast[data-count="2"] { --cast-fill: .82; }
  .gchat-cast[data-count="3"] { --cast-fill: .56; }
  .gchat-cast[data-count="4"] { --cast-fill: .48; }
  .gchat-caption { padding: 10px 14px 12px; border-radius: 16px; }
  .gchat-ja { font-size: 14.5px; }
  .gchat-zh { font-size: 12.5px; }
  .gchat-log { max-height: 24vh; }
}

/* Cast standing inside the story hero */
.hero-cast {
  position: absolute; right: clamp(12px, 2.6vw, 40px); bottom: 0; z-index: 1;
  height: 72%; display: flex; align-items: flex-end; gap: clamp(2px, .8vw, 14px);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%);
  mask-image: linear-gradient(90deg, transparent 0, #000 14%);
}
.hero-cast[data-count="1"] { --cast-fill: 1; }
.hero-cast[data-count="2"] { --cast-fill: .97; }
.hero-cast[data-count="3"] { --cast-fill: .93; }
.hero-figure { height: 100%; display: flex; align-items: flex-end; }
.hero-figure .char-figure { --art-h: calc(100% * var(--cast-fill, 1)); }
.hero-figure:nth-child(3) { opacity: .96; }
.hero-cast-live { height: 78%; bottom: 2%; right: clamp(14px, 3vw, 46px); -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%); mask-image: linear-gradient(90deg, transparent 0, #000 22%); }
.hero-cast-live[data-count="3"] { --cast-fill: .92; }
.hero-cast-live[data-count="4"] { --cast-fill: .86; }
.hero-figure-btn {
  position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center;
  border: 0; background: none; padding: 0; cursor: pointer; pointer-events: auto;
  transition: transform var(--base), filter var(--base);
}
.hero-figure-btn:hover { transform: translateY(-5px); }
.hero-figure-btn > span {
  position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
  padding: 3px 12px; border-radius: 999px; white-space: nowrap;
  background: rgba(255,255,255,.92); color: var(--ink); font-size: 11.5px; font-weight: 700;
  box-shadow: 0 6px 14px -8px rgba(0,0,0,.6);
  opacity: 0; transition: opacity var(--fast);
}
.hero-figure-btn:hover > span, .hero-figure-btn:focus-visible > span { opacity: 1; }
.hero-more {
  align-self: flex-end; margin: 0 0 6px -6px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255,255,255,.9); color: var(--ink-2); font-size: 11.5px; font-weight: 700;
}
@media (max-width: 860px) {
  /* On a phone the hero is too narrow to hold both the copy and standing characters. */
  .hero-cast { display: none; }
  .hero { min-height: 340px; }
  /* The story page has room for a pair behind the text, faded so it stays readable. */
  .story-hero { min-height: 380px; }
  .story-hero .hero-cast {
    display: flex; right: -14%; height: 62%; opacity: .9;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 34%);
    mask-image: linear-gradient(90deg, transparent 0, #000 34%);
  }
  .story-hero .hero-cast .hero-figure:nth-child(n+3) { display: none; }
  .story-hero .hero-inner { max-width: 74%; }
}

/* In-save warmth between two characters (never overwrites the canon note). */
.rel-warm { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.rel-warm em {
  font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, #fff); color: var(--accent-ink);
}
.rel-warm span { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rel-warm-track { flex: 1 1 auto; max-width: 130px; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; min-width: 70px; }
.rel-warm-bar { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, #fff), var(--accent)); }

/* ---------- stage directions in group chat ---------- */
.gchat-act {
  font-size: 12.5px; line-height: 1.6; color: var(--ink-3);
  font-style: italic; margin-bottom: 3px;
}
.gchat-line-act { font-size: 11.8px; color: rgba(255,255,255,.66); font-style: italic; }

@keyframes gchat-nod  { 0%,100% { transform: translateY(0); } 35% { transform: translateY(5px); } 65% { transform: translateY(2px); } }
@keyframes gchat-laugh{ 0%,100% { transform: translateY(0) rotate(0deg); } 28% { transform: translateY(-4px) rotate(-.7deg); } 58% { transform: translateY(-1px) rotate(.6deg); } }
@keyframes gchat-sigh { 0%,100% { transform: translateY(0) scale(1); } 45% { transform: translateY(4px) scale(.994); } }
@keyframes gchat-away { 0%,100% { transform: translateX(0) rotate(0deg); } 42% { transform: translateX(-7px) rotate(-.9deg); } }
@keyframes gchat-look { 0%,100% { transform: translateX(0); } 45% { transform: translateX(6px); } }
@keyframes gchat-step { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-9px); } }
@keyframes gchat-hand { 0%,100% { transform: translateY(0) rotate(0deg); } 34% { transform: translateY(-4px) rotate(.9deg); } }
@keyframes gchat-idle { 0%,100% { transform: translateY(0); } 50% { transform: translateY(2px); } }

.gchat-actor[data-act="nod"]   { animation: gchat-nod .95s var(--ease) 1; }
.gchat-actor[data-act="laugh"] { animation: gchat-laugh 1s var(--ease) 1; }
.gchat-actor[data-act="sigh"]  { animation: gchat-sigh 1.05s var(--ease) 1; }
.gchat-actor[data-act="away"]  { animation: gchat-away 1.1s var(--ease) 1; }
.gchat-actor[data-act="look"]  { animation: gchat-look 1s var(--ease) 1; }
.gchat-actor[data-act="step"]  { animation: gchat-step .9s var(--ease) 1; }
.gchat-actor[data-act="hand"]  { animation: gchat-hand .9s var(--ease) 1; }
.gchat-actor[data-act="idle"]  { animation: gchat-idle 1.1s var(--ease) 1; }

@media (prefers-reduced-motion: reduce) {
  .gchat-actor[data-act] { animation: none !important; }
}

/* ---------- story page: unit arcs ---------- */
.hero-goal {
  margin-top: 8px; font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,.9);
  padding-left: 10px; border-left: 2px solid rgba(255,255,255,.5);
}
.arc-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.arc-chip {
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-3);
  font-size: 12.5px; font-weight: 600; transition: all var(--fast);
}
.arc-chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.arc-chip.on { background: var(--accent); border-color: transparent; color: #fff; }
.arc-chip[data-unit="mmj"].on { background: #eda33f; }
.arc-chip[data-unit="vbs"].on { background: #e2556c; }
.arc-chip[data-unit="wxs"].on { background: #2fb7a6; }
.arc-chip[data-unit="n25"].on { background: #9579ca; }
.arc-chip[data-unit="vs"].on { background: #3aa8bd; }

/* ---------- profile: canon outline ---------- */
.canon-block {
  padding: 14px 16px; margin-bottom: 16px; border-radius: 16px;
  background: var(--accent-wash); border: 1px solid var(--line);
}
.canon-block h4 { font-size: 12.5px; color: var(--accent-ink); letter-spacing: .04em; margin-bottom: 8px; }
.canon-block.plain { background: #fff; border-style: dashed; }
.canon-block.plain .canon-beat:first-of-type { border-top: 0; margin-top: 0; padding-top: 2px; }
.canon-block p { font-size: 13.4px; line-height: 1.75; color: var(--ink-2); }
.canon-theme { margin-top: 4px; color: var(--ink-3); font-size: 12.5px; }
.canon-beat { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px dashed var(--line); margin-top: 6px; }
.canon-beat b { font-size: 12.8px; color: var(--ink); }
.canon-beat span { font-size: 12.6px; line-height: 1.7; color: var(--ink-2); }
