/* ══════════════════════════════════════════════════════════════
   MINECRAFT VOKABELTRAINER — style.css
   Press Start 2P pixel font via Google Fonts
══════════════════════════════════════════════════════════════ */

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

:root {
  --mc-green:      #5aaa3c;
  --mc-green-dark: #3d7a25;
  --mc-green-light:#7adf50;
  --mc-brown:      #8b5e3c;
  --mc-brown-dark: #5c3d1f;
  --mc-dirt:       #a0744c;
  --mc-stone:      #888;
  --mc-stone-dark: #555;
  --mc-sky:        #7ec8e3;
  --mc-sky-dark:   #4a9abc;
  --mc-gold:       #ffd700;
  --mc-gold-dark:  #c8a800;
  --mc-blue:       #3799d4;
  --mc-blue-dark:  #2060a0;
  --mc-red:        #c22;
  --mc-red-dark:   #900;
  --mc-text:       #fff;
  --mc-shadow:     rgba(0,0,0,.65);
  --pixel: 2px;
  --panel-bg:      rgba(12,12,12,.88);
  --panel-border:  #555;
  --panel-border-light: #888;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Press Start 2P', monospace;
  color: var(--mc-text);
  image-rendering: pixelated;
}

/* ── Background Scene ───────────────────────────────────────── */
#bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sky {
  flex: 1;
  background: linear-gradient(180deg, #1a85c4 0%, #7ec8e3 60%, #c9eaf7 100%);
  position: relative;
}

/* Sun block */
.sun-block {
  position: absolute;
  top: 30px;
  right: 120px;
  width: 52px; height: 52px;
  background: #ffe97a;
  box-shadow:
    0 0 0 4px #ffd700,
    0 0 0 8px rgba(255,215,0,.3),
    0 0 40px 20px rgba(255,220,0,.2);
  image-rendering: pixelated;
  animation: sunPulse 4s ease-in-out infinite;
}

@keyframes sunPulse {
  0%,100% { box-shadow: 0 0 0 4px #ffd700, 0 0 0 8px rgba(255,215,0,.3), 0 0 40px 20px rgba(255,220,0,.2); }
  50%      { box-shadow: 0 0 0 4px #ffd700, 0 0 0 16px rgba(255,215,0,.2), 0 0 60px 30px rgba(255,220,0,.15); }
}

/* Pixel clouds */
.clouds-layer {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 200px;
  pointer-events: none;
}

.cloud {
  position: absolute;
  background: rgba(255,255,255,.92);
  image-rendering: pixelated;
}

.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: inherit;
}

.cloud1 { width:80px; height:24px; top:40px; left:8%;
  animation: cloudDrift1 28s linear infinite; }
.cloud1::before { width:40px; height:24px; top:-16px; left:16px; }
.cloud1::after  { width:56px; height:16px; top:-8px;  left:8px; }

.cloud2 { width:64px; height:20px; top:70px; left:30%;
  animation: cloudDrift2 36s linear infinite; }
.cloud2::before { width:32px; height:20px; top:-12px; left:12px; }

.cloud3 { width:96px; height:28px; top:25px; left:55%;
  animation: cloudDrift1 44s linear infinite reverse; }
.cloud3::before { width:48px; height:28px; top:-20px; left:20px; }
.cloud3::after  { width:64px; height:20px; top:-10px; left:12px; }

.cloud4 { width:72px; height:22px; top:55px; left:78%;
  animation: cloudDrift2 32s linear infinite; }
.cloud4::before { width:36px; height:20px; top:-14px; left:14px; }

@keyframes cloudDrift1 {
  from { transform: translateX(0); }
  to   { transform: translateX(-110vw); }
}
@keyframes cloudDrift2 {
  from { transform: translateX(0); }
  to   { transform: translateX(110vw); }
}

/* Trees */
.trees-layer {
  position: absolute;
  bottom: 72px;
  left: 0; right: 0;
  display: flex;
  align-items: flex-end;
  padding: 0 20px;
  gap: 0;
  pointer-events: none;
}

.tree { display: flex; flex-direction: column; align-items: center; }
.tree .trunk {
  background: #7b4a1e;
  width: 20px;
  image-rendering: pixelated;
  box-shadow: inset -4px 0 0 rgba(0,0,0,.3);
}
.tree .leaves {
  background: #2d7a1e;
  image-rendering: pixelated;
  box-shadow: inset -4px 0 0 rgba(0,0,0,.2), inset 0 -4px 0 rgba(0,0,0,.2);
}
.tree .leaves.large { background: #3a9928; }

.t1 { margin-left: 2%; }
.t1 .leaves { width:68px; height:60px; }
.t1 .trunk  { height:36px; }

.t2 { margin-left: 4%; }
.t2 .leaves { width:56px; height:52px; }
.t2 .trunk  { height:44px; }

.t3 { margin-left: 8%; }
.t3 .leaves { width:88px; height:80px; }
.t3 .trunk  { height:52px; width:24px; }

.t4 { margin-left: auto; }
.t4 .leaves { width:64px; height:60px; }
.t4 .trunk  { height:40px; }

.t5 { margin-right: 6%; }
.t5 .leaves { width:96px; height:84px; }
.t5 .trunk  { height:56px; width:24px; }

.t6 { margin-right: 2%; }
.t6 .leaves { width:60px; height:56px; }
.t6 .trunk  { height:36px; }

/* Ground */
.ground-layer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  pointer-events: none;
}

.grass-row {
  height: 24px;
  background: repeating-linear-gradient(90deg,
    #4a9c2a 0px, #4a9c2a 16px,
    #3d8020 16px, #3d8020 32px);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.3), inset 0 4px 0 rgba(255,255,255,.1);
}

.dirt-row {
  height: 28px;
  background: repeating-linear-gradient(90deg,
    #8b5e3c 0px, #8b5e3c 16px,
    #7a5030 16px, #7a5030 32px);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.2);
}

.dirt-row.dark {
  background: repeating-linear-gradient(90deg,
    #6b4828 0px, #6b4828 16px,
    #5c3c20 16px, #5c3c20 32px);
  height: 24px;
}

/* Falling leaves */
.leaves-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.falling-leaf {
  position: absolute;
  top: -20px;
  animation: leafFall linear infinite;
  will-change: transform, opacity;
}

@keyframes leafFall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(100vh) translateX(60px) rotate(720deg); opacity: 0; }
}

/* ── Screens ───────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.screen.active { display: flex; }

/* ══════════════════════════════════════════════════════════════
   MAIN MENU
══════════════════════════════════════════════════════════════ */
.menu-box {
  background: rgba(0,0,0,.82);
  border: 4px solid var(--panel-border);
  box-shadow: 6px 6px 0 #000, inset 0 0 0 2px var(--panel-border-light);
  padding: 32px 40px 28px;
  width: min(560px, 96vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
}

.menu-title {
  font-size: clamp(18px, 4vw, 28px);
  line-height: 1.4;
  text-align: center;
  color: #fff;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #000;
  letter-spacing: 2px;
}

.menu-title span {
  color: var(--mc-green-light);
  font-size: 0.65em;
  display: block;
  margin-top: 4px;
}

.menu-title-wrap {
  background: linear-gradient(135deg, #1a6b00, #2fa80d, #1a6b00);
  border: 3px solid var(--mc-green-dark);
  box-shadow: 4px 4px 0 #000;
  padding: 16px 24px;
  width: 100%;
  text-align: center;
}

.menu-subtitle {
  font-size: 9px;
  color: #aaa;
  letter-spacing: 1px;
}

.menu-grass-bar {
  width: 100%;
  height: 12px;
  background: repeating-linear-gradient(90deg,
    #3d8020 0, #3d8020 12px, #4a9c2a 12px, #4a9c2a 24px);
  border-top: 2px solid var(--mc-green-light);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.menu-version {
  font-size: 7px;
  color: #666;
  letter-spacing: 1px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.mc-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(9px, 1.6vw, 13px);
  color: #fff;
  background: #7a7a7a;
  border: none;
  cursor: pointer;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  position: relative;
  image-rendering: pixelated;
  transition: filter .08s, transform .08s;
  /* Pixel border sim */
  box-shadow:
    0  3px 0 rgba(0,0,0,.7),
    inset 0  2px 0 rgba(255,255,255,.28),
    inset 0 -2px 0 rgba(0,0,0,.35);
}

.mc-btn:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}
.mc-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0,0,0,.7), inset 0 2px 0 rgba(0,0,0,.2);
}

.mc-btn.green  { background: #5aaa3c; }
.mc-btn.blue   { background: #3799d4; }
.mc-btn.red    { background: #ad2020; }

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

.mc-btn-small {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #ddd;
  background: #444;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  box-shadow: 0 2px 0 rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.2);
  transition: filter .08s;
}
.mc-btn-small:hover { filter: brightness(1.3); }

/* ── Diamond Easter Egg ─────────────────────────────────────── */
#diamondEgg {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 8px;
  opacity: 0.12;
  cursor: pointer;
  transition: opacity .3s;
  user-select: none;
}
#diamondEgg:hover { opacity: 0.5; }

/* ══════════════════════════════════════════════════════════════
   GAME SCREEN
══════════════════════════════════════════════════════════════ */
#screen-game {
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 0;
  gap: 0;
}

/* ── HUD ──────────────────────────────────────────────────────── */
.hud {
  width: 100%;
  background: rgba(0,0,0,.88);
  border-bottom: 3px solid #333;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 20;
  flex-shrink: 0;
}

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

.hud-center { flex: 1; }
.hud-left   { min-width: 80px; }
.hud-right  { min-width: 140px; }

.hud-score-label, .hud-progress-label, .hunger-label {
  font-size: 6px;
  color: #aaa;
  letter-spacing: 1px;
}

.hud-score {
  font-size: clamp(14px, 2.5vw, 20px);
  color: var(--mc-gold);
  text-shadow: 2px 2px 0 #000;
}

.hud-progress-bar-wrap {
  width: 100%;
  height: 12px;
  background: #222;
  border: 2px solid #555;
  overflow: hidden;
}

.hud-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3d9c24, #5aaa3c);
  width: 0%;
  transition: width .4s ease;
}

.hud-progress-text { font-size: 6px; color: #ccc; }

/* Hunger / Hearts */
.hunger-bar-wrap { display: flex; flex-direction: column; align-items: center; }

.hunger-segments {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
}

.hunger-heart {
  font-size: 14px;
  line-height: 1;
  transition: all .2s;
}
.hunger-heart.filled { color: #e02020; filter: drop-shadow(0 0 4px #f55); }
.hunger-heart.empty  { color: #333; }

.hunger-text { font-size: 7px; color: #ccc; margin-top: 2px; }

/* ── Game Panel ─────────────────────────────────────────────── */
#screen-game {
  overflow-y: auto;
}

.game-panel {
  width: min(740px, 98vw);
  background: rgba(10,10,10,.9);
  border: 4px solid #555;
  box-shadow: 8px 8px 0 rgba(0,0,0,.8), inset 0 0 0 2px #777;
  margin: 16px auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Fake book spine on left */
.panel-spine {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 10px;
  background: repeating-linear-gradient(180deg,
    #4a3820 0, #4a3820 8px, #3a2810 8px, #3a2810 16px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 24px;
  background: repeating-linear-gradient(90deg,
    #2a2a2a 0, #2a2a2a 8px, #222 8px, #222 16px);
  border-bottom: 3px solid #555;
}

.panel-tab {
  font-size: 9px;
  color: #e0c060;
  letter-spacing: 1px;
}

.panel-body {
  padding: 24px 28px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Question */
.question-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: rgba(0,0,0,.4);
  border: 2px solid #444;
  border-left: 4px solid var(--mc-green);
}

.question-label {
  font-size: 8px;
  color: #aaa;
  letter-spacing: 1px;
}

.vocab-word {
  font-size: clamp(22px, 5vw, 36px);
  color: #fff;
  text-shadow: 3px 3px 0 #000, 0 0 20px rgba(255,255,150,.3);
  letter-spacing: 4px;
  text-align: center;
  animation: wordAppear .25s ease;
}

@keyframes wordAppear {
  from { transform: scale(.8); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

.vocab-hint {
  font-size: 7px;
  color: #6a6;
  letter-spacing: 1px;
}

/* Input */
.input-area { display: flex; flex-direction: column; gap: 10px; }

.input-row { display: flex; gap: 10px; align-items: stretch; }

.mc-input {
  flex: 1;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(9px, 1.5vw, 13px);
  color: #fff;
  background: #1a1a1a;
  border: 3px solid #555;
  box-shadow: inset 3px 3px 0 rgba(0,0,0,.5), inset -1px -1px 0 rgba(255,255,255,.05);
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.mc-input:focus {
  border-color: var(--mc-green);
  box-shadow: inset 3px 3px 0 rgba(0,0,0,.5), 0 0 8px rgba(90,170,60,.4);
}

.mc-input::placeholder { color: #555; }

.submit-btn { min-width: 80px; padding: 12px 16px; font-size: 12px; }

/* Feedback */
.feedback-row {
  font-size: 9px;
  padding: 10px 14px;
  min-height: 38px;
  border-left: 4px solid transparent;
  letter-spacing: .5px;
  line-height: 1.6;
}
.feedback-row.correct {
  color: var(--mc-green-light);
  border-left-color: var(--mc-green);
  background: rgba(90,170,60,.1);
}
.feedback-row.wrong {
  color: #ff6666;
  border-left-color: var(--mc-red);
  background: rgba(180,30,30,.1);
}

/* Stats strip */
.stats-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-chip {
  font-size: 7px;
  padding: 6px 10px;
  background: #222;
  border: 2px solid #444;
  color: #8d8;
  letter-spacing: .5px;
}
.stat-chip.red  { color: #e55; border-color: #622; }
.stat-chip.gold { color: var(--mc-gold); border-color: #664; }

/* ── Shake animation ──────────────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}
.shake { animation: shake .35s ease; }

/* ── Particles ──────────────────────────────────────────────── */
.particles { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

.particle {
  position: absolute;
  font-size: 16px;
  font-weight: bold;
  animation: particleFly .75s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes particleFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ══════════════════════════════════════════════════════════════
   GAME OVER SCREEN
══════════════════════════════════════════════════════════════ */
.gameover-box {
  background: rgba(13,0,0,.95);
  border: 4px solid #800;
  box-shadow: 8px 8px 0 #000, inset 0 0 0 2px #b33;
  padding: 32px 36px;
  width: min(520px, 96vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeInScale .3s ease;
}

@keyframes fadeInScale {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.gameover-title {
  font-size: clamp(12px, 3vw, 18px);
  text-align: center;
  color: #ff5555;
  text-shadow: 3px 3px 0 #000;
  letter-spacing: 2px;
}

.gameover-skull {
  font-size: 52px;
  animation: skullBounce 1s ease-in-out infinite;
}

@keyframes skullBounce {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}

.gameover-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.go-stat {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  padding: 8px 12px;
  background: rgba(255,255,255,.06);
  border-left: 3px solid #555;
}
.go-stat span:last-child { color: var(--mc-gold); }

.name-entry { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.name-label { font-size: 8px; color: #aaa; }

.gameover-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ══════════════════════════════════════════════════════════════
   HIGHSCORE SCREEN
══════════════════════════════════════════════════════════════ */
.hs-box {
  background: rgba(0,5,0,.95);
  border: 4px solid #446;
  box-shadow: 8px 8px 0 #000, inset 0 0 0 2px #668;
  padding: 28px 32px;
  width: min(620px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeInScale .3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.hs-title {
  font-size: clamp(12px, 2.5vw, 18px);
  color: var(--mc-gold);
  text-shadow: 2px 2px 0 #000;
  text-align: center;
  letter-spacing: 2px;
}

.hs-table-wrap { overflow-x: auto; }

.hs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8px;
}

.hs-table th {
  background: #222;
  color: var(--mc-gold);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid #555;
  letter-spacing: .5px;
}

.hs-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #333;
  color: #ccc;
}

.hs-table tr.hs-gold td { color: var(--mc-gold); background: rgba(180,140,0,.08); }

.hs-table tr:hover td { background: rgba(255,255,255,.04); }

.hs-buttons { display: flex; gap: 12px; }
.hs-buttons .mc-btn { flex: 1; }

/* ══════════════════════════════════════════════════════════════
   HELP SCREEN
══════════════════════════════════════════════════════════════ */
.help-box {
  background: rgba(0,0,10,.95);
  border: 4px solid #335;
  box-shadow: 8px 8px 0 #000, inset 0 0 0 2px #558;
  padding: 28px 32px;
  width: min(560px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeInScale .3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.help-title {
  font-size: clamp(12px, 2.5vw, 16px);
  color: #88aaff;
  text-shadow: 2px 2px 0 #000;
  text-align: center;
  letter-spacing: 2px;
}

.help-content { display: flex; flex-direction: column; gap: 12px; }

.help-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  border-left: 3px solid #448;
}

.help-icon { font-size: 18px; flex-shrink: 0; }

.help-item p { font-size: 8px; color: #ccc; line-height: 1.8; letter-spacing: .3px; }

/* ══════════════════════════════════════════════════════════════
   EASTER EGG POPUP
══════════════════════════════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 90;
}

.hidden { display: none !important; }

.egg-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  z-index: 100;
  background: rgba(0,10,20,.97);
  border: 4px solid #0af;
  box-shadow: 0 0 40px rgba(0,200,255,.3), 8px 8px 0 #000;
  padding: 32px 36px;
  width: min(420px, 92vw);
  animation: fadeInScale .3s ease;
}

.egg-content { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.egg-title {
  font-size: 14px;
  color: #5ff;
  text-shadow: 2px 2px 0 #000, 0 0 20px #0af;
  text-align: center;
  letter-spacing: 2px;
}

.egg-text {
  font-size: 9px;
  color: #ccc;
  text-align: center;
  line-height: 1.8;
  letter-spacing: .5px;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .menu-box { padding: 20px 16px; }
  .panel-body { padding: 16px 14px 16px 18px; }
  .hud { padding: 6px 10px; gap: 8px; }
  .hunger-heart { font-size: 11px; }
  .game-panel { margin: 8px; }
  .hs-box, .help-box, .gameover-box { padding: 20px 16px; }
}

/* ── Custom scrollbar (Minecraft feel) ───────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #555; border: 1px solid #333; }
::-webkit-scrollbar-thumb:hover { background: #777; }
