/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; width: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
  background: #1a0f2e;
  color: #f5f0ff;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

:root {
  --bg-1: #1a0f2e;
  --bg-2: #2d1b4e;
  --bg-3: #3d2466;
  --accent: #ffd23f;
  --accent-2: #ff6b9d;
  --primary: #7b5fff;
  --primary-2: #9b7dff;
  --good: #4ade80;
  --bad: #ef4444;
  --text: #f5f0ff;
  --text-dim: #b8a9d9;
  --card: rgba(255,255,255,0.08);
  --card-2: rgba(255,255,255,0.14);
  --border: rgba(255,255,255,0.2);
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(ellipse at top, var(--bg-3), var(--bg-1) 70%);
}

/* === SCREENS === */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-title {
  text-align: center;
  font-size: 2rem;
  margin: 8px 0 20px;
  color: var(--accent);
  text-shadow: 0 2px 0 rgba(0,0,0,0.3);
}
.section-title {
  font-size: 1.2rem;
  margin: 20px 0 10px;
  color: var(--accent-2);
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--card-2);
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
}
.btn:hover { background: rgba(255,255,255,0.2); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: var(--primary-2);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-2), var(--primary)); }
.btn-big { padding: 18px 28px; font-size: 1.2rem; min-width: 220px; }
.btn-icon { padding: 8px 12px; font-size: 1rem; min-width: 0; }
.btn-danger { background: linear-gradient(135deg, #c0392b, #e74c3c); border-color: #e74c3c; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* === MENU === */
.menu-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(155,125,255,0.3), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,107,157,0.3), transparent 40%);
  pointer-events: none;
  animation: slowPulse 6s ease-in-out infinite alternate;
}
@keyframes slowPulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}
#screen-menu { padding: 0; }
.menu-topbar {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}
.menu-topbar .btn-icon {
  padding: 8px 12px;
  font-size: 1.1rem;
}
.menu-topstats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.menu-topstats .stat {
  background: rgba(0,0,0,0.35);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
}
.menu-topstats .stat b { color: var(--accent); }
.stat-label { display: block; font-size: 0.55rem; color: var(--text-dim); font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; margin-top: 1px; }

.menu-content {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
  padding: 0 20px 30px;
  z-index: 1;
}
.title {
  font-size: 2.8rem;
  color: var(--accent);
  text-shadow:
    0 3px 0 #b8860b,
    0 6px 20px rgba(0,0,0,0.6);
  animation: titleBounce 2s ease-in-out infinite;
  margin-top: 6px;
}
@keyframes titleBounce {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1deg); }
}
.subtitle {
  font-size: 1rem;
  color: var(--text-dim);
  margin: 4px 0 16px;
  font-style: italic;
}

/* ── Hero karta s avatarem + info ─────────────────────── */
.menu-hero-card {
  background: linear-gradient(135deg, rgba(123,95,255,0.22), rgba(255,107,157,0.14));
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.menu-avatar-frame {
  background: radial-gradient(circle at center, rgba(255,210,63,0.25), transparent 70%);
  border: 3px solid var(--accent);
  border-radius: 50%;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(255,210,63,0.35);
  flex-shrink: 0;
  position: relative;
}
.menu-avatar-frame::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--primary), var(--accent));
  z-index: -1;
  opacity: 0.5;
  animation: frameRotate 8s linear infinite;
}
@keyframes frameRotate {
  to { transform: rotate(360deg); }
}
.menu-hero-info {
  flex: 1;
  text-align: left;
  min-width: 0;
}
.menu-hero-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
}
.menu-hero-level {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: 2px 0 8px;
}
.menu-hero-level b { color: var(--text); }
.menu-hero-xp-bar {
  height: 8px;
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.menu-hero-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.6s ease;
}

/* ── Hero CTA Hrát ─────────────────────── */
.btn-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 20px 30px;
  font-size: 1.6rem;
  font-weight: 900;
  font-family: inherit;
  color: #1a0f2e;
  background: linear-gradient(135deg, #ffd23f, #ffaa00, #ff6b9d);
  background-size: 200% 200%;
  border: 3px solid rgba(255,255,255,0.35);
  border-radius: 18px;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(0,0,0,0.35), 0 10px 30px rgba(255,210,63,0.4);
  transition: transform 0.1s, box-shadow 0.15s;
  animation: heroShine 5s ease-in-out infinite;
  letter-spacing: 1px;
  margin-bottom: 16px;
  text-transform: uppercase;
}
@keyframes heroShine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.btn-hero:hover { transform: translateY(-2px); box-shadow: 0 10px 0 rgba(0,0,0,0.35), 0 14px 36px rgba(255,210,63,0.55); }
.btn-hero:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 6px 16px rgba(255,210,63,0.3); }
.bh-icon {
  font-size: 1.4rem;
  background: rgba(0,0,0,0.15);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Truhlicový banner ─────────────────────── */
.menu-chest-banner {
  width: 100%;
  padding: 14px 18px;
  background: linear-gradient(135deg, #7b5fff, #b347ff);
  border: 2px solid #ffaa00;
  border-radius: 14px;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  animation: chestBannerPulse 1.4s ease-in-out infinite;
  box-shadow: 0 4px 20px rgba(123,95,255,0.5);
}
.menu-chest-banner.hidden { display: none; }
.mcb-icon {
  font-size: 1.8rem;
  animation: chestWiggle 0.8s ease-in-out infinite;
}
@keyframes chestWiggle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}
@keyframes chestBannerPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(123,95,255,0.5); }
  50% { box-shadow: 0 4px 30px rgba(255,210,63,0.7); }
}
.mcb-text b {
  font-size: 1.2rem;
  color: #ffd23f;
}

/* ── Info strip: streak / questy / odznaky ─────────────────────── */
.menu-info-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.mis-item {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.mis-item:hover { transform: translateY(-2px); background: rgba(0,0,0,0.45); }
.mis-item.active {
  border-color: #ff6b3d;
  box-shadow: 0 0 12px rgba(255, 107, 61, 0.3);
}
.mis-item.complete {
  border-color: var(--good);
  background: rgba(74,222,128,0.15);
}
.mis-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.mis-text {
  text-align: left;
  line-height: 1.1;
  min-width: 0;
}
.mis-text b {
  display: block;
  color: var(--accent);
  font-size: 0.95rem;
}
.mis-text small {
  color: var(--text-dim);
  font-size: 0.65rem;
}

/* ── 2×2 grid sekundárních akcí ─────────────────────── */
.menu-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.menu-action-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
}
.menu-action-card:hover {
  transform: translateY(-3px);
  background: var(--card-2);
  border-color: var(--accent);
}
.menu-action-card:active { transform: translateY(1px); }
.mac-icon {
  font-size: 2rem;
  line-height: 1;
}
.mac-label {
  font-size: 0.95rem;
  font-weight: 700;
}

/* === TOP BAR === */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 16px;
  flex-wrap: wrap;
}
.stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stat {
  background: var(--card);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  border: 1px solid var(--border);
}

/* === MAP TABS === */
.map-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 8px 10px 12px;
  flex-wrap: wrap;
}
.map-tab {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 800;
  font-family: inherit;
  color: var(--text-dim);
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.map-tab:hover { background: var(--card-2); }
.map-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: var(--primary-2);
  box-shadow: 0 4px 12px rgba(123,95,255,0.3);
}

/* === MAP PATH (vertikální cestička) === */
.map-path {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0 16px 20px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

/* Konektor (čára mezi světy) */
.map-connector {
  width: 4px;
  height: 28px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  flex-shrink: 0;
}
.map-connector.active {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  box-shadow: 0 0 8px rgba(123,95,255,0.3);
}

/* World card — horizontální */
.wc {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.wc-unlocked:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.wc-locked {
  opacity: 0.45;
  filter: grayscale(0.4);
}
.wc-final {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255,210,63,0.08), rgba(139,92,246,0.08));
}
.wc-final.wc-unlocked {
  box-shadow: 0 0 20px rgba(255,210,63,0.15);
}

/* Levá strana — číslo + ikona */
.wc-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 50px;
}
.wc-num {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-dim);
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wc-icon {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

/* Střed — název + popis + progress */
.wc-center {
  min-width: 0;
}
.wc-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 2px;
  line-height: 1.2;
}
.wc-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  line-height: 1.3;
}
.wc-progress-bar {
  height: 6px;
  background: rgba(0,0,0,0.4);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.wc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.5s ease;
}
.wc-stars-label {
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* Pravá strana — level tlačítka */
.wc-levels {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}
.ld {
  background: var(--card-2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 700;
  color: var(--text);
  min-width: 50px;
  min-height: 50px;
  text-align: center;
  transition: all 0.15s;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ld:hover:not([disabled]) { background: var(--primary); transform: scale(1.1); }
.ld[disabled] { cursor: not-allowed; opacity: 0.35; }
.ld-boss {
  background: linear-gradient(135deg, #7f1d1d, #b91c1c);
  border-color: #ef4444;
  font-size: 1.2rem;
}
.ld-done {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(255,210,63,0.25);
}
.ld-stars { display: block; font-size: 0.65rem; color: var(--accent); min-height: 0.65rem; margin-top: 2px; }

@media (max-width: 480px) {
  .wc { grid-template-columns: auto 1fr; gap: 10px; padding: 10px 12px; }
  .wc-levels { grid-column: 1 / -1; justify-content: center; margin-top: 8px; }
  .ld { min-width: 48px; min-height: 48px; padding: 8px 12px; }
  .map-tab { padding: 6px 12px; font-size: 0.8rem; }
  .collection-stats { grid-template-columns: repeat(2, 1fr); }
  .badges-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .hall-of-fame { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .hof-card { padding: 8px; gap: 6px; }
  .hof-card .hof-icon { font-size: 1.2rem; }
  .hof-card b { font-size: 0.85rem; }
  .hof-card small { font-size: 0.6rem; }
}

/* === LEVEL === */
.level-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}
.level-hud > span {
  background: var(--card);
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.streak:empty { display: none; }
.level-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  gap: 16px;
}
.question-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 24px 20px;
  max-width: 680px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
  transition: background 0.3s, border-color 0.3s, transform 0.2s;
  flex-shrink: 0;
}
.question-card.correct-flash {
  background: rgba(74,222,128,0.25);
  border-color: var(--good);
  animation: shake-ok 0.4s;
}
.question-card.wrong-flash {
  background: rgba(239,68,68,0.25);
  border-color: var(--bad);
  animation: shake-bad 0.4s;
}
@keyframes shake-ok {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@keyframes shake-bad {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.prompt {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.subject {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  margin: 12px 0;
  text-shadow: 0 2px 0 rgba(0,0,0,0.3);
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.subject .blank {
  display: inline-block;
  min-width: 40px;
  padding: 0 6px;
  border-bottom: 3px dashed var(--accent-2);
  color: var(--accent-2);
}
.subject .blank.active-blank {
  background: rgba(255, 210, 63, 0.25);
  border-radius: 6px 6px 0 0;
  animation: blinkBlank 1s ease-in-out infinite;
}
@keyframes blinkBlank {
  0%, 100% { background: rgba(255, 210, 63, 0.25); }
  50% { background: rgba(255, 210, 63, 0.55); }
}
.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 16px;
  width: 100%;
}
.options.two { grid-template-columns: 1fr 1fr; max-width: 360px; margin-left: auto; margin-right: auto; }
.options.four { grid-template-columns: 1fr 1fr; }
.option-btn {
  padding: 16px 14px;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--card-2);
  border: 2px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
  overflow-wrap: break-word;
  word-break: keep-all;
  white-space: nowrap;
  min-width: 0;
}
.option-btn:hover:not([disabled]) { background: var(--primary); transform: translateY(-2px); }
.option-btn:active:not([disabled]) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.option-btn.correct {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  border-color: var(--good);
  animation: popIn 0.3s;
}
.option-btn.wrong {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  border-color: var(--bad);
}
.option-btn[disabled] { cursor: default; }
@keyframes popIn {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.feedback {
  min-height: 30px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

/* === RESULT === */
.result-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 30px 20px;
  max-width: 560px;
  margin: auto;
  text-align: center;
  box-shadow: var(--shadow);
}
.result-card h2 {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 16px;
}
.stars {
  font-size: 3rem;
  margin: 10px 0 20px;
  letter-spacing: 6px;
}
.stars .star {
  display: inline-block;
  filter: grayscale(1) opacity(0.3);
  transition: filter 0.4s, transform 0.4s;
}
.stars .star.on {
  filter: none;
  animation: starPop 0.5s ease-out;
}
@keyframes starPop {
  0% { transform: scale(0) rotate(-180deg); filter: none; }
  60% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}
.result-stats {
  display: grid;
  gap: 8px;
  background: var(--card);
  padding: 16px;
  border-radius: 14px;
  margin: 16px 0;
  font-size: 1.05rem;
}
.result-stats b { color: var(--accent); }
.mistakes {
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-dim);
  max-height: 180px;
  overflow-y: auto;
  padding: 4px 8px;
}
.mistakes .mistake {
  background: rgba(239,68,68,0.12);
  border-left: 3px solid var(--bad);
  padding: 6px 10px;
  margin: 6px 0;
  border-radius: 6px;
}
.result-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* === BOSS === */
.boss-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px;
  overflow-y: auto;
}
.boss-stage {
  text-align: center;
  flex-shrink: 0;
}
.boss-sprite {
  font-size: 3.5rem;
  display: inline-block;
  animation: bossFloat 2s ease-in-out infinite;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5));
}
.boss-sprite.hit { animation: bossHit 0.4s; }
@keyframes bossFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes bossHit {
  0%, 100% { transform: translateX(0); filter: brightness(1); }
  25% { transform: translateX(-10px); filter: brightness(2) hue-rotate(-30deg); }
  75% { transform: translateX(10px); filter: brightness(2); }
}
.hp-bar {
  width: 280px;
  max-width: 90%;
  height: 16px;
  background: rgba(0,0,0,0.4);
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 8px auto 4px;
}
.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  width: 100%;
  transition: width 0.4s;
}
.boss-name {
  color: var(--accent-2);
  font-weight: 700;
  font-size: 1.1rem;
}
.timer-bar {
  width: 100%;
  max-width: 680px;
  height: 6px;
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  overflow: hidden;
}
.timer-fill {
  height: 100%;
  background: var(--accent);
  width: 100%;
  transition: width 0.1s linear;
}

/* === COLLECTION === */
.collection-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 10px;
}
.collection-stats .stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  min-width: 0;
}
.collection-stats .stat-card b {
  display: block;
  font-size: 1.2rem;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
}
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 10px;
}
.badge-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
  font-size: 0.75rem;
  min-width: 0;
  overflow: hidden;
}
.badge-card.locked { opacity: 0.35; filter: grayscale(1); }
.badge-card .badge-icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 4px;
}
.badge-card .badge-name {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
}
.costumes {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 10px;
}
.costume-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  min-width: 110px;
}
.costume-card.active { border-color: var(--accent); }
.costume-card.locked { opacity: 0.4; cursor: not-allowed; }
.costume-card .wizard { font-size: 2.5rem; display: block; }

/* === SETTINGS === */
.settings-list {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 1.05rem;
  cursor: pointer;
}
.setting-row input[type="checkbox"] {
  width: 22px; height: 22px; cursor: pointer;
}
.voice-select {
  background: var(--bg-2);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  max-width: 60%;
}
.hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* === MODAL === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.2s;
}
.modal.hidden { display: none; }
.modal-card {
  background: linear-gradient(160deg, var(--bg-3), var(--bg-2));
  border: 2px solid var(--accent);
  border-radius: 18px;
  padding: 24px 20px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
  animation: popIn 0.3s;
}
.modal-card h3 {
  color: var(--accent);
  font-size: 1.4rem;
  margin-bottom: 8px;
}
.modal-card p {
  color: var(--text);
  margin: 12px 0 18px;
  line-height: 1.5;
}
.modal-icon { font-size: 3rem; }

/* === TOAST === */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  background: var(--accent);
  color: #1a0f2e;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === CONFETTI === */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 14px;
  top: -20px;
  animation: fall linear forwards;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* =============================================================
   ENGAGEMENT UPDATE — avatar, home, wardrobe, chest, quests, HoF
   ============================================================= */

/* === AVATAR (vrstvený) === */
.avatar {
  position: relative;
  display: inline-block;
  line-height: 1;
  transform-origin: 50% 100%;
  transition: transform 0.3s;
}
.avatar-huge   { width: 140px; height: 170px; font-size: 7rem; }
.avatar-large  { width: 110px; height: 140px; font-size: 5.5rem; }
.avatar-medium { width: 80px;  height: 100px; font-size: 4rem;   }
.avatar-small  { width: 55px;  height: 70px;  font-size: 2.6rem; }
.avatar-tiny   { width: 44px;  height: 56px;  font-size: 2rem;   }

.avatar-body {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
}
.avatar-hat {
  position: absolute;
  top: -8%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55em;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  z-index: 2;
}
.avatar-staff {
  position: absolute;
  top: 35%;
  right: -5%;
  font-size: 0.5em;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  z-index: 3;
  animation: staffFloat 2s ease-in-out infinite;
}
.avatar-pet {
  position: absolute;
  bottom: -5%;
  right: -15%;
  font-size: 0.45em;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  animation: petFloat 1.8s ease-in-out infinite;
}
@keyframes staffFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-3px) rotate(2deg); }
}
@keyframes petFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Animace reakcí */
.avatar-correct { animation: avatarNod 0.5s ease; }
.avatar-wrong   { animation: avatarShake 0.5s ease; }
.avatar-celebrate { animation: avatarJump 0.9s ease; }
@keyframes avatarNod {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-6px) rotate(-4deg); }
  60% { transform: translateY(0) rotate(4deg); }
}
@keyframes avatarShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-3deg); }
  40% { transform: translateX(8px) rotate(3deg); }
  60% { transform: translateX(-6px) rotate(-2deg); }
  80% { transform: translateX(6px) rotate(2deg); }
}
@keyframes avatarJump {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-25px) scale(1.1); }
  60% { transform: translateY(-10px) scale(0.95); }
  100% { transform: translateY(0) scale(1); }
}

/* === MENU — avatar + streak === */
.menu-avatar-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}
.menu-streak {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  margin: 10px auto 16px;
  max-width: 320px;
  text-align: center;
}
.streak-label {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 700;
}
.streak-days {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.streak-day {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
}
.streak-day.on {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #1a0f2e;
  border-color: #fbbf24;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}
.chest-badge {
  display: inline-block;
  background: var(--accent);
  color: #1a0f2e;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  margin-left: 4px;
  animation: chestPulse 1.4s ease-in-out infinite;
}
@keyframes chestPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Top avatar v HUDu */
.top-avatar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* === HOME === */
.home-body {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 10px;
}
.home-stage {
  background: rgba(0,0,0,0.25);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 10px;
  margin-bottom: 16px;
  min-height: 320px;
  position: relative;
  overflow: hidden;
}
.home-stage-inner {
  position: relative;
  width: 100%;
  height: 300px;
  /* dřevěná "podlaha" gradient */
  background: linear-gradient(180deg, transparent 65%, rgba(120,60,20,0.25) 68%, rgba(80,40,10,0.35) 100%);
  border-radius: 14px;
}
.home-avatar-center {
  position: absolute;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%);
  z-index: 5;
}
.placed-item {
  position: absolute;
  font-size: 3rem;
  cursor: pointer;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
  transition: transform 0.2s;
}
.placed-item:hover {
  transform: scale(1.15);
  z-index: 10;
}
.placed-item.rarity-rare      { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)) drop-shadow(0 0 6px rgba(74,222,128,0.6)); }
.placed-item.rarity-epic      { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)) drop-shadow(0 0 8px rgba(139,92,246,0.7)); }
.placed-item.rarity-legendary { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)) drop-shadow(0 0 12px rgba(251,191,36,0.9)); }

/* --- Pozadí karty --- */
.backgrounds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.bg-card {
  height: 50px;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s;
}
.bg-card:hover { transform: scale(1.03); }
.bg-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(255,210,63,0.5);
}
.bg-card.locked { opacity: 0.5; cursor: not-allowed; }
.bg-card-name {
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* --- Furniture inventář --- */
.furniture-inventory {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.furniture-inventory .furniture-item {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 6px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: transform 0.15s, background 0.2s;
  text-align: center;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.furniture-inventory .furniture-item:hover { transform: translateY(-3px); }
.furniture-inventory .furniture-item.placed {
  background: rgba(74,222,128,0.15);
  border-color: var(--good);
}
.fi-icon { font-size: 2.2rem; }
.fi-name { font-size: 0.8rem; font-weight: 700; }
.fi-check { font-size: 0.7rem; color: var(--good); }
.trophies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.trophy-slot {
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
}
.trophy-slot.earned {
  background: linear-gradient(135deg, rgba(251,191,36,0.2), rgba(245,158,11,0.1));
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px rgba(255, 210, 63, 0.2);
}
.trophy-icon {
  display: block;
  font-size: 2.8rem;
  margin-bottom: 4px;
}
.trophy-name {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.trophy-slot.earned .trophy-name { color: var(--accent); font-weight: 600; }

.furniture-grid {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 80px;
  align-items: center;
  justify-content: center;
}
.furniture-item {
  font-size: 2.4rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: rgba(255,255,255,0.06);
  transition: transform 0.2s;
}
.furniture-item:hover { transform: translateY(-3px); }

/* === WARDROBE === */
.wardrobe-body {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wardrobe-preview {
  background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(255,210,63,0.08));
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}
.wp-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
}
.wp-outfit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wp-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0,0,0,0.25);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
}
.wp-label { color: var(--text-dim); font-weight: 600; }
.wp-value { color: var(--accent); font-weight: 700; }

/* === Tabs === */
.wardrobe-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.wardrobe-tab {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.1s, background 0.2s;
}
.wardrobe-tab:hover { background: rgba(255,255,255,0.15); }
.wardrobe-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: var(--primary-2);
  box-shadow: 0 4px 12px rgba(123, 95, 255, 0.3);
}
.wt-icon { font-size: 1.2rem; }
.wt-label { font-size: 0.95rem; }

/* === Item grid === */
.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.wardrobe-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 14px 10px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.wardrobe-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.wc-rarity-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: #9ca3af;
}
.wardrobe-card.rarity-rare      .wc-rarity-bar { background: linear-gradient(90deg, #22c55e, #4ade80); }
.wardrobe-card.rarity-epic      .wc-rarity-bar { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.wardrobe-card.rarity-legendary .wc-rarity-bar {
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #fde047);
  animation: shineBar 2s linear infinite;
  background-size: 200% 100%;
}
@keyframes shineBar {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.wc-icon-wrap {
  position: relative;
  margin-top: 8px;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  border-radius: 50%;
}
.wc-icon {
  font-size: 2.8rem;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
}
.wc-equipped-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--good);
  color: #0a3b1a;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.8rem;
  border: 2px solid var(--bg-1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.wc-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 4px;
}
.wc-rarity-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.wc-bonus {
  font-size: 0.72rem;
  color: #4ade80;
  background: rgba(74,222,128,0.12);
  padding: 2px 8px;
  border-radius: 6px;
  margin: 2px 0;
}
.wc-status {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 10px;
  width: 100%;
  margin-top: auto;
}
.wardrobe-card.status-equipped .wc-status {
  background: rgba(74,222,128,0.2);
  color: var(--good);
  border: 1px solid rgba(74,222,128,0.4);
}
.wardrobe-card.status-equipped {
  border-color: var(--good);
  box-shadow: 0 0 0 2px rgba(74,222,128,0.3);
}
.wardrobe-card.status-owned .wc-status {
  background: rgba(255,210,63,0.12);
  color: var(--accent);
  border: 1px solid rgba(255,210,63,0.3);
}
.wardrobe-card.status-buy .wc-status {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border: 1px solid var(--primary-2);
}
.wardrobe-card.status-expensive {
  opacity: 0.75;
}
.wardrobe-card.status-expensive .wc-status {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
  font-size: 0.72rem;
}
.wardrobe-card.status-expensive .wc-icon { filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4)) grayscale(0.6); }

@media (max-width: 600px) {
  .wardrobe-preview {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .wp-avatar { justify-self: center; }
  .wardrobe-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* === RARITY === */
.rarity-common    { border-color: #9ca3af !important; }
.rarity-rare      { border-color: #4ade80 !important; box-shadow: 0 0 0 1px rgba(74,222,128,0.2); }
.rarity-epic      { border-color: #8b5cf6 !important; box-shadow: 0 0 0 1px rgba(139,92,246,0.3); }
.rarity-legendary {
  border-color: #fbbf24 !important;
  box-shadow: 0 0 0 2px rgba(251,191,36,0.4), 0 0 20px rgba(251,191,36,0.3);
  animation: legendaryGlow 2s ease-in-out infinite;
}
@keyframes legendaryGlow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(251,191,36,0.4), 0 0 20px rgba(251,191,36,0.2); }
  50% { box-shadow: 0 0 0 3px rgba(251,191,36,0.6), 0 0 30px rgba(251,191,36,0.5); }
}

/* === QUESTS === */
.quests-body {
  max-width: 700px;
  margin: 0 auto;
  padding: 10px;
  width: 100%;
}
.quests-streak-info {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  text-align: center;
  font-size: 1rem;
}
.quests-streak-info b { color: var(--accent); }
.quests-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.quest-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.quest-card.done {
  background: rgba(74,222,128,0.15);
  border-color: var(--good);
}
.quest-text {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.quest-bar {
  height: 8px;
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.quest-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.5s;
}
.quest-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* === HALL OF FAME === */
.hall-of-fame {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-width: 900px;
  margin: 0 auto 16px;
  padding: 0 10px;
}
.hof-card {
  background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(255,210,63,0.08));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.hof-card .hof-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.hof-card b {
  display: block;
  color: var(--accent);
  font-size: 1rem;
}
.hof-card small {
  display: block;
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* === CHEST modal === */
.chest-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 20px;
}
.chest-modal.hidden { display: none; }
.chest-inner {
  background: linear-gradient(160deg, var(--bg-3), var(--bg-1));
  border: 2px solid var(--accent);
  border-radius: 18px;
  padding: 30px 24px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.chest-stage {
  padding: 20px 0;
}
.chest-box {
  font-size: 6rem;
  display: inline-block;
  cursor: pointer;
  animation: chestShake 0.8s ease-in-out infinite;
  transition: transform 0.3s;
}
.chest-box:hover { transform: scale(1.1); }
.chest-box.opening {
  animation: chestOpen 0.6s ease forwards;
}
@keyframes chestShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(4deg); }
}
@keyframes chestOpen {
  0% { transform: scale(1); }
  50% { transform: scale(1.4) rotate(10deg); filter: brightness(2); }
  100% { transform: scale(0) rotate(180deg); filter: brightness(3); opacity: 0; }
}
.chest-hint {
  color: var(--text-dim);
  margin-top: 10px;
  animation: bounce 1s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.loot-display {
  padding: 30px 20px;
  border-radius: 16px;
  margin-bottom: 16px;
  border: 3px solid var(--border);
  animation: lootReveal 0.6s ease;
}
@keyframes lootReveal {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(10deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.loot-icon {
  font-size: 5rem;
  margin-bottom: 10px;
}
.loot-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.loot-rarity {
  font-size: 0.9rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* === CUTSCENE === */
.cutscene {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 140;
  padding: 20px;
}
.cutscene.hidden { display: none; }
.cutscene-card {
  background: linear-gradient(160deg, #1a0f2e, #3d2466);
  border: 2px solid var(--accent);
  border-radius: 18px;
  padding: 30px 24px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}
.cutscene-card h3 {
  color: var(--accent);
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.cutscene-text {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.cutscene-line {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--text);
  animation: fadeInUp 0.5s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === LEVEL-UP banner === */
.level-up-banner {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 160;
  pointer-events: none;
  animation: lubPop 2.5s ease forwards;
}
.lub-inner {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #1a0f2e;
  padding: 24px 40px;
  border-radius: 20px;
  font-size: 1.6rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6), 0 0 60px rgba(251,191,36,0.6);
}
@keyframes lubPop {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-20deg); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.15) rotate(5deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  80% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.9) translateY(-30px); opacity: 0; }
}

/* === POINT POPUP === */
.point-popup {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 2px 0 #000, 0 0 20px rgba(255,210,63,0.6);
  pointer-events: none;
  z-index: 90;
  animation: pointFloat 1.5s ease forwards;
}
@keyframes pointFloat {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.2); }
  30% { transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80px) scale(0.9); }
}

/* === RESULT avatar === */
.result-avatar {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

/* === CRAFT / LABORATOŘ === */
.craft-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 10px;
  width: 100%;
}
.craft-ingredients {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}
.ingredient-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 60px;
}
.ingredient-badge .ib-icon { font-size: 2rem; }
.ingredient-badge .ib-count {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
}
.ingredient-badge .ib-name {
  font-size: 0.65rem;
  color: var(--text-dim);
}
.craft-recipes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.recipe-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recipe-card .rc-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.recipe-card .rc-icon { font-size: 2.2rem; }
.recipe-card .rc-name { font-size: 1rem; font-weight: 800; color: var(--text); }
.recipe-card .rc-desc { font-size: 0.8rem; color: var(--text-dim); }
.recipe-card .rc-cost {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  margin: 4px 0;
}
.recipe-card .rc-cost .cost-item { display: flex; align-items: center; gap: 2px; }
.recipe-card .rc-cost .cost-item.missing { color: var(--bad); }
.recipe-card .rc-cost .cost-item.have { color: var(--good); }
.recipe-card .btn-brew {
  padding: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border: 2px solid #a78bfa;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s;
}
.recipe-card .btn-brew:hover:not([disabled]) { transform: translateY(-2px); }
.recipe-card .btn-brew[disabled] { opacity: 0.4; cursor: not-allowed; }
.recipe-card .btn-brew.brewing {
  animation: brewBubble 0.6s ease;
}
@keyframes brewBubble {
  0% { transform: scale(1); }
  30% { transform: scale(1.1) rotate(-3deg); }
  60% { transform: scale(0.95) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}
.craft-potions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 50px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.potion-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.potion-badge .pb-icon { font-size: 2rem; }
.potion-badge .pb-count { font-size: 1rem; font-weight: 800; color: var(--accent); }
.potion-badge .pb-name { font-size: 0.65rem; color: var(--text-dim); }

/* === POTION MODAL === */
.potion-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 130;
  padding: 20px;
}
.potion-modal.hidden { display: none; }
.potion-modal-card {
  background: linear-gradient(160deg, var(--bg-3), var(--bg-1));
  border: 2px solid var(--accent);
  border-radius: 18px;
  padding: 24px 20px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}
.potion-modal-card h3 {
  color: var(--accent);
  font-size: 1.3rem;
  margin-bottom: 14px;
}
.potion-modal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}
.potion-use-btn {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 90px;
  transition: transform 0.15s, border-color 0.2s;
}
.potion-use-btn:hover { transform: translateY(-3px); border-color: var(--accent); }
.potion-use-btn .pub-icon { font-size: 1.8rem; }
.potion-use-btn .pub-name { font-size: 0.75rem; font-weight: 700; }
.potion-use-btn .pub-count { font-size: 0.7rem; color: var(--text-dim); }

/* === HINT BAR (Lektvar paměti) === */
.hint-bar {
  background: linear-gradient(90deg, rgba(251,191,36,0.2), rgba(139,92,246,0.15));
  border: 1px solid rgba(251,191,36,0.4);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 8px;
  text-align: center;
}
.hint-bar.hidden { display: none; }

/* === ACTIVE EFFECTS v level HUD === */
.active-effects {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
  min-height: 0;
}
.active-effects:empty { display: none; }
.effect-pill {
  background: rgba(139,92,246,0.25);
  border: 1px solid rgba(139,92,246,0.5);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
}

/* === REPORT BUG === */
.report-link {
  display: block;
  margin: 10px auto 0;
  padding: 4px 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.report-link:hover { opacity: 1; color: var(--accent-2); }

/* === LEADERBOARD === */
.lb-body { max-width: 600px; margin: 0 auto; padding: 10px; }
.lb-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.lb-tab {
  padding: 8px 20px; font-size: 0.95rem; font-weight: 800; font-family: inherit;
  background: var(--card); border: 2px solid var(--border); border-radius: 12px;
  color: var(--text-dim); cursor: pointer; transition: all 0.15s;
}
.lb-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: var(--primary-2); }
.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; font-size: 0.9rem;
}
.lb-row.top3 { border-color: var(--accent); background: linear-gradient(135deg, rgba(255,210,63,0.08), var(--card)); }
.lb-rank { font-weight: 900; color: var(--accent); font-size: 1.1rem; text-align: center; }
.lb-row.top3:nth-child(1) .lb-rank { font-size: 1.4rem; }
.lb-name { font-weight: 700; color: var(--text); }
.lb-school { font-size: 0.7rem; color: var(--text-dim); }
.lb-score { font-weight: 800; color: var(--accent); font-size: 0.95rem; text-align: right; }
.lb-score small { display: block; font-size: 0.65rem; color: var(--text-dim); font-weight: 600; }
.lb-loading { text-align: center; color: var(--text-dim); }

/* === SPONSOR === */
.sponsor-footer {
  text-align: center;
  margin-top: 20px;
  padding: 8px 0;
}
.sponsor-footer a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.7rem;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.sponsor-footer a:hover { opacity: 1; color: var(--accent); }
.sponsor-footer b { color: var(--text); }

/* === SCHOOL AUTOCOMPLETE === */
.school-search-wrap { position: relative; }
.school-suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  background: var(--bg-2); border: 2px solid var(--border); border-top: none;
  border-radius: 0 0 12px 12px; max-height: 200px; overflow-y: auto;
}
.school-suggestions.hidden { display: none; }
.school-suggestion {
  padding: 10px 14px; font-size: 0.85rem; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--text); transition: background 0.1s;
}
.school-suggestion:hover, .school-suggestion.active { background: var(--primary); color: #fff; }
.school-suggestion em { font-style: normal; color: var(--accent); font-weight: 700; }

/* === AUTH === */
.menu-auth-btn {
  display: block;
  margin: 0 auto 12px;
  padding: 8px 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s;
}
.menu-auth-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.menu-auth-btn.logged-in { border-color: var(--good); color: var(--good); }

.auth-body {
  max-width: 420px;
  margin: 0 auto;
  padding: 20px;
}
.auth-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 30px 24px;
  text-align: center;
}
.auth-icon { font-size: 4rem; margin-bottom: 16px; }
.auth-field {
  text-align: left;
  margin-bottom: 14px;
}
.auth-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.auth-field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.1rem;
  font-family: inherit;
  background: rgba(0,0,0,0.3);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid var(--bad);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  color: #fca5a5;
  font-size: 0.85rem;
}
.auth-error.hidden { display: none; }
.auth-btn {
  width: 100%;
  margin-bottom: 8px;
}
.auth-skip {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 8px;
}
.auth-info {
  background: var(--card);
  border: 2px solid var(--good);
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  margin-top: 16px;
}
.auth-info.hidden { display: none; }
.auth-info b { color: var(--accent); }

/* === RESPONSIVE === */
@media (max-width: 600px) {
  .title { font-size: 2.5rem; }
  .subject { font-size: 1.8rem; }
  .btn-big { min-width: 180px; padding: 14px 20px; }
  .screen { padding: 10px; }
  .level-hud { font-size: 0.85rem; gap: 6px; }
  .level-hud > span { padding: 4px 8px; }
  .options.four { grid-template-columns: 1fr 1fr; }
  .stars { font-size: 2.4rem; }
  .avatar-huge { font-size: 5rem; width: 100px; height: 130px; }
  .avatar-large { font-size: 4rem; width: 80px; height: 110px; }
}
@media (max-height: 620px) {
  .title { font-size: 2.4rem; margin-bottom: 0; }
  .subtitle { margin: 4px 0 20px; }
  .menu-buttons { gap: 10px; }
}
