/* === Variables === */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1a73e8;
  --primary-dark: #0d47a1;
  --success: #34c759;
  --text: #1a1a1a;
  --text-light: #666;
  --bg: #ffffff;
  --bg-light: #f5f7fa;
  --bg-card: #ffffff;
  --border: rgba(0,0,0,0.1);
  --header-bg: rgba(255,255,255,0.95);
  --shadow: rgba(0,0,0,0.15);
}

[data-theme="dark"] {
  --primary: #4a9eff;
  --primary-dark: #1a73e8;
  --text: #f0f0f0;
  --text-light: #a0a0a0;
  --bg: #0d1117;
  --bg-light: #161b22;
  --bg-card: #21262d;
  --border: rgba(255,255,255,0.1);
  --header-bg: rgba(13,17,23,0.95);
  --shadow: rgba(0,0,0,0.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

/* === Header === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.header-logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.header-logo span {
  font-weight: 700;
  font-size: 18px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* === Theme Toggle === */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: var(--bg-light);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--border);
}

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

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

.lang-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  min-width: 50px;
}

/* === Footer === */
.footer {
  padding: 32px 16px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  background: var(--text);
  color: var(--bg);
  text-align: center;
}

[data-theme="dark"] .footer {
  background: #000;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
}

.footer-links a:active {
  color: white;
}

.footer-copy {
  color: rgba(255,255,255,0.4);
  font-size: 13px;
}

/* === Content Pages (privacy, terms, support) === */
body.page-content {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 100px 16px 40px;
  padding-top: max(100px, calc(80px + env(safe-area-inset-top)));
  width: 100%;
}

.page-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.updated {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 40px;
}

.page-subtitle {
  font-size: 17px;
  color: var(--text-light);
  margin-bottom: 40px;
}

.section {
  margin-bottom: 28px;
}

.section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.section p {
  color: var(--text-light);
  font-size: 15px;
}

.section a {
  color: var(--primary);
  text-decoration: none;
}

/* === Support Page === */
.contact-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 40px;
  box-shadow: 0 4px 20px var(--shadow);
}

.contact-box h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.contact-box p {
  color: var(--text-light);
  margin: 8px 0;
}

.contact-box a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  margin: 40px 0 20px;
  color: var(--text);
}

.faq-item {
  margin-bottom: 24px;
}

.faq-item h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.faq-item p {
  color: var(--text-light);
  font-size: 15px;
}

/* === Index Page === */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: 80px 16px 40px;
  padding-top: max(80px, calc(60px + env(safe-area-inset-top)));
  background: var(--bg-light);
}

.hero-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 32px;
}

.hero-content h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-content p {
  font-size: 17px;
  color: var(--text-light);
  margin-bottom: 28px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.download-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:active {
  background: var(--bg-light);
}

.btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.screenshots {
  display: flex;
  gap: 12px;
  justify-content: center;
  overflow-x: auto;
  padding: 10px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.screenshot {
  width: 160px;
  min-width: 160px;
  border-radius: 20px;
  box-shadow: 0 10px 40px var(--shadow);
  scroll-snap-align: center;
}

.features {
  padding: 60px 16px;
  background: var(--bg);
}

.features-container {
  max-width: 1000px;
  margin: 0 auto;
}

.features .section-title,
.how-it-works .section-title {
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 40px;
  margin-top: 0;
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.feature {
  text-align: center;
  padding: 24px 16px;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
}

.feature-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 26px;
}

.feature h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.feature p {
  color: var(--text-light);
  font-size: 13px;
  display: none;
}

.how-it-works {
  padding: 60px 16px;
  background: var(--bg-light);
}

.steps {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  text-align: left;
}

.step-number {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.step-content h4 {
  font-size: 17px;
  margin-bottom: 4px;
}

.step-content p {
  color: var(--text-light);
  font-size: 14px;
}

/* === Desktop === */
@media (min-width: 768px) {
  .header {
    padding: 12px 24px;
  }

  /* Content pages */
  .main {
    padding: 120px 24px 60px;
  }

  .page-title {
    font-size: 36px;
  }

  .section h2 {
    font-size: 20px;
  }

  .contact-box {
    padding: 32px;
  }

  .footer {
    padding: 40px 24px;
  }

  /* Index page */
  .hero {
    padding: 100px 24px 60px;
  }

  .hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    text-align: left;
  }

  .hero-content h1 {
    font-size: 48px;
  }

  .hero-content p {
    font-size: 20px;
    margin-left: 0;
  }

  .download-buttons {
    flex-direction: row;
    max-width: none;
    margin: 0;
  }

  .btn {
    padding: 16px 28px;
  }

  .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--shadow);
  }

  .screenshots {
    justify-content: flex-end;
    overflow: visible;
    perspective: 1000px;
  }

  .screenshot {
    width: 200px;
    min-width: 200px;
    transform: rotateY(-5deg);
    transition: transform 0.3s;
  }

  .screenshot:hover {
    transform: rotateY(0) scale(1.02);
  }

  .screenshot:nth-child(2) {
    transform: rotateY(5deg);
    margin-top: 40px;
  }

  .features {
    padding: 100px 24px;
  }

  .features .section-title {
    font-size: 36px;
    margin-bottom: 60px;
  }

  .features-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
  }

  .feature {
    padding: 30px 20px;
  }

  .feature-icon {
    width: 70px;
    height: 70px;
    font-size: 32px;
  }

  .feature h3 {
    font-size: 18px;
  }

  .feature p {
    display: block;
    font-size: 14px;
  }

  .how-it-works {
    padding: 100px 24px;
  }

  .steps {
    max-width: 800px;
    flex-direction: row;
    justify-content: space-between;
    position: relative;
  }

  .steps::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 15%;
    right: 15%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--success));
  }

  .step {
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    position: relative;
    z-index: 1;
  }

  .step-number {
    background: var(--bg-light);
  }
}

/* === Small phones === */
@media (max-width: 360px) {
  .hero-content h1 {
    font-size: 26px;
  }

  .screenshot {
    width: 130px;
    min-width: 130px;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }
}
