:root {
  --bg: #0b0d12;
  --surface: #14171f;
  --surface-2: #1c2029;
  --text: #f2f3f5;
  --text-dim: #9aa0ac;
  --accent: #3b82f6;
  --accent-text: #ffffff;
  --border: #262b36;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f8;
    --surface: #ffffff;
    --surface-2: #eef0f4;
    --text: #14161a;
    --text-dim: #6b7280;
    --border: #e2e5ea;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: calc(var(--safe-top) + 12px);
  padding-bottom: calc(var(--safe-bottom) + 16px);
  animation: view-in 260ms ease both;
}

[hidden],
.view[hidden],
#view-scan[hidden] {
  display: none !important;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Scan view: Modern Fullscreen Experience ---------- */

#view-scan {
  position: absolute;
  inset: 0;
  padding: 0;
  background: #000;
  overflow: hidden;
  animation: none;
}

#camera,
#view-scan #camera {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 1;
  pointer-events: none;
  /* `visibility` as well as `opacity`: iOS promotes an inline-playing <video>
     to its own compositing layer, and that layer can paint a frame or two
     before an opacity-only transition is applied to it. `visibility: hidden`
     keeps the media layer out of the paint entirely until it is sized. */
  opacity: 0;
  visibility: hidden;
  /* Promote up front so the layer is not created (and repainted) mid-fade. */
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: opacity 280ms ease;
}

#camera.ready,
#view-scan #camera.ready {
  opacity: 1;
  visibility: visible;
}

.scan-vignette-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: min(28vh, 180px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.28) 55%, transparent 100%);
  z-index: 2;
  pointer-events: none;
}

.scan-vignette-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: min(24vh, 150px);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
  z-index: 2;
  pointer-events: none;
}

#view-scan .particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

/* Center Viewfinder Reticle with Animated Laser Sweep */
.scan-reticle {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(68vw, 240px);
  height: min(68vw, 240px);
  pointer-events: none;
  z-index: 4;
}

.reticle-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: #38bdf8;
  border-style: solid;
  border-width: 0;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.45));
}
.reticle-tl { top: 0; left: 0; border-top-width: 3.5px; border-left-width: 3.5px; border-top-left-radius: 12px; }
.reticle-tr { top: 0; right: 0; border-top-width: 3.5px; border-right-width: 3.5px; border-top-right-radius: 12px; }
.reticle-bl { bottom: 0; left: 0; border-bottom-width: 3.5px; border-left-width: 3.5px; border-bottom-left-radius: 12px; }
.reticle-br { bottom: 0; right: 0; border-bottom-width: 3.5px; border-right-width: 3.5px; border-bottom-right-radius: 12px; }

.reticle-laser {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #38bdf8 50%, transparent 100%);
  box-shadow: 0 0 14px #38bdf8;
  animation: scan-laser 2.4s ease-in-out infinite;
}

@keyframes scan-laser {
  0% { top: 8%; opacity: 0.2; }
  50% { top: 92%; opacity: 0.95; }
  100% { top: 8%; opacity: 0.2; }
}

/* iOS Liquid Glass Top Header */
.scan-overlay-top {
  position: absolute;
  top: calc(var(--safe-top) + 16px);
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
  pointer-events: none;
}

.scan-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.glass-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(18, 22, 32, 0.65);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  transition: all 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8;
  animation: pulse-dot 2.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.65; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.18); box-shadow: 0 0 14px #38bdf8; }
}

.glass-text {
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.glass-pill.locked {
  background: rgba(16, 185, 129, 0.4);
  border-color: rgba(52, 211, 153, 0.7);
}
.glass-pill.locked .glass-dot {
  background: #34d399;
  box-shadow: 0 0 12px #34d399;
}

.glass-btn {
  pointer-events: auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(18, 22, 32, 0.65);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 120ms ease, background 180ms ease, color 180ms ease;
}
.glass-btn:active {
  transform: scale(0.92);
}
.glass-btn.active {
  background: rgba(255, 255, 255, 0.92);
  color: #0b0d12;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.55);
}

.scan-overlay-bottom {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 20px);
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.scan-action-bar {
  pointer-events: auto;
  display: flex;
  gap: 12px;
}

.glass-pill-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  color: #ffffff;
  background: rgba(18, 22, 32, 0.72);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  transition: transform 120ms ease, background 180ms ease, border-color 180ms ease;
}
.glass-pill-btn:active {
  transform: scale(0.95);
  background: rgba(28, 34, 48, 0.85);
}
.glass-pill-btn svg {
  opacity: 0.9;
}
.glass-pill-btn span {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.1px;
}

/* Glass Camera Fallback Card */
.glass-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(85vw, 340px);
  padding: 28px 24px;
  background: rgba(20, 24, 34, 0.84);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
  z-index: 20;
}
.glass-card-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.glass-card h2 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 600;
}
.glass-card p {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.45;
}
.glass-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.glass-card-actions .btn {
  margin: 0;
  width: 100%;
}
/* ---------- Shared ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 12px;
}
.topbar-title { font-weight: 600; font-size: 16px; }
.topbar-spacer { width: 36px; }

.btn-text-action {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 120ms ease;
}
.btn-text-action:active {
  background: var(--surface-2);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 600;
  margin: 8px 16px 0;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}
.btn:active { transform: scale(0.97); opacity: 0.9; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-full { width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }

/* ---------- Destination Card ---------- */

.destination-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 16px 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.destination-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.destination-host {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.destination-url {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-verified {
  font-size: 11px;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---------- Customize View ---------- */

.customize-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
  -webkit-overflow-scrolling: touch;
}

.icon-mockups {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 36px;
  margin: 4px 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.mockup { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }

.squircle-frame {
  width: 76px;
  height: 76px;
  border-radius: 22.4%;
  overflow: hidden;
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.squircle-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.adaptive-frame {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 8px 20px -3px rgba(0, 0, 0, 0.38);
}
.adaptive-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.field { display: block; margin-bottom: 18px; }
.field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.field-header > span:first-child,
.field > span:first-child { display: block; font-size: 13px; color: var(--text-dim); }
.field-hex-tag {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}
.field-sub {
  font-size: 11px;
  color: var(--text-dim);
}
.field input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
}
.tab.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.tab-panel { margin-bottom: 0; }
.tab-panel:not(:empty) { margin-bottom: 18px; }
.field-hint { font-size: 12px; color: var(--text-dim); margin: 6px 0 0; line-height: 1.4; }

/* Favicon Rich Card */
.favicon-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.favicon-card img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
}
.favicon-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.favicon-card-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-hd {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  width: fit-content;
}
.btn-chip-action {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}
.btn-chip-action:active {
  background: var(--border);
}

/* Monogram Typography Options */
.monogram-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.subfield-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* Segmented Controls (Monogram & Transitions) */
.segmented-control {
  display: flex;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 4px;
}
.segmented-control .segment {
  flex: 1;
  padding: 9px 8px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
  white-space: nowrap;
}
.segmented-control .segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.font-serif-demo { font-family: Georgia, "Times New Roman", serif !important; }
.font-mono-demo { font-family: "SF Mono", Menlo, monospace !important; }

#iconify-search {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  margin-bottom: 10px;
}
.iconify-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px;
}
.iconify-grid button {
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  cursor: pointer;
  transition: transform 100ms ease, border-color 150ms ease;
}
.iconify-grid button:active {
  transform: scale(0.94);
}
.iconify-grid button.selected {
  border-color: var(--accent);
  background: #eef2ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}
.iconify-grid img { width: 100%; height: 100%; object-fit: contain; }

/* Curated Palette Row */
.palette-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.palette-row .preset-chips {
  flex: 1;
  margin: 0;
}

.preset-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 12px;
  overflow-x: auto;
  padding: 2px 2px 4px 2px;
}
.preset-chips .chip {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 100ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.preset-chips .chip:active {
  transform: scale(0.9);
}
.preset-chips .chip.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--accent);
  transform: scale(1.08);
}
@media (prefers-color-scheme: light) {
  .preset-chips .chip.active {
    border-color: #0b0d12;
  }
}

.color-picker-btn {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.color-picker-btn input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.color-picker-icon {
  font-size: 15px;
  pointer-events: none;
}

.advanced-sliders {
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.advanced-sliders summary {
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 500;
  user-select: none;
}
.advanced-sliders[open] summary {
  margin-bottom: 12px;
}

.color-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.color-row:last-child { margin-bottom: 0; }
.color-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.slider-label { width: 40px; flex-shrink: 0; font-size: 12px; color: var(--text-dim); }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }
.swatch-spacer { width: 30px; flex-shrink: 0; }

.hue-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #000000 0%, #71717a 6%, hsl(0, 75%, 50%) 10%, hsl(60, 75%, 50%) 26%, hsl(120, 75%, 50%) 42%, hsl(180, 75%, 50%) 58%, hsl(240, 75%, 50%) 74%, hsl(300, 75%, 50%) 88%, hsl(360, 75%, 50%) 100%);
  outline: none;
}
.hue-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  cursor: pointer;
}
.hue-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  cursor: pointer;
}
.hue-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #000000 0%, #71717a 6%, hsl(0, 75%, 50%) 10%, hsl(60, 75%, 50%) 26%, hsl(120, 75%, 50%) 42%, hsl(180, 75%, 50%) 58%, hsl(240, 75%, 50%) 74%, hsl(300, 75%, 50%) 88%, hsl(360, 75%, 50%) 100%);
}

.lightness-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #000, #fff);
  outline: none;
}
.lightness-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.lightness-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.lightness-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #000, #fff);
}

/* ---------- Bottom bar actions ---------- */

.bottom-bar {
  margin-top: auto;
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  background: linear-gradient(0deg, var(--bg) 80%, transparent);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
  flex-shrink: 0;
}
.bottom-bar .btn {
  margin: 0;
  width: 100%;
}

/* ---------- Install ---------- */

.install-hero {
  text-align: center;
  padding: 32px 16px 8px;
}
#install-icon-canvas { width: 96px; height: 96px; border-radius: 22%; box-shadow: 0 12px 30px rgba(0,0,0,0.3); }
.install-hero h1 { font-size: 20px; margin: 14px 0 4px; }
.install-hero p { margin: 0; color: var(--text-dim); font-size: 13px; word-break: break-all; padding: 0 24px; }

.install-block { padding: 0 16px; margin-top: 12px; flex: 1; }
#install-android {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
#install-android .btn {
  width: 100%;
  margin: 8px 0 0;
}
#install-android .field-hint {
  text-align: center;
  margin-top: 8px;
}
.install-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  margin-top: auto;
}
.install-actions .btn {
  margin: 0;
  width: 100%;
}

.step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  vertical-align: middle;
  background: var(--surface-2);
  border-radius: 7px;
  color: var(--text);
  margin: 0 2px;
}
.step-icon.inline { margin: 0 1px; }

.guide-link {
  display: block;
  margin-top: 20px;
  font-size: 13.5px;
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Launch transitions ---------- */

.launch-fade {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.launch-fade img { width: 80px; height: 80px; border-radius: 22%; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.92); opacity: 0.7; } }

.launch-slide {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: launch-slide-up 380ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.launch-slide img {
  width: 80px;
  height: 80px;
  border-radius: 22%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
@keyframes launch-slide-up {
  from { transform: translateY(100%); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Install Bottom Sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}
.sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.sheet-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(var(--safe-bottom) + 24px);
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
}
.sheet-backdrop.active .sheet-container {
  transform: translateY(0);
}

.sheet-handle-bar {
  display: flex;
  justify-content: center;
  padding: 6px 0 14px;
  touch-action: none;
  cursor: grab;
}
.sheet-handle {
  width: 38px;
  height: 5px;
  border-radius: 999px;
  background: var(--text-dim);
  opacity: 0.45;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.sheet-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sheet-app-icon {
  border-radius: 7px;
}
.sheet-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.sheet-close {
  font-size: 22px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.sheet-desc {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.45;
}

.sheet-install-block {
  margin-top: 8px;
}
.sheet-install-block .btn {
  margin: 0 0 8px;
  width: 100%;
}
#sheet-android-block {
  text-align: center;
}
#sheet-android-block .field-hint {
  text-align: center;
  margin-top: 8px;
}
.sheet-install-block .ios-steps {
  padding-left: 20px;
  font-size: 14.5px;
  line-height: 1.85;
}

/* ---------- Settings / Legal Menu Sheet ---------- */

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 16px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 150ms ease, transform 100ms ease;
  width: 100%;
}
.menu-item:active {
  transform: scale(0.98);
  background: var(--border);
}
.menu-item-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.menu-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.menu-item-title {
  font-size: 14.5px;
  font-weight: 600;
}
.menu-item-sub {
  font-size: 12px;
  color: var(--text-dim);
}
.menu-item-arrow {
  color: var(--text-dim);
  font-size: 16px;
  flex-shrink: 0;
}

/* ---------- Direct URL Modal / Drawer ---------- */

.direct-url-icon {
  font-size: 20px;
}

.direct-url-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.url-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.url-input-wrap input {
  width: 100%;
  padding: 13px 76px 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.url-input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-paste-tag {
  position: absolute;
  right: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}
.btn-paste-tag:active {
  background: var(--surface-2);
}

.suggestions-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.suggestions-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}
.suggestions-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-suggestion {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms ease, transform 100ms ease, background 150ms ease;
}
.chip-suggestion:active {
  transform: scale(0.95);
  border-color: var(--accent);
  background: var(--surface);
}

.field-error {
  font-size: 12px;
  color: #ef4444;
  margin: 0;
}

/* ---------- In-Person QR Code Card ---------- */

.install-qr-section {
  padding: 0 16px;
  margin-top: 14px;
}

.install-qr-card {
  margin-top: 12px;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: view-in 220ms ease both;
}

.install-qr-canvas-wrap {
  padding: 12px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.install-qr-canvas-wrap canvas {
  display: block;
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
}

.install-qr-hint {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
}
