:root {
  color-scheme: dark;
  --shell: #101618;
  --panel: #131a1b;
  --muted: #a9b6b3;
  --light: #f4f6ef;
  --acid: #d5f76b;
  --ice: #80e4f4;
  --mono: 'Consolas', 'Cascadia Mono', ui-monospace, monospace;
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--light);
  background: radial-gradient(ellipse at 50% 0%, #253234, var(--shell) 64%);
  display: grid;
  place-items: center;
  padding: 18px clamp(12px, 3vw, 46px);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button { color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; }
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--acid); outline-offset: -4px; }
.cabinet { width: min(100%, 1350px); touch-action: manipulation; }
.masthead { height: 58px; display: flex; align-items: flex-start; justify-content: space-between; }
.brand { height: 43px; display: flex; align-items: center; gap: 11px; }
.brand strong { font-size: 24px; font-weight: 900; letter-spacing: -.075em; }
.brand-mark { width: 33px; height: 33px; border-radius: 8px; display: grid; place-items: center; background: var(--acid); color: #182218; }
.brand-mark i { width: 13px; height: 13px; border: 2px solid currentColor; border-radius: 50%; position: relative; }
.brand-mark i::before, .brand-mark i::after { content: ''; position: absolute; background: currentColor; inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
.brand-mark i::before { width: 21px; height: 2px; }
.brand-mark i::after { width: 2px; height: 21px; }
.brand-divider { width: 1px; height: 20px; background: #475151; margin-left: 3px; }
.wordmark { color: #a9b6b3; font: 700 12px var(--mono); letter-spacing: .12em; }
.screen-button { width: 42px; height: 42px; border: 1px solid #43504f; border-radius: 8px; display: grid; place-items: center; background: #1b2426; }
.screen-button:hover { background: #303c3a; }
.fullscreen-icon { width: 17px; height: 17px; background: linear-gradient(var(--light),var(--light)) top left, linear-gradient(var(--light),var(--light)) top right, linear-gradient(var(--light),var(--light)) bottom left, linear-gradient(var(--light),var(--light)) bottom right, linear-gradient(var(--light),var(--light)) top left, linear-gradient(var(--light),var(--light)) top right, linear-gradient(var(--light),var(--light)) bottom left, linear-gradient(var(--light),var(--light)) bottom right; background-size: 6px 2px, 6px 2px, 6px 2px, 6px 2px, 2px 6px, 2px 6px, 2px 6px, 2px 6px; background-repeat: no-repeat; }

.arena {
  position: relative;
  isolation: isolate;
  height: min(73dvh, 752px);
  min-height: 365px;
  overflow: hidden;
  border: 1px solid #63716e;
  border-radius: 15px 15px 0 0;
  background: linear-gradient(#6bacc8 0 40%, #516462 52%, #34464a);
  box-shadow: 0 22px 66px #060b0a66;
}
#world, .scene-shade, #field-labels, #aim-assist, .overlay { width: 100%; height: 100%; position: absolute; inset: 0; }
#world { display: block; cursor: crosshair; touch-action: none; }
.scene-shade { z-index: 1; pointer-events: none; background: linear-gradient(to bottom, #1326304a, transparent 20%, transparent 71%, #1017197a), radial-gradient(ellipse at center, transparent 53%, #16232133 100%); }
.hud-top, .hud-bottom { position: absolute; z-index: 4; left: clamp(9px, 2.1vw, 27px); right: clamp(9px, 2.1vw, 27px); display: grid; grid-template-columns: 1fr 1.13fr 1fr; align-items: start; gap: 7px; pointer-events: none; }
.hud-top { top: clamp(9px, 2vw, 24px); }
.hud-bottom { bottom: clamp(9px, 2vw, 24px); align-items: end; }
.stat, .meter { background: #101b1ce8; border: 1px solid #7183848c; box-shadow: 0 3px 10px #09101052, inset 0 1px #edfff018; border-radius: 8px; min-width: 0; }
.stat { width: max-content; min-width: 124px; padding: 9px 15px 10px; }
.stat-label, .meter-label { display: flex; align-items: center; gap: 7px; color: #d0dbd7; font-size: 11px; font-weight: 700; white-space: nowrap; }
.stat-main { display: flex; align-items: baseline; gap: 7px; font: 750 clamp(23px, 3.1vw, 39px)/1.07 var(--mono); letter-spacing: -.055em; white-space: nowrap; }
.stat-main strong, .meter-value strong { font-weight: inherit; }
.score-stat .stat-main { color: var(--acid); }
.combo-readout { display: flex; align-items: center; gap: 5px; width: max-content; min-height: 21px; margin-top: 6px; padding: 2px 6px; border: 1px solid #637c744f; border-radius: 4px; color: #c1d2cb; background: #2a3a36; font-size: 10px; font-weight: 800; white-space: nowrap; }
.combo-readout::before { content: ''; width: 5px; height: 5px; border: 1px solid currentColor; transform: rotate(45deg); }
.combo-readout.powered { color: #ecffae; border-color: #d5f76baf; background: #415229; box-shadow: 0 0 11px #c1ff4029; }
.attempts-stat { justify-self: center; text-align: center; min-width: 106px; }
.attempts-stat .stat-main, .attempts-stat .stat-label { justify-content: center; }
.attempts-column { justify-self: center; display: grid; justify-items: center; gap: 7px; }
.stage-status { display: flex; align-items: center; gap: 8px; border: 1px solid #bde4d461; border-radius: 5px; background: #142223ec; padding: 5px 8px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.stage-status strong { color: var(--acid); }
.wind-stat { justify-self: end; }
.wind-stat .stat-label { justify-content: flex-end; }
.wind-stat .stat-main { align-items: center; }
.unit, .meter-unit { font: 700 11px var(--mono); color: #c0cbc5; letter-spacing: 0; }
.pip { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 8px #d5f76775; }
.attempts-icon { width: 11px; height: 8px; display: inline-block; color: #aebeb8; background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 4px); }
.wind-dial { margin-right: 1px; border: 1px solid #638486; background: #253a3a; border-radius: 50%; display: grid; place-items: center; width: 25px; height: 25px; }
#shots-left.warning { color: #ffb479; }
#wind-arrow { display: block; position: relative; width: 14px; height: 2px; border-radius: 1px; background: var(--ice); }
#wind-arrow::after { content: ''; width: 6px; height: 6px; border-top: 2px solid; border-right: 2px solid; color: var(--ice); position: absolute; right: 0; top: -2px; transform: rotate(45deg); }

#field-labels, #aim-assist { z-index: 2; overflow: hidden; pointer-events: none; }
#aim-assist { z-index: 3; }
.target-tag { position: absolute; transform: translate(-50%, -100%); display: flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: 4px; background: #142122e8; border: 1px solid #d8eae166; font-size: 10px; font-weight: 750; white-space: nowrap; color: #f2f8ee; }
.target-tag::after { content: ''; position: absolute; height: 6px; width: 1px; background: #e6f5ecd9; bottom: -7px; left: 50%; }
.target-tag b { font: 700 10px var(--mono); color: #cce9ef; }
.target-tag.long-range b { color: #ffd480; }
.target-tag.aimed { background: #d5f76b; color: #152014; border-color: #ecffa8; z-index: 1; }
.target-tag.aimed b { color: #213319; }
.arc-dot { position: absolute; transform: translate(-50%, -50%); width: 5px; height: 5px; border-radius: 50%; background: #e4faff; box-shadow: 0 0 0 1px #183344a8, 0 0 6px #8ae9ff; }
.arc-dot.endpoint { width: 14px; height: 14px; border: 2px solid #e4faff; background: none; }
.arc-dot.predicted-hit { border-color: var(--acid); box-shadow: 0 0 10px #d5f76bab; }
.arena:has(#combo.powered) .arc-dot:not(.endpoint) { background: #e8ff9b; box-shadow: 0 0 0 1px #3644239c, 0 0 6px #d5f76b; }
.reticle { width: 26px; height: 26px; position: absolute; z-index: 3; inset: 50% auto auto 50%; transform: translate(-50%, -50%); pointer-events: none; color: #fff; filter: drop-shadow(0 0 2px #1a2e33) drop-shadow(0 0 2px #1a2e33); }
.reticle::before, .reticle::after { content: ''; position: absolute; inset: 0; }
.reticle::before { inset: 50% 0 auto; height: 2px; margin-top: -1px; background: linear-gradient(90deg, currentColor 0 6px, transparent 6px 20px, currentColor 20px); }
.reticle::after { inset: 0 auto 0 50%; width: 2px; margin-left: -1px; background: linear-gradient(180deg, currentColor 0 6px, transparent 6px 20px, currentColor 20px); }
.reticle i { display: block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); }
.arena:has(:is(.overlay, .guide, .results):not([hidden])) .reticle { display: none; }
.notice { position: absolute; z-index: 4; left: 50%; top: 35%; transform: translate(-50%, 6px); pointer-events: none; opacity: 0; transition: opacity .16s, transform .16s; text-align: center; line-height: 1.3; width: max-content; max-width: 90%; border: 1px solid #d5f76b78; border-radius: 7px; color: var(--acid); background: #172420ef; padding: 7px 12px 8px; font-weight: 800; font-size: clamp(13px, 2vw, 21px); }
.notice.visible { opacity: 1; transform: translate(-50%, 0); }
.notice.bonus { color: #ffdf8d; border-color: #ffdf8db0; }
.notice.miss { color: #f3f6f1; border-color: #f3f6f17a; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; padding: 0; margin: -1px; clip-path: inset(50%); white-space: nowrap; }

.meter { width: 100%; max-width: 192px; padding: 9px 12px 11px; }
.meter-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 7px; }
.angle-meter { width: max-content; min-width: 112px; }
.angle-meter strong { display: block; margin-top: 2px; font: 700 26px/1 var(--mono); letter-spacing: -.07em; }
.angle-icon { width: 12px; height: 9px; border-bottom: 1px solid currentColor; position: relative; }
.angle-icon::before { content: ''; position: absolute; width: 12px; left: 0; bottom: -1px; border-top: 1px solid currentColor; transform-origin: left; transform: rotate(-38deg); }
.speed-meter { justify-self: center; max-width: 252px; }
.meter-value { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; font: 750 18px/1 var(--mono); color: var(--ice); }
.drop-icon { display: inline-block; width: 9px; height: 9px; border: 1.5px solid currentColor; border-radius: 1px 55% 55% 55%; transform: rotate(45deg); flex: 0 0 auto; }
.meter-track { height: 7px; background: #354144; border-radius: 2px; overflow: hidden; position: relative; }
.meter-fill { width: 0; height: 100%; background: var(--ice); box-shadow: 0 0 10px #80e4f4b2; }
.meter-track::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 2px), #101b1caa calc(12.5% - 2px) 12.5%); }

.overlay { display: flex; align-items: center; align-items: safe center; padding: 62px clamp(15px, 5.2vw, 72px) 64px; z-index: 3; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; background: linear-gradient(90deg, #101b1cad, #1421223d 51%, transparent 78%); }
.intro-card { width: min(100%, 355px); padding: clamp(16px, 3vw, 30px); background: linear-gradient(133deg, #182827fa, #111c1cf0); border: 1px solid #82948a8a; border-radius: 12px; box-shadow: 0 20px 45px #131f26a6, inset 0 1px #c7f0d324; }
.card-rule { width: 35px; height: 4px; background: var(--acid); margin-bottom: clamp(7px, 1.7vh, 16px); border-radius: 2px; }
h1 { margin: 0; font-size: clamp(42px, 6.2vw, 79px); font-weight: 900; line-height: 1.02; letter-spacing: -.105em; color: #f5f9ef; word-break: keep-all; }
#overlay-copy { margin: 15px 0 19px; color: #d6e0d9; font-size: clamp(12px, 1.4vw, 15px); line-height: 1.55; word-break: keep-all; }
.round-summary { color: var(--acid); font-weight: 800; margin: -6px 0 16px; line-height: 1.55; }
.name-field { display: flex; align-items: center; gap: 9px; padding: 0 0 12px; color: #d6e0d9; font-size: 12px; font-weight: 750; }
.name-field span { flex: 0 0 auto; }
.name-field input { width: 100%; min-width: 0; padding: 7px 8px; color: var(--light); background: #14201f; border: 1px solid #697d77; border-radius: 5px; font: inherit; }
.name-field input:focus { outline: 2px solid var(--acid); outline-offset: 1px; }
.start-button { width: 100%; min-height: 48px; padding: 9px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: #172313; background: var(--acid); border: 1px solid #efffbe; border-radius: 6px; font-size: 16px; font-weight: 900; }
.start-button:hover { background: #e8ff9a; }
.start-button:focus-visible { outline-color: #233117; }
.button-arrow { font: 700 23px/1 var(--mono); }
.guide, .results { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; align-items: safe center; overflow: auto; background: #0e191ae5; overscroll-behavior: contain; touch-action: pan-y; padding: clamp(7px, 2vh, 20px); }
.guide-card, .results-card { width: min(100%, 460px); border: 1px solid #81948b; border-radius: 12px; padding: clamp(12px, 3vh, 25px); background: linear-gradient(143deg, #273a35, #142222 60%); box-shadow: 0 20px 50px #030908ac; }
.guide-card { width: min(100%, 530px); display: grid; gap: 12px; }
.guide-card h2 { margin: 0; font-size: clamp(25px, 5vw, 36px); line-height: 1.1; letter-spacing: -.06em; }
.guide-actions { margin: 0; }
.guide-actions div { display: grid; grid-template-columns: 65px 1fr; gap: 8px; border-bottom: 1px solid #6f8f804b; padding: 8px 0; }
.guide-actions dt { color: #f1f6eb; font-size: 13px; font-weight: 800; }
.guide-actions dd { margin: 0; color: #d4e1d8; font-size: 12px; line-height: 1.5; word-break: keep-all; }
.guide-actions kbd { vertical-align: middle; }
.guide-rules { background: #19271b; border: 1px solid #7f9653; border-radius: 7px; padding: 8px 10px; color: #e5efda; font-size: 12px; word-break: keep-all; }
.guide-rules strong { color: var(--acid); font-size: 14px; }
.guide-rules p { margin: 4px 0; line-height: 1.45; }
.guide-rules small { color: #c4d1bb; line-height: 1.35; }
.results-heading, .ranking-heading { display: flex; align-items: end; justify-content: space-between; gap: 8px; }
.results-heading { margin-bottom: 12px; }
.results-heading p { margin: 0 0 5px; color: #bbcec3; font-size: 11px; font-weight: 750; }
.results-heading h2 { margin: 0; font-size: clamp(25px, 5vw, 39px); line-height: 1; letter-spacing: -.075em; }
.results-heading h2:focus { outline: none; }
.final-score { display: flex; align-items: baseline; gap: 6px; color: var(--acid); white-space: nowrap; }
.final-score strong { font: 800 clamp(26px, 5vw, 41px)/1 var(--mono); letter-spacing: -.06em; }
.final-score span { color: var(--muted); font: 750 11px var(--mono); }
.ranking-heading { margin: 0 0 4px; align-items: baseline; }
.ranking-heading h3, .credits h3 { font-size: 13px; margin: 0; }
#ranking-mode { color: #bdd0c7; font-size: 11px; }
.score-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.score-table th, .score-table td { border-bottom: 1px solid #6f8f804b; height: 21px; padding: 2px 7px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-table th { color: #aebfb8; font-size: 10px; }
.score-table th:first-child { width: 48px; }
.score-table th:last-child { width: 75px; text-align: right; }
.score-table td:first-child, .score-table td:last-child { font-family: var(--mono); }
.score-table td:last-child { text-align: right; }
.score-table tr:first-child td { color: var(--acid); }
.credits { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 14px; padding: 11px 0; }
.credits dl, .credits dl div { margin: 0; display: flex; gap: 7px; }
.credits dl { gap: 13px; font-size: 11px; }
.credits dt { color: #aebfb8; }
.credits dd { margin: 0; font-weight: 750; }
.results .start-button { min-height: 38px; }

.controls { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px clamp(7px, 2vw, 22px); border: 1px solid #4a5a57; border-top: 0; border-radius: 0 0 13px 13px; background: var(--panel); }
.control-hints { display: flex; align-items: center; flex-wrap: wrap; gap: 5px clamp(8px, 2.4vw, 32px); }
.control-item { display: flex; align-items: center; gap: 7px; color: #bfcbc6; white-space: nowrap; font-size: 12px; }
.key-group { display: inline-flex; gap: 3px; }
kbd { min-width: 21px; height: 22px; display: inline-grid; place-items: center; padding: 1px 3px; border: 1px solid #65716f; box-shadow: inset 0 -2px #141b1b; border-radius: 4px; background: #293333; color: #f1f3ef; font: 700 11px var(--mono); }
.space-key { padding-inline: 6px; }
.mouse-icon { width: 13px; height: 17px; border-radius: 6px; border: 1px solid #bfcfc9; position: relative; }
.mouse-icon::before { content: ''; position: absolute; width: 1px; height: 5px; background: #bfcfc9; inset: 2px auto auto 5px; }
.touch-hint { display: none; }
.charge-button { display: flex; align-items: center; justify-content: center; gap: 9px; flex: 0 0 auto; min-width: 136px; min-height: 46px; padding: 5px 12px; color: #172313; background: var(--acid); border: 1px solid #eeffb0; border-radius: 8px; text-align: left; touch-action: none; }
.charge-label { display: grid; gap: 3px; line-height: 1.08; }
.charge-label strong { font-size: 15px; font-weight: 900; }
.charge-label small { font-size: 11px; font-weight: 750; }
.charge-button .drop-icon { width: 11px; height: 11px; }
.charge-button:disabled { color: #c1ccba; background: #242e2b; border-color: #515d54; cursor: default; }
.charge-button:not(:disabled):not(.charging) { box-shadow: 0 0 12px #d5f76b63; animation: charge-pulse 1.5s ease-in-out infinite alternate; }
.charge-button:not(:disabled):hover, .charge-button.charging { background: #edffa9; }
.charge-button.charging { box-shadow: inset 0 0 0 2px #869d3c; }
.charge-button.powered:not(:disabled) { color: #302707; background: #ffe188; border-color: #fff1ad; }
.charge-button.powered.charging { background: #fff1b1; }
@keyframes charge-pulse {
  from { filter: brightness(1); box-shadow: 0 0 9px #d5f76b60, 0 0 0 0 #d5f76b50; }
  to { filter: brightness(1.17); box-shadow: 0 0 21px #d5f76b96, 0 0 0 3px #d5f76b2b; }
}
.cabinet:fullscreen { width: 100%; height: 100%; padding: 12px; display: grid; grid-template-rows: 55px minmax(0,1fr) auto; background: var(--shell); }
.cabinet:fullscreen .arena { height: 100%; min-height: 0; }
.cabinet:fullscreen .fullscreen-icon { transform: scale(.8); }

@media (min-width: 701px) and (max-height: 715px) {
  body { padding-block: 8px; }
  .masthead { height: 48px; }
  .arena { height: calc(100dvh - 119px); }
  .intro-card { padding: 16px 20px; width: 290px; }
  h1 { font-size: clamp(34px, 8.3vh, 59px); }
  #overlay-copy { margin: 10px 0 12px; }
  .start-button { min-height: 40px; padding-block: 6px; }
  .overlay:has(#name-wrap:not([hidden])) h1 { font-size: clamp(30px, 6.4vh, 50px); }
}

@media (max-width: 700px), (pointer: coarse), (orientation: landscape) and (max-width: 1000px) and (max-height: 480px) {
  html { width: 100%; height: 100%; overflow: hidden; }
  body { position: fixed; inset: 0; display: block; height: 100%; height: 100dvh; min-height: 0; padding: 0; overflow: hidden; }
  .cabinet, .cabinet:fullscreen {
    width: 100%; height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }
  .masthead { height: 44px; padding: 0 8px; align-items: center; }
  .screen-button { height: 36px; width: 36px; }
  .brand { height: 36px; }
  .arena { height: 100%; min-height: 0; border-radius: 0; border-inline: 0; }
  .overlay { justify-content: center; padding: 12px 8px; background: #13212370; }
  .intro-card { width: min(295px, 89%); }
  .overlay h1 br { display: none; }
  h1 { font-size: clamp(32px, 10vw, 52px); }
  .name-field input { font-size: 16px; }
  .desktop-break { display: none; }
  .stat { min-width: 0; padding: 7px 8px; }
  .stat-label, .meter-label { gap: 4px; font-size: 10px; }
  .stat-main { gap: 4px; }
  .stage-status { display: grid; gap: 2px; text-align: center; padding: 3px 5px; font-size: 9px; }
  .wind-dial { width: 19px; height: 19px; }
  .meter { padding: 7px; }
  .angle-meter { min-width: 0; }
  .angle-meter strong { font-size: 21px; }
  .meter-value { font-size: 14px; }
  .meter-unit, .unit { font-size: 9px; }
  .controls { min-height: 61px; padding: 5px 9px; border-radius: 0; border-inline: 0; gap: 7px; }
  .control-item { font-size: 10px; }
  .charge-button { min-width: 133px; min-height: 49px; }
}

@media (pointer: coarse) {
  .aim-hint, .move-hint, .charge-hint { display: none; }
  .touch-hint { display: flex; white-space: normal; }
}

@media (max-height: 480px) and (pointer: coarse), (max-height: 480px) and (max-width: 1000px) {
  .masthead { height: 37px; }
  .controls { min-height: 49px; padding-block: 3px; }
  .charge-button { min-height: 43px; }
  .intro-card { padding: 10px 14px; }
  .intro-card h1 { font-size: clamp(25px, 8vh, 36px); }
  .intro-card #overlay-copy { margin: 7px 0; }
  .intro-card .card-rule { margin-bottom: 6px; }
  .intro-card .start-button { min-height: 36px; padding-block: 3px; }
  .arena:has(.overlay:not([hidden])) .hud-top, .arena:has(.overlay:not([hidden])) .hud-bottom { visibility: hidden; }
}

@media (orientation: landscape) and (max-height: 480px) {
  .guide-card { width: min(100%, 620px); grid-template-columns: 1.1fr 1fr; gap: 8px 13px; }
  .guide-card h2 { grid-column: span 2; }
  .guide-actions { grid-row: span 2; }
  .guide-actions div { padding-block: 5px; }
  .guide-card .start-button { min-height: 38px; padding-block: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .notice { transition: none; }
  .charge-button:not(:disabled):not(.charging) { animation: none; }
}
