/* ─────────────────────────────────────────────────────────────────────────────
   SIGNAL — Boßel-App Design System
   Aesthetic: midnight-field / coastal-tactical
   ───────────────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ── Variables ── */
:root {
  /* Surfaces */
  --bg:      #080d16;
  --surface: #0e1826;
  --raised:  #13202f;
  --border:  rgba(255,255,255,0.055);
  --border-h: rgba(255,255,255,0.11);

  /* Brand */
  --signal:     #00d4b8;
  --signal-dim: rgba(0,212,184,0.10);
  --signal-glow:rgba(0,212,184,0.22);
  --fire:       #ff3b5c;
  --fire-dim:   rgba(255,59,92,0.12);
  --amber:      #f5a623;
  --amber-dim:  rgba(245,166,35,0.12);
  --go:         #0fdf86;
  --go-dim:     rgba(15,223,134,0.10);
  --blue:       #4d9fff;

  /* Text */
  --t1: #deeaf3;
  --t2: #6d93b0;
  --t3: #344f63;

  /* Fonts — unified Plus Jakarta Sans */
  --f-display: 'Plus Jakarta Sans', sans-serif;
  --f-body:    'Plus Jakarta Sans', sans-serif;
  --f-mono:    'Plus Jakarta Sans', sans-serif;

  /* Shape */
  --r:    13px;
  --r-sm: 8px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Misc */
  --shadow:    0 2px 14px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.55);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--f-body);
  font-size: 16px;
  background: var(--bg);
  color: var(--t1);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 800;
  backdrop-filter: blur(8px);
}
header h1 {
  font-family: var(--f-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
header h1 span { color: var(--t2); }

/* ── Map ── */
#map {
  width: 100%;
  height: 52vh;
  min-height: 280px;
}

/* ── Map theme toggle button (lives in sticky header) ── */
.map-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--raised);
  border: 1px solid var(--border-h);
  border-radius: var(--r-sm);
  padding: 0 11px;
  height: 36px;
  color: var(--t1);
  font-family: var(--f-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.08s;
}
.map-theme-btn:hover  { opacity: 0.8; }
.map-theme-btn:active { transform: scale(0.94); }

/* ── Section ── */
section {
  padding: 14px 14px 32px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 10px;
}
.card h3 {
  font-family: var(--f-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--t2);
  margin-bottom: 10px;
}
.section-label {
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
  margin: 16px 0 6px;
}

/* ── Buttons ── */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  height: 44px;
  border: none;
  border-radius: var(--r-lg);
  font-family: var(--f-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s, transform 0.1s, box-shadow 0.15s;
  background: var(--raised);
  color: var(--t1);
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid var(--border-h);
}
button:hover, .btn:hover   { opacity: 0.85; }
button:active, .btn:active { transform: scale(0.96); }
button:disabled            { opacity: 0.38; cursor: not-allowed; transform: none; }

/* Variants */
.btn-signal  { background: var(--signal);    color: #05111e; border-color: var(--signal);  box-shadow: 0 0 16px var(--signal-glow); }
.btn-fire    { background: var(--fire);      color: #fff;    border-color: var(--fire); }
.btn-amber   { background: var(--amber-dim); color: var(--amber); border-color: rgba(245,166,35,0.3); }
.btn-go      { background: var(--go);        color: #05111e; border-color: var(--go); }
.btn-danger  { background: var(--fire-dim);  color: var(--fire); border-color: rgba(255,59,92,0.3); }
.btn-warning { background: var(--amber-dim); color: var(--amber); border-color: rgba(245,166,35,0.3); }
.btn-sm      { height: 36px; padding: 0 13px; font-size: 0.8rem; border-radius: var(--r); }
.btn-xs      { height: 30px; padding: 0 10px; font-size: 0.75rem; border-radius: var(--r-sm); }
.w-full      { width: 100%; }

/* ── Throw button (hero element) ── */
.throw-btn {
  width: 100%;
  height: 64px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--r);
  border-left-width: 5px !important;
  border-left-style: solid !important;
  background: var(--raised);
  justify-content: flex-start;
  padding: 0 20px;
  gap: 12px;
  margin-bottom: 8px;
  transition: opacity 0.12s, transform 0.1s, box-shadow 0.15s;
  border: 1px solid var(--border);
}
.throw-btn:active { transform: scale(0.98); }
.throw-btn .throw-btn-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.throw-btn .throw-btn-player {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--f-display);
}
.throw-btn .throw-btn-hint {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--t2);
}

/* ── Score cards (spectator) ── */
.team-score {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 10px;
  overflow: hidden;
  min-height: 92px;
}
.team-score-stripe {
  width: 5px;
  flex-shrink: 0;
  background: var(--tc, var(--signal));
}
.team-score-main {
  flex: 1;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}
/* Team label: klein, gedimmt, darüber */
.team-score-name {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
/* Spielername: das Wichtigste – groß, bold */
.team-score-player {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--t1);
}
.team-score-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 20px 0 10px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  gap: 1px;
}
.team-score-num {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--t1);
}
.team-score-unit {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
}
.team-finished-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--go-dim);
  color: var(--go);
  border: 1px solid rgba(15,223,134,0.25);
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: center;
  line-height: 1.3;
}

/* ── Live view team card ── */
.live-team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 10px;
}
.live-team-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.live-team-name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1rem;
  flex: 1;
}
.live-throw-count {
  font-family: var(--f-mono);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.live-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.live-actions button { flex: 1; }

/* ── Forms ── */
input[type="text"],
input[type="password"],
input[type="number"],
select {
  display: block;
  width: 100%;
  padding: 0 13px;
  height: 44px;
  border: 1px solid var(--border-h);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--t1);
  font-family: var(--f-body);
  font-size: 0.9rem;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 3px;
  border: 1px solid var(--border-h);
  border-radius: var(--r);
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: 0 0 0 2px var(--signal-dim);
}
input::placeholder { color: var(--t3); }

/* ── Inline input row ── */
.input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.input-row input[type="text"],
.input-row input[type="password"] { flex: 1; }

/* ── Modal / PIN screen ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,10,18,0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(6px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border-h);
  border-radius: var(--r-lg);
  padding: 32px 28px;
  width: min(360px, 92vw);
  box-shadow: var(--shadow-lg);
}
.modal h2 {
  font-family: var(--f-display);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 22px;
}
.modal label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--t2);
  margin-bottom: 6px;
}
.modal input { margin-bottom: 8px; }
.modal .btn { height: 48px; font-size: 0.95rem; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--signal-dim);
  color: var(--signal);
  border: 1px solid rgba(0,212,184,0.2);
}
.badge-planning  { background: rgba(100,120,140,0.15); color: var(--t2);    border-color: var(--border-h); }
.badge-active    { background: var(--go-dim);           color: var(--go);    border-color: rgba(15,223,134,0.25); }
.badge-finished  { background: rgba(77,159,255,0.1);    color: var(--blue);  border-color: rgba(77,159,255,0.25); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 3px;
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  height: 36px;
  border-radius: calc(var(--r) - 3px);
  font-family: var(--f-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--t2);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab.active {
  background: var(--surface);
  color: var(--t1);
  border: 1px solid var(--border-h);
}
.tab.tab-locked { opacity: 0.4; cursor: not-allowed; }

/* ── Connection dot ── */
#connection-status {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fire);
  flex-shrink: 0;
  transition: background 0.4s;
}
#connection-status.online { background: var(--go); box-shadow: 0 0 6px var(--go); }

/* ── Toast notifications ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--raised);
  color: var(--t1);
  border: 1px solid var(--border-h);
  padding: 11px 20px;
  border-radius: var(--r);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 9998;
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}
.toast.toast-show { transform: translateX(-50%) translateY(0); }

/* ── Route section ── */
.route-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.route-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--t3);
  flex-shrink: 0;
}
.route-status-dot.has-route { background: var(--go); box-shadow: 0 0 6px var(--go); }
.route-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Own-position GPS marker ── */
.own-pos-icon { background: transparent !important; border: none !important; overflow: visible; }
.own-pos-dot {
  width: 14px; height: 14px;
  background: var(--blue);
  border: 2.5px solid #fff;
  border-radius: 50%;
  position: absolute;
  top: 5px; left: 5px;
  box-shadow: 0 0 8px rgba(77,159,255,0.7);
}
.own-pos-ring {
  width: 24px; height: 24px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  position: absolute;
  top: 0; left: 0;
  animation: pos-pulse 1.8s ease-out infinite;
}
@keyframes pos-pulse {
  0%   { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ── Utilities ── */
.hidden      { display: none !important; }
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.gap-8       { gap: 8px; }
.gap-6       { gap: 6px; }
.mt-8        { margin-top: 8px; }
.mt-12       { margin-top: 12px; }
.mt-16       { margin-top: 16px; }
.mb-10       { margin-bottom: 10px; }
.mb-12       { margin-bottom: 12px; }
.text-muted  { color: var(--t2); }
.text-dim    { color: var(--t3); }
.text-center { text-align: center; }
.text-sm     { font-size: 0.82rem; }
.text-xs     { font-size: 0.72rem; }
.hint-text   { font-size: 0.78rem; color: var(--t3); margin-top: 8px; line-height: 1.5; }
.mono        { font-family: var(--f-mono); }

/* Player name tag */
.player-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 9px;
  border-radius: 100px;
  font-size: 0.77rem;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 4px;
  color: #05111e;
}
.player-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0,0,0,0.22);
  color: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity 0.1s, background 0.1s;
}
.player-tag-remove:hover  { opacity: 1; background: rgba(0,0,0,0.38); }
.player-tag-remove:active { transform: scale(0.88); }

/* ── Archived tour card ── */
.tour-card-archived { opacity: 0.55; }
.tour-card-archived .tour-card-name { color: var(--t3); }
.tour-card-archived .tour-card-info { cursor: default; pointer-events: none; }
.tour-card-archived .tour-card-actions { pointer-events: auto; }

/* ── Map hidden (screen-list) ── */
.map-hidden {
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden;
}

/* ── Tour list card ── */
.tour-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.tour-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 10px;
}
.tour-card-info:hover .tour-card-name { color: var(--signal); }
.tour-card-name {
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}
.tour-card-actions {
  display: flex;
  gap: 8px;
}

/* ── Throw card (live screen) ── */
.throw-card {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 4px;
  overflow: hidden;
  min-height: 100px;
  transition: transform 0.08s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
}
.throw-card:not(.throw-card-done):active { transform: scale(0.972); }
.throw-card-done { opacity: 0.55; cursor: default; }

/* Overlay for tap/recording animations */
.throw-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tc, transparent);
  opacity: 0;
  pointer-events: none;
  border-radius: inherit;
}
.throw-card:not(.throw-card-done):active::after { opacity: 0.09; }
.throw-card.is-recording::after {
  animation: card-breathe 0.65s ease-in-out infinite alternate;
}
.throw-card.tap-flash::after {
  animation: card-flash 0.5s ease-out forwards;
}

.throw-stripe {
  width: 6px;
  flex-shrink: 0;
  background: var(--tc, #3388ff);
}

.throw-body {
  flex: 1;
  padding: 14px 16px;
}

.throw-team-label {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 4px;
}
.throw-player-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.throw-hint {
  font-size: 0.7rem;
  color: var(--t3);
  letter-spacing: 0.02em;
}

.throw-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 22px 0 10px;
  gap: 1px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
}
.throw-count-num {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--t1);
}
.throw-count-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
}

.throw-secondary {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.throw-secondary .btn { flex: 1; }

@keyframes card-breathe {
  from { opacity: 0.05; }
  to   { opacity: 0.15; }
}
@keyframes card-flash {
  0%   { opacity: 0.28; }
  60%  { opacity: 0.10; }
  100% { opacity: 0; }
}
