/* Fairway Friends Read-Along: stylesheet
   Mobile-first. Vanilla CSS, no preprocessor. */

:root {
  --theme-color: #3a7d44;
  --theme-color-dark: #2a5a32;
  --bg: #faf6ee;
  --ink: #1a1a1a;
  --ink-soft: #555;
  --card-bg: #ffffff;
  --error-bg: #fde8e8;
  --error-ink: #8a1a1a;
  --shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  cursor: pointer;
}

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

.hidden {
  display: none !important;
}

/* ---------- Splash ---------- */

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  z-index: 10;
  text-align: center;
  transition: opacity 250ms ease;
}

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

.splash-cover {
  width: min(80vw, 420px);
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  background: #eee;
}

.splash-title {
  font-size: 28px;
  margin: 0 0 4px;
  line-height: 1.2;
}

.splash-author {
  margin: 0 0 32px;
  color: var(--ink-soft);
  font-style: italic;
}

.splash-status {
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 14px;
  min-height: 1.2em;
}

/* ---------- Buttons ---------- */

.big-button {
  background: var(--theme-color);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
  box-shadow: var(--shadow);
  text-decoration: none;
  display: inline-block;
  transition: transform 100ms ease, background 200ms ease;
}

.big-button:active {
  transform: scale(0.98);
}

.big-button:hover {
  background: var(--theme-color-dark);
}

.big-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-button {
  display: inline-block;
  margin-top: 12px;
  color: var(--theme-color);
  font-weight: 600;
  text-decoration: underline;
}

/* ---------- Player view ---------- */

.player-view {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow: hidden;
}

.page-stage {
  position: absolute;
  inset: 0 0 56px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.page-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 200ms ease;
}

.page-canvas.hidden {
  opacity: 0;
  pointer-events: none;
}

.audio-missing {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

/* Tap zones overlay the page. They are transparent buttons. */
.tap-zone {
  position: absolute;
  top: 0;
  bottom: 56px;
  width: 33.34%;
  background: transparent;
  border: none;
  outline: none;
  z-index: 2;
}

.tap-zone-left { left: 0; }
.tap-zone-mid  { left: 33.33%; }
.tap-zone-right { right: 0; }

.toolbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  z-index: 3;
}

.page-indicator {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-size: 14px;
}

.toolbar-button {
  background: transparent;
  border: 1px solid var(--theme-color);
  color: var(--theme-color);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  margin-left: 8px;
}

.toolbar-button-primary {
  background: var(--theme-color);
  color: white;
  border-color: var(--theme-color);
}

/* ---------- Welcome ---------- */

.welcome {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100%;
  padding: 32px 16px;
}

.welcome-card {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.welcome-cover {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 16px;
  margin: 0 auto 20px;
  background: #eee;
  box-shadow: var(--shadow);
}

.welcome-title {
  font-size: 24px;
  margin: 0 0 12px;
}

.welcome-blurb {
  color: var(--ink-soft);
  margin: 0 0 24px;
  line-height: 1.5;
}

.welcome-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-section {
  border: 1px solid #e6e1d5;
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-section legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-color);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-hint {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-soft);
}

.field input[type="text"],
.field input[type="email"] {
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid #d4d0c5;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}

.field input:focus {
  outline: 2px solid var(--theme-color);
  outline-offset: 1px;
  border-color: var(--theme-color);
}

.field-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.field-checkbox input {
  margin-top: 3px;
  flex-shrink: 0;
}

.welcome-form .big-button {
  margin-top: 8px;
  align-self: stretch;
}

.welcome-error {
  background: var(--error-bg);
  color: var(--error-ink);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.welcome-status {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 14px;
  min-height: 1.2em;
}

/* ---------- Paywall ---------- */

.paywall {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 32px 16px;
}

.paywall-card {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.paywall-cover {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 16px;
  margin: 0 auto 20px;
  background: #eee;
  box-shadow: var(--shadow);
}

.paywall-title {
  font-size: 22px;
  margin: 0 0 14px;
  line-height: 1.3;
}

.paywall-blurb {
  color: var(--ink-soft);
  margin: 0 0 24px;
  line-height: 1.5;
}

/* ---------- Landscape adjustments ---------- */

@media (orientation: landscape) and (max-height: 500px) {
  .splash-cover { width: 30vw; }
  .splash-title { font-size: 22px; }
  .splash-author { margin-bottom: 16px; }
}
