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

:root {
  --bg: #ffffff;
  --bg-card: #fafafa;
  --text: rgba(0,0,0,0.85);
  --muted: rgba(0,0,0,0.35);
  --muted-light: rgba(0,0,0,0.15);
  --accent: rgba(0,0,0,0.85);
  --accent-hover: rgba(0,0,0,1);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --text: rgba(255,255,255,0.85);
  --muted: rgba(255,255,255,0.35);
  --muted-light: rgba(255,255,255,0.12);
  --accent: rgba(255,255,255,0.85);
  --accent-hover: rgba(255,255,255,1);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

a { color: inherit; text-decoration: none; }

/* ── Landing Page ── */

.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 48px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg);
}

.landing-nav .logo-text {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.5px;
}

.landing-nav .nav-links {
  display: flex;
  gap: 32px;
  align-items: center;
}

.landing-nav .nav-links a {
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  transition: color 0.2s;
}

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

.nav-btn {
  font-size: 14px;
  font-weight: 400;
  padding: 8px 20px;
  border-radius: 100px;
  border: 1px solid var(--muted-light);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Hero */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}

.hero-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
  border-radius: 18px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 200;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 18px;
  font-weight: 300;
  color: var(--muted);
  max-width: 420px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.cta-btn {
  font-size: 16px;
  font-weight: 500;
  padding: 14px 40px;
  border-radius: 100px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.cta-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }

.cta-secondary {
  background: transparent;
  border: 1px solid var(--muted-light);
  color: var(--text);
  margin-left: 12px;
}

.cta-secondary:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Features */
.features {
  padding: 120px 48px;
  max-width: 900px;
  margin: 0 auto;
}

.features h2 {
  font-size: 32px;
  font-weight: 200;
  text-align: center;
  margin-bottom: 64px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
}

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

.feature-item p {
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.7;
}

/* Pricing */
.pricing {
  padding: 120px 48px;
  max-width: 700px;
  margin: 0 auto;
}

.pricing h2 {
  font-size: 32px;
  font-weight: 200;
  text-align: center;
  margin-bottom: 16px;
}

.pricing .subtitle {
  font-size: 15px;
  font-weight: 300;
  color: var(--muted);
  text-align: center;
  margin-bottom: 56px;
}

.pricing-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.pricing-card {
  border: 1px solid var(--muted-light);
  border-radius: 16px;
  padding: 32px;
  position: relative;
}

.pricing-card.highlighted {
  border-color: var(--accent);
}

.pricing-card .plan-name {
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 16px;
}

.pricing-card .price {
  font-size: 36px;
  font-weight: 200;
  margin-bottom: 4px;
}

.pricing-card .price-period {
  font-size: 13px;
  font-weight: 300;
  color: var(--muted);
  margin-bottom: 24px;
}

.pricing-card ul {
  list-style: none;
  margin-bottom: 28px;
}

.pricing-card ul li {
  font-size: 14px;
  font-weight: 300;
  color: var(--text);
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-card ul li::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.pricing-card .plan-btn {
  width: 100%;
  padding: 12px;
  border-radius: 100px;
  border: 1px solid var(--muted-light);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
}

.pricing-card.highlighted .plan-btn {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.pricing-card .plan-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Footer */
.footer {
  padding: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 300;
}

/* ── Auth Pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
}

.auth-card h1 {
  font-size: 28px;
  font-weight: 200;
  margin-bottom: 8px;
}

.auth-card .auth-subtitle {
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  margin-bottom: 36px;
}

.auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 6px;
}

.auth-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--muted-light);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  margin-bottom: 18px;
  outline: none;
  transition: border-color 0.2s;
}

.auth-card input:focus { border-color: var(--muted); }

.auth-card .auth-btn {
  width: 100%;
  padding: 14px;
  border-radius: 100px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.auth-card .auth-btn:hover { opacity: 0.9; }

/* OAuth buttons */
.oauth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px;
  border-radius: 100px;
  border: 1px solid var(--muted-light);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 10px;
}

.oauth-btn:hover {
  background: var(--muted-light);
}

.oauth-btn svg { flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--muted-light);
}

.auth-divider span {
  padding: 0 14px;
  font-size: 12px;
  font-weight: 300;
  color: var(--muted);
}

.auth-card .auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  font-weight: 300;
  color: var(--muted);
}

.auth-card .auth-footer a {
  color: var(--text);
  font-weight: 400;
}

.auth-back {
  position: fixed;
  top: 24px;
  left: 24px;
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
}

/* ── Web App ── */
.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  flex-shrink: 0;
}

.app-topbar .app-timer {
  font-size: 14px;
  font-weight: 300;
  font-family: 'SF Mono', 'Menlo', monospace;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.app-topbar .app-timer.active { color: var(--text); }

.app-topbar-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 300;
  padding: 4px 8px;
  transition: color 0.2s;
}

.app-topbar-btn:hover { color: var(--text); }

.app-topbar-left, .app-topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 120px;
}

.app-topbar-right { justify-content: flex-end; }

.app-editor {
  flex: 1;
  padding: 0 24px;
  overflow: hidden;
}

.app-editor textarea {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.8;
  padding: 20px max(calc(50% - 340px), 24px) 80px;
}

.app-editor textarea::placeholder {
  color: var(--muted);
  opacity: 0.5;
  font-weight: 300;
}

.app-bottombar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 24px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.6s;
  pointer-events: none;
}

.app-bottombar.visible {
  opacity: 1;
  pointer-events: auto;
}

.app-bottombar-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 300;
  padding: 6px 12px;
  transition: color 0.2s;
}

.app-bottombar-btn:hover { color: var(--text); }

.app-bottombar .done-btn {
  font-weight: 500;
  color: var(--text);
}

/* Duration picker */
.duration-picker {
  display: none;
  gap: 8px;
  justify-content: center;
  padding: 8px 0;
}

.duration-picker.visible { display: flex; }

.duration-picker button {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 300;
  padding: 5px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}

.duration-picker button:hover { color: var(--text); }
.duration-picker button.active {
  color: var(--text);
  font-weight: 400;
  background: var(--muted-light);
}

/* History sidebar */
.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.history-overlay.visible { opacity: 1; pointer-events: auto; }

.history-panel {
  position: fixed;
  top: 0; right: -400px; bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--bg);
  z-index: 201;
  transition: right 0.3s ease;
  overflow-y: auto;
  border-left: 1px solid var(--muted-light);
}

.history-panel.visible { right: 0; }

.history-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  position: sticky;
  top: 0;
  background: var(--bg);
}

.history-panel-header h2 {
  font-size: 16px;
  font-weight: 300;
}

.history-entry {
  padding: 16px 24px;
  cursor: pointer;
  border-bottom: 1px solid var(--muted-light);
  transition: background 0.15s;
}

.history-entry:hover { background: var(--bg-card); }

.history-entry .entry-meta {
  font-size: 12px;
  font-weight: 300;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.history-entry .entry-preview {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 300;
}

/* Theme toggle icon */
.theme-toggle {
  cursor: pointer;
  font-size: 15px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 4px;
  transition: color 0.2s;
}

.theme-toggle:hover { color: var(--text); }

/* ── Onboarding ── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s;
}

.onboarding-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.onboarding-content {
  text-align: center;
  padding: 0 36px;
  max-width: 520px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.onboarding-content .ob-line {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.onboarding-content .ob-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.onboarding-content .ob-title {
  font-size: 32px;
  font-weight: 200;
  color: var(--text);
}

.onboarding-content .ob-subtitle {
  font-size: 20px;
  font-weight: 200;
  color: var(--muted);
}

.onboarding-content .ob-body {
  font-size: 15px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.7;
}

.onboarding-content .ob-body-strong {
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  opacity: 0.7;
}

.onboarding-content .ob-step {
  font-size: 15px;
  font-weight: 300;
  color: var(--text);
  opacity: 0.8;
  text-align: left;
  width: 100%;
  padding-left: 20px;
}

.onboarding-content .ob-step span {
  display: inline-block;
  width: 22px;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 13px;
  color: var(--muted);
  margin-left: -20px;
}

.onboarding-content .ob-rule {
  font-size: 15px;
  font-weight: 300;
  color: var(--text);
  opacity: 0.8;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.onboarding-content .ob-rule::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.5;
  flex-shrink: 0;
}

.onboarding-content .ob-cta {
  font-size: 16px;
  font-weight: 500;
  padding: 14px 36px;
  border-radius: 100px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 12px;
}

.onboarding-content .ob-cta:hover { opacity: 0.9; }

.onboarding-continue {
  position: fixed;
  bottom: 48px;
  font-size: 15px;
  font-weight: 300;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.4s, color 0.2s;
  opacity: 0;
}

.onboarding-continue.visible { opacity: 1; }
.onboarding-continue:hover { color: var(--text); }

/* Onboarding writing session */
.ob-session {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ob-session .ob-timer {
  font-size: 14px;
  font-weight: 300;
  font-family: 'SF Mono', 'Menlo', monospace;
  color: var(--muted);
}

.ob-session textarea {
  width: 100%;
  height: 280px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.8;
  text-align: left;
  padding: 16px;
}

.ob-session textarea::placeholder {
  color: var(--muted);
  opacity: 0.5;
  font-weight: 300;
}

.ob-session .ob-done-btn {
  font-size: 16px;
  font-weight: 500;
  padding: 14px 36px;
  border-radius: 100px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0;
}

.ob-session .ob-done-btn.visible { opacity: 1; }
.ob-session .ob-done-btn:hover { opacity: 0.9; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .landing-nav { padding: 16px 20px; }
  .landing-nav .nav-links { gap: 20px; }
  .hero h1 { font-size: 36px; }
  .hero p { font-size: 16px; }
  .feature-grid { grid-template-columns: 1fr; gap: 32px; }
  .features, .pricing { padding: 80px 24px; }
  .pricing-cards { grid-template-columns: 1fr; }
  .app-editor textarea { padding: 20px 16px 80px; }
}
