/* ==========================================================================
   theme-verdant.css — 翠星 accent candidate layer (story-vibe pass).
   Loaded AFTER theme-royal.css. Two story-driven shifts, everything else
   inherits the approved royal theme:

   1. Enemy surfaces: crimson → steel blue-grey. The story's enemies are
      people with coherent positions — not villains. Crimson read as "evil";
      cold steel reads as "another conviction".
   2. 翠星 emerald accent on story surfaces (chapter title card subtitle,
      victory title): the verdant star is the narrative's signature symbol.
      Kept quiet — the full emerald burst is reserved for the ch9 awakening.
   ========================================================================== */

/* --- 1. enemy surfaces: crimson → steel blue-grey ------------------------- */

.banner-enemy {
  background: linear-gradient(135deg, rgba(46, 60, 88, 0.96), rgba(24, 32, 50, 0.96));
  border: 1px solid #8fa3c8;
  color: #dce4f2;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  box-shadow:
    0 0 0 1px var(--royal-ink),
    inset 0 0 0 1px rgba(180, 200, 230, 0.24),
    0 6px 24px rgba(0, 0, 0, 0.45);
}

#phase-indicator.phase-enemy {
  color: #a8bce0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* enemy forecast / result panels: crimson → steel navy (same shadow system) */
.fe-panel--enemy {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 20%),
    var(--royal-tex),
    linear-gradient(155deg, #3a4a68 0%, #222c44 48%, #0e1424 100%) !important;
  background-blend-mode: normal, soft-light, normal;
  border-color: #8fa3c8 !important;
  box-shadow:
    0 0 0 1px var(--royal-ink),
    inset 0 0 0 1px rgba(180, 200, 230, 0.22),
    inset 0 12px 22px rgba(140, 160, 220, 0.06),
    0 4px 0 rgba(2, 6, 16, 0.72),
    0 10px 26px rgba(0, 0, 0, 0.68) !important;
}

/* --- 2. 翠星 emerald accent on story surfaces ----------------------------- */

/* Chapter title card subtitle: verdant glow instead of plain ivory-dim */
#chapter-title-sub {
  color: #b8e8cc;
  text-shadow: 0 0 14px rgba(88, 214, 164, 0.45), 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Victory panel title: the gilt keeps its gold but picks up a quiet emerald
   edge — victory in this story is always shadowed by cost. */
.fe-result-panel .fe-screen-title,
#victory-overlay .fe-screen-title {
  text-shadow: 0 1px 0 #1d1304, 0 0 18px rgba(246, 223, 160, 0.35), 0 0 30px rgba(88, 214, 164, 0.25);
}

/* ==========================================================================
   翠星手稿 manuscript pass — dialogue box (approved concept:
   demo/ui-manuscript/). Layered light, verdant vine divider + corner,
   serif display text, fused portrait, staggered entrance.
   ========================================================================== */

/* Manuscript palette tokens (mirror the concept board) */
#game-container {
  --ms-gold-hi: #f8e2a4;
  --ms-verdant: #58d6a4;
  --ms-verdant-hi: #9ff0cd;
  --ms-serif: 'Noto Serif TC', 'Songti TC', 'PMingLiU', serif;
}

@keyframes ms-panel-in {
  0% { opacity: 0; transform: translateY(14px) scale(0.985); }
  100% { opacity: 1; transform: none; }
}
@keyframes ms-ornament-in {
  0% { opacity: 0; scale: 0.86; }
  100% { opacity: 1; scale: 1; }
}

#dialogue-box {
  animation: ms-panel-in 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
  background:
    linear-gradient(180deg, rgba(248, 226, 164, 0.13), rgba(248, 226, 164, 0) 26%),
    linear-gradient(0deg, rgba(2, 6, 16, 0.55), rgba(2, 6, 16, 0) 34%),
    var(--royal-tex),
    linear-gradient(158deg, #234a86 0%, #0e2a52 46%, #061530 100%) !important;
  box-shadow:
    0 0 0 1px rgba(2, 7, 18, 0.9),
    inset 0 1px 0 rgba(248, 226, 164, 0.38),
    inset 0 0 0 1px rgba(248, 226, 164, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.65),
    0 14px 40px rgba(0, 0, 0, 0.6) !important;
}

/* verdant vine divider straddling the top edge, centred */
#dialogue-box::before {
  top: -30px;
  width: 280px;
  height: 60px;
  background: url('../assets/ui/vine-divider.png') center 0 / auto 60px no-repeat;
  animation: ms-ornament-in 0.8s 0.2s ease-out both;
}

/* compact vine corner on the top-right, star at the vertex */
#dialogue-box::after {
  top: -16px;
  right: -9px;
  width: 120px;
  height: 123px;
  /* asset is pre-flipped on disk — no CSS transform (an animation clobbered
     it once; transforms on decorated pseudos are not worth the fragility) */
  background: url('../assets/ui/corner-compact.png') top left / contain no-repeat;
  animation: ms-ornament-in 0.9s 0.25s ease-out both;
}

/* name tab → floating all-rounded gold nameplate */
#dialogue-name {
  border-radius: 4px;
}

/* serif dialogue text */
#dialogue-text {
  font-family: 'Noto Serif TC', 'Songti TC', 'PMingLiU', serif;
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* portrait: feather the bottom edge into the panel instead of a hard frame */
#portrait-canvas {
  border: 1px solid rgba(248, 226, 164, 0.35);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
}

/* hide ornaments on small/touch layouts (same conditions as the royal theme) */
@media (max-width: 900px), (max-height: 600px), (hover: none) and (pointer: coarse) {
  #dialogue-box::before,
  #dialogue-box::after {
    display: none;
  }
}

/* ==========================================================================
   Manuscript pass 1 — top bar
   Layered light (warm top sheen + bottom weight shadow), a whisper of
   verdant beneath the gold baseline, serif chapter name.
   ========================================================================== */

#top-bar {
  background:
    /* top-lit sheen: warm light falling from the top edge */
    linear-gradient(180deg, rgba(248, 226, 164, 0.10), rgba(248, 226, 164, 0) 55%),
    /* bottom weight shadow */
    linear-gradient(0deg, rgba(2, 6, 16, 0.45), rgba(2, 6, 16, 0) 40%),
    var(--royal-tex),
    linear-gradient(180deg, #1d4074 0%, #0b2349 60%, #071733 100%) !important;
  background-blend-mode: normal, normal, soft-light, normal;
  box-shadow:
    0 1px 0 rgba(248, 226, 164, 0.30),
    inset 0 -1px 0 rgba(2, 7, 18, 0.85),
    0 3px 12px rgba(0, 0, 0, 0.5) !important;
  /* position: absolute is inherited from style.css — do not override it;
     the ::after verdant line below anchors to this absolute bar */
}

/* a whisper of verdant beneath the gold baseline — the star is present but
   never competes with the gilt */
#top-bar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88, 214, 164, 0.55) 30%, rgba(88, 214, 164, 0.55) 70%, transparent);
  pointer-events: none;
}

/* chapter name → manuscript serif with gilt breath */
#chapter-name {
  font-family: var(--ms-serif);
  letter-spacing: 2px;
  color: var(--ms-gold-hi);
  text-shadow: 0 1px 0 #1d1304, 0 0 12px rgba(248, 226, 164, 0.22);
}

/* turn count in dim ivory — recedes behind the chapter name */
#turn-count { color: var(--royal-ivory-dim); }

/* ==========================================================================
   Manuscript pass 2 — action menu
   Sheen sweep on hover + left gold tick that unfurls downward.
   Two-line rich rows (icon + label + desc) stay untouched.
   ========================================================================== */

.menu-item {
  position: relative;
  overflow: hidden;
  transition: color 0.15s;
}

/* the sheen sweep — a warm light band sliding left → right on hover */
.menu-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(248, 226, 164, 0.16) 45%, rgba(248, 226, 164, 0.28) 50%, rgba(248, 226, 164, 0.16) 55%, transparent 80%);
  transform: translateX(-110%);
  transition: transform 0.45s cubic-bezier(0.3, 0.6, 0.3, 1);
  pointer-events: none;
  z-index: 1;
}

.menu-item:hover::before,
.menu-item.selected::before {
  transform: translateX(110%);
}

/* the left gold tick — unfurls from the top on hover */
.menu-item::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--ms-gold-hi);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.18s ease-out;
  pointer-events: none;
  z-index: 1;
}

.menu-item:hover::after,
.menu-item.selected::after {
  transform: scaleY(1);
}

/* lift the label above the sheen */
.menu-item > * {
  position: relative;
  z-index: 2;
}

/* keep the warm hover background; the tick replaces the static inset line */
.menu-item:hover,
.menu-item.selected {
  background: linear-gradient(90deg, rgba(216, 180, 95, 0.32), rgba(216, 180, 95, 0.12) 65%, rgba(216, 180, 95, 0.04));
  color: #fffbe8;
  box-shadow: none; /* the ::after tick takes over from the static inset line */
}

/* disabled rows stay quiet — no sweep, no tick */
.menu-item.disabled::before,
.menu-item.disabled::after {
  display: none;
}

/* ==========================================================================
   Manuscript pass 3 — chapter title card
   Large serif title with centering compensation, verdant subtitle, and
   verdant vine dividers above/below (replacing the royal flourish).
   ========================================================================== */

#chapter-title-text {
  font-family: var(--ms-serif);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 14px;
  padding-left: 14px;   /* letter-spacing trailing-space compensation → true centre */
  color: var(--ms-gold-hi);
  text-shadow: 0 2px 0 #1d1304, 0 0 26px rgba(248, 226, 164, 0.35);
  background: url('../assets/ui/vine-divider.png') top center / 340px no-repeat;
  padding: 52px 170px 0;
}

#chapter-title-sub {
  font-family: var(--ms-serif);
  font-size: 18px;
  letter-spacing: 6px;
  padding-left: 6px;    /* same compensation */
  color: var(--ms-verdant-hi);
  text-shadow: 0 0 16px rgba(88, 214, 164, 0.5);
  background: url('../assets/ui/vine-divider.png') bottom center / 340px no-repeat;
  padding: 0 170px 52px;
}

/* small/touch layouts: drop the vine flourishes (same media conditions as
   the royal theme's ornament rules) */
@media (max-width: 900px), (max-height: 600px), (hover: none) and (pointer: coarse) {
  #chapter-title-text,
  #chapter-title-sub {
    background: none;
    padding-left: 0;
    padding-right: 0;
  }
  #chapter-title-text { padding-top: 0; }
  #chapter-title-sub { padding-bottom: 0; }
}

/* ==========================================================================
   Manuscript pass 4 — overlay panels
   Unified layered-light recipe extracted from the dialogue box: warmer top
   sheen, deeper bottom weight shadow, softer radius. Applied to every major
   overlay panel. Victory + camp header pick up a quiet verdant star accent.
   ========================================================================== */

/* shared manuscript panel recipe — the dialogue box's light system, lifted
   into a reusable class for all overlays */
.ms-panel {
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(248, 226, 164, 0.13), rgba(248, 226, 164, 0) 26%),
    linear-gradient(0deg, rgba(2, 6, 16, 0.55), rgba(2, 6, 16, 0) 34%),
    var(--royal-tex),
    linear-gradient(158deg, #234a86 0%, #0e2a52 46%, #061530 100%) !important;
  background-blend-mode: normal, normal, soft-light, normal;
  box-shadow:
    0 0 0 1px rgba(2, 7, 18, 0.9),
    inset 0 1px 0 rgba(248, 226, 164, 0.38),
    inset 0 0 0 1px rgba(248, 226, 164, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.65),
    0 14px 40px rgba(0, 0, 0, 0.6) !important;
}

/* apply the manuscript panel to the major overlays (camp, victory, settings,
   status, confirm, trade, unit list, level-up, item-get) */
#camp-overlay > .fe-panel,
#victory-overlay > .fe-panel,
#settings-overlay > .fe-panel,
#status-screen > .fe-panel,
#confirm-overlay > .fe-panel,
#trade-overlay > .fe-panel,
#unit-list-box,
#level-up-screen,
#item-get-screen {
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(248, 226, 164, 0.13), rgba(248, 226, 164, 0) 26%),
    linear-gradient(0deg, rgba(2, 6, 16, 0.55), rgba(2, 6, 16, 0) 34%),
    var(--royal-tex),
    linear-gradient(158deg, #234a86 0%, #0e2a52 46%, #061530 100%) !important;
  background-blend-mode: normal, normal, soft-light, normal;
  box-shadow:
    0 0 0 1px rgba(2, 7, 18, 0.9),
    inset 0 1px 0 rgba(248, 226, 164, 0.38),
    inset 0 0 0 1px rgba(248, 226, 164, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.65),
    0 14px 40px rgba(0, 0, 0, 0.6) !important;
}

/* victory title — the gilt keeps its gold but picks up a quiet emerald edge;
   victory in this story is always shadowed by cost */
#victory-overlay .fe-screen-title {
  text-shadow: 0 1px 0 #1d1304, 0 0 18px rgba(246, 223, 160, 0.35), 0 0 30px rgba(88, 214, 164, 0.25) !important;
}

/* camp header — a whisper of verdant on the gilt */
#camp-header {
  text-shadow: 0 1px 0 #1d1304, 0 0 14px rgba(248, 226, 164, 0.28), 0 0 24px rgba(88, 214, 164, 0.18) !important;
}

/* ==========================================================================
   Manuscript pass 5 — entrance motion
   Panels enter with the manuscript curve (0.45s cubic-bezier(0.2,0.9,0.25,1.15));
   their filigree corners bloom 0.2–0.25s later at 0.8–0.9s, staggered like
   the dialogue box. Panels with existing entrance animations keep them.
   ========================================================================== */

/* unified panel entrance — overlays that currently pop in with no animation */
#settings-overlay > .fe-panel,
#confirm-overlay > .fe-panel,
#unit-list-box,
#trade-overlay > .fe-panel,
#status-screen > .fe-panel {
  animation: ms-panel-in 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

/* filigree corners bloom after the panel body — map menu / unit list / trade
   / settings / status / confirm / level-up / item-get / result / promo */
#map-menu-box::before,
#map-menu-box::after,
#unit-list-box::before,
#unit-list-box::after,
#unit-list-box .fe-heading::before,
#unit-list-box .fe-heading::after,
#trade-overlay > .fe-panel::before,
#trade-overlay > .fe-panel::after,
#trade-overlay .fe-heading::before,
#trade-overlay .fe-heading::after,
#settings-overlay > .fe-panel::before,
#settings-overlay > .fe-panel::after,
#settings-overlay .fe-heading::before,
#settings-overlay .fe-heading::after,
#status-screen > .fe-panel::before,
#status-screen > .fe-panel::after,
#confirm-overlay > .fe-panel::before,
#confirm-overlay > .fe-panel::after,
#level-up-screen::before,
#level-up-screen::after,
#item-get-screen::before,
#item-get-screen::after,
.fe-result-panel::before,
.fe-result-panel::after,
#promo-showcase::before,
#promo-showcase::after {
  animation: ms-ornament-in 0.85s 0.22s ease-out both;
}
