/* ═══════════════════════════════════════════════════════════════
   RUSSIAN MASTERY — 8-bit Arcade CSS
   Press Start 2P font | Neon green on black | CRT effects
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:        #080808;
  --bg-panel:  #0e0e0e;
  --bg-card:   #111111;
  --primary:   #00ff41;
  --primary-d: #00cc33;
  --accent:    #ffd700;
  --red:       #ff3333;
  --cyan:      #00cfff;
  --orange:    #ff9f1c;
  --purple:    #bf5fff;
  --dim:       #333333;
  --text:      #cccccc;
  --text-dim:  #666666;
  --border:    #1e1e1e;
  --glow-g:    0 0 8px rgba(0,255,65,0.6), 0 0 20px rgba(0,255,65,0.2);
  --glow-a:    0 0 8px rgba(255,215,0,0.7), 0 0 20px rgba(255,215,0,0.3);
  --glow-r:    0 0 8px rgba(255,51,51,0.7);
  --glow-c:    0 0 8px rgba(0,207,255,0.6);
  --font:      'Press Start 2P', monospace;
  --radius:    0px; /* pixel-perfect */
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%; min-height: 100vh;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 10px;
  line-height: 1.8;
  cursor: default;
  /* CRT scanlines overlay */
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,0.15) 2px,
      rgba(0,0,0,0.15) 4px
    );
}

/* CRT vignette */
body::before {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%);
  pointer-events: none;
  z-index: 9999;
}

/* ── Pixel border utility ───────────────────────────────────── */
.pixel-border {
  border: 2px solid var(--primary);
  box-shadow: 
    4px 4px 0 var(--primary-d),
    var(--glow-g);
  image-rendering: pixelated;
}

.pixel-border-dim {
  border: 2px solid var(--dim);
  box-shadow: 4px 4px 0 #1a1a1a;
}

.pixel-border-accent {
  border: 2px solid var(--accent);
  box-shadow: 4px 4px 0 #997700, var(--glow-a);
}

/* ── Screen system ──────────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
  padding: 20px;
  flex-direction: column;
  align-items: center;
}

.screen.active {
  display: flex;
}

/* ════════════════════════════════════════════════════════════
   TITLE SCREEN
   ════════════════════════════════════════════════════════════ */

#screen-title {
  justify-content: center;
  gap: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(0,255,65,0.04) 0%, transparent 70%),
    var(--bg);
}

.title-logo {
  text-align: center;
  margin-bottom: 20px;
  padding: 30px 20px;
  position: relative;
}

.title-logo-ru {
  font-size: clamp(18px, 4vw, 36px);
  color: var(--primary);
  text-shadow: var(--glow-g);
  letter-spacing: 4px;
  display: block;
  margin-bottom: 10px;
  animation: textflicker 4s infinite;
}

.title-logo-sub {
  font-size: clamp(8px, 1.5vw, 11px);
  color: var(--accent);
  text-shadow: var(--glow-a);
  letter-spacing: 6px;
  display: block;
}

.title-tagline {
  font-size: 7px;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 2px;
}

/* Stats dashboard on title */
.title-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 600px;
  margin: 16px 0;
}

.stat-tile {
  background: var(--bg-panel);
  border: 1px solid var(--dim);
  padding: 12px 8px;
  text-align: center;
  position: relative;
}

.stat-tile .tile-label {
  font-size: 6px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.stat-tile .tile-value {
  font-size: clamp(10px, 2vw, 16px);
  color: var(--primary);
  text-shadow: var(--glow-g);
  display: block;
}

.stat-tile.accent .tile-value { color: var(--accent); text-shadow: var(--glow-a); }
.stat-tile.cyan .tile-value   { color: var(--cyan);   text-shadow: var(--glow-c); }

.level-banner {
  text-align: center;
  padding: 10px;
  margin-bottom: 12px;
  font-size: 8px;
  color: var(--accent);
  text-shadow: var(--glow-a);
  letter-spacing: 2px;
}

.press-start {
  font-size: clamp(10px, 2vw, 14px);
  color: var(--primary);
  text-shadow: var(--glow-g);
  letter-spacing: 3px;
  margin: 20px 0 16px;
  animation: blink 1s step-end infinite;
  cursor: pointer;
  text-align: center;
}

.title-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  font-family: var(--font);
  font-size: 8px;
  padding: 10px 16px;
  cursor: pointer;
  border: none;
  letter-spacing: 1px;
  transition: transform 0.05s, box-shadow 0.05s;
  text-transform: uppercase;
}

.btn:active { transform: translate(2px, 2px); }

.btn-primary {
  background: var(--primary);
  color: var(--bg);
  box-shadow: 4px 4px 0 var(--primary-d), var(--glow-g);
}
.btn-primary:hover { background: #00ff99; }

.btn-secondary {
  background: var(--bg-panel);
  color: var(--primary);
  border: 2px solid var(--primary);
  box-shadow: 3px 3px 0 var(--primary-d);
}
.btn-secondary:hover { background: rgba(0,255,65,0.1); }

.btn-accent {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 4px 4px 0 #997700, var(--glow-a);
}

.btn-danger {
  background: var(--bg-panel);
  color: var(--red);
  border: 2px solid var(--red);
  box-shadow: 3px 3px 0 #990000;
}

.btn.muted { opacity: 0.5; }

/* Big start button */
.btn-start {
  font-size: clamp(10px, 2vw, 14px);
  padding: 16px 32px;
  background: var(--primary);
  color: var(--bg);
  box-shadow: 6px 6px 0 var(--primary-d), var(--glow-g);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 6px 6px 0 var(--primary-d), 0 0 12px rgba(0,255,65,0.4); }
  50%       { box-shadow: 6px 6px 0 var(--primary-d), 0 0 30px rgba(0,255,65,0.8); }
}

/* ════════════════════════════════════════════════════════════
   GAME SCREEN
   ════════════════════════════════════════════════════════════ */

#screen-game {
  justify-content: flex-start;
  gap: 12px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  padding: 16px;
}

/* Top HUD bar */
.hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--dim);
  padding: 8px 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 5px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.hud-value {
  font-size: 11px;
  color: var(--primary);
  text-shadow: var(--glow-g);
}

.hud-value.accent { color: var(--accent); text-shadow: var(--glow-a); }
.hud-value.correct-color { color: #00ff41; }

/* Progress bar */
.progress-wrap {
  width: 100%;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--dim);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  box-shadow: var(--glow-g);
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 4px;
  background: white;
  opacity: 0.8;
}

.progress-text {
  font-size: 7px;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
}

/* Card */
.card {
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--dim);
  padding: 20px;
  position: relative;
}

.card-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.tier-badge {
  font-size: 6px;
  padding: 3px 6px;
  letter-spacing: 1px;
}

.tier-1 { background: var(--primary); color: var(--bg); }
.tier-2 { background: var(--cyan); color: var(--bg); }
.tier-3 { background: var(--purple); color: var(--bg); }

.pos-badge {
  font-size: 6px;
  padding: 3px 6px;
  background: var(--bg-panel);
  border: 1px solid var(--dim);
  color: var(--text-dim);
  letter-spacing: 1px;
}

.review-tag {
  font-size: 6px;
  padding: 3px 6px;
  margin-left: auto;
}

.review-tag.review    { color: var(--cyan); border: 1px solid var(--cyan); }
.review-tag.new-card  { color: var(--accent); border: 1px solid var(--accent); }

/* Sentence display */
.sentence-display {
  font-size: clamp(11px, 2.5vw, 16px);
  color: var(--text);
  line-height: 2.2;
  margin-bottom: 16px;
  letter-spacing: 1px;
  text-align: center;
  padding: 10px 0;
}

.blank {
  color: var(--primary);
  text-shadow: var(--glow-g);
  border-bottom: 2px solid var(--primary);
  padding: 0 4px;
  min-width: 60px;
  display: inline-block;
  text-align: center;
  animation: blank-pulse 1.5s ease-in-out infinite;
  letter-spacing: 2px;
}

.blank.filled { animation: none; letter-spacing: 0; font-size: inherit; }
.blank.filled.correct { color: var(--primary); text-shadow: var(--glow-g); border-color: var(--primary); }
.blank.filled.wrong   { color: var(--red);     text-shadow: var(--glow-r); border-color: var(--red); }

@keyframes blank-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Translation */
.translation-display {
  font-size: 8px;
  color: var(--text-dim);
  text-align: center;
  padding: 8px;
  border-top: 1px solid var(--border);
  letter-spacing: 1px;
  line-height: 2;
  transition: opacity 0.3s;
}

.translation-display.hidden { opacity: 0; pointer-events: none; }

/* ── Answer area ──────────────────────────────────────────── */
.answer-area {
  width: 100%;
}

.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice-btn {
  font-family: var(--font);
  font-size: clamp(8px, 1.5vw, 10px);
  padding: 14px 10px;
  background: var(--bg-panel);
  color: var(--text);
  border: 2px solid var(--dim);
  cursor: pointer;
  letter-spacing: 1px;
  text-align: center;
  transition: all 0.08s;
  word-break: break-word;
  line-height: 1.6;
}

.choice-btn:hover:not(:disabled) {
  background: rgba(0,255,65,0.1);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 8px rgba(0,255,65,0.3);
}

.choice-btn:active:not(:disabled) { transform: translate(1px,1px); }
.choice-btn:disabled { cursor: default; }
.choice-btn.correct-choice { background: rgba(0,255,65,0.15); border-color: var(--primary); color: var(--primary); box-shadow: var(--glow-g); }
.choice-btn.wrong-choice   { background: rgba(255,51,51,0.15); border-color: var(--red); color: var(--red); }

/* Type input */
.type-input-wrap {
  display: flex;
  gap: 8px;
  width: 100%;
}

.type-input {
  flex: 1;
  font-family: var(--font);
  font-size: clamp(10px, 2vw, 13px);
  background: var(--bg-panel);
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 12px 14px;
  outline: none;
  box-shadow: var(--glow-g);
  letter-spacing: 2px;
}

.type-input:focus { background: rgba(0,255,65,0.05); }
.type-input:disabled { opacity: 0.5; }

.submit-btn {
  font-family: var(--font);
  font-size: 8px;
  background: var(--primary);
  color: var(--bg);
  border: none;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--primary-d);
  white-space: nowrap;
}
.submit-btn:hover { background: #00ff99; }
.submit-btn:disabled { opacity: 0.4; cursor: default; }

.type-hint {
  font-size: 6px;
  color: var(--accent);
  text-align: center;
  margin-top: 6px;
  letter-spacing: 1px;
}

/* ── Feedback overlay ───────────────────────────────────────── */
.feedback-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.15s;
}

.feedback-overlay.show { opacity: 1; }

.feedback-overlay.correct { background: rgba(0,255,65,0.07); }
.feedback-overlay.wrong   { background: rgba(255,51,51,0.07); }

.feedback-box {
  background: var(--bg-card);
  border: 3px solid var(--primary);
  padding: 20px 32px;
  text-align: center;
  box-shadow: 6px 6px 0 var(--primary-d), var(--glow-g);
  transform: translateY(-40px);
}

.feedback-overlay.wrong .feedback-box {
  border-color: var(--red);
  box-shadow: 6px 6px 0 #660000, var(--glow-r);
}

.feedback-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
}

.feedback-overlay.correct .feedback-icon { color: var(--primary); text-shadow: var(--glow-g); }
.feedback-overlay.wrong   .feedback-icon { color: var(--red);     text-shadow: var(--glow-r); }

.feedback-msg {
  font-size: 9px;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.feedback-overlay.correct .feedback-msg { color: var(--primary); }
.feedback-overlay.wrong   .feedback-msg { color: var(--red); }

.feedback-pts {
  font-size: 10px;
  color: var(--accent);
  text-shadow: var(--glow-a);
}

/* ── Game control buttons ───────────────────────────────────── */
.game-controls {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════════════════════════
   RESULTS SCREEN
   ════════════════════════════════════════════════════════════ */

#screen-results {
  justify-content: center;
  gap: 14px;
  max-width: 600px;
  margin: 0 auto;
}

.results-header {
  text-align: center;
  padding: 20px 0 10px;
}

.results-title {
  font-size: clamp(14px, 3vw, 22px);
  color: var(--primary);
  text-shadow: var(--glow-g);
  letter-spacing: 4px;
  margin-bottom: 8px;
}

.grade-display {
  font-size: clamp(36px, 8vw, 64px);
  font-weight: bold;
  line-height: 1;
  text-shadow: 0 0 30px currentColor;
  display: block;
  margin: 10px 0;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

.result-tile {
  background: var(--bg-panel);
  border: 1px solid var(--dim);
  padding: 14px 10px;
  text-align: center;
}

.result-tile .r-label {
  font-size: 6px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.result-tile .r-value {
  font-size: clamp(14px, 3vw, 20px);
  color: var(--primary);
  text-shadow: var(--glow-g);
  display: block;
}

.result-tile .r-value.accent { color: var(--accent); text-shadow: var(--glow-a); }
.result-tile .r-value.red    { color: var(--red); }
.result-tile .r-value.cyan   { color: var(--cyan); text-shadow: var(--glow-c); }

/* Level up banner */
.levelup-banner {
  display: none;
  width: 100%;
  background: linear-gradient(90deg, rgba(255,215,0,0.1), rgba(255,215,0,0.2), rgba(255,215,0,0.1));
  border: 2px solid var(--accent);
  box-shadow: var(--glow-a);
  padding: 14px;
  text-align: center;
  animation: levelup-flash 0.5s ease-out;
}

.levelup-banner.show { display: block; }

.levelup-banner .lu-title {
  font-size: 8px;
  color: var(--accent);
  text-shadow: var(--glow-a);
  letter-spacing: 2px;
}

.levelup-name {
  font-size: 11px;
  color: var(--accent);
  margin-top: 6px;
  display: block;
}

@keyframes levelup-flash {
  0%   { transform: scale(0.8); opacity: 0; }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.results-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

/* ════════════════════════════════════════════════════════════
   STATS SCREEN
   ════════════════════════════════════════════════════════════ */

#screen-stats {
  justify-content: flex-start;
  gap: 12px;
  max-width: 660px;
  margin: 0 auto;
  padding: 16px;
}

.stats-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--dim);
  padding-bottom: 10px;
}

.stats-title {
  font-size: clamp(10px, 2vw, 14px);
  color: var(--primary);
  text-shadow: var(--glow-g);
  letter-spacing: 3px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.st-tile {
  background: var(--bg-panel);
  border: 1px solid var(--dim);
  padding: 12px 8px;
  text-align: center;
}

.st-tile .st-label {
  font-size: 5px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.st-tile .st-value {
  font-size: clamp(11px, 2vw, 16px);
  color: var(--primary);
  text-shadow: var(--glow-g);
}

.st-tile .st-value.accent { color: var(--accent); text-shadow: var(--glow-a); }
.st-tile .st-value.cyan   { color: var(--cyan);   text-shadow: var(--glow-c); }
.st-tile .st-value.red    { color: var(--red); }

/* Progress bars */
.bars-section {
  width: 100%;
}

.bar-row {
  margin-bottom: 14px;
}

.bar-label-text {
  font-size: 6px;
  color: var(--text-dim);
  margin-bottom: 5px;
  display: block;
  letter-spacing: 1px;
}

.bar-track {
  width: 100%;
  height: 12px;
  background: var(--dim);
  border: 1px solid var(--border);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  box-shadow: var(--glow-g);
  transition: width 1s ease;
  min-width: 4px;
}

.bar-fill.accent { background: var(--accent); box-shadow: var(--glow-a); }
.bar-fill.cyan   { background: var(--cyan);   box-shadow: var(--glow-c); }
.bar-fill.purple { background: var(--purple); }

/* Section headings */
.section-heading {
  font-size: 7px;
  color: var(--accent);
  letter-spacing: 3px;
  text-shadow: var(--glow-a);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,215,0,0.2);
  width: 100%;
}

/* ── Keyframe animations ────────────────────────────────────── */

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@keyframes textflicker {
  0%, 97%, 100%  { opacity: 1; }
  98%             { opacity: 0.7; }
  99%             { opacity: 0.9; }
}

/* ── Utility ────────────────────────────────────────────────── */
.hidden { opacity: 0 !important; }
.text-center { text-align: center; }
.text-green { color: var(--primary); text-shadow: var(--glow-g); }
.text-gold  { color: var(--accent); text-shadow: var(--glow-a); }
.text-cyan  { color: var(--cyan); text-shadow: var(--glow-c); }
.text-red   { color: var(--red); }
.text-dim   { color: var(--text-dim); }
.divider { width: 100%; border: none; border-top: 1px solid var(--dim); }
.w-full { width: 100%; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--dim); }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  body { font-size: 9px; }
  .choices-grid { grid-template-columns: 1fr; }
  .title-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .results-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .type-input-wrap { flex-direction: column; }
}

/* ── HINT DISPLAY (Russian dictionary description) ─────────── */
.hint-display {
  font-size: 8px;
  color: var(--orange);
  background: rgba(255, 159, 28, 0.07);
  border-left: 3px solid var(--orange);
  padding: 8px 12px;
  margin: 8px 0;
  line-height: 2;
  letter-spacing: 0.5px;
  font-style: italic;
  transition: opacity 0.4s;
}

.hint-display.hidden { opacity: 0; pointer-events: none; }

/* ── WORD-MEANING CARD — large word display ─────────────────── */
.word-target {
  display: block;
  font-size: clamp(22px, 5vw, 38px);
  color: var(--accent);
  text-shadow: var(--glow-a);
  text-align: center;
  letter-spacing: 4px;
  padding: 16px 0 8px;
  animation: textflicker 6s infinite;
}

/* English choices are wider for longer phrases */
.choice-btn-en {
  font-size: clamp(7px, 1.2vw, 9px) !important;
  padding: 12px 8px !important;
  line-height: 1.8 !important;
}
