:root {
  --bg-top:    #1a3a2a;
  --bg-bot:    #0d2218;
  --card:      rgba(15, 40, 25, 0.88);
  --line:      rgba(255, 255, 255, 0.13);
  --text:      #eef7ee;
  --muted:     #8db89a;
  --ok:        #5dda80;
  --bad:       #ff8b8b;
  --accent:    #6fd98a;
  --chip:      #ffe066;
  --btn-gold:  linear-gradient(135deg, #ffe066, #ffc94d);
  --btn-dark:  #112214;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
}

body {
  background: #08131a;
}

/* Subtle leaf/texture overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("images/bg.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  opacity: 0.9;
  mix-blend-mode: normal;
}

.bg {
  min-height: 100vh;
  padding: 80px 20px 28px;
  position: relative;
  z-index: 1;
}

.app {
  max-width: 1140px;
  margin: 0 auto;
}

/* ── Top bar ──────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.brand {
  border: 0;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  cursor: pointer;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #6fd98a, #34c15e);
  font-size: 28px;
  box-shadow: 0 4px 14px rgba(52, 193, 94, 0.35);
}

.brand-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.brand-sub {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stats { display: flex; gap: 8px; }

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.06);
  min-width: 96px;
}

.pill-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pill-value {
  font-size: 18px;
  font-weight: 800;
}

/* ── Card shell ───────────────────────────── */
.card {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  background: var(--card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
}

.screen.hidden, .hidden { display: none !important; }

/* ── Typography ───────────────────────────── */
.headline {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.lead {
  margin-top: 10px;
  color: #c6e8cc;
  font-size: clamp(15px, 2vw, 19px);
}

.tiny {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Buttons ──────────────────────────────── */
.btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  color: var(--btn-dark);
  background: var(--btn-gold);
  box-shadow: 0 4px 16px rgba(255, 196, 77, 0.3);
}

.btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}

/* ── Back-home button ─────────────────────── */
#btnBackHome {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 20;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  color: var(--text);
  transition: background 0.15s ease;
}

#btnBackHome:hover { background: rgba(0, 0, 0, 0.65); }

/* ── Game layout ──────────────────────────── */
.game-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 18px;
}

.items-panel,
.categories-panel {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
  padding: 16px;
}

.items-panel h2,
.categories-panel h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Item grid ────────────────────────────── */
.items-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.item-card {
  border: 2px solid rgba(111, 217, 138, 0.2);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 96px;
  padding: 10px 8px;
  cursor: grab;
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.item-card:hover {
  border-color: rgba(111, 217, 138, 0.55);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.item-card.dragging { opacity: 0.45; transform: scale(0.95); }

.item-card.is-selected {
  border-color: var(--chip);
  background: linear-gradient(145deg, rgba(255, 224, 102, 0.18), rgba(255, 201, 77, 0.06));
  box-shadow: 0 0 0 3px rgba(255, 224, 102, 0.25);
}

.item-emoji {
  font-size: 32px;
  line-height: 1;
}

.item-emoji img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.item-label {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

/* ── Category drop zones ──────────────────── */
.categories {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.category {
  border: 2px dashed rgba(111, 217, 138, 0.25);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.15);
  padding: 14px;
  min-height: 120px;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.12s ease;
}

.category.is-hover {
  border-color: var(--chip);
  background: rgba(255, 224, 102, 0.08);
  transform: scale(1.01);
}

.category-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 800;
}

.category-title span:last-child {
  background: rgba(111, 217, 138, 0.18);
  border-radius: 999px;
  font-size: 13px;
  padding: 2px 9px;
  color: var(--accent);
}

.category-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.category-items {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Placed chips ─────────────────────────── */
.placed-chip {
  border-radius: 999px;
  padding: 5px 11px;
  background: rgba(111, 217, 138, 0.16);
  border: 1px solid rgba(111, 217, 138, 0.3);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
}

.placed-chip .chip-emoji { font-size: 15px; line-height: 1; }

.placed-chip .chip-emoji img {
  width: 18px;
  height: 18px;
  object-fit: cover;
  border-radius: 5px;
  display: block;
}

/* ── Footer ───────────────────────────────── */
.footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.feedback {
  min-height: 22px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.feedback.ok  { color: var(--ok); }
.feedback.bad { color: var(--bad); }

/* ── Result screen ────────────────────────── */
.result-emoji { font-size: 52px; }

.result-box {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
}

.result-stat {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.result-stat-label { color: var(--muted); font-size: 13px; }

.result-stat-value {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
}

.result-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 920px) {
  .brand-title  { font-size: 22px; }
  .game-layout  { grid-template-columns: 1fr; }
  .stats        { display: none; }
}

@media (max-width: 520px) {
  .bg   { padding-left: 12px; padding-right: 12px; }
  .card { padding: 16px; }
  .items-grid { grid-template-columns: repeat(2, 1fr); }
  #btnBackHome { top: 10px; left: 10px; }
}

/* Emoji placeholders are intentionally hidden — items use labels/images. */
.question-emoji,.result-emoji,.learn-emoji,.missed-emoji { display: none !important; }
