/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== Dark Theme (default) ===== */
:root {
  --color-bg: #0b0b0f;
  --color-surface: #15151e;
  --color-surface-hover: #1c1c28;
  --color-border: rgba(255, 255, 255, 0.07);
  --color-border-hover: rgba(255, 255, 255, 0.12);
  --color-text: #e8e8ed;
  --color-text-secondary: #7c7c8a;
  --color-heading: #ffffff;
  --color-accent: #3b82f6;
  --color-accent-hover: #5b9aff;
  --color-accent-subtle: rgba(59, 130, 246, 0.1);
  --color-accent-border: rgba(59, 130, 246, 0.15);
  --color-accent-border-hover: rgba(59, 130, 246, 0.3);
  --color-accent-bg-hover: rgba(59, 130, 246, 0.18);
  --nav-bg: rgba(11, 11, 15, 0.82);
  --nav-bg-mobile: rgba(11, 11, 15, 0.96);
  --app-icon-bg: rgba(255, 255, 255, 0.05);
  --card-shadow: 0 4px 24px rgba(59, 130, 246, 0.06);
  --bg-glow: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.06), transparent);
  --selection-bg: rgba(59, 130, 246, 0.3);
  --selection-color: #fff;
  --scrollbar-thumb: rgba(255, 255, 255, 0.1);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.18);
  --max-width: 1120px;
  --nav-height: 56px;
  --content-padding: clamp(20px, 5vw, 64px);
}

/* ===== Light Theme ===== */
[data-theme="light"] {
  --color-bg: #ffffff;
  --color-surface: #f5f5f7;
  --color-surface-hover: #ebebed;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-hover: rgba(0, 0, 0, 0.14);
  --color-text: #1d1d1f;
  --color-text-secondary: #6e6e73;
  --color-heading: #000000;
  --color-accent: #0071e3;
  --color-accent-hover: #0077ed;
  --color-accent-subtle: rgba(0, 113, 227, 0.06);
  --color-accent-border: rgba(0, 113, 227, 0.12);
  --color-accent-border-hover: rgba(0, 113, 227, 0.25);
  --color-accent-bg-hover: rgba(0, 113, 227, 0.1);
  --nav-bg: rgba(255, 255, 255, 0.88);
  --nav-bg-mobile: rgba(255, 255, 255, 0.97);
  --app-icon-bg: rgba(0, 0, 0, 0.04);
  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --bg-glow: none;
  --selection-bg: rgba(0, 113, 227, 0.2);
  --selection-color: #000;
  --scrollbar-thumb: rgba(0, 0, 0, 0.15);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.25);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--color-text);
  background: var(--color-bg);
  background-image: var(--bg-glow);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s, color 0.3s;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* ===== Navigation ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.3s, border-color 0.3s;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text);
  white-space: nowrap;
}

.nav-brand:hover {
  text-decoration: none;
  color: var(--color-heading);
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--color-heading);
  font-weight: 500;
}

/* Nav right group: theme toggle + hamburger */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  background: var(--color-surface);
  border: 1px solid var(--color-border-hover);
  border-radius: 10px;
  cursor: pointer;
  padding: 8px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.theme-toggle:hover {
  color: var(--color-heading);
  border-color: var(--color-accent);
  background: var(--color-surface-hover);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Show moon in dark mode, sun in light mode */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--color-text);
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}

@media (max-width: 600px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--nav-bg-mobile);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--color-border);
    padding: 8px 0;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    border-top: 1px solid var(--color-border);
  }

  .nav-links li:first-child {
    border-top: none;
  }

  .nav-links a {
    display: block;
    padding: 14px var(--content-padding);
    font-size: 0.95rem;
  }
}

/* ===== Main Content ===== */
main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 64px) var(--content-padding);
  width: 100%;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: clamp(24px, 5vw, 48px) 0 clamp(32px, 6vw, 64px);
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
  color: var(--color-heading);
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--color-text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

/* ===== Section ===== */
.section {
  margin-bottom: clamp(36px, 6vw, 56px);
}

.section h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  color: var(--color-heading);
}

.section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text);
}

.section p,
.section li {
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.section ul,
.section ol {
  padding-left: 20px;
}

.section ul li,
.section ol li {
  margin-bottom: 8px;
}

/* ===== App Cards ===== */
.app-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 480px) {
  .app-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .app-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.app-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.app-card:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-hover);
  box-shadow: var(--card-shadow);
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--app-icon-bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.app-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--color-text);
}

.app-info p {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin: 0;
}

/* ===== Quick Links ===== */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.quick-links a {
  display: inline-block;
  padding: 10px 22px;
  background: var(--color-accent-subtle);
  border: 1px solid var(--color-accent-border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-accent);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.quick-links a:hover {
  background: var(--color-accent-bg-hover);
  border-color: var(--color-accent-border-hover);
  color: var(--color-accent-hover);
  text-decoration: none;
}

/* ===== FAQ ===== */
.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: 18px 0;
}

.faq-item:first-child {
  border-top: 1px solid var(--color-border);
}

.faq-item summary {
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--color-text);
  transition: color 0.2s;
}

.faq-item summary:hover {
  color: var(--color-heading);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: color 0.2s;
}

.faq-item[open] summary::after {
  content: "\2212";
  color: var(--color-accent);
}

.faq-item .faq-answer {
  padding-top: 12px;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

/* ===== Contact Box ===== */
.contact-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: clamp(24px, 4vw, 36px);
  text-align: center;
  transition: background 0.3s, border-color 0.3s;
}

.contact-box p {
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.contact-box a {
  font-weight: 500;
  font-size: 1.05rem;
}

/* ===== Instructions Box ===== */
.instructions {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: clamp(20px, 3vw, 28px);
  margin-bottom: 16px;
  transition: background 0.3s, border-color 0.3s;
}

.instructions h3 {
  margin-bottom: 8px;
  color: var(--color-text);
}

.instructions p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.instructions ol {
  padding-left: 20px;
}

.instructions ol li {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 6px;
}

/* ===== Legal / Policy Pages ===== */
.legal h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
  color: var(--color-heading);
}

.legal .updated {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 36px;
}

.legal h2 {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 600;
  margin-top: 36px;
  margin-bottom: 12px;
  color: var(--color-text);
}

.legal p,
.legal li {
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.legal ul {
  padding-left: 20px;
}

.legal ul li {
  margin-bottom: 6px;
}

.legal strong {
  color: var(--color-text);
}

.legal h3 {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 10px;
  color: var(--color-heading);
}

.legal h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--color-text);
}

/* ===== App Selector (Privacy Page) ===== */
.app-selector {
  margin-top: 32px;
}

.app-selector-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.app-selector-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 24px 28px;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.2s;
  min-width: 130px;
}

.app-selector-item:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-accent-border-hover);
  box-shadow: var(--card-shadow);
  transform: translateY(-2px);
}

.app-selector-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: var(--app-icon-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-selector-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

.icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--color-text-secondary);
}

.app-selector-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
}

/* ===== Policy Back Button ===== */
.policy-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 20px;
  transition: color 0.2s;
  font-family: inherit;
}

.policy-back:hover {
  color: var(--color-accent-hover);
}

.policy-app-title {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem) !important;
  font-weight: 700 !important;
  margin-top: 0 !important;
  margin-bottom: 4px !important;
  color: var(--color-heading) !important;
}

.policy-date {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 28px;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--color-border);
  padding: 28px var(--content-padding);
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  transition: border-color 0.3s;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer a {
  color: var(--color-text-secondary);
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* ===== Utility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ===== Selection ===== */
::selection {
  background: var(--selection-bg);
  color: var(--selection-color);
}

/* ===== Scrollbar (Webkit) ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}
