:root {
  color-scheme: dark;
  --bg: #070913;
  --surface: #101425;
  --surface-2: #151a2e;
  --ink: #f7f7ff;
  --muted: #a7aec8;
  --line: rgba(255, 255, 255, 0.12);
  --cyan: #71e7ff;
  --pink: #ff5ca8;
  --yellow: #ffd65b;
  --red: #ff4d5f;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --display: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body {
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
[hidden] { display: none !important; }

.ambient { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.ambient__orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .22; }
.ambient__orb--a { width: 38vw; height: 38vw; left: -14vw; top: -12vw; background: #5b61ff; }
.ambient__orb--b { width: 42vw; height: 42vw; right: -17vw; bottom: -18vw; background: #db247f; }
.ambient__grid {
  position: absolute; inset: 0;
  opacity: .11;
  background-image: linear-gradient(rgba(135, 151, 255, .22) 1px, transparent 1px), linear-gradient(90deg, rgba(135, 151, 255, .22) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 80%, transparent 100%);
}
.ambient__noise {
  position: absolute; inset: -20%; opacity: .035;
  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='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  animation: noise-shift .25s steps(2) infinite;
}
@keyframes noise-shift { to { transform: translate3d(2%, -2%, 0); } }

#app { position: relative; z-index: 1; width: 100%; height: 100dvh; min-height: 620px; }
.screen { position: absolute; inset: 0; opacity: 0; visibility: hidden; transform: scale(1.015); transition: opacity .35s ease, transform .6s var(--ease-out), visibility .35s; }
.screen.is-active { opacity: 1; visibility: visible; transform: none; z-index: 2; }

.screen--home { display: flex; flex-direction: column; padding: clamp(20px, 3vw, 44px) clamp(24px, 5vw, 82px) 24px; overflow: hidden; }
.home-nav { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 3; }
.brand-chip { display: inline-flex; align-items: center; gap: 9px; color: #bac2dc; font-weight: 800; font-size: 11px; letter-spacing: .18em; }
.brand-chip__dot { width: 8px; height: 8px; border-radius: 2px; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); transform: rotate(45deg); }
.home-nav__actions { display: flex; align-items: center; gap: 8px; }
.icon-button, .text-button { border: 0; background: transparent; cursor: pointer; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--cyan); font-size: 17px; }
.text-button { padding: 10px 12px; color: #cdd2e7; font-size: 13px; font-weight: 700; }
.text-button:hover { color: #fff; }

.hero { flex: 1; display: grid; grid-template-columns: minmax(440px, .92fr) minmax(400px, 1.08fr); align-items: center; min-height: 0; max-width: 1600px; width: 100%; margin: 0 auto; }
.hero__copy { position: relative; z-index: 3; padding-bottom: 8px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: #939bb6; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.eyebrow i { width: 4px; height: 4px; background: var(--pink); transform: rotate(45deg); }
.logo { position: relative; display: inline-flex; flex-direction: column; margin: 0 0 16px; font-family: var(--display); transform: skew(-3deg); }
.logo__kicker { margin-left: 5px; color: var(--cyan); font-size: clamp(12px, 1vw, 15px); letter-spacing: .46em; text-shadow: 0 0 18px rgba(113, 231, 255, .45); }
.logo__main { display: flex; align-items: baseline; font-size: clamp(64px, 7vw, 118px); line-height: .92; letter-spacing: -.09em; filter: drop-shadow(0 20px 30px rgba(0, 0, 0, .35)); }
.logo__main b { color: #f9faff; -webkit-text-stroke: 1px rgba(255,255,255,.12); }
.logo__main em { position: relative; color: var(--yellow); font-style: normal; font-size: .66em; margin-left: .06em; text-shadow: 5px 5px 0 #e74368; }
.logo__main em::before { content: "乱斗"; position: absolute; left: -3px; top: -3px; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.45); z-index: -1; }
.logo__slash { position: absolute; width: 94%; height: 7px; left: 2%; bottom: -11px; background: linear-gradient(90deg, transparent, var(--pink) 14%, var(--yellow) 78%, transparent); clip-path: polygon(0 35%, 86% 0, 100% 42%, 15% 100%); }
.hero__lead { max-width: 620px; margin: 0 0 24px; color: #afb6cf; line-height: 1.75; font-size: clamp(14px, 1.15vw, 17px); }

.mode-list { display: grid; width: min(100%, 600px); gap: 8px; }
.mode-card {
  position: relative; display: grid; grid-template-columns: 48px 1fr 28px; align-items: center; gap: 14px;
  min-height: 66px; padding: 10px 16px; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(255,255,255,.1); border-radius: 6px; background: rgba(16,20,37,.66); backdrop-filter: blur(16px);
  text-align: left; transition: transform .25s var(--ease-out), border-color .25s, background .25s;
}
.mode-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, rgba(113,231,255,.13), transparent 42%); opacity: 0; transition: opacity .25s; }
.mode-card:hover { transform: translateX(7px); border-color: rgba(113,231,255,.52); background: rgba(22,28,49,.92); }
.mode-card:hover::before, .mode-card--primary::before { opacity: 1; }
.mode-card--primary { border-color: rgba(113,231,255,.3); }
.mode-card__index { position: relative; color: #6e7897; font-family: var(--display); font-size: 13px; letter-spacing: .08em; }
.mode-card--primary .mode-card__index { color: var(--cyan); }
.mode-card__body { position: relative; display: flex; flex-direction: column; gap: 2px; }
.mode-card__body strong { font-size: 17px; letter-spacing: .05em; }
.mode-card__body small { color: #858da9; font-size: 11px; }
.mode-card__arrow { position: relative; color: #7c87a5; font-size: 28px; font-weight: 200; }
.mode-card:hover .mode-card__arrow { color: var(--cyan); }
.quick-controls { display: flex; align-items: center; gap: 18px; margin-top: 18px; color: #717a98; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.quick-controls > div { display: flex; align-items: center; gap: 4px; }
kbd { display: inline-grid; min-width: 24px; height: 24px; place-items: center; padding: 0 6px; border: 1px solid rgba(255,255,255,.16); border-bottom-color: rgba(255,255,255,.3); border-radius: 4px; background: rgba(255,255,255,.055); color: #dfe3f3; box-shadow: 0 2px 0 rgba(0,0,0,.35); font: 700 10px var(--body); }

.hero__visual { position: relative; align-self: stretch; min-height: 440px; display: grid; place-items: center; }
.poster-shell { position: relative; width: min(49vw, 760px); aspect-ratio: 1.16; transform: translateX(3%) rotate(1.2deg); }
.poster-shell::before { content: ""; position: absolute; inset: 6% 5%; z-index: -1; border: 1px solid rgba(113,231,255,.22); transform: rotate(-3deg); }
.poster-shell__halo { position: absolute; width: 90%; height: 90%; left: 5%; top: 8%; border-radius: 50%; background: radial-gradient(circle, rgba(112,232,255,.27), rgba(124,69,255,.12) 38%, transparent 68%); filter: blur(12px); animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); opacity: .72; } }
.poster-shell img { position: absolute; width: 100%; height: 100%; object-fit: cover; object-position: center 65%; clip-path: polygon(10% 4%, 96% 0, 100% 89%, 87% 100%, 2% 94%, 0 14%); filter: saturate(.78) contrast(1.08) brightness(.83); image-rendering: pixelated; }
.poster-shell::after { content: ""; position: absolute; inset: 0; clip-path: polygon(10% 4%, 96% 0, 100% 89%, 87% 100%, 2% 94%, 0 14%); background: linear-gradient(125deg, rgba(5,8,20,.55) 0%, transparent 35%, transparent 66%, rgba(255,69,147,.26) 100%), repeating-linear-gradient(0deg, transparent 0 4px, rgba(255,255,255,.025) 5px); }
.poster-shell__cut { position: absolute; z-index: 2; height: 5px; background: var(--cyan); box-shadow: 0 0 20px rgba(113,231,255,.6); }
.poster-shell__cut--top { width: 24%; right: 5%; top: 0; }
.poster-shell__cut--bottom { width: 30%; left: 3%; bottom: 4%; background: var(--pink); }
.poster-shell__label { position: absolute; z-index: 3; right: -1%; bottom: 5%; display: flex; align-items: center; gap: 9px; padding: 8px 12px; background: #f2f4ff; color: #080b18; transform: skew(-8deg); box-shadow: 9px 9px 0 var(--pink); }
.poster-shell__label span { font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.poster-shell__label b { font-family: var(--display); font-size: 15px; }
.floating-tag { position: absolute; z-index: 4; padding: 7px 10px; border: 1px solid var(--line); background: rgba(8,11,25,.68); color: #b8c1dc; font-size: 9px; font-weight: 900; letter-spacing: .18em; backdrop-filter: blur(10px); }
.floating-tag--a { left: 4%; top: 20%; transform: rotate(-7deg); }
.floating-tag--b { right: 2%; top: 32%; transform: rotate(5deg); color: var(--yellow); }
.spark { position: absolute; width: 7px; height: 7px; background: var(--pink); transform: rotate(45deg); box-shadow: 0 0 16px var(--pink); animation: float 3.5s ease-in-out infinite; }
.spark--a { left: 12%; bottom: 19%; }
.spark--b { right: 10%; top: 14%; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); animation-delay: -1.8s; }
@keyframes float { 50% { transform: rotate(135deg) translateY(-14px); } }
.home-footer { display: flex; justify-content: space-between; color: #626b88; font-size: 10px; font-weight: 700; letter-spacing: .08em; }

/* Character select */
.screen--select { padding: clamp(18px, 2.5vw, 38px) clamp(22px, 4vw, 64px) clamp(18px, 2.5vw, 36px); display: flex; flex-direction: column; overflow: hidden; }
.screen--select::before { content: "SELECT"; position: absolute; right: -2vw; top: 4vh; color: rgba(255,255,255,.025); font-family: var(--display); font-size: 20vw; line-height: .8; letter-spacing: -.08em; pointer-events: none; }
.select-header { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 66px; }
.back-button { justify-self: start; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: #aeb6d0; cursor: pointer; font-weight: 800; font-size: 13px; }
.back-button span { font-size: 30px; font-weight: 300; }
.select-heading { text-align: center; }
.select-heading span { color: var(--cyan); font-size: 9px; font-weight: 900; letter-spacing: .26em; }
.select-heading h2 { margin: 4px 0 0; font: 900 clamp(22px, 2vw, 32px)/1 var(--display); letter-spacing: .08em; }
.match-badge { justify-self: end; padding: 8px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; color: #bac2db; background: rgba(255,255,255,.04); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.select-layout { position: relative; z-index: 1; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(470px, 1.1fr) minmax(330px, .9fr); gap: clamp(22px, 4vw, 70px); align-items: center; max-width: 1500px; width: 100%; margin: 0 auto; }
.fighter-grid { display: grid; grid-template-columns: repeat(2, minmax(190px, 1fr)); gap: 12px; align-content: center; }
.fighter-card { --char: #71e7ff; position: relative; min-height: clamp(170px, 22vh, 250px); overflow: hidden; border: 1px solid rgba(255,255,255,.1); border-radius: 5px; background: linear-gradient(145deg, rgba(23,28,50,.84), rgba(10,13,25,.88)); cursor: pointer; text-align: left; transition: transform .28s var(--ease-out), border-color .25s, box-shadow .25s; }
.fighter-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 72% 48%, color-mix(in srgb, var(--char) 20%, transparent), transparent 43%); opacity: .55; transition: opacity .25s; }
.fighter-card::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 4px; background: var(--char); transform: scaleX(.12); transform-origin: left; transition: transform .35s var(--ease-out); }
.fighter-card:hover, .fighter-card.is-focused { transform: translateY(-4px); border-color: color-mix(in srgb, var(--char) 62%, transparent); box-shadow: 0 16px 40px rgba(0,0,0,.26); }
.fighter-card.is-focused::before { opacity: 1; }
.fighter-card.is-focused::after { transform: scaleX(1); }
.fighter-card.is-selected-p1 { box-shadow: inset 0 0 0 2px var(--cyan), 0 0 30px rgba(113,231,255,.16); }
.fighter-card.is-selected-p2 { box-shadow: inset 0 0 0 2px var(--pink), 0 0 30px rgba(255,92,168,.16); }
.fighter-card img { position: absolute; z-index: 1; right: -3%; bottom: -6%; width: 72%; height: 108%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 12px 18px rgba(0,0,0,.42)); transition: transform .35s var(--ease-out); }
.fighter-card:hover img, .fighter-card.is-focused img { transform: scale(1.05) translateY(-2%); }
.fighter-card__number { position: absolute; z-index: 2; left: 16px; top: 14px; color: color-mix(in srgb, var(--char) 70%, #fff); font: 900 10px var(--display); letter-spacing: .16em; }
.fighter-card__name { position: absolute; z-index: 2; left: 16px; bottom: 18px; display: flex; flex-direction: column; }
.fighter-card__name strong { font: 900 clamp(22px, 2.2vw, 35px)/1 var(--display); letter-spacing: .05em; text-shadow: 0 4px 16px rgba(0,0,0,.8); }
.fighter-card__name small { margin-top: 5px; color: #8f98b7; font-size: 9px; font-weight: 900; letter-spacing: .17em; }
.fighter-card__pick { position: absolute; z-index: 3; right: 12px; top: 12px; display: flex; gap: 5px; }
.fighter-card__pick span { display: none; min-width: 27px; height: 20px; place-items: center; border-radius: 2px; color: #07101a; font: 900 9px var(--display); }
.fighter-card.is-selected-p1 .fighter-card__pick .p1 { display: grid; background: var(--cyan); }
.fighter-card.is-selected-p2 .fighter-card__pick .p2 { display: grid; background: var(--pink); }
.fighter-detail { --detail-color: #ffd65b; position: relative; min-height: 470px; display: grid; grid-template-columns: minmax(220px, .85fr) minmax(230px, 1fr); align-items: center; }
.fighter-detail__number { position: absolute; right: 1%; top: 3%; color: rgba(255,255,255,.04); font: 900 180px/.8 var(--display); letter-spacing: -.1em; }
.fighter-detail__portrait-wrap { position: relative; z-index: 1; height: min(54vh, 540px); min-height: 390px; display: flex; align-items: end; justify-content: center; }
.fighter-detail__portrait-wrap::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: 5%; height: 24px; border-radius: 50%; background: rgba(0,0,0,.45); filter: blur(10px); }
.fighter-detail__aura { position: absolute; width: 85%; aspect-ratio: 1; left: 7.5%; top: 8%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--detail-color) 35%, transparent), transparent 64%); filter: blur(12px); }
.fighter-detail__portrait-wrap img { position: relative; z-index: 1; width: 130%; max-width: 520px; height: 100%; object-fit: contain; object-position: center bottom; image-rendering: pixelated; filter: drop-shadow(0 22px 24px rgba(0,0,0,.38)); }
.fighter-detail__copy { position: relative; z-index: 2; padding-left: 10px; }
.fighter-detail__role { display: inline-block; padding: 5px 8px; margin-bottom: 8px; background: var(--detail-color); color: #080a13; font-size: 9px; font-weight: 950; letter-spacing: .12em; transform: skew(-6deg); }
.fighter-detail h3 { margin: 0; font: 900 clamp(50px, 5.5vw, 86px)/.95 var(--display); letter-spacing: -.05em; }
.fighter-detail__copy > p { min-height: 26px; margin: 10px 0 24px; color: #9fa8c4; font-size: 13px; }
.stats { display: grid; gap: 10px; max-width: 320px; }
.stats > div { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 10px; color: #7f89a8; font-size: 10px; font-weight: 900; }
.stats i { height: 4px; overflow: hidden; background: rgba(255,255,255,.09); transform: skew(-12deg); }
.stats b { display: block; width: 50%; height: 100%; background: linear-gradient(90deg, var(--detail-color), #fff); box-shadow: 0 0 12px var(--detail-color); transition: width .45s var(--ease-out); }
.skill-preview { margin-top: 22px; padding-left: 12px; border-left: 2px solid var(--detail-color); display: flex; flex-direction: column; gap: 3px; }
.skill-preview span { color: #707a9a; font-size: 8px; font-weight: 900; letter-spacing: .2em; }
.skill-preview strong { font-size: 15px; letter-spacing: .06em; }
.versus-dock { position: relative; z-index: 3; display: grid; grid-template-columns: minmax(220px, 1fr) 72px minmax(220px, 1fr) minmax(180px, .75fr); gap: 12px; align-items: stretch; width: min(100%, 1180px); margin: 10px auto 0; }
.player-slot { position: relative; min-height: 72px; padding: 11px 14px 10px 82px; border: 1px solid var(--line); border-radius: 4px; background: rgba(15,19,35,.8); overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.player-slot img { display: none; position: absolute; left: 8px; bottom: -18px; width: 78px; height: 100px; object-fit: contain; image-rendering: pixelated; }
.player-slot.has-pick img { display: block; }
.player-slot__label { color: var(--cyan); font-size: 8px; font-weight: 950; letter-spacing: .2em; }
.player-slot--p2 .player-slot__label { color: var(--pink); }
.player-slot strong { margin-top: 3px; font-size: 15px; }
.player-slot small { margin-top: 1px; color: #717b99; font-size: 9px; }
.versus-mark { display: flex; justify-content: center; align-items: center; color: rgba(255,255,255,.16); font: italic 900 30px/.65 var(--display); transform: skew(-9deg); }
.versus-mark span:last-child { color: rgba(255,92,168,.4); transform: translate(-3px, 10px); }
.launch-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; border: 0; border-radius: 4px; background: linear-gradient(105deg, var(--pink), #ff7d5c); box-shadow: 8px 8px 0 rgba(255,214,91,.8); color: #fff; cursor: pointer; font-weight: 950; letter-spacing: .08em; transition: transform .2s var(--ease-out), filter .2s; }
.launch-button:hover:not(:disabled) { transform: translate(-2px, -2px); filter: brightness(1.1); }
.launch-button:disabled { cursor: not-allowed; filter: grayscale(1); opacity: .36; box-shadow: none; }
.launch-button i { font-size: 28px; font-style: normal; font-weight: 300; }

/* Game */
.screen--game { display: grid; place-items: center; background: #050712; }
.game-shell { position: relative; width: min(100vw, calc(100dvh * 16 / 9)); max-height: 100dvh; aspect-ratio: 16 / 9; overflow: hidden; background: #090d1d; box-shadow: 0 0 80px rgba(0,0,0,.65); touch-action: none; }
#game-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.game-loading { position: absolute; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: #080b18; transition: opacity .45s ease, visibility .45s; }
.game-loading.is-hidden { opacity: 0; visibility: hidden; }
.game-loading strong { margin-top: 7px; font: 900 14px var(--display); letter-spacing: .12em; }
.game-loading span { color: var(--cyan); font: 900 10px var(--display); }
.loader-ring { width: 52px; height: 52px; border: 3px solid rgba(255,255,255,.08); border-top-color: var(--cyan); border-right-color: var(--pink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.game-toolbar { position: absolute; z-index: 10; right: 16px; bottom: 14px; display: flex; gap: 7px; opacity: .34; transition: opacity .2s; }
.game-toolbar:hover { opacity: 1; }
.game-tool { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; background: rgba(7,10,20,.55); backdrop-filter: blur(8px); color: #fff; cursor: pointer; }
.touch-controls {
  --touch-key-size: clamp(48px, min(15vw, 13.5dvh), 64px);
  --touch-key-gap: clamp(4px, 1.1vw, 8px);
  display: none;
  position: absolute;
  z-index: 8;
  inset: auto 0 max(10px, env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.touch-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.touch-controls__move,
.touch-controls__attack { pointer-events: none; }
.touch-controls__move {
  display: grid;
  width: calc(var(--touch-key-size) * 3 + var(--touch-key-gap) * 2);
  height: calc(var(--touch-key-size) * 2 + var(--touch-key-gap));
  grid-template: repeat(2, var(--touch-key-size)) / repeat(3, var(--touch-key-size));
  gap: var(--touch-key-gap);
}
.touch-controls__move [data-touch="jump"] { grid-area: 1 / 2; }
.touch-controls__move [data-touch="left"] { grid-area: 2 / 1; }
.touch-controls__move [data-touch="block"] { grid-area: 2 / 2; }
.touch-controls__move [data-touch="right"] { grid-area: 2 / 3; }
.touch-controls__attack {
  display: grid;
  grid-template: repeat(2, var(--touch-key-size)) / repeat(2, var(--touch-key-size));
  gap: var(--touch-key-gap);
}
.touch-key {
  --touch-accent: 113 231 255;
  position: relative;
  isolation: isolate;
  display: grid;
  width: var(--touch-key-size);
  height: var(--touch-key-size);
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 8px 6px 6px;
  border: 1px solid rgb(var(--touch-accent) / .48);
  clip-path: polygon(16% 0, 84% 0, 100% 16%, 100% 84%, 84% 100%, 16% 100%, 0 84%, 0 16%);
  background:
    linear-gradient(145deg, rgb(255 255 255 / .15), transparent 32%),
    radial-gradient(circle at 50% 108%, rgb(var(--touch-accent) / .28), transparent 62%),
    rgb(8 12 27 / .76);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / .055),
    inset 0 -9px 16px rgb(0 0 0 / .34),
    0 5px 0 rgb(1 3 12 / .48),
    0 9px 22px rgb(0 0 0 / .2);
  color: #fff;
  font-weight: 900;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(8px) saturate(1.15);
  transition: transform 90ms var(--ease-out), filter 90ms ease-out, box-shadow 90ms ease-out, background-color 90ms ease-out;
}
.touch-key::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 5px;
  border: 1px solid rgb(var(--touch-accent) / .18);
  clip-path: inherit;
  pointer-events: none;
}
.touch-key::after {
  content: "";
  position: absolute;
  left: 24%;
  right: 24%;
  top: 5px;
  height: 1px;
  background: rgb(255 255 255 / .36);
  box-shadow: 0 0 8px rgb(var(--touch-accent) / .5);
  pointer-events: none;
}
.touch-key__icon {
  width: clamp(20px, calc(var(--touch-key-size) * .4), 26px);
  height: clamp(20px, calc(var(--touch-key-size) * .4), 26px);
  align-self: end;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgb(var(--touch-accent) / .42));
}
.touch-key small {
  align-self: end;
  color: rgb(255 255 255 / .76);
  font: 950 clamp(7px, calc(var(--touch-key-size) * .14), 9px)/1 var(--body);
  letter-spacing: .08em;
}
.touch-key--move { --touch-accent: 113 231 255; }
.touch-key--left .touch-key__icon { transform: rotate(-90deg); }
.touch-key--right .touch-key__icon { transform: rotate(90deg); }
.touch-key--block { --touch-accent: 91 150 255; }
.touch-key--block .touch-key__icon { transform: rotate(180deg); }
.touch-action--dash { --touch-accent: 155 124 255; }
.touch-action--light { --touch-accent: 113 231 255; }
.touch-action--heavy { --touch-accent: 255 214 91; }
.touch-action--special { --touch-accent: 255 92 168; }
.touch-key.is-pressed,
.touch-key:active {
  transform: translateY(4px) scale(.95);
  filter: brightness(1.22);
  background-color: rgb(var(--touch-accent) / .18);
  box-shadow:
    inset 0 0 22px rgb(var(--touch-accent) / .28),
    inset 0 -5px 10px rgb(0 0 0 / .26),
    0 1px 0 rgb(1 3 12 / .5),
    0 0 18px rgb(var(--touch-accent) / .24);
}

/* Dialogs */
.overlay-panel, .pause-panel, .result-panel { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; }
.overlay-panel__backdrop, .pause-panel::before, .result-panel::before { content: ""; position: absolute; inset: 0; background: rgba(3,5,13,.76); backdrop-filter: blur(12px); }
.overlay-panel__card { position: relative; width: min(760px, 100%); padding: clamp(26px, 4vw, 52px); border: 1px solid rgba(255,255,255,.14); background: linear-gradient(145deg, rgba(24,29,52,.98), rgba(9,12,24,.98)); box-shadow: 0 30px 90px rgba(0,0,0,.5); clip-path: polygon(0 0, 96% 0, 100% 7%, 100% 100%, 4% 100%, 0 93%); animation: panel-in .35s var(--ease-out); }
@keyframes panel-in { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.overlay-panel__card::before { content: ""; position: absolute; left: 0; top: 0; width: 34%; height: 4px; background: linear-gradient(90deg, var(--cyan), var(--pink)); }
.overlay-panel__close { position: absolute; right: 18px; top: 14px; width: 36px; height: 36px; border: 0; background: transparent; color: #939cb8; cursor: pointer; font-size: 28px; }
.panel-kicker { color: var(--cyan); font-size: 9px; font-weight: 950; letter-spacing: .25em; }
.overlay-panel h2 { margin: 5px 0 28px; font: 900 clamp(27px, 4vw, 42px)/1.1 var(--display); }
.guide-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 38px; }
.guide-player { display: block; margin-bottom: 14px; color: var(--cyan); font-size: 9px; font-weight: 950; letter-spacing: .2em; }
.guide-player--p2 { color: var(--pink); }
.key-row { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.key-row > div { display: flex; gap: 4px; }
.key-row span { color: #939cb8; font-size: 11px; }
.panel-tip { margin: 24px 0 0; padding: 13px 15px; border-left: 2px solid var(--yellow); background: rgba(255,214,91,.07); color: #969fba; font-size: 11px; line-height: 1.7; }
.panel-tip b { color: var(--yellow); }
.overlay-panel__card--about { width: min(660px, 100%); }
.overlay-panel__card--about > p { color: #a4acc6; line-height: 1.85; font-size: 13px; }
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px 0; }
.about-grid > div { padding: 18px 10px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.025); text-align: center; }
.about-grid strong { display: block; color: var(--cyan); font: 900 30px var(--display); }
.about-grid span { color: #77809e; font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.about-note { margin-bottom: 0 !important; color: #6f7895 !important; font-size: 10px !important; }
.pause-panel__card { position: relative; width: min(350px, 100%); display: grid; gap: 9px; padding: 38px; border: 1px solid rgba(255,255,255,.13); background: rgba(13,17,32,.96); text-align: center; box-shadow: 0 25px 80px rgba(0,0,0,.6); }
.pause-panel__card > span { color: var(--cyan); font-size: 9px; font-weight: 950; letter-spacing: .3em; }
.pause-panel__card h2 { margin: 1px 0 18px; font: 900 30px var(--display); }
.pause-panel__card button, .result-panel__actions button { min-height: 43px; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; background: rgba(255,255,255,.04); cursor: pointer; font-weight: 800; }
.pause-panel__card button:first-of-type { border: 0; background: linear-gradient(100deg, #4fcbf2, #5b72ff); }
.pause-panel__card button:hover, .result-panel__actions button:hover { filter: brightness(1.16); }
.result-panel { overflow: hidden; }
.result-panel__light { position: absolute; width: 70vw; height: 70vw; border-radius: 50%; background: radial-gradient(circle, rgba(113,231,255,.26), transparent 63%); filter: blur(30px); animation: result-light 2.3s ease-in-out infinite alternate; }
@keyframes result-light { to { transform: scale(1.13); opacity: .6; } }
.result-panel__card { position: relative; width: min(620px, 100%); padding: 50px; text-align: center; animation: panel-in .45s var(--ease-out); }
.result-panel__kicker { color: var(--yellow); font-size: 9px; font-weight: 950; letter-spacing: .32em; }
.result-panel h2 { margin: 10px 0 7px; font: italic 900 clamp(38px, 7vw, 70px)/1 var(--display); text-shadow: 5px 5px 0 rgba(255,75,114,.42); transform: skew(-5deg); }
.result-panel p { color: #a0a9c4; font-size: 12px; }
.result-panel__actions { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 8px; margin-top: 30px; }
.result-panel__actions button:first-child { border: 0; background: linear-gradient(100deg, var(--pink), #ff7858); }
.toast { position: fixed; z-index: 150; left: 50%; bottom: 34px; max-width: min(440px, calc(100vw - 30px)); padding: 10px 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 4px; background: rgba(12,16,30,.92); color: #dfe4f6; font-size: 11px; font-weight: 700; transform: translate(-50%, 20px); opacity: 0; visibility: hidden; transition: .3s var(--ease-out); box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  #app { min-height: 560px; }
  .screen--home { padding-inline: 28px; }
  .hero { grid-template-columns: minmax(390px, .95fr) minmax(320px, 1.05fr); }
  .poster-shell { width: min(51vw, 600px); }
  .select-layout { gap: 22px; grid-template-columns: minmax(420px, 1.15fr) minmax(280px, .85fr); }
  .fighter-detail { grid-template-columns: minmax(170px,.8fr) minmax(190px,1fr); }
  .fighter-detail__portrait-wrap { min-height: 330px; }
  .versus-dock { grid-template-columns: 1fr 46px 1fr 170px; }
}

@media (max-width: 760px), (max-height: 560px) and (pointer: coarse) {
  body { overflow: auto; }
  #app { min-height: 100dvh; }
  .screen { min-height: 100dvh; }
  .screen--home { overflow-y: auto; padding: 18px 18px 16px; }
  .home-nav .text-button { display: none; }
  .hero { display: flex; flex-direction: column; align-items: stretch; justify-content: center; padding: 32px 0 12px; }
  .hero__copy { order: 2; }
  .hero__visual { order: 1; min-height: 230px; height: 31vh; max-height: 310px; }
  .poster-shell { width: min(94vw, 570px); height: 100%; aspect-ratio: auto; opacity: .8; }
  .poster-shell img { object-position: center 68%; }
  .poster-shell__label { right: 2%; bottom: 7%; }
  .floating-tag { display: none; }
  .eyebrow { margin-top: 12px; }
  .logo__main { font-size: clamp(58px, 18vw, 92px); }
  .logo__kicker { font-size: 10px; }
  .hero__lead { margin-bottom: 18px; }
  .mode-card { min-height: 61px; }
  .quick-controls, .home-footer span:last-child { display: none; }
  .home-footer { margin-top: 18px; justify-content: center; }
  .screen--select { overflow-y: auto; padding: 16px; }
  .select-header { grid-template-columns: auto 1fr auto; }
  .select-heading { text-align: left; margin-left: 14px; }
  .select-heading h2 { font-size: 21px; }
  .match-badge { font-size: 9px; padding: 6px 8px; }
  .select-layout { display: flex; flex-direction: column; gap: 14px; align-items: stretch; margin-top: 14px; }
  .fighter-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .fighter-card { min-height: 180px; }
  .fighter-detail { display: none; }
  .versus-dock { position: sticky; bottom: 0; grid-template-columns: 1fr 30px 1fr; gap: 6px; width: 100%; padding: 8px; margin-top: 12px; background: rgba(7,9,19,.9); backdrop-filter: blur(12px); }
  .player-slot { min-height: 58px; padding: 8px 8px 8px 56px; }
  .player-slot img { width: 54px; height: 75px; }
  .player-slot small { display: none; }
  .launch-button { grid-column: 1 / -1; min-height: 48px; }
  .guide-columns { grid-template-columns: 1fr; gap: 26px; max-height: 58vh; overflow-y: auto; }
  .overlay-panel__card { padding: 30px 24px; }
  .touch-controls { display: flex; }
  .game-toolbar { top: 10px; bottom: auto; right: 10px; }
}

@media (max-height: 700px) and (min-width: 761px) {
  .screen--home { padding-top: 18px; padding-bottom: 14px; }
  .logo__main { font-size: clamp(58px, 6.4vw, 88px); }
  .hero__lead { margin-bottom: 14px; }
  .mode-card { min-height: 57px; }
  .quick-controls { margin-top: 11px; }
  .fighter-card { min-height: 170px; }
  .fighter-detail { min-height: 380px; }
  .fighter-detail__portrait-wrap { min-height: 310px; }
  .fighter-detail__copy > p { margin-bottom: 14px; }
}

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

@media (orientation: portrait) and (pointer: coarse) {
  .screen--game {
    place-items: start center;
    padding-top: max(88px, calc(env(safe-area-inset-top) + 56px));
    overflow: hidden;
  }
  .game-shell {
    width: 100vw;
    overflow: visible;
    box-shadow: 0 0 44px rgba(0,0,0,.72);
  }
  #game-canvas {
    border-top: 1px solid rgba(113,231,255,.25);
    border-bottom: 1px solid rgba(113,231,255,.25);
  }
  .touch-controls {
    top: calc(100% + 32px);
    bottom: auto;
    padding-inline: 18px;
  }
  .game-toolbar {
    top: 8px;
    bottom: auto;
  }
  .touch-controls::before {
    content: "横屏可获得更完整的战斗视野";
    position: absolute;
    left: 50%;
    top: -23px;
    transform: translateX(-50%);
    color: rgba(255,255,255,.42);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .12em;
    white-space: nowrap;
  }
}

@media (orientation: portrait) and (max-width: 760px) {
  .screen--game {
    position: fixed;
    place-items: start center;
    padding-top: max(88px, calc(env(safe-area-inset-top) + 56px));
    overflow: hidden;
  }
  .game-shell {
    width: 100vw;
    overflow: visible;
    box-shadow: 0 0 44px rgba(0,0,0,.72);
  }
  #game-canvas {
    border-top: 1px solid rgba(113,231,255,.25);
    border-bottom: 1px solid rgba(113,231,255,.25);
  }
  .touch-controls {
    top: calc(100% + 32px);
    bottom: auto;
    padding-inline: 18px;
  }
  .game-toolbar {
    top: 8px;
    bottom: auto;
  }
}

/* Combat revision: logical move lists, difficulty selection and campaign route */
.mode-card--campaign {
  border-color: rgba(168, 109, 255, .34);
  background: linear-gradient(110deg, rgba(112, 61, 176, .14), rgba(16,20,37,.72));
}
.mode-card--campaign .mode-card__index { color: #b98cff; }
.select-meta { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.difficulty-picker { display: flex; align-items: center; gap: 4px; }
.difficulty-picker > span { margin-right: 4px; color: #69738f; font-size: 8px; font-weight: 900; letter-spacing: .16em; }
.difficulty-picker button {
  min-width: 42px; height: 25px; padding: 0 8px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.1); border-radius: 3px;
  background: rgba(255,255,255,.035); color: #8d96b2;
  font-size: 9px; font-weight: 900;
}
.difficulty-picker button:hover { color: #fff; border-color: rgba(113,231,255,.35); }
.difficulty-picker button.is-active { color: #07101a; border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 16px rgba(113,231,255,.25); }
.move-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 18px; max-width: 350px; }
.move-preview > div { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 8px; min-height: 43px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.075); background: rgba(255,255,255,.025); }
.move-preview kbd { min-width: 34px; height: 29px; border-color: color-mix(in srgb, var(--detail-color) 42%, transparent); color: var(--detail-color); }
.move-preview span { display: flex; flex-direction: column; min-width: 0; }
.move-preview small { color: #6f7895; font-size: 7px; font-weight: 900; letter-spacing: .12em; }
.move-preview strong { overflow: hidden; color: #e9ebf7; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.move-preview__command { border-color: color-mix(in srgb, var(--detail-color) 28%, transparent) !important; }
.move-preview__burst { background: color-mix(in srgb, var(--detail-color) 9%, transparent) !important; }
.move-preview__burst strong { color: var(--detail-color); }

.campaign-panel { position: fixed; inset: 0; z-index: 105; display: grid; place-items: center; padding: 24px; overflow: hidden; }
.campaign-panel::before { content: ""; position: absolute; inset: 0; background: rgba(3,5,13,.82); backdrop-filter: blur(14px); }
.campaign-panel__glow { position: absolute; width: 72vw; height: 72vw; border-radius: 50%; background: radial-gradient(circle, rgba(121,97,255,.22), transparent 64%); filter: blur(26px); }
.campaign-panel__card { position: relative; width: min(920px, 100%); padding: clamp(28px, 4vw, 48px); border: 1px solid rgba(255,255,255,.14); background: linear-gradient(145deg, rgba(23,28,52,.98), rgba(9,12,24,.98)); box-shadow: 0 30px 100px rgba(0,0,0,.62); animation: panel-in .38s var(--ease-out); }
.campaign-panel__card::before { content: ""; position: absolute; left: 0; top: 0; width: 42%; height: 4px; background: linear-gradient(90deg, var(--cyan), #9c68ff, var(--pink)); }
.campaign-panel__kicker { color: var(--cyan); font-size: 9px; font-weight: 950; letter-spacing: .28em; }
.campaign-panel h2 { margin: 6px 0 5px; font: italic 900 clamp(34px, 5vw, 58px)/1 var(--display); transform: skew(-4deg); }
.campaign-panel__card > p { margin: 0 0 24px; color: #929bb7; font-size: 12px; }
.campaign-route { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.campaign-route > i { color: #4f5873; font-size: 24px; font-style: normal; }
.campaign-node { --node-color: #71e7ff; position: relative; flex: 1; min-width: 0; height: 96px; padding: 10px 8px 8px 70px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.025); opacity: .42; }
.campaign-node::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: var(--node-color); transform: scaleX(.15); transform-origin: left; }
.campaign-node.is-current, .campaign-node.is-complete { opacity: 1; border-color: color-mix(in srgb, var(--node-color) 40%, transparent); }
.campaign-node.is-current::after, .campaign-node.is-complete::after { transform: scaleX(1); }
.campaign-node.is-complete::before { content: "✓"; position: absolute; z-index: 3; right: 7px; top: 6px; color: var(--node-color); font-weight: 900; }
.campaign-node img { position: absolute; left: 3px; bottom: -15px; width: 76px; height: 104px; object-fit: contain; image-rendering: pixelated; }
.campaign-node span { display: block; color: var(--node-color); font-size: 7px; font-weight: 950; letter-spacing: .13em; }
.campaign-node strong { display: block; margin-top: 9px; font-size: 11px; }
.campaign-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; }
.campaign-stats span { padding: 6px 9px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.025); color: #727c98; font-size: 8px; font-weight: 800; }
.campaign-stats b { color: #e8ecfb; }
.upgrade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.upgrade-grid button { position: relative; min-height: 92px; padding: 16px; cursor: pointer; border: 1px solid rgba(255,255,255,.1); border-radius: 3px; background: rgba(255,255,255,.035); text-align: left; transition: .22s var(--ease-out); }
.upgrade-grid button::after { content: "+"; position: absolute; right: 13px; top: 9px; color: #5f6986; font-size: 23px; font-weight: 300; }
.upgrade-grid button:hover { transform: translateY(-3px); border-color: rgba(113,231,255,.42); background: rgba(113,231,255,.065); }
.upgrade-grid button.is-selected { border-color: var(--yellow); background: rgba(255,214,91,.10); box-shadow: inset 0 0 0 1px var(--yellow); }
.upgrade-grid button.is-selected::after { content: "✓"; color: var(--yellow); }
.upgrade-grid b { display: block; color: #f3f5ff; font-size: 14px; }
.upgrade-grid span { display: block; margin-top: 7px; color: #78829e; font-size: 9px; line-height: 1.5; }
.campaign-panel__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.campaign-panel__actions button { min-width: 118px; min-height: 42px; padding: 0 16px; cursor: pointer; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; background: rgba(255,255,255,.04); font-weight: 850; }
.campaign-panel__actions button:hover:not(:disabled) { filter: brightness(1.2); }
.campaign-panel__actions button:disabled { cursor: not-allowed; opacity: .35; }
#campaign-next { border: 0; background: linear-gradient(100deg, #6bdcf7, #6f73ff); }
#campaign-retry { border: 0; background: linear-gradient(100deg, var(--pink), #ff805e); }

@media (max-height: 760px) and (min-width: 761px) {
  .mode-card { min-height: 52px; }
  .mode-card__body strong { font-size: 15px; }
  .mode-card__body small { font-size: 9px; }
  .quick-controls { margin-top: 9px; }
  .move-preview { margin-top: 11px; gap: 5px; }
  .move-preview > div { min-height: 37px; }
}

@media (max-width: 760px) {
  .select-meta { gap: 4px; }
  .difficulty-picker > span { display: none; }
  .difficulty-picker button { min-width: 35px; padding-inline: 5px; }
  .campaign-panel { padding: 12px; overflow-y: auto; }
  .campaign-panel__card { padding: 27px 20px; }
  .campaign-route { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .campaign-route > i { display: none; }
  .campaign-node { height: 76px; padding: 8px 4px; text-align: center; }
  .campaign-node img { display: none; }
  .campaign-node strong { margin-top: 8px; font-size: 8px; }
  .upgrade-grid { grid-template-columns: 1fr; }
  .upgrade-grid button { min-height: 66px; }
  .campaign-panel__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .campaign-panel__actions button { min-width: 0; }
  #campaign-next, #campaign-retry { grid-column: 1 / -1; }
}
@media (max-width: 760px), (max-height: 560px) and (pointer: coarse) {
  .home-nav [data-open-panel="guide"] { display: inline-flex; padding-inline: 7px; font-size: 11px; }
}
.pause-panel__card { width: min(390px, 100%); }
.pause-moves { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: -5px 0 13px; padding: 12px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.025); text-align: left; }
.pause-moves > strong { grid-column: 1 / -1; margin-bottom: 3px; color: var(--yellow); font-size: 11px; letter-spacing: .1em; }
.pause-moves > div { display: flex; align-items: center; gap: 7px; min-width: 0; color: #a5aec7; font-size: 9px; }
.pause-moves > div span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pause-moves > small { grid-column: 1 / -1; margin-top: 4px; color: #6f7895; font-size: 8px; }
/* Roguelike campaign additions */
.campaign-route { overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.campaign-node { min-width: 138px; }
.campaign-node em { display: block; margin-top: 4px; overflow: hidden; color: #626d89; font-size: 7px; font-style: normal; white-space: nowrap; text-overflow: ellipsis; }
.campaign-node.is-current em, .campaign-node.is-complete em { color: color-mix(in srgb, var(--node-color) 66%, #7d86a2); }
.upgrade-grid button > em { display: inline-grid; min-width: 32px; height: 18px; place-items: center; margin-bottom: 8px; border: 1px solid rgba(113,231,255,.26); border-radius: 2px; color: var(--cyan); font-size: 7px; font-style: normal; font-weight: 950; letter-spacing: .08em; }
@media (max-width: 760px) {
  .campaign-route { display: flex; gap: 5px; }
  .campaign-node { flex: 0 0 74px; min-width: 74px; }
  .campaign-node em { font-size: 6px; }
}

/* Mobile home must scroll as normal content; do not let the footer cover mode cards. */
@media (max-width: 760px) {
  .screen--home {
    display: block;
    height: 100dvh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding:
      max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      calc(24px + env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .screen--home .home-nav { min-height: 40px; }
  .screen--home .hero {
    display: flex;
    width: 100%;
    min-height: 0;
    padding: 22px 0 0;
  }
  .screen--home .hero__visual {
    width: 100%;
    height: clamp(200px, 31vh, 290px);
    min-height: 200px;
  }
  .screen--home .poster-shell {
    width: 100%;
    max-width: 570px;
  }
  .screen--home .hero__copy { width: 100%; }
  .screen--home .logo { margin-bottom: 22px; }
  .screen--home .mode-list { width: 100%; }
  .screen--home .home-footer {
    position: relative;
    margin: 24px 0 0;
    padding: 0 0 4px;
  }
}

@media (max-width: 380px) and (max-height: 700px) {
  .screen--home .hero { padding-top: 14px; }
  .screen--home .hero__visual { height: 190px; min-height: 190px; }
  .screen--home .eyebrow { margin-top: 8px; margin-bottom: 8px; font-size: 9px; }
  .screen--home .logo__main { font-size: 56px; }
  .screen--home .hero__lead { font-size: 13px; line-height: 1.65; }
  .screen--home .mode-card { min-height: 58px; }
  .screen--home .mode-card__body strong { font-size: 15px; }
  .screen--home .mode-card__body small { font-size: 9px; }
}
.brand-chip__short { display: none; }
.home-nav [data-open-panel="guide"] { white-space: nowrap; }
@media (max-width: 340px) {
  .brand-chip { gap: 7px; font-size: 9px; letter-spacing: .12em; }
  .brand-chip__full { display: none; }
  .brand-chip__short { display: inline; }
  .home-nav [data-open-panel="guide"] { font-size: 10px; }
}

/* WebRTC online lobby */
.mode-card--online { border-color: rgba(90,225,182,.34); background: linear-gradient(110deg, rgba(44,160,128,.13), rgba(16,20,37,.72)); }
.mode-card--online .mode-card__index { color: #65e6b8; }
.online-panel__card { width: min(690px, 100%); }
.online-panel__intro { margin: -15px 0 22px; color: #929bb6; font-size: 12px; line-height: 1.7; }
.online-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.online-actions > button, .online-join { min-height: 92px; border: 1px solid rgba(255,255,255,.1); border-radius: 4px; background: rgba(255,255,255,.03); }
.online-actions > button { padding: 16px; cursor: pointer; text-align: left; }
.online-actions > button:hover { border-color: rgba(101,230,184,.45); background: rgba(101,230,184,.07); }
.online-actions b { display: block; font-size: 15px; }
.online-actions span { display: block; margin-top: 8px; color: #74809d; font-size: 9px; }
.online-join { display: grid; grid-template-rows: 1fr 38px; padding: 10px; }
.online-join input { min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; text-align: center; text-transform: uppercase; font: 900 25px var(--display); letter-spacing: .22em; }
.online-join input::placeholder { color: #58627e; font: 800 11px var(--body); letter-spacing: .08em; }
.online-join button, .online-room button, .online-enter { border: 0; border-radius: 3px; background: rgba(255,255,255,.08); cursor: pointer; font-weight: 850; }
.online-room { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 13px 15px; border: 1px solid rgba(101,230,184,.22); background: rgba(101,230,184,.055); }
.online-room > span { color: #76829e; font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.online-room > strong { color: #65e6b8; font: 900 25px var(--display); letter-spacing: .22em; }
.online-room button { margin-left: auto; min-height: 31px; padding: 0 12px; font-size: 9px; }
.online-status { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 11px; margin-top: 14px; padding: 14px; border: 1px solid rgba(255,255,255,.08); background: rgba(8,11,24,.55); }
.online-status > i { width: 10px; height: 10px; border-radius: 50%; background: #59627e; box-shadow: 0 0 0 4px rgba(89,98,126,.1); }
.online-status.is-connecting > i { background: var(--yellow); box-shadow: 0 0 14px rgba(255,214,91,.7); animation: breathe 1s ease-in-out infinite; }
.online-status.is-connected > i { background: #65e6b8; box-shadow: 0 0 15px rgba(101,230,184,.8); }
.online-status.is-error > i { background: #ff596b; box-shadow: 0 0 15px rgba(255,89,107,.7); }
.online-status div { display: flex; flex-direction: column; gap: 3px; }
.online-status div strong { font-size: 11px; }
.online-status div span { color: #6f7996; font-size: 8px; }
.online-status > b { color: #8d97b2; font: 900 10px var(--display); }
.online-recovery { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 11px; margin-top: 9px; padding: 10px; border: 1px solid rgba(255,89,107,.22); background: rgba(255,89,107,.055); }
.online-recovery button { min-height: 34px; padding: 0 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; background: linear-gradient(100deg,rgba(255,92,168,.86),rgba(83,132,255,.86)); cursor: pointer; color: #fff; font-size: 9px; font-weight: 900; }
.online-recovery button:disabled { cursor: wait; opacity: .5; }
.online-recovery span { color: #78839f; font-size: 8px; line-height: 1.45; }
.online-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-top: 10px; }
.online-steps span { padding: 8px; border: 1px solid rgba(255,255,255,.07); color: #59637e; font-size: 8px; font-weight: 900; text-align: center; }
.online-steps span.is-active { border-color: rgba(113,231,255,.35); color: var(--cyan); background: rgba(113,231,255,.055); }
.online-steps span.is-complete { border-color: rgba(101,230,184,.35); color: #65e6b8; background: rgba(101,230,184,.055); }
.online-enter { width: 100%; min-height: 45px; margin-top: 12px; background: linear-gradient(100deg,#39cda3,#5384ff); }
.online-enter:disabled { cursor: not-allowed; filter: grayscale(1); opacity: .35; }
.online-note { margin: 12px 0 0; color: #5f6986; font-size: 8px; line-height: 1.6; }
@media (max-width: 760px) {
  .online-panel { align-items: start; overflow-y: auto; }
  .online-panel__card { margin-top: 16px; }
  .online-actions { grid-template-columns: 1fr; }
  .online-actions > button, .online-join { min-height: 76px; }
  .online-steps span { padding-inline: 3px; font-size: 7px; }
  .online-room { flex-wrap: wrap; }
  .online-recovery { grid-template-columns: 1fr; }
  .online-recovery button { width: 100%; }
}
