:root {
  color-scheme: dark;
  --bg: #05070c;
  --surface: #0f1320;
  --surface-2: #151b2f;
  --border: #25304d;
  --text: #e6ecff;
  --muted: #9aa4c5;
  --accent: #6aa6ff;
  --accent-2: #7ef3c9;
  --accent-3: #f09bff;
  --warning: #f4b56a;
  --shadow: 0 14px 40px rgba(6, 9, 18, 0.45);
  --radius: 18px;
  --panel-gap: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(circle at top, #11183a 0%, #05070c 45%, #04040a 100%);
  color: var(--text);
  min-height: 100vh;
}

.guide-app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(8, 12, 24, 0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 24px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Mode Navigation */
.mode-nav {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  color: var(--text);
  background: rgba(106, 166, 255, 0.1);
}

.mode-btn.active {
  background: var(--accent);
  color: #0c1425;
}

.mode-icon {
  font-size: 16px;
}

.mode-label {
  display: none;
}

@media (min-width: 640px) {
  .mode-label {
    display: inline;
  }
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

/* ===== HI ASSISTANT ===== */
.hi-assistant {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(126, 243, 201, 0.08), rgba(106, 166, 255, 0.08));
  border-bottom: 1px solid var(--border);
}

.hi-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #0c1425;
  flex-shrink: 0;
  animation: float 3.4s ease-in-out infinite;
}

.hi-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-top-left-radius: 4px;
  padding: 12px 16px;
  flex: 1;
  max-width: 600px;
}

.hi-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* ===== MAIN CONTENT ===== */
.guide-main {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.mode-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.mode-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== JOURNEY MODE ===== */
.journey-card {
  background: linear-gradient(180deg, rgba(22, 29, 52, 0.98), rgba(10, 14, 28, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: float 6s ease-in-out infinite;
}

.journey-card::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle, rgba(126, 243, 201, 0.08), transparent 65%);
  opacity: 0.6;
  pointer-events: none;
}

.journey-card.is-popping {
  animation: popIn 0.45s ease-out;
}

.journey-popup {
  position: relative;
  padding: 18px;
  border-radius: calc(var(--radius) + 10px);
  background: rgba(6, 9, 18, 0.55);
  border: 1px solid rgba(106, 166, 255, 0.25);
  box-shadow: 0 0 0 1px rgba(126, 243, 201, 0.12), 0 18px 40px rgba(6, 9, 18, 0.55);
  backdrop-filter: blur(10px);
}

.journey-popup::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(106, 166, 255, 0.25), rgba(126, 243, 201, 0.3), rgba(240, 155, 255, 0.2));
  opacity: 0.35;
  filter: blur(12px);
  z-index: -1;
}

.journey-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.journey-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.journey-progress {
  font-size: 13px;
  color: var(--accent-2);
  background: rgba(126, 243, 201, 0.08);
  border: 1px solid rgba(126, 243, 201, 0.2);
  padding: 6px 12px;
  border-radius: 999px;
  animation: pulse 2.5s ease-in-out infinite;
}

.journey-question {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}

.journey-detail {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.journey-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.journey-actions--results {
  margin-top: 20px;
}

.journey-results {
  margin-top: 24px;
  padding: 20px;
  background: rgba(10, 15, 30, 0.6);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  animation: fadeIn 0.4s ease;
}

.journey-results-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.journey-fallback {
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent-2);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.choice-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font: inherit;
  color: inherit;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  animation: choiceIn 0.35s ease forwards;
  animation-delay: var(--delay, 0s);
}

.choice-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(106, 166, 255, 0.15);
}

.choice-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(106, 166, 255, 0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.choice-card:hover::after {
  opacity: 1;
  animation: shimmer 1.2s linear infinite;
}

.choice-card .icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.choice-card .label {
  font-weight: 600;
  font-size: 14px;
}

.journey-results.hidden {
  display: none;
}

/* ===== APP CARDS ===== */
.app-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.app-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.app-card-icon {
  font-size: 28px;
}

.app-card-title {
  font-weight: 700;
  font-size: 15px;
}

.app-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.app-card-tags {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.app-tag {
  padding: 4px 8px;
  background: rgba(106, 166, 255, 0.1);
  border-radius: 6px;
  font-size: 11px;
  color: var(--accent);
}

/* ===== FINDER MODE ===== */
.finder-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.finder-search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(106, 166, 255, 0.15);
}

.search-icon {
  font-size: 20px;
  opacity: 0.6;
}

.finder-search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.finder-search-box input::placeholder {
  color: var(--muted);
}

.finder-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0c1425;
}

.finder-results {
  min-height: 200px;
}

.finder-hint {
  text-align: center;
  color: var(--muted);
  padding: 40px;
  font-size: 14px;
}

/* ===== FAQ MODE ===== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.faq-question {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s ease;
}

.faq-question:hover {
  background: var(--surface-2);
}

.faq-question::after {
  content: '+';
  font-size: 20px;
  color: var(--muted);
}

.faq-item.open .faq-question::after {
  content: '−';
}

.faq-answer {
  display: none;
  padding: 0 20px 16px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.faq-item.open .faq-answer {
  display: block;
}

.quick-links h4 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.quick-link:hover {
  border-color: var(--accent);
  background: rgba(106, 166, 255, 0.08);
}

/* ===== MOBILE BOTTOM NAV ===== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(8, 12, 24, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 100;
}

@media (max-width: 639px) {
  .mobile-nav {
    display: flex;
    justify-content: space-around;
  }
  
  .mode-nav {
    display: none;
  }
  
  .guide-main {
    padding-bottom: 80px;
  }
}

.mobile-nav-btn {
  background: transparent;
  border: none;
  padding: 10px 20px;
  font-size: 24px;
  opacity: 0.5;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.mobile-nav-btn.active {
  opacity: 1;
  background: rgba(106, 166, 255, 0.15);
}

/* ===== MODALS ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes choiceIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(126, 243, 201, 0.2);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(126, 243, 201, 0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row span {
  font-size: 14px;
}

.setting-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.setting-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

/* App Preview Modal */
.modal-content.app-preview {
  max-width: 500px;
}

.app-preview-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.app-preview-body {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
  margin-bottom: 20px;
}

.app-preview-actions {
  display: flex;
  gap: 12px;
}

/* ===== BUTTONS ===== */
.btn {
  background: var(--accent);
  color: #0c1425;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(106, 166, 255, 0.3);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  border-color: var(--accent);
  background: rgba(106, 166, 255, 0.1);
  box-shadow: none;
}

/* ===== UTILITIES ===== */
.hidden {
  display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
