/* ==========================================================================
   한글 타자속도 측정기 (typing-speed) - Haruism GDD Design System
   Path: utils/typing-speed/app.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Layout Container & Tool Stage Card
   -------------------------------------------------------------------------- */
.typing-app-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3.5rem;
  width: 100%;
  box-sizing: border-box;
}

.tool-stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 24px rgba(99, 102, 241, 0.06);
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
  box-sizing: border-box;
}

.tool-stage-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent));
}

/* --------------------------------------------------------------------------
   1. Header Section
   -------------------------------------------------------------------------- */
.tool-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--secondary-accent);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tool-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #FFFFFF 30%, #C7D2FE 80%, #67E8F9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.tool-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 650px;
  margin: 0 auto;
}

.tool-desc strong {
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   2. Difficulty Tab Bar (Touch Target >= 44px)
   -------------------------------------------------------------------------- */
.difficulty-tab-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.diff-tab-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  touch-action: manipulation;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.diff-tab-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.4);
}

.diff-tab-btn.active {
  background: var(--primary-accent);
  color: #FFFFFF;
  border-color: var(--primary-accent);
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* --------------------------------------------------------------------------
   3. Realtime Status Dashboard & Progress Bar
   -------------------------------------------------------------------------- */
.realtime-status-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.status-stat-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition-fast);
  box-sizing: border-box;
}

.status-stat-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(15, 23, 42, 0.85);
}

.status-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.status-value-group {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.status-number {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.status-unit {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

#stat-cpm {
  color: var(--secondary-accent);
}

#stat-accuracy {
  color: var(--highlight);
}

#stat-progress {
  color: var(--primary-accent);
}

#stat-time {
  color: #FCD34D;
}

.progress-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-full);
  margin-top: 0.5rem;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent));
  border-radius: var(--radius-full);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* --------------------------------------------------------------------------
   4. Target Text Viewport & Character Stream Typography
   -------------------------------------------------------------------------- */
.target-viewport-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}

.target-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.target-badge-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.badge-easy {
  background: rgba(16, 185, 129, 0.15);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-normal {
  background: rgba(59, 130, 246, 0.15);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-hard {
  background: rgba(239, 68, 68, 0.15);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-neutral {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.target-hint-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.target-text-viewport {
  min-height: 95px;
  max-height: 220px;
  overflow-y: auto;
  outline: none;
  padding-right: 0.35rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.target-text-viewport::-webkit-scrollbar {
  width: 4px;
}

.target-text-viewport::-webkit-scrollbar-track {
  background: transparent;
}

.target-text-viewport::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 2px;
}

.target-text-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

.target-text-stream {
  font-size: 1.35rem;
  line-height: 1.9;
  font-weight: 500;
  letter-spacing: 0.04em;
  word-break: break-all;
  user-select: none;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Character States */
.char-pending {
  color: #64748B;
  transition: color 0.12s ease, background 0.12s ease;
}

.char-correct {
  color: #34D399;
  background: rgba(16, 185, 129, 0.12);
  border-radius: 3px;
  padding: 0 1px;
}

.char-wrong {
  color: #F87171;
  background: rgba(239, 68, 68, 0.28);
  border-bottom: 2px solid #EF4444;
  border-radius: 3px;
  padding: 0 1px;
}

.char-current {
  color: #FFFFFF;
  background: rgba(99, 102, 241, 0.35);
  border-left: 2px solid var(--secondary-accent);
  border-radius: 3px;
  padding: 0 1px;
  animation: blink-cursor 1s infinite;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.char-composing {
  color: #FCD34D;
  background: rgba(245, 158, 11, 0.2);
  border-bottom: 2px solid #F59E0B;
  border-radius: 3px;
  padding: 0 1px;
}

@keyframes blink-cursor {
  0%, 100% {
    border-left-color: var(--secondary-accent);
    background-color: rgba(99, 102, 241, 0.45);
  }
  50% {
    border-left-color: transparent;
    background-color: rgba(99, 102, 241, 0.15);
  }
}

/* --------------------------------------------------------------------------
   5. User Input Textarea (iOS 16px Auto-zoom Prevention)
   -------------------------------------------------------------------------- */
.input-container {
  position: relative;
  width: 100%;
  margin-bottom: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.typing-textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.9rem 1.1rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1.05rem; /* Min 16px to prevent iOS auto-zoom */
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: var(--transition-fast);
  box-sizing: border-box;
}

.typing-textarea::placeholder {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.typing-textarea:focus {
  border-color: var(--primary-accent);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------------------------
   6. Realtime Hints Bar
   -------------------------------------------------------------------------- */
.typing-hints-bar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.hint-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}

kbd {
  font-family: 'Inter', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

/* --------------------------------------------------------------------------
   7. Toast Notification Notice (.toast-notice)
   -------------------------------------------------------------------------- */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--primary-accent);
  border-radius: var(--radius-full);
  padding: 0.75rem 1.4rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px var(--accent-glow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toast-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  pointer-events: none;
}

.toast-icon {
  font-size: 1.1rem;
}

.toast-text {
  font-size: 0.9rem;
}

@keyframes toast-slide-up {
  from {
    opacity: 0;
    transform: translate(-50%, 15px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

/* --------------------------------------------------------------------------
   8. Tool Control Bar (Touch Target >= 44px)
   -------------------------------------------------------------------------- */
.tool-control-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.ctrl-btn {
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
  flex: 1;
  min-width: 140px;
  touch-action: manipulation;
  border: 1px solid transparent;
  user-select: none;
}

.secondary-btn {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.secondary-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.4);
}

.primary-btn {
  background: var(--primary-accent);
  color: #FFFFFF;
  border-color: var(--primary-accent);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.primary-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.outline-btn {
  background: transparent;
  border-color: rgba(99, 102, 241, 0.4);
  color: #A5B4FC;
}

.outline-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.15);
  color: #FFFFFF;
}

.ctrl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.ctrl-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-icon {
  font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   9. Result Dashboard
   -------------------------------------------------------------------------- */
.result-dashboard {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 1.75rem;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 0 30px rgba(99, 102, 241, 0.15);
  animation: result-fade-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes result-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.result-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.result-label-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--highlight);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-heading {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.result-record-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.record-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  animation: badge-pop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes badge-pop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  70% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.badge-cpm {
  background: rgba(245, 158, 11, 0.18);
  color: #FCD34D;
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.badge-acc {
  background: rgba(16, 185, 129, 0.18);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

/* Result Metric Grid */
.result-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.metric-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  transition: var(--transition-fast);
  box-sizing: border-box;
}

.metric-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  background: rgba(15, 23, 42, 0.9);
}

.metric-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.metric-value-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

.metric-number {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  letter-spacing: -0.03em;
}

.metric-unit {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.metric-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.3;
}

#result-cpm {
  color: var(--secondary-accent);
}

#result-accuracy {
  color: var(--highlight);
}

#result-time {
  color: #A5B4FC;
}

#result-wrong-strokes {
  color: #F87171;
}

/* --------------------------------------------------------------------------
   10. Analysis Section: Weak Jamo Top 3 & Virtual Keyboard Heatmap
   -------------------------------------------------------------------------- */
.result-analysis-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

/* Weak Jamo Card */
.weak-jamo-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  box-sizing: border-box;
}

.weak-jamo-header {
  margin-bottom: 1rem;
}

.analysis-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  color: #FCD34D;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.analysis-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.analysis-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.weak-jamo-container {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.weak-jamo-chip {
  background: rgba(30, 41, 59, 0.9);
  border: 1.5px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-md);
  padding: 0.6rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: var(--transition-fast);
}

.weak-jamo-chip:hover {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.15);
  transform: translateY(-2px);
}

.jamo-char {
  font-size: 1.35rem;
  font-weight: 800;
  color: #FCA5A5;
}

.jamo-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: #FCD34D;
}

/* Keyboard Heatmap Card */
.keyboard-heatmap-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  box-sizing: border-box;
}

.heatmap-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.heatmap-title-box {
  display: flex;
  flex-direction: column;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-box {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid transparent;
}

/* 2-Set Virtual Keyboard Layout */
.virtual-keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: center;
  width: 100%;
  user-select: none;
  box-sizing: border-box;
}

.kb-row {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  width: 100%;
  max-width: 680px;
  box-sizing: border-box;
}

.kb-row-bottom {
  justify-content: center;
}

.key-cap {
  min-height: 44px;
  min-width: 0;
  flex: 1;
  max-width: 58px;
  border-radius: var(--radius-sm);
  font-family: 'Pretendard', sans-serif;
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.15s ease;
  padding: 0.25rem 0.1rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  touch-action: manipulation;
  box-sizing: border-box;
}

.key-main {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.1;
}

.key-shift {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
}

.key-space {
  max-width: 280px;
  flex: 3;
  min-height: 40px;
}

.key-space .key-main {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Heatmap Levels */
.key-heat-0 {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(148, 163, 184, 0.18);
  color: var(--text-primary);
}

.key-heat-1 {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.55);
  color: #FDE68A;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.key-heat-2 {
  background: rgba(249, 115, 22, 0.32);
  border-color: rgba(249, 115, 22, 0.75);
  color: #FDBA74;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.35);
}

.key-heat-3 {
  background: rgba(239, 68, 68, 0.42);
  border-color: #EF4444;
  color: #FECACA;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.55);
  font-weight: 800;
}

/* Compound Jamo Subgroup */
.compound-jamo-subgroup {
  width: 100%;
  max-width: 680px;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
  box-sizing: border-box;
}

.compound-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.compound-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.compound-chips-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.compound-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 55px;
}

.key-chip {
  min-height: 32px;
  min-width: 34px;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-primary);
  cursor: default;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   11. Result Action Bar (Touch Target >= 44px)
   -------------------------------------------------------------------------- */
.result-action-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.act-btn {
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
  flex: 1;
  min-width: 140px;
  touch-action: manipulation;
  border: 1px solid transparent;
  user-select: none;
}

.accent-btn {
  background: linear-gradient(135deg, #06B6D4 0%, #0891B2 100%);
  color: #FFFFFF;
  border-color: var(--secondary-accent);
  box-shadow: 0 4px 14px var(--cyan-glow);
}

.accent-btn:hover {
  background: linear-gradient(135deg, #22D3EE 0%, #06B6D4 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--cyan-glow);
}

.act-btn:active {
  transform: scale(0.98);
}

/* --------------------------------------------------------------------------
   12. History Accordion (.history-accordion)
   -------------------------------------------------------------------------- */
.history-accordion {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition-fast);
}

.history-accordion[open] {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(15, 23, 42, 0.75);
}

.history-summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  user-select: none;
  list-style: none;
}

.history-summary::-webkit-details-marker {
  display: none;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.summary-icon {
  font-size: 1.15rem;
}

.summary-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.history-count-badge {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--secondary-accent);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.history-content-panel {
  padding: 0 1.25rem 1.25rem;
}

.history-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.history-table th {
  padding: 0.6rem 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.4);
}

.history-table td {
  padding: 0.65rem 0.75rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.history-empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem !important;
}

.history-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.history-storage-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-clear-btn {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 36px;
}

.history-clear-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #EF4444;
  color: #FFFFFF;
}

/* --------------------------------------------------------------------------
   13. SEO Guide & Help Article Styling (#guide / .guide-content)
   -------------------------------------------------------------------------- */
.guide-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  margin-top: 2rem;
  color: var(--text-secondary);
  line-height: 1.8;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.guide-content h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 2.2rem;
  margin-bottom: 1rem;
  line-height: 1.35;
  background: linear-gradient(135deg, #FFFFFF 20%, #C7D2FE 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.guide-content h2:first-of-type {
  margin-top: 0;
}

.guide-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--secondary-accent);
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
}

.guide-content p {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  word-break: keep-all;
  line-height: 1.75;
}

.guide-content ul,
.guide-content ol {
  margin-left: 1.3rem;
  margin-bottom: 1.25rem;
}

.guide-content li {
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
  line-height: 1.7;
}

.guide-content strong {
  color: var(--text-primary);
}

.guide-content code {
  font-family: 'Inter', monospace;
  font-size: 0.85rem;
  color: #FCD34D;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.formula-callout {
  background: rgba(15, 23, 42, 0.75);
  border-left: 4px solid var(--primary-accent);
  padding: 1.1rem 1.3rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.25rem 0;
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.formula-callout strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.formula-callout code {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.9rem;
  background: rgba(30, 41, 59, 0.8);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  color: #A5B4FC;
}

/* FAQ Items */
.faq-accordion-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

.faq-item {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.3rem;
  transition: var(--transition-fast);
}

.faq-item:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(15, 23, 42, 0.7);
}

.faq-question {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.faq-answer p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 0;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   14. Responsive Layout (Mobile-First 360px ~ 430px Zero Horizontal Scroll)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .typing-app-container {
    padding: 1rem 0.75rem 2.5rem;
  }

  .tool-stage-card {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }

  .tool-title {
    font-size: 1.55rem;
  }

  .tool-desc {
    font-size: 0.88rem;
  }

  .realtime-status-board {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .result-metric-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .result-dashboard {
    padding: 1.25rem;
  }

  .guide-content {
    padding: 1.5rem 1.2rem;
  }
}

@media (max-width: 640px) {
  .realtime-status-board {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .status-stat-card {
    padding: 0.75rem 0.85rem;
  }

  .status-number {
    font-size: 1.35rem;
  }

  .target-viewport-card {
    padding: 1rem;
  }

  .target-text-stream {
    font-size: 1.18rem;
    line-height: 1.8;
  }

  .tool-control-bar,
  .result-action-bar {
    flex-direction: column;
    gap: 0.5rem;
  }

  .ctrl-btn,
  .act-btn {
    width: 100%;
    min-width: 100%;
    min-height: 46px;
  }

  .weak-jamo-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .weak-jamo-chip {
    width: 100%;
    justify-content: space-between;
    box-sizing: border-box;
  }

  .heatmap-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .virtual-keyboard {
    gap: 0.3rem;
  }

  .kb-row {
    gap: 0.25rem;
  }

  .key-cap {
    min-height: 38px;
    padding: 0.2rem 0;
  }

  .key-main {
    font-size: 0.85rem;
  }

  .key-shift {
    font-size: 0.65rem;
  }

  .key-space {
    max-width: 200px;
  }

  .compound-chips-wrap {
    gap: 0.25rem;
  }

  .key-chip {
    min-width: 28px;
    min-height: 28px;
    font-size: 0.78rem;
    padding: 0.15rem 0.35rem;
  }

  .diff-tab-btn {
    min-height: 44px;
    font-size: 0.82rem;
    padding: 0.45rem 0.85rem;
  }
}

/* Small Smartphone Viewports (360px ~ 390px) */
@media (max-width: 400px) {
  .typing-app-container {
    padding: 0.75rem 0.5rem 2rem;
  }

  .tool-stage-card {
    padding: 1rem 0.75rem;
  }

  .tool-title {
    font-size: 1.35rem;
  }

  .status-number {
    font-size: 1.2rem;
  }

  .metric-number {
    font-size: 1.5rem;
  }

  .target-text-stream {
    font-size: 1.1rem;
  }

  .kb-row {
    gap: 0.18rem;
  }

  .key-cap {
    min-height: 36px;
    padding: 0.15rem 0;
  }

  .key-main {
    font-size: 0.78rem;
  }

  .key-shift {
    font-size: 0.6rem;
  }

  .toast-notice {
    width: 90%;
    justify-content: center;
    font-size: 0.82rem;
    padding: 0.65rem 1rem;
  }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  .char-current {
    animation: none;
    border-left-color: var(--secondary-accent);
  }

  .progress-bar-fill,
  .ctrl-btn,
  .act-btn,
  .status-stat-card,
  .metric-card,
  .key-cap,
  .key-chip {
    transition: none !important;
  }

  .result-dashboard,
  .record-badge,
  .toast-notice {
    animation: none !important;
  }
}
