@import url('./sky.css');

:root {
  color-scheme: dark;
  font-family: 'Microsoft YaHei UI', 'PingFang SC', system-ui, sans-serif;
  --ink: #f2f2e8;
  --muted: #a1aab6;
  --mint: #9ff5df;
  --brass: #ffba86;
  --thin: #c2d7f029;
  --side: clamp(16px, 4vw, 60px);
  --sky: radial-gradient(ellipse at 82% 12%, #433025 0, #141823 27%, #070c14 68%);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 296px; background: #080c13; color: var(--ink); }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
[hidden] { display: none !important; }

#game {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(240px, 1fr) auto;
  min-height: 100svh;
  background-color: #080c13;
  background-image: linear-gradient(180deg, #080b12b8, #080c1400 33%, #080c1459 69%, #080c14 99%), var(--sky);
  background-size: cover;
  background-position: center 27%;
  isolation: isolate;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) max-content minmax(82px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px var(--side) 15px;
  border-bottom: 1px solid var(--thin);
  background: linear-gradient(90deg, #121b26c9, #090f19b5 52%, #161a23a3);
  box-shadow: 0 6px 30px #04080d55;
  z-index: 1;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand h1 { font-size: clamp(19px, 2.05vw, 32px); letter-spacing: .11em; line-height: 1; margin: 0 0 5px; white-space: nowrap; }
.brand-en { font: 650 10px/1.2 Consolas, monospace; color: var(--mint); letter-spacing: .26em; white-space: nowrap; }
.brand-icon { border: 1px solid #9ff5dfb0; width: 32px; height: 32px; transform: rotate(-18deg); border-radius: 50%; display: grid; place-items: center; flex: none; box-shadow: inset 0 0 12px #74f5d82c, 0 0 10px #74f5d825; }
.brand-icon::after { content: ''; position: absolute; inset: 10px -4px; border: 1px solid #9ff5df80; border-radius: 50%; }
.brand-icon i { background: var(--mint); border-radius: 50%; width: 8px; height: 8px; box-shadow: 0 0 10px var(--mint); }

.match-score { display: flex; align-items: center; gap: clamp(16px, 2.25vw, 38px); font-variant-numeric: tabular-nums; }
.side-score { display: grid; grid-template-columns: auto auto; align-items: center; justify-items: center; column-gap: 9px; row-gap: 3px; }
.side-score > span:first-child { align-self: center; font: 800 11px/1 system-ui, sans-serif; letter-spacing: .12em; }
.side-score strong { font: 600 clamp(23px, 3vw, 42px)/.9 Consolas, monospace; }
.yours { color: var(--mint); }
.rival { color: var(--brass); }
.pips { display: flex; grid-column: 1/-1; gap: 4px; }
.pips i { width: 12px; height: 3px; background: currentColor; opacity: .2; }
.pips i.won { opacity: 1; box-shadow: 0 0 8px currentColor; }
.round-label { display: grid; place-items: center; gap: 4px; white-space: nowrap; }
.round-label b { font-size: 13px; font-weight: 750; letter-spacing: .1em; }
.round-label span { color: var(--muted); font-size: 10px; }
.sound, .quiet-button { justify-self: end; padding: 7px 12px; min-height: 38px; border: 1px solid var(--thin); background: #131e28d1; color: #cdd9e0; border-radius: 5px; font-size: 12px; white-space: nowrap; }
.sound { display: inline-flex; align-items: center; gap: 8px; }
.sound:hover, .quiet-button:hover { background: #233340; color: white; }
.sound-icon { width: 17px; height: 13px; display: flex; align-items: center; gap: 2px; }
.sound-icon i { display: block; width: 2px; height: 6px; background: var(--mint); }
.sound-icon i:nth-child(2) { height: 12px; }
.sound-icon i:nth-child(3) { height: 8px; }
.sound-icon i:nth-child(4) { height: 4px; }
.sound[aria-pressed="true"] .sound-icon i { height: 2px; background: var(--muted); }

.stage { position: relative; min-height: 260px; overflow: hidden; }
#arena { display: block; position: absolute; width: 100%; height: 100%; touch-action: pan-y; }
[data-phase="aim"] #arena { cursor: crosshair; }
.telemetry { position: absolute; top: clamp(13px, 3vh, 25px); inset-inline: var(--side); display: grid; grid-template-columns: minmax(0, 1fr) 90px minmax(0, 1fr); justify-items: start; pointer-events: none; }
.pilot { width: min(100%, 242px); padding: 9px 12px 8px; border: 1px solid #c0d5f02b; background: #0b1521dc; border-radius: 5px; }
.pilot.rival { grid-column: 3; justify-self: end; }
.pilot-head { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; color: var(--ink); }
.pilot-head b { letter-spacing: .1em; font-size: 14px; }
.pilot-head b:has(.pilot-portrait) { display: inline-flex; align-items: center; gap: 7px; }
.pilot-portrait { width: 25px; height: 25px; border-radius: 50%; object-fit: cover; border: 1px solid #ff879f; }
.pilot-head small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.hull { height: 4px; background: #cdd5e320; margin-top: 6px; }
.hull i { display: block; height: 100%; width: var(--hull); background: currentColor; box-shadow: 0 0 9px currentColor; transition: width 170ms ease-out; }
.pilot-foot { display: flex; justify-content: space-between; gap: 6px; font: 11px/1.2 Consolas, 'Microsoft YaHei UI', monospace; color: var(--muted); margin-top: 5px; }
.charge { color: currentColor; letter-spacing: .07em; }
.skill-status { display: flex; justify-content: space-between; gap: 4px; margin-top: 5px; font-size: 10px; font-variant-numeric: tabular-nums; }
.skill-status > span:last-child { white-space: nowrap; }
.experience { height: 2px; background: #ead2aa24; margin-top: 4px; }
.experience i { display: block; height: 100%; width: var(--xp); background: #e7cb8c; }
.drain-tag { color: #ff9ab0; white-space: nowrap; }
.pilot.is-rbq { border-color: #ee557d; box-shadow: 0 0 12px #f0406440; }
.san-label { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1px 4px; margin-top: 5px; color: #e8c3ed; font: 10px/1.2 Consolas, 'Microsoft YaHei UI', monospace; }
.san-label strong { color: #ff92a8; }
.san-meter { height: 3px; background: #e4b6f239; margin-top: 3px; }
.san-meter i { display: block; height: 100%; width: var(--san); background: #e6a7ed; }
.is-rbq .san-meter i { background: #ff7a97; }
.battle-time { grid-column: 2; justify-self: center; display: grid; text-align: center; gap: 2px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.battle-time strong { color: var(--ink); font: 600 25px/1 Consolas, monospace; text-shadow: 0 2px 13px #070b0e; }
.announcement { position: absolute; inset: 26% 12% auto; text-align: center; pointer-events: none; font-size: clamp(16px, 4vw, 34px); font-weight: 800; letter-spacing: .13em; text-shadow: 0 3px 12px #070b0e, 0 0 20px #090c14; }
.announcement:empty { display: none; }
.announcement[data-tone="you"] { color: var(--mint); }
.announcement[data-tone="ai"] { color: var(--brass); }
.announcement[data-tone="samb"] { color: #ff9cb0; text-shadow: 0 2px 8px #310011, 0 0 20px #e0285a63; }
.combat-dialogue {
  position: absolute;
  inset: auto var(--side) clamp(26px, 4vh, 44px);
  max-width: 660px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  pointer-events: none;
}
.dialogue-pair {
  display: grid;
  gap: 3px;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, currentColor 44%, transparent);
  border-radius: 5px;
  background: #0b1521ed;
  font-size: clamp(11px, 1.1vw, 14px);
  line-height: 1.36;
  overflow-wrap: anywhere;
}
.dialogue-pair.yours { grid-column: 1; }
.dialogue-pair.rival { grid-column: 2; grid-row: 1; }
.dialogue-pair span + span { color: var(--ink); }
.graphics-status { position: absolute; inset: auto auto 13px var(--side); font-size: 11px; color: var(--muted); }

.controls { padding: 0 var(--side) clamp(14px, 2.6vh, 28px); z-index: 1; }
.control-panel { width: min(100%, 1120px); margin-inline: auto; padding: 15px 19px 18px; background: linear-gradient(122deg, #172431f4, #0d151ff5 65%); border: 1px solid #9db9d653; border-top-color: #a9e8e078; border-radius: 10px; box-shadow: 0 16px 38px #04060bb0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.control-panel h2 { margin: 0; letter-spacing: .08em; font-size: clamp(18px, 2.2vw, 25px); line-height: 1.15; }
.control-panel p { margin: 5px 0 0; font-size: 12px; line-height: 1.55; color: #bcc8d5; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.core {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  grid-template-rows: auto auto auto 1fr;
  column-gap: 13px;
  text-align: left;
  padding: 12px 11px 10px;
  border: 1px solid color-mix(in srgb, var(--core) 34%, #273240);
  border-radius: 7px;
  color: var(--ink);
  background: radial-gradient(ellipse at left top, color-mix(in srgb, var(--core) 14%, transparent), transparent 70%), #111c28;
  min-height: 105px;
  transition: background-color 170ms ease, border-color 170ms ease, transform 170ms ease;
}
.core:hover, .core:focus-visible { border-color: var(--core); background-color: #203241; transform: translateY(-3px); }
.core-top { grid-column: 2; display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; padding-right: 15px; }
.core-name { font-size: clamp(17px, 1.7vw, 23px); line-height: 1; font-weight: 770; }
.core-kind { font-size: 11px; color: var(--core); font-weight: 700; }
.rarity { color: #ffdd92; background: #6c3a244e; border: 1px solid #c58a4b9c; border-radius: 3px; padding: 1px 4px; font: 800 10px/1.18 Consolas, monospace; letter-spacing: .07em; }
.core .rarity[data-rarity="R"] { color: #d0dfed; background: #2c3b4b; border-color: #8fa4bc77; }
.core-categories { grid-column: 2; margin-top: 6px; font-size: 11px; line-height: 1.4; color: #b8c3d5; }
.core-categories b { color: #d3dce7; font-weight: 750; }
.core-vitals { grid-column: 2; display: flex; flex-wrap: wrap; column-gap: 14px; margin-top: 5px; font-size: 11px; color: #b8c3d5; }
.core-vitals > span { white-space: nowrap; }
.core-vitals strong { color: var(--ink); font: 700 13px/1.2 Consolas, monospace; }
.core-abilities { grid-column: 2; display: grid; align-content: start; gap: 5px; font-size: 12px; line-height: 1.45; margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--thin); color: #c4cfda; }
.core-abilities > span { display: block; }
.core-abilities b { display: inline-block; padding: 2px 3px; color: var(--core); border: 1px solid color-mix(in srgb, var(--core) 42%, transparent); font-size: 10px; line-height: 1; border-radius: 2px; }
.core-abilities strong { color: var(--ink); font-weight: 720; }
.keycap { position: absolute; top: 9px; right: 9px; color: #a9b8c5; font: 11px/1.2 Consolas, monospace; border: 1px solid #73879d67; border-radius: 3px; padding: 2px 4px; }
.core-orb { position: relative; align-self: center; justify-self: center; grid-row: 1/-1; border-radius: 50%; width: 45px; aspect-ratio: 1; border: 1px solid color-mix(in srgb, var(--core) 70%, white); background: radial-gradient(circle at 34% 27%, #f8fff8, var(--core) 12%, color-mix(in srgb, var(--core) 40%, #172631) 38%, #0a111a 73%); box-shadow: 0 0 14px color-mix(in srgb, var(--core) 52%, transparent), inset 0 -3px 8px #000; }
.core-orb::before { content: ''; position: absolute; inset: 11px -7px; transform: rotate(-28deg); border-radius: 50%; border: 1px solid var(--core); box-shadow: 0 0 6px var(--core); }
.core-orb::after { content: ''; position: absolute; inset: -5px; border: 1px dotted color-mix(in srgb, var(--core) 75%, transparent); border-radius: 50%; }
.core-portrait { grid-row: 1/-1; align-self: center; justify-self: center; width: min(53px, 100%); aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 1px solid var(--core); box-shadow: 0 0 11px color-mix(in srgb, var(--core) 58%, transparent); }
.core[data-core="anvil"] .core-orb::after, .core[data-core="bastion"] .core-orb::after { border-radius: 24%; transform: rotate(33deg); border-style: solid; }
.core[data-core="prism"] .core-orb::before, .core[data-core="nova"] .core-orb::before { transform: rotate(35deg); }

.aim-controls { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(90px, 1fr) max-content; align-items: center; gap: clamp(14px, 3vw, 48px); }
.aim-controls label { display: grid; grid-template-columns: 1fr auto; gap: 6px; color: #cbd4dd; font-size: 12px; }
.aim-controls output { color: var(--mint); font: 700 13px Consolas, monospace; }
.aim-controls input { grid-column: 1/-1; width: 100%; min-width: 0; margin: 0; accent-color: var(--mint); touch-action: pan-y; }
.main-button { min-height: 46px; min-width: 132px; display: flex; align-items: center; justify-content: space-between; gap: 23px; padding: 10px 15px; border-radius: 5px; border: 1px solid #c7fff0; background: #a3f4dc; color: #0a241f; font-weight: 800; white-space: nowrap; box-shadow: 0 0 16px #82f8d853; }
.main-button:hover { background: #cbfff1; }
.main-button span { font: 600 19px/1 system-ui, sans-serif; }
.action-panel { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 100px; }
.in-progress { display: flex; gap: 7px; color: var(--mint); margin: 0 8px; }
.in-progress i { display: inline-block; width: 5px; height: 5px; background: currentColor; animation: blink 1.3s infinite alternate; }
.in-progress i:nth-child(2) { animation-delay: 160ms; }
.in-progress i:nth-child(3) { animation-delay: 320ms; }
@keyframes blink { from { opacity: .23; } to { opacity: 1; } }

@media (min-height: 570px) and (min-width: 710px) { #game:not([data-phase="draft"]) { height: 100svh; } }
@media (max-width: 710px) {
  .masthead { grid-template-columns: minmax(95px, 1fr) max-content minmax(49px, 1fr); gap: 9px; padding-block: 13px; }
  .brand { gap: 6px; }
  .brand-icon { width: 23px; height: 23px; }
  .brand-icon::after { inset: 7px -3px; }
  .brand-icon i { width: 5px; height: 5px; }
  .brand h1 { font-size: clamp(15px, 4.5vw, 24px); }
  .brand-en { font-size: 8px; letter-spacing: .15em; }
  .sound { padding: 7px 10px; }
  .sound #mute-label { position: absolute; clip-path: inset(50%); }
  .match-score { gap: 10px; }
  .side-score { column-gap: 4px; }
  .pips i { width: 7px; }
  .control-panel { padding: 13px 12px 14px; }
  .choices { gap: 6px; }
  .core { padding: 9px 8px; grid-template-columns: 1fr; grid-template-rows: 41px auto auto auto 1fr; }
  .core-top, .core-abilities, .core-categories, .core-vitals { grid-column: 1; }
  .core-top, .core-vitals { justify-content: center; }
  .core-top { gap: 4px; padding: 0; }
  .core-orb { grid-row: 1; width: 28px; }
  .core-portrait { grid-row: 1; width: 35px; }
  .core-categories { text-align: center; }
  .core-orb::before { inset: 7px -5px; }
  .keycap { top: 5px; right: 5px; font-size: 9px; }
  .main-button { min-width: 97px; padding: 8px 10px; font-size: 13px; gap: 10px; }
  .aim-controls { gap: 10px; }
  .telemetry { grid-template-columns: 1fr 50px 1fr; }
  .pilot { padding: 7px 8px 6px; }
  .pilot-head b { font-size: 12px; }
  .pilot-head small { font-size: 9px; }
  .pilot-foot { font-size: 9px; }
}
@media (max-width: 580px) {
  .choices { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .core { grid-template-columns: 42px minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; column-gap: 9px; }
  .core-top, .core-abilities, .core-categories, .core-vitals { grid-column: 2; }
  .core-orb, .core-portrait { grid-row: 1/-1; }
  .core-top, .core-vitals { justify-content: flex-start; }
  .core-top { padding-right: 14px; }
  .core-categories { text-align: left; }
}
@media (max-width: 372px) {
  :root { --side: 9px; }
  .brand-icon { display: none; }
  .aim-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aim-controls .main-button { grid-column: 1/-1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
