:root {
  --bg-color: #050508;
  --surface-color: #12121a;
  --surface-highlight: #1c1c26;
  --primary-color: #A546E8;
  --primary-glow: rgba(165, 70, 232, 0.4);
  --accent-color: #00f0ff;
  --accent-glow: rgba(0, 240, 255, 0.3);
  --text-primary: #ffffff;
  --text-secondary: #8888a0;
  --success-color: #00ff9d;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Phone Frame Variables - Increased for breathing room */
  --phone-width: 420px;
  --phone-height: 880px;
  --phone-border: 12px;
  --phone-radius: 46px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: #000;
  background-image: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #000 100%);
  color: var(--text-primary);
  font-family: var(--font-family);
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Mobile Device Frame */
.phone-frame {
  width: var(--phone-width);
  height: var(--phone-height);
  border: var(--phone-border) solid #333;
  border-radius: var(--phone-radius);
  position: relative;
  box-shadow: 0 0 0 2px #555, 0 20px 50px rgba(0,0,0,0.8);
  background: var(--bg-color);
  overflow: hidden;
  transform-origin: center center;
}

/* Responsive scaling */
@media (max-height: 900px) {
  .phone-frame { transform: scale(0.85); }
}
@media (max-height: 750px) {
  .phone-frame { transform: scale(0.7); }
}

.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 30px;
  background: #000;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  z-index: 100;
}

.phone-power {
  position: absolute;
  top: 100px;
  right: -16px;
  width: 4px;
  height: 40px;
  background: #333;
  border-top-right-radius: 2px;
  border-bottom-right-radius: 2px;
}

.phone-volume {
  position: absolute;
  top: 100px;
  left: -16px;
  width: 4px;
  height: 60px;
  background: #333;
  border-top-left-radius: 2px;
  border-bottom-left-radius: 2px;
}

/* Utilities */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.5s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* App Container */
#app {
  width: 100%;
  height: 100%;
  position: relative;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: calc(var(--phone-radius) - var(--phone-border));
}

/* Typography */
h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
p { color: var(--text-secondary); line-height: 1.5; margin-bottom: 1rem; }

/* Buttons */
.btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  width: 100%;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 20px var(--primary-glow);
}
.btn:active { transform: scale(0.98); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--surface-highlight);
  color: var(--text-secondary);
  box-shadow: none;
}

/* Views */
.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  z-index: 10;
  transition: opacity 0.3s ease;
  padding-top: 50px; /* Space for notch */
}

/* Splash Screen */
#view-splash {
  justify-content: center;
  align-items: center;
  text-align: center;
  background: radial-gradient(circle at center, #1a0a1a 0%, var(--bg-color) 70%);
}

.brand-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), #aa0055);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 24px;
  box-shadow: 0 0 40px var(--primary-glow);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 40px var(--primary-glow); } 50% { box-shadow: 0 0 60px var(--primary-glow); transform: scale(1.05); } 100% { box-shadow: 0 0 40px var(--primary-glow); } }

/* Location Interstitial */
#view-location {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.radar-scan {
  width: 200px;
  height: 200px;
  border: 2px solid var(--surface-highlight);
  border-radius: 50%;
  position: relative;
  margin-bottom: 32px;
  overflow: hidden;
}
.radar-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(to bottom, transparent, var(--accent-glow));
  border-bottom: 2px solid var(--accent-color);
  animation: scan 2s linear infinite;
  transform-origin: bottom;
}
@keyframes scan { 0% { transform: translateY(-100%); } 100% { transform: translateY(200%); } }

/* Home Dashboard */
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.user-avatar { width: 40px; height: 40px; background: var(--surface-highlight); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }

.intel-card {
  background: var(--surface-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--surface-highlight);
  position: relative;
}

.recommendation-card {
  background: var(--surface-color);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--surface-highlight);
  position: relative;
  display: flex;
  flex-direction: column;
}

.intel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.badge-source {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent-color);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.divider {
  height: 1px;
  background: var(--surface-highlight);
  margin: 12px 0;
}

.intel-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.95rem;
  align-items: center;
  opacity: 0;
  animation: slideIn 0.5s ease forwards;
}

.intel-row:nth-child(1) { animation-delay: 0.1s; }
.intel-row:nth-child(2) { animation-delay: 0.2s; }
.intel-row:nth-child(3) { animation-delay: 0.3s; }
.intel-row:nth-child(4) { animation-delay: 0.4s; }
.intel-row:nth-child(5) { animation-delay: 0.5s; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.intel-label { color: var(--text-secondary); }
.intel-value { color: var(--text-primary); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.intel-meta { font-size: 0.7rem; color: var(--success-color); margin-top: 2px; }

.editable {
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  margin-bottom: 4px;
  border-radius: 8px;
  transition: background 0.2s;
}
.editable:hover { background: var(--surface-highlight); }

.edit-icon {
  color: var(--text-secondary);
  font-size: 0.8rem;
  opacity: 0.5;
}
.editable:hover .edit-icon { opacity: 1; color: var(--accent-color); }

.action-card {
  background: linear-gradient(135deg, var(--surface-color), #1a1a24);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  border: 1px solid var(--primary-glow);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Camera Experience */
#view-camera {
  padding: 0;
  background: black;
}
.camera-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
}
.camera-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  padding-top: 60px; /* Notch */
  z-index: 20;
}
.camera-top {
  display: flex;
  justify-content: space-between;
  padding-top: 20px;
}
.camera-pill {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.1);
}
.camera-overlay-text {
  text-align: center;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  margin-bottom: 20px;
}
.shutter-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: transparent;
  border: 4px solid white;
  margin: 0 auto 40px;
  position: relative;
  cursor: pointer;
}
.shutter-inner {
  position: absolute;
  inset: 4px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.shutter-btn:active .shutter-inner { transform: scale(0.9); background: var(--primary-color); }

/* Analysis Overlay */
.analysis-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--surface-color);
  border-radius: 24px;
  border-bottom-left-radius: 34px; /* Matches phone curve */
  border-bottom-right-radius: 34px; /* Matches phone curve */
  padding: 24px 24px 32px 24px; /* Extra bottom padding for curve */
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 30;
  border-top: 1px solid var(--accent-color);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}
.analysis-overlay.show { transform: translateY(0); }

/* Room Navigation */
.room-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.room-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-highlight); transition: background 0.3s; }
.room-dot.active { background: var(--text-primary); }

/* Results */
.result-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-color);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--surface-highlight);
}
.result-icon {
  width: 48px;
  height: 48px;
  background: rgba(0, 240, 255, 0.1);
  color: var(--accent-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.result-details { flex: 1; }
.result-title { font-weight: 600; margin-bottom: 4px; font-size: 1rem; }
.result-meta { font-size: 0.8rem; color: var(--text-secondary); }
.result-badge {
  background: rgba(0, 255, 157, 0.1);
  color: var(--success-color);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Radio Buttons */
.radio-btn {
  flex: 1;
  cursor: pointer;
  position: relative;
}
.radio-btn input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}
.radio-btn span {
  display: block;
  padding: 12px;
  background: var(--surface-highlight);
  border-radius: 8px;
  text-align: center;
  border: 1px solid transparent;
  transition: all 0.2s;
  color: var(--text-secondary);
}
.radio-btn input:checked ~ span {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--accent-color);
  color: var(--accent-color);
  font-weight: 600;
}

/* Confetti */
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #f00;
  animation: fall linear forwards;
  z-index: 999;
}

@keyframes fall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Toast Notification */
.toast {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 255, 157, 0.9);
  color: #000;
  padding: 12px 24px;
  border-radius: 50px;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 255, 157, 0.3);
  pointer-events: none;
  width: max-content;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
