:root {
  color-scheme: light;
  font: 600 16px/1.35 "Avenir Next", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #152842;
  background: #9fcadf;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #7d38c5; outline-offset: 3px; }
#arena { position: relative; width: 100%; height: 100svh; isolation: isolate; overflow: hidden; }
#field, #names { position: absolute; inset: 0; width: 100%; height: 100%; }
#field { display: block; touch-action: none; }
.playing #field { cursor: crosshair; }
#names, #damage-floats { pointer-events: none; }
#damage-floats { position: absolute; inset: 0; }
.nameplate { position: absolute; left: 0; top: 0; min-width: 52px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 4px; white-space: nowrap; background: #183353ef; color: #fff; border: 1px solid #dffaff; border-left: 4px solid var(--actor); padding: 2px 5px; border-radius: 5px; font-size: 12px; box-shadow: 0 2px 6px #132d5566; }
.nameplate small { font-size: 10px; color: #c6e3ff; }
.nameplate.own { z-index: 2; border-color: #fff; border-left-color: var(--actor); background: #771f50; }
.health-bar { height: 7px; overflow: hidden; border-radius: 5px; background: #c2d7e6; }
.health-bar i { display: block; height: 100%; width: 100%; background: #16784e; border-radius: inherit; }
.health-bar.low i { background: #bd3561; }
.nameplate .health-bar { grid-column: 1 / -1; height: 4px; background: #50627e; }
.nameplate .health-bar i { background: #a3f0b7; }
.nameplate .health-bar.low i { background: #ffc1a9; }
.damage-float { position: absolute; left: 0; top: 0; color: #fff; background: #173654; border-radius: 5px; padding: 1px 5px; font-size: 14px; font-weight: 850; white-space: nowrap; }
.damage-float.heavy { background: #833355; font-size: 16px; }
.top { position: absolute; z-index: 5; inset: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left)); gap: 9px; pointer-events: none; }
.top button { pointer-events: auto; }
.brand { display: flex; gap: 11px; align-items: center; color: #163252; font-size: 18px; font-weight: 900; line-height: 1; letter-spacing: -.035em; }
.brand small { display: block; margin-top: 4px; font-size: 10px; letter-spacing: .20em; }
.in-match .brand, .figure-preview .brand { color: #fff; text-shadow: 0 1px 3px #163252; }
.brand-mark { position: relative; width: 38px; height: 38px; border-radius: 12px; background: #153453; transform: rotate(-6deg); box-shadow: 0 3px 0 #4c78a4; }
.brand-mark i { position: absolute; width: 25px; height: 3px; border-radius: 2px; background: #e7faff; top: 17px; left: 6px; }
.brand-mark i:nth-child(2) { transform: rotate(60deg); }
.brand-mark i:nth-child(3) { transform: rotate(-60deg); }
.top-actions { display: flex; gap: 7px; }
.glass { border: 1px solid #f2fcff; border-radius: 12px; background: #f4fbffef; color: #163453; box-shadow: 0 2px 0 #234a6861, 0 6px 18px #183a5620; }
.top-actions button { min-width: 58px; min-height: 44px; padding: 0 11px; font-size: 13px; font-weight: 800; }
.top-actions button[aria-pressed="false"] { background: #d9e6ef; color: #46576d; }
.title-screen { position: absolute; inset: 0; z-index: 3; display: flex; overflow-y: auto; padding: 72px clamp(24px, 7vw, 118px) 30px; background: linear-gradient(90deg, #e9f8fe 0%, #e9f8fef7 21%, #e9f8feb0 37%, #e9f8fe00 63%), linear-gradient(0deg, #d7eef4bd, #d7eef400 24%); }
.title-copy { width: min(530px, 100%); margin-block: auto; }
.kicker { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; font-weight: 850; letter-spacing: .08em; color: #366284; }
.kicker > span { display: inline-block; width: 9px; height: 9px; background: #e64f85; transform: rotate(45deg); border-radius: 2px; }
h1 { margin: 0; font-size: clamp(38px, 6.5vw, 94px); font-weight: 1000; line-height: 1.03; letter-spacing: -.06em; color: #143052; }
h1 span { display: block; margin-top: 10px; color: #752e77; font-size: .61em; letter-spacing: -.035em; }
.intro { margin: 20px 0 15px; font-size: clamp(16px, 2vw, 24px); font-weight: 750; }
.action { display: inline-flex; align-items: center; justify-content: center; gap: 24px; border: 2px solid #112743; border-radius: 12px; min-height: 58px; padding: 10px 22px; color: #fff; background: #183455; box-shadow: 0 5px 0 #7251a1; font-size: 19px; font-weight: 850; pointer-events: auto; }
.action:hover { background: #2e507c; }
.action span { font-size: 24px; }
.title-meta { margin: 13px 0 0; color: #405875; font-size: 13px; }
.quick-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; max-width: 365px; margin: 0 0 20px; padding: 0; list-style: none; font-size: 14px; color: #294a68; }
.quick-controls li { max-width: 100%; }
.mobile-controls { display: none; }
kbd { display: inline-block; background: #f5fdff; border: 1px solid #adcbdd; border-bottom-width: 2px; padding: 3px 6px; border-radius: 5px; color: #263957; font: inherit; font-size: 11px; font-weight: 800; }
.round-status { position: absolute; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); display: grid; grid-template-columns: auto auto; gap: 0 10px; align-items: center; background: #132e4deb; border: 1px solid #c5f0ff; box-shadow: 0 4px 0 #11345150; color: #fff; padding: 5px 13px; border-radius: 10px; white-space: nowrap; font-size: 12px; }
.round-status strong { font-size: 24px; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.round-status small { grid-column: 1 / -1; color: #d1ecff; text-align: center; font-size: 11px; }
.round-status.danger small { color: #ffbcac; }
.score { position: absolute; right: max(24px, env(safe-area-inset-right)); top: max(78px, calc(env(safe-area-inset-top) + 51px)); width: 156px; padding: 8px 9px; pointer-events: none; }
.score-head { display: flex; justify-content: space-between; gap: 6px; padding: 0 2px 5px; font-size: 11px; color: #405a79; }
.score ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.score li { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto auto; align-items: center; gap: 5px; border-radius: 6px; padding: 3px 4px; font-size: 12px; line-height: 1.1; }
.score li.me { background: #f9dfec; }
.score li.out { color: #596b7f; }
.score i { width: 8px; height: 8px; border-radius: 3px; background: var(--actor); border: 1px solid #18335344; }
.score small { font-size: 10px; color: #4c617d; }
.score b { min-width: 13px; text-align: right; font-size: 13px; }
.message { pointer-events: none; position: absolute; top: 19%; left: 50%; transform: translateX(-50%); max-width: 88%; min-width: 0; text-align: center; color: #fff; background: #162e4dee; border-radius: 12px; font-size: clamp(14px, 2vw, 20px); padding: 8px 15px; white-space: normal; box-shadow: 0 4px 12px #1734523d; }
.message:empty, #feed:empty { display: none; }
.message.countdown { top: 39%; min-width: 1.45em; font-weight: 1000; font-size: clamp(44px, 8vw, 78px); line-height: 1; color: #fff; background: #143452ee; border: 2px solid #e8fcff; box-shadow: 0 5px 0 #662c83; }
#feed { position: absolute; top: max(80px, calc(env(safe-area-inset-top) + 48px)); left: max(24px, env(safe-area-inset-left)); pointer-events: none; display: grid; gap: 4px; font-size: 12px; }
#feed span { width: max-content; background: #173655de; color: #fff; border-radius: 6px; padding: 4px 7px; }
.combat-hud { position: absolute; z-index: 2; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: stretch; gap: 6px; pointer-events: none; white-space: nowrap; }
.player-info, .ammo, .roll-info { display: flex; gap: 12px; align-items: center; padding: 7px 12px; }
.combat-hud small { display: block; font-size: 10px; color: #46617d; }
.player-health { min-width: 99px; }
.player-health > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.player-health strong { font-size: 16px; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.ammo { font-size: 12px; gap: 10px; }
.ammo div { display: grid; grid-template-columns: auto auto; align-items: center; gap: 0 4px; }
.ammo strong { grid-column: 2; line-height: 1.1; font-size: 15px; font-variant-numeric: tabular-nums; }
.orb { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 1px solid #8bacd5; box-shadow: inset -2px -2px #c1dbf2; }
.orb.heavy { width: 15px; height: 15px; border-color: #a878cb; box-shadow: inset -3px -2px #d9b4ef; }
.roll-info { display: grid; gap: 2px; text-align: center; min-width: 58px; }
.roll-info strong { font-size: 14px; }
#charge { position: absolute; bottom: 86px; left: 50%; width: min(180px, 40vw); height: 8px; border: 1px solid #fff; background: #293453aa; transform: translateX(-50%); border-radius: 9px; overflow: hidden; pointer-events: none; }
#charge i { display: block; background: #e395e6; height: 100%; width: 0; }
.touch-controls { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
.stick { position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); width: clamp(67px, 15vh, 112px); aspect-ratio: 1; border: 2px solid #edfbffbd; background: #152c5361; color: #fff; border-radius: 50%; pointer-events: auto; touch-action: none; left: max(16px, env(safe-area-inset-left)); }
.stick span { position: absolute; left: 0; right: 0; bottom: 7px; text-align: center; font-size: 11px; text-shadow: 0 1px #21394d; pointer-events: none; }
.stick i { pointer-events: none; width: 39%; aspect-ratio: 1; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #effaffdc; border: 1px solid #fff; border-radius: 50%; }
.aim-stick { left: auto; right: max(18px, env(safe-area-inset-right)); }
#touch-roll { position: absolute; right: max(20px, env(safe-area-inset-right)); bottom: max(96px, calc(env(safe-area-inset-bottom) + 78px)); min-height: 46px; min-width: 58px; pointer-events: auto; touch-action: none; }
.result { position: absolute; z-index: 6; inset: 0; display: grid; place-items: center; background: #14345380; padding: 14px; }
.result-card { width: min(420px, 100%); border: 2px solid #fff; border-radius: 24px; padding: clamp(15px, 5vw, 34px); text-align: center; background: #effbff; box-shadow: 0 9px 0 #17345269; }
.result-card .kicker { justify-content: center; }
.result-card h2 { margin: 0; font-size: clamp(30px, 6vw, 52px); line-height: 1.08; }
.result-card p:not(.kicker) { margin: 9px 0 20px; }
dialog { z-index: 10; width: min(478px, calc(100% - 24px)); max-height: min(720px, calc(100% - 24px)); border: 1px solid #fff; border-radius: 18px; background: #f4fbff; color: #152842; padding: 0; box-shadow: 0 16px 80px #102c4a86; }
dialog::backdrop { background: #122d4aab; }
dialog header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #d4e6f2; background: #f4fbff; }
dialog h2 { margin: 0; font-size: 20px; }
dialog button { min-height: 44px; border: 1px solid #b6cde0; border-radius: 8px; background: #fff; color: #163453; padding: 5px 12px; }
.panel-body { padding: 12px 16px 18px; }
#help-panel h3 { margin: 0 0 8px; font-size: 16px; }
.help-keys { margin: 0; font-size: 14px; }
.help-keys > div { display: grid; grid-template-columns: 3.1em minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid #dce9f2; }
.help-keys dt { font-weight: 800; }
.help-keys dd { margin: 0; }
.aim-setting { margin-top: 6px; }
.help-note { margin: 0; color: #405875; font-size: 13px; }
.help-rules { margin-top: 15px; }
.help-rules ul { margin: 0; padding-left: 1.2em; font-size: 14px; }
.help-rules li + li { margin-top: 4px; }
.slider { display: grid; gap: 1px; padding: 5px 0; font-size: 13px; }
.slider > span { display: flex; justify-content: space-between; gap: 8px; }
.slider output { font-variant-numeric: tabular-nums; }
.slider input { width: 100%; min-height: 27px; margin: 0; accent-color: #793f94; }
.latency { font-size: 16px; }
.presets { display: flex; gap: 7px; flex-wrap: wrap; }
.presets button[aria-pressed="true"] { background: #203f61; color: #fff; }
.network-note, .measurements { font-size: 13px; color: #405875; }
.measurements { background: #dfeffa; padding: 8px; border-radius: 7px; }
.toggle { display: flex; justify-content: space-between; align-items: center; min-height: 50px; gap: 8px; font-size: 14px; }
.toggle input { width: 22px; height: 22px; accent-color: #793f94; }
details { border-top: 1px solid #d4e6f2; margin-bottom: 10px; }
summary { padding: 11px 0; cursor: pointer; }
#error { position: absolute; z-index: 12; inset: 0; display: grid; place-content: center; text-align: center; padding: 20px; background: #eefaff; }
@media (max-width: 850px) {
  .score { width: 119px; right: 9px; top: 67px; padding: 5px; }
  .score li { font-size: 11px; gap: 3px; }
  .score-head { font-size: 10px; }
}
@media (max-width: 600px) {
  .top { padding-right: 9px; padding-left: 9px; }
  .brand { gap: 5px; font-size: 12px; }
  .brand small { font-size: 8px; }
  .brand-mark { width: 27px; height: 27px; border-radius: 8px; }
  .brand-mark i { width: 17px; top: 12px; left: 5px; }
  .top-actions { gap: 4px; }
  .top-actions button { min-width: 44px; padding: 0 5px; }
  .title-screen { padding: 68px 20px max(34px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, #eefaff 4%, #e7f8fbef 44%, #e7f8fb32 90%); }
  .title-copy { margin-block: auto 0; }
  .intro { margin: 11px 0 12px; }
  .in-match .brand { display: none; }
  .in-match .round-status { position: static; transform: none; }
  .score { width: 95px; }
  .score li { padding: 3px 1px; }
  .score small { display: none; }
  .score li { grid-template-columns: 7px 1fr auto; }
  #feed { left: 8px; top: 63px; max-width: 30%; }
  #feed span { width: auto; }
  .nameplate { font-size: 10px; padding: 1px 3px; gap: 2px; }
  .nameplate small { font-size: 8px; }
}
@media (pointer: coarse) {
  .desktop-controls { display: none; }
  .mobile-controls { display: block; }
  .quick-controls.mobile-controls { display: flex; }
  .player-info, .ammo, .roll-info { padding: 5px 6px; gap: 4px; }
  .roll-info { display: none; }
}
@media (pointer: coarse) and (orientation: portrait) {
  .combat-hud { bottom: max(118px, calc(env(safe-area-inset-bottom) + 100px)); }
  #charge { bottom: 178px; }
  #touch-roll { bottom: calc(max(20px, env(safe-area-inset-bottom)) + clamp(67px, 15vh, 112px) + 8px); }
}
@media (max-height: 510px) {
  .top { padding-top: max(5px, env(safe-area-inset-top)); }
  .in-match .brand { display: none; }
  .in-match .round-status { position: static; transform: none; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-mark i { width: 20px; left: 4px; top: 14px; }
  .score { top: max(52px, calc(env(safe-area-inset-top) + 46px)); }
  .score li { padding-block: 2px; }
  .title-screen { padding-top: 57px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  h1 { font-size: clamp(32px, 7vw, 62px); }
  .action { min-height: 46px; font-size: 16px; }
  .quick-controls { margin-bottom: 10px; gap: 3px 10px; }
  .intro { margin-top: 10px; }
  .message:not(.countdown) { top: 20%; }
  .combat-hud { bottom: max(8px, env(safe-area-inset-bottom)); }
}

#field:focus { outline: none; }

@media (pointer: coarse) and (orientation: portrait) {
  .combat-hud { bottom: calc(max(20px, env(safe-area-inset-bottom)) + clamp(67px, 15vh, 112px) + 10px); }
  #charge { bottom: calc(max(20px, env(safe-area-inset-bottom)) + clamp(67px, 15vh, 112px) + 72px); }
}
@media (pointer: coarse) and (orientation: portrait) and (min-width: 361px) and (max-width: 430px) {
  #touch-roll { bottom: calc(max(20px, env(safe-area-inset-bottom)) + clamp(67px, 15vh, 112px) + 61px); }
}
@media (pointer: coarse) and (orientation: landscape) {
  #touch-roll { bottom: calc(max(20px, env(safe-area-inset-bottom)) + clamp(67px, 15vh, 112px) + 8px); }
}

#score-toggle { display: none; }
@media (max-width: 600px) {
  .score { z-index: 3; padding: 0; width: auto; }
  #score-toggle { display: block; border: 0; background: none; color: inherit; min-height: 44px; min-width: 48px; border-radius: 10px; font-size: 12px; pointer-events: auto; }
  .score .score-head, .score ol { display: none; }
  .score.expanded { width: 102px; padding: 4px; }
  .score.expanded .score-head { display: flex; }
  .score.expanded ol { display: grid; }
}
@media (pointer: coarse) and (orientation: portrait) and (max-width: 360px) {
  .combat-hud { bottom: calc(max(20px, env(safe-area-inset-bottom)) + clamp(67px, 15vh, 112px) + 63px); }
  #charge { bottom: calc(max(20px, env(safe-area-inset-bottom)) + clamp(67px, 15vh, 112px) + 116px); }
}
@media (max-width: 360px) {
  .round-status { gap: 0 5px; padding-inline: 7px; }
  .round-status strong { font-size: 20px; }
}
