/* ═══════════════════════════════════════════════════════════
   MORSE CODE PAGE — morse.css
   ═══════════════════════════════════════════════════════════ */

/* ── HERO ── */
.morse-hero {
  position: relative;
  overflow: hidden;
  padding: 80px 0 60px;
  background: linear-gradient(180deg, rgba(0,212,255,.06) 0%, transparent 60%);
}
.morse-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.morse-hero-pattern {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  flex-wrap: nowrap;
  opacity: .12;
}
.morse-bit {
  flex-shrink: 0;
  height: 3px;
  border-radius: 99px;
  background: var(--cyan);
  animation: morsePulse 3s ease-in-out infinite;
}
.morse-bit.dot  { width: 8px; }
.morse-bit.dash { width: 24px; }
.morse-bit.gap  { width: 14px; background: transparent; }
@keyframes morsePulse {
  0%,100% { opacity: .4; }
  50%      { opacity: 1; }
}

.morse-hero-inner { position: relative; z-index: 2; text-align: center; }
.morse-hero-icon {
  width: 80px; height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 2px solid rgba(0,212,255,.3);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 40px rgba(0,212,255,.2);
  animation: heroGlow 3s ease-in-out infinite;
}
@keyframes heroGlow {
  0%,100% { box-shadow: 0 0 30px rgba(0,212,255,.2); }
  50%      { box-shadow: 0 0 60px rgba(0,212,255,.4); }
}
.morse-hero-icon svg { color: var(--cyan); }

.morse-hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 12px;
}
.morse-hero-title span { color: var(--cyan); text-shadow: 0 0 30px rgba(0,212,255,.4); }
.morse-hero-sub { color: var(--text2); font-size: 1.05rem; margin-bottom: 36px; }

/* Live signal LED bar */
.morse-signal-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 50px;
  padding: 8px 20px;
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--text2);
  margin-bottom: 36px;
}
.signal-led {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: ledBlink 1s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes ledBlink { 0%,100% { opacity: 1; } 50% { opacity: .2; } }

.morse-hero-text-display {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--cyan);
  letter-spacing: 4px;
  min-width: 180px;
}

/* Hero stats */
.morse-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}
.morse-stat {
  text-align: center;
  padding: 16px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 120px;
  transition: border-color .2s, transform .2s;
}
.morse-stat:hover { border-color: rgba(0,212,255,.4); transform: translateY(-3px); }
.morse-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--cyan);
  font-family: var(--mono);
  line-height: 1;
}
.morse-stat-lbl {
  font-size: .75rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ── SECTION HEADER ── */
.morse-section { padding: 40px 0; }
.morse-section-hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.morse-section-hdr h2 {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text2);
  margin: 0;
}
.morse-section-hdr .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  flex-shrink: 0;
}

/* ── INFO CARDS ── */
.morse-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.morse-info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color .2s, transform .2s;
}
.morse-info-card:hover { border-color: rgba(0,212,255,.35); transform: translateY(-3px); }
.mic-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--cyan-dim);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  color: var(--cyan);
}
.mic-title { font-weight: 700; font-size: .95rem; margin-bottom: 8px; }
.mic-body  { font-size: .88rem; color: var(--text2); line-height: 1.6; }
.mic-body strong { color: var(--cyan); font-family: var(--mono); }

/* ── ALPHABET GRID ── */
.morse-alpha-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.alpha-filter-btn {
  padding: 6px 16px;
  border-radius: 50px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1),
              box-shadow .2s ease, background .18s, border-color .18s, color .18s;
  position: relative; overflow: hidden;
}
.alpha-filter-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 4px 14px rgba(0,212,255,.18), inset 0 0 0 1px rgba(0,212,255,.15);
}
.alpha-filter-btn:active { transform: scale(.94) !important; transition: transform .08s !important; }
.alpha-filter-btn.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
}

.morse-alpha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}
.alpha-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.alpha-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cyan-dim);
  opacity: 0;
  transition: opacity .18s;
}
.alpha-card:hover::before { opacity: 1; }
.alpha-card:hover { border-color: rgba(0,212,255,.5); transform: scale(1.05); }
.alpha-card.playing {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0,212,255,.3);
  animation: cardPing .6s ease-out;
}
@keyframes cardPing {
  0%   { box-shadow: 0 0 0 0 rgba(0,212,255,.5); }
  100% { box-shadow: 0 0 0 16px rgba(0,212,255,0); }
}
.alpha-char {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  display: block;
  line-height: 1;
}
.alpha-morse {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--cyan);
  margin-top: 5px;
  letter-spacing: 2px;
  display: block;
}
.alpha-dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 7px;
  min-height: 8px;
}
.alpha-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); opacity: .5; flex-shrink: 0; }
.alpha-dash { width: 16px; height: 6px; border-radius: 3px; background: var(--cyan); opacity: .5; flex-shrink: 0; }

/* ── CONVERTER PANEL ── */
.morse-converter-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.converter-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s;
}
.converter-panel:hover { border-color: var(--border2); }
.conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.2);
}
.conv-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: .9rem;
}
.conv-title svg { color: var(--cyan); }
.conv-actions { display: flex; gap: 8px; }
.conv-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 50px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.conv-btn:hover, .conv-btn.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
}
.conv-btn.play-btn { border-color: rgba(0,212,255,.5); color: var(--cyan); }
.conv-btn.play-btn.playing {
  background: var(--cyan-dim);
  animation: convBtnPulse 1s ease-in-out infinite;
}
@keyframes convBtnPulse { 0%,100% { box-shadow: none; } 50% { box-shadow: 0 0 16px rgba(0,212,255,.4); } }

.conv-body { padding: 20px; }
.conv-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--mono);
  font-size: .95rem;
  resize: vertical;
  min-height: 100px;
  outline: none;
  transition: border-color .2s;
  line-height: 1.6;
}
.conv-textarea:focus { border-color: rgba(0,212,255,.5); }
.conv-textarea::placeholder { color: var(--text3); }

.conv-output {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-height: 100px;
  font-family: var(--mono);
  font-size: .95rem;
  color: var(--cyan);
  line-height: 1.8;
  word-break: break-all;
  letter-spacing: 1px;
  overflow-y: auto;
}
.conv-output.text-out { color: var(--text); letter-spacing: 0; word-break: normal; }

.conv-morse-visual {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  min-height: 36px;
}
.morse-symbol-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0,212,255,.06);
  border-radius: 6px;
  border: 1px solid rgba(0,212,255,.12);
}
.morse-symbol-group.playing-group {
  background: rgba(0,212,255,.18);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,212,255,.2);
}
.v-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  flex-shrink: 0;
}
.v-dash {
  width: 20px; height: 7px;
  border-radius: 3px;
  background: var(--cyan);
  flex-shrink: 0;
}
.morse-symbol-char {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--text3);
  margin-left: 4px;
}

/* Speed / tone controls */
.conv-controls {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.conv-control {
  flex: 1;
  min-width: 120px;
}
.conv-control label {
  display: block;
  font-size: .75rem;
  color: var(--text3);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.conv-range {
  width: 100%;
  accent-color: var(--cyan);
  cursor: pointer;
}

/* ── PROGRESS / PLAY BAR ── */
.conv-progress-wrap {
  margin-top: 12px;
  display: none;
}
.conv-progress-wrap.visible { display: block; }
.conv-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.conv-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), #7c3aed);
  border-radius: 99px;
  width: 0;
  transition: width .1s linear;
}

/* ── PRACTICE SECTION ── */
.practice-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.practice-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.practice-header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.practice-header h3 svg { color: var(--cyan); }
.practice-mode-tabs { display: flex; gap: 6px; }
.pmode-btn {
  padding: 6px 14px;
  border-radius: 50px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1),
              box-shadow .2s ease, background .18s, border-color .18s, color .18s;
  position: relative; overflow: hidden;
}
.pmode-btn:hover {
  border-color: var(--cyan); color: var(--cyan);
  background: var(--cyan-dim);
  transform: translateY(-2px) scale(1.07);
  box-shadow: 0 4px 14px rgba(0,212,255,.2), inset 0 0 0 1px rgba(0,212,255,.15);
}
.pmode-btn:active { transform: scale(.93) !important; transition: transform .08s !important; }
.pmode-btn.active { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }

.practice-body { padding: 28px 24px; }

/* Target display */
.practice-target {
  text-align: center;
  margin-bottom: 28px;
}
.target-char-display {
  font-size: 4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
  font-family: var(--mono);
  transition: all .2s;
}
.target-char-display.hint-shown { color: var(--cyan); text-shadow: 0 0 20px rgba(0,212,255,.4); }
.target-morse-hint {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--text3);
  letter-spacing: 4px;
  height: 24px;
  transition: all .2s;
}
.target-morse-hint.visible { color: var(--cyan); }

/* Practice input */
.practice-input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.practice-input {
  flex: 1;
  background: var(--bg);
  border: 2px solid var(--border2);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 4px;
  outline: none;
  transition: border-color .2s;
  text-align: center;
}
.practice-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(0,212,255,.08); }
.practice-input.correct { border-color: var(--green); box-shadow: 0 0 16px rgba(16,185,129,.2); }
.practice-input.wrong   { border-color: var(--red); box-shadow: 0 0 16px rgba(239,68,68,.2); animation: shake .3s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.practice-check-btn {
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--cyan), #0099cc);
  color: #000;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  transition: all .18s;
  white-space: nowrap;
}
.practice-check-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,212,255,.3); }

.practice-feedback {
  text-align: center;
  font-size: .95rem;
  min-height: 24px;
  font-weight: 600;
  transition: all .2s;
}
.practice-feedback.correct { color: var(--green); }
.practice-feedback.wrong   { color: var(--red); }

/* Practice stats */
.practice-stats-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pstat {
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 12px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
}
.pstat-num { font-size: 1.4rem; font-weight: 800; color: var(--cyan); font-family: var(--mono); }
.pstat-lbl { font-size: .72rem; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

/* Practice helper buttons */
.practice-helpers {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.phelper-btn {
  padding: 8px 18px;
  border-radius: 50px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  display: inline-flex; align-items: center; gap: 6px;
}
.phelper-btn:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }

/* ── COMMON PHRASES ── */
.phrases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.phrase-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  cursor: pointer;
  transition: all .18s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.phrase-card:hover { border-color: rgba(0,212,255,.4); transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.phrase-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.phrase-text {
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.3;
  word-break: break-word;
}
.phrase-desc {
  font-size: .78rem;
  color: var(--text3);
  line-height: 1.4;
}
.phrase-morse {
  font-family: var(--mono);
  font-size: .73rem;
  color: var(--cyan);
  letter-spacing: .5px;
  line-height: 1.5;
  word-break: break-all;
  padding: 6px 8px;
  background: rgba(0,212,255,.05);
  border-radius: 5px;
  border: 1px solid rgba(0,212,255,.1);
}
.phrase-play-icon {
  color: var(--cyan);
  flex-shrink: 0;
  opacity: .6;
  transition: opacity .18s, transform .18s;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0,212,255,.3);
  display: flex; align-items: center; justify-content: center;
}
.phrase-card:hover .phrase-play-icon { opacity: 1; transform: scale(1.1); border-color: var(--cyan); background: var(--cyan-dim); }

/* ── PHONETIC TABLE ── */
.morse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.morse-table th {
  text-align: left;
  padding: 12px 14px;
  background: rgba(0,0,0,.3);
  color: var(--text2);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}
.morse-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.morse-table tr:last-child td { border-bottom: none; }
.morse-table tr:hover td { background: var(--cyan-dim); }
.morse-table .td-char { font-weight: 700; font-size: 1rem; color: var(--text); }
.morse-table .td-morse { font-family: var(--mono); color: var(--cyan); letter-spacing: 2px; }
.morse-table .td-phonetic { color: var(--text2); }
.morse-table .td-prosign { color: var(--amber); font-family: var(--mono); font-size: .78rem; }

/* Responsive table wrapper */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.morse-table { min-width: 480px; }

/* ── ANIMATION CLASSES ── */
.fade-in { animation: fadeIn .4s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── TOOLTIP ── */
.has-tooltip { position: relative; }
.has-tooltip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .75rem;
  color: var(--text2);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

/* ── RESPONSIVE ── */
@media (max-width: 960px) {
  .morse-info-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 768px) {
  .morse-converter-wrap { grid-template-columns: 1fr; }
  .conv-header { flex-wrap: wrap; gap: 10px; }
  .conv-actions { flex-wrap: wrap; }
  .practice-header { flex-direction: column; align-items: flex-start; }
  .practice-mode-tabs { flex-wrap: wrap; }
  .phrases-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .morse-hero { padding: 48px 0 36px; }
  .morse-hero-title { font-size: 1.75rem; letter-spacing: -1px; }
  .morse-hero-sub   { font-size: .95rem; }
  .morse-signal-bar { font-size: .78rem; padding: 7px 14px; }
  .morse-hero-text-display { font-size: .85rem; min-width: 120px; }

  .morse-stats { gap: 8px; }
  .morse-stat  { min-width: 72px; padding: 10px 12px; flex: 1; }
  .morse-stat-num { font-size: 1.3rem; }
  .morse-stat-lbl { font-size: .7rem; }

  .morse-section-hdr h2 { font-size: .9rem; }

  .morse-info-grid { grid-template-columns: 1fr; }

  .morse-alpha-filter { gap: 6px; }
  .alpha-filter-btn   { font-size: .76rem; padding: 5px 12px; }
  .morse-alpha-grid   { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 7px; }
  .alpha-card         { padding: 10px 6px; }
  .alpha-char         { font-size: 1.1rem; }
  .alpha-morse        { font-size: .72rem; letter-spacing: 1px; }

  .conv-header  { padding: 12px 14px; }
  .conv-body    { padding: 14px; }
  .conv-textarea { font-size: .88rem; min-height: 80px; }
  .conv-output   { font-size: .88rem; min-height: 80px; }
  .conv-controls { gap: 10px; }

  .practice-body   { padding: 20px 14px; }
  .target-char-display { font-size: 3rem; }
  .practice-input-row  { flex-direction: column; }
  .practice-input  { font-size: .95rem; }
  .practice-check-btn { width: 100%; padding: 12px; }
  .practice-helpers { gap: 6px; }
  .phelper-btn { font-size: .75rem; padding: 7px 14px; }
  .pstat-num { font-size: 1.2rem; }

  .phrases-grid { grid-template-columns: 1fr; }
  .phrase-text  { font-size: .88rem; }
  .phrase-morse { font-size: .7rem; }

  .morse-table th, .morse-table td { padding: 10px 10px; font-size: .82rem; }
  .morse-table .td-char { font-size: .95rem; }
  .hide-mobile { display: none; }
}

@media (max-width: 400px) {
  .morse-stats { grid-template-columns: 1fr 1fr; display: grid; }
  .morse-hero-title { font-size: 1.5rem; }
  .morse-alpha-grid { grid-template-columns: repeat(4, 1fr); }
  .phrases-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   ENHANCED INTERACTIVE FEATURES
   ═══════════════════════════════════════════════════════════ */

/* ── ALPHA CARD ENHANCEMENTS ── */
.alpha-card .alpha-dot,
.alpha-card .alpha-dash { transition: opacity .1s, box-shadow .1s, background .1s; }
.alpha-card .alpha-dot.lit  { opacity: 1 !important; box-shadow: 0 0 8px var(--cyan); }
.alpha-card .alpha-dash.lit { opacity: 1 !important; box-shadow: 0 0 10px var(--cyan); }
.alpha-mnemonic {
  font-size: .6rem; color: var(--text3); font-style: italic;
  margin-top: 5px; min-height: 13px; opacity: 0;
  transition: opacity .2s; line-height: 1.3;
}
.alpha-card:hover .alpha-mnemonic { opacity: 1; }

/* ── CW KEY SECTION ── */
.key-section-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.key-osc-wrap {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.key-osc-wrap::after {
  content: '· — CW SIGNAL';
  position: absolute; top: 6px; right: 10px;
  font-family: var(--mono); font-size: .6rem;
  color: rgba(0,212,255,.22); letter-spacing: 1px; pointer-events: none;
}
#keyOscCanvas { display: block; width: 100%; height: 70px; }

.key-output-row {
  width: 100%; display: flex; gap: 12px; align-items: stretch;
}
.key-output-display {
  flex: 1; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; min-height: 52px;
  font-family: var(--mono); font-size: 1.05rem; color: var(--text);
  letter-spacing: 2px; display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  word-break: break-all;
}
.key-output-display .key-empty { color: var(--text3); font-style: italic; font-size: .85rem; letter-spacing: 0; }
.key-char-chip {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 5px; padding: 2px 8px;
  font-family: var(--mono); font-size: .95rem; color: var(--text);
  animation: chipPop .15s ease both;
}
@keyframes chipPop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.key-symbol-display {
  min-width: 90px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; display: flex; align-items: center;
  justify-content: center; gap: 5px; flex-wrap: wrap;
}
.sym-el {
  display: inline-block; border-radius: 3px; background: var(--cyan);
  animation: symPop .12s ease both;
  box-shadow: 0 0 6px rgba(0,212,255,.5);
}
.sym-el.dot  { width: 8px; height: 8px; border-radius: 50%; }
.sym-el.dash { width: 22px; height: 8px; }
@keyframes symPop { from { transform: scale(0) translateY(4px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

.key-center-row {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap; justify-content: center;
}
.key-led-group {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.key-led-group > span {
  font-family: var(--mono); font-size: .6rem; color: var(--text3);
  text-transform: uppercase; letter-spacing: 2px;
}
.key-led {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--border2); transition: background .04s, box-shadow .04s;
}
.key-led.on {
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan), 0 0 24px rgba(0,212,255,.25);
}

.cw-key {
  width: 220px; height: 90px;
  background: linear-gradient(180deg, #1a2745 0%, var(--bg2) 100%);
  border: 2px solid var(--border2); border-radius: 18px;
  box-shadow: 0 8px 0 rgba(0,0,0,.55), 0 12px 28px rgba(0,0,0,.45),
              inset 0 1px 0 rgba(255,255,255,.04);
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: none; position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .06s ease, box-shadow .06s ease, border-color .1s;
}
.cw-key::before {
  content: '';
  position: absolute; top: 10px; left: 28px; right: 28px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,.18), transparent);
}
.cw-key-prog {
  position: absolute; bottom: 0; left: 0; height: 4px;
  background: var(--cyan); border-radius: 0 0 16px 16px; width: 0;
  transition: background .1s;
}
.cw-key > span {
  font-size: .86rem; font-weight: 700; color: var(--text2);
  pointer-events: none; text-transform: uppercase; letter-spacing: 1px;
}
.cw-key > small { font-size: .7rem; color: var(--text3); font-family: var(--mono); pointer-events: none; }
.cw-key.pressed {
  transform: translateY(7px);
  box-shadow: 0 1px 0 rgba(0,0,0,.55), 0 3px 8px rgba(0,0,0,.4),
              inset 0 1px 0 rgba(255,255,255,.04);
  border-color: var(--cyan);
}
.cw-key.pressed > span { color: var(--cyan); }

.key-hint-box {
  min-width: 60px; text-align: center;
}
.key-hint-char {
  font-size: 2.4rem; font-weight: 800; color: var(--text3);
  font-family: var(--mono); line-height: 1; transition: color .15s;
  display: block; min-height: 44px;
}
.key-hint-char.found { color: var(--cyan); text-shadow: 0 0 20px rgba(0,212,255,.4); }
.key-hint-morse {
  font-family: var(--mono); font-size: .8rem; color: var(--text3);
  letter-spacing: 2px; transition: color .15s;
}

.key-btn-row {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.key-btn {
  padding: 8px 14px; border-radius: 50px; border: 1px solid var(--border2);
  background: transparent; color: var(--text2); font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: all .18s; display: inline-flex; align-items: center; gap: 5px;
}
.key-btn:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }
.key-btn kbd {
  display: inline-block; padding: 2px 5px; border-radius: 4px;
  background: var(--card2); border: 1px solid var(--border2);
  font-family: var(--mono); font-size: .68rem; color: var(--text3);
}
.key-tip {
  font-size: .75rem; color: var(--text3); text-align: center;
  font-style: italic; padding: 6px 14px;
  background: rgba(0,0,0,.2); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ── PRACTICE ENHANCEMENTS ── */
.practice-top-row {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 20px; flex-wrap: wrap; justify-content: center;
}
.progress-ring-wrap {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.progress-ring-wrap svg { transform: rotate(-90deg); }
.pring-bg { fill: none; stroke: var(--border); stroke-width: 4.5; }
.pring-fill {
  fill: none; stroke: var(--cyan); stroke-width: 4.5; stroke-linecap: round;
  transition: stroke-dashoffset .6s ease, stroke .3s;
}
.pring-text {
  position: absolute; display: flex; flex-direction: column; align-items: center;
}
.pring-pct { font-size: 1rem; font-weight: 800; font-family: var(--mono); color: var(--cyan); line-height: 1; }
.pring-lbl { font-size: .6rem; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

.practice-char-area { flex: 1; text-align: center; min-width: 160px; }
.practice-mnemonic {
  font-size: .8rem; color: var(--text3); font-style: italic;
  min-height: 18px; transition: all .25s; margin-top: 4px;
}
.practice-mnemonic.show { color: var(--amber); }

.vkb-wrap {
  display: flex; gap: 10px; justify-content: center; margin: 12px 0 4px; flex-wrap: wrap;
}
.vkb {
  border: 2px solid; border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 700; font-family: var(--mono);
  transition: transform .1s, background .1s;
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.vkb-dot  { width: 60px; height: 60px; font-size: 1.6rem; border-color: rgba(0,212,255,.5); background: rgba(0,212,255,.08); color: var(--cyan); }
.vkb-dash { width: 108px; height: 60px; font-size: 1.2rem; letter-spacing: 3px; border-color: rgba(0,212,255,.5); background: rgba(0,212,255,.08); color: var(--cyan); }
.vkb-del  { width: 60px; height: 60px; font-size: .85rem; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.07); color: var(--red); }
.vkb-go   { min-width: 90px; height: 60px; padding: 0 16px; font-size: .85rem; border-color: rgba(16,185,129,.5); background: rgba(16,185,129,.08); color: var(--green); }
.vkb:active { transform: scale(.88); }
.vkb.flash { filter: brightness(1.6); }

kbd {
  display: inline-block; padding: 1px 5px; border-radius: 4px;
  background: var(--card2); border: 1px solid var(--border2);
  font-family: var(--mono); font-size: .68rem; color: var(--text2);
}
.shortcut-hint { font-size: .72rem; color: var(--text3); text-align: center; }

/* ── LEARNING PATH ── */
.lpath-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.lpath-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  cursor: pointer; transition: all .2s; position: relative; overflow: hidden;
}
.lpath-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--cyan), #7c3aed);
  transform: scaleX(0); transform-origin: left; transition: transform .3s;
}
.lpath-card:hover::before, .lpath-card.active::before { transform: scaleX(1); }
.lpath-card:hover, .lpath-card.active { border-color: rgba(0,212,255,.4); transform: translateY(-2px); }
.lpath-lv { font-size: .65rem; font-weight: 700; color: var(--cyan); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; }
.lpath-chars { font-family: var(--mono); font-size: 1.1rem; font-weight: 800; color: var(--text); letter-spacing: 2px; margin-bottom: 5px; }
.lpath-desc { font-size: .72rem; color: var(--text3); line-height: 1.4; margin-bottom: 8px; }
.lpath-bar { height: 3px; background: var(--border); border-radius: 99px; overflow: hidden; }
.lpath-bar-fill { height: 100%; background: linear-gradient(90deg, var(--cyan), #7c3aed); border-radius: 99px; transition: width .5s; }
.lpath-go {
  margin-top: 8px; width: 100%; padding: 6px;
  border-radius: 6px; border: 1px solid rgba(0,212,255,.3);
  background: var(--cyan-dim); color: var(--cyan);
  font-size: .72rem; font-weight: 600; cursor: pointer; transition: all .18s;
}
.lpath-go:hover { background: rgba(0,212,255,.2); }

/* ── CONFETTI CANVAS ── */
/* confettiCanvas — positioned via inline style on element */

/* ── RESPONSIVE ADDITIONS ── */
@media (max-width: 768px) {
  .key-output-row { flex-direction: column; }
  .key-center-row { gap: 18px; }
  .key-symbol-display { min-width: auto; justify-content: flex-start; }
}
@media (max-width: 600px) {
  .cw-key { width: 180px; height: 80px; }
  .key-section-wrap { padding: 16px; gap: 14px; }
  .vkb-dot, .vkb-del { width: 52px; height: 52px; }
  .vkb-dash { width: 94px; height: 52px; }
  .vkb-go { height: 52px; }
  .lpath-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .practice-top-row { gap: 14px; }
}
