/* ==========================================================================
   Design tokens
   Palette: night search — deep navy ground, ice-cyan cold, ember-orange hot.
   The thermoscope (concentric pulsing rings) is the signature element:
   its color and pulse speed are the entire interface for "searching".
   ========================================================================== */
:root {
  --bg: #0B0E1A;
  --bg-elevated: #12172B;
  --ice: #3FD0E0;
  --ember: #FF5A36;
  --neutral-signal: #6B7690;
  --text: #EAF0FA;
  --muted: #8891AC;
  --border: #232A44;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;

  --signal-color: var(--neutral-signal);
  --pulse-duration: 2.4s;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  height: 100%;
  overflow-x: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px 48px;
  position: relative;
}

.screen { display: none; }
.screen[data-active="true"] { display: flex; flex-direction: column; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--text);
}

.subtitle {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 32px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease;
}

.field input:focus { border-color: var(--ice); }
.field input::placeholder { color: #4A5372; }

.btn {
  width: 100%;
  padding: 15px 20px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--ice), #2AA8B8);
  color: #06121A;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  margin-top: 8px;
}

.divider {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider span { padding: 0 12px; }

.error-text {
  color: var(--ember);
  font-size: 13px;
  min-height: 18px;
  margin-top: 12px;
}

/* -------------------- Waiting screen -------------------- */
#screen-waiting {
  align-items: center;
  text-align: center;
}
.join-code {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--ice);
  margin: 12px 0 20px;
}
.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ice);
  margin-top: 24px;
  animation: dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

/* -------------------- Searching screen: the Thermoscope -------------------- */
#screen-searching {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 70vh;
}

.thermoscope {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--signal-color);
  transition: border-color 0.6s ease;
}

.ring-outer {
  width: 260px;
  height: 260px;
  opacity: 0.25;
  animation: ring-pulse var(--pulse-duration) ease-in-out infinite;
}
.ring-mid {
  width: 190px;
  height: 190px;
  opacity: 0.45;
  animation: ring-pulse var(--pulse-duration) ease-in-out infinite;
  animation-delay: 0.15s;
}
.ring-inner {
  width: 120px;
  height: 120px;
  opacity: 0.75;
  background: radial-gradient(circle, color-mix(in srgb, var(--signal-color) 25%, transparent), transparent 70%);
  animation: ring-pulse var(--pulse-duration) ease-in-out infinite;
  animation-delay: 0.3s;
}

@keyframes ring-pulse {
  0%   { transform: scale(0.85); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(0.85); }
}

.signal-word {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--signal-color);
  transition: color 0.6s ease;
  padding: 0 20px;
}

.distance-hint {
  color: var(--muted);
  font-size: 14px;
  max-width: 280px;
}

/* -------------------- Found screen -------------------- */
#screen-found {
  align-items: center;
  text-align: center;
}
.dinner-list {
  width: 100%;
  margin: 8px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dinner-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
  font-size: 14px;
}
.dinner-item .dinner-name {
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}
.dinner-item .dinner-meta {
  color: var(--muted);
  font-size: 13px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ring, .pulse-dot { animation: none; }
}
