:root {
  --bg: #050a0d;
  --bg-soft: #071116;
  --panel: #0a151b;
  --panel-strong: #0d1a20;
  --panel-raised: #102129;
  --line: rgba(164, 207, 195, 0.12);
  --line-strong: rgba(164, 207, 195, 0.22);
  --text: #e9f1ea;
  --text-soft: #bdccc5;
  --muted: #7e958e;
  --faint: #536963;
  --jade: #74f0c8;
  --jade-bright: #b8ffe9;
  --jade-dim: rgba(116, 240, 200, 0.12);
  --cyan: #64cfff;
  --gold: #f5c66b;
  --gold-soft: #d6a751;
  --red: #ff6b70;
  --red-dim: rgba(255, 107, 112, 0.12);
  --quality-common: #9db0aa;
  --quality-rare: #62c9ff;
  --quality-epic: #f5c66b;
  --font-ui: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-display: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --stage-height: clamp(470px, calc(100svh - 206px), 740px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  color-scheme: dark;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 82% -8%, rgba(57, 108, 91, 0.2), transparent 38%),
    radial-gradient(ellipse at 4% 104%, rgba(119, 77, 38, 0.12), transparent 32%),
    linear-gradient(145deg, #050a0d 0%, #060d11 48%, #04090c 100%);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.36;
  background-image:
    linear-gradient(rgba(132, 183, 168, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(132, 183, 168, 0.026) 1px, transparent 1px);
  background-size: 68px 68px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 0%, transparent 78%);
  mask-image: radial-gradient(ellipse at 50% 45%, #000 0%, transparent 78%);
}

body::after {
  position: fixed;
  z-index: 60;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.15;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

button {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 3px;
}

::selection {
  background: rgba(116, 240, 200, 0.22);
  color: var(--jade-bright);
}

.ambient {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-orb {
  position: absolute;
  display: block;
  border-radius: 999px;
  filter: blur(110px);
  opacity: 0.38;
}

.ambient-orb--one {
  top: 8%;
  right: 3%;
  width: 32vw;
  height: 32vw;
  background: #1e5b4d;
}

.ambient-orb--two {
  bottom: -12%;
  left: -5%;
  width: 30vw;
  height: 26vw;
  background: #69471f;
  opacity: 0.16;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  opacity: 0.17;
  background:
    linear-gradient(115deg, transparent 20%, rgba(245, 198, 107, 0.06) 50%, transparent 75%),
    linear-gradient(295deg, transparent 20%, rgba(116, 240, 200, 0.05) 50%, transparent 75%);
}

body[data-theme="cyber"] .ambient-orb--one {
  background: #521d71;
  opacity: 0.32;
}

body[data-theme="cyber"] .ambient-orb--two {
  background: #0b5872;
  opacity: 0.22;
}

body[data-theme="cyber"] .ambient-grid {
  opacity: 0.24;
  background:
    linear-gradient(115deg, transparent 20%, rgba(255, 72, 216, 0.08) 50%, transparent 75%),
    linear-gradient(295deg, transparent 20%, rgba(79, 221, 255, 0.07) 50%, transparent 75%);
}

body[data-theme="eldritch"] .ambient-orb--one {
  background: #1a604a;
  opacity: 0.3;
}

body[data-theme="eldritch"] .ambient-orb--two {
  background: #3d2158;
  opacity: 0.24;
}

body[data-theme="eldritch"] .ambient-grid {
  opacity: 0.22;
  background:
    linear-gradient(115deg, transparent 20%, rgba(124, 255, 190, 0.07) 50%, transparent 75%),
    linear-gradient(295deg, transparent 20%, rgba(161, 102, 255, 0.07) 50%, transparent 75%);
}

.app {
  position: relative;
  z-index: 1;
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 20px clamp(16px, 2.3vw, 36px) 18px;
}

/* Header */
.topbar {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(164, 207, 195, 0.09);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  transform: rotate(45deg);
  border: 1px solid rgba(245, 198, 107, 0.46);
  background:
    linear-gradient(135deg, rgba(245, 198, 107, 0.16), transparent 58%),
    rgba(8, 16, 19, 0.8);
  box-shadow:
    0 0 0 3px rgba(245, 198, 107, 0.035),
    0 0 22px rgba(245, 198, 107, 0.08);
}

.brand-mark i {
  transform: rotate(-45deg);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 14px;
  font-style: normal;
  font-weight: 800;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-text strong {
  color: #eef4ed;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1.2;
}

.brand-text small {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.26em;
}

.act-meta {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.act-line {
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 198, 107, 0.5));
}

.act-cap {
  padding-left: 11px;
  border-left: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.11em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: 8px;
}

.icon-button {
  display: flex;
  height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 18, 22, 0.52);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.icon-button:hover:not(:disabled) {
  border-color: rgba(164, 207, 195, 0.28);
  background: rgba(15, 29, 33, 0.8);
  color: var(--text-soft);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.icon-button.is-muted {
  color: var(--faint);
}

.sound-icon {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1;
}

.pause-glyph {
  color: var(--jade);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.18em;
}

/* Main layout */
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  gap: 16px;
  align-items: start;
}

.game-column {
  min-width: 0;
}

.stage {
  position: relative;
  height: var(--stage-height);
  min-height: 460px;
  overflow: hidden;
  border: 1px solid rgba(164, 207, 195, 0.16);
  border-radius: var(--radius-lg);
  background: #071117;
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(0, 0, 0, 0.25) inset,
    0 0 90px rgba(44, 116, 98, 0.035);
  isolation: isolate;
  container-type: inline-size;
  container-name: stage;
}

.stage::before {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 8%;
  width: 38%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(245, 198, 107, 0.55), transparent);
  pointer-events: none;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.stage-scanlines {
  position: absolute;
  z-index: 6;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(0, 0, 0, 0.24) 3px,
    rgba(0, 0, 0, 0.24) 4px
  );
  mix-blend-mode: multiply;
}

.stage-vignette {
  position: absolute;
  z-index: 6;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 8, 10, 0.58) 0%, transparent 19%, transparent 78%, rgba(2, 7, 9, 0.54) 100%),
    radial-gradient(ellipse at center, transparent 42%, rgba(1, 5, 7, 0.52) 100%);
}

.edge-danger {
  position: absolute;
  z-index: 11;
  top: 0;
  right: 0;
  width: 80px;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(270deg, rgba(255, 67, 73, 0.24), transparent);
  transition: opacity 220ms ease;
}

.edge-danger.is-active {
  opacity: 1;
  animation: dangerEdge 1.15s ease-in-out infinite;
}

/* HUD */
.hud {
  position: absolute;
  z-index: 8;
  inset: 0;
  padding: clamp(13px, 1.8vw, 22px);
  pointer-events: none;
}

.status-card {
  display: flex;
  width: min(300px, 44%);
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid rgba(164, 207, 195, 0.15);
  border-radius: 13px;
  background:
    linear-gradient(135deg, rgba(22, 43, 44, 0.72), rgba(6, 15, 19, 0.82)),
    rgba(5, 13, 17, 0.76);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.portrait {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(245, 198, 107, 0.3);
  border-radius: 8px 8px 14px 8px;
  background:
    radial-gradient(circle at 50% 36%, rgba(245, 198, 107, 0.18), transparent 60%),
    rgba(17, 27, 25, 0.9);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(245, 198, 107, 0.06) inset;
}

body[data-class="gunner"] .portrait {
  border-color: rgba(100, 207, 255, 0.32);
  background:
    radial-gradient(circle at 50% 36%, rgba(100, 207, 255, 0.2), transparent 60%),
    rgba(13, 26, 29, 0.92);
  color: var(--cyan);
}

.status-main {
  flex: 1;
  min-width: 0;
}

.status-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.status-title strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.level-badge {
  padding: 2px 6px;
  border: 1px solid rgba(245, 198, 107, 0.28);
  border-radius: 4px;
  background: rgba(245, 198, 107, 0.07);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.meter-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meter-row + .meter-row {
  margin-top: 5px;
}

.meter-key {
  width: 17px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.meter {
  position: relative;
  flex: 1;
  height: 3px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
}

.meter i {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  border-radius: inherit;
  transition: width 160ms linear;
}

.meter--hp i {
  background: linear-gradient(90deg, #d9595e, #f08d70);
  box-shadow: 0 0 8px rgba(240, 112, 112, 0.45);
}

.meter--xp i {
  width: 0;
  background: linear-gradient(90deg, #4eddc0, #a0fff0);
  box-shadow: 0 0 8px rgba(116, 240, 200, 0.45);
}

.meter-value {
  width: 59px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 6.5px;
  text-align: right;
  white-space: nowrap;
}

.meter-value--xp {
  color: rgba(116, 240, 200, 0.66);
}

.zone-badge {
  position: absolute;
  top: clamp(14px, 1.9vw, 23px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  transform: translateX(-50%);
  border: 1px solid rgba(164, 207, 195, 0.1);
  border-radius: 999px;
  background: rgba(5, 13, 17, 0.38);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.09em;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.live-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 7px rgba(116, 240, 200, 0.85);
  animation: dotPulse 1.8s ease-in-out infinite;
}

body[data-theme="medieval"] .zone-badge {
  border-color: rgba(232, 188, 116, 0.14);
  color: rgba(222, 201, 163, 0.72);
}

body[data-theme="cyber"] .zone-badge {
  border-color: rgba(255, 88, 216, 0.22);
  background: rgba(13, 5, 28, 0.5);
  color: rgba(255, 181, 241, 0.78);
}

body[data-theme="cyber"] .live-dot {
  background: #ff58d8;
  box-shadow: 0 0 8px rgba(255, 88, 216, 0.9);
}

body[data-theme="eldritch"] .zone-badge {
  border-color: rgba(125, 255, 184, 0.17);
  background: rgba(2, 14, 13, 0.52);
  color: rgba(173, 232, 200, 0.76);
}

body[data-theme="eldritch"] .live-dot {
  background: #9dffc8;
  box-shadow: 0 0 8px rgba(157, 255, 200, 0.85);
}

body[data-theme="cyber"] .stage-scanlines {
  opacity: 0.2;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 3px,
      rgba(2, 0, 12, 0.24) 3px,
      rgba(2, 0, 12, 0.24) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 54px,
      rgba(255, 82, 220, 0.035) 54px,
      rgba(255, 82, 220, 0.035) 55px
    );
  mix-blend-mode: multiply;
}

body[data-theme="eldritch"] .stage-scanlines {
  opacity: 0.13;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 4px,
    rgba(3, 18, 14, 0.28) 4px,
    rgba(3, 18, 14, 0.28) 5px
  );
  mix-blend-mode: multiply;
}

.hud-stats {
  position: absolute;
  top: clamp(13px, 1.8vw, 22px);
  right: clamp(13px, 1.8vw, 22px);
  display: flex;
  gap: 5px;
}

.stat-chip {
  display: flex;
  min-width: 55px;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid rgba(164, 207, 195, 0.12);
  border-radius: 8px;
  background: rgba(5, 13, 17, 0.48);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.stat-chip span {
  color: var(--faint);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.stat-chip b {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.stat-chip:nth-child(2) b {
  color: var(--jade);
}

/* Boss HUD */
.boss-hud {
  --boss-accent: #f3b465;
  --boss-accent-rgb: 243, 180, 101;
  position: absolute;
  z-index: 9;
  bottom: 18px;
  left: 50%;
  width: min(560px, 76%);
  padding: 10px 14px 9px;
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid rgba(243, 180, 101, 0.26);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(28, 20, 15, 0.78), rgba(5, 12, 15, 0.9)),
    rgba(5, 12, 15, 0.72);
  box-shadow:
    0 14px 45px rgba(0, 0, 0, 0.4),
    0 0 32px rgba(243, 180, 101, 0.05);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: none;
  animation: bossHudIn 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.boss-hud[data-kind="oracle"] {
  --boss-accent: #ff58d8;
  --boss-accent-rgb: 255, 88, 216;
  border-color: rgba(255, 88, 216, 0.3);
  background:
    linear-gradient(180deg, rgba(30, 8, 38, 0.84), rgba(5, 9, 24, 0.92)),
    rgba(5, 9, 24, 0.76);
}

.boss-hud[data-kind="overlord"] {
  --boss-accent: #c084ff;
  --boss-accent-rgb: 192, 132, 255;
  border-color: rgba(192, 132, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(13, 25, 25, 0.86), rgba(7, 5, 17, 0.93)),
    rgba(7, 5, 17, 0.78);
}

.boss-hud::before {
  position: absolute;
  top: 0;
  left: 8%;
  width: 72%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(var(--boss-accent-rgb), 0.7), transparent);
}

.boss-hud.is-enraged {
  animation: bossHudIn 420ms cubic-bezier(0.22, 1, 0.36, 1) both, bossHudPulse 1.2s ease-in-out infinite;
}

.boss-hud.is-shielded {
  --boss-accent: #ffd37c;
  --boss-accent-rgb: 255, 211, 124;
  border-color: rgba(255, 211, 124, 0.4);
  animation: bossHudIn 420ms cubic-bezier(0.22, 1, 0.36, 1) both, bossHudPulse 1.55s ease-in-out infinite;
}

.boss-hud.is-shielded .boss-hud-tag {
  background: rgba(255, 211, 124, 0.1);
  color: #ffe5ad;
}

.boss-hud.is-shielded .boss-hud-bar > i {
  background:
    repeating-linear-gradient(
      115deg,
      rgba(255, 241, 203, 0.76) 0,
      rgba(255, 241, 203, 0.76) 7px,
      rgba(255, 211, 124, 0.36) 7px,
      rgba(255, 211, 124, 0.36) 14px
    ),
    #ffd37c;
  box-shadow: 0 0 20px rgba(255, 211, 124, 0.32);
}

.boss-hud-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.boss-hud-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(var(--boss-accent-rgb), 0.7);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.13em;
  white-space: nowrap;
}

.boss-hud-kicker i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--boss-accent);
  box-shadow: 0 0 8px rgba(var(--boss-accent-rgb), 0.8);
  animation: dotPulse 1.25s ease-in-out infinite;
}

.boss-hud-head strong {
  overflow: hidden;
  min-width: 0;
  color: #ffeed4;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boss-hud-tag {
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid rgba(var(--boss-accent-rgb), 0.26);
  border-radius: 3px;
  color: rgba(var(--boss-accent-rgb), 0.85);
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.boss-hud-bar {
  position: relative;
  height: 8px;
  margin-top: 7px;
  overflow: hidden;
  border: 1px solid rgba(var(--boss-accent-rgb), 0.13);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.44);
}

.boss-hud-bar > i {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(var(--boss-accent-rgb), 0.55), var(--boss-accent)),
    var(--boss-accent);
  box-shadow: 0 0 16px rgba(var(--boss-accent-rgb), 0.38);
  transition: width 160ms linear;
}

.boss-hud-ticks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(10% - 1px),
    rgba(4, 9, 11, 0.52) calc(10% - 1px),
    rgba(4, 9, 11, 0.52) 10%
  );
}

.boss-hud-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 5px;
  color: rgba(var(--boss-accent-rgb), 0.6);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.04em;
}

.boss-hud-foot span:last-child {
  overflow: hidden;
  color: rgba(196, 211, 201, 0.55);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Boss encounter title card */
.boss-banner {
  position: absolute;
  z-index: 16;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  outline: 1px solid rgba(255, 107, 112, 0.1);
  outline-offset: -10px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(76, 16, 19, 0.32), transparent 46%),
    linear-gradient(180deg, rgba(2, 6, 8, 0.38), rgba(2, 6, 8, 0.1) 52%, rgba(2, 6, 8, 0.48));
  pointer-events: none;
  animation: bossBannerLife 2.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.boss-banner-inner {
  display: flex;
  max-width: 520px;
  align-items: center;
  flex-direction: column;
  text-align: center;
}

.boss-banner-rune {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border: 1px solid rgba(255, 136, 130, 0.52);
  transform: rotate(45deg);
  background: rgba(29, 8, 10, 0.74);
  color: #ffaaa3;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 0 32px rgba(255, 89, 95, 0.12);
}

.boss-banner-rune i {
  font-style: normal;
  transform: rotate(-45deg);
}

.boss-banner-kicker {
  margin-top: 18px;
  color: rgba(255, 146, 141, 0.7);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.22em;
}

.boss-banner h2 {
  margin-top: 7px;
  color: #fff1d8;
  font-family: var(--font-display);
  font-size: clamp(23px, 3.5vw, 38px);
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1.25;
  text-shadow: 0 6px 34px rgba(0, 0, 0, 0.5);
}

.boss-banner-sub {
  margin-top: 7px;
  color: rgba(215, 195, 179, 0.72);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.boss-banner-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  color: rgba(255, 171, 148, 0.58);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.08em;
}

.boss-banner-line i {
  display: block;
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 108, 107, 0.48));
}

.boss-banner-line i:last-child {
  transform: rotate(180deg);
}

/* Screen overlays */
.screen {
  position: absolute;
  z-index: 20;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.start-screen {
  background:
    linear-gradient(92deg, rgba(3, 9, 12, 0.97) 0%, rgba(3, 10, 13, 0.88) 40%, rgba(4, 12, 15, 0.58) 100%),
    radial-gradient(ellipse at 78% 45%, rgba(245, 198, 107, 0.075), transparent 44%),
    radial-gradient(ellipse at 32% 82%, rgba(57, 143, 120, 0.07), transparent 38%);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  padding: clamp(22px, 3.2vw, 46px);
}

.start-screen::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(133, 186, 169, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(133, 186, 169, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(90deg, #000, transparent 70%);
  mask-image: linear-gradient(90deg, #000, transparent 70%);
}

.start-inner {
  position: relative;
  display: grid;
  width: 100%;
  max-width: 1180px;
  margin: auto;
  align-items: center;
  grid-template-columns: minmax(220px, 0.76fr) minmax(0, 1.24fr);
  gap: clamp(24px, 3.4vw, 54px);
}

.start-copy {
  animation: fadeUp 520ms both cubic-bezier(0.22, 1, 0.36, 1);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow > span {
  display: block;
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
}

.start-copy h1 {
  margin-top: 16px;
  color: #f2f5ef;
  font-family: var(--font-display);
  font-size: clamp(2.05rem, 3.4vw, 3.35rem);
  font-weight: 900;
  letter-spacing: 0.055em;
  line-height: 1.2;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.start-copy h1 em {
  color: var(--gold);
  font-style: normal;
  background: linear-gradient(95deg, #f9e1a2, #dca848 70%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.start-desc {
  max-width: 360px;
  margin-top: 16px;
  color: #91a39d;
  font-size: 11.5px;
  letter-spacing: 0.035em;
  line-height: 1.9;
}

.start-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 23px;
  padding-top: 17px;
  border-top: 1px solid rgba(164, 207, 195, 0.12);
  color: var(--muted);
  font-size: 9px;
}

.start-rules > div {
  display: flex;
  align-items: center;
  gap: 5px;
}

.start-rules span:last-child {
  white-space: nowrap;
}

.boss-route {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 107, 112, 0.13);
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 107, 112, 0.04), transparent);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.06em;
}

.boss-route > span {
  margin-right: 3px;
  color: rgba(255, 148, 150, 0.6);
}

.boss-route b {
  color: rgba(255, 173, 168, 0.86);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.boss-route b.is-final {
  color: var(--gold);
}

.boss-route i {
  width: 16px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 107, 112, 0.35), rgba(245, 198, 107, 0.28));
}

kbd {
  display: inline-flex;
  min-width: 19px;
  height: 19px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1px solid rgba(164, 207, 195, 0.24);
  border-bottom-color: rgba(164, 207, 195, 0.38);
  border-radius: 4px;
  background: rgba(181, 224, 210, 0.055);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.auto-rune,
.cap-rune {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(245, 198, 107, 0.22);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--font-mono);
}

.auto-rune {
  width: 18px;
  height: 18px;
  border-style: dashed;
  animation: slowSpin 12s linear infinite;
}

.auto-rune::after {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
  box-shadow: 0 0 6px rgba(245, 198, 107, 0.7);
}

.cap-rune {
  width: 19px;
  height: 19px;
  border-radius: 5px;
  font-size: 8px;
}

.class-select {
  min-width: 0;
  animation: fadeUp 580ms 80ms both cubic-bezier(0.22, 1, 0.36, 1);
}

.class-select-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--text-soft);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.class-select-head small {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.14em;
}

.class-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.class-card {
  --accent: var(--gold);
  --accent-rgb: 245, 198, 107;
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 10px;
  border: 1px solid rgba(164, 207, 195, 0.14);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.08), transparent 38%),
    linear-gradient(155deg, rgba(16, 32, 36, 0.94), rgba(6, 14, 17, 0.97));
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.class-card--gunner {
  --accent: var(--cyan);
  --accent-rgb: 100, 207, 255;
}

.class-card::after {
  position: absolute;
  top: 0;
  left: 16%;
  width: 68%;
  height: 1px;
  content: "";
  opacity: 0.65;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.7), transparent);
}

.class-card:hover {
  z-index: 2;
  transform: translateY(-5px);
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.3),
    0 0 32px rgba(var(--accent-rgb), 0.06);
}

.class-number {
  position: absolute;
  z-index: 3;
  top: 15px;
  right: 16px;
  color: rgba(var(--accent-rgb), 0.62);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.class-visual {
  position: relative;
  display: block;
  height: clamp(100px, 12vw, 130px);
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.1);
  border-radius: 9px;
  background:
    radial-gradient(ellipse at 50% 54%, rgba(var(--accent-rgb), 0.105), transparent 54%),
    linear-gradient(180deg, rgba(4, 10, 12, 0.24), rgba(4, 10, 12, 0.6));
}

.class-visual::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0.6;
  background-image:
    linear-gradient(rgba(169, 214, 199, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(169, 214, 199, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000, transparent 84%);
  mask-image: radial-gradient(ellipse at center, #000, transparent 84%);
}

.class-visual::after {
  position: absolute;
  right: 14%;
  bottom: 8px;
  left: 14%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.4), transparent);
}

.class-visual svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.class-card:hover .class-visual svg {
  transform: translateY(-2px) scale(1.035);
}

.class-content {
  display: flex;
  flex-direction: column;
  padding: 10px 3px 0;
}

.class-kicker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.17em;
}

.class-name-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 3px;
}

.class-name-row strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.25;
}

.class-name-row > span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: 0.08em;
}

.class-desc {
  min-height: 38px;
  margin-top: 4px;
  color: #81958e;
  font-size: 9.5px;
  letter-spacing: 0.025em;
  line-height: 1.65;
}

.class-stats {
  display: flex;
  gap: 10px;
  margin-top: 9px;
  color: var(--faint);
  font-size: 7.5px;
}

.class-stats span {
  white-space: nowrap;
}

.class-stats b {
  margin-right: 2px;
  color: var(--accent);
  font-weight: 600;
}

.class-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 11px;
  padding: 9px 3px 2px;
  border-top: 1px solid rgba(164, 207, 195, 0.1);
  color: var(--text-soft);
  font-size: 8.5px;
  letter-spacing: 0.1em;
}

.class-pick i {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-style: normal;
  transition: transform 180ms ease;
}

.class-card:hover .class-pick i {
  transform: translateX(4px);
}

.start-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
  color: var(--faint);
  font-size: 8px;
}

.start-foot kbd {
  min-width: 16px;
  height: 16px;
  border-radius: 3px;
  font-size: 7px;
}

.start-foot-divider {
  width: 1px;
  height: 10px;
  background: var(--line);
}

/* Pause / result screens */
.pause-screen,
.result-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(44, 101, 86, 0.12), transparent 45%),
    rgba(2, 7, 9, 0.74);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.pause-card {
  width: min(420px, 94%);
  padding: clamp(26px, 4vw, 42px);
  border: 1px solid rgba(164, 207, 195, 0.17);
  border-radius: 18px;
  background:
    linear-gradient(150deg, rgba(18, 36, 38, 0.95), rgba(6, 15, 19, 0.97));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.46);
  animation: cardIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pause-card .eyebrow,
.result-card .eyebrow {
  justify-content: center;
}

.pause-card h2,
.result-card h2 {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 900;
  letter-spacing: 0.07em;
  line-height: 1.25;
  text-align: center;
}

.pause-card h2 {
  margin-top: 10px;
}

.pause-card > p:not(.eyebrow) {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.pause-actions {
  display: flex;
  gap: 9px;
  margin-top: 25px;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  transition: transform 180ms ease, filter 180ms ease, background 180ms ease, border-color 180ms ease;
}

.primary-button {
  border: 1px solid rgba(255, 228, 171, 0.45);
  background: linear-gradient(135deg, #f1cb7c, #d5a546);
  color: #152018;
  box-shadow: 0 8px 24px rgba(193, 143, 52, 0.16);
}

.primary-button:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.primary-button span {
  font-family: var(--font-mono);
  font-size: 13px;
}

.ghost-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
}

.ghost-button:hover {
  border-color: rgba(164, 207, 195, 0.38);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-soft);
  transform: translateY(-2px);
}

.pause-actions > * {
  flex: 1;
}

.pause-hint {
  margin-top: 17px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  text-align: center;
}

.pause-hint kbd {
  min-width: 21px;
  height: 16px;
  margin: 0 2px;
  font-size: 6.5px;
}

.result-card {
  position: relative;
  width: min(570px, 96%);
  padding: clamp(28px, 4.2vw, 45px) clamp(22px, 4vw, 42px) clamp(23px, 3.4vw, 34px);
  border: 1px solid rgba(245, 198, 107, 0.23);
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 198, 107, 0.08), transparent 38%),
    linear-gradient(150deg, rgba(17, 34, 36, 0.96), rgba(5, 13, 16, 0.985));
  box-shadow:
    0 35px 90px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.025) inset;
  animation: cardIn 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.result-card::before {
  position: absolute;
  top: 0;
  left: 22%;
  width: 56%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(245, 198, 107, 0.72), transparent);
}

.result-seal {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  margin: -4px auto 13px;
  transform: rotate(45deg);
  border: 1px solid rgba(245, 198, 107, 0.35);
  background: rgba(245, 198, 107, 0.07);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 0 30px rgba(245, 198, 107, 0.08);
}

.result-seal > * {
  transform: rotate(-45deg);
}

.result-seal {
  line-height: 1;
}

.result-screen.is-defeat .result-seal {
  border-color: rgba(255, 107, 112, 0.3);
  background: rgba(255, 107, 112, 0.06);
  color: var(--red);
}

.result-screen.is-victory .eyebrow {
  color: var(--jade);
}

.result-screen.is-victory .result-seal {
  border-color: rgba(116, 240, 200, 0.35);
  background: rgba(116, 240, 200, 0.07);
  color: var(--jade);
}

.result-card h2 {
  margin-top: 8px;
  font-size: clamp(25px, 3.4vw, 37px);
}

.result-desc {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
  text-align: center;
}

.result-stats {
  display: grid;
  margin-top: 23px;
  padding: 15px 0;
  border-top: 1px solid rgba(164, 207, 195, 0.12);
  border-bottom: 1px solid rgba(164, 207, 195, 0.12);
  grid-template-columns: repeat(4, 1fr);
}

.result-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border-right: 1px solid rgba(164, 207, 195, 0.1);
}

.result-stats > div:last-child {
  border-right: 0;
}

.result-stats span {
  color: var(--faint);
  font-size: 7.5px;
  letter-spacing: 0.08em;
}

.result-stats strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
}

.result-stats > div:first-child strong {
  color: var(--gold);
}

.result-gear {
  margin-top: 12px;
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-align: center;
}

.result-actions {
  display: flex;
  gap: 9px;
  justify-content: center;
  margin-top: 22px;
}

.result-actions .primary-button {
  min-width: 144px;
}

.result-actions .ghost-button {
  min-width: 110px;
}

/* Toast stack */
.toast-stack {
  position: absolute;
  z-index: 15;
  top: clamp(76px, 12%, 104px);
  left: 50%;
  display: flex;
  width: min(340px, 70%);
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  --toast-accent: var(--jade);
  display: flex;
  min-width: 180px;
  max-width: 100%;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--toast-accent) 28%, transparent);
  border-radius: 8px;
  background: rgba(5, 14, 18, 0.82);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(13px);
  backdrop-filter: blur(13px);
  animation: toastIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.toast.is-leaving {
  animation: toastOut 220ms ease both;
}

.toast--gold {
  --toast-accent: var(--gold);
}

.toast--red {
  --toast-accent: var(--red);
}

.toast--cyan {
  --toast-accent: var(--cyan);
}

.toast-mark {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--toast-accent) 35%, transparent);
  border-radius: 6px;
  color: var(--toast-accent);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
}

.toast-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.toast-copy strong {
  color: var(--text);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.toast-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 7.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Touch controls */
.touch-controls {
  position: absolute;
  z-index: 10;
  right: 18px;
  bottom: 17px;
  display: none;
  gap: 9px;
}

.touch-button {
  display: flex;
  width: 54px;
  height: 48px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(164, 207, 195, 0.22);
  border-radius: 10px;
  background: rgba(6, 16, 20, 0.62);
  color: var(--text-soft);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  touch-action: none;
  user-select: none;
}

.touch-button span {
  color: var(--jade);
  font-size: 13px;
  line-height: 1;
}

.touch-button small {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
}

.touch-button.is-pressed {
  border-color: rgba(116, 240, 200, 0.52);
  background: rgba(23, 56, 50, 0.78);
  transform: scale(0.96);
}

/* Under-stage bar */
.stage-bar {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 3px 0;
  color: var(--muted);
}

.stage-bar p {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.stage-bar kbd {
  min-width: 18px;
  height: 17px;
  font-size: 7px;
}

.stage-legend {
  color: var(--faint);
}

.stage-legend > span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

.legend-dot--jade {
  background: var(--jade);
  box-shadow: 0 0 6px rgba(116, 240, 200, 0.6);
}

.legend-dot--red {
  background: var(--red);
  box-shadow: 0 0 6px rgba(255, 107, 112, 0.6);
}

.stage-legend-cap {
  margin-left: 3px;
  padding-left: 11px;
  border-left: 1px solid var(--line);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.06em;
}

/* Sidebar */
.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

/* 开始时只保留标题、职业选项与操作说明；旅途记录在开局后出现。 */
body.is-menu .journal-panel {
  display: none;
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(164, 207, 195, 0.11);
  border-radius: 15px;
  background:
    linear-gradient(160deg, rgba(14, 30, 35, 0.82), rgba(5, 12, 16, 0.9)),
    var(--panel);
  box-shadow:
    0 11px 35px rgba(0, 0, 0, 0.15),
    0 1px 0 rgba(255, 255, 255, 0.02) inset;
}

.panel::before {
  position: absolute;
  top: 0;
  left: 12%;
  width: 56%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, rgba(164, 207, 195, 0.22), transparent);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 11px;
}

.panel-kicker {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.15em;
  line-height: 1.5;
}

.panel h2 {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.quality-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 3px;
}

.q {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--faint);
  font-size: 7px;
  white-space: nowrap;
}

.q::before {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.q--common {
  color: var(--quality-common);
}

.q--rare {
  color: var(--quality-rare);
}

.q--epic {
  color: var(--quality-epic);
}

.gear-card {
  --quality: var(--quality-common);
  --quality-rgb: 157, 176, 170;
  position: relative;
  display: flex;
  gap: 10px;
  margin-top: 7px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(164, 207, 195, 0.1);
  border-radius: 10px;
  background: rgba(4, 12, 15, 0.48);
  transition: border-color 220ms ease, background 220ms ease;
}

.gear-card::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--quality);
  opacity: 0.5;
  content: "";
}

.gear-card.quality-common {
  --quality: var(--quality-common);
  --quality-rgb: 157, 176, 170;
}

.gear-card.quality-rare {
  --quality: var(--quality-rare);
  --quality-rgb: 98, 201, 255;
  border-color: rgba(98, 201, 255, 0.18);
  background: linear-gradient(90deg, rgba(98, 201, 255, 0.035), rgba(4, 12, 15, 0.48));
}

.gear-card.quality-epic {
  --quality: var(--quality-epic);
  --quality-rgb: 245, 198, 107;
  border-color: rgba(245, 198, 107, 0.23);
  background: linear-gradient(90deg, rgba(245, 198, 107, 0.05), rgba(4, 12, 15, 0.48));
}

.gear-card.is-upgraded {
  animation: gearFlash 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gear-glyph {
  display: grid;
  width: 37px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--quality) 30%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--quality) 6%, transparent);
  color: var(--quality);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 0 18px color-mix(in srgb, var(--quality) 4%, transparent) inset;
}

.gear-body {
  min-width: 0;
  flex: 1;
}

.gear-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.gear-slot {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.14em;
}

.quality-badge {
  padding: 1px 4px;
  border: 1px solid color-mix(in srgb, var(--quality) 30%, transparent);
  border-radius: 3px;
  color: var(--quality);
  font-size: 6.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.45;
}

.gear-body h3 {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gear-effect {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 7.5px;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tier-dots {
  display: flex;
  gap: 3px;
  margin-top: 7px;
}

.tier-dots i {
  display: block;
  width: 15px;
  height: 2px;
  border-radius: 2px;
  background: rgba(164, 207, 195, 0.13);
}

.tier-dots i.is-active {
  background: var(--quality);
  box-shadow: 0 0 6px color-mix(in srgb, var(--quality) 45%, transparent);
}

.gear-bar {
  height: 2px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
}

.gear-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--quality);
  box-shadow: 0 0 6px color-mix(in srgb, var(--quality) 50%, transparent);
  transition: width 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gear-rank {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 5.5px;
  letter-spacing: 0.08em;
}

.rank-pips {
  display: flex;
  flex: 1;
  gap: 2px;
}

.rank-pips i {
  display: block;
  height: 2px;
  flex: 1;
  border-radius: 1px;
  background: rgba(164, 207, 195, 0.1);
  transition: background 220ms ease, box-shadow 220ms ease;
}

.rank-pips i.is-active {
  background: color-mix(in srgb, var(--quality) 68%, transparent);
  box-shadow: 0 0 4px color-mix(in srgb, var(--quality) 26%, transparent);
}

.gear-rank b {
  min-width: 27px;
  color: color-mix(in srgb, var(--quality) 78%, #ffffff 4%);
  font-size: 5.5px;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

.gear-card::after {
  position: absolute;
  inset: 0;
  content: "";
  opacity: calc(var(--rank, 1) * 0.012);
  background:
    linear-gradient(115deg, transparent 55%, rgba(var(--quality-rgb), 0.58), transparent 78%);
  pointer-events: none;
}

.gear-glyph {
  position: relative;
}

.gear-glyph::after {
  position: absolute;
  inset: 3px;
  border: 1px solid color-mix(in srgb, var(--quality) 26%, transparent);
  border-radius: 4px;
  content: "";
  opacity: calc(0.16 + var(--rank, 1) * 0.045);
}

.gear-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 5px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  line-height: 1.4;
}

.gear-foot span:last-child {
  overflow: hidden;
  color: var(--muted);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-note {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px dashed rgba(164, 207, 195, 0.1);
  color: var(--faint);
  font-size: 7.5px;
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.journal-panel {
  flex: 1;
}

.panel-head--compact {
  align-items: center;
  margin-bottom: 5px;
}

.journal-mark {
  color: rgba(245, 198, 107, 0.5);
  font-size: 14px;
}

.combat-log {
  display: flex;
  flex-direction: column;
  list-style: none;
}

.combat-log li {
  display: grid;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(164, 207, 195, 0.08);
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.01em;
  line-height: 1.5;
  grid-template-columns: 9px 1fr;
  gap: 5px;
  animation: logIn 280ms ease both;
}

.combat-log li:last-child {
  border-bottom: 0;
}

.combat-log li::before {
  margin-top: 4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
  content: "";
}

.combat-log li.is-gold::before {
  background: var(--gold);
  box-shadow: 0 0 5px rgba(245, 198, 107, 0.5);
}

.combat-log li.is-jade::before {
  background: var(--jade);
  box-shadow: 0 0 5px rgba(116, 240, 200, 0.5);
}

.combat-log li.is-red::before {
  background: var(--red);
  box-shadow: 0 0 5px rgba(255, 107, 112, 0.5);
}

.record-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  padding: 7px 8px;
  border: 1px solid rgba(245, 198, 107, 0.1);
  border-radius: 6px;
  background: rgba(245, 198, 107, 0.035);
}

.record-strip span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.1em;
}

.record-strip strong {
  overflow: hidden;
  color: var(--gold-soft);
  font-size: 7.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 2px 0;
  color: rgba(105, 128, 120, 0.65);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.07em;
}

/* Responsive */
@media (max-width: 1240px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 292px;
  }

  .panel {
    padding: 14px;
  }

  .class-desc {
    min-height: 42px;
    font-size: 9px;
  }

  .start-inner {
    gap: 24px;
  }

  .start-desc {
    font-size: 10.5px;
  }
}

@media (max-width: 1060px) {
  :root {
    --stage-height: clamp(490px, calc(100svh - 193px), 720px);
  }

  .game-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .equipment-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-items: start;
  }

  .equipment-panel .panel-head,
  .equipment-panel .equipment-note {
    grid-column: 1 / -1;
  }

  .equipment-panel .panel-head {
    margin-bottom: 2px;
  }

  .equipment-panel .gear-card {
    margin-top: 0;
  }

  .journal-panel {
    padding-bottom: 12px;
  }

  .combat-log {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
  }

  .combat-log li:nth-last-child(2):nth-child(odd) {
    border-bottom: 0;
  }

  .start-inner {
    grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.28fr);
  }

  .start-copy h1 {
    font-size: clamp(2rem, 4.4vw, 3rem);
  }
}

@media (max-width: 820px) {
  .app {
    padding: 14px 12px 15px;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 11px;
  }

  .act-meta {
    display: none;
  }

  .top-actions {
    margin-left: auto;
  }

  .button-label {
    display: none;
  }

  .icon-button {
    width: 32px;
    justify-content: center;
    padding: 0;
  }

  :root {
    --stage-height: clamp(500px, 76svh, 660px);
  }

  .start-screen {
    align-items: flex-start;
    padding: 22px;
  }

  .start-inner {
    grid-template-columns: 1fr;
    gap: 17px;
    padding: 3px 0 8px;
  }

  .start-copy {
    text-align: center;
  }

  .start-copy .eyebrow,
  .start-rules {
    justify-content: center;
  }

  .boss-route {
    flex-wrap: wrap;
    justify-content: center;
  }

  .start-copy h1 {
    margin-top: 9px;
    font-size: clamp(1.8rem, 7vw, 2.5rem);
  }

  .start-copy h1 br {
    display: none;
  }

  .start-desc {
    max-width: 480px;
    margin: 9px auto 0;
    font-size: 9.5px;
    line-height: 1.7;
  }

  .start-rules {
    margin-top: 12px;
    padding-top: 10px;
    gap: 12px;
  }

  .class-select-head {
    margin-bottom: 6px;
  }

  .class-grid {
    gap: 8px;
  }

  .class-visual {
    height: 88px;
  }

  .class-content {
    padding-top: 7px;
  }

  .class-name-row strong {
    font-size: 19px;
  }

  .class-desc {
    min-height: 0;
    font-size: 8.5px;
    line-height: 1.5;
  }

  .class-stats {
    margin-top: 5px;
    gap: 6px;
    font-size: 6.8px;
  }

  .class-pick {
    margin-top: 7px;
    padding-top: 6px;
  }

  .start-foot {
    justify-content: center;
  }

  .status-card {
    width: min(270px, 63%);
  }

  .zone-badge {
    display: none;
  }

  .hud-stats {
    gap: 3px;
  }

  .stat-chip {
    min-width: 44px;
    padding: 6px 7px;
    gap: 5px;
  }

  .stat-chip span {
    display: none;
  }

  .stat-chip b {
    font-size: 10px;
  }

  .stat-chip:nth-child(3) {
    display: none;
  }

  .toast-stack {
    top: 81px;
    width: min(290px, 80%);
  }

  .boss-hud {
    bottom: 76px;
    width: min(92%, 520px);
  }

  .boss-hud-kicker {
    font-size: 5.5px;
    letter-spacing: 0.08em;
  }

  .boss-hud-head strong {
    font-size: 9px;
  }

  .boss-banner h2 {
    font-size: clamp(21px, 5vw, 30px);
  }

  .stage-bar {
    min-height: 27px;
    padding-top: 7px;
  }

  .stage-legend-cap {
    display: none !important;
  }

  .stage-legend {
    gap: 9px !important;
  }

  .footer {
    padding-top: 11px;
    font-size: 6.5px;
  }

  .footer span:last-child {
    display: none;
  }
}

@media (max-width: 610px) {
  :root {
    --stage-height: 620px;
  }

  .brand-text strong {
    font-size: 15px;
    letter-spacing: 0.12em;
  }

  .brand-text small {
    font-size: 6px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .stage {
    border-radius: 15px;
  }

  .class-grid {
    grid-template-columns: 1fr;
  }

  .class-card {
    display: grid;
    grid-template-columns: 94px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 0 10px;
    align-items: center;
  }

  .class-visual {
    height: 110px;
    grid-row: 1 / 3;
    margin: 0;
  }

  .class-content {
    padding: 4px 2px 0;
  }

  .class-desc {
    display: none;
  }

  .class-pick {
    margin-top: 5px;
    padding: 5px 2px 2px;
  }

  .class-name-row strong {
    font-size: 18px;
  }

  .class-stats {
    margin-top: 4px;
  }

  .class-number {
    top: 9px;
    right: 10px;
  }

  .start-copy {
    text-align: left;
  }

  .start-copy .eyebrow,
  .start-rules {
    justify-content: flex-start;
  }

  .start-copy h1 {
    font-size: 1.9rem;
    letter-spacing: 0.04em;
  }

  .start-desc {
    margin-left: 0;
    font-size: 9px;
  }

  .start-rules {
    gap: 10px;
  }

  .boss-route {
    justify-content: flex-start;
  }

  .start-foot {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .start-screen {
    padding: 18px;
  }

  .hud {
    padding: 10px;
  }

  .status-card {
    width: min(252px, 72%);
    gap: 8px;
    padding: 8px 9px;
  }

  .portrait {
    width: 34px;
    height: 38px;
    font-size: 15px;
  }

  .meter-value {
    display: none;
  }

  .hud-stats {
    top: 10px;
    right: 10px;
  }

  .stat-chip {
    padding: 5px 6px;
  }

  .stat-chip:nth-child(2) {
    display: none;
  }

  .meter-key {
    width: 15px;
  }

  .stage-bar {
    justify-content: center;
  }

  .stage-legend {
    display: none !important;
  }

  .touch-controls {
    display: flex;
    gap: 6px;
  }

  .touch-button {
    width: 44px;
    height: 44px;
    gap: 2px;
  }

  .touch-button span {
    font-size: 11px;
  }

  .touch-button small {
    font-size: 6px;
  }

  .boss-hud {
    bottom: 70px;
    width: calc(100% - 20px);
    padding: 9px 11px 8px;
  }

  .boss-hud-kicker {
    display: none;
  }

  .boss-hud-head {
    gap: 7px;
  }

  .boss-hud-head strong {
    font-size: 10px;
  }

  .boss-hud-foot span:last-child {
    max-width: 58%;
  }

  .boss-banner {
    padding: 20px 16px;
  }

  .boss-banner-inner {
    max-width: 100%;
  }

  .boss-banner-sub {
    font-size: 9px;
    line-height: 1.6;
  }

  .boss-banner-line {
    font-size: 6px;
  }

  .status-card {
    -webkit-backdrop-filter: blur(9px);
    backdrop-filter: blur(9px);
  }

  .toast-stack {
    top: 72px;
    width: min(270px, 82%);
  }

  .pause-card,
  .result-card {
    width: 100%;
  }

  .result-stats {
    grid-template-columns: 1fr 1fr;
    gap: 13px 0;
  }

  .result-stats > div:nth-child(2) {
    border-right: 0;
  }

  .result-stats > div:nth-child(3),
  .result-stats > div:nth-child(4) {
    padding-top: 10px;
    border-top: 1px solid rgba(164, 207, 195, 0.1);
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions .primary-button,
  .result-actions .ghost-button {
    width: 100%;
  }

  .pause-actions {
    flex-direction: column;
  }

  .equipment-panel {
    grid-template-columns: 1fr;
  }

  .equipment-panel .gear-card {
    margin-top: 0;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .combat-log {
    grid-template-columns: 1fr;
  }

  .combat-log li:nth-last-child(2):nth-child(odd) {
    border-bottom: 1px dashed rgba(164, 207, 195, 0.08);
  }

  .sidebar {
    margin-bottom: 5px;
  }

  .screen {
    overflow: auto;
  }

  .footer {
    justify-content: center;
  }
}

@media (max-height: 720px) and (min-width: 821px) {
  .start-inner {
    gap: 26px;
  }

  .start-copy h1 {
    margin-top: 10px;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
  }

  .start-desc {
    margin-top: 10px;
    line-height: 1.7;
  }

  .start-rules {
    margin-top: 14px;
    padding-top: 11px;
  }

  .class-visual {
    height: 88px;
  }

  .class-desc {
    min-height: 32px;
  }

  .class-name-row strong {
    font-size: 19px;
  }
}

@media (hover: none), (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-7px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-5px) scale(0.97);
  }
}

@keyframes logIn {
  from {
    opacity: 0;
    transform: translateX(-5px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes gearFlash {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(245, 198, 107, 0);
  }
  35% {
    border-color: rgba(245, 198, 107, 0.7);
    box-shadow: 0 0 26px rgba(245, 198, 107, 0.12);
  }
}

@keyframes dangerEdge {
  0%,
  100% {
    opacity: 0.38;
  }
  50% {
    opacity: 0.95;
  }
}

@keyframes dotPulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.18);
  }
}

@keyframes slowSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes bossHudIn {
  from {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes bossHudPulse {
  0%,
  100% {
    box-shadow:
      0 14px 45px rgba(0, 0, 0, 0.4),
      0 0 28px rgba(var(--boss-accent-rgb), 0.06);
  }
  50% {
    box-shadow:
      0 14px 45px rgba(0, 0, 0, 0.4),
      0 0 42px rgba(var(--boss-accent-rgb), 0.15);
  }
}

@keyframes bossBannerLife {
  0% {
    opacity: 0;
    transform: scale(1.025);
  }
  12% {
    opacity: 1;
    transform: scale(1);
  }
  76% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.99);
  }
}
