:root {
  --bg: #ffffff; --fg: #0a0a0a; --accent: #ff5a4e;
  --muted: rgba(10,10,10,.55); --border: rgba(10,10,10,.08); --shadow: rgba(10,10,10,.08);
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px; --space-xl: 32px;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 16px; --radius-full: 9999px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  animation: fade-in 800ms ease-out both;
}

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

.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-md); }
.logo { width: 80px; height: 80px; }
.headline {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.75rem, 5vw, 2.4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.subheadline { color: var(--muted); font-size: 1rem; }

.permission {
  background: rgba(255,90,78,0.06);
  border: 1px solid rgba(255,90,78,0.18);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  animation: fade-in 600ms ease-out both;
}
.pre-prompt { color: var(--fg); font-size: 0.95rem; line-height: 1.6; }

.timer { text-align: center; }
.timer-label {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-sm);
  letter-spacing: 0.02em;
}
.countdown {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-size: clamp(2.4rem, 9vw, 3.2rem);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.colon { display: inline-block; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.quote {
  text-align: center;
  padding: 0 var(--space-md);
  min-height: 4em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quote blockquote {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--fg);
  max-width: 38ch;
  line-height: 1.55;
  animation: fade-in 600ms ease-out both;
}

.action { display: flex; flex-direction: column; align-items: center; gap: var(--space-md); }

.btn {
  font-family: inherit;
  font-weight: 500;
  font-size: 1rem;
  padding: var(--space-md) var(--space-xl);
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease, background 250ms ease, color 250ms ease;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-primary {
  background: var(--fg);
  color: var(--bg);
  min-width: 220px;
  box-shadow: 0 4px 14px var(--shadow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px var(--shadow); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.thanked { background: var(--accent); color: #fff; }

.btn-secondary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255,90,78,0.25);
}
.btn-secondary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(255,90,78,0.3); }

.btn-label { position: relative; z-index: 2; }

.ripple {
  position: absolute;
  top: 50%; left: 50%;
  width: 24px; height: 24px;
  margin: -12px 0 0 -12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.ripple.active { animation: ripple 800ms ease-out; }
@keyframes ripple {
  0%   { transform: scale(0);  opacity: 0.65; }
  100% { transform: scale(12); opacity: 0; }
}

.streak {
  color: var(--muted);
  font-size: 0.875rem;
  min-height: 1.2em;
  letter-spacing: 0.02em;
}

.settings {
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.settings-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}
.setting {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  font-size: 0.95rem;
  color: var(--fg);
}
.setting strong { color: var(--accent); font-weight: 500; }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px var(--shadow);
  transition: transform 150ms ease;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.1); }
input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 0;
  box-shadow: 0 2px 6px var(--shadow);
}

.setting-toggle {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
}
.setting-toggle input[type=checkbox] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px; height: 1px;
}
.switch {
  width: 44px; height: 26px;
  background: var(--border);
  border-radius: var(--radius-full);
  position: relative;
  transition: background 220ms ease;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px var(--shadow);
  transition: transform 220ms ease;
}
.setting-toggle input[type=checkbox]:checked + .switch { background: var(--accent); }
.setting-toggle input[type=checkbox]:checked + .switch::after { transform: translateX(18px); }
.setting-toggle input[type=checkbox]:focus-visible + .switch {
  box-shadow: 0 0 0 3px rgba(255,90,78,0.3);
}

.btn-link {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  padding: var(--space-sm) 0;
  align-self: flex-start;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 200ms ease;
}
.btn-link:hover { color: var(--accent); }
.btn-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

.footer {
  text-align: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
}

@media (max-width: 480px) {
  .app { padding: var(--space-lg) var(--space-md); gap: var(--space-lg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .colon { animation: none !important; opacity: 1 !important; }
  .ripple { display: none !important; }
}
