/* ── Base ────────────────────────────────────────────────────────────── */

:root {
  --primary: #3fd2ff;
  --accent: #a7f0ff;
  --bg: #05080f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: #eaf4ff;
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

/* ── AR/3D container ─────────────────────────────────────────────────── */

#arContainer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body.mode-3d {
  background:
    radial-gradient(120% 90% at 50% 105%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 60%),
    radial-gradient(100% 70% at 50% -10%, #101a2e, transparent 70%),
    var(--bg);
}

body[data-theme="gold"] { --bg: #0d0805; }
body[data-theme="neon"] { --bg: #0a0512; }
body[data-theme="adx"]  { --bg: #010138; } /* derived from ALDI dark blue #00005F */
body[data-theme="adx"] #heroTitle { font-family: 'Manrope', 'Segoe UI', sans-serif; font-weight: 800; }

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 50%, transparent 62%, rgba(0, 0, 0, 0.42));
  z-index: 3;
}

/* ── start screen ────────────────────────────────────────────────────── */

#startScreen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(90% 60% at 50% 110%, color-mix(in srgb, var(--primary) 25%, transparent), transparent 65%),
    radial-gradient(70% 45% at 50% -8%, #111d33, transparent 70%),
    var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s;
}

#startScreen.hidden { opacity: 0; visibility: hidden; }

.hero-ring {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--primary) 65%, transparent);
  display: grid;
  place-items: center;
  position: relative;
  margin-bottom: 10px;
  box-shadow:
    0 0 34px color-mix(in srgb, var(--primary) 38%, transparent),
    inset 0 0 26px color-mix(in srgb, var(--primary) 25%, transparent);
  animation: pulse 2.6s ease-in-out infinite;
}

.hero-ring::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--primary) 45%, transparent);
  animation: spin 14s linear infinite;
}

.hero-ring span { font-size: 46px; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes spin { to { transform: rotate(360deg); } }

#heroTitle {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: clamp(26px, 6.5vw, 44px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #f2fbff;
  text-shadow: 0 0 26px color-mix(in srgb, var(--primary) 70%, transparent);
}

#heroSubtitle {
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 500;
  color: color-mix(in srgb, var(--accent) 80%, #ffffff 10%);
  opacity: 0.9;
}

.hero-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
  width: min(320px, 82vw);
}

.btn {
  border-radius: 14px;
  padding: 15px 22px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  border: 1px solid color-mix(in srgb, var(--primary) 80%, white 10%);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--primary) 34%, transparent),
    color-mix(in srgb, var(--primary) 16%, transparent));
  color: #ffffff;
  box-shadow: 0 0 28px color-mix(in srgb, var(--primary) 35%, transparent);
}

.btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(235, 245, 255, 0.9);
}

.hero-hint {
  margin-top: 18px;
  font-size: 14px;
  color: rgba(210, 228, 244, 0.55);
  max-width: 300px;
  line-height: 1.45;
}

.hero-logo {
  margin-top: 26px;
  height: 34px;
  opacity: 0.92;
}

/* ── HUD ─────────────────────────────────────────────────────────────── */

#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}

#hud.show { opacity: 1; }

.hud-top {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.chip {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 14, 24, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #eaf4ff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.chip.active {
  border-color: color-mix(in srgb, var(--primary) 75%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--primary) 35%, transparent);
  color: var(--accent);
}

.hud-bottom {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#themePills {
  pointer-events: auto;
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 14, 24, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.theme-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(232, 244, 255, 0.75);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
}

.theme-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}

.theme-pill.active {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

#closeFocus {
  pointer-events: auto;
  position: absolute;
  top: calc(64px + env(safe-area-inset-top));
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(8, 14, 24, 0.6);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 19px;
  display: none;
  place-items: center;
}

#closeFocus.show { display: grid; }

/* card navigation arrows in focus/tour mode */
.nav-arrow {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 64px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 14, 24, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  display: none;
  place-items: center;
  padding-bottom: 4px;
}

.nav-arrow.show { display: grid; }
#prevCard { left: 10px; }
#nextCard { right: 10px; }

/* ── scan overlay ────────────────────────────────────────────────────── */

#scanOverlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: none;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
}

#scanOverlay.show { display: flex; }

.scan-frame {
  width: min(58vw, 260px);
  aspect-ratio: 1;
  position: relative;
  animation: scanPulse 2s ease-in-out infinite;
}

.scan-frame i {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 3px solid var(--primary);
  filter: drop-shadow(0 0 8px var(--primary));
}

.scan-frame i:nth-child(1) { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 10px 0 0 0; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 10px 0 0; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 10px; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 10px 0; }

@keyframes scanPulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.05); opacity: 0.6; }
}

.scan-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #ffffff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
  background: rgba(8, 14, 24, 0.5);
  border-radius: 999px;
  padding: 8px 18px;
  backdrop-filter: blur(6px);
}

/* ── toast ───────────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 40;
  background: rgba(10, 16, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  max-width: 86vw;
  text-align: center;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }
