:root {
  --teal: #00aec7;
  --orange: #f89406;
  --navy: #011627;
  --sand: #e8c98a;
  --sand-deep: #c4a05a;
  --ink: #1a2430;
  --glass: rgba(255, 255, 255, 0.88);
  font-family: "Outfit", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--navy); color: var(--ink); }
canvas#c { display: block; width: 100%; height: 100%; touch-action: none; }

.splash {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem;
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(0, 174, 199, 0.35), transparent 55%),
    radial-gradient(100% 70% at 90% 100%, rgba(248, 148, 6, 0.4), transparent 50%),
    linear-gradient(165deg, #043047 0%, #011627 55%, #1a1208 100%);
}

/* Author display:flex beats the UA [hidden] rule — without this, login never leaves. */
.splash[hidden],
.hud[hidden],
.gov-box[hidden],
.feat-box[hidden],
.impulse-box[hidden],
.bubble[hidden],
.login-card [hidden],
.error[hidden],
.admin-link[hidden] {
  display: none !important;
}

.splash-logo {
  width: min(420px, 88vw);
  height: auto;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.35));
  animation: floatIn 0.9s ease-out both;
}

.tagline {
  margin: 0 0 1rem;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.04em;
  font-weight: 400;
  animation: floatIn 1s 0.1s ease-out both;
}

.login-card {
  width: min(360px, 92vw);
  padding: 1.1rem 1.2rem 1.25rem;
  border-radius: 18px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  display: grid;
  gap: 0.75rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  animation: floatIn 1.05s 0.15s ease-out both;
}

.login-card label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
}

.login-card select,
.login-card input {
  font: inherit;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1.5px solid rgba(1, 22, 39, 0.15);
  background: #fff;
}

#enterBtn {
  margin-top: 0.25rem;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--teal), #0891a8 45%, var(--orange));
}

#enterBtn:active { transform: scale(0.98); }
.error { color: #b42318; margin: 0; font-size: 0.85rem; }

.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud > * { pointer-events: auto; }

.topbar {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.hud-icon { width: 36px; height: 36px; border-radius: 9px; }
.muted { color: #5b6b7c; font-weight: 400; font-size: 0.9rem; }

#claimBtn {
  margin-left: auto;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--orange);
  cursor: pointer;
}

.bubble {
  position: absolute;
  left: 50%;
  bottom: 7.5rem;
  transform: translateX(-50%);
  width: min(520px, 92vw);
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(1, 22, 39, 0.88);
  color: #f4fbff;
  line-height: 1.35;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 174, 199, 0.45);
}

.dock {
  position: absolute;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.mic {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--teal), var(--orange));
}

.mic.listening {
  animation: pulse 1.2s ease-in-out infinite;
}

.mic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
}

#voiceSelect, #stopTalkBtn {
  font: inherit;
  border-radius: 999px;
  border: 1px solid rgba(1, 22, 39, 0.12);
  padding: 0.55rem 0.7rem;
  background: #fff;
  max-width: 140px;
}

#stopTalkBtn { cursor: pointer; }

.login-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}
.login-tabs .tab {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem;
  font: inherit;
  font-weight: 600;
  background: rgba(1, 22, 39, 0.08);
  color: var(--navy);
  cursor: pointer;
}
.login-tabs .tab.active {
  background: linear-gradient(135deg, var(--teal), var(--orange));
  color: #fff;
}

.admin-link {
  margin-left: auto;
  margin-right: 0.4rem;
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.85rem;
}

.stats-panel {
  position: absolute;
  top: calc(max(0.75rem, env(safe-area-inset-top)) + 4.2rem);
  right: 0.75rem;
  width: min(260px, 42vw);
  max-height: calc(100vh - 11rem);
  overflow: auto;
  padding: 0.85rem 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}
.stats-panel h2, .stats-panel h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--navy);
}
.stats-panel h3 { margin-top: 0.75rem; font-size: 0.85rem; color: var(--teal); }
.stats-panel dl {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}
.stats-panel dl > div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
}
.stats-panel dt { color: #5b6b7c; }
.stats-panel dd { margin: 0; font-weight: 700; }
.ref-line { font-size: 0.72rem; color: #5b6b7c; margin: 0.6rem 0; word-break: break-all; }
.ref-line code { color: var(--navy); font-weight: 700; }
.mini {
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--teal);
  color: #fff;
}
.mini.yes { background: #1a7f4b; }
.mini.no { background: #b42318; }
.idea-box, .gov-box, .feat-box, .impulse-box {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(1, 22, 39, 0.08);
}
.idea-box label { font-size: 0.75rem; font-weight: 700; display: block; margin-bottom: 0.25rem; }
.idea-box textarea {
  width: 100%;
  font: inherit;
  font-size: 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(1, 22, 39, 0.15);
  padding: 0.4rem;
  resize: vertical;
}
.gov-box p, .feat-box p, .impulse-box p { margin: 0 0 0.4rem; font-size: 0.75rem; line-height: 1.35; color: #334; }
.impulse-box h3, .feat-box h3, .gov-box h3 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: #011627;
}
.impulse-theme { font-weight: 600; color: #00AEC7 !important; }
.impulse-box ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #334;
}
.impulse-box li { margin-bottom: 0.25rem; }
.gov-actions { display: flex; gap: 0.35rem; }

.status {
  position: absolute;
  left: 50%;
  bottom: 5.2rem;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #fff;
  background: rgba(1, 22, 39, 0.45);
  pointer-events: none;
  max-width: 92vw;
  text-align: center;
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 174, 199, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(248, 148, 6, 0); }
}

@media (max-width: 720px) {
  .stats-panel {
    width: min(200px, 46vw);
    font-size: 0.9rem;
    top: auto;
    bottom: 7.5rem;
    max-height: 38vh;
  }
  #voiceSelect { max-width: 96px; font-size: 0.75rem; }
}

@media (max-width: 520px) {
  .stats-panel { display: none; } /* keep mobile uncluttered; topbar still shows JASMA/land */
  #voiceSelect { max-width: 96px; font-size: 0.75rem; }
}
