/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ── Views ─────────────────────────────────────────────────────────────── */
.view { display: none !important; }
.view.active { display: flex !important; flex-direction: column; }
#view-dashboard.active,
#view-new-text.active,
#view-learn.active,
#view-validate.active { display: block !important; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  background: #c0392b;
  color: white;
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(192, 57, 43, 0.3);
}
.btn-primary:hover { background: #a93226; }
.btn-primary:active { transform: scale(0.97); box-shadow: 0 2px 8px rgba(192, 57, 43, 0.2); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: #fdf6f0;
  color: #2d1b0e;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid rgba(45, 27, 14, 0.12);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: #f5e6d8; border-color: rgba(45,27,14,0.2); }
.btn-secondary:active { transform: scale(0.97); }

/* ── Auth tabs ─────────────────────────────────────────────────────────── */
.auth-tab {
  color: rgba(45, 27, 14, 0.4);
  background: transparent;
  border: none;
  cursor: pointer;
}
.auth-tab.active {
  background: white;
  color: #2d1b0e;
  box-shadow: 0 1px 8px rgba(0,0,0,0.08);
}

/* ── Format buttons ────────────────────────────────────────────────────── */
.format-btn {
  border-color: rgba(45,27,14,0.12);
  background: white;
  cursor: pointer;
  color: #2d1b0e;
}
.format-btn.active {
  border-color: #c0392b;
  background: rgba(192,57,43,0.05);
  color: #c0392b;
}

/* ── Input tabs ────────────────────────────────────────────────────────── */
.input-tab {
  color: rgba(45, 27, 14, 0.4);
  background: transparent;
  border: none;
  cursor: pointer;
}
.input-tab.active {
  background: white;
  color: #2d1b0e;
  box-shadow: 0 1px 8px rgba(0,0,0,0.08);
}

/* ── Text card ─────────────────────────────────────────────────────────── */
.text-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  border: 1.5px solid rgba(45,27,14,0.07);
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.text-card:hover { border-color: rgba(192,57,43,0.3); box-shadow: 0 4px 16px rgba(192,57,43,0.1); }
.text-card:active { transform: scale(0.99); }

.text-card-progress {
  height: 3px;
  background: rgba(45,27,14,0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}
.text-card-progress-fill {
  height: 100%;
  background: linear-gradient(to right, #c0392b, #e74c3c);
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* ── Learn view — sentences ────────────────────────────────────────────── */
.sentence-container {
  transition: all 0.4s ease;
}
.sentence-text {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  line-height: 1.65;
  color: #2d1b0e;
  transition: filter 0.5s ease, opacity 0.5s ease;
}
.sentence-text.blurred {
  filter: blur(6px);
  opacity: 0.5;
  user-select: none;
}
.sentence-text.hidden-sentence {
  filter: blur(10px);
  opacity: 0.15;
  user-select: none;
}
.sentence-reveal-enter {
  animation: sentenceReveal 0.4s ease forwards;
}
@keyframes sentenceReveal {
  from { opacity: 0; transform: translateY(8px); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

/* ── Paragraph separator ───────────────────────────────────────────────── */
.paragraph-block {
  padding: 16px 0;
  border-bottom: 1px solid rgba(45,27,14,0.06);
}
.paragraph-block:last-child { border-bottom: none; }
.paragraph-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(45,27,14,0.25);
  margin-bottom: 10px;
}

/* ── Validate view — word-level blur ───────────────────────────────────── */
.val-word {
  display: inline;
  transition: filter 0.3s ease, color 0.3s ease;
}
.val-word.blurred {
  filter: blur(5px);
  color: transparent;
  text-shadow: 0 0 8px rgba(45,27,14,0.4);
  user-select: none;
}
.val-word.revealed {
  filter: none;
  color: inherit;
  text-shadow: none;
}

/* ── OTP inputs ────────────────────────────────────────────────────────── */
.otp-input {
  caret-color: #c0392b;
}
.otp-input.filled {
  border-color: #c0392b;
  background: rgba(192,57,43,0.04);
}

/* ── Dictation pulse ───────────────────────────────────────────────────── */
@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.4); }
  50%       { box-shadow: 0 0 0 12px rgba(192,57,43,0); }
}
.btn-recording {
  background: #c0392b !important;
  color: white !important;
  animation: pulse-mic 1.5s ease-in-out infinite;
}

/* ── Strength bars ─────────────────────────────────────────────────────── */
.strength-bar.s1 { background: #e74c3c; }
.strength-bar.s2 { background: #f39c12; }
.strength-bar.s3 { background: #2ecc71; }
.strength-bar.s4 { background: #27ae60; }

.req.met { color: #27ae60; }
.req.met::first-letter { }

/* ── Toast ─────────────────────────────────────────────────────────────── */
#toast.show {
  display: block;
  animation: toastIn 0.2s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ── Chest overlay ─────────────────────────────────────────────────────── */
#chest-overlay {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#chest-emoji.open {
  animation: chestOpen 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes chestOpen {
  0%   { transform: scale(1) rotate(0deg); }
  30%  { transform: scale(1.3) rotate(-10deg); }
  60%  { transform: scale(0.9) rotate(5deg); }
  100% { transform: scale(1.1) rotate(0deg); }
}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(45,27,14,0.15); border-radius: 4px; }

/* ── Safe area (iPhone notch) ──────────────────────────────────────────── */
.pb-safe { padding-bottom: env(safe-area-inset-bottom, 16px); }
