/* Lingosaurus – pixel / Minecraft look */
:root {
  --ink: #fff;
  --shadow: #3f3f3f;
  --panel: #c6c6c6;
  --panel-ink: #3f3f3f;
  --panel-light: #ffffff;
  --panel-dark: #555555;
  --slot: #8b8b8b;
  --stone: #727272;
  --stone-light: #a8a8a8;
  --stone-dark: #3d3d3d;
  --grass: #3f9b2c;
  --grass-light: #7fd65a;
  --grass-dark: #1f5c14;
  --red: #b3312c;
  --red-light: #e2615b;
  --red-dark: #6b1612;
  --mc-green: #55ff55;
  --mc-red: #ff5555;
  --mc-gold: #ffaa00;
  --mc-yellow: #ffff55;
  --mc-aqua: #55ffff;
  --pixel: 'Jersey 15', 'Nunito', system-ui, sans-serif;
  --pixel-title: 'Press Start 2P', 'Pixelify Sans', monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; border-radius: 0 !important; }
html, body { margin: 0; }
body {
  background-color: #3b2a1d;
  background-image: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), url('dirt.svg');
  background-size: auto, 64px 64px;
  image-rendering: pixelated;
  color: var(--ink);
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 25px;
  font-synthesis: none;
  letter-spacing: 0.3px;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.pix { display: block; flex: none; image-rendering: pixelated; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Text on dirt gets the classic Minecraft drop shadow */
.hero, h2, .prompt-word, .prompt-label, .round-label, .result-title, .result-sub, .topbar .title, .muted, .link-btn, .empty {
  text-shadow: 1px 2px 0 rgba(0,0,0,.6);
}

/* ---------- Bevel helpers ---------- */
.panel, .choice, .lesson, .mistakes, .table, .tile, .sheet, .seg, .empty, .upload {
  background: var(--panel);
  color: var(--panel-ink);
  border: 3px solid #000;
  box-shadow: inset 3px 3px 0 var(--panel-light), inset -3px -3px 0 var(--panel-dark);
  text-shadow: none;
}

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 18px; }
.topbar .title { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 700; overflow: hidden; white-space: nowrap; }
.topbar .title span { overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  background: var(--stone); color: #fff; border: 3px solid #000;
  box-shadow: inset 3px 3px 0 var(--stone-light), inset -3px -4px 0 var(--stone-dark);
}
.icon-btn:hover { background: #7e87c8; box-shadow: inset 3px 3px 0 #b4bdf5, inset -3px -4px 0 #3c4380; }
.icon-btn:active { transform: translateY(2px); }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 6px; min-height: 46px; white-space: nowrap; font-size: 20px;
  background: rgba(0, 0, 0, 0.55); border: 2px solid #000; color: #fff;
}

/* ---------- Hero ---------- */
.hero { text-align: center; margin: 18px 0 30px; position: relative; }
.hero .logo { margin: 0 auto; }
.hero h1 {
  font-family: var(--pixel-title); font-size: clamp(20px, 7vw, 30px); font-weight: 400;
  margin: 14px 0 8px; color: #fff; letter-spacing: 1px;
  text-shadow: 3px 3px 0 #3f3f3f, 0 0 0 #000;
}
.hero h1 b { color: var(--mc-green); font-weight: 400; }
.hero p { margin: 10px 0 0; font-size: 24px; color: #e0e0e0; }
.splash {
  position: absolute; left: calc(50% + 58px); top: 22px;
  font-family: var(--pixel-title); font-size: 10px; color: var(--mc-yellow);
  text-shadow: 2px 2px 0 #3f3f00; transform: rotate(-16deg);
  animation: splash 0.9s ease-in-out infinite alternate; white-space: nowrap; pointer-events: none;
}
@keyframes splash { from { transform: rotate(-16deg) scale(1); } to { transform: rotate(-16deg) scale(1.1); } }

h2 { font-size: 25px; font-weight: 800; margin: 10px 0 14px; }
.muted { color: #cfcfcf; }
.small { font-size: 18px; }

/* ---------- Buttons (Minecraft GUI buttons) ---------- */
.btn {
  --c: var(--stone); --cl: var(--stone-light); --cd: var(--stone-dark);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 10px 18px;
  background: var(--c); color: #fff;
  border: 3px solid #000;
  box-shadow: inset 3px 3px 0 var(--cl), inset -3px -5px 0 var(--cd);
  font-size: 24px; font-weight: 800; letter-spacing: 0.3px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 3px 3px 0 var(--cd), inset -3px -2px 0 var(--cl); }
.btn:disabled, .btn.primary:disabled { --c: #4a4a4a; --cl: #5e5e5e; --cd: #2b2b2b; color: #a0a0a0; cursor: default; }
.btn.primary, .btn.ok { --c: var(--grass); --cl: var(--grass-light); --cd: var(--grass-dark); }
.btn.danger, .btn.bad { --c: var(--red); --cl: var(--red-light); --cd: var(--red-dark); }
.btn.near { --c: #c98a0e; --cl: #f5c542; --cd: #6e4a05; }
.btn.small-btn { min-height: 44px; font-size: 20px; width: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.spacer { flex: 1; min-height: 18px; }

/* ---------- Choice cards (accounts, languages) ---------- */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 20px 10px 16px; font-size: 26px; font-weight: 800;
}
.choice:hover { background: #d6d6d6; }
.choice:active { transform: translateY(3px); }
.choice .slot {
  padding: 8px; background: var(--slot);
  box-shadow: inset 3px 3px 0 #373737, inset -3px -3px 0 #fff;
}

/* ---------- Lesson list ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.lesson { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; }
.lesson .main { flex: 1; min-width: 0; border: 0; background: none; padding: 4px 0; text-align: left; display: flex; align-items: center; gap: 14px; color: inherit; }
.lesson .badge { flex: none; padding: 5px; background: var(--slot); box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff; }
.lesson .info { min-width: 0; }
.lesson .name { font-size: 22px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson .meta { font-size: 18px; color: #5f5f5f; }
.lesson:hover { background: #d0d0d0; }
.lesson.all { background: #9ed78a; box-shadow: inset 3px 3px 0 #d6ffc6, inset -3px -3px 0 #3b7a2a; }
.lesson.all .meta { color: #2b5a1f; }
.lesson .more { border: 0; background: none; width: 42px; height: 42px; font-size: 26px; font-weight: 700; color: var(--panel-ink); }
.lesson .more:hover { background: rgba(0, 0, 0, 0.1); }
.empty { text-align: center; padding: 30px 16px; font-size: 21px; }
.empty .big { display: flex; justify-content: center; margin-bottom: 12px; }

/* ---------- Menu sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { width: 100%; max-width: 560px; padding: 20px 16px max(20px, env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0 0 6px; font-size: 26px; font-weight: 700; }
.sheet .link-btn { color: var(--panel-ink); text-shadow: none; }

/* ---------- Forms (Minecraft text fields) ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 20px; color: #e0e0e0; text-shadow: 1px 2px 0 rgba(0,0,0,.6); }
.input {
  width: 100%; padding: 12px 14px;
  background: #000; color: #fff; border: 3px solid #a0a0a0;
  font-size: 24px; font-family: var(--pixel); outline: none; text-shadow: none;
}
.input::placeholder { color: #707070; }
.input:focus { border-color: #fff; }
.upload { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 16px; text-align: center; cursor: pointer; font-size: 22px; font-weight: 600; }
.upload:hover { background: #d0d0d0; }
.upload input { display: none; }
.upload .small { color: #5f5f5f; font-weight: 500; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 84px; height: 84px; border: 3px solid #000; box-shadow: 0 0 0 2px var(--panel); }
.thumb img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.thumb button { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; border: 2px solid #000; background: var(--red); color: #fff; font-size: 17px; line-height: 1; padding: 0; }

.words { display: flex; flex-direction: column; gap: 8px; }
.word-head, .word-row { display: grid; grid-template-columns: 1fr 1fr 40px; gap: 8px; align-items: center; }
.word-head { font-size: 18px; color: #e0e0e0; padding: 0 2px; text-shadow: 1px 2px 0 rgba(0,0,0,.6); }
.word-row .input { padding: 9px 10px; font-size: 21px; }
.word-row .del { width: 40px; height: 40px; border: 3px solid #000; background: var(--red); color: #fff; font-size: 21px; box-shadow: inset 2px 2px 0 var(--red-light), inset -2px -3px 0 var(--red-dark); }

/* ---------- Quiz ---------- */
.progress {
  flex: 1; height: 18px; background: #1d1d1d; border: 3px solid #000; position: relative; overflow: hidden;
}
.progress > div {
  height: 100%; background: #80ff20; transition: width 0.3s steps(8);
  box-shadow: inset 0 -4px 0 #4fa80e, inset 0 3px 0 #c2ff8a;
}
.progress::after { /* XP bar segments */
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 3px), #000 calc(10% - 3px) 10%);
}
.round-label { font-family: var(--pixel-title); font-size: 12px; color: var(--mc-green); font-weight: 600; letter-spacing: 1px; }
.round-label.repeat { color: var(--mc-gold); }
.prompt-label { color: #d0d0d0; font-size: 21px; margin: 14px 0 4px; }
.prompt-word { font-size: 45px; font-weight: 900; line-height: 1.15; margin: 0 0 22px; word-break: break-word; color: #fff; }
.answer { font-size: 31px; padding: 14px 16px; }
.answer.ok { border-color: var(--mc-green); color: var(--mc-green); }
.answer.bad { border-color: var(--mc-red); color: var(--mc-red); }
.answer.near { border-color: var(--mc-gold); color: var(--mc-gold); }
.feedback {
  margin: 0 -16px calc(-1 * max(24px, env(safe-area-inset-bottom)));
  padding: 16px 16px max(24px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.78); border-top: 3px solid #000;
  display: flex; flex-direction: column; gap: 14px;
  text-shadow: 2px 2px 0 #1a1a1a;
}
.feedback.ok { color: var(--mc-green); box-shadow: inset 0 3px 0 #2c7a2c; }
.feedback.bad { color: var(--mc-red); box-shadow: inset 0 3px 0 #7a2c2c; }
.feedback.near { color: var(--mc-gold); box-shadow: inset 0 3px 0 #7a5a10; }
.feedback .head { display: flex; align-items: center; gap: 12px; font-size: 28px; font-weight: 700; }
.feedback .correct { font-size: 22px; color: #fff; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.feedback .correct b { font-size: 31px; color: var(--mc-yellow); }
.speak {
  width: 46px; height: 40px; flex: none; display: grid; place-items: center;
  background: var(--stone); color: #fff; border: 3px solid #000;
  box-shadow: inset 2px 2px 0 var(--stone-light), inset -2px -3px 0 var(--stone-dark);
}
.quiz-actions { display: flex; flex-direction: column; gap: 12px; }
.link-btn { border: 0; background: none; color: #d0d0d0; font-size: 22px; font-weight: 600; padding: 10px; }
.link-btn:hover { color: #fff; }

/* ---------- Results ---------- */
.hearts { display: flex; justify-content: center; gap: 4px; margin: 18px auto 10px; flex-wrap: wrap; }
.score-num { text-align: center; font-family: var(--pixel-title); font-size: 34px; margin: 8px 0 12px; text-shadow: 3px 3px 0 var(--shadow); }
.score-num.good { color: var(--mc-green); }
.score-num.mid { color: var(--mc-gold); }
.score-num.low { color: var(--mc-red); }
.result-title { text-align: center; font-size: 33px; font-weight: 900; margin: 6px 0 4px; }
.result-sub { text-align: center; color: #d0d0d0; margin: 0 0 22px; font-size: 22px; }
.mistakes { padding: 4px 14px; }
.mistake { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 2px solid #9a9a9a; font-size: 21px; }
.mistake:last-child { border-bottom: 0; }
.mistake .t { color: #1f6b14; font-weight: 700; text-align: right; }
.trophy { display: flex; justify-content: center; margin-top: 18px; }

/* ---------- Stats ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.tile { padding: 12px 8px; text-align: center; }
.tile .v { font-family: var(--pixel-title); font-size: 18px; margin: 4px 0 8px; }
.tile .l { font-size: 18px; color: #5f5f5f; }
.table { padding: 2px 14px; margin-bottom: 20px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 2px solid #9a9a9a; font-size: 20px; }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .grow div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.row .small { color: #5f5f5f; }
.pct { font-weight: 700; min-width: 52px; text-align: right; font-size: 22px; }
.pct.good, .cnt-ok { color: #1f7a14 !important; }
.pct.mid { color: #a86a00; }
.pct.low, .cnt-bad { color: #b3312c !important; }
.seg { display: flex; padding: 5px; gap: 5px; margin-bottom: 16px; }
.seg button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 3px solid #000; padding: 8px 6px; font-weight: 600; color: #fff; background: var(--stone);
  box-shadow: inset 2px 2px 0 var(--stone-light), inset -2px -3px 0 var(--stone-dark); text-shadow: 2px 2px 0 rgba(0,0,0,.5);
}
.seg button.on { background: var(--grass); box-shadow: inset 2px 2px 0 var(--grass-light), inset -2px -3px 0 var(--grass-dark); }

/* ---------- Misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: rgba(0, 0, 0, 0.8); color: #fff; padding: 12px 16px; font-size: 21px; border: 2px solid #000;
  text-shadow: 2px 2px 0 #3f3f3f;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.spinner { width: 20px; height: 20px; background: #fff; animation: blink .5s steps(2) infinite; box-shadow: 24px 0 0 #fff, -24px 0 0 #fff; margin: 0 24px; }
@keyframes blink { 50% { opacity: .3; } }
.pin-input { text-align: center; font-size: 40px; letter-spacing: 12px; }
.pop { animation: pop .3s steps(3); }
@keyframes pop { 0% { transform: scale(.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
.shake { animation: shake .3s steps(4); }
@keyframes shake { 25%, 75% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.upload .muted, .table .muted, .row .muted { text-shadow: none; color: #5f5f5f; }

/* Lesson selection checkboxes */
.check {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  background: #000; border: 3px solid #a0a0a0; color: var(--mc-green);
}
.check.on { border-color: #fff; }
.lesson.selected { background: #e2e2e2; box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #555, 0 0 0 3px var(--mc-green); }
.lesson.all.selected { background: #b6e8a3; }

/* Test type choice */
.choice-desc { font-size: 18px; font-weight: 400; color: #5f5f5f; margin-top: -6px; }

/* Pexeso */
.memory { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.memory .col { display: flex; flex-direction: column; gap: 12px; }
.card {
  min-height: 76px; padding: 8px 10px; text-align: center; word-break: break-word; line-height: 1.1;
  background: var(--panel); color: var(--panel-ink); border: 3px solid #000; font-size: 23px; font-weight: 700;
  box-shadow: inset 3px 3px 0 var(--panel-light), inset -3px -3px 0 var(--panel-dark);
}
.card.target { background: #b9c8ec; box-shadow: inset 3px 3px 0 #e6edff, inset -3px -3px 0 #4d5f8c; }
.card:active:not(:disabled) { transform: translateY(2px); }
.card.sel { background: var(--mc-yellow); box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #a8a800, 0 0 0 3px #fff; }
.card.bad { background: var(--red-light); color: #fff; box-shadow: inset 3px 3px 0 #ffb3b0, inset -3px -3px 0 var(--red-dark); }
.card.done { background: var(--grass); color: #fff; opacity: 0.35; cursor: default; box-shadow: inset 3px 3px 0 var(--grass-light), inset -3px -3px 0 var(--grass-dark); }
