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

:root {
  --bg-blur: 20px;
  --bg-darkness: 0.7;
  --accent: #ff3b30;
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.6);
  --surface: rgba(255, 255, 255, 0.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #000;
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.desktop-bg {
  position: fixed;
  inset: 0;
  background: url('bg.jpg') no-repeat center center;
  background-size: cover;
  z-index: 0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, var(--bg-darkness));
  backdrop-filter: blur(var(--bg-blur));
  -webkit-backdrop-filter: blur(var(--bg-blur));
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.overlay.visible {
  animation: fadeIn 1s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); }
  to { opacity: 1; backdrop-filter: blur(var(--bg-blur)); -webkit-backdrop-filter: blur(var(--bg-blur)); }
}

.reader-container {
  text-align: center;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.state {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.state.hidden,
.hidden {
  display: none;
}

.logo {
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.tagline {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 3rem;
}

.play-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  padding: 0.875rem 1.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.play-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.play-icon {
  font-size: 0.875rem;
}

.hint {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

kbd {
  display: inline-block;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  margin: 0 0.25rem;
}

/* Reading state */
.word-container {
  position: relative;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orp-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 59, 48, 0.3) 30%,
    rgba(255, 59, 48, 0.3) 70%,
    transparent 100%
  );
  transform: translateX(-50%);
}

.word {
  font-family: 'JetBrains Mono', monospace;
  font-size: 4rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  white-space: nowrap;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-width: 100%;
}

.word .before {
  text-align: right;
  justify-self: end;
}

.word .orp {
  color: var(--accent);
  text-align: center;
}

.word .after {
  text-align: left;
  justify-self: start;
}

.progress-container {
  width: 400px;
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  margin: 2rem auto 1rem;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.separator {
  opacity: 0.5;
}

.keyboard-hints {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.keyboard-hints.hidden {
  display: flex;
  opacity: 0;
}

.keyboard-hints.visible {
  opacity: 1;
}

/* Email state */
#email-state {
  width: 100%;
  max-width: 520px;
  text-align: left;
}

.pitch-text {
  margin-bottom: 2.5rem;
}

.pitch-text h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.pitch-text p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.pitch-text .highlight {
  color: var(--text);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  color: #000;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.download-btn:hover {
  background: rgba(255, 255, 255, 0.9);
}

.download-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.download-form {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.download-form input[type="email"] {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px !important;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.download-form input:focus {
  border-color: rgba(255, 255, 255, 0.3);
}

.download-form input::placeholder {
  color: var(--text-muted);
}

.download-icon {
  width: 16px;
  height: 16px;
}

.pitch-text a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pitch-text a:hover {
  opacity: 0.8;
}

.try-link {
  display: block;
  margin-top: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s ease;
}

.try-link:hover {
  color: var(--text);
}

.back-link {
  display: block;
  margin-top: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--text);
}

.email-form {
  display: flex;
  flex-direction: row;
  gap: 0;
  align-items: stretch;
}

#email-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-right: none;
  color: var(--text);
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  border-radius: 8px 0 0 8px;
  outline: none;
  transition: all 0.2s ease;
}

#email-input::placeholder {
  color: var(--text-muted);
}

#email-input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.submit-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  padding: 0.875rem 1.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 400;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.submit-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Custom text state */
#custom-state {
  width: 100%;
  max-width: 520px;
  text-align: center;
}

#custom-state h2 {
  font-size: 0.9rem;
  font-weight: 400;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.custom-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#custom-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  padding: 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.6;
  border-radius: 8px;
  outline: none;
  resize: none;
  min-height: 140px;
  transition: all 0.2s ease;
}

#custom-input::placeholder {
  color: var(--text-muted);
}

#custom-input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.custom-actions {
  display: flex;
  gap: 0.75rem;
}

.custom-form .submit-btn {
  border-radius: 8px;
  padding: 0.875rem 1.5rem;
  flex: 1;
}

.submit-btn.secondary {
  background: transparent;
  flex: 0 0 auto;
}

/* Read summary */
.read-summary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.read-summary #summary-wpm {
  color: var(--text);
  font-weight: 600;
}

.text-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}

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

/* Success state */
.success-icon {
  width: 64px;
  height: 64px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.5rem;
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.success-text {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.success-links {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.success-links a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.success-links a:hover {
  opacity: 0.8;
}

/* Paused indicator */
.paused-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.paused-indicator.visible {
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 640px) {
  .logo {
    font-size: 2rem;
  }
  
  .tagline {
    font-size: 1rem;
  }
  
  .word {
    font-size: 2.5rem;
  }
  
  .keyboard-hints {
    display: none !important;
  }
}

/* Download page */
.download-page {
  max-width: 480px;
  text-align: center;
}

.download-page h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

.download-btn {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  padding: 0.875rem 2rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.system-req {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.download-instructions {
  margin-top: 2.5rem;
  text-align: left;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.download-instructions p {
  margin-bottom: 0.75rem;
}

.download-instructions ol {
  margin: 0;
  padding-left: 1.25rem;
}

.download-instructions li {
  margin-bottom: 0.5rem;
}

.download-instructions code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.download-instructions kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.download-footer {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.8;
}

.download-footer a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.download-footer a:hover {
  opacity: 0.8;
}

/* Share button */
.share-btn {
  display: inline-block;
  margin-top: 2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
