/* 拼字測驗 — 主頁分頁樣式 */

.spelling-panel {
  max-width: 640px;
  margin: 0 auto;
}

.spelling-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 560px) {
  .spelling-hero {
    flex-direction: column;
    align-items: stretch;
  }
}

.spelling-accent-rose {
  color: #e11d48;
}

.spelling-accent-sky {
  color: #0284c7;
}

.spelling-status {
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.spelling-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.spelling-hearts {
  display: flex;
  gap: 0.35rem;
  font-size: 1.6rem;
}

.spelling-progress-label {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
}

.spelling-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.spelling-progress-fill {
  height: 100%;
  width: 10%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fbbf24, #f472b6, #8b5cf6);
  transition: width 0.45s ease;
}

.spelling-card {
  padding: 1.5rem 1.25rem;
}

.spelling-card-pop {
  animation: spelling-pop 0.35s ease;
}

.spelling-card-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  position: relative;
}

.spelling-card-eyebrow {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7c3aed;
}

.spelling-card-top .btn-star {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.spelling-card-top .btn-star:hover {
  transform: translateY(-50%) scale(1.08);
}

.spelling-definition-box {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1rem;
  border-radius: 16px;
  text-align: center;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.spelling-definition {
  margin: 0;
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  font-weight: 700;
  line-height: 1.45;
  color: #92400e;
}

.spelling-speak-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.btn-spelling-speak {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 1.75rem;
  border: none;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #38bdf8, #0ea5e9);
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-spelling-speak:hover {
  transform: scale(1.04);
  box-shadow: 0 14px 28px rgba(14, 165, 233, 0.4);
}

.btn-spelling-speak:active {
  transform: scale(0.97);
}

.btn-spelling-speak-icon {
  font-size: 2rem;
  line-height: 1;
}

.spelling-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

@media (min-width: 520px) {
  .spelling-options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.spelling-option {
  padding: 0.95rem 1rem;
  border: 2px solid #c4b5fd;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: #3730a3;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(180deg, #fff, #f5f3ff);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.1);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.spelling-option:hover:not(:disabled) {
  transform: scale(1.02);
  border-color: #8b5cf6;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.16);
}

.spelling-feedback {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
}

.spelling-summary {
  padding: 1.75rem 1.5rem;
  text-align: center;
}

.spelling-summary-emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.spelling-summary-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--primary, #4f46e5);
}

.spelling-summary-desc {
  margin: 0 0 1.25rem;
  color: var(--text-muted, #64748b);
}

.spelling-option:disabled {
  cursor: default;
}

.spelling-option.option-correct {
  border-color: #10b981 !important;
  background: linear-gradient(to bottom, #d1fae5, #a7f3d0) !important;
  color: #065f46 !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35) !important;
  transform: scale(1.03);
}

.spelling-option.option-wrong {
  border-color: #f87171 !important;
  background: linear-gradient(to bottom, #fee2e2, #fecaca) !important;
  color: #991b1b !important;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3) !important;
  animation: shake-wrong 0.45s ease;
}

.spelling-option.option-reveal-correct {
  border-color: #059669 !important;
  background: linear-gradient(to bottom, #6ee7b7, #34d399) !important;
  color: #064e3b !important;
  box-shadow:
    0 0 0 4px rgba(16, 185, 129, 0.35),
    0 12px 28px rgba(5, 150, 105, 0.35) !important;
  transform: scale(1.05);
  animation: pulse-correct 0.8s ease infinite;
}

#spelling-feedback.feedback-ok {
  background: linear-gradient(to right, #d1fae5, #a7f3d0);
  color: #065f46;
  border: 2px solid #6ee7b7;
}

#spelling-feedback.feedback-bad {
  background: linear-gradient(to right, #fee2e2, #fecaca);
  color: #991b1b;
  border: 2px solid #fca5a5;
}

.heart-alive {
  display: inline-block;
  animation: heart-beat 1.2s ease infinite;
}

.heart-lost {
  opacity: 0.45;
  filter: grayscale(1);
}

@keyframes spelling-pop {
  0% {
    transform: scale(0.98);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes shake-wrong {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}

@keyframes pulse-correct {
  0%,
  100% {
    box-shadow:
      0 0 0 4px rgba(16, 185, 129, 0.35),
      0 12px 28px rgba(5, 150, 105, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(16, 185, 129, 0.25),
      0 14px 32px rgba(5, 150, 105, 0.45);
  }
}

@keyframes heart-beat {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}
