/* Tikrace — minimalistisch, energiek realtime tik-wedstrijdje. */

:root {
  --bg: #0c1118;
  --bg-elev: #151c27;
  --bg-elev-2: #1d2735;
  --line: #283446;
  --text: #eef3fa;
  --text-dim: #93a2b8;
  --accent: #25e08a;
  --accent-strong: #18c074;
  --accent-press: #0fa862;
  --accent-ink: #04130b;
  --gold: #ffd24a;
  --danger: #ff6b6b;

  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
    sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: radial-gradient(120% 100% at 50% 0%, #131c2a 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overflow: hidden; /* de pagina scrollt niet; alleen het scorebord scrollt intern */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  height: 100%;
}

/* ── loading overlay (alleen zichtbaar tijdens SW-herlaad) ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  color: var(--text-dim);
}

.loading-overlay--hidden {
  display: none;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.screen {
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: clamp(10px, 2.5vh, 20px);
  padding: calc(var(--safe-top) + 14px) calc(var(--safe-right) + 16px)
    calc(var(--safe-bottom) + 16px) calc(var(--safe-left) + 16px);
}

/* ── topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  margin: 0;
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--accent) 0%, #6df0c8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text-dim);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status--online {
  color: var(--accent);
  border-color: rgba(37, 224, 138, 0.4);
}
.status--connecting {
  color: var(--gold);
  border-color: rgba(255, 210, 74, 0.4);
}
.status--offline {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.4);
}

/* ── name row ── */
.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.name-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
  flex: none;
}

.name-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px; /* voorkomt iOS-zoom bij focus */
  font-weight: 700;
  padding: 6px 4px;
  text-align: right;
}

.name-input:focus {
  outline: none;
}
.name-input::placeholder {
  color: var(--text-dim);
  font-weight: 500;
}
