/* ==========================================================================
   STADTSPIEL - COMMON DESIGN SYSTEM (CYBERPUNK / APPLE GLASSMORPHISM)
   Conforming to Systemprompt_optik_features.md
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Backgrounds */
  --bg-core: #07070a;
  --bg-surface: rgba(18, 16, 26, 0.76);
  --bg-surface-elevated: rgba(28, 24, 42, 0.88);
  --bg-surface-hover: rgba(40, 34, 60, 0.94);
  
  /* Borders & Glassmorphism */
  --border: rgba(255, 255, 255, 0.10);
  --border-bright: rgba(255, 255, 255, 0.22);
  --glass-blur: blur(24px) saturate(170%);

  /* Neon Accents */
  --neon-purple: #a855f7;
  --neon-pink: #ec4899;
  --neon-cyan: #00e5ff;
  --neon-gold: #f59e0b;
  --neon-green: #10b981;
  --neon-red: #ef4444;
  --neon-glow: rgba(236, 72, 153, 0.35);

  /* Texts */
  --text-primary: #ffffff;
  --text-secondary: rgba(240, 240, 255, 0.74);
  --text-muted: rgba(240, 240, 255, 0.45);

  /* Shadows & Radii */
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 12px 32px rgba(236, 72, 153, 0.25);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-core: #f5f6fa;
    --bg-surface: rgba(255, 255, 255, 0.80);
    --bg-surface-elevated: rgba(255, 255, 255, 0.92);
    --bg-surface-hover: rgba(255, 255, 255, 0.98);

    --border: rgba(0, 0, 0, 0.08);
    --border-bright: rgba(0, 0, 0, 0.16);
    --glass-blur: blur(24px) saturate(150%);

    --neon-purple: #8b5cf6;
    --neon-pink: #db2777;
    --neon-cyan: #0284c7;
    --neon-gold: #d97706;
    --neon-green: #059669;
    --neon-red: #dc2626;
    --neon-glow: rgba(219, 39, 119, 0.2);

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 12px 32px rgba(219, 39, 119, 0.18);
  }
}

/* Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-core);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  padding: env(safe-area-inset-top, 16px) 16px env(safe-area-inset-bottom, 24px) 16px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Background Glowing Blobs & Dot Grid
   -------------------------------------------------------------------------- */
.glow-bg {
  position: fixed;
  inset: 0;
  background-color: var(--bg-core);
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  mix-blend-mode: screen;
  filter: blur(100px);
  opacity: 0.25;
  pointer-events: none;
}

@media (prefers-color-scheme: light) {
  .blob {
    mix-blend-mode: multiply;
    opacity: 0.14;
  }
}

.blob-purple {
  background-color: var(--neon-purple);
  top: -10%;
  left: -5%;
  animation: move-purple 16s infinite alternate ease-in-out;
}

.blob-pink {
  background-color: var(--neon-pink);
  bottom: -10%;
  right: -5%;
  animation: move-pink 14s infinite alternate ease-in-out;
}

.blob-cyan {
  background-color: var(--neon-cyan);
  top: 40%;
  left: 20%;
  animation: move-cyan 18s infinite alternate ease-in-out;
}

.dot-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(217, 191, 255, 0.15) 0.7px, transparent 0.7px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 90%);
}

@media (prefers-color-scheme: light) {
  .dot-grid {
    background-image: radial-gradient(rgba(100, 116, 139, 0.18) 0.7px, transparent 0.7px);
  }
}

@keyframes move-purple {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(80px, 60px, 0) scale(1.15); }
  100% { transform: translate3d(-40px, 100px, 0) scale(0.92); }
}

@keyframes move-pink {
  0% { transform: translate3d(0, 0, 0) scale(0.95); }
  50% { transform: translate3d(-90px, -60px, 0) scale(1.18); }
  100% { transform: translate3d(60px, 40px, 0) scale(1.05); }
}

@keyframes move-cyan {
  0% { transform: translate3d(0, 0, 0) scale(1.05); }
  50% { transform: translate3d(-60px, 70px, 0) scale(0.9); }
  100% { transform: translate3d(70px, -60px, 0) scale(1.12); }
}

/* --------------------------------------------------------------------------
   Dynamic Island (Notification Capsule)
   -------------------------------------------------------------------------- */
.dynamic-island-container {
  position: fixed;
  top: max(env(safe-area-inset-top, 12px), 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
}

.dynamic-island {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: rgba(14, 12, 22, 0.95);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--neon-glow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  opacity: 0;
  transform: translateY(-20px) scale(0.9);
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
}

.dynamic-island.expanded {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.island-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.island-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--neon-cyan);
}

/* --------------------------------------------------------------------------
   App Header (Schlank, rein visuelles Branding, kein Link zu ayen.work)
   -------------------------------------------------------------------------- */
.app-header {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 6px 16px 6px;
  margin-bottom: 8px;
}

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

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.app-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-bright);
}

.app-title-group {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #fff 40%, var(--neon-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--neon-cyan);
}

/* --------------------------------------------------------------------------
   Main Container & Cards
   -------------------------------------------------------------------------- */
.app-main {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-pink), var(--neon-purple), transparent);
  opacity: 0.8;
}

.station-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--neon-purple);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.riddle-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.25;
  margin-bottom: 12px;
}

.riddle-story {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 16px;
  user-select: text;
  -webkit-user-select: text;
}

.riddle-highlight-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-style: italic;
  line-height: 1.45;
  user-select: text;
  -webkit-user-select: text;
}

/* --------------------------------------------------------------------------
   Buttons (No Emojis - Inline SVG Only)
   -------------------------------------------------------------------------- */
.btn-primary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  padding: 16px 24px;
  font-family: var(--font-family);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--neon-glow);
  transition: var(--transition-smooth);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-pill);
  padding: 13px 20px;
  font-family: var(--font-family);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-svg-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  stroke-width: 2.2;
}

/* --------------------------------------------------------------------------
   Success Reveal Card (Visible after puzzle is solved)
   -------------------------------------------------------------------------- */
.success-reveal-card {
  display: none;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.12), rgba(18, 16, 26, 0.88));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);
  animation: revealPulse 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.success-reveal-card.visible {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@keyframes revealPulse {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--neon-green);
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--neon-green);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.location-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.location-text {
  font-size: 0.96rem;
  color: var(--text-secondary);
  line-height: 1.55;
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--neon-green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 14px;
  user-select: text;
  -webkit-user-select: text;
}

/* --------------------------------------------------------------------------
   iOS-Style Bottom Sheet Modal
   -------------------------------------------------------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-bright);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
  z-index: 2001;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 12px 20px max(env(safe-area-inset-bottom, 24px), 24px) 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 90vh;
  overflow-y: auto;
}

.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-grabber {
  width: 44px;
  height: 5px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  align-self: center;
  margin-bottom: 4px;
  cursor: pointer;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.sheet-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sheet-close-btn:active {
  transform: scale(0.9);
}

/* Shake Animation for Wrong Code */
@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-9px); }
  40%, 80% { transform: translateX(9px); }
}

.shake {
  animation: shakeWrong 0.4s ease-in-out;
}

/* --------------------------------------------------------------------------
   Footer (minimal)
   -------------------------------------------------------------------------- */
.app-footer {
  margin-top: auto;
  padding: 20px 0 6px 0;
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-muted);
}
