:root {
  --bg: #070d19;
  --surface: rgba(15, 25, 45, 0.86);
  --surface-solid: #0f192d;
  --surface-alt: rgba(24, 38, 66, 0.72);
  --border: rgba(148, 163, 184, 0.18);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
  --gold: #facc15;
  --green: #22c55e;
  --blue-run: #2563eb;
  --red-run: #ef4444;
  --black-run: #111827;
  --danger: #f43f5e;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #0f1e3a 0%, #070d19 65%);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 12px 92px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand small {
  color: var(--muted);
  font-size: 0.75rem;
  display: block;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #bae6fd;
  cursor: pointer;
}

.pill.warn {
  background: rgba(250, 204, 21, 0.14);
  border-color: rgba(250, 204, 21, 0.35);
  color: #fef08a;
}

.pill.danger {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.45);
  color: #fecdd3;
}

.pill.green {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.card-title {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 820px) {
  .grid-2 {
    grid-template-columns: 1.25fr 1fr;
  }
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.map-box {
  width: 100%;
  height: 410px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  background: #0b162a;
}

.map-overlay-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  background: rgba(8, 15, 29, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #e0f2fe;
}

label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(9, 16, 30, 0.85);
  color: var(--text);
  font-size: 0.86rem;
  font-family: inherit;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

input[type="range"] {
  padding: 0;
  background: transparent;
  border: none;
  accent-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 11px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.btn:hover { opacity: 0.94; }
.btn:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text);
}

.btn-danger {
  background: linear-gradient(135deg, #e11d48, #be123c);
  border-color: rgba(244, 63, 94, 0.5);
}

.btn-gold {
  background: linear-gradient(135deg, #ca8a04, #a16207);
  border-color: rgba(250, 204, 21, 0.5);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.76rem;
  border-radius: 8px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.stat-box {
  background: rgba(9, 17, 32, 0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.stat-box .val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.stat-box .lbl {
  font-size: 0.72rem;
  color: var(--muted);
}

.diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.diff-easy { background: var(--blue-run); }
.diff-medium { background: var(--red-run); }
.diff-hard { background: #1e293b; border: 1px solid #64748b; }
.diff-expert { background: #09090b; border: 1px solid #facc15; color: #fde047; }

.list-item {
  background: rgba(9, 17, 32, 0.65);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.horizon-wrap {
  position: relative;
  width: 100%;
  height: 360px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #081224;
}

.horizon-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.horizon-wrap canvas {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  background: rgba(8, 14, 28, 0.94);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.nav-btn.active {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.14);
}

.nav-btn span.ico {
  font-size: 1.15rem;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.g-meter-bar {
  height: 12px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 8px 0;
}

.g-meter-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, #22c55e, #facc15, #ef4444);
  transition: width 0.14s ease;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 8, 18, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open { display: flex; }

.modal-box {
  width: 100%;
  max-width: 480px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  max-height: 90vh;
  overflow-y: auto;
}

.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 120;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #f8fafc;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  display: none;
}

.toast.show { display: block; }

.qr-box {
  background: #fff;
  color: #0f172a;
  padding: 14px;
  border-radius: 12px;
  text-align: center;
}

/* Innskráningargátt (2FA Netfang + Lykilorð + Tölvupóstskóði) */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at top, #0f2547 0%, #050a14 75%);
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: rgba(15, 25, 45, 0.94);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  background: rgba(8, 15, 30, 0.7);
  padding: 4px;
  border-radius: 12px;
}

.auth-tab-btn {
  padding: 8px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}

.auth-tab-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
}

.otp-input {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.45em;
  padding: 12px;
}
