/* ── LAYOUT ── */
.wp-main   { max-width: 1060px; margin: 0 auto; padding: 24px 24px 60px; }
.wp-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
.wp-right  { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 20px; }

/* ── TYPING TEST CARD ── */
.wp-card { padding: 24px; display: flex; flex-direction: column; width: 100%; margin-bottom: 20px; position: relative; }

/* METRICS GRID */
.wp-metrics-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; width: 100%; }
.wp-metric-box { display: flex; flex-direction: column; align-items: center; background: var(--bg-muted); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; }
.wp-metric-val { font-family: var(--font-mono); font-size: 32px; font-weight: 700; color: var(--text); line-height: 1; }
.wp-metric-lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; margin-top: 6px; }

/* THE QUOTE DISPLAY */
.wp-quote-box { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); padding: 20px; font-size: 18px; line-height: 1.6; color: var(--text-muted); cursor: text; position: relative; min-height: 120px; transition: all 0.15s; margin-bottom: 20px; user-select: none; }
.wp-quote-box:focus-within { border-color: var(--text); box-shadow: 0 0 10px rgba(var(--text-rgb, 26,26,26), 0.05); }

/* HIDDEN INTERCEPT TEXTAREA */
.wp-hidden-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; left: -100px; top: -100px; }

/* CHARACTERS */
.wp-char { position: relative; }
.wp-char.correct { color: #2e7d32; }
.wp-char.incorrect { color: #c62828; background: rgba(198, 40, 40, 0.08); border-radius: 2px; }
.wp-char.active { color: var(--text); background: var(--bg-muted); border-bottom: 2px solid var(--text); }

/* BLINKING CURSOR ON ACTIVE */
@keyframes cursor-blink {
  0%, 100% { border-bottom-color: transparent; }
  50% { border-bottom-color: var(--text); }
}
.wp-char.active { animation: cursor-blink 1s infinite; }

/* FOCUS OVERLAY */
.wp-focus-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(var(--bg-card-rgb, 255, 255, 255), 0.85); display: flex; align-items: center; justify-content: center; border-radius: var(--radius-lg); font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; transition: all 0.12s; z-index: 10; backdrop-filter: blur(2px); }
.wp-focus-overlay:hover { background: rgba(var(--bg-card-rgb, 255, 255, 255), 0.95); }

/* ACTIONS */
.wp-controls { display: flex; gap: 12px; justify-content: center; }
.wp-controls .btn { height: 42px; min-width: 150px; font-weight: 600; }

/* ── LEADERBOARD ── */
.wp-board { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.wp-board-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-muted); border: 1px solid var(--border); font-size: 13px; }
.wp-board-rank { font-family: var(--font-mono); font-weight: 700; color: var(--text-muted); width: 24px; }
.wp-board-wpm { font-family: var(--font-mono); font-weight: 700; color: #2aa198; font-size: 15px; }
.wp-board-acc { font-family: var(--font-mono); color: var(--text-muted); font-size: 11px; margin-left: 8px; }
.wp-board-date { font-family: var(--font-mono); color: var(--text-muted); font-size: 11px; }
.wp-board-empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 16px 0; }

/* ── RESPONSIVE ── */
@media (max-width: 800px) {
  .wp-layout { grid-template-columns: 1fr; }
  .wp-right { position: static; }
}
@media (max-width: 560px) {
  .wp-main { padding: 16px 14px 40px; }
  .wp-metrics-row { gap: 8px; }
  .wp-metric-val { font-size: 24px; }
  .wp-metric-lbl { font-size: 8px; }
  .wp-quote-box { font-size: 15px; padding: 14px; }
}

/* ── LANG SWITCHER ── */
.lang-switcher { position: relative; }
.lang-current { display:flex;align-items:center;gap:5px;padding:5px 10px;border:1px solid var(--border);border-radius:var(--radius);background:var(--bg);font-size:12px;font-weight:500;color:var(--text);cursor:pointer;font-family:var(--font-sans); }
.lang-code { font-family:var(--font-mono);font-size:11px;color:var(--text-muted); }
.lang-menu { display:none;position:absolute;top:calc(100% + 6px);right:0;background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 8px 24px rgba(0,0,0,.10);z-index:200;padding:6px;width:210px;max-height:340px;overflow-y:auto; }
.lang-menu.open { display:flex;flex-direction:column; }
.lang-option { display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--radius);font-size:13px;color:var(--text);text-decoration:none;transition:background .12s; }
.lang-option:hover { background:var(--bg-muted); }
.lang-option.active { background:var(--accent);font-weight:500; }
