/* ============ ROBO REVOLUTION — UI ============ */
:root {
  --cyan: #41e8ff;
  --cyan-dim: rgba(65, 232, 255, 0.35);
  --red: #ff5a4a;
  --orange: #ffb13d;
  --ink: #dff4ff;
  --panel: rgba(7, 12, 26, 0.82);
  --panel-edge: rgba(65, 232, 255, 0.4);
  --head: "Avenir Next Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --body: "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #04060e; }
body { font-family: var(--body); color: var(--ink); }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ---------- screen-space overlays ---------- */
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(2, 4, 12, 0.35) 100%);
}
#scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 6; opacity: 0.16;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
#damage-flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 7; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 40, 30, 0.5) 100%);
  transition: opacity 0.06s linear;
}
#letterbox .bar { position: fixed; left: 0; right: 0; height: 9vh; background: #02030a; z-index: 8; }
#letterbox .top { top: 0; } #letterbox .bot { bottom: 0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

.hp-wrap {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-start; gap: 26px; width: min(1060px, 92vw);
}
.vs {
  font-family: var(--head); font-style: italic; font-weight: 900; font-size: 26px;
  color: rgba(223,244,255,.55); padding-top: 16px; letter-spacing: 0.06em;
}
.hp-block { flex: 1; }
.hp-block.right .hp-name { text-align: right; }
.hp-name {
  font-family: var(--head); font-weight: 700; font-style: italic; letter-spacing: 0.14em;
  font-size: 17px; margin-bottom: 5px; text-shadow: 0 0 12px rgba(65,232,255,.6);
}
.hp-bar {
  position: relative; height: 16px; transform: skewX(-18deg);
  background: rgba(10, 16, 32, 0.75);
  border: 1px solid rgba(160, 220, 255, 0.35);
  box-shadow: 0 0 14px rgba(0,0,0,.5), inset 0 0 8px rgba(0,0,0,.6);
  overflow: hidden;
}
.hp-fill, .hp-ghost { position: absolute; inset: 0; transform-origin: left center; }
.hp-block.right .hp-fill, .hp-block.right .hp-ghost { transform-origin: right center; right: 0; left: auto; width: 100%; }
.hp-ghost { background: rgba(255, 250, 240, 0.85); }
.hp-fill {
  background: linear-gradient(180deg, #b8ffe9 0%, #2fd8ff 38%, #1387ff 100%);
  box-shadow: 0 0 18px rgba(65, 232, 255, 0.8);
}
.hp-fill.enemy { background: linear-gradient(180deg, #ffe2b0 0%, #ff9a3d 40%, #ff3b2e 100%); box-shadow: 0 0 18px rgba(255, 110, 60, 0.8); }
.down-bar {
  height: 5px; margin-top: 4px; transform: skewX(-18deg);
  background: rgba(10, 16, 32, 0.7); border: 1px solid rgba(160,220,255,.18); overflow: hidden;
}
.down-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #ffe65a, #ff8b2e); box-shadow: 0 0 10px rgba(255,180,60,.9); }
.hp-block.right .down-fill { margin-left: auto; }

.chips { position: absolute; left: 34px; bottom: 30px; display: flex; gap: 14px; }
.chip {
  position: relative; width: 86px; height: 64px; padding-top: 10px;
  background: var(--panel); border: 1px solid var(--panel-edge);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  text-align: center;
}
.chip.slim { width: 70px; opacity: 0.85; }
.chip .key { font-size: 9px; letter-spacing: 0.12em; color: rgba(223,244,255,.5); }
.chip .lbl { font-family: var(--head); font-style: italic; font-weight: 700; font-size: 15px; letter-spacing: 0.08em; margin-top: 2px; }
.chip .ring { position: absolute; inset: 0; opacity: 0.28; }
.chip.ready { border-color: var(--cyan); box-shadow: 0 0 16px rgba(65,232,255,.35), inset 0 0 14px rgba(65,232,255,.12); }
.chip.ready .lbl { color: var(--cyan); text-shadow: 0 0 10px rgba(65,232,255,.9); }

.hint {
  position: absolute; right: 34px; bottom: 36px; font-size: 11px; letter-spacing: 0.14em;
  color: rgba(223,244,255,.42);
}

/* ---------- center announcements ---------- */
#announce {
  position: fixed; top: 38%; left: 0; right: 0; text-align: center; z-index: 20;
  font-family: var(--head); font-style: italic; font-weight: 900;
  font-size: clamp(44px, 8vw, 96px); letter-spacing: 0.1em; pointer-events: none;
  color: #fff; opacity: 0;
  text-shadow: -4px 0 rgba(255, 45, 150, 0.85), 4px 0 rgba(65, 232, 255, 0.85),
    0 0 22px rgba(65,232,255,.9), 0 0 60px rgba(65,232,255,.5), 0 4px 0 rgba(0,30,60,.6);
}
#announce.warn {
  text-shadow: -4px 0 rgba(65, 232, 255, 0.85), 4px 0 rgba(255, 45, 150, 0.85),
    0 0 22px rgba(255,120,60,.95), 0 0 60px rgba(255,80,40,.5), 0 4px 0 rgba(60,10,0,.6);
}
#announce.show { animation: slam 0.45s cubic-bezier(.17,.84,.3,1) forwards; }
#announce.fade { animation: fadeout 0.4s linear forwards; }
@keyframes slam { 0% { opacity: 0; transform: scale(2.4); } 60% { opacity: 1; transform: scale(0.96); } 100% { opacity: 1; transform: scale(1); } }
@keyframes fadeout { from { opacity: 1; } to { opacity: 0; } }

/* ---------- generic panel ---------- */
.panel { position: fixed; z-index: 30; }
.panel.center {
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--panel); border: 1px solid var(--panel-edge);
  padding: 38px 56px; text-align: center; backdrop-filter: blur(8px);
  clip-path: polygon(22px 0, 100% 0, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0 100%, 0 22px);
  box-shadow: 0 0 50px rgba(65,232,255,.12);
}

button {
  display: block; width: 100%; margin: 10px 0; padding: 12px 26px;
  background: rgba(20, 34, 64, 0.65); color: var(--ink);
  border: 1px solid rgba(160, 220, 255, 0.35); cursor: pointer;
  font-family: var(--head); font-style: italic; font-weight: 700;
  font-size: 16px; letter-spacing: 0.18em;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: all 0.12s ease;
}
button:hover { background: rgba(65, 232, 255, 0.18); border-color: var(--cyan); color: #fff; box-shadow: 0 0 18px rgba(65,232,255,.35); }

/* ---------- title ---------- */
#title { inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.logo {
  text-align: center; line-height: 0.86;
  filter: drop-shadow(0 6px 30px rgba(65,232,255,.4)) drop-shadow(-5px 0 14px rgba(255,45,150,.45));
}
.logo-top {
  font-family: var(--head); font-style: italic; font-weight: 900;
  font-size: clamp(80px, 15vw, 170px); letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff 12%, #9ee9ff 45%, #1f9bff 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo-bottom {
  font-family: var(--head); font-style: italic; font-weight: 900;
  font-size: clamp(40px, 7.6vw, 86px); letter-spacing: 0.34em; margin-top: 8px; padding-left: 0.3em;
  background: linear-gradient(180deg, #ffd9a0 0%, #ff7a3d 55%, #ff3d2e 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tag { margin-top: 26px; font-size: 14px; letter-spacing: 0.62em; color: rgba(223,244,255,.66); padding-left: 0.6em; }
.press {
  margin-top: 64px; font-family: var(--head); font-style: italic; font-weight: 700;
  font-size: 21px; letter-spacing: 0.3em; color: var(--cyan);
  text-shadow: 0 0 16px rgba(65,232,255,.8); animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.foot {
  position: absolute; bottom: 22px; left: 0; right: 0; text-align: center;
  font-size: 10.5px; letter-spacing: 0.08em; color: rgba(223,244,255,.34);
}

/* ---------- garage ---------- */
#garage.side {
  top: 0; right: 0; bottom: 0; width: min(430px, 44vw);
  background: linear-gradient(270deg, rgba(6, 10, 24, 0.93) 75%, rgba(6, 10, 24, 0.55) 100%);
  border-left: 1px solid var(--panel-edge); backdrop-filter: blur(10px);
  padding: 26px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
}
.g-title { font-family: var(--head); font-style: italic; font-weight: 900; font-size: 44px; letter-spacing: 0.08em;
  background: linear-gradient(180deg,#fff,#6fd9ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.g-sub { font-size: 11px; letter-spacing: 0.42em; color: rgba(223,244,255,.5); margin-top: -4px; }

.tabs { display: flex; gap: 6px; margin-top: 8px; }
.tab { margin: 0; padding: 8px 0; font-size: 13px; letter-spacing: 0.1em; flex: 1; }
.tab.sel { background: rgba(65, 232, 255, 0.22); border-color: var(--cyan); color: #fff; box-shadow: 0 0 14px rgba(65,232,255,.3); }

#part-list { display: flex; flex-direction: column; gap: 6px; min-height: 150px; }
.part-item {
  padding: 9px 14px; border: 1px solid rgba(160,220,255,.22); background: rgba(14, 22, 44, 0.55);
  cursor: pointer; display: flex; justify-content: space-between; align-items: baseline;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: all 0.1s ease;
}
.part-item:hover { border-color: rgba(65,232,255,.7); background: rgba(30, 50, 90, 0.6); }
.part-item.sel { border-color: var(--cyan); background: rgba(65, 232, 255, 0.16); box-shadow: 0 0 14px rgba(65,232,255,.25); }
.part-item .pn { font-family: var(--head); font-style: italic; font-weight: 700; font-size: 16px; letter-spacing: 0.06em; }
.part-item .pt { font-size: 10px; letter-spacing: 0.14em; color: rgba(223,244,255,.5); }

#part-info { min-height: 44px; font-size: 12.5px; line-height: 1.5; color: rgba(223,244,255,.75); padding: 4px 2px; }
#part-info b { color: var(--cyan); }

.g-stats { display: flex; flex-direction: column; gap: 7px; padding: 12px 0 4px; border-top: 1px solid rgba(160,220,255,.16); }
.stat-row { display: flex; align-items: center; gap: 12px; }
.stat-row span { width: 64px; font-size: 10.5px; letter-spacing: 0.18em; color: rgba(223,244,255,.6); text-align: right; }
.stat-row .bar { flex: 1; height: 8px; background: rgba(10,16,32,.8); border: 1px solid rgba(160,220,255,.2); transform: skewX(-18deg); overflow: hidden; }
.stat-row .fill { height: 100%; width: 50%; background: linear-gradient(90deg, #2fd8ff, #9ef3ff); box-shadow: 0 0 10px rgba(65,232,255,.7); transition: width 0.25s ease; }

.g-diff { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.g-lbl { font-size: 10.5px; letter-spacing: 0.2em; color: rgba(223,244,255,.6); }
#difficulty { display: flex; gap: 6px; flex: 1; }
.diff-btn { margin: 0; padding: 7px 0; font-size: 11.5px; flex: 1; letter-spacing: 0.08em; }
.diff-btn.sel { background: rgba(255, 140, 60, 0.22); border-color: var(--orange); color: #fff; box-shadow: 0 0 14px rgba(255,160,60,.3); }

#btn-launch {
  margin-top: 10px; padding: 16px; font-size: 20px;
  background: linear-gradient(180deg, rgba(40, 160, 255, 0.4), rgba(20, 80, 200, 0.45));
  border-color: var(--cyan);
}
#btn-launch:hover { box-shadow: 0 0 30px rgba(65,232,255,.55); }
.g-foot { text-align: center; font-size: 10px; letter-spacing: 0.2em; color: rgba(223,244,255,.3); }

/* ---------- pause / result ---------- */
.p-title, .r-verdict {
  font-family: var(--head); font-style: italic; font-weight: 900; font-size: 52px;
  letter-spacing: 0.12em; margin-bottom: 18px;
  text-shadow: -3px 0 rgba(255,45,150,.7), 3px 0 rgba(65,232,255,.7), 0 0 24px rgba(65,232,255,.7);
}
.r-verdict.win { color: #c4ffe8; text-shadow: 0 0 28px rgba(65,255,180,.85); }
.r-verdict.lose { color: #ffc4b8; text-shadow: 0 0 28px rgba(255,90,60,.85); }
.r-stats { font-size: 13px; letter-spacing: 0.12em; line-height: 2; color: rgba(223,244,255,.78); margin-bottom: 16px; white-space: pre-line; }
.p-foot { margin-top: 14px; font-size: 10.5px; letter-spacing: 0.16em; color: rgba(223,244,255,.4); }

/* ---------- misc ---------- */
#banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99; padding: 10px 16px;
  background: rgba(120, 10, 10, 0.92); color: #ffd9d4; font: 12px/1.5 monospace; white-space: pre-wrap;
}
#fps {
  position: fixed; top: 8px; left: 10px; z-index: 50; font: 11px monospace; color: rgba(140, 255, 190, 0.8);
  text-shadow: 0 1px 2px #000;
}
