:root {
  color-scheme: dark;
  --bg: #090e16;
  --panel: rgba(12, 18, 28, 0.92);
  --panel-strong: #101824;
  --text: #f5fbff;
  --muted: #94a7b7;
  --cyan: #70f6df;
  --line: rgba(255, 255, 255, 0.11);
  --warning: #fff4c2;
  --game-max-width: 540px;
  --side-pad: clamp(10px, 3.5vw, 16px);
  --hud-top-offset: max(12px, env(safe-area-inset-top));
  --bottom-offset: max(12px, env(safe-area-inset-bottom));
  --skill-gap: clamp(5px, 1.4vw, 8px);
  --skill-button-height: clamp(68px, 10.5dvh, 84px);
  --skill-thumb-height: clamp(22px, 4dvh, 30px);
  --skill-bar-height: calc(var(--skill-button-height) + var(--skill-button-height) + var(--skill-gap));
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
  overscroll-behavior: none;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
}

.game-shell {
  position: relative;
  width: min(100vw, var(--game-max-width));
  max-width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  background: #090e16;
  isolation: isolate;
  touch-action: none;
}

.battle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hud {
  position: absolute;
  z-index: 6;
  top: var(--hud-top-offset);
  left: var(--side-pad);
  right: var(--side-pad);
  pointer-events: none;
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand-small {
  color: #94b8c6;
  font-size: 13px;
  line-height: 1.2;
}

.brand-title {
  margin-top: 2px;
  color: #ffffff;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.timer {
  min-width: 56px;
  color: var(--warning);
  font-size: 28px;
  font-weight: 800;
  line-height: 42px;
  text-align: right;
  text-shadow: 0 0 18px rgba(255, 244, 194, 0.28);
}

.round-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(112, 246, 223, 0.4);
  border-radius: 999px;
  background: rgba(11, 20, 30, 0.82);
  color: var(--cyan);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 0 18px rgba(112, 246, 223, 0.14);
}

.round-button.is-selected {
  border-color: #fff4c2;
  color: #fff4c2;
  box-shadow: 0 0 20px rgba(255, 244, 194, 0.22);
}

.tutorial-reentry-button {
  font-size: 15px;
  font-weight: 900;
}

.control-mode-button {
  font-size: 14px;
  font-weight: 900;
}

.control-mode-button.is-selected {
  border-color: #8effee;
  color: #8effee;
  box-shadow: 0 0 18px rgba(142, 255, 238, 0.22);
}

.game-shell.is-mobile {
  --game-max-width: 100vw;
}

.game-shell.is-mobile.is-compact-hud .brand-small,
.game-shell.is-mobile.is-compact-hud .brand-title {
  display: none;
}

.game-shell.is-mobile.is-compact-hud .stats {
  margin-top: 0;
  font-size: 12px;
  padding: 5px 8px;
}

.game-shell.is-mobile.is-compact-hud .battle-hint {
  margin-top: 5px;
  font-size: 12px;
  padding: 5px 8px;
}

.game-shell.is-mobile.is-compact-hud .timer {
  font-size: 24px;
  line-height: 38px;
}

.game-shell.is-mobile.control-fixed::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: calc(var(--joystick-center-x, 82px) - var(--joystick-radius, 58px));
  top: calc(var(--joystick-center-y, 610px) - var(--joystick-radius, 58px));
  width: calc(var(--joystick-radius, 58px) * 2);
  height: calc(var(--joystick-radius, 58px) * 2);
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(112, 246, 223, 0.14), rgba(112, 246, 223, 0.05) 72%, transparent 100%);
  opacity: 0.9;
}

.game-shell.is-mobile.control-fixed.is-playing.has-move-input::after {
  opacity: 0.35;
}

.stats,
.battle-hint {
  margin-top: 9px;
  border: 1px solid rgba(112, 246, 223, 0.18);
  border-radius: 8px;
  background: rgba(6, 11, 18, 0.48);
  padding: 7px 10px;
  color: #d8e7ee;
  font-size: 14px;
  line-height: 1.25;
  backdrop-filter: blur(6px);
}

.battle-hint {
  margin-top: 7px;
  color: #8effee;
}

.boomerang-follow-toggle {
  position: absolute;
  z-index: 8;
  left: var(--side-pad);
  right: var(--side-pad);
  bottom: calc(var(--bottom-offset) + var(--skill-button-height) + 10px);
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  border: 1px solid rgba(255, 228, 92, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 228, 92, 0.18), transparent 48%),
    linear-gradient(145deg, rgba(35, 29, 9, 0.94), rgba(9, 17, 28, 0.96));
  padding: 8px 10px;
  color: #fff4c2;
  text-align: left;
  box-shadow: 0 0 28px rgba(255, 228, 92, 0.22), 0 10px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  pointer-events: auto;
  touch-action: manipulation;
}

.boomerang-follow-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 244, 194, 0.36);
  border-radius: 999px;
  background: rgba(255, 228, 92, 0.12);
  color: #fff4c2;
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 0 18px rgba(255, 228, 92, 0.12);
}

.boomerang-follow-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.boomerang-follow-title {
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.boomerang-follow-subtitle {
  min-width: 0;
  color: #d8e7ee;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boomerang-follow-state {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  min-width: 86px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(4, 8, 14, 0.62);
  padding: 3px;
}

.boomerang-follow-state i {
  border-radius: 999px;
  padding: 5px 7px;
  color: #8fa4b7;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.boomerang-follow-toggle:not(.is-following) [data-mode="manual"],
.boomerang-follow-toggle.is-following [data-mode="follow"] {
  background: #fff4c2;
  color: #101824;
  box-shadow: 0 0 12px rgba(255, 244, 194, 0.24);
}

.boomerang-follow-toggle.is-selected {
  border-color: rgba(112, 246, 223, 0.66);
  background:
    linear-gradient(90deg, rgba(112, 246, 223, 0.18), transparent 48%),
    linear-gradient(145deg, rgba(7, 44, 43, 0.95), rgba(9, 18, 30, 0.96));
  color: #8effee;
  box-shadow: 0 0 24px rgba(112, 246, 223, 0.2);
}

.boomerang-follow-toggle.is-selected .boomerang-follow-mark {
  border-color: rgba(142, 255, 238, 0.48);
  background: rgba(112, 246, 223, 0.14);
  color: #8effee;
}

.boomerang-follow-toggle:disabled {
  opacity: 0.76;
}

.spear-energy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  border: 1px solid rgba(255, 95, 109, 0.24);
  border-radius: 8px;
  background: rgba(7, 12, 18, 0.54);
  padding: 7px 10px;
  color: #ffd5da;
  font-size: 13px;
  backdrop-filter: blur(6px);
}

.spear-energy-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.spear-energy-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--spear-energy-color, #ff5f6d), #fff4c2);
  box-shadow: 0 0 14px rgba(255, 95, 109, 0.32);
}

.spear-energy.is-buffed {
  border-color: color-mix(in srgb, var(--spear-energy-color, #ff5f6d) 54%, rgba(255, 255, 255, 0.18));
}

.spear-energy.is-low .spear-energy-track i {
  animation: spear-energy-warning 520ms ease-in-out infinite alternate;
}

@keyframes spear-energy-warning {
  from {
    opacity: 0.52;
    box-shadow: 0 0 6px rgba(255, 95, 109, 0.2);
  }
  to {
    opacity: 1;
    box-shadow: 0 0 18px rgba(255, 95, 109, 0.55);
  }
}

.spear-energy strong {
  min-width: 42px;
  text-align: right;
}

.skill-bar {
  position: absolute;
  z-index: 7;
  left: var(--side-pad);
  right: var(--side-pad);
  bottom: var(--bottom-offset);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--skill-gap);
  touch-action: manipulation;
}

.spear-buff-bar,
.boomerang-skill-bar {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.skill-button {
  position: relative;
  height: var(--skill-button-height);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(10, 16, 25, 0.9);
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
}

.skill-button.is-selected {
  transform: translateY(calc(var(--skill-gap) * -1));
  border-color: var(--skill-color);
  box-shadow: 0 0 22px color-mix(in srgb, var(--skill-color) 42%, transparent);
}

.skill-button.is-stocked {
  border-color: color-mix(in srgb, var(--skill-color) 68%, rgba(255, 255, 255, 0.18));
  background: color-mix(in srgb, var(--skill-color) 13%, rgba(10, 16, 25, 0.92));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--skill-color) 18%, transparent);
}

.skill-button.is-stocked .skill-meta {
  color: color-mix(in srgb, var(--skill-color) 72%, #e7f5ff);
  font-weight: 800;
}

.skill-button.is-empty {
  opacity: 0.48;
}

.buff-button {
  background: color-mix(in srgb, var(--skill-color) 13%, rgba(10, 16, 25, 0.92));
}

.buff-button .skill-name {
  font-size: clamp(13px, 3vw, 16px);
}

.buff-button .skill-meta {
  color: color-mix(in srgb, var(--skill-color) 65%, #d8e8f0);
  font-weight: 800;
}

.buff-button.is-empty {
  opacity: 0.45;
}

.skill-button:disabled,
.skill-button.is-disabled {
  opacity: 0.72;
}

.skill-thumb {
  position: absolute;
  top: clamp(5px, 1.1dvh, 7px);
  left: clamp(6px, 2vw, 10px);
  right: clamp(6px, 2vw, 10px);
  width: auto;
  height: var(--skill-thumb-height);
}

.skill-name,
.skill-meta {
  position: absolute;
  left: 6px;
  right: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-name {
  bottom: clamp(19px, 3.2dvh, 23px);
  color: #ffffff;
  font-size: clamp(11px, 2.8vw, 13px);
  font-weight: 700;
}

.skill-meta {
  bottom: 7px;
  color: #b8c8d6;
  font-size: clamp(9px, 2.4vw, 10px);
}

.skill-button.is-combo {
  border-color: rgba(255, 244, 194, 0.28);
  background: linear-gradient(160deg, rgba(34, 30, 18, 0.94), rgba(11, 18, 28, 0.92));
}

.skill-button.is-combo.is-selected {
  border-color: #fff4c2;
  box-shadow: 0 0 24px rgba(255, 244, 194, 0.34);
}

.combo-skill-card {
  padding: 0;
}

.combo-release-button {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
}

.combo-skill-card .skill-thumb {
  right: 38px;
  width: calc(100% - 48px);
}

.combo-card-edit {
  position: absolute;
  z-index: 5;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 24px;
  border: 1px solid rgba(255, 244, 194, 0.36);
  border-radius: 7px;
  background: rgba(8, 13, 20, 0.74);
  color: #fff4c2;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 12px rgba(255, 244, 194, 0.12);
}

.combo-card-edit.is-selected {
  background: rgba(255, 244, 194, 0.18);
  border-color: #fff4c2;
}

.combo-card-edit:disabled {
  color: #807967;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.combo-panel {
  position: absolute;
  z-index: 9;
  left: var(--side-pad);
  right: var(--side-pad);
  bottom: calc(var(--bottom-offset) + var(--skill-bar-height) + 14px);
  border: 1px solid rgba(255, 244, 194, 0.28);
  border-radius: 8px;
  background: rgba(7, 12, 18, 0.88);
  padding: 10px;
  color: #effbff;
  pointer-events: auto;
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.32);
}

.combo-panel::after {
  content: "";
  position: absolute;
  right: calc(12.5% - 8px);
  bottom: -8px;
  width: 16px;
  height: 16px;
  border-right: 1px solid rgba(255, 244, 194, 0.28);
  border-bottom: 1px solid rgba(255, 244, 194, 0.28);
  background: rgba(7, 12, 18, 0.88);
  transform: rotate(45deg);
}

.combo-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}

.combo-panel-head strong {
  color: #fff4c2;
  font-size: 15px;
  line-height: 1;
}

.combo-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.combo-panel-actions button,
.combo-slot,
.combo-option {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(12, 19, 28, 0.92);
  color: #d8e8f0;
}

.combo-panel-actions button {
  min-width: 38px;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 800;
}

.combo-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.combo-slot {
  position: relative;
  min-height: 48px;
  padding: 7px 6px 6px;
  text-align: left;
}

.combo-slot.is-active {
  border-color: #fff4c2;
  box-shadow: inset 0 0 0 1px rgba(255, 244, 194, 0.24);
}

.combo-slot span,
.combo-option span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-slot .slot-order {
  color: #94a7b7;
  font-size: 10px;
  line-height: 1;
}

.combo-slot .slot-name {
  margin-top: 5px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
}

.combo-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.combo-option {
  min-height: 36px;
  padding: 0 6px;
  color: var(--skill-color);
  font-size: 12px;
  font-weight: 800;
}

.combo-option.is-used {
  border-color: var(--skill-color);
  background: color-mix(in srgb, var(--skill-color) 18%, rgba(12, 19, 28, 0.92));
  color: #ffffff;
}

.combo-option.is-empty {
  opacity: 0.55;
}

.combo-option:disabled {
  color: #6b7783;
  opacity: 0.55;
}

.weapon-select-layer {
  position: absolute;
  z-index: 22;
  inset: 0;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 18%, rgba(112, 246, 223, 0.11), transparent 34%),
    #090e16;
  padding: max(22px, env(safe-area-inset-top)) var(--side-pad) max(18px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.weapon-select-content {
  width: 100%;
  max-width: min(620px, 100%);
  min-height: calc(100dvh - 44px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.weapon-select-kicker {
  color: #86fff0;
  font-size: 15px;
}

.weapon-select-content h1 {
  margin: 6px 0 8px;
  color: #ffffff;
  font-size: clamp(32px, 8vw, 48px);
  line-height: 1.05;
}

.weapon-select-content p {
  margin: 0 0 18px;
  color: #b9cbd4;
  font-size: 14px;
  line-height: 1.55;
}

.weapon-options {
  display: grid;
  gap: 10px;
}

.weapon-select-layer.is-tutorial-intro .weapon-select-content {
  justify-content: center;
}

.weapon-select-layer.is-tutorial-intro .weapon-options {
  margin-top: 22px;
  place-items: center;
}

.weapon-option {
  min-height: 108px;
  border: 1px solid color-mix(in srgb, var(--weapon-color) 42%, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  background: color-mix(in srgb, var(--weapon-color) 11%, rgba(12, 18, 28, 0.94));
  padding: 13px 14px;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.tutorial-start-button {
  position: relative;
  width: min(100%, 430px);
  min-height: 172px;
  overflow: hidden;
  display: grid;
  align-content: center;
  padding: 24px 78px 24px 24px;
  border-width: 2px;
  border-color: rgba(112, 246, 223, 0.92);
  background:
    linear-gradient(135deg, rgba(112, 246, 223, 0.2), rgba(255, 244, 194, 0.08) 46%, rgba(12, 40, 44, 0.98)),
    rgba(12, 40, 44, 0.94);
  box-shadow:
    0 0 0 1px rgba(255, 244, 194, 0.12),
    0 18px 46px rgba(0, 0, 0, 0.36),
    0 0 38px rgba(112, 246, 223, 0.28);
  transform: translateY(0);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.tutorial-start-button::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 244, 194, 0.16);
  border-radius: 6px;
  pointer-events: none;
}

.tutorial-start-button::after {
  content: ">";
  position: absolute;
  top: 50%;
  right: 24px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 244, 194, 0.8);
  border-radius: 999px;
  background: rgba(255, 244, 194, 0.12);
  color: #fff4c2;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 22px rgba(255, 244, 194, 0.22);
  transform: translateY(-50%);
}

.tutorial-start-button:hover {
  border-color: #fff4c2;
  box-shadow:
    0 0 0 1px rgba(255, 244, 194, 0.18),
    0 20px 50px rgba(0, 0, 0, 0.42),
    0 0 46px rgba(112, 246, 223, 0.36);
  transform: translateY(-2px);
}

.tutorial-start-button:active {
  transform: translateY(1px);
}

.tutorial-start-button strong {
  font-size: 34px;
  line-height: 1;
  text-shadow: 0 0 22px rgba(112, 246, 223, 0.32);
}

.tutorial-start-button .weapon-subtitle {
  margin-top: 10px;
  font-size: 15px;
}

.tutorial-start-button .weapon-hint {
  margin-top: 12px;
  color: #ecfffb;
}

.weapon-option strong,
.weapon-option span {
  display: block;
}

.weapon-option strong {
  color: #ffffff;
  font-size: 20px;
  line-height: 1.15;
}

.weapon-option .weapon-subtitle {
  margin-top: 4px;
  color: var(--weapon-color);
  font-size: 13px;
  font-weight: 800;
}

.weapon-option .weapon-hint {
  margin-top: 8px;
  color: #c7d6de;
  font-size: 13px;
  line-height: 1.45;
}

.forge-layer {
  position: absolute;
  z-index: 20;
  inset: 0;
  overflow-y: auto;
  background: #090e16;
  padding: max(18px, env(safe-area-inset-top)) var(--side-pad) max(18px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.forge-content {
  width: 100%;
  max-width: min(560px, 100%);
  margin: 0 auto;
}

.forge-kicker {
  color: #86fff0;
  font-size: 15px;
  letter-spacing: 0;
}

.forge-content h1 {
  margin: 5px 0 8px;
  color: #ffffff;
  font-size: clamp(28px, 7vw, 36px);
  line-height: 1.08;
}

.forge-current {
  color: #d7f7ff;
  font-size: 17px;
}

.forge-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 18px 0 12px;
}

.progress-item {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(15, 24, 35, 0.9);
  padding: 6px 4px;
  color: #d8e8f0;
  text-align: center;
  font-size: 12px;
  line-height: 1.25;
}

.progress-item.is-active,
.progress-item.is-done {
  border-color: var(--skill-color);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--skill-color) 32%, transparent);
}

.progress-item.is-preset {
  background: color-mix(in srgb, var(--skill-color) 16%, rgba(15, 24, 35, 0.9));
  color: #f7fbff;
}

.draw-card {
  height: clamp(238px, 41dvh, 430px);
  overflow: hidden;
  border: 1px solid rgba(112, 246, 223, 0.22);
  border-radius: 8px;
  background: #101824;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.route-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.forge-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.forge-info div {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(12, 19, 28, 0.92);
  padding: 8px 6px;
}

.forge-info span,
.forge-info strong {
  display: block;
  text-align: center;
}

.forge-info span {
  color: #9fafbd;
  font-size: 12px;
}

.forge-info strong {
  margin-top: 2px;
  color: #f3fbff;
  font-size: 18px;
}

.forge-status {
  min-height: 42px;
  margin: 12px 0;
  color: #b8c8d6;
  font-size: 14px;
  line-height: 1.45;
}

.forge-actions {
  display: grid;
  grid-template-columns: 0.68fr 1fr;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid rgba(112, 246, 223, 0.58);
  background: #163c42;
  color: #eafffb;
  box-shadow: 0 0 24px rgba(112, 246, 223, 0.18);
}

.primary-button:disabled {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(18, 24, 32, 0.9);
  color: #697685;
  box-shadow: none;
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(14, 21, 31, 0.95);
  color: #d6e3eb;
}

.secondary-button:disabled {
  color: #66717d;
}

.result-modal {
  position: absolute;
  z-index: 25;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 8, 14, 0.72);
}

.result-panel {
  width: min(430px, 100%);
  border: 1px solid rgba(112, 246, 223, 0.72);
  border-radius: 8px;
  background: rgba(10, 17, 26, 0.96);
  padding: 24px 22px 22px;
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.44);
}

.result-panel h2 {
  margin: 0;
  color: #ffffff;
  font-size: 25px;
  line-height: 1.2;
}

.result-panel p {
  margin: 12px 0 18px;
  color: #c8d7df;
  font-size: 14px;
  line-height: 1.5;
}

.result-stats {
  display: grid;
  gap: 9px;
  margin-bottom: 22px;
  color: #f4fbff;
  font-size: 17px;
  line-height: 1.35;
}

.tutorial-menu-layer {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 8, 14, 0.68);
  backdrop-filter: blur(10px);
}

.tutorial-menu-panel {
  width: min(460px, 100%);
  border: 1px solid rgba(112, 246, 223, 0.58);
  border-radius: 8px;
  background: rgba(8, 14, 22, 0.96);
  padding: 20px;
  color: #effbff;
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.46);
}

.tutorial-menu-panel h2 {
  margin: 5px 0 8px;
  color: #ffffff;
  font-size: 28px;
  line-height: 1.15;
}

.tutorial-menu-panel p {
  margin: 0 0 16px;
  color: #c8d7df;
  font-size: 14px;
  line-height: 1.45;
}

.tutorial-menu-options {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.tutorial-menu-option {
  position: relative;
  min-height: 82px;
  overflow: hidden;
  border: 1px solid rgba(112, 246, 223, 0.32);
  border-radius: 8px;
  background: rgba(11, 20, 30, 0.92);
  padding: 13px 44px 13px 14px;
  text-align: left;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.tutorial-menu-option::after {
  content: ">";
  position: absolute;
  top: 50%;
  right: 14px;
  color: #fff4c2;
  font-size: 22px;
  font-weight: 900;
  transform: translateY(-50%);
}

.tutorial-menu-option:hover {
  border-color: #fff4c2;
  box-shadow: 0 0 26px rgba(112, 246, 223, 0.18);
  transform: translateY(-1px);
}

.tutorial-menu-option strong,
.tutorial-menu-option span {
  display: block;
}

.tutorial-menu-option strong {
  color: #ffffff;
  font-size: 18px;
  line-height: 1.2;
}

.tutorial-menu-option span {
  margin-top: 6px;
  color: #c7d6de;
  font-size: 13px;
  line-height: 1.35;
}

.tutorial-menu-close {
  width: 100%;
}

.tutorial-layer {
  position: absolute;
  z-index: 31;
  left: var(--side-pad);
  right: var(--side-pad);
  bottom: max(18px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.tutorial-layer.is-top {
  top: max(14px, env(safe-area-inset-top));
  bottom: auto;
}

.tutorial-panel {
  border: 1px solid rgba(255, 244, 194, 0.56);
  border-radius: 8px;
  background: rgba(7, 12, 18, 0.92);
  padding: 14px;
  color: #effbff;
  pointer-events: auto;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

.tutorial-layer.is-compact .tutorial-panel {
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 12px;
}

.tutorial-layer.is-mini .tutorial-panel {
  padding: 7px 10px;
}

.tutorial-layer.is-mini .tutorial-kicker {
  display: none;
}

.tutorial-layer.is-mini .tutorial-panel h2 {
  margin: 0 0 3px;
  font-size: 15px;
  line-height: 1.12;
}

.tutorial-layer.is-mini .tutorial-panel p {
  font-size: 12px;
  line-height: 1.24;
}

.tutorial-kicker {
  color: #fff4c2;
  font-size: 12px;
  font-weight: 900;
}

.tutorial-panel h2 {
  margin: 4px 0 7px;
  color: #ffffff;
  font-size: 19px;
  line-height: 1.2;
}

.tutorial-panel p {
  margin: 0 0 12px;
  color: #d7e7ef;
  font-size: 14px;
  line-height: 1.45;
}

.tutorial-objective {
  margin: 10px 0 12px;
  padding: 8px 10px;
  border: 1px solid rgba(112, 246, 223, 0.22);
  border-radius: 8px;
  background: rgba(112, 246, 223, 0.08);
  color: #ecfffb;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.36;
}

.tutorial-panel .primary-button {
  width: 100%;
}

.tutorial-layer.is-compact .tutorial-panel p {
  margin-bottom: 0;
}

.tutorial-layer.is-compact .tutorial-objective {
  margin-bottom: 0;
}

.tutorial-layer.is-mini .tutorial-objective {
  margin-top: 4px;
  padding: 5px 7px;
  font-size: 11px;
  line-height: 1.2;
}

.tutorial-highlight {
  outline: 2px solid #fff4c2;
  outline-offset: 4px;
  box-shadow: 0 0 0 1px rgba(9, 14, 22, 0.9), 0 0 26px rgba(255, 244, 194, 0.38) !important;
}

.skill-button.tutorial-highlight,
.combo-card-edit.tutorial-highlight,
.combo-slot.tutorial-highlight,
.combo-option.tutorial-highlight,
.buff-button.tutorial-highlight,
.weapon-option.tutorial-highlight {
  position: relative;
  z-index: 32 !important;
}

.combo-panel.tutorial-highlight {
  z-index: 32 !important;
}

.battle-canvas.tutorial-highlight,
.route-canvas.tutorial-highlight {
  outline-offset: -7px;
}

.is-hidden {
  display: none !important;
}

.gm-button {
  color: #ffe45c;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.gm-button.is-selected {
  border-color: #ffe45c;
  background: rgba(255, 228, 92, 0.18);
  color: #fff6bd;
}

.gm-panel {
  position: absolute;
  top: 76px;
  right: 18px;
  z-index: 30;
  display: flex;
  width: min(620px, calc(100% - 36px));
  max-height: min(78vh, 760px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 228, 92, 0.38);
  border-radius: 18px;
  background: rgba(11, 18, 29, 0.97);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5), 0 0 34px rgba(255, 228, 92, 0.08);
  backdrop-filter: blur(18px);
}

.gm-panel-head,
.gm-panel-foot,
.gm-field,
.gm-runtime-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gm-panel-head {
  padding: 16px 18px 12px;
}

.gm-panel-head > div {
  display: grid;
  gap: 3px;
}

.gm-panel-kicker {
  color: #ffe45c;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
}

.gm-panel-head strong {
  color: #f7fbff;
  font-size: 1.1rem;
}

.gm-panel-head button,
.gm-panel-actions button,
.gm-panel-foot button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: #d7e0ec;
  cursor: pointer;
}

.gm-panel-head button {
  width: 30px;
  height: 30px;
  font-size: 1.3rem;
  line-height: 1;
}

.gm-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 18px 12px;
}

.gm-tabs button {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #aebdce;
  cursor: pointer;
  padding: 7px 12px;
}

.gm-tabs button.is-active {
  border-color: rgba(255, 228, 92, 0.62);
  background: rgba(255, 228, 92, 0.14);
  color: #fff4ae;
}

.gm-content {
  min-height: 0;
  overflow: auto;
  padding: 0 18px 14px;
}

.gm-section {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.gm-section h3,
.gm-content > h3 {
  margin: 0 0 9px;
  color: #eef7ff;
  font-size: 0.84rem;
}

.gm-field {
  min-height: 32px;
  color: #b7c5d5;
  font-size: 0.76rem;
}

.gm-field + .gm-field,
.gm-runtime-row + .gm-runtime-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.gm-field input {
  width: 112px;
  border: 1px solid rgba(112, 246, 223, 0.24);
  border-radius: 7px;
  background: rgba(4, 10, 17, 0.78);
  color: #f4fbff;
  font: inherit;
  padding: 5px 7px;
  text-align: right;
}

.gm-runtime-row {
  min-height: 34px;
  color: #b7c5d5;
  font-size: 0.8rem;
}

.gm-runtime-row strong {
  color: #f7fbff;
  font-weight: 700;
}

.gm-panel-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding: 12px 18px 14px;
}

.gm-panel-foot > span {
  color: #8ea1b8;
  font-size: 0.68rem;
}

.gm-panel-foot > div {
  display: flex;
  gap: 7px;
}

.gm-panel-foot button {
  padding: 7px 10px;
}

.gm-panel-foot .primary-button {
  border-color: rgba(112, 246, 223, 0.48);
  background: rgba(112, 246, 223, 0.15);
  color: #b9fff0;
}

@media (pointer: coarse), (max-width: 720px) {
  .gm-panel {
    top: 66px;
    right: 8px;
    width: calc(100% - 16px);
    max-height: 78vh;
  }

  .gm-panel-head,
  .gm-tabs,
  .gm-content,
  .gm-panel-foot {
    padding-left: 12px;
    padding-right: 12px;
  }

  .gm-panel-foot {
    align-items: flex-end;
  }

  .gm-panel-foot > span {
    max-width: 52%;
  }
}

.ui-editor-mode .ui-edit-target {
  outline: 1px dashed rgba(255, 244, 194, 0.56);
  outline-offset: 4px;
  cursor: move;
  pointer-events: auto;
  transform-origin: center center;
}

.ui-editor-mode .ui-edit-target * {
  pointer-events: none;
}

.ui-editor-mode .ui-edit-target.ui-edit-selected {
  outline: 2px solid rgba(255, 228, 92, 0.92);
  box-shadow: 0 0 0 1px rgba(9, 14, 22, 0.9), 0 0 24px rgba(255, 228, 92, 0.24);
}

.ui-editor-mode .ui-edit-target.is-ui-dragging {
  outline-style: solid;
}

.ui-editor-mode #hud.ui-edit-selected.is-hidden {
  display: block !important;
}

.ui-editor-mode #skill-bar.ui-edit-selected.is-hidden {
  display: grid !important;
}

.ui-editor-panel {
  position: fixed;
  z-index: 90;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: min(330px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  border: 1px solid rgba(112, 246, 223, 0.44);
  border-radius: 8px;
  background: rgba(5, 10, 16, 0.88);
  padding: 14px;
  color: #effbff;
  font-size: 14px;
  line-height: 1.3;
  pointer-events: auto;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38);
}

.ui-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  margin-bottom: 12px;
  cursor: grab;
  user-select: none;
}

.ui-editor-head strong {
  color: #ffffff;
  font-size: 17px;
}

.ui-editor-head span {
  color: #8effee;
  font-size: 12px;
}

.ui-editor-targets,
.ui-editor-preview,
.ui-editor-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.ui-editor-targets {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ui-editor-panel button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(16, 24, 34, 0.92);
  color: #d9e8ef;
  font-size: 13px;
}

.ui-editor-panel button.is-active {
  border-color: #ffe45c;
  color: #fff4c2;
  box-shadow: inset 0 0 0 1px rgba(255, 228, 92, 0.2);
}

.ui-editor-panel label {
  display: block;
  margin: 11px 0;
  color: #c6d7df;
}

.ui-editor-panel label span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ui-editor-panel output {
  color: #fff4c2;
}

.ui-editor-panel input[type="range"] {
  width: 100%;
  min-height: 28px;
  accent-color: #70f6df;
}

.ui-editor-css {
  display: none;
  width: 100%;
  min-height: 116px;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(5, 9, 14, 0.92);
  color: #d8e8f0;
  font: 12px/1.4 Consolas, "Microsoft YaHei", monospace;
  resize: vertical;
}

.ui-editor-css.is-visible {
  display: block;
}

@media (max-height: 650px) {
  :root {
    --skill-button-height: 72px;
    --skill-thumb-height: 24px;
  }

  .forge-layer {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .forge-content h1 {
    font-size: 30px;
  }

  .draw-card {
    height: clamp(200px, 35dvh, 248px);
  }

  .combo-panel {
    bottom: calc(var(--bottom-offset) + var(--skill-bar-height) + 12px);
  }

}

@media (min-width: 760px) and (min-height: 700px) {
  :root {
    --game-max-width: 720px;
    --side-pad: 24px;
    --skill-gap: 9px;
    --skill-button-height: 90px;
    --skill-thumb-height: 34px;
  }

  .brand-title {
    font-size: 34px;
  }

  .forge-content {
    max-width: 620px;
  }

  .draw-card {
    height: clamp(340px, 46dvh, 500px);
  }

}

@media (pointer: coarse), (max-width: 720px) {
  :root {
    --game-max-width: 100vw;
    --skill-button-height: clamp(72px, 11.5dvh, 88px);
    --skill-thumb-height: clamp(24px, 4.2dvh, 32px);
  }

  .skill-button {
    min-height: 44px;
  }

  .round-button {
    width: 44px;
    height: 44px;
  }

  .forge-actions .primary-button,
  .forge-actions .secondary-button,
  .weapon-option,
  .tutorial-menu-option {
    min-height: 48px;
  }
}

@media (max-width: 380px) {
  :root {
    --side-pad: 10px;
    --skill-gap: 5px;
    --skill-button-height: 66px;
    --skill-thumb-height: 21px;
  }

  .hud-top {
    gap: 8px;
  }

  .brand-small {
    font-size: 12px;
  }

  .brand-title {
    font-size: 26px;
  }

  .timer {
    min-width: 48px;
    font-size: 24px;
    line-height: 38px;
  }

  .round-button {
    width: 38px;
    height: 38px;
  }

  .tutorial-start-button {
    min-height: 156px;
    padding: 20px 64px 20px 18px;
  }

  .tutorial-start-button::after {
    right: 16px;
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  .tutorial-start-button strong {
    font-size: 30px;
  }

  .stats,
  .battle-hint {
    padding: 6px 8px;
    font-size: 12px;
  }

  .combo-panel {
    padding: 8px;
  }

  .combo-panel-head strong,
  .combo-slot .slot-name {
    font-size: 12px;
  }

  .combo-option {
    padding: 0 4px;
    font-size: 11px;
  }

  .tutorial-menu-panel {
    padding: 16px;
  }

  .tutorial-menu-panel h2 {
    font-size: 24px;
  }

  .tutorial-menu-option {
    min-height: 76px;
    padding: 11px 38px 11px 12px;
  }

  .tutorial-menu-option strong {
    font-size: 16px;
  }

  .forge-current,
  .forge-info strong {
    font-size: 15px;
  }

  .forge-info {
    gap: 6px;
  }

  .forge-info div {
    padding: 7px 4px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --game-max-width: 100vw;
    --side-pad: 12px;
    --hud-top-offset: max(8px, env(safe-area-inset-top));
    --skill-button-height: 60px;
    --skill-thumb-height: 19px;
  }

  .brand-title {
    font-size: 24px;
  }

  .brand-small,
  .stats,
  .battle-hint {
    font-size: 12px;
  }

  .stats,
  .battle-hint {
    margin-top: 5px;
    padding: 5px 8px;
  }

  .round-button {
    width: 36px;
    height: 36px;
    font-size: 19px;
  }

  .weapon-select-layer.is-tutorial-intro .weapon-select-content {
    min-height: calc(100dvh - 20px);
  }

  .weapon-select-layer.is-tutorial-intro .weapon-options {
    margin-top: 12px;
  }

  .tutorial-start-button {
    min-height: 128px;
    padding: 16px 64px 16px 18px;
  }

  .tutorial-start-button strong {
    font-size: 28px;
  }

  .tutorial-start-button .weapon-subtitle {
    margin-top: 7px;
    font-size: 13px;
  }

  .tutorial-start-button .weapon-hint {
    margin-top: 8px;
    font-size: 12px;
  }

  .tutorial-menu-layer {
    align-items: start;
    padding: max(10px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .tutorial-menu-panel {
    max-width: min(640px, 100%);
    padding: 12px;
  }

  .tutorial-menu-panel h2 {
    font-size: 22px;
  }

  .tutorial-menu-panel p {
    margin-bottom: 10px;
    font-size: 12px;
  }

  .tutorial-menu-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .tutorial-menu-option {
    min-height: 78px;
    padding: 10px 22px 10px 10px;
  }

  .tutorial-menu-option::after {
    right: 8px;
    font-size: 18px;
  }

  .tutorial-menu-option strong {
    font-size: 14px;
  }

  .tutorial-menu-option span {
    font-size: 11px;
  }

  .timer {
    min-width: 46px;
    font-size: 23px;
    line-height: 36px;
  }

  .forge-layer {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .forge-content {
    max-width: min(720px, 100%);
  }

  .forge-kicker,
  .forge-current {
    font-size: 13px;
  }

  .forge-content h1 {
    margin: 2px 0 5px;
    font-size: 23px;
  }

  .forge-progress {
    margin: 8px 0;
  }

  .progress-item {
    min-height: 32px;
    padding: 4px;
    font-size: 10px;
  }

  .draw-card {
    height: min(205px, 49dvh);
  }

  .forge-info {
    gap: 6px;
    margin-top: 8px;
  }

  .forge-info div {
    padding: 5px 4px;
  }

  .forge-status {
    min-height: 28px;
    margin: 6px 0;
    font-size: 12px;
    line-height: 1.35;
  }

  .primary-button,
  .secondary-button {
    min-height: 38px;
  }

}
