/* Hancom Taja Official Web Style 4-Stage Typing Practice Styles */

.typing-container {
  max-width: 980px;
  margin: 1.5rem auto 3.5rem;
}

/* 4-Stage Tab Bar */
.typing-stage-tabs {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  margin-bottom: 2rem;
  overflow-x: auto;
  gap: 0.35rem;
  scrollbar-width: none;
}

.stage-tab-btn {
  flex: 1;
  min-width: 130px;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.stage-tab-btn:hover {
  color: var(--text-primary);
}

.stage-tab-btn.active {
  background: var(--brand-black);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Sub-selection / Stage pills */
.substage-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0 1.25rem;
  scrollbar-width: thin;
}

.substage-pill {
  flex-shrink: 0;
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.substage-pill:hover, .substage-pill.active {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #1D4ED8;
}

/* Main Typing Arena Card */
.typing-arena-card {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  position: relative;
}

/* Realtime Metrics HUD */
.typing-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
}

.hud-stat-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.hud-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.hud-value {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.1;
}

.hud-unit {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.2rem;
}

/* ============================================================
   Stage 1: Key Placement Practice (자리 연습)
============================================================ */
.key-practice-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0 2rem;
}

.key-spotlight-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
}

.key-big-bubble {
  width: 110px;
  height: 110px;
  border-radius: 28px;
  background: linear-gradient(135deg, #111827 0%, #1F2937 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.25);
  margin-bottom: 1rem;
  transition: transform 0.1s ease;
}

.key-big-bubble.flash-green {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  transform: scale(1.08);
}

.key-big-bubble.flash-red {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  transform: scale(0.95);
}

.key-finger-guide-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 700;
}

/* ============================================================
   Stage 2, 3, 4: Visible-Input Hancom Taja Official Web Style
============================================================ */
.hancom-typing-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

/* Target Sentence Box Above */
.hancom-target-box {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: 0.02em;
  color: #64748B;
  min-height: 80px;
}

.char {
  position: relative;
  transition: color 0.1s ease, background-color 0.1s ease;
}

.char.correct {
  color: #059669;
  font-weight: 800;
}

.char.incorrect {
  color: #DC2626;
  background-color: #FEE2E2;
  border-radius: 3px;
  font-weight: 800;
}

.char.active-cursor {
  color: #1D4ED8;
  border-bottom: 3px solid #3B82F6;
  font-weight: 800;
}

.char.composing {
  color: #2563EB;
  background-color: #EFF6FF;
  border-bottom: 3px solid #60A5FA;
  border-radius: 3px;
  font-weight: 800;
}

.char.pending {
  color: #94A3B8;
}

/* Large Visible Input Field Below */
.hancom-real-input {
  width: 100%;
  padding: 1.15rem 1.5rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: #0F172A;
  background: #FFFFFF;
  border: 2px solid #3B82F6;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.15);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hancom-real-input:focus {
  border-color: #1D4ED8;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
}

.hancom-real-input::placeholder {
  font-size: 1.1rem;
  font-weight: 500;
  color: #94A3B8;
}

.typing-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 1rem;
}

.typing-progress-fill {
  height: 100%;
  background: var(--color-blue);
  width: 0%;
  transition: width 0.15s ease;
}

/* Visual Keyboard Guide */
.keyboard-guide-card {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.keyboard-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.keyboard-layout {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 760px;
  margin: 0 auto;
  user-select: none;
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.kb-key {
  height: 44px;
  min-width: 44px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  box-shadow: 0 2px 0 #D1D5DB;
  transition: all 0.1s ease;
}

.kb-key.wide { min-width: 70px; font-size: 0.75rem; }
.kb-key.space { min-width: 260px; }

.kb-key.target-glow {
  background: #10B981 !important;
  color: #FFFFFF !important;
  border-color: #059669 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.6) !important;
  transform: translateY(1px);
}

.kb-key.home-row {
  border-bottom: 3px solid #94A3B8;
}

.kb-sub {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .typing-hud {
    grid-template-columns: repeat(2, 1fr);
  }
  .hancom-target-box {
    font-size: 1.25rem;
  }
  .hancom-real-input {
    font-size: 1.15rem;
  }
  .kb-key {
    height: 36px;
    min-width: 28px;
    font-size: 0.75rem;
  }
  .kb-key.space {
    min-width: 140px;
  }
}
