@layer base, layout, components, skills, motion, utilities;

:root {
  color-scheme: dark;

  /* Warm Storybook Twilight & Golden Parchment Palette */
  --bg: #15100b;
  --sheet-top: #231b13;
  --sheet-bg: #17120d;
  --surface: #271e16;
  --surface-elev: #33271d;
  --surface-soft: #201812;
  --surface-well: #120d09;
  --surface-glass: rgba(25, 19, 13, 0.62);

  --border: rgba(255, 236, 204, 0.09);
  --border-strong: rgba(255, 232, 188, 0.19);
  --border-gold: rgba(246, 207, 124, 0.44);
  --divider: rgba(255, 238, 208, 0.075);

  --ink: #fff8ed;
  --ink-soft: #eadcc8;
  --ink-muted: #c2b19a;
  --ink-dim: #96846f;

  --gold: #f0b94f;
  --gold-bright: #fde39d;
  --gold-soft: rgba(240, 185, 79, 0.16);
  --emerald: #4ade97;
  --emerald-soft: rgba(74, 222, 151, 0.16);
  --crimson: #f26c6c;
  --crimson-soft: rgba(242, 108, 108, 0.16);
  --sky: #74c4ff;
  --sky-soft: rgba(116, 196, 255, 0.16);
  --ember: #fb9848;
  --ember-soft: rgba(251, 152, 72, 0.16);
  --violet: #c59cff;
  --violet-soft: rgba(197, 156, 255, 0.16);

  /* Backward-compatible aliases */
  --brass: var(--gold);
  --brass-bright: var(--gold-bright);
  --brass-soft: var(--gold-soft);
  --border-brass: var(--border-gold);

  /* Dynamic per-skill atmosphere */
  --skill-accent: #4ade97;
  --skill-accent-soft: rgba(74, 222, 151, 0.18);

  /* Typography */
  --font-display: "Songti SC", "STSong", "Noto Serif SC", "FandolSong", "Source Han Serif CN", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Source Han Sans CN", sans-serif;

  /* Motion */
  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-crisp: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur-mid: 260ms;
  --dur-sheet: 320ms;

  /* Geometry */
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --hud-h: 52px;
  --nav-h: 74px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  accent-color: var(--gold);
  scrollbar-color: rgba(255, 232, 190, 0.22) transparent;
}

@layer base {
  *, *::before, *::after {
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.44;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    min-height: 100dvh;
  }

  input, textarea {
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
    caret-color: var(--gold-bright);
  }

  ::selection {
    background: rgba(240, 185, 79, 0.32);
    color: var(--ink);
  }

  button, input, textarea {
    font: inherit;
    color: inherit;
  }

  button:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
  }

  img {
    display: block;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
  }
}

@layer layout {
  .app-shell {
    max-width: 480px;
    margin-inline: auto;
    min-height: 100dvh;
    background: var(--sheet-bg);
    display: flex;
    flex-direction: column;
    position: relative;
  }

  /* Floating Glass HUD over Full-Bleed Storybook Panoramas */
  .top-hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin-inline: auto;
    width: 100%;
    max-width: 480px;
    z-index: 35;
    padding-top: var(--safe-top);
    height: calc(var(--hud-h) + var(--safe-top));
    background: linear-gradient(180deg, rgba(18, 13, 9, 0.68) 0%, rgba(18, 13, 9, 0.16) 76%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-inline: 12px;
    transition: background var(--dur-mid) ease, border-color var(--dur-mid) ease;
    border-bottom: 1px solid transparent;
  }
  .top-hud.scrolled {
    background: rgba(23, 18, 13, 0.90);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom-color: rgba(255, 235, 200, 0.12);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.36);
  }

  /* Main Viewport: Zero top/side padding so Panoramas bleed edge-to-edge */
  .main-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 0 calc(var(--nav-h) + var(--safe-bottom) + 18px);
  }

  /* Floating Storybook Island Navigation */
  .bottom-nav {
    position: fixed;
    bottom: calc(10px + var(--safe-bottom));
    left: 12px;
    right: 12px;
    margin-inline: auto;
    width: calc(100% - 24px);
    max-width: 456px;
    z-index: 40;
    height: 60px;
    padding: 4px 6px;
    border-radius: 999px;
    background: rgba(34, 26, 19, 0.90);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 236, 200, 0.18);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(255, 240, 212, 0.14);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
  }
}

@layer components {
  .ui-svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }
  .ui-svg.sm { width: 14px; height: 14px; }
  .ui-svg.xs { width: 12px; height: 12px; }
  .num { font-variant-numeric: tabular-nums; }
  .display-font { font-family: var(--font-display); }

  /* Floating Top HUD Glass Capsules */
  .hud-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
  }
  .hud-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 3px 9px 3px 3px;
    border-radius: 999px;
    background: rgba(26, 19, 13, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 234, 192, 0.24);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 244, 220, 0.14);
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--dur-fast) var(--ease-out-expo), border-color var(--dur-fast);
  }
  .hud-hero-btn:active { transform: scale(0.95); }
  .hud-hero-crest {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(250, 212, 128, 0.34), rgba(24, 18, 12, 0.92));
    border: 1px solid rgba(250, 212, 128, 0.56);
    color: var(--gold-bright);
    display: grid;
    place-items: center;
    overflow: hidden;
    flex-shrink: 0;
  }
  .hud-hero-crest img { width: 17px; height: 17px; object-fit: contain; }
  .hud-hero-meta {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    max-width: 72px;
    overflow: hidden;
  }
  .hud-hero-name {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hud-hero-lvl {
    font-size: 11px;
    font-weight: 800;
    color: var(--gold-bright);
    flex-shrink: 0;
  }
  .hud-active-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: rgba(24, 38, 28, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(74, 222, 151, 0.52);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .hud-active-pill[hidden], .hud-active-text[hidden] { display: none; }
  .hud-active-pill:active { transform: scale(0.93); }
  .status-ring {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ink-dim);
    border: 1.5px solid #17120d;
  }
  .status-ring.running {
    background: var(--emerald);
  }
  .hud-icon { width: 18px; height: 18px; flex-shrink: 0; }
  .hud-icon[hidden] { display: none; }
  .hud-metrics {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
  }
  .hud-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(26, 19, 13, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 234, 192, 0.20);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
    font-size: 11.5px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
  }
  .hud-stat.gold { color: var(--gold-bright); }
  .hud-stat.hp { color: #ffa3a3; }
  .hud-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 234, 192, 0.20);
    background: rgba(26, 19, 13, 0.70);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
    color: var(--ink-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--dur-fast) var(--ease-out-expo), border-color var(--dur-fast), color var(--dur-fast);
  }
  .hud-icon-btn:active { transform: scale(0.92); }
  .hud-icon-btn:hover { border-color: var(--border-gold); color: var(--gold-bright); }

  /* Floating Island Navigation Sliding Medallion */
  .nav-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 6px;
    width: calc((100% - 12px) / 5);
    pointer-events: none;
    transition: transform var(--dur-mid) var(--ease-out-expo);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .nav-indicator::after {
    content: "";
    width: 92%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(248, 206, 118, 0.22), rgba(226, 164, 56, 0.11));
    border: 1px solid rgba(250, 214, 132, 0.36);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 246, 222, 0.22);
  }
  .nav-btn {
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 50px;
    color: var(--ink-dim);
    cursor: pointer;
    transition: color var(--dur-fast), transform var(--dur-fast) var(--ease-out-expo);
  }
  .nav-btn:active { transform: scale(0.92); }
  .nav-btn.active { color: var(--gold-bright); }
  .nav-img {
    width: 21px;
    height: 21px;
    opacity: 0.56;
    filter: saturate(0.55);
    transition: opacity var(--dur-fast), filter var(--dur-fast), transform var(--dur-mid) var(--ease-crisp);
  }
  .nav-btn.active .nav-img {
    opacity: 1;
    filter: saturate(1.18) drop-shadow(0 2px 8px rgba(246, 207, 124, 0.35));
    transform: translateY(-1px) scale(1.08);
  }
  .nav-lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.01em; }

  /* ============================================================
     STORYBOOK FULL-BLEED PANORAMA STAGE & RISING PARCHMENT SHEET
     ============================================================ */
  .panorama-stage {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #211810;
    background-size: cover;
    background-position: center 24%;
    flex-shrink: 0;
  }
  .panorama-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 92% 145px at 50% 24%, color-mix(in srgb, var(--skill-accent) 18%, rgba(255, 224, 148, 0.20)), transparent 66%),
      linear-gradient(180deg, rgba(20, 14, 9, 0.44) 0%, rgba(20, 14, 9, 0.08) 32%, rgba(23, 18, 13, 0.24) 68%, var(--sheet-bg) 100%);
    pointer-events: none;
    z-index: 1;
  }
  .panorama-stage.shop-panorama::before {
    background:
      radial-gradient(ellipse 90% 130px at 30% 30%, rgba(24, 17, 11, 0.52), transparent 72%),
      linear-gradient(180deg, rgba(20, 14, 9, 0.62) 0%, rgba(20, 14, 9, 0.44) 44%, rgba(23, 18, 13, 0.72) 82%, var(--sheet-bg) 100%);
  }
  .panorama-stage.combat-panorama::before {
    background:
      radial-gradient(ellipse 85% 110px at 50% 84%, rgba(16, 12, 8, 0.72), transparent 68%),
      linear-gradient(180deg, rgba(18, 13, 9, 0.56) 0%, rgba(18, 13, 9, 0.14) 36%, rgba(18, 13, 9, 0.34) 72%, var(--sheet-bg) 100%);
  }
  .ambient-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
  }
  .panorama-inner {
    position: relative;
    z-index: 4;
    height: 100%;
    padding: calc(var(--hud-h) + var(--safe-top) + 4px) 14px 34px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  /* Strict Fixed Heights -> ZERO Layout Shift on Start / Stop / Switch! */
  .play-panorama {
    height: calc(330px + var(--safe-top));
  }
  .combat-panorama {
    height: calc(368px + var(--safe-top));
  }
  .compact-panorama {
    height: calc(206px + var(--safe-top));
  }
  .compact-panorama .panorama-inner {
    padding-bottom: 32px;
    justify-content: flex-end;
    gap: 10px;
  }

  /* Floating Glass Controls inside Panorama */
  .pano-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 34px;
  }
  .skill-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 11px 0 7px;
    border-radius: 999px;
    background: rgba(24, 18, 12, 0.62);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 238, 206, 0.24);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out-expo), border-color var(--dur-fast);
  }
  .skill-switch-btn:active { transform: scale(0.95); }
  .skill-switch-btn .lvl-tag {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--gold-bright);
  }

  .pano-hero-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 5px;
  }
  .pano-subject-orb {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: none;
    padding: 0;
    position: relative;
    display: grid;
    place-items: center;
    background: radial-gradient(circle, rgba(255, 246, 214, 0.24) 0%, color-mix(in srgb, var(--skill-accent) 16%, rgba(20, 14, 9, 0.38)) 58%, transparent 74%);
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.52));
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .pano-subject-orb:active { transform: scale(0.92); }
  .pano-subject-orb.running {
    animation: orbBreathe 2.8s ease-in-out infinite;
  }
  .pano-ring-svg {
    position: absolute;
    inset: 0;
    width: 96px;
    height: 96px;
    transform: rotate(-90deg);
    pointer-events: none;
  }
  .pano-ring-track {
    fill: rgba(18, 13, 9, 0.32);
    stroke: rgba(255, 242, 212, 0.18);
    stroke-width: 2.5;
  }
  .pano-ring-prog {
    fill: none;
    stroke: var(--skill-accent);
    stroke-width: 3.5;
    stroke-linecap: round;
  }
  .pano-subject-orb img {
    width: 62px;
    height: 62px;
    position: relative;
    z-index: 1;
    will-change: transform;
  }
  .pano-rate-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(18, 13, 9, 0.62);
    border: 1px solid rgba(255, 238, 206, 0.16);
    color: var(--gold-bright);
    font-size: 11px;
    font-weight: 800;
  }
  .pano-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    color: #fffbf2;
    letter-spacing: 0.02em;
    line-height: 1.15;
    text-shadow: 0 3px 14px rgba(0, 0, 0, 0.85);
    max-width: 92%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pano-sub {
    font-size: 12px;
    font-weight: 700;
    color: #f4e6cf;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
    min-height: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 94%;
  }

  .pano-bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    padding-inline: 4px;
  }
  .pano-xp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: #f3e4cc;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.9);
  }

  /* Rising Warm Parchment Scroll Sheet */
  .story-sheet {
    position: relative;
    z-index: 6;
    margin-top: -22px;
    border-radius: 26px 26px 0 0;
    background: linear-gradient(180deg, var(--sheet-top) 0%, var(--sheet-bg) 160px);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 236, 200, 0.22);
    padding: 14px 13px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
  }

  /* Active Buff Ribbon inside Story Sheet (Compact, Zero Dead Space) */
  .stage-buff-bar {
    min-height: 32px;
    padding: 4px 6px 4px 10px;
    border-radius: 14px;
    background: rgba(16, 12, 8, 0.56);
    border: 1px solid rgba(255, 236, 200, 0.08);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .stage-buff-track {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 92%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 92%, transparent 100%);
    padding-right: 10px;
  }
  .stage-buff-track::-webkit-scrollbar { display: none; }
  .stage-buff-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(74, 222, 151, 0.13);
    border: 1px solid rgba(74, 222, 151, 0.28);
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .stage-buff-chip:active { transform: scale(0.95); }
  .stage-buff-chip .sb-num { color: #8af5c0; font-weight: 800; }
  .stage-buff-chip .sb-lbl { color: var(--ink-soft); font-weight: 600; }
  .stage-buff-empty {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-dim);
    white-space: nowrap;
  }
  .stage-buff-all {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(255, 240, 214, 0.07);
    border: 1px solid rgba(255, 236, 204, 0.12);
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
  }
  .stage-buff-all:active { transform: scale(0.94); }
  .stage-buff-all .sb-cnt { color: var(--gold-bright); font-weight: 800; }

  /* Quick Skill Pill Ribbon */
  .skill-dock {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 36px;
  }
  .dock-all-btn {
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(246, 207, 124, 0.42);
    background: linear-gradient(180deg, rgba(246, 207, 124, 0.20), rgba(240, 185, 79, 0.10));
    color: var(--gold-bright);
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .dock-all-btn:active { transform: scale(0.94); }
  .dock-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
  }
  .dock-pills::-webkit-scrollbar { display: none; }
  .dock-chip {
    flex: 0 0 auto;
    height: 34px;
    padding: 0 11px;
    border-radius: 999px;
    background: rgba(255, 244, 224, 0.06);
    border: 1px solid transparent;
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out-expo), background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  }
  .dock-chip:active { transform: scale(0.95); }
  .dock-chip.active {
    background: #3a2c1e;
    border-color: color-mix(in srgb, var(--skill-accent) 60%, var(--gold));
    color: var(--ink);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.26);
  }
  .dock-chip .run-pip {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--emerald);
  }

  /* Storybook Section Heading */
  .story-sec-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 2px 0;
  }
  .story-sec-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 800;
    color: #fff6e6;
    letter-spacing: 0.02em;
  }
  .story-sec-meta {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--ink-muted);
  }

  /* Legacy Scene Stage (used in secondary banners if any) */
  .scene-stage {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--surface);
    background-size: cover;
    background-position: center;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 238, 206, 0.16);
  }
  .scene-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(20, 15, 10, 0.34) 0%, rgba(20, 15, 10, 0.72) 60%, rgba(18, 14, 10, 0.92) 100%);
    pointer-events: none;
  }
  .scene-inner {
    position: relative;
    z-index: 2;
    padding: 13px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .stage-mid {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .stage-emblem {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: radial-gradient(circle at 50% 42%, rgba(255, 240, 204, 0.16), rgba(18, 13, 9, 0.74));
    border: 1px solid rgba(255, 236, 204, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 244, 220, 0.16);
    cursor: pointer;
    padding: 0;
  }
  .stage-emblem img { width: 42px; height: 42px; }
  .stage-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
  .stage-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    margin: 0;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .stage-sub {
    font-size: 12px;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Float Juice, Leaf/Spark Burst & Slash Layer */
  .juice-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 8;
  }
  .float-pop {
    position: absolute;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.92);
    white-space: nowrap;
    will-change: transform, opacity;
    animation: floatUp 940ms var(--ease-out-expo) forwards;
  }
  .float-pop.xp { color: #a5e6ff; }
  .float-pop.item { color: #fef08a; }
  .float-pop.dmg-p {
    font-family: var(--font-display);
    color: #fef08a;
    font-size: 21px;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.96);
  }
  .float-pop.dmg-e { color: #ff8e8e; font-size: 16px; }
  .float-pop.heal { color: #7ef5bc; font-size: 15px; }
  .float-pop.miss { color: var(--ink-muted); font-size: 12.5px; }

  .fx-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 100% 0 100% 0;
    pointer-events: none;
    will-change: transform, opacity;
    animation: particleBurst 600ms var(--ease-out-expo) forwards;
  }
  .slash-arc {
    position: absolute;
    width: 72px;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, #fffbe2, #fde047, transparent);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
    pointer-events: none;
    animation: slashSweep 290ms var(--ease-out-expo) forwards;
  }

  /* Smooth 60fps Progress Bars + Souls-like Delayed Damage Bar */
  .bar-track {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: rgba(12, 8, 5, 0.64);
    border: 1px solid rgba(255, 240, 212, 0.14);
    overflow: hidden;
    position: relative;
  }
  .bar-track.lg { height: 9px; }
  .bar-track.xs { height: 4px; border: none; background: rgba(255, 244, 224, 0.11); }
  .bar-delay {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    background: #fff4d6;
    opacity: 0.9;
    transition: width 520ms cubic-bezier(0.22, 1, 0.36, 1) 180ms;
    z-index: 1;
  }
  .bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--skill-accent), color-mix(in srgb, var(--skill-accent) 60%, #fef08a));
    position: relative;
    z-index: 2;
    will-change: width;
  }
  .bar-fill.gpu-bar {
    width: 100%;
    transform-origin: left center;
    will-change: transform;
  }
  .bar-fill.xp { background: linear-gradient(90deg, #38bdf8, #a5f3fc); box-shadow: none; }
  .bar-fill.hp { background: linear-gradient(90deg, #dc2626, #fb7185); box-shadow: none; transition: width 120ms ease-out; }
  .bar-fill.enemy { background: linear-gradient(90deg, #f59e0b, #fde047); box-shadow: none; transition: width 120ms ease-out; }
  .bar-fill.gold { background: linear-gradient(90deg, #d99322, #fde39d); box-shadow: none; }
  .bar-marker {
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 2px;
    z-index: 3;
    background: #fff7db;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.95);
  }

  /* Warm Storybook Pill Buttons */
  .btn {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 236, 204, 0.14);
    background: linear-gradient(180deg, #36291e, #261d15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 242, 218, 0.10);
    color: var(--ink);
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform var(--dur-fast) var(--ease-out-expo), background var(--dur-fast), border-color var(--dur-fast), filter var(--dur-fast);
  }
  .btn:active:not(:disabled) { transform: scale(0.94); }
  .btn:disabled { opacity: 0.36; cursor: not-allowed; box-shadow: none; }
  .btn.primary {
    background: linear-gradient(180deg, color-mix(in srgb, var(--skill-accent) 92%, white), color-mix(in srgb, var(--skill-accent) 78%, #0c2618));
    color: #081e12;
    border-color: rgba(255, 255, 255, 0.20);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.34);
  }
  .btn.accent {
    background: linear-gradient(180deg, #433220, #2e2216);
    color: var(--gold-bright);
    border-color: rgba(246, 207, 124, 0.42);
  }
  .btn.gold {
    background: linear-gradient(180deg, #fce08b, #d89020);
    color: #211202;
    border-color: rgba(255, 246, 216, 0.38);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 252, 238, 0.48);
  }
  .btn.danger {
    background: linear-gradient(180deg, #542826, #3d1c1b);
    color: #ffd0cc;
    border-color: rgba(248, 113, 113, 0.36);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
  }
  .btn.sm { min-height: 32px; padding: 0 13px; font-size: 12px; }
  .btn.fixed-w { min-width: 68px; }
  .btn.ghost-slot { visibility: hidden; pointer-events: none; }
  .btn.full { width: 100%; }

  .speed-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 34px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid rgba(255, 238, 204, 0.24);
    background: rgba(24, 18, 12, 0.62);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--gold-bright);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .speed-pill:active { transform: scale(0.93); }
  .speed-pill.boosted {
    border-color: rgba(250, 204, 21, 0.62);
    background: rgba(68, 46, 14, 0.78);
    color: #fef08a;
  }

  /* Horizontal Sub-Category Ribbon */
  .chip-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-block: 1px;
  }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 242, 218, 0.06);
    border: 1px solid transparent;
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform var(--dur-fast) var(--ease-out-expo), background var(--dur-fast), color var(--dur-fast);
  }
  .chip:active { transform: scale(0.95); }
  .chip.active {
    background: #3d2e20;
    border-color: rgba(246, 207, 124, 0.45);
    color: var(--ink);
  }

  /* Segmented Control (Warm Storybook Sliding Pill) */
  .seg-bar {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--seg-n, 2), 1fr);
    padding: 3px;
    border-radius: 999px;
    background: rgba(15, 11, 8, 0.68);
    border: 1px solid rgba(255, 236, 204, 0.09);
  }
  .seg-pill {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc((100% - 6px) / var(--seg-n, 2));
    border-radius: 999px;
    background: linear-gradient(180deg, #3c2e21, #2c2117);
    border: 1px solid rgba(246, 207, 124, 0.34);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 242, 214, 0.14);
    transform: translateX(calc(var(--seg-idx, 0) * 100%));
    transition: transform var(--dur-mid) var(--ease-out-expo);
    pointer-events: none;
  }
  .seg-btn {
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    height: 34px;
    border-radius: 999px;
    color: var(--ink-muted);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    padding-inline: 6px;
    transition: color var(--dur-fast);
  }
  .seg-btn.active { color: #fff8ea; font-weight: 800; }
  .seg-tag {
    font-size: 10px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(74, 222, 151, 0.22);
    color: #86efac;
  }

  /* Unified Warm Storybook Card & Ledger */
  .ledger {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 240, 212, 0.08);
  }
  .ledger-row {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--divider);
    transition: background var(--dur-fast);
  }
  .ledger-row:last-child { border-bottom: none; }
  .ledger-row.running {
    background: linear-gradient(90deg, color-mix(in srgb, var(--skill-accent) 18%, var(--surface)) 0%, var(--surface) 78%);
  }
  .ledger-row.locked { opacity: 0.56; }

  .art-frame {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: radial-gradient(circle at 50% 38%, rgba(255, 240, 206, 0.16), rgba(16, 12, 8, 0.48));
    box-shadow: inset 0 1px 0 rgba(255, 244, 222, 0.10), 0 4px 10px rgba(0, 0, 0, 0.22);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .art-frame:active { transform: scale(0.93); }
  .art-frame img { width: 35px; height: 35px; }

  .row-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .row-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 11.5px;
    color: var(--ink-muted);
    margin-top: 3px;
  }

  /* Compact Soft Badges */
  .pill-stat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 242, 220, 0.08);
    color: var(--ink-soft);
    border: none;
  }
  .pill-stat.gold { background: var(--gold-soft); color: var(--gold-bright); }
  .pill-stat.ok { background: var(--emerald-soft); color: #8af5c0; }
  .pill-stat.bad { background: var(--crimson-soft); color: #ffaaa8; }
  .pill-stat.sky { background: var(--sky-soft); color: #9ad8ff; }
  .pill-stat.ember { background: var(--ember-soft); color: #ffc085; }
  .pill-stat.violet { background: var(--violet-soft); color: #d8beff; }
  .pill-stat.btn-pill { cursor: pointer; background: rgba(255, 242, 220, 0.11); color: var(--ink); }

  /* Clickable Inline Item Chip */
  .item-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 5px;
    border-radius: 999px;
    background: rgba(16, 12, 8, 0.44);
    border: 1px solid rgba(255, 238, 206, 0.08);
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    max-width: 100%;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .item-chip:active { transform: scale(0.95); }
  .item-chip.ok { border-color: rgba(74, 222, 151, 0.34); color: #9ef5c8; }
  .item-chip.bad { border-color: rgba(242, 108, 108, 0.32); color: #ffb3b3; }

  .section-label {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 800;
    color: #f3e4cc;
    letter-spacing: 0.03em;
    padding: 4px 2px 0;
  }

  .search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(15, 11, 8, 0.62);
    border: 1px solid rgba(255, 236, 204, 0.12);
    color: var(--ink-muted);
  }
  .search-wrap:focus-within { border-color: var(--border-gold); color: var(--gold-bright); }
  .search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--ink);
    font-size: 13.5px;
    outline: none;
    min-width: 0;
  }
  .search-input::placeholder { color: var(--ink-dim); }
}

/* ============================================================
   BESPOKE STORYBOOK SKILL VIEWS, COMBAT, QUESTS, BANK & SHOP
   ============================================================ */
@layer skills {
  /* Storybook Row Cards (Woodcutting, Mining, Fishing, Firemaking, Cooking, Herblore, Thieving, Hunting, Astrology) */
  .story-card-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
  }
  .story-row-card {
    border-radius: var(--radius-md);
    padding: 11px 12px;
    background: var(--surface);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 240, 212, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .story-row-card.running {
    background: linear-gradient(135deg, color-mix(in srgb, var(--skill-accent) 22%, #241d16) 0%, #271e16 68%);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34), inset 0 0 0 1.5px color-mix(in srgb, var(--skill-accent) 68%, white);
  }
  .story-row-card.locked {
    background: rgba(34, 26, 19, 0.56);
    opacity: 0.62;
    box-shadow: none;
  }

  /* Compact 2-Column Grid for Locked / Ranch / Mini Items */
  .grove-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }
  .grove-card, .vein-card {
    border-radius: var(--radius-md);
    padding: 11px;
    background: var(--surface);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 240, 212, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .grove-card.running, .vein-card.running {
    background: linear-gradient(135deg, color-mix(in srgb, var(--skill-accent) 20%, #241d16), #271e16 70%);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32), inset 0 0 0 1.5px color-mix(in srgb, var(--skill-accent) 65%, white);
  }
  .grove-card.locked, .vein-card.locked {
    background: rgba(34, 26, 19, 0.52);
    opacity: 0.62;
    box-shadow: none;
  }
  .grove-top { display: flex; align-items: center; gap: 9px; min-width: 0; }

  .hp-pips { display: flex; gap: 3px; align-items: center; }
  .hp-pip {
    width: 12px;
    height: 4px;
    border-radius: 999px;
    background: var(--skill-accent);
    transition: opacity 160ms;
  }
  .hp-pip.dim { opacity: 0.18; box-shadow: none; }

  .stability-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-muted);
  }
  .catch-strip, .flow-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .flow-arrow {
    color: var(--gold-bright);
    font-weight: 900;
    font-size: 13px;
  }

  /* Workshop Forge Bench & 3-Col Blueprint Tiles */
  .forge-bench {
    border-radius: var(--radius-md);
    padding: 13px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--skill-accent) 14%, #2b2118), #231b14 75%);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 240, 212, 0.14);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .forge-stats-strip { display: flex; flex-wrap: wrap; gap: 6px; }
  .bp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .bp-tile {
    position: relative;
    border-radius: 16px;
    border: none;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 240, 212, 0.06);
    padding: 12px 6px 9px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .bp-tile:active { transform: scale(0.95); }
  .bp-tile.selected {
    background: #36281c;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32), inset 0 0 0 1.5px var(--gold);
  }
  .bp-tile.running {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32), inset 0 0 0 1.5px var(--skill-accent);
  }
  .bp-tile.locked { opacity: 0.48; }
  .bp-lvl {
    position: absolute;
    top: 5px;
    left: 7px;
    font-size: 9.5px;
    font-weight: 800;
    color: var(--ink-dim);
  }
  .bp-ready-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--emerald);
  }
  .bp-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-soft);
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Potion / Astrology Effect Capsules (Replacing Plain Text Banners) */
  .effect-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }
  .effect-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--skill-accent) 14%, rgba(16, 12, 8, 0.55));
    color: color-mix(in srgb, var(--skill-accent) 70%, white);
    font-size: 11.5px;
    font-weight: 700;
  }

  /* Agility Illustrated Expedition Trail (Zero Plain-Text #1 Boxes!) */
  .course-rail {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 16px;
  }
  .course-rail::before {
    content: "";
    position: absolute;
    left: 24px;
    top: 24px;
    bottom: 24px;
    width: 2px;
    background: linear-gradient(180deg, rgba(45, 212, 191, 0.55), rgba(246, 207, 124, 0.20));
    border-radius: 999px;
  }
  .obstacle-node {
    position: relative;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 240, 212, 0.08);
  }
  .obstacle-node.running {
    background: linear-gradient(135deg, rgba(22, 66, 62, 0.85), var(--surface) 70%);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34), inset 0 0 0 1.5px #2dd4bf;
  }
  .obstacle-node.locked { opacity: 0.58; }
  .course-medallion {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%, rgba(45, 212, 191, 0.30), rgba(16, 12, 8, 0.86));
    border: 1.5px solid rgba(45, 212, 191, 0.50);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #99f6e4;
    font-weight: 900;
    font-size: 12px;
    position: relative;
    z-index: 2;
  }

  /* Farming Illustrated Soil Plots */
  .farm-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .plot-card {
    border-radius: var(--radius-md);
    padding: 12px;
    background:
      radial-gradient(ellipse 90% 50px at 50% 100%, rgba(120, 82, 42, 0.24), transparent 72%),
      var(--surface);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 240, 212, 0.08);
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 126px;
    justify-content: space-between;
  }
  .plot-card.ready {
    background:
      radial-gradient(ellipse 90% 70px at 50% 0%, rgba(250, 204, 21, 0.22), transparent 68%),
      linear-gradient(160deg, #2b3822, #261e16 74%);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32), inset 0 0 0 1.5px rgba(250, 204, 21, 0.56);
  }
  .plot-empty-art {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .plot-soil-ico {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(16, 11, 7, 0.52);
    border: 1px dashed rgba(246, 207, 124, 0.28);
    display: grid;
    place-items: center;
    color: #a99174;
    flex-shrink: 0;
  }

  /* ============================================================
     COMBAT PANORAMA THEATER (Option B Grounded Duel + Delayed HP)
     ============================================================ */
  .cb-dual-hp {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .cb-hp-card {
    padding: 8px 10px;
    border-radius: 15px;
    background: rgba(20, 15, 10, 0.66);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 238, 206, 0.18);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.30);
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .cb-hp-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 800;
  }
  .cb-hp-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink);
  }
  .cb-hp-meta {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--ink-muted);
    display: flex;
    justify-content: space-between;
  }

  .cb-floor {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: flex-end;
    justify-items: center;
    padding: 0 2px 2px;
    min-height: 126px;
  }
  .cb-vs-crest {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    margin-bottom: 34px;
    background: rgba(24, 17, 11, 0.72);
    border: 1px solid rgba(246, 207, 124, 0.42);
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 900;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.44);
  }
  .cb-actor {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
  }
  .cb-actor-btn {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    position: relative;
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .cb-actor-btn:active { transform: scale(0.93); }
  .cb-actor-sprite {
    width: 90px;
    height: 90px;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.62));
    will-change: transform, filter;
    animation: actorIdle 3.1s ease-in-out infinite;
  }
  .cb-actor-sprite.hero-avatar-full {
    width: 108px;
    height: 108px;
    animation: heroIdle 2.9s ease-in-out infinite;
  }
  .cb-weapon-badge {
    position: absolute;
    left: 2px;
    bottom: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(20, 14, 9, 0.84);
    border: 1px solid rgba(246, 207, 124, 0.48);
    display: grid;
    place-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.46);
  }
  .ground-shadow {
    width: 78px;
    height: 14px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.56);
    filter: blur(4px);
    margin-top: -10px;
    pointer-events: none;
  }
  .combat-tactics-tray {
    border-radius: 20px;
    padding: 10px;
    background: rgba(16, 12, 8, 0.48);
    border: 1px solid rgba(255, 238, 206, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .wave-pips { display: inline-flex; gap: 3px; align-items: center; }
  .wave-pip { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.24); }
  .wave-pip.done { background: var(--emerald); }
  .wave-pip.now { background: var(--gold-bright); transform: scale(1.2); }

  .combat-xp-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .cb-xp-chip {
    border-radius: 12px;
    padding: 6px 7px;
    background: rgba(16, 12, 8, 0.52);
    border: 1px solid rgba(255, 236, 204, 0.08);
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .cb-xp-chip.training {
    background: rgba(246, 207, 124, 0.12);
    border-color: rgba(246, 207, 124, 0.36);
  }
  .cb-xp-chip.hp-sub {
    background: rgba(242, 108, 108, 0.11);
    border-color: rgba(242, 108, 108, 0.30);
  }
  .cb-xp-top { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; font-weight: 700; }
  .cb-xp-name { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-soft); }
  .cb-xp-lvl { color: var(--gold-bright); font-weight: 800; }
  .cb-xp-track { height: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.10); overflow: hidden; }
  .cb-xp-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); }

  .tactical-dock {
    display: grid;
    grid-template-columns: 1.25fr 1fr 1fr;
    gap: 8px;
  }
  .tac-btn {
    height: 40px;
    border-radius: 15px;
    border: 1px solid rgba(255, 236, 204, 0.10);
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 242, 218, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 800;
    color: var(--ink);
    cursor: pointer;
    min-width: 0;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .tac-btn:active { transform: scale(0.95); }
  .tac-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tac-btn.heal-ready {
    background: linear-gradient(180deg, #3c2a19, #2b1d12);
    border-color: rgba(251, 152, 72, 0.52);
    color: #fed7aa;
  }
  .tac-btn.sky-on {
    background: rgba(116, 196, 255, 0.14);
    border-color: rgba(116, 196, 255, 0.42);
    color: #bae6fd;
  }

  /* Idle Combat Prep Bar */
  .prep-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
  }
  .tac-pill {
    height: 36px;
    padding: 0 8px;
    border-radius: 14px;
    border: 1px solid rgba(255, 236, 204, 0.12);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    min-width: 0;
  }
  .tac-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tac-pill.active { background: #3b2d1f; border-color: var(--border-gold); color: var(--gold-bright); }
  .tac-pill.low { border-color: rgba(242, 108, 108, 0.44); color: #ffb3b3; }
  .tac-pill.sky-on { border-color: rgba(116, 196, 255, 0.44); color: #bae6fd; }

  .slayer-banner-mini {
    border-radius: 16px;
    padding: 9px 12px;
    background: linear-gradient(135deg, rgba(40, 56, 74, 0.58), var(--surface));
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24), inset 0 0 0 1px rgba(116, 196, 255, 0.26);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  /* Illustrated Dungeon Cards */
  .dungeon-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    background-size: cover;
    background-position: center;
    position: relative;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 240, 212, 0.16);
  }
  .dungeon-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(20, 15, 10, 0.46) 0%, rgba(18, 14, 10, 0.88) 100%);
  }
  .dungeon-card.running { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.44), inset 0 0 0 1.5px var(--emerald); }
  .dungeon-inner {
    position: relative;
    z-index: 1;
    padding: 13px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  /* Area Picker Map Cards */
  .area-map-card {
    width: 100%;
    text-align: left;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    position: relative;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 240, 212, 0.14);
  }
  .area-map-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(18, 14, 10, 0.88) 0%, rgba(18, 14, 10, 0.56) 65%, rgba(18, 14, 10, 0.78) 100%);
  }
  .area-map-card.selected { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38), inset 0 0 0 1.5px var(--gold); }
  .area-map-inner {
    position: relative;
    z-index: 1;
    padding: 12px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .area-enemy-thumbs { display: flex; gap: 5px; margin-top: 6px; }
  .area-enemy-thumb {
    width: 26px;
    height: 26px;
    border-radius: 9px;
    background: rgba(16, 12, 8, 0.65);
    display: grid;
    place-items: center;
  }

  /* ============================================================
     QUEST ADVENTURE CHRONICLE (Illustrated Route & Wax Seals!)
     ============================================================ */
  .quest-tracker-card {
    border-radius: var(--radius-md);
    padding: 13px;
    background: linear-gradient(145deg, #342619, #251c14 78%);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.30), inset 0 0 0 1px rgba(246, 207, 124, 0.34);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .quest-tracker-goal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 14px;
    background: rgba(15, 11, 8, 0.52);
  }
  .quest-goal-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
  .quest-goal-lbl {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Illustrated Vertical Adventure Roadmap */
  .quest-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-left: 16px;
  }
  .quest-timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 20px;
    bottom: 20px;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(246, 207, 124, 0.55), rgba(255, 236, 204, 0.10));
  }
  .quest-ch-card {
    position: relative;
    width: 100%;
    text-align: left;
    border: none;
    border-radius: var(--radius-md);
    padding: 11px 12px;
    background: var(--surface);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 240, 212, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .quest-ch-card::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: #3a2d20;
    border: 2px solid #75624b;
  }
  .quest-ch-card.selected {
    background: linear-gradient(135deg, #35281a, #271e16 74%);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32), inset 0 0 0 1.5px rgba(246, 207, 124, 0.58);
  }
  .quest-ch-card.selected::before {
    background: var(--gold-bright);
    border-color: #fff6db;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  }
  .quest-ch-card.done::before {
    background: var(--emerald);
    border-color: #d1fae5;
  }
  .quest-ch-card.locked { opacity: 0.56; }
  .quest-ch-card:active { transform: scale(0.98); }

  .quest-art-thumb {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: radial-gradient(circle at 50% 38%, rgba(246, 207, 124, 0.18), rgba(16, 12, 8, 0.52));
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
  }
  .quest-seal {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2b2117;
    border: 1px solid rgba(246, 207, 124, 0.45);
    color: var(--gold-bright);
    font-size: 9.5px;
    font-weight: 900;
    display: grid;
    place-items: center;
  }
  .quest-ch-card.done .quest-seal { background: #1c4a32; border-color: var(--emerald); color: #86efac; }

  .quest-lore {
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(246, 207, 124, 0.12), rgba(246, 207, 124, 0.04));
    border: 1px solid rgba(246, 207, 124, 0.22);
    font-size: 13px;
    line-height: 1.55;
    color: var(--ink-soft);
  }
  .quest-step-list { display: flex; flex-direction: column; gap: 9px; }
  .quest-step-card {
    border-radius: 16px;
    padding: 11px 12px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .quest-step-card.done { box-shadow: inset 0 0 0 1px rgba(74, 222, 151, 0.34); }
  .quest-step-head { display: flex; align-items: baseline; gap: 8px; }
  .quest-step-num { font-size: 11px; font-weight: 800; color: var(--gold-bright); flex-shrink: 0; }
  .quest-step-quote { font-size: 12px; color: var(--ink-muted); }
  .quest-goal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 12px;
    background: rgba(15, 11, 8, 0.48);
  }

  /* ============================================================
     SHOP SHELF V3 (Clean 3-Column Merchant Shelf, Zero Red Pill Wall!)
     ============================================================ */
  .currency-shelf {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .curr-tile {
    padding: 7px 10px;
    border-radius: 14px;
    background: rgba(20, 15, 10, 0.66);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 238, 206, 0.18);
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .curr-lbl { font-size: 10px; font-weight: 700; color: var(--ink-muted); }
  .curr-val { font-size: 14px; font-weight: 900; color: var(--gold-bright); }

  .shelf-card {
    border-radius: var(--radius-md);
    padding: 11px 12px;
    background: var(--surface);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 240, 212, 0.08);
    display: grid;
    grid-template-columns: 50px 1fr auto;
    align-items: center;
    gap: 11px;
  }
  .shelf-card.can-buy {
    background: linear-gradient(135deg, rgba(56, 42, 24, 0.92), var(--surface) 74%);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.30), inset 0 0 0 1px rgba(246, 207, 124, 0.36);
  }
  .shelf-card.locked { opacity: 0.72; }
  .shelf-tier-tag {
    position: absolute;
    bottom: -3px;
    right: -3px;
    padding: 1px 5px;
    border-radius: 999px;
    background: #1a130d;
    border: 1px solid rgba(246, 207, 124, 0.42);
    font-size: 9px;
    font-weight: 800;
    color: var(--gold-bright);
  }
  .shelf-effect {
    font-size: 12px;
    font-weight: 700;
    color: #86efac;
    margin-top: 2px;
    line-height: 1.35;
  }
  .shelf-effect.gear { color: #fde68a; }
  .shelf-effect.tb { color: #d8beff; }
  .shelf-effect.muted { color: var(--ink-muted); }
  .shelf-costs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    font-size: 11.5px;
    font-weight: 700;
  }
  .cost-inline {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--gold-bright);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
  }
  .cost-inline.sky { color: var(--sky); }
  .cost-inline.ok { color: #86efac; }
  .cost-inline.short { color: #f8a4a4; }
  .shelf-lock-note {
    font-size: 10.5px;
    font-weight: 700;
    color: #f8a4a4;
    text-align: center;
    margin-top: 3px;
    max-width: 76px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ============================================================
     BANK & COMPENDIUM TREASURY CELLS
     ============================================================ */
  .bank-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .bank-cell {
    position: relative;
    border-radius: 16px;
    border: none;
    background: var(--surface);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 240, 212, 0.08);
    padding: 13px 6px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .bank-cell:active { transform: scale(0.94); }
  .bank-cell.has-perk {
    background: linear-gradient(155deg, rgba(197, 156, 255, 0.16), var(--surface) 68%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(197, 156, 255, 0.36);
  }
  .bank-cell.is-equip {
    background: linear-gradient(155deg, rgba(246, 207, 124, 0.14), var(--surface) 68%);
  }
  .bank-cell.is-food {
    background: linear-gradient(155deg, rgba(74, 222, 151, 0.12), var(--surface) 68%);
  }
  .bank-cell.undiscovered { opacity: 0.36; filter: grayscale(0.75); }
  .bank-qty {
    position: absolute;
    top: 5px;
    right: 6px;
    font-size: 10px;
    font-weight: 800;
    color: #fff6e3;
    background: rgba(15, 11, 8, 0.72);
    padding: 1px 5px;
    border-radius: 999px;
  }
  .bank-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-soft);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
  }

  /* ============================================================
     MASTERY STORYBOOK ASTROLABE DASHBOARD
     ============================================================ */
  .mastery-hero {
    border-radius: var(--radius-lg);
    padding: 15px 14px;
    background:
      radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--skill-accent) 18%, transparent), transparent 55%),
      linear-gradient(160deg, #2d2219, #201812);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 240, 212, 0.14);
    display: flex;
    flex-direction: column;
    gap: 13px;
  }
  .mastery-top { display: flex; align-items: center; gap: 14px; }
  .m-ring-lg { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
  .m-ring-lg svg { width: 100%; height: 100%; transform: rotate(-90deg); }
  .m-ring-bg { fill: none; stroke: rgba(255, 240, 212, 0.10); }
  .m-ring-fg {
    fill: none;
    stroke: var(--gold-bright);
    stroke-linecap: round;
    transition: stroke-dashoffset 450ms var(--ease-out-expo);
  }
  .m-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
  }
  .m-ring-pct { font-size: 11.5px; font-weight: 900; color: var(--gold-bright); }
  .mastery-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
  .m-kpi {
    padding: 6px 5px;
    border-radius: 12px;
    background: rgba(15, 11, 8, 0.50);
    text-align: center;
  }
  .m-kpi-val { font-size: 13.5px; font-weight: 900; color: var(--ink); }
  .m-kpi-val.gold { color: var(--gold-bright); }
  .m-kpi-lbl { font-size: 10px; font-weight: 600; color: var(--ink-muted); margin-top: 1px; }

  .rank-rail {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--rk-n, 7), 1fr);
    align-items: start;
  }
  .rank-rail-track {
    position: absolute;
    top: 15px;
    left: 7%;
    right: 7%;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 240, 212, 0.12);
    overflow: hidden;
  }
  .rank-rail-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  }
  .rank-node {
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
  }
  .rank-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #1b140e;
    border: 1.5px solid rgba(255, 236, 204, 0.18);
    color: var(--ink-dim);
    font-size: 10.5px;
    font-weight: 800;
    display: grid;
    place-items: center;
    transition: transform var(--dur-fast);
  }
  .rank-node.unlocked .rank-dot {
    background: #3b2b16;
    border-color: var(--gold);
    color: var(--gold-bright);
  }
  .rank-node.selected .rank-dot {
    transform: scale(1.14);
    border-color: #fff6db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    color: #fff9ec;
  }
  .rank-pct-lbl { font-size: 9.5px; font-weight: 700; color: var(--ink-dim); }
  .rank-node.selected .rank-pct-lbl { color: var(--gold-bright); }

  .rank-showcase {
    border-radius: 15px;
    padding: 10px 12px;
    background: rgba(15, 11, 8, 0.50);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .rank-bonus-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .bonus-metric {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(246, 207, 124, 0.13);
    font-size: 12px;
    font-weight: 700;
    color: var(--gold-bright);
  }
  .bonus-metric.ok { background: var(--emerald-soft); color: #8af5c0; }

  .mastery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .m-card {
    text-align: left;
    border: none;
    border-radius: 16px;
    padding: 11px;
    background: var(--surface);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 240, 212, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
  }
  .m-card.unstarted { opacity: 0.64; }
  .m-card-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
  .m-ring-sm { position: relative; width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center; }
  .m-ring-sm svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
  .m-card-lvl { font-size: 15px; font-weight: 900; color: var(--gold-bright); }
  .m-card-max { font-size: 10.5px; color: var(--ink-dim); }
  .m-tier-bar { position: relative; height: 5px; border-radius: 999px; background: rgba(255, 240, 212, 0.09); overflow: hidden; }
  .m-tier-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--skill-accent), var(--gold-bright)); }
  .m-card-foot { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-dim); }

  /* ============================================================
     SKILLS OVERVIEW & PICKER GRID
     ============================================================ */
  .skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .skill-tile {
    border: none;
    border-radius: 16px;
    padding: 11px 8px 9px;
    background: var(--surface);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 240, 212, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
  }
  .skill-tile.running { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.30), inset 0 0 0 1.5px var(--emerald); }
  .skill-tile-name { font-size: 12px; font-weight: 800; color: var(--ink); }
  .skill-tile-lvl { font-size: 13px; font-weight: 900; color: var(--gold-bright); }

  .picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .picker-cell {
    position: relative;
    border: none;
    border-radius: 16px;
    padding: 10px 4px 8px;
    background: var(--surface);
    box-shadow: inset 0 1px 0 rgba(255, 240, 212, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
  }
  .picker-cell:active { transform: scale(0.94); }
  .picker-cell.selected { background: #3b2d1f; box-shadow: inset 0 0 0 1.5px var(--gold); }
  .picker-cell.running { box-shadow: inset 0 0 0 1.5px var(--emerald); }
  .picker-cell .run-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--emerald);
  }
  .picker-name { font-size: 11.5px; font-weight: 800; color: var(--ink); }
  .picker-lvl { font-size: 10px; font-weight: 700; color: var(--gold-bright); }

  /* ============================================================
     HERO CHARACTER SHRINE PAPER-DOLL & EFFECTS SHEET
     ============================================================ */
  .hero-banner {
    border-radius: 20px;
    padding: 14px;
    background:
      radial-gradient(circle at 85% 15%, rgba(246, 207, 124, 0.18), transparent 55%),
      linear-gradient(155deg, #322519, #221912);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 242, 214, 0.16);
    display: flex;
    flex-direction: column;
    gap: 11px;
  }
  .hero-banner-top { display: flex; align-items: center; gap: 12px; }
  .hero-avatar {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: radial-gradient(circle at 40% 32%, rgba(250, 212, 128, 0.30), rgba(18, 13, 9, 0.85));
    border: 1px solid rgba(250, 212, 128, 0.45);
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }
  .hero-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hero-stat-tile {
    padding: 9px 11px;
    border-radius: 14px;
    background: rgba(15, 11, 8, 0.50);
    display: flex;
    align-items: center;
    gap: 9px;
  }
  .hero-stat-ico {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: rgba(255, 240, 212, 0.08);
    display: grid;
    place-items: center;
    color: var(--gold-bright);
    flex-shrink: 0;
  }
  .hero-stat-lbl { font-size: 10.5px; font-weight: 700; color: var(--ink-muted); display: block; }
  .hero-stat-val { font-size: 15px; font-weight: 900; color: var(--ink); }
  .hero-stat-val.gold { color: var(--gold-bright); }
  .hero-stat-val.ok { color: #8af5c0; }
  .hero-stat-val.sky { color: #9ad8ff; }

  .paperdoll-stage {
    position: relative;
    border-radius: 22px;
    padding: 15px 12px;
    background:
      radial-gradient(circle at 50% 48%, rgba(246, 207, 124, 0.16) 0%, rgba(246, 207, 124, 0.04) 45%, transparent 72%),
      #1f1711;
    box-shadow: inset 0 1px 0 rgba(255, 240, 212, 0.12);
    overflow: hidden;
  }
  .paperdoll-bg-fig {
    position: absolute;
    inset: 12px;
    display: grid;
    place-items: center;
    pointer-events: none;
    overflow: hidden;
  }
  .paperdoll-bg-hero {
    width: 210px;
    height: 210px;
    opacity: 0.22;
    filter: saturate(0.8);
  }
  .paperdoll-ring-deco {
    position: absolute;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    border: 1px dashed rgba(246, 207, 124, 0.18);
  }
  .pd-avail-tag {
    position: absolute;
    top: 4px;
    right: 5px;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(34, 140, 88, 0.88);
    color: #eafff3;
    font-size: 9px;
    font-weight: 800;
  }
  .paperdoll-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
  }
  .pd-slot {
    position: relative;
    height: 78px;
    border-radius: 16px;
    border: 1px solid rgba(255, 236, 204, 0.11);
    background: rgba(24, 18, 13, 0.78);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out-expo);
  }
  .pd-slot:active { transform: scale(0.94); }
  .pd-slot.filled {
    background: linear-gradient(155deg, rgba(246, 207, 124, 0.18), rgba(26, 20, 14, 0.90));
    border-color: rgba(246, 207, 124, 0.50);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
  }
  .pd-slot.has-avail { border-color: rgba(74, 222, 151, 0.48); }
  .pd-avail-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald);
  }
  .pd-slot-tag {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 9px;
    font-weight: 800;
    color: var(--gold-bright);
  }
  .pd-sil { width: 24px; height: 24px; color: rgba(235, 210, 172, 0.44); }
  .pd-slot-lbl {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-muted);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pd-slot.filled .pd-slot-lbl { color: var(--ink); }

  .hero-cskills-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .hero-cskill-cell {
    position: relative;
    border-radius: 14px;
    padding: 9px 4px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
  }
  .hero-cskill-cell.training { box-shadow: inset 0 0 0 1.5px rgba(246, 207, 124, 0.46); }
  .hero-cskill-up { position: absolute; top: 4px; right: 6px; font-size: 10px; font-weight: 900; color: var(--emerald); }
  .hero-cskill-name { font-size: 11px; color: var(--ink-muted); font-weight: 700; }
  .hero-cskill-lvl { font-size: 12px; font-weight: 900; color: var(--gold-bright); }

  /* Cumulative Active Effects */
  .effect-scope-card {
    border-radius: 16px;
    background: var(--surface);
    overflow: hidden;
  }
  .effect-scope-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(15, 11, 8, 0.42);
    border-bottom: 1px solid var(--divider);
  }
  .effect-row {
    display: grid;
    grid-template-columns: 68px 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--divider);
  }
  .effect-row:last-child { border-bottom: none; }
  .effect-total {
    font-size: 14.5px;
    font-weight: 900;
    color: #8af5c0;
    text-align: center;
    padding: 4px 6px;
    border-radius: 10px;
    background: rgba(74, 222, 151, 0.12);
  }
  .effect-total.gold { color: var(--gold-bright); background: var(--gold-soft); }
  .effect-src-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
  .effect-src-tag {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 240, 212, 0.08);
    color: var(--ink-muted);
  }

  /* Item Inspector & Links */
  .perk-panel {
    border-radius: 15px;
    padding: 10px 12px;
    background: rgba(197, 156, 255, 0.11);
    border: 1px solid rgba(197, 156, 255, 0.28);
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .perk-line { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; color: var(--ink); }
  .perk-bullet { width: 7px; height: 7px; border-radius: 50%; background: var(--violet); margin-top: 5px; flex-shrink: 0; }
  .perk-bullet.gold { background: var(--gold-bright); }
  .stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-box {
    border-radius: 14px;
    padding: 8px 11px;
    background: var(--surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .stat-box-lbl { font-size: 11.5px; color: var(--ink-muted); }
  .stat-box-val { font-size: 13px; font-weight: 800; color: var(--gold-bright); }

  .link-group {
    border-radius: 16px;
    background: var(--surface);
    overflow: hidden;
  }
  .link-row {
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 10px;
    text-align: left;
    border-bottom: 1px solid var(--divider);
    cursor: pointer;
  }
  .link-row:last-child { border-bottom: none; }
  .link-ico { width: 32px; height: 32px; border-radius: 10px; background: rgba(15, 11, 8, 0.45); display: grid; place-items: center; }
  .link-title { font-size: 13px; font-weight: 800; color: var(--ink); }
  .link-meta { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
  .link-right { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--gold-bright); }
  .link-more-btn {
    width: 100%;
    border: none;
    background: rgba(246, 207, 124, 0.08);
    color: var(--gold-bright);
    padding: 9px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
  }

  /* Illustrated Activity Log Timeline (Zero Plain Text Lines!) */
  .log-list { display: flex; flex-direction: column; gap: 8px; }
  .log-card {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 15px;
    background: var(--surface);
  }
  .log-badge-ico {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: rgba(246, 207, 124, 0.14);
    color: var(--gold-bright);
  }
  .log-card.level .log-badge-ico { background: rgba(250, 204, 21, 0.20); color: #fef08a; }
  .log-card.loot .log-badge-ico, .log-card.drop .log-badge-ico { background: rgba(74, 222, 151, 0.16); color: #86efac; }
  .log-card.combat .log-badge-ico, .log-card.danger .log-badge-ico { background: rgba(242, 108, 108, 0.18); color: #fca5a5; }
  .log-txt { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
  .log-time { font-size: 11px; color: var(--ink-dim); }

  /* Settings Profile Card & Controls */
  .profile-banner {
    border-radius: 18px;
    padding: 14px;
    background:
      radial-gradient(circle at 90% 10%, rgba(246, 207, 124, 0.22), transparent 55%),
      linear-gradient(150deg, #332519, #221912);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .text-field, .save-textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255, 236, 204, 0.14);
    background: rgba(15, 11, 8, 0.60);
    color: var(--ink);
    padding: 9px 12px;
    font-size: 13px;
    outline: none;
  }
  .text-field:focus, .save-textarea:focus { border-color: var(--border-gold); }
  .save-textarea { min-height: 76px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
  .save-id-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 12px;
    background: rgba(15, 11, 8, 0.56);
  }
  .save-id-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--gold-bright); overflow: hidden; text-overflow: ellipsis; }
  .save-btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Native Animated Bottom-Sheet Dialog (Modern Web Guidance Compliant) */
  .sheet-dialog {
    width: 100%;
    max-width: 480px;
    margin: auto auto 0;
    padding: 0;
    border: none;
    border-radius: 26px 26px 0 0;
    background: linear-gradient(180deg, #251c14 0%, #17120d 100%);
    color: var(--ink);
    max-height: 86dvh;
    overflow: hidden;
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(255, 238, 206, 0.22);
    transform: translateY(100%);
    opacity: 0;
    transition: transform var(--dur-sheet) var(--ease-out-expo), opacity 220ms ease;
  }
  .sheet-dialog[open] {
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    opacity: 1;
  }
  .sheet-dialog[data-closing="1"] {
    transform: translateY(100%);
    opacity: 0;
  }
  .sheet-dialog:modal {
    overscroll-behavior: contain;
  }
  .sheet-dialog::backdrop {
    background: rgba(10, 7, 4, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow: hidden;
    overscroll-behavior: contain;
  }
  @starting-style {
    .sheet-dialog[open] {
      transform: translateY(100%);
      opacity: 0;
    }
  }
  .sheet-handle-wrap { display: flex; justify-content: center; padding: 10px 0 4px; flex-shrink: 0; }
  .sheet-handle { width: 42px; height: 4px; border-radius: 999px; background: rgba(255, 238, 206, 0.24); }
  .sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px 12px;
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
  }
  .sheet-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    color: #fff8eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sheet-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 238, 206, 0.14);
    background: rgba(255, 240, 212, 0.07);
    color: var(--ink-soft);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
  }
  .sheet-body {
    padding: 14px 14px calc(22px + var(--safe-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* Toast */
  .toast {
    position: fixed;
    top: calc(var(--hud-h) + var(--safe-top) + 10px);
    left: 50%;
    transform: translate(-50%, -14px);
    opacity: 0;
    pointer-events: none;
    z-index: 60;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(34, 25, 17, 0.94);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(246, 207, 124, 0.44);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.48);
    color: var(--gold-bright);
    font-size: 12.5px;
    font-weight: 800;
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: transform 240ms var(--ease-out-expo), opacity 200ms ease;
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }

  .loading-box {
    margin: auto;
    padding: 40px 20px;
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--gold-bright);
    text-align: center;
  }
}

@layer motion {
  @keyframes orbBreathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.03); }
  }
  @keyframes floatUp {
    0% { opacity: 0; transform: translate(-50%, 6px) scale(0.86); }
    18% { opacity: 1; transform: translate(-50%, -6px) scale(1.06); }
    100% { opacity: 0; transform: translate(-50%, -46px) scale(0.96); }
  }
  @keyframes particleBurst {
    0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx, 18px), var(--dy, -18px)) rotate(var(--rot, 140deg)) scale(0.3); }
  }
  @keyframes slashSweep {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(-36deg) scaleX(0.2); }
    35% { opacity: 1; transform: translate(-50%, -50%) rotate(-36deg) scaleX(1.12); }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(-36deg) scaleX(1.32); }
  }
  @keyframes swingStrike {
    0% { transform: scale(1) rotate(0deg); }
    28% { transform: scale(1.12) rotate(-8deg); }
    62% { transform: scale(0.96) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); }
  }
  @keyframes heroIdle {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.015); }
  }
  @keyframes actorIdle {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2.5px) scale(1.015); }
  }
  @keyframes playerLunge {
    0% { transform: translateX(0) scale(1); }
    35% { transform: translateX(28px) scale(1.06); }
    100% { transform: translateX(0) scale(1); }
  }
  @keyframes enemyHit {
    0% { transform: translateX(0); filter: drop-shadow(0 10px 16px rgba(0,0,0,0.65)); }
    22% { transform: translateX(10px) rotate(6deg) scale(0.94); filter: brightness(2.4) saturate(0.4) drop-shadow(0 0 18px #fff5cc); }
    55% { transform: translateX(-5px) rotate(-3deg); }
    100% { transform: translateX(0); filter: drop-shadow(0 10px 16px rgba(0,0,0,0.65)); }
  }
  @keyframes enemyLunge {
    0% { transform: translateX(0); }
    36% { transform: translateX(-24px) scale(1.10); }
    100% { transform: translateX(0); }
  }
  @keyframes numPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.18); }
    100% { transform: scale(1); }
  }
  @keyframes viewIn {
    from { opacity: 0.25; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes jumpRing {
    0% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.85); }
    70% { box-shadow: 0 0 0 12px rgba(250, 204, 21, 0); }
    100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
  }

  .anim-swing { animation: swingStrike 340ms var(--ease-out-expo); }
  .anim-lunge { animation: playerLunge 320ms var(--ease-out-expo); }
  .anim-hit { animation: enemyHit 360ms var(--ease-out-expo); }
  .anim-enemy-lunge { animation: enemyLunge 320ms var(--ease-out-expo); }
  .num-pop { animation: numPop 260ms var(--ease-out-expo); }
  .view-enter { animation: viewIn 220ms var(--ease-out-expo); }
  .jump-focus { animation: jumpRing 1.1s ease-out 2; }
}

@layer utilities {
  .row { display: flex; align-items: center; }
  .col { display: flex; flex-direction: column; }
  .between { display: flex; align-items: center; justify-content: space-between; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .p-14 { padding: 14px; }
}
