@import url('/static/shared/base.css');

/* Meteor — atmospheric entry, deterministic outcome.
   Visual language: NASA flight-loop minimalism + cinematic space drama.
   Mobile-first; tablet/desktop scales up with breakpoints at 720/1100. */

:root {
  --theme-primary:        #fbbf24;
  --theme-primary-bright: #ffd76a;
  --meteor-blue:          #5fa6c4;
  --meteor-red:           #ff5b5b;
  --space-bg:             #050810;
  --space-elev:           #11141c;
  --space-card:           #161a24;
  --space-card-hi:        #1d2230;
}

/* ---------- Global / canvas ---------- */

body {
  background:
    radial-gradient(ellipse at 30% 15%, rgba(255, 32, 145, 0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 75% 85%, rgba(1, 132, 253, 0.10) 0%, transparent 55%),
    var(--space-bg) !important;
  color: #e8eaf3 !important;
}

/* Force explicit high-contrast text everywhere base.css / compact.css might
   otherwise leave it under-saturated. */
.stage, .hero, .hero p, .panel, .muted, .pool-panel,
.bet-panel h2, .pool-panel h3, .narration-panel,
.entry-panel, .telemetry-panel, .map-panel { color: #e8eaf3; }
.muted, .pool-panel p.muted { color: #a8aebf !important; }
.brand, .brand-game { color: #fbbf24 !important; }
.balance { color: #ffd76a !important; }
#player-label { color: #cdd0d8 !important; }
.hero h1 { color: #fff !important; }
.hero p  { color: #cdd0d8 !important; }

.topbar {
  background: rgba(8, 10, 16, 0.88) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(10px);
}
.new-pill {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FF2091 0%, #0184FD 100%);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Screen shake — applied to <body> for fragmentation + impact thumps. */
@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  20%      { transform: translate(-3px, 2px); }
  40%      { transform: translate(2px, -3px); }
  60%      { transform: translate(-2px, -1px); }
  80%      { transform: translate(3px, 2px); }
}
body.shake { animation: screen-shake 0.4s ease-in-out; }

/* ---------- Hero ---------- */

.hero { text-align: center; padding: 1.2rem 1rem 0.4rem; }
.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: #fbbf24;
  margin-bottom: 0.5rem;
}
.hero h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  margin: 0 0 0.5rem;
  line-height: 1.15;
}
.hero p {
  max-width: 640px;
  margin: 0 auto 1.2rem;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 0 0.5rem;
}
.hero p em { color: #ff8aa7; font-style: normal; font-weight: 600; }

.hero-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  max-width: 1000px;
  margin: 1.5rem auto 0;
  text-align: left;
}
.hp-card {
  background: var(--space-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  position: relative;
  transition: transform 0.25s, border-color 0.25s, background 0.25s;
}
.hp-card:hover {
  transform: translateY(-2px);
  border-color: rgba(251, 191, 36, 0.4);
  background: var(--space-card-hi);
}
.hp-step {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 100px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.hp-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.18rem;
  font-weight: 600;
  color: #ffd76a;
  margin-top: 0.5rem;
  margin-bottom: 0.3rem;
}
.hp-body { font-size: 13px; color: #b8bfd0; line-height: 1.55; }
.hp-body em { color: #ff8aa7; font-style: normal; font-weight: 600; }

button.cta {
  background: linear-gradient(135deg, #FF2091 0%, #0184FD 100%) !important;
  color: #fff !important;
  border: none !important;
  padding: 0.9rem 2rem !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  box-shadow: 0 6px 22px rgba(255, 32, 145, 0.35);
  transition: transform 0.15s, filter 0.15s !important;
  min-height: 48px;
}
button.cta:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
button.cta:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Entry panel ---------- */

.entry-panel {
  background: var(--space-elev);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid #fbbf24;
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
}
.entry-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: #fbbf24;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}
.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.7rem 1.3rem;
  margin-bottom: 0.8rem;
}
.entry-stat .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8a92a8;
  margin-bottom: 0.15rem;
}
.entry-stat .value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  color: #ffd76a;
  font-weight: 500;
}
.entry-hidden {
  margin-top: 0.5rem;
  padding-top: 0.7rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #b0b6c8;
  line-height: 1.45;
}
.hidden-label {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  color: #ff8aa7;
  background: rgba(255, 32, 145, 0.12);
  border: 1px solid rgba(255, 32, 145, 0.3);
  border-radius: 3px;
  padding: 2px 7px;
  margin-right: 0.4rem;
}

/* ---------- Polar map (the centerpiece) ---------- */

.map-panel {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(95, 166, 196, 0.06) 0%, transparent 70%),
    rgba(6, 8, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem 0.8rem 0.8rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.map-panel::before {
  content: '';
  position: absolute; inset: -20%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 32, 145, 0.05) 0%, transparent 40%);
  pointer-events: none;
  animation: halo-pulse 6s ease-in-out infinite;
}
@keyframes halo-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.05); }
}

#map-svg {
  width: 100%;
  max-width: 560px;
  height: auto;
  display: block;
  margin: 0 auto;
  position: relative;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
#map-svg.zoom-in { transform: scale(1.18); }

/* Starfield */
.star {
  opacity: 0.5;
  animation: star-twinkle 4s ease-in-out infinite;
}
@keyframes star-twinkle {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 0.95; }
}

/* Biome wedges */
.wedge {
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.25s, filter 0.25s, transform 0.4s;
  transform-origin: 0 0;
}
.wedge:hover {
  opacity: 0.8;
  filter: brightness(1.15) drop-shadow(0 0 8px rgba(251, 191, 36, 0.35));
}
.wedge.is-selected {
  opacity: 0.92;
  filter: brightness(1.35) drop-shadow(0 0 14px rgba(251, 191, 36, 0.65));
}
.wedge.is-winner {
  opacity: 1;
  filter: brightness(1.55) drop-shadow(0 0 28px rgba(255, 91, 91, 0.8));
  animation: winner-pulse 1.4s ease-in-out infinite;
}
@keyframes winner-pulse {
  0%, 100% { filter: brightness(1.4) drop-shadow(0 0 18px rgba(255, 91, 91, 0.6)); }
  50%      { filter: brightness(1.75) drop-shadow(0 0 34px rgba(255, 91, 91, 0.95)); }
}
.wedge-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  fill: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  pointer-events: none;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Outer Burnup ring — annulus outside the planet wedges. The reading is
   "the meteor never reached the surface" → ring is outside the world. */
.wedge.wedge-burnup {
  opacity: 0.55;
  transition: opacity 0.25s, fill 0.25s, filter 0.25s, stroke-width 0.25s;
}
.wedge.wedge-burnup:hover {
  opacity: 0.95;
  fill: rgba(255, 91, 91, 0.20) !important;
  filter: drop-shadow(0 0 10px rgba(255, 91, 91, 0.55));
}
.wedge.wedge-burnup.is-selected {
  opacity: 1;
  fill: rgba(255, 91, 91, 0.30) !important;
  stroke-width: 2;
  filter: drop-shadow(0 0 16px rgba(255, 91, 91, 0.75));
}
.wedge.wedge-burnup.is-winner {
  opacity: 1;
  fill: rgba(255, 91, 91, 0.45) !important;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 28px rgba(255, 91, 91, 0.95));
  animation: winner-pulse 1.4s ease-in-out infinite;
}
.burnup-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  fill: #ff8aa7;
  pointer-events: none;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

/* Sub-entry point pulses while the round is open */
.entry-point {
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.9));
  animation: entry-pulse 1.6s ease-in-out infinite;
}
@keyframes entry-pulse {
  0%, 100% { r: 5; opacity: 1; }
  50%      { r: 8; opacity: 0.65; }
}

/* Glowing meteor head — travels along the polyline */
#meteor-head {
  filter: drop-shadow(0 0 10px rgba(255, 215, 106, 0.95))
          drop-shadow(0 0 22px rgba(255, 32, 145, 0.55));
  transition: cx 0.22s linear, cy 0.22s linear, r 0.3s ease-out;
}
#meteor-head.active { r: 7; }

/* Comet trail ghosts */
@keyframes ghost-fade {
  0%   { r: 6; opacity: 0.85; }
  100% { r: 1; opacity: 0;    }
}
.meteor-ghost {
  filter: drop-shadow(0 0 6px rgba(255, 215, 106, 0.6));
  animation: ghost-fade 0.9s ease-out forwards;
  pointer-events: none;
}

#trajectory {
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.7));
  opacity: 0.95;
  stroke-dasharray: 0;
}

.map-legend {
  margin-top: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #6f7689;
  padding: 0 0.5rem;
}

/* Impact marker + shockwaves */
@keyframes impact-flash {
  0%   { r: 0;  opacity: 0; }
  40%  { r: 22; opacity: 1; }
  100% { r: 12; opacity: 1; }
}
#impact-marker.active {
  animation: impact-flash 0.6s ease-out forwards;
  filter: drop-shadow(0 0 14px rgba(255, 91, 91, 0.95));
}
@keyframes shockwave {
  0%   { r: 2;  opacity: 0.95; stroke-width: 2.2; }
  100% { r: 80; opacity: 0;    stroke-width: 0.4; }
}
.impact-wave {
  animation: shockwave 1.8s ease-out forwards;
  pointer-events: none;
}

/* Fragmentation shards (SVG dots that fly out from the meteor head) */
@keyframes shard-fly {
  0%   { transform: translate(0, 0)        scale(1);   opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}
.frag-shard {
  filter: drop-shadow(0 0 5px rgba(255, 215, 106, 0.85));
  animation: shard-fly 0.9s ease-out forwards;
  pointer-events: none;
}

/* ---------- Telemetry HUD ---------- */

.telemetry-panel {
  background: var(--space-elev);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.8rem 1rem;
}
.telem .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8a92a8;
  margin-bottom: 0.2rem;
}
.telem .value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px;
  color: #fbbf24;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Bet panel ---------- */

.bet-panel {
  background: var(--space-elev);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
}
/* ---------- Bet strip (lives ABOVE the map) ---------- */

.bet-panel { padding: 1rem 1.2rem; }
.bet-strip {
  display: flex; align-items: center; gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: space-between;
}
.bet-strip-headline {
  flex: 1 1 320px;
  min-width: 0;
}
.bet-strip-headline h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  color: #ffd76a !important;
  margin: 0 0 0.4rem;
}
.bet-strip-controls {
  display: flex; align-items: center; gap: 0.7rem;
  flex-wrap: wrap;
}
.stake-label {
  color: #cdd0d8;
  font-size: 0.85rem;
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stake-label input {
  width: 78px;
  padding: 0.55rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  min-height: 42px;
}
.stake-label input:focus { outline: none; border-color: #fbbf24; }
#bet-status { color: #ffd76a !important; margin-top: 0.6rem; }

/* "Selected: X" feedback line. Compact, lives inside the bet strip. */
.selected-side {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #8a92a8;
  padding: 0.35rem 0.6rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  display: inline-block;
  transition: all 0.2s;
}
.selected-side.has-pick {
  border-style: solid;
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.08);
  color: #e8eaf3;
}
.selected-side strong {
  color: #ffd76a;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.15em;
  letter-spacing: 0;
  margin-left: 0.3rem;
}

#biome-grid { display: none !important; }

.stake-row {
  display: flex; align-items: center; gap: 0.8rem;
  margin-top: 0.7rem;
  flex-wrap: wrap;
}
.stake-row label { color: #cdd0d8; font-size: 0.95rem; }
.stake-row input {
  width: 86px;
  padding: 0.55rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  min-height: 44px;
}
.stake-row input:focus { outline: none; border-color: #fbbf24; }
#bet-status { color: #ffd76a !important; }

/* ---------- Narration ---------- */

.narration-panel {
  background: var(--space-elev);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.95rem 1.3rem;
}
.loop-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: #ff8aa7;
  margin-bottom: 0.5rem;
}
.narration {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  color: #cdd0d8;
  white-space: pre-wrap;
  min-height: 4em;
}

/* ---------- Pool ---------- */
.pool-panel h3 { color: #ffd76a !important; }
.pool-panel .side-label { color: #fbbf24 !important; }
.pool-panel .amount, .pool-panel p.muted { color: #b0b6c8 !important; }

/* ---------- Reveal ---------- */

.reveal-panel { text-align: center; padding: 1.5rem 1rem; }
.impact-banner {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  color: #ff5b5b;
  letter-spacing: 0.2em;
  margin-bottom: 0.4rem;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s, transform 0.5s;
  text-shadow: 0 0 30px rgba(255, 91, 91, 0.7);
}
.impact-banner.shown { opacity: 1; transform: scale(1); }
.reveal-val {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2rem, 6vw, 3rem);
  color: #ffd76a;
  margin: 0.3rem 0;
}
.reveal-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #a8aebf !important;
  padding: 0 0.5rem;
}

/* ---------- Fragmentation full-screen flash ---------- */

@keyframes frag-flash {
  0%   { opacity: 0; }
  20%  { opacity: 0.6; }
  100% { opacity: 0; }
}
.frag-flash {
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 200, 100, 0.65) 0%, transparent 60%);
  animation: frag-flash 0.7s ease-out forwards;
  z-index: 5;
}

/* ============================================================
   MOBILE — phone-first layout
   ============================================================ */

@media (max-width: 720px) {
  .stage { padding: 0.8rem 0.6rem 1.4rem; gap: 0.9rem; }
  .hero { padding: 0.8rem 0.5rem 0.2rem; }
  .hero h1 { font-size: 1.45rem; line-height: 1.2; }
  .hero p { font-size: 0.92rem; padding: 0 0.2rem; }
  .hero-preview { grid-template-columns: 1fr; gap: 0.6rem; margin-top: 1rem; }
  .hp-card { padding: 0.9rem 1rem; }
  button.cta { padding: 1rem 1.8rem !important; width: 100%; max-width: 320px; }

  /* Map dominates the phone viewport. */
  .map-panel { padding: 0.7rem 0.4rem 0.5rem; border-radius: 14px; }
  #map-svg { max-width: 100%; }
  .wedge-label { font-size: 9px; letter-spacing: 0.08em; }

  /* Entry conditions stay readable but tighter. */
  .entry-panel { padding: 0.9rem 1rem; }
  .entry-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem 0.9rem; }
  .entry-stat .value { font-size: 14px; }

  /* Telemetry: 2-column with chunky values. */
  .telemetry-panel { padding: 0.7rem 0.9rem; grid-template-columns: repeat(2, 1fr); gap: 0.7rem 0.9rem; }
  .telem .value { font-size: 15px; }

  /* Bet strip: stack vertically on phones. */
  .bet-panel { padding: 0.85rem 1rem; }
  .bet-strip { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .bet-strip-headline h2 { font-size: 1rem; }
  .bet-strip-controls { width: 100%; gap: 0.6rem; }
  .stake-label { flex: 0 0 auto; }
  .stake-label input { width: 72px; }
  .bet-strip-controls button.cta { flex: 1 1 auto; padding: 0.85rem 1rem !important; min-height: 46px; }
  .selected-side { font-size: 10px; padding: 0.3rem 0.55rem; }
  .burnup-label { font-size: 8px; letter-spacing: 0.18em; }

  /* Narration / reveal compact. */
  .narration-panel { padding: 0.8rem 1rem; }
  .narration { font-size: 12px; }
  .reveal-panel { padding: 1.2rem 0.7rem; }

  /* Topbar tightens. */
  .topbar { padding: 0.5rem 0.9rem; }
  .balance { font-size: 0.95rem; }
  .meta { gap: 0.5rem; font-size: 0.85rem; }
  .new-pill { font-size: 8px; padding: 1px 6px; }
}

/* Very small phones (<360px) — strip even more chrome. */
@media (max-width: 380px) {
  .biome-grid { grid-template-columns: 1fr; }
  .biome-chip { min-height: 64px; padding: 0.7rem; }
  .entry-grid { grid-template-columns: 1fr; }
}
