:root {
  color-scheme: dark;
  --bg: #05060b;
  --ink: #f4f6fb;
  --muted: rgba(232, 238, 249, 0.62);
  --line: rgba(255, 255, 255, 0.14);
  --glass: rgba(10, 12, 20, 0.56);
  --long: #22efa0;
  --long-soft: rgba(34, 239, 160, 0.18);
  --short: #ff4c32;
  --short-soft: rgba(255, 76, 50, 0.2);
  --gold: #ffc84a;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Syne", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

#war {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  cursor: grab;
}
#war:active { cursor: grabbing; }

/* 3D projected layers */
#callouts, #whale-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.callout {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 5px 10px;
  border-radius: 999px;
  font: 700 12px var(--mono);
  letter-spacing: 0.03em;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  animation: callout-rise 2.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.callout.long {
  background: rgba(10, 44, 32, 0.78);
  color: #7effcb;
  border-color: rgba(34, 239, 160, 0.55);
  box-shadow: 0 0 22px rgba(34, 239, 160, 0.35);
}
.callout.short {
  background: rgba(58, 14, 12, 0.78);
  color: #ff8e7a;
  border-color: rgba(255, 76, 50, 0.55);
  box-shadow: 0 0 22px rgba(255, 76, 50, 0.35);
}
.callout.big {
  font-size: 14px;
  padding: 7px 14px;
}

@keyframes callout-rise {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.84); }
  12% { opacity: 1; transform: translate(-50%, -55%) scale(1.04); }
  75% { opacity: 1; transform: translate(-50%, -115%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -155%) scale(0.96); }
}

/* Whale 3D floating target lock */
.whale-tag {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  min-width: 210px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(14, 12, 18, 0.84);
  border: 1px solid rgba(255, 200, 74, 0.7);
  box-shadow: 0 0 36px rgba(255, 200, 74, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(18px);
  display: grid;
  gap: 6px;
  text-align: center;
}
.whale-tag .wt-top {
  font: 700 11px var(--mono);
  letter-spacing: 0.12em;
  color: var(--gold);
}
.whale-tag .wt-main {
  font: 700 16px var(--display);
}
.whale-tag .wt-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
.whale-tag .wt-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #ff6836);
  transition: width 0.12s linear;
}
.whale-tag button {
  border: 1px solid rgba(255, 200, 74, 0.85);
  background: linear-gradient(135deg, rgba(255, 200, 74, 0.28), rgba(255, 92, 48, 0.28));
  color: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font: 700 12px var(--display);
  letter-spacing: 0.06em;
  cursor: pointer;
}
.whale-tag button:hover {
  background: linear-gradient(135deg, rgba(255, 200, 74, 0.45), rgba(255, 92, 48, 0.45));
}

/* Glass surfaces */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.glass-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  font: 500 13px var(--font);
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(18px);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.glass-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Top HUD bar */
.hud-top {
  position: fixed;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr minmax(280px, 460px) 1fr;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }

.brand {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 999px;
}
.mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 800 16px var(--display);
  letter-spacing: 0.14em;
  color: var(--ink);
  text-decoration: none;
}
.mark-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 11px var(--mono);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.live-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4dff9a;
  box-shadow: 0 0 10px #4dff9a;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.war-meter {
  padding: 10px 16px 12px;
  border-radius: 22px;
}
.meter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: 600 12px var(--mono);
  margin-bottom: 8px;
}
.side-long { color: var(--long); }
.side-short { color: var(--short); }
.timer-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--ink);
}
.timer-pill em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.timer-pill strong {
  font: 700 18px var(--display);
  letter-spacing: 0.04em;
}
.bar-track {
  display: flex;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}
.bar-long {
  background: linear-gradient(90deg, #0d9c67, var(--long));
  box-shadow: 0 0 14px rgba(34, 239, 160, 0.7);
  transition: width 0.35s ease;
}
.bar-short {
  background: linear-gradient(90deg, var(--short), #b81d13);
  box-shadow: 0 0 14px rgba(255, 76, 50, 0.7);
  transition: width 0.35s ease;
}

.wallet-box {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wallet-addr {
  font: 500 12px var(--mono);
  color: var(--muted);
}

/* Side glass panels */
.hud-left {
  position: fixed;
  top: 94px;
  left: 16px;
  width: 286px;
  max-height: calc(100vh - 230px);
  z-index: 10;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}
.hud-right {
  position: fixed;
  top: 94px;
  right: 16px;
  width: 286px;
  z-index: 10;
  display: grid;
  gap: 10px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.panel-head h2 {
  margin: 0;
  font: 700 11px var(--mono);
  letter-spacing: 0.12em;
  color: var(--muted);
}
.hint, .mode-pill {
  font: 500 10px var(--mono);
  color: var(--muted);
  letter-spacing: 0.08em;
}
.mode-pill {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.tape {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  overflow: hidden;
}
.tape li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.tape .t-main { font-weight: 600; white-space: nowrap; }
.tape .t-meta { font: 500 11px var(--mono); color: var(--muted); white-space: nowrap; }
.tape .long { color: var(--long); }
.tape .short { color: var(--short); }

.stats-card { padding: 12px 14px; }
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.strip p { margin: 0; }
.strip span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.strip strong { font: 700 15px var(--display); }

.board-card { padding: 12px 14px; }
#board {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
#board li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}
.badge {
  font-style: normal;
  font: 500 10px var(--mono);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--muted);
  margin-left: 4px;
}

/* Bottom command dock */
.hud-dock {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  z-index: 12;
  padding: 12px 16px;
  border-radius: 26px;
  min-width: 390px;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.dock-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font: 500 11.5px var(--mono);
  color: var(--muted);
  margin-bottom: 9px;
}
.calls {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.calls button {
  flex: 1 1 155px;
  padding: 11px 18px;
  border-radius: 999px;
  font: 700 14px var(--display);
  letter-spacing: 0.03em;
  color: var(--ink);
  cursor: pointer;
  border: 1px solid var(--line);
  transition: transform 0.14s, box-shadow 0.14s, background 0.14s;
}
.calls button:hover { transform: translateY(-1px); }
.btn-long {
  background: linear-gradient(135deg, rgba(34, 239, 160, 0.22), rgba(12, 120, 82, 0.22));
  border-color: rgba(34, 239, 160, 0.55) !important;
}
.btn-long.on, .btn-long:hover {
  background: linear-gradient(135deg, rgba(34, 239, 160, 0.44), rgba(14, 138, 92, 0.4));
  box-shadow: 0 0 26px rgba(34, 239, 160, 0.38);
}
.btn-short {
  background: linear-gradient(135deg, rgba(255, 76, 50, 0.24), rgba(160, 22, 16, 0.22));
  border-color: rgba(255, 76, 50, 0.55) !important;
}
.btn-short.on, .btn-short:hover {
  background: linear-gradient(135deg, rgba(255, 76, 50, 0.48), rgba(180, 28, 18, 0.42));
  box-shadow: 0 0 26px rgba(255, 76, 50, 0.42);
}
.btn-whale {
  background: linear-gradient(135deg, rgba(255, 200, 74, 0.34), rgba(255, 92, 48, 0.34));
  border-color: rgba(255, 200, 74, 0.85) !important;
  box-shadow: 0 0 28px rgba(255, 200, 74, 0.4);
}
#notice {
  margin: 7px 0 0;
  min-height: 1.1em;
  font-size: 12.5px;
  color: var(--ink);
}

/* Round settled banner */
#round-banner {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  pointer-events: none;
}
#round-banner[hidden] { display: none; }
.banner-card {
  padding: 22px 42px;
  text-align: center;
  border-radius: 26px;
}
.banner-kicker {
  display: block;
  font: 700 11px var(--mono);
  letter-spacing: 0.2em;
  color: var(--muted);
}
#banner-title {
  display: block;
  font: 800 42px var(--display);
  letter-spacing: 0.06em;
  margin-top: 4px;
}
#banner-sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* Share modal */
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(4, 5, 10, 0.65);
  backdrop-filter: blur(8px);
  padding: 16px;
}
.share-modal[hidden] { display: none; }
.share-sheet {
  width: min(560px, 100%);
  padding: 16px;
}
#share-card {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
}
#share-line { margin: 10px 0; font-size: 14px; }
.share-actions { display: flex; gap: 10px; }
.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

/* Subtle footer */
.hud-foot {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 10px;
  z-index: 9;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  color: rgba(232, 238, 249, 0.44);
  pointer-events: none;
}

@media (max-width: 1120px) {
  .hud-left, .hud-right {
    width: 228px;
    top: 136px;
  }
  .hud-left {
    max-height: 226px;
  }
  .tape li {
    font-size: 11.5px;
    padding: 4px 7px;
  }
  .tape .t-meta {
    font-size: 10px;
  }
  .hud-top {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .war-meter {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (max-width: 680px) {
  .hud-left, .hud-right {
    display: none;
  }
  .hud-dock {
    min-width: 0;
    width: calc(100vw - 24px);
    bottom: 42px;
  }
  .hud-foot {
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
  }
}
