/* ============================================================
   英文字母模組 — 互動版樣式
   Layout 與注音模組一致，色系改為藍色系
   ============================================================ */

/* --- 全螢幕容器 --- */
.eng-i-game {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--gradient-english, linear-gradient(180deg, #E0F2FE, #fff));
  overflow: hidden;
  position: relative;
}

/* --- Splash --- */
.eng-i-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  gap: var(--space-xl);
  padding: var(--space-lg);
  text-align: center;
  background: var(--gradient-english, linear-gradient(180deg, #E0F2FE, #fff));
}

.eng-i-splash-icon {
  font-size: 80px;
  animation: engIBounceFloat 1.5s ease-in-out infinite;
}

.eng-i-splash-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: #2563EB;
}

.eng-i-splash-btn {
  min-width: 200px;
  min-height: var(--touch-target-min);
  padding: var(--space-md) 48px;
  font-size: 1.3rem;
}

/* --- Header --- */
.eng-i-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  padding-top: max(var(--space-sm), env(safe-area-inset-top, 0px));
  flex-shrink: 0;
}

.eng-i-progress {
  display: flex;
  gap: 6px;
  align-items: center;
}

.eng-i-progress-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #93C5FD;
  background: transparent;
  transition: background 300ms, border-color 300ms;
}

.eng-i-progress-dot.done {
  background: #3B82F6;
  border-color: #3B82F6;
}

.eng-i-progress-dot.current {
  border-color: #2563EB;
  background: #BFDBFE;
}

.eng-i-exit-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white, #fff);
  border: 2px solid #93C5FD;
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  color: #2563EB;
  font-size: 20px;
  transition: transform 200ms ease-out, box-shadow 200ms ease-out;
  -webkit-tap-highlight-color: transparent;
}

.eng-i-exit-btn:active {
  transform: scale(0.92);
}

/* --- 目標字母區 --- */
.eng-i-target-area {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md, 16px);
  padding: var(--space-md, 16px);
}

.eng-i-target-card {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.eng-i-target-letter {
  font-family: 'Arial Rounded MT Bold', 'Nunito', var(--font-display, sans-serif);
  font-size: 64px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.eng-i-replay-btn {
  width: 56px;
  height: 56px;
  min-width: var(--touch-target-min, 44px);
  min-height: var(--touch-target-min, 44px);
  border: none;
  border-radius: 50%;
  background: #F97316;
  color: #fff;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  transition: transform 200ms ease-out, box-shadow 200ms ease-out;
  -webkit-tap-highlight-color: transparent;
}

.eng-i-replay-btn:active {
  transform: scale(0.92);
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.2);
}

/* --- 字卡選項區 --- */
.eng-i-options-area {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: var(--space-md, 16px);
  padding: var(--space-md, 16px);
  align-content: center;
}

.eng-i-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 120px;
  padding: var(--space-md, 16px) var(--space-sm, 8px);
  border: 3px solid #BFDBFE;
  border-radius: var(--radius-lg, 16px);
  background: var(--color-white, #fff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 200ms ease-out, box-shadow 200ms ease-out;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.eng-i-option-card:active {
  transform: translate(1px, 1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.eng-i-option-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  line-height: 1;
}

.eng-i-option-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.eng-i-option-emoji {
  font-size: 36px;
  line-height: 1;
}

.eng-i-option-letter {
  font-family: 'Arial Rounded MT Bold', 'Nunito', var(--font-display, sans-serif);
  font-size: 42px;
  font-weight: 800;
  color: #2563EB;
  line-height: 1;
}

.eng-i-option-word {
  font-family: var(--font-text, sans-serif);
  font-size: 13px;
  color: var(--color-text, #3d3229);
  opacity: 0.7;
  line-height: 1.2;
}

/* 正確 */
.eng-i-option-card.correct {
  border-color: var(--color-cta, #4CAF50);
  background: #DCFCE7;
  animation: engIBounce 500ms ease-out;
}

/* 錯誤 */
.eng-i-option-card.wrong {
  animation: engIShake 400ms ease-out;
}

/* 停用 */
.eng-i-option-card.disabled {
  pointer-events: none;
  opacity: 0.4;
}

/* --- 爸媽提示 --- */
.eng-i-parent-hint {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0px);
  left: 0;
  right: 0;
  padding: 6px 16px;
  background: rgba(224, 242, 254, 0.9);
  font-size: 13px;
  font-family: var(--font-text, sans-serif);
  color: var(--color-text, #3d3229);
  text-align: center;
  opacity: 0.6;
  pointer-events: none;
  z-index: 50;
}

/* --- 慶祝覆蓋層 --- */
.eng-i-celebration-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(224, 242, 254, 0.95);
  z-index: 100;
  gap: var(--space-lg, 24px);
  animation: engIFadeIn 300ms ease-out;
}

.eng-i-celebration-emoji {
  font-size: 100px;
  animation: engICelebrate 1s ease-out;
}

.eng-i-celebration-text {
  font-family: var(--font-display, sans-serif);
  font-size: 2rem;
  color: #2563EB;
  text-align: center;
}

.eng-i-celebration-sub {
  font-family: var(--font-text, sans-serif);
  font-size: 1.2rem;
  color: var(--color-text, #3d3229);
  opacity: 0.8;
}

.eng-i-star {
  position: absolute;
  font-size: 24px;
  color: #F59E0B;
  animation: engIStarBurst 1s ease-out forwards;
  pointer-events: none;
}

/* --- 最終慶祝 --- */
.eng-i-final-celebration {
  gap: var(--space-xl, 32px);
}

.eng-i-final-emoji {
  font-size: 120px;
  animation: engICelebrate 1.2s ease-out;
}

.eng-i-final-btn {
  min-width: 180px;
  min-height: var(--touch-target-min, 44px);
  font-size: 1.2rem;
}

/* ============================================================
   動畫
   ============================================================ */

@keyframes engIBounceFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes engIBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); }
  50% { transform: scale(0.95); }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes engIShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@keyframes engICelebrate {
  0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  50% { transform: scale(1.2) rotate(5deg); opacity: 1; }
  70% { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes engIStarBurst {
  0% {
    transform: translate(0, 0) scale(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--star-tx), var(--star-ty)) scale(1.2) rotate(360deg);
    opacity: 0;
  }
}

@keyframes engIFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 減少動態偏好 */
@media (prefers-reduced-motion: reduce) {
  .eng-i-splash-icon,
  .eng-i-option-card,
  .eng-i-celebration-emoji,
  .eng-i-final-emoji,
  .eng-i-star {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
