/* ============================================================
   AI EXPLORER — mission UI
   Palette : nuit spatiale #05060a · cyan core #7df9ff · soleil #ffb36b
   ============================================================ */

:root {
  --bg: #05060a;
  --ink: #e8f1f2;
  --dim: #8a98a8;
  --cyan: #7df9ff;
  --cyan-deep: #19c8d6;
  --sun: #ffb36b;
  --font-display: 'Michroma', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  -webkit-user-select: none;
  user-select: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  z-index: 20;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 140, 60, .08), transparent 55%),
    radial-gradient(ellipse at 80% -10%, rgba(60, 130, 255, .10), transparent 55%),
    rgba(5, 6, 10, .82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity .6s ease, visibility .6s;
}
.screen.hidden, #hud.hidden, #touch-ui.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.title-inner, .loader-inner { display: flex; flex-direction: column; align-items: center; gap: 1.4rem; padding: 2rem; max-width: 92vw; }

/* ---------- wordmark ---------- */
.wordmark {
  font-family: var(--font-display);
  letter-spacing: .14em;
  color: var(--ink);
  text-shadow: 0 0 24px rgba(125, 249, 255, .35);
}
.wordmark span { color: var(--cyan); text-shadow: 0 0 18px rgba(125, 249, 255, .8); }
.wordmark-hero { font-size: clamp(1.6rem, 6vw, 3.6rem); line-height: 1.15; }
.wordmark-big  { font-size: clamp(1.3rem, 4.5vw, 2.2rem); }
.wordmark-small { font-size: .85rem; }

.mission-tag {
  font-size: .72rem; letter-spacing: .42em; color: var(--sun);
  border: 1px solid rgba(255, 179, 107, .35);
  padding: .45em 1.1em .35em 1.45em;
}
.mission-tag--ok { color: var(--cyan); border-color: rgba(125, 249, 255, .4); }

.title-brief { color: var(--dim); font-size: .95rem; line-height: 1.7; }

.handle {
  color: var(--dim); font-size: .78rem; letter-spacing: .25em; opacity: .85;
  text-decoration: none; transition: color .2s, text-shadow .2s;
}
a.handle:hover { color: var(--cyan); text-shadow: 0 0 14px rgba(125, 249, 255, .8); }

/* ---------- callsign input ---------- */
.callsign-row { display: flex; align-items: center; gap: 1rem; }
.callsign-row label { font-size: .62rem; letter-spacing: .35em; color: var(--dim); }
#callsign {
  background: rgba(125, 249, 255, .06);
  border: 1px solid rgba(125, 249, 255, .35);
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: .85rem; letter-spacing: .2em;
  padding: .6em .9em; width: 13ch;
  text-transform: uppercase; text-align: center;
  outline: none;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
#callsign:focus { border-color: var(--cyan); box-shadow: 0 0 18px rgba(125, 249, 255, .35); }
#callsign::placeholder { color: rgba(138, 152, 168, .5); }

.victory-time {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 4rem);
  color: var(--cyan);
  text-shadow: 0 0 30px rgba(125, 249, 255, .6);
}

/* ---------- CTA ---------- */
.cta {
  font-family: var(--font-display);
  font-size: clamp(.8rem, 2.4vw, 1.05rem);
  letter-spacing: .3em;
  color: var(--bg);
  background: var(--cyan);
  border: none;
  padding: 1.05em 2.2em .95em 2.5em;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  box-shadow: 0 0 32px rgba(125, 249, 255, .45);
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
  animation: ctaPulse 2.2s ease-in-out infinite;
}
.cta:hover { transform: scale(1.05); background: #fff; box-shadow: 0 0 48px rgba(125, 249, 255, .8); }
@keyframes ctaPulse { 50% { box-shadow: 0 0 56px rgba(125, 249, 255, .75); } }

.title-controls {
  display: flex; gap: 2.2rem; flex-wrap: wrap; justify-content: center;
  font-size: .72rem; color: var(--dim); letter-spacing: .08em;
}
.title-controls b { color: var(--ink); font-weight: 500; }

/* ---------- loader ---------- */
.loader-sub { font-size: .7rem; letter-spacing: .35em; color: var(--dim); }
.loader-track {
  width: min(420px, 70vw); height: 3px;
  background: rgba(125, 249, 255, .12);
  overflow: hidden;
}
#loader-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--cyan-deep), var(--cyan));
  box-shadow: 0 0 14px rgba(125, 249, 255, .9);
  transition: width .25s ease;
}
#loader-status { font-size: .7rem; letter-spacing: .3em; color: var(--cyan); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; transition: opacity .6s; }
.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 1.1rem 1.4rem;
  background: linear-gradient(rgba(5, 6, 10, .55), transparent);
}
.hud-mission { font-size: .58rem; letter-spacing: .3em; color: var(--dim); margin-top: .45rem; }
#hud-online { font-size: .6rem; letter-spacing: .25em; color: var(--cyan); margin-top: .45rem; opacity: 0; transition: opacity .5s; }
#hud-online.on { opacity: 1; text-shadow: 0 0 10px rgba(125, 249, 255, .7); }
.hud-right { text-align: right; }
.hud-cores {
  font-family: var(--font-display); font-size: .95rem; letter-spacing: .15em;
}
.hud-cores span { color: var(--cyan); text-shadow: 0 0 12px rgba(125, 249, 255, .8); }
.hud-timer { font-size: .78rem; color: var(--dim); margin-top: .4rem; letter-spacing: .15em; }

#core-progress {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: rgba(125, 249, 255, .08);
}
#core-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--cyan-deep), var(--cyan));
  box-shadow: 0 0 10px rgba(125, 249, 255, .9);
  transition: width .5s cubic-bezier(.2, .9, .2, 1);
}

#hud-toast {
  position: absolute; left: 50%; top: 18%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: clamp(.8rem, 2.5vw, 1.2rem);
  letter-spacing: .25em; color: var(--cyan);
  text-shadow: 0 0 20px rgba(125, 249, 255, .9);
  opacity: 0; pointer-events: none;
  white-space: nowrap;
}
#hud-toast.show { animation: toast 1.6s ease forwards; }
@keyframes toast {
  0% { opacity: 0; transform: translateX(-50%) translateY(14px) scale(.92); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ---------- combat HUD ---------- */
#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 26px; height: 26px;
  transform: translate(-50%, -50%);
  border: 1.5px solid rgba(125, 249, 255, .55);
  border-radius: 50%;
  pointer-events: none;
  transition: transform .08s ease;
}
#crosshair span {
  position: absolute; left: 50%; top: 50%;
  width: 3px; height: 3px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--cyan);
  box-shadow: 0 0 6px rgba(125, 249, 255, .9);
}
#crosshair.hit { transform: translate(-50%, -50%) scale(1.45); border-color: #fff; }

#shield-wrap {
  position: absolute; bottom: 3.2rem; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  pointer-events: none;
}
#shield-label { font-size: .55rem; letter-spacing: .4em; color: var(--dim); }
#shield-track {
  width: min(300px, 50vw); height: 6px;
  background: rgba(125, 249, 255, .12);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
#shield-bar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--cyan-deep), var(--cyan));
  box-shadow: 0 0 12px rgba(125, 249, 255, .8);
  transition: width .15s ease;
}
#shield-bar.low { background: linear-gradient(90deg, #d6451f, #ff8d5b); box-shadow: 0 0 12px rgba(255, 100, 60, .8); }

.hud-frags {
  font-family: var(--font-display); font-size: .8rem; letter-spacing: .15em;
  color: var(--sun); margin-top: .4rem;
}

#damage-flash {
  position: fixed; inset: 0; z-index: 12; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 30, 20, .45) 100%);
  opacity: 0; transition: opacity .1s;
}

#death-banner {
  position: absolute; left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  text-align: center; pointer-events: none;
  transition: opacity .3s;
}
#death-banner.hidden { opacity: 0; }
.death-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.8rem); letter-spacing: .3em;
  color: #ff5a3c; text-shadow: 0 0 30px rgba(255, 80, 40, .8);
}
.death-by { font-size: .85rem; color: var(--ink); letter-spacing: .2em; margin-top: .6rem; }
.death-respawn { font-size: .7rem; color: var(--dim); letter-spacing: .3em; margin-top: 1rem; }

#fire-btn {
  position: absolute; bottom: 10%; right: 26%;
  width: 86px; height: 86px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: .62rem; letter-spacing: .2em;
  color: var(--sun);
  border: 1.5px solid rgba(255, 179, 107, .55);
  background: rgba(255, 179, 107, .08);
  pointer-events: auto; touch-action: none;
}
#fire-btn:active { background: rgba(255, 179, 107, .3); }

/* ---------- chat ---------- */
#chat {
  position: absolute; left: 1.2rem; bottom: 1rem;
  width: min(440px, 78vw);
  display: flex; flex-direction: column; gap: .5rem;
  pointer-events: none;
}
#chat-log { display: flex; flex-direction: column; gap: .3rem; }
.chat-line {
  font-size: .74rem; line-height: 1.45;
  color: var(--ink);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  background: rgba(5, 6, 10, .45);
  padding: .3em .6em;
  width: fit-content; max-width: 100%;
  border-left: 2px solid rgba(125, 249, 255, .4);
  animation: chatIn .2s ease, chatOut 1s ease 11s forwards;
  word-break: break-word;
}
.chat-line b { font-weight: 700; letter-spacing: .06em; }
.chat-line.system { color: var(--dim); font-style: italic; border-left-color: rgba(138, 152, 168, .3); }
@keyframes chatIn { from { opacity: 0; transform: translateX(-8px); } }
@keyframes chatOut { to { opacity: 0; } }
#chat-form {
  display: flex; align-items: center; gap: .5rem;
  background: rgba(5, 6, 10, .75);
  border: 1px solid rgba(125, 249, 255, .45);
  padding: .45em .7em;
  pointer-events: auto;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
#chat-form.hidden { display: none; }
.chat-prompt { color: var(--cyan); font-weight: 700; }
#chat-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--ink); font-family: var(--font-mono); font-size: .8rem;
}
#chat-input::placeholder { color: rgba(138, 152, 168, .5); }
#chat-hint { font-size: .58rem; letter-spacing: .3em; color: rgba(138, 152, 168, .55); }
#chat-hint.hidden { display: none; }

#chat-btn {
  position: absolute; bottom: 24%; right: 8.6%;
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: .5rem; letter-spacing: .15em;
  color: var(--cyan);
  border: 1.5px solid rgba(125, 249, 255, .4);
  background: rgba(125, 249, 255, .06);
  pointer-events: auto; touch-action: none;
}
#chat-btn:active { background: rgba(125, 249, 255, .25); }

#mute-btn {
  position: absolute; bottom: 1rem; right: 1.2rem;
  pointer-events: auto; cursor: pointer;
  background: none; border: 1px solid rgba(138, 152, 168, .35);
  color: var(--dim); font-family: var(--font-mono); font-size: .62rem;
  letter-spacing: .25em; padding: .5em .9em;
}
#mute-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* ---------- mobile ---------- */
#touch-ui { position: fixed; inset: 0; z-index: 15; pointer-events: none; transition: opacity .4s; }
#joystick {
  position: absolute; bottom: 9%; left: 7%;
  width: 124px; height: 124px; border-radius: 50%;
  border: 1.5px solid rgba(125, 249, 255, .35);
  background: rgba(125, 249, 255, .05);
  pointer-events: auto; touch-action: none;
}
#joystick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(125, 249, 255, .25);
  border: 1.5px solid var(--cyan);
  box-shadow: 0 0 18px rgba(125, 249, 255, .5);
}
#jump-btn {
  position: absolute; bottom: 10%; right: 8%;
  width: 86px; height: 86px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: .62rem; letter-spacing: .2em;
  color: var(--cyan);
  border: 1.5px solid rgba(125, 249, 255, .5);
  background: rgba(125, 249, 255, .08);
  pointer-events: auto; touch-action: none;
}
#jump-btn:active { background: rgba(125, 249, 255, .3); }

/* ---------- css vignette (cheap, always on) ---------- */
#vignette-css {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 5, .42) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .cta { animation: none; }
  .screen { transition: none; }
}
