/* style.css — all styling */
:root{
  color-scheme:dark;
  --bg:#070b18;
  --bg-deep:#050813;
  --surface:#10182e;
  --surface-raised:#172344;
  --surface-glass:#101a34e8;
  --line:#2b3c69;
  --line-bright:#49649d;
  --text:#f2f7ff;
  --muted:#91a4c9;
  --accent:#5ce5d0;
  --accent-soft:#5ce5d033;
  --accent2:#ffc86b;
  --danger:#ff7186;
  --shadow:0 22px 70px #000a;
  --radius:18px;
}

@media(prefers-color-scheme:light){
  :root{
    color-scheme:light;
    --bg:#e7edf8;
    --bg-deep:#dce5f4;
    --surface:#ffffff;
    --surface-raised:#edf3fc;
    --surface-glass:#fffffff0;
    --line:#c4d0e5;
    --line-bright:#8fa5ca;
    --text:#142342;
    --muted:#5f708f;
    --accent:#087f76;
    --accent-soft:#087f7622;
    --accent2:#a86500;
    --danger:#c43f58;
    --shadow:0 22px 60px #34466a2b;
  }
}

html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#070b18;
  --bg-deep:#050813;
  --surface:#10182e;
  --surface-raised:#172344;
  --surface-glass:#101a34e8;
  --line:#2b3c69;
  --line-bright:#49649d;
  --text:#f2f7ff;
  --muted:#91a4c9;
  --accent:#5ce5d0;
  --accent-soft:#5ce5d033;
  --accent2:#ffc86b;
  --danger:#ff7186;
  --shadow:0 22px 70px #000a;
}

html[data-theme="light"]{
  color-scheme:light;
  --bg:#e7edf8;
  --bg-deep:#dce5f4;
  --surface:#ffffff;
  --surface-raised:#edf3fc;
  --surface-glass:#fffffff0;
  --line:#c4d0e5;
  --line-bright:#8fa5ca;
  --text:#142342;
  --muted:#5f708f;
  --accent:#087f76;
  --accent-soft:#087f7622;
  --accent2:#a86500;
  --danger:#c43f58;
  --shadow:0 22px 60px #34466a2b;
}

*{box-sizing:border-box}

html,body{
  width:100%;
  height:100%;
  margin:0;
  padding:0;
  overflow:hidden;
}

body{
  background:
    radial-gradient(circle at 50% -20%,#263c7d44,transparent 42%),
    var(--bg);
  color:var(--text);
  font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  touch-action:manipulation;
}

button{
  font:inherit;
  color:inherit;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}

button:focus-visible{
  outline:3px solid var(--accent);
  outline-offset:3px;
}

.game-shell{
  position:relative;
  isolation:isolate;
  width:100%;
  height:100dvh;
  min-height:0;
  display:flex;
  flex-direction:column;
  max-width:1480px;
  margin:auto;
  padding:24px 34px 15px;
  overflow:hidden;
  background:
    radial-gradient(circle at 93% 3%,#3b5ba544,transparent 31%),
    radial-gradient(circle at 4% 100%,#087f7621,transparent 32%);
}

.game-shell::before,
.game-shell::after{
  position:absolute;
  z-index:-1;
  content:"";
  width:190px;
  height:190px;
  border:1px solid var(--accent-soft);
  border-radius:50%;
  pointer-events:none;
}

.game-shell::before{
  top:-130px;
  right:13%;
  box-shadow:0 0 0 20px transparent,0 0 0 21px var(--accent-soft);
}

.game-shell::after{
  bottom:-150px;
  left:8%;
  opacity:.55;
}

.hud{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:20px;
  padding-bottom:17px;
}

.brand{
  display:flex;
  align-items:center;
  gap:13px;
  min-width:0;
}

.brand-copy{min-width:0}

.signal-mark{
  position:relative;
  width:44px;
  height:44px;
  flex:0 0 44px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  border:1px solid var(--accent);
  border-radius:14px;
  background:var(--accent-soft);
  transform:rotate(-10deg);
  box-shadow:0 0 25px var(--accent-soft),inset 0 0 16px #ffffff08;
}

.signal-mark::after{
  position:absolute;
  inset:5px;
  border:1px solid #ffffff18;
  border-radius:10px;
  content:"";
}

.signal-mark i{
  position:relative;
  z-index:1;
  display:block;
  width:4px;
  border-radius:5px;
  background:var(--accent);
  box-shadow:0 0 8px var(--accent);
}

.signal-mark i:nth-child(1){height:13px}
.signal-mark i:nth-child(2){height:26px}
.signal-mark i:nth-child(3){height:18px}

.eyebrow{
  display:block;
  color:var(--accent);
  font-size:10px;
  font-weight:850;
  letter-spacing:.16em;
  line-height:1.2;
  text-transform:uppercase;
}

h1{
  margin:4px 0 0;
  color:var(--text);
  font-size:clamp(21px,3vw,31px);
  line-height:1;
  letter-spacing:-.045em;
  white-space:nowrap;
}

.stats{
  display:flex;
  gap:8px;
  margin-left:auto;
}

.stat-card{
  min-width:78px;
  padding:8px 12px 9px;
  border:1px solid var(--line);
  border-radius:12px;
  background:linear-gradient(145deg,var(--surface-raised),var(--surface));
  box-shadow:0 8px 22px #0002,inset 0 1px #ffffff0b;
  text-align:center;
  transition:border-color .2s ease,transform .2s ease;
}

.stat-card:hover{
  border-color:var(--line-bright);
  transform:translateY(-1px);
}

.stat-card span{
  display:block;
  color:var(--muted);
  font-size:9px;
  font-weight:750;
  letter-spacing:.13em;
  text-transform:uppercase;
}

.stat-card strong{
  display:block;
  margin-top:1px;
  color:var(--text);
  font-size:19px;
  font-variant-numeric:tabular-nums;
  letter-spacing:-.02em;
}

.wave-stat strong{color:var(--accent2)}
.hull-stat strong{color:var(--danger)}

.icon-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-width:91px;
  min-height:44px;
  padding:9px 12px;
  border:1px solid var(--line);
  border-radius:11px;
  background:var(--surface);
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  transition:background .2s ease,border-color .2s ease,color .2s ease,transform .2s ease;
}

.icon-button:hover{
  border-color:var(--accent);
  background:var(--surface-raised);
  color:var(--text);
  transform:translateY(-1px);
}

.icon-button[aria-pressed="false"]{
  border-color:var(--line);
}

.sound-led{
  width:7px;
  height:7px;
  border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 9px var(--accent);
  transition:background .2s ease,box-shadow .2s ease;
}

.icon-button[aria-pressed="false"] .sound-led{
  background:var(--muted);
  box-shadow:none;
}

.arena-wrap{
  position:relative;
  min-width:0;
  min-height:0;
  flex:1 1 0;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:#0a1024;
  box-shadow:var(--shadow),0 0 0 5px #ffffff04;
}

.arena-wrap::before{
  position:absolute;
  z-index:1;
  inset:0;
  border:1px solid #ffffff0a;
  border-radius:inherit;
  content:"";
  pointer-events:none;
}

#arena{
  display:block;
  width:100%;
  height:100%;
  min-width:1px;
  min-height:1px;
  touch-action:none;
}

.overlay-card{
  position:absolute;
  z-index:2;
  left:50%;
  top:50%;
  width:min(500px,calc(100% - 34px));
  min-height:268px;
  padding:34px 35px 29px;
  overflow:hidden;
  border:1px solid var(--accent);
  border-radius:19px;
  background:var(--surface-glass);
  box-shadow:0 24px 80px #000b,0 0 0 5px #5ce5d00b,inset 0 1px #ffffff18;
  backdrop-filter:blur(16px);
  text-align:center;
  transform:translate(-50%,-50%);
  animation:rise .48s cubic-bezier(.2,.8,.2,1);
}

.card-orbit{
  position:absolute;
  top:-80px;
  left:50%;
  width:210px;
  height:150px;
  border:1px solid var(--accent-soft);
  border-radius:50%;
  transform:translateX(-50%) rotate(-18deg);
  pointer-events:none;
}

.card-orbit::after{
  position:absolute;
  right:11px;
  bottom:8px;
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--accent2);
  box-shadow:0 0 13px var(--accent2);
  content:"";
}

.overlay-card .eyebrow,
.overlay-card h2,
.overlay-card p,
.overlay-card button,
.overlay-card .controls{
  position:relative;
  z-index:1;
}

.overlay-card.hidden{
  visibility:hidden;
  opacity:0;
  pointer-events:none;
}

.overlay-card h2{
  margin:8px 0 9px;
  color:var(--text);
  font-size:clamp(28px,5vw,43px);
  line-height:1.03;
  letter-spacing:-.055em;
}

.overlay-card p{
  max-width:400px;
  margin:0 auto 23px;
  color:var(--muted);
  font-size:14px;
}

.primary-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:163px;
  min-height:50px;
  padding:12px 23px;
  border:1px solid #ffffff30;
  border-radius:11px;
  background:linear-gradient(135deg,var(--accent),#4ac8c2);
  color:#062622;
  font-weight:850;
  box-shadow:0 10px 25px var(--accent-soft),inset 0 1px #ffffff88;
  transition:transform .18s ease,filter .18s ease,box-shadow .18s ease;
}

.primary-button:hover{
  transform:translateY(-2px);
  filter:brightness(1.08);
  box-shadow:0 13px 31px var(--accent-soft),inset 0 1px #ffffffaa;
}

.primary-button:active{
  transform:translateY(1px);
  box-shadow:0 5px 14px var(--accent-soft);
}

.controls{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:9px 16px;
  margin-top:22px;
  color:var(--muted);
  font-size:11px;
}

kbd{
  display:inline-grid;
  place-items:center;
  min-width:24px;
  height:23px;
  padding:0 5px;
  margin:0 2px;
  border:1px solid var(--line-bright);
  border-bottom-width:2px;
  border-radius:5px;
  background:var(--surface-raised);
  color:var(--text);
  font-size:11px;
  font-weight:700;
}

.aim-hint{
  position:absolute;
  z-index:1;
  right:16px;
  bottom:15px;
  display:flex;
  align-items:center;
  gap:7px;
  padding:7px 10px;
  border:1px solid #ffffff12;
  border-radius:8px;
  background:#101a35b8;
  color:#afbed9;
  font-size:11px;
  pointer-events:none;
  backdrop-filter:blur(8px);
}

.aim-hint b{
  color:var(--accent);
  font-weight:800;
}

.hint-dot{
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 9px var(--accent);
  animation:pulse 2s ease-in-out infinite;
}

.footer{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:20px;
  min-height:41px;
  padding-top:10px;
  color:var(--muted);
  font-size:11px;
}

.footer span{
  white-space:nowrap;
}

.footer span:last-child{
  margin-left:auto;
  overflow:hidden;
  color:var(--accent);
  font-weight:700;
  text-overflow:ellipsis;
}

.legend-dot{
  display:inline-block;
  width:7px;
  height:7px;
  margin-right:6px;
  border-radius:50%;
  vertical-align:1px;
}

.enemy-dot{
  background:var(--danger);
  box-shadow:0 0 9px var(--danger);
}

.star-dot{
  background:var(--accent2);
  box-shadow:0 0 9px var(--accent2);
}

@keyframes rise{
  from{
    opacity:0;
    transform:translate(-50%,-46%) scale(.97);
  }
  to{
    opacity:1;
    transform:translate(-50%,-50%) scale(1);
  }
}

@keyframes pulse{
  0%,100%{opacity:.55;transform:scale(.8)}
  50%{opacity:1;transform:scale(1.25)}
}

@media(max-width:760px){
  .game-shell{
    padding:14px 12px 8px;
  }

  .hud{
    gap:9px;
    padding-bottom:11px;
    align-items:flex-start;
  }

  .signal-mark{
    width:35px;
    height:35px;
    flex-basis:35px;
    border-radius:11px;
  }

  .signal-mark i:nth-child(1){height:10px}
  .signal-mark i:nth-child(2){height:20px}
  .signal-mark i:nth-child(3){height:14px}

  .brand{gap:8px}
  .eyebrow{font-size:8px}
  h1{font-size:21px}

  .stats{
    gap:4px;
    margin-left:auto;
  }

  .stat-card{
    min-width:43px;
    padding:6px 4px 7px;
    border-radius:9px;
  }

  .stat-card span{font-size:8px}
  .stat-card strong{font-size:15px}
  .best-stat{display:none}

  .icon-button{
    min-width:70px;
    padding:7px 8px;
    font-size:11px;
  }

  .overlay-card{
    width:calc(100% - 24px);
    min-height:250px;
    padding:27px 19px 24px;
  }

  .overlay-card h2{font-size:30px}
  .overlay-card p{font-size:13px}

  .primary-button{
    min-width:156px;
    min-height:49px;
  }

  .aim-hint{
    right:9px;
    bottom:9px;
    padding:6px 8px;
    font-size:10px;
  }

  .footer{
    min-height:42px;
    gap:10px;
    font-size:10px;
  }

  .footer span:nth-child(2){display:none}
}

@media(max-height:560px) and (orientation:landscape){
  .game-shell{
    padding-top:7px;
  }

  .hud{
    padding-bottom:6px;
  }

  .footer{
    min-height:30px;
    padding-top:4px;
  }

  .overlay-card{
    min-height:210px;
    padding:17px 22px 15px;
  }

  .overlay-card h2{
    margin:5px 0 6px;
    font-size:26px;
  }

  .overlay-card p{
    margin-bottom:12px;
    font-size:12px;
  }

  .controls{
    margin-top:10px;
  }

  .card-orbit{display:none}
}
