:root {
  --ink: #e8f2dd;
  --muted: #9eb29f;
  --dim: #657a6c;
  --glass: rgba(8, 25, 20, 0.72);
  --line: rgba(197, 226, 185, 0.16);
  --gold: #e5c174;
  --mint: #8fe0b0;
  --red: #e46f68;
  --blue: #82c7e8;
  --violet: #d4a1ff;
  --orange: #ffad66;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #06110e;
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  user-select: none;
}

button {
  font: inherit;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 48% 36%, rgba(59, 102, 78, 0.22), transparent 42%),
    #06110e;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: default;
  outline: none;
}

.hidden {
  display: none !important;
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.topbar {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: 84px;
  padding: 20px 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(2, 10, 8, 0.72), transparent);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.45));
}

.brand-mark {
  width: 38px;
  height: 38px;
  position: relative;
  border: 1px solid rgba(228, 201, 132, 0.48);
  border-radius: 50% 50% 47% 53%;
  transform: rotate(45deg);
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(143, 224, 176, 0.5);
  border-radius: 50% 5% 50% 5%;
}

.brand-mark span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 13px;
  background: linear-gradient(var(--gold), transparent);
  transform-origin: 50% 100%;
}

.brand-mark span:nth-child(1) { transform: translate(-50%, -100%) rotate(-42deg); }
.brand-mark span:nth-child(2) { transform: translate(-50%, -100%) rotate(12deg); }
.brand-mark span:nth-child(3) { transform: translate(-50%, -100%) rotate(68deg); }

.brand b {
  display: block;
  font-size: 17px;
  letter-spacing: 0.22em;
  color: #ecf4de;
}

.brand small {
  display: block;
  margin-top: 4px;
  font-size: 8px;
  color: #839a89;
  letter-spacing: 0.3em;
}

.stage-pill {
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  min-width: 260px;
  height: 42px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(90deg, transparent, rgba(10, 29, 23, 0.82) 18%, rgba(10, 29, 23, 0.82) 82%, transparent);
  color: #c6d6c6;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 3px #000;
}

.stage-pill b {
  color: var(--gold);
  font-size: 16px;
}

.stage-pill i {
  display: block;
  width: 1px;
  height: 14px;
  background: var(--line);
}

.stage-icon {
  color: var(--gold);
  font-size: 11px;
}

.top-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(217, 232, 216, 0.18);
  border-radius: 50%;
  color: #c4d3c5;
  background: rgba(9, 25, 20, 0.6);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: 160ms ease;
}

.icon-btn:hover {
  color: var(--gold);
  border-color: rgba(229, 193, 116, 0.5);
  background: rgba(30, 54, 43, 0.78);
  transform: translateY(-1px);
}

.boss-panel {
  position: absolute;
  z-index: 11;
  top: 82px;
  left: 50%;
  width: min(620px, 66vw);
  transform: translateX(-50%);
  animation: boss-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes boss-in {
  from { opacity: 0; transform: translate(-50%, -10px) scaleX(0.92); }
}

.boss-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 7px;
  text-shadow: 0 2px 8px black;
}

.boss-label span {
  color: var(--red);
  font-size: 10px;
  letter-spacing: 0.25em;
}

.boss-label b {
  font-size: 19px;
  letter-spacing: 0.2em;
}

.boss-label em {
  margin-left: auto;
  color: #c9a686;
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.14em;
}

.boss-track {
  position: relative;
  height: 12px;
  padding: 2px;
  background: rgba(2, 8, 6, 0.85);
  border: 1px solid rgba(234, 185, 143, 0.2);
  box-shadow: 0 3px 20px rgba(0, 0, 0, 0.45);
  transform: skewX(-12deg);
}

.boss-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #713d31, #d56558 52%, #f2a377);
  box-shadow: 0 0 15px rgba(235, 100, 86, 0.5);
  transition: width 180ms linear;
}

.boss-ticks {
  position: absolute;
  inset: 2px;
  display: flex;
  justify-content: space-evenly;
}

.boss-ticks span {
  width: 1px;
  background: rgba(7, 19, 14, 0.75);
}

.quest-card {
  position: absolute;
  z-index: 8;
  top: 96px;
  right: 30px;
  width: 205px;
  padding: 13px 15px 14px;
  background: linear-gradient(135deg, rgba(10, 30, 23, 0.8), rgba(7, 20, 16, 0.52));
  border: 1px solid rgba(197, 226, 185, 0.13);
  border-right: 2px solid rgba(229, 193, 116, 0.5);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
}

.quest-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quest-kicker {
  color: #7f9783;
  font-size: 9px;
  letter-spacing: 0.2em;
}

.quest-top b {
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.quest-card p {
  margin: 7px 0 9px;
  color: #d4dfd2;
  font-size: 12px;
}

.quest-track {
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.quest-track div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #5aa77f, var(--gold));
  transition: width 300ms ease;
}

.fusion-hint {
  position: absolute;
  z-index: 9;
  top: 188px;
  right: 30px;
  width: 205px;
  padding: 10px 14px;
  background: linear-gradient(110deg, rgba(74, 47, 91, 0.72), rgba(29, 63, 58, 0.78));
  border: 1px solid rgba(212, 161, 255, 0.3);
  box-shadow: 0 0 25px rgba(149, 92, 255, 0.13);
  animation: pulse-hint 2.2s ease-in-out infinite;
}

@keyframes pulse-hint {
  50% { border-color: rgba(212, 161, 255, 0.66); box-shadow: 0 0 30px rgba(149, 92, 255, 0.24); }
}

.fusion-hint span,
.fusion-hint b {
  display: block;
}

.fusion-hint span {
  color: var(--violet);
  font-size: 10px;
}

.fusion-hint b {
  margin-top: 3px;
  color: #e6dcf0;
  font-size: 11px;
  font-weight: 500;
}

.player-panel {
  position: absolute;
  z-index: 8;
  left: 28px;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 13px;
  filter: drop-shadow(0 5px 18px rgba(0, 0, 0, 0.4));
}

.portrait-frame {
  position: relative;
  width: 68px;
  height: 68px;
  padding: 4px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, rgba(229,193,116,.8), rgba(84,135,107,.15), rgba(143,224,176,.65), rgba(229,193,116,.8));
  box-shadow: 0 0 0 1px rgba(5, 16, 12, 0.8), 0 0 22px rgba(143, 224, 176, 0.08);
}

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(4, 13, 10, 0.8);
  border-radius: 50%;
}

#portraitCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #2b4a3b, #071510 70%);
}

#levelBadge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 2;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d1af67;
  color: #142116;
  border: 2px solid #1c3026;
  font-size: 10px;
  font-weight: 800;
}

.player-bars {
  width: 250px;
}

.name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
  padding: 0 1px;
  text-shadow: 0 2px 5px black;
}

.name-row b {
  font-size: 13px;
  letter-spacing: 0.16em;
}

.name-row span {
  color: #b3c6b5;
  font-size: 10px;
}

.health-track {
  position: relative;
  height: 11px;
  overflow: hidden;
  background: rgba(4, 14, 10, 0.82);
  border: 1px solid rgba(232, 244, 221, 0.12);
  transform: skewX(-12deg);
}

.health-fill,
.health-lag {
  position: absolute;
  inset: 1px auto 1px 1px;
  width: calc(100% - 2px);
}

.health-lag {
  background: #d5a36e;
  opacity: 0.5;
  transition: width 700ms ease 160ms;
}

.health-fill {
  z-index: 1;
  background: linear-gradient(90deg, #b7424a, #e27768 66%, #f6b276);
  box-shadow: 0 0 12px rgba(239, 111, 95, 0.3);
  transition: width 160ms ease;
}

.xp-track {
  height: 2px;
  margin-top: 5px;
  background: rgba(255, 255, 255, 0.07);
}

#xpFill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #69c594, #b4edc3);
  box-shadow: 0 0 8px #83d8a8;
}

.weapon-dock {
  position: absolute;
  z-index: 8;
  left: 29px;
  bottom: 113px;
}

.dock-label {
  margin-bottom: 8px;
  color: #d3ded2;
  font-size: 10px;
  letter-spacing: 0.22em;
}

.dock-label span {
  margin-left: 7px;
  color: #687f71;
  letter-spacing: 0.06em;
}

.weapon-slots {
  display: flex;
  gap: 7px;
}

.weapon-slot {
  position: relative;
  width: 72px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  color: #a8b7a9;
  border: 1px solid rgba(204, 227, 201, 0.13);
  background: linear-gradient(145deg, rgba(12, 31, 24, 0.83), rgba(7, 19, 15, 0.66));
  backdrop-filter: blur(9px);
  cursor: pointer;
  transition: 160ms ease;
  overflow: hidden;
}

.weapon-slot::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 160ms ease;
}

.weapon-slot.active {
  color: #f0e3c3;
  border-color: rgba(229, 193, 116, 0.44);
  background: linear-gradient(145deg, rgba(65, 57, 35, 0.7), rgba(17, 39, 29, 0.8));
  transform: translateY(-2px);
}

.weapon-slot.active::after {
  transform: scaleX(1);
}

.weapon-slot.locked {
  opacity: 0.42;
  filter: grayscale(0.7);
}

.weapon-glyph {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 18px;
  transform: rotate(-6deg);
}

.weapon-meta {
  min-width: 0;
}

.weapon-meta b {
  display: block;
  font-size: 10px;
  white-space: nowrap;
}

.weapon-meta small {
  display: block;
  margin-top: 2px;
  color: #788d7d;
  font-size: 8px;
}

.weapon-key {
  position: absolute;
  top: 3px;
  right: 4px;
  color: #708778;
  font-size: 7px;
}

.skill-dock {
  position: absolute;
  z-index: 9;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.skill-wrap {
  display: flex;
  align-items: center;
  filter: drop-shadow(0 9px 24px rgba(0, 0, 0, 0.45));
}

.skill-slot {
  position: relative;
  width: 122px;
  height: 58px;
  padding: 8px 12px 8px 54px;
  display: flex;
  align-items: center;
  background: linear-gradient(145deg, rgba(14, 36, 27, 0.88), rgba(7, 20, 16, 0.82));
  border: 1px solid rgba(219, 235, 215, 0.16);
  overflow: hidden;
  transition: 180ms ease;
}

.skill-slot.cooling {
  filter: saturate(0.65);
}

.skill-slot.locked {
  opacity: 0.48;
}

.skill-slot.fusion {
  border-color: rgba(212, 161, 255, 0.24);
  background: linear-gradient(145deg, rgba(52, 34, 64, 0.9), rgba(13, 28, 27, 0.86));
}

.skill-icon {
  position: absolute;
  left: 9px;
  top: 7px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 25px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.06);
}

.skill-icon.flame {
  color: #ffb06e;
  background: radial-gradient(circle, rgba(255, 124, 66, 0.28), rgba(35, 24, 17, 0.2) 65%);
}

.skill-icon.frost {
  color: #a5dcf0;
  background: radial-gradient(circle, rgba(90, 192, 230, 0.24), rgba(14, 31, 40, 0.2) 65%);
}

.skill-icon.chain {
  color: #dcc6ff;
  background: radial-gradient(circle, rgba(155, 105, 235, 0.24), rgba(20, 25, 39, 0.2) 65%);
}

.skill-icon.fusion {
  color: #dfbaff;
  background: radial-gradient(circle, rgba(177, 107, 255, 0.25), rgba(22, 22, 36, 0.2) 65%);
}

.skill-meta {
  position: relative;
  z-index: 2;
}

.skill-meta b {
  display: block;
  color: #e0e9dc;
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.skill-meta small {
  display: block;
  margin-top: 4px;
  color: #768b7b;
  font-size: 8px;
  white-space: nowrap;
}

.skill-slot .key {
  position: absolute;
  right: 5px;
  top: 4px;
  z-index: 3;
  color: #c4d1c4;
  font-size: 8px;
  font-weight: 700;
}

.cooldown-veil {
  position: absolute;
  inset: 0;
  transform-origin: bottom;
  transform: scaleY(0);
  background: rgba(3, 10, 8, 0.72);
  pointer-events: none;
}

.cooldown-text {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 4px black;
}

.skill-link {
  width: 16px;
  height: 1px;
  background: linear-gradient(90deg, rgba(229, 193, 116, 0.1), rgba(229, 193, 116, 0.5), rgba(229, 193, 116, 0.1));
}

.fusion-link {
  background: linear-gradient(90deg, rgba(212, 161, 255, 0.1), rgba(212, 161, 255, 0.65), rgba(212, 161, 255, 0.1));
}

.dash-info {
  margin-top: 8px;
  color: #708678;
  font-size: 8px;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 3px black;
}

.dash-info span {
  padding: 1px 5px;
  color: #bdcbbf;
  border: 1px solid rgba(255, 255, 255, 0.13);
}

.dash-info b {
  color: var(--mint);
  font-weight: 500;
}

.toast-layer {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 135px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  padding: 8px 18px;
  text-align: center;
  color: #dfe9da;
  font-size: 11px;
  letter-spacing: 0.1em;
  border: 1px solid rgba(219, 237, 214, 0.13);
  background: rgba(7, 23, 17, 0.72);
  backdrop-filter: blur(8px);
  animation: toast-in 2.7s forwards;
}

.toast.gold {
  color: #f1d99d;
  border-color: rgba(229, 193, 116, 0.27);
}

.toast.purple {
  color: #e6caff;
  border-color: rgba(212, 161, 255, 0.34);
  box-shadow: 0 0 18px rgba(157, 91, 240, 0.12);
}

@keyframes toast-in {
  0% { opacity: 0; transform: translateY(8px); }
  12%, 72% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

.screen-banner {
  position: absolute;
  z-index: 16;
  left: 50%;
  top: 41%;
  transform: translate(-50%, -50%);
  font-family: "STSong", "SimSun", serif;
  font-size: clamp(36px, 5vw, 66px);
  letter-spacing: 0.28em;
  color: rgba(238, 231, 202, 0.94);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.9), 0 0 50px rgba(200, 226, 186, 0.22);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.screen-banner.show {
  animation: banner 2.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -42%) scale(0.94); letter-spacing: 0.45em; }
  18%, 60% { opacity: 1; transform: translate(-50%, -50%) scale(1); letter-spacing: 0.28em; }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(1.03); }
}

.overlay {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.overlay.visible {
  display: flex;
}

.modal-screen {
  background: rgba(2, 10, 8, 0.58);
  backdrop-filter: blur(9px) saturate(0.85);
  animation: fade-in 240ms ease;
}

@keyframes fade-in {
  from { opacity: 0; }
}

.modal-card {
  width: min(900px, calc(100vw - 50px));
  padding: 34px 38px 28px;
  background:
    linear-gradient(145deg, rgba(17, 39, 30, 0.96), rgba(6, 19, 15, 0.98)),
    radial-gradient(circle at top, rgba(98, 147, 107, 0.22), transparent 55%);
  border: 1px solid rgba(216, 235, 204, 0.14);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), inset 0 0 80px rgba(112, 162, 117, 0.035);
  position: relative;
  overflow: hidden;
  animation: modal-in 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card::before {
  content: "";
  position: absolute;
  left: 38px;
  right: 38px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(229, 193, 116, 0.65), transparent);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
}

.eyebrow {
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.28em;
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-heading h2,
.pause-modal h2,
.help-modal h2,
.end-modal h2,
.transition-content h2 {
  margin: 8px 0 0;
  font-family: "STSong", "SimSun", serif;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.level-orb {
  min-width: 70px;
  height: 70px;
  padding: 9px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 50%;
  color: #dcc98f;
  font-size: 10px;
  border: 1px solid rgba(229, 193, 116, 0.3);
  background: radial-gradient(circle, rgba(187, 148, 77, 0.14), transparent 68%);
}

.level-orb b {
  display: block;
  margin-top: -8px;
  font-size: 22px;
  color: #f1dfb0;
}

.modal-subtitle {
  margin: 12px 0 25px;
  color: #8fa393;
  font-size: 12px;
}

.choice-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.choice-card {
  position: relative;
  min-height: 272px;
  padding: 20px;
  text-align: left;
  color: var(--ink);
  border: 1px solid rgba(219, 237, 215, 0.13);
  background:
    linear-gradient(160deg, rgba(31, 55, 43, 0.72), rgba(10, 26, 20, 0.85)),
    radial-gradient(circle at 50% 10%, var(--card-glow, rgba(143, 224, 176, 0.14)), transparent 45%);
  cursor: pointer;
  overflow: hidden;
  transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.choice-card:hover,
.choice-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--card-accent, rgba(229, 193, 116, 0.65));
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.26), inset 0 0 40px var(--card-glow, rgba(143, 224, 176, 0.08));
  outline: none;
}

.choice-card.fusion-card {
  --card-accent: #cc95ff;
  --card-glow: rgba(173, 107, 255, 0.22);
  border-color: rgba(204, 149, 255, 0.35);
  background:
    linear-gradient(160deg, rgba(58, 37, 73, 0.9), rgba(10, 27, 24, 0.9)),
    radial-gradient(circle at 50% 10%, rgba(193, 122, 255, 0.2), transparent 45%);
}

.choice-card .choice-index {
  position: absolute;
  right: 13px;
  top: 12px;
  color: #5e7466;
  font-size: 9px;
}

.choice-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  display: grid;
  place-items: center;
  color: var(--card-accent, var(--gold));
  font-family: "STSong", "SimSun", serif;
  font-size: 28px;
  border: 1px solid color-mix(in srgb, var(--card-accent, var(--gold)) 42%, transparent);
  background: radial-gradient(circle, var(--card-glow, rgba(229, 193, 116, 0.16)), transparent 68%);
  transform: rotate(45deg);
}

.choice-icon span {
  transform: rotate(-45deg);
}

.choice-type {
  color: var(--card-accent, var(--gold));
  font-size: 9px;
  letter-spacing: 0.2em;
}

.choice-card h3 {
  margin: 7px 0 5px;
  font-size: 19px;
  letter-spacing: 0.08em;
}

.choice-level {
  color: #718879;
  font-size: 9px;
}

.choice-card p {
  margin: 15px 0 0;
  color: #a1b3a2;
  font-size: 11px;
  line-height: 1.8;
}

.choice-tag {
  position: absolute;
  left: 20px;
  bottom: 18px;
  padding: 3px 8px;
  color: #8fa393;
  font-size: 8px;
  letter-spacing: 0.1em;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-foot {
  margin-top: 19px;
  text-align: center;
  color: #5e7465;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.startScreen,
#startScreen {
  justify-content: flex-start;
  background:
    radial-gradient(circle at 70% 42%, rgba(83, 136, 104, 0.15), transparent 32%),
    linear-gradient(90deg, rgba(2, 10, 8, 0.95) 0%, rgba(2, 12, 9, 0.8) 43%, rgba(3, 13, 10, 0.2) 72%, rgba(2, 9, 7, 0.52) 100%);
  backdrop-filter: blur(2px);
}

.start-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.moon {
  position: absolute;
  right: 14%;
  top: 15%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  opacity: 0.24;
  background: radial-gradient(circle at 42% 38%, #dfead1, #8ea996 30%, rgba(74, 107, 85, 0.2) 63%, transparent 70%);
  filter: blur(1px);
  box-shadow: 0 0 90px rgba(177, 205, 177, 0.17);
}

.mist {
  position: absolute;
  width: 70vw;
  height: 26vh;
  filter: blur(45px);
  opacity: 0.09;
  background: #b8d3b8;
  animation: mist-drift 18s ease-in-out infinite alternate;
}

.mist-a {
  right: -8vw;
  top: 48%;
}

.mist-b {
  right: 8vw;
  top: 35%;
  animation-duration: 23s;
  animation-direction: alternate-reverse;
}

@keyframes mist-drift {
  to { transform: translateX(-13vw) scaleY(1.3); opacity: 0.15; }
}

.start-spirit {
  position: absolute;
  right: 28%;
  top: 35%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c8ebd5;
  box-shadow: 0 0 14px 4px rgba(176, 235, 197, 0.55);
  animation: spirit-float 7s ease-in-out infinite;
}

.start-spirit::after {
  content: "";
  position: absolute;
  left: 90px;
  top: 110px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e5d49c;
  box-shadow: 0 0 10px 2px rgba(229, 212, 156, 0.5);
}

@keyframes spirit-float {
  50% { transform: translate(30px, -25px); opacity: 0.55; }
}

.start-content {
  position: relative;
  z-index: 2;
  width: min(590px, 52vw);
  margin-left: clamp(45px, 8vw, 130px);
  transform: translateY(-3px);
}

.start-content h1 {
  margin: 17px 0 18px;
  font-family: "STSong", "SimSun", serif;
  font-size: clamp(62px, 8vw, 108px);
  line-height: 0.96;
  letter-spacing: 0.08em;
  font-weight: 400;
  color: #e7efdd;
  text-shadow: 0 9px 45px rgba(0, 0, 0, 0.55), 0 0 60px rgba(173, 214, 183, 0.12);
}

.start-content h1 span {
  color: #b9d4a9;
}

.lead {
  margin: 0 0 28px;
  color: #9fb2a2;
  font-family: "STSong", "SimSun", serif;
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: 0.1em;
}

.control-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-bottom: 30px;
  background: rgba(214, 234, 209, 0.09);
  border: 1px solid rgba(214, 234, 209, 0.09);
}

.control-grid > div {
  position: relative;
  min-height: 62px;
  padding: 13px 13px 12px 72px;
  background: rgba(6, 20, 15, 0.67);
}

.control-grid b {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 500;
  color: #cbd9ca;
}

.control-grid small {
  display: block;
  margin-top: 4px;
  color: #64796b;
  font-size: 8px;
}

.kbd {
  position: absolute;
  left: 13px;
  top: 13px;
  min-width: 36px;
  height: 30px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  color: #c8d5c7;
  font-size: 8px;
  border: 1px solid rgba(219, 235, 215, 0.2);
  border-bottom-color: rgba(219, 235, 215, 0.35);
  background: rgba(255, 255, 255, 0.025);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.kbd.wide {
  font-size: 7px;
  letter-spacing: 0.06em;
}

.primary-btn {
  min-width: 230px;
  height: 54px;
  padding: 0 8px 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  color: #172018;
  background: linear-gradient(100deg, #cbb178, #ead9a8 55%, #cfb273);
  border: 1px solid rgba(255, 241, 196, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 35px rgba(229, 193, 116, 0.1);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: 180ms ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35), 0 0 38px rgba(229, 193, 116, 0.22);
  filter: brightness(1.05);
}

.secondary-btn {
  min-width: 180px;
  height: 54px;
  padding: 0 8px 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  color: #d8e3d5;
  background: rgba(13, 34, 26, 0.76);
  border: 1px solid rgba(193, 224, 184, 0.24);
  box-shadow: 0 9px 28px rgba(0, 0, 0, 0.22);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: 180ms ease;
}

.secondary-btn:hover {
  color: #f0dba9;
  border-color: rgba(229, 193, 116, 0.5);
  background: rgba(28, 52, 39, 0.88);
  transform: translateY(-2px);
}

.secondary-btn i {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 16px;
  font-style: normal;
  border: 1px solid rgba(219, 235, 215, 0.12);
}

.start-actions {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
}

.primary-btn i {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-style: normal;
  border: 1px solid rgba(23, 32, 24, 0.2);
}

.network-badge {
  position: absolute;
  z-index: 12;
  top: 82px;
  left: 30px;
  min-height: 30px;
  padding: 6px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #92a897;
  background: rgba(7, 22, 17, 0.72);
  border: 1px solid rgba(192, 222, 185, 0.13);
  backdrop-filter: blur(8px);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.network-badge b {
  color: #dce8d8;
  font-weight: 500;
}

.network-badge i {
  width: 1px;
  height: 11px;
  background: rgba(255, 255, 255, 0.11);
}

.network-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #80dfa4;
  box-shadow: 0 0 8px #80dfa4;
}

.touch-controls {
  display: none;
}

.touch-device.game-running .touch-controls {
  display: block;
}

.joystick-base {
  position: absolute;
  z-index: 15;
  left: 18px;
  bottom: 18px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(157, 204, 163, 0.08), rgba(4, 16, 11, 0.42) 66%),
    rgba(6, 20, 14, 0.26);
  border: 1px solid rgba(198, 228, 190, 0.2);
  box-shadow: inset 0 0 28px rgba(113, 171, 121, 0.08), 0 8px 28px rgba(0, 0, 0, 0.24);
  touch-action: none;
}

.joystick-ring {
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  border: 1px dashed rgba(192, 225, 186, 0.16);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 38% 32%, #d7ebc9, #729d7b 62%, #3e6750);
  border: 1px solid rgba(232, 245, 218, 0.45);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35), 0 0 18px rgba(136, 213, 153, 0.13);
  pointer-events: none;
}

.touch-actions {
  position: absolute;
  z-index: 15;
  right: 138px;
  bottom: 22px;
  display: flex;
  gap: 10px;
}

.touch-action-btn {
  width: 55px;
  height: 55px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  color: #dce9d8;
  background: radial-gradient(circle at 40% 30%, rgba(77, 118, 87, 0.88), rgba(9, 29, 20, 0.85));
  border: 1px solid rgba(201, 229, 194, 0.24);
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  touch-action: manipulation;
}

.touch-action-btn.dash {
  color: #f1d99b;
  border-color: rgba(229, 193, 116, 0.33);
}

.touch-action-btn span {
  font-size: 18px;
  line-height: 1;
}

.touch-action-btn small {
  font-size: 7px;
  letter-spacing: 0.08em;
}

.touch-action-btn:active {
  transform: scale(0.93);
  filter: brightness(1.22);
}

.online-modal {
  width: min(690px, calc(100vw - 40px));
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  z-index: 3;
  right: 20px;
  top: 18px;
  width: 31px;
  height: 31px;
  color: #849989;
  background: transparent;
  border: 1px solid rgba(207, 231, 200, 0.13);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--gold);
  border-color: rgba(229, 193, 116, 0.4);
}

.online-modal h2 {
  margin: 9px 0 0;
  font-family: "STSong", "SimSun", serif;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.online-form {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 14px;
  margin-top: 22px;
}

.online-form label {
  display: block;
}

.online-form label:nth-child(3) {
  grid-column: 1 / -1;
}

.online-form label > span {
  display: block;
  margin-bottom: 7px;
  color: #8fa393;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.online-input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  color: #e2ecde;
  background: rgba(3, 14, 10, 0.62);
  border: 1px solid rgba(209, 232, 203, 0.16);
  outline: none;
  font: 12px "Microsoft YaHei UI", sans-serif;
  transition: 160ms ease;
}

.online-input:focus {
  border-color: rgba(229, 193, 116, 0.55);
  box-shadow: 0 0 0 2px rgba(229, 193, 116, 0.06);
}

.room-code-input {
  text-transform: uppercase;
  letter-spacing: 0.38em;
  font-weight: 700;
}

.online-actions {
  margin-top: 23px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.online-error {
  min-height: 18px;
  margin: 11px 0 0;
  color: #ef8f80;
  font-size: 10px;
}

.online-hint {
  margin: 10px 0 0;
  color: #617668;
  font-size: 8px;
  line-height: 1.7;
}

.online-hint code {
  padding: 1px 4px;
  color: #b8c9b8;
  background: rgba(255, 255, 255, 0.04);
}

.room-code-display {
  margin: 20px 0 16px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(5, 18, 13, 0.58);
  border: 1px solid rgba(229, 193, 116, 0.2);
}

.room-code-display span {
  color: #778c7d;
  font-size: 9px;
  letter-spacing: 0.14em;
}

.room-code-display b {
  margin-right: auto;
  color: #edd69c;
  font-size: 24px;
  letter-spacing: 0.32em;
}

.copy-btn {
  padding: 7px 10px;
  color: #a9bbaa;
  background: transparent;
  border: 1px solid rgba(213, 232, 206, 0.15);
  font-size: 9px;
  cursor: pointer;
}

.online-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.online-player {
  min-height: 48px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: rgba(17, 40, 30, 0.6);
  border: 1px solid rgba(202, 229, 195, 0.1);
}

.online-player-avatar {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  color: #1a2118;
  background: var(--player-color, #8fd2a1);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.online-player b {
  display: block;
  color: #dde8d9;
  font-size: 11px;
  font-weight: 500;
}

.online-player small {
  display: block;
  margin-top: 3px;
  color: #74887a;
  font-size: 8px;
}

.online-player .host-tag {
  margin-left: auto;
  padding: 2px 5px;
  color: #e2c57f;
  border: 1px solid rgba(229, 193, 116, 0.24);
  font-size: 7px;
}

.lobby-status-row {
  margin-top: 15px;
  display: flex;
  justify-content: space-between;
  color: #7f9384;
  font-size: 9px;
}

.lobby-actions {
  margin-top: 16px;
}

.start-note {
  margin: 13px 0 0;
  color: #52675a;
  font-size: 8px;
  letter-spacing: 0.07em;
}

.pause-modal {
  width: min(500px, calc(100vw - 40px));
  text-align: center;
}

.pause-modal p {
  margin: 12px 0 24px;
  color: #899c8c;
  font-size: 12px;
}

.pause-stats,
.end-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 25px 0;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pause-stats div,
.end-stats div {
  padding: 15px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.pause-stats div:last-child,
.end-stats div:last-child {
  border-right: 0;
}

.pause-stats span,
.end-stats span {
  display: block;
  margin-bottom: 5px;
  color: #718678;
  font-size: 8px;
  letter-spacing: 0.12em;
}

.pause-stats b,
.end-stats b {
  color: #e9d39d;
  font-size: 20px;
}

.text-btn {
  margin-top: 12px;
  padding: 9px 15px;
  color: #768b7c;
  background: transparent;
  border: 0;
  font-size: 10px;
  cursor: pointer;
}

.text-btn:hover {
  color: #b3c5b4;
}

.help-modal {
  width: min(760px, calc(100vw - 40px));
}

.help-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
  margin: 24px 0;
}

.help-columns h3 {
  margin: 0 0 10px;
  color: #d9e5d7;
  font-size: 13px;
  letter-spacing: 0.16em;
}

.help-columns p {
  margin: 0 0 9px;
  color: #8fa193;
  font-size: 10px;
  line-height: 1.8;
}

.help-columns p b {
  color: #d2be88;
}

.fusion-legend {
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #849788;
  font-size: 9px;
  border: 1px solid rgba(212, 161, 255, 0.16);
  background: rgba(46, 30, 57, 0.32);
}

.fusion-legend > span {
  margin-right: 6px;
  color: var(--violet);
  letter-spacing: 0.16em;
}

.fusion-legend b {
  color: #b7c8b6;
  font-weight: 500;
}

.fusion-legend i {
  color: #8c6aa3;
  font-style: normal;
}

.fusion-legend em {
  color: #e0baff;
  font-style: normal;
}

.help-modal .primary-btn {
  margin-top: 20px;
  float: right;
}

.transition-screen {
  background: radial-gradient(circle at 50% 55%, rgba(217, 194, 131, 0.12), transparent 33%), rgba(2, 11, 8, 0.78);
  backdrop-filter: blur(7px);
  text-align: center;
}

.transition-content {
  position: relative;
  animation: transition-copy 1s ease;
}

.transition-content p {
  color: #91a293;
  font-family: "STSong", "SimSun", serif;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.transition-glow {
  width: 8px;
  height: 8px;
  margin: 36px auto 0;
  border-radius: 50%;
  background: #f5e0a8;
  box-shadow: 0 0 30px 8px rgba(245, 224, 168, 0.5), 0 0 100px 40px rgba(132, 197, 144, 0.13);
  animation: transition-pulse 1.1s ease-in-out infinite alternate;
}

@keyframes transition-copy {
  from { opacity: 0; transform: translateY(10px); }
}

@keyframes transition-pulse {
  to { transform: scale(1.5); opacity: 0.7; }
}

.end-modal {
  width: min(640px, calc(100vw - 40px));
  text-align: center;
}

.end-modal p {
  max-width: 430px;
  margin: 13px auto 25px;
  color: #8fa293;
  font-size: 12px;
  line-height: 1.8;
}

.end-stats {
  grid-template-columns: repeat(4, 1fr);
}

.end-stats div:nth-child(3) {
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 1050px) {
  .player-bars {
    width: 190px;
  }

  .weapon-slot {
    width: 62px;
  }

  .weapon-meta b {
    font-size: 9px;
  }

  .skill-slot {
    width: 105px;
  }

  .skill-meta b {
    font-size: 10px;
  }

  .start-content {
    width: min(550px, 60vw);
  }
}

@media (max-width: 780px), (pointer: coarse) {
  .topbar {
    padding: 16px 18px;
  }

  .brand small,
  .stage-pill,
  .quest-card {
    display: none;
  }

  .brand b {
    font-size: 14px;
  }

  .player-panel {
    left: 14px;
    top: 72px;
    bottom: auto;
  }

  .player-bars {
    width: 155px;
  }

  .weapon-dock {
    display: none;
  }

  .weapon-slot {
    width: 52px;
    padding: 5px;
  }

  .weapon-meta,
  .dock-label span {
    display: none;
  }

  .weapon-glyph {
    margin: auto;
  }

  .skill-dock {
    left: auto;
    right: 14px;
    bottom: 14px;
    transform: none;
  }

  .skill-wrap {
    width: 116px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }

  .skill-slot {
    width: 56px;
    height: 52px;
    padding: 0;
    justify-content: center;
  }

  .skill-icon {
    position: relative;
    left: auto;
    top: auto;
    width: 38px;
    height: 38px;
    font-size: 21px;
  }

  .skill-meta,
  .skill-link,
  .dash-info {
    display: none;
  }

  .start-content {
    width: calc(100vw - 48px);
    margin: 0 24px;
  }

  .start-content h1 {
    font-size: 60px;
  }

  .control-grid {
    grid-template-columns: 1fr;
    max-height: 218px;
    overflow: auto;
  }

  .start-content .lead {
    font-size: 12px;
  }

  .start-actions {
    align-items: stretch;
  }

  .start-actions .primary-btn,
  .start-actions .secondary-btn {
    width: 100%;
  }

  .start-note {
    display: none;
  }

  .modal-card {
    padding: 25px 20px 20px;
    max-height: 88vh;
    overflow-y: auto;
  }

  .choice-cards {
    grid-template-columns: 1fr;
  }

  .choice-card {
    min-height: 150px;
    padding-left: 95px;
  }

  .choice-icon {
    position: absolute;
    left: 23px;
    top: 35px;
  }

  .help-columns {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .end-stats {
    grid-template-columns: 1fr 1fr;
  }

  .online-form,
  .online-players {
    grid-template-columns: 1fr;
  }

  .online-form label:nth-child(3) {
    grid-column: auto;
  }

  .network-badge {
    top: 130px;
    left: 14px;
  }

  .touch-actions {
    right: 132px;
    bottom: 18px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  #app {
    min-height: 0;
  }

  .joystick-base {
    width: 104px;
    height: 104px;
    left: 14px;
    bottom: 12px;
  }

  .skill-dock {
    right: 10px;
    bottom: 10px;
  }

  .touch-actions {
    right: 120px;
    bottom: 14px;
  }

  .player-panel {
    top: 62px;
  }

  .network-badge {
    top: 112px;
  }
}
