:root{
  --bg1:#0b0b14;
  --bg2:#131328;
  --card:#16162e;
  --text:#e8e8ff;
  --muted:#a7a7c9;
  --line:#2b2b52;
  --accent:#b94cff;
  --accent2:#00d2ff;
  --danger:#ff3b7a;
  --ok:#30e07a;
  --warn:#ffcc00;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background: radial-gradient(1200px 700px at 20% 10%, #1b0f2a 0%, transparent 55%),
              radial-gradient(900px 600px at 80% 30%, #0b2a2a 0%, transparent 55%),
              linear-gradient(180deg, var(--bg1), var(--bg2));
}

.bg::before{
  content:"";
  position:fixed; inset:0;
  background-image: radial-gradient(circle at 10% 20%, rgba(185,76,255,.08), transparent 40%),
                    radial-gradient(circle at 90% 70%, rgba(0,210,255,.06), transparent 40%);
  pointer-events:none;
}

.screen{
  padding: 84px 16px 24px;
  max-width: 980px;
  margin: 0 auto;
}

.center{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
  padding:16px;
}

.topbar{
  position:fixed;
  top:0; left:0; right:0;
  height:72px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  background: rgba(10,10,22,.72);
  border-bottom:1px solid var(--line);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.top-left{ display:flex; align-items:center; gap:10px; }
.avatar{
  width:44px; height:44px;
  display:grid; place-items:center;
  border-radius:14px;
  background: linear-gradient(135deg, rgba(185,76,255,.25), rgba(0,210,255,.18));
  border:1px solid rgba(185,76,255,.25);
}
.label{ font-size:12px; color:var(--muted); }
.value{ font-weight:700; letter-spacing:.2px; }

.points{
  min-width:120px;
  padding:8px 12px;
  border-radius:16px;
  background: rgba(255,255,255,.04);
  border:1px solid var(--line);
  text-align:center;
}

.badges{ display:flex; gap:8px; align-items:center; }
.badge{
  width:34px; height:34px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  padding:4px;
}
.badge.off{
  filter: grayscale(1) brightness(.65);
  opacity:.55;
}

.card{
  background: rgba(22,22,46,.72);
  border:1px solid var(--line);
  border-radius:22px;
  padding:18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.title{ margin:0 0 8px; font-size:34px; letter-spacing:.3px; }
.subtitle{ margin:0 0 16px; color:var(--muted); }

.form{ display:flex; gap:10px; }
.input{
  flex:1;
  height:54px;
  border-radius:16px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.25);
  color:var(--text);
  font-size:18px;
  padding:0 14px;
  outline:none;
}
.input:focus{ border-color: rgba(185,76,255,.55); }

.btn{
  height:54px;
  padding:0 16px;
  border-radius:16px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color:var(--text);
  font-weight:700;
  font-size:16px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  user-select:none;
}
.btn.primary{
  border-color: rgba(185,76,255,.45);
  background: linear-gradient(135deg, rgba(185,76,255,.35), rgba(0,210,255,.18));
}
.btn.danger{
  border-color: rgba(255,59,122,.55);
  background: linear-gradient(135deg, rgba(255,59,122,.28), rgba(185,76,255,.18));
}
.btn.ghost{
  height:44px;
  border-radius:14px;
  padding:0 14px;
}

.alert{
  background: rgba(255,59,122,.12);
  border:1px solid rgba(255,59,122,.35);
  color: var(--text);
  padding:10px 12px;
  border-radius:16px;
  margin: 0 0 12px;
}

.hint{ margin:14px 0 0; color:var(--muted); font-size:13px; }

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}
@media (max-width: 700px){
  .grid{ grid-template-columns: 1fr; }
}

.room-tile{
  border-radius:22px;
  padding:18px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  text-decoration:none;
  color:var(--text);
}
.room-tile.locked{ opacity:.45; }
.room-icon{ font-size:34px; }
.room-name{ font-weight:900; margin-top:10px; font-size:20px; }
.room-desc{ color:var(--muted); margin-top:4px; }

.room-head{ margin: 8px 0 14px; }
.room-title{ margin: 0; font-size: 28px; }
.room-sub{ margin: 6px 0 0; color: var(--muted); }

.game{ padding: 14px; }
.difficulty{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom: 12px; }

.game-area{ display:block; }
.progress{
  display:flex;
  justify-content:space-between;
  color: var(--muted);
  margin-bottom: 10px;
}
.small{ font-size: 12px; }

.word-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px;
  border-radius:18px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
  margin-bottom: 12px;
}
.word-image{
  width:120px;
  height:120px;
  border-radius:18px;
  object-fit:cover;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
}
.cs-hint{
  flex:1;
  font-size:22px;
  font-weight:800;
  text-align:right;
  color: rgba(232,232,255,.92);
}

.board{
  border:1px solid var(--line);
  border-radius:18px;
  padding:12px;
  background: rgba(255,255,255,.03);
}
.board-title{ color: var(--muted); margin-bottom:10px; }

.slots{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom: 12px;
}
.slot{
  width:50px; height:54px;
  border-radius:16px;
  border:1px dashed rgba(185,76,255,.45);
  background: rgba(185,76,255,.08);
  color: var(--text);
  font-weight:900;
  font-size:22px;
}

.tiles{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom: 12px;
}
.tile{
  min-width:50px; height:54px;
  border-radius:16px;
  border:1px solid rgba(0,210,255,.35);
  background: rgba(0,210,255,.10);
  color: var(--text);
  font-weight:900;
  font-size:22px;
}

.actions{ display:flex; gap:10px; }

.feedback{
  margin-top: 10px;
  padding:10px 12px;
  border-radius:16px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
  color: var(--muted);
}
.feedback.ok{
  border-color: rgba(48,224,122,.35);
  background: rgba(48,224,122,.10);
  color: var(--text);
}
.feedback.bad{
  border-color: rgba(255,59,122,.35);
  background: rgba(255,59,122,.10);
  color: var(--text);
}
.feedback.warn{
  border-color: rgba(255,204,0,.35);
  background: rgba(255,204,0,.10);
  color: var(--text);
}

.confetti{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index: 999;
}

.game-finish{ text-align:center; }
footer.footer{
  padding: 16px;
  color: var(--muted);
  text-align:center;
}

.mode-select { padding: 6px 2px 2px; }
.mode-title { margin: 6px 0 12px; font-size: 20px; color: var(--text); }

.mode-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
}
@media (max-width: 800px){
  .mode-grid{ grid-template-columns: 1fr; }
}

.mode-btn{
  border-radius:22px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  padding:14px;
  cursor:pointer;
  text-align:center;
}
.mode-btn img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  display:block;
  margin-bottom:10px;
}
.mode-name{ font-weight:900; font-size:18px; }
.mode-desc{ color: var(--muted); margin-top:4px; }

.mode-btn.danger{
  border-color: rgba(255,59,122,.55);
  background: linear-gradient(135deg, rgba(255,59,122,.14), rgba(185,76,255,.12));
}


/* ===== LAB redesign (diagram layout, universal sizes) ===== */
body.lab .screen{ max-width: 1200px; }

.lab-card{ position: relative; overflow: hidden; padding: 14px; }

/* Stage: fixed height that fits most laptop/tablet landscapes */
.lab-stage{
  position: relative;
  width: 100%;
  height: min(720px, calc(100dvh - 170px)); /* fits even smaller laptops */
  border-radius: 22px;
}

/* Header row inside stage */
.lab-header{
  height: clamp(56px, 7vh, 72px);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 10px 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.16);
}

.lab-titlewrap{ display:flex; flex-direction:column; gap: 3px; }
.lab-title{ margin:0; font-size: clamp(20px, 2.6vw, 28px); }
.lab-sub{ color: var(--muted); font-size: 13px; }
.lab-back{ height:44px; border-radius:14px; }

/* MODE (difficulty select) */
.lab-mode2{
  margin-top: 12px;
  height: calc(100% - clamp(56px, 7vh, 72px) - 12px);
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap: 14px;
}
.lab-mode-title{ margin:0; font-size: 18px; color: var(--text); }
.lab-mode-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(760px, 100%);
}
@media (max-width: 800px){
  .lab-mode-grid{ grid-template-columns: 1fr; }
}
.lab-mode-btn{
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  padding: 16px;
  cursor:pointer;
  text-align:left;
}
.lab-mode-btn.danger{
  border-color: rgba(255,59,122,.55);
  background: linear-gradient(135deg, rgba(255,59,122,.14), rgba(185,76,255,.12));
}
.lab-mode-emoji{ font-size: 54px; line-height: 1; margin-bottom: 10px; }
.lab-mode-name{ font-weight: 900; font-size: 18px; }
.lab-mode-desc{ color: var(--muted); margin-top: 4px; }

/* GAME GRID: left buttons / center cauldron+ bubble / right teacher */
.lab-game2{
  position: relative;
  margin-top: 12px;
  height: calc(100% - clamp(56px, 7vh, 72px) - 12px);
  border-radius: 18px;
  border: 1px solid var(--line);
  overflow: hidden;

  display:grid;
  grid-template-columns: clamp(190px, 22vw, 260px) 1fr clamp(220px, 26vw, 340px);
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 12px;
}

.lab-bg2{
  position:absolute;
  inset:0;
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(185,76,255,.10), transparent 60%),
    radial-gradient(700px 500px at 80% 30%, rgba(0,210,255,.08), transparent 60%),
    url("/assets/img/rooms/lab_bg.png");
  background-size: cover;
  background-position: center;
  opacity: .30;
  pointer-events:none;
}

.lab-left, .lab-center, .lab-right2{
  position: relative;
  z-index: 1;
}

/* Left column */
.lab-left{
  grid-column: 1;
  grid-row: 1 / -1;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.lab-round{
  color: var(--muted);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.18);
}
.lab-dot{ margin: 0 6px; opacity: .7; }

.lab-answers-vert{
  display:flex;
  flex-direction:column;
  gap: 10px;
  flex: 1;
  justify-content:flex-start;
}

/* Answer buttons */
.lab-answer-btn{
  width: 100%;
  height: clamp(78px, 12vh, 110px);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  cursor:pointer;
  font-weight: 900;
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text);
  background: rgba(255,255,255,.04);
}

/* Easy = solid color fill (NO transparency) */
.lab-answer-btn.easy{
  border-color: rgba(255,255,255,.22);
  /* background set inline via JS: btn.style.background = c.hex */
  color: rgba(0,0,0,.0); /* no visible text */
}

/* Hard = Czech text only */
.lab-answer-btn.hard{
  background: rgba(0,0,0,.28);
  border-color: rgba(185,76,255,.28);
  color: var(--text);
}

/* Center column */
.lab-center{
  grid-column: 2;
  grid-row: 1 / -1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 14px;
}

/* Speech bubble */
.lab-bubble{
  max-width: min(520px, 100%);
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.20);
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 900;
  text-align:center;
  position: relative;
}
.lab-bubble::after{
  content:"";
  position:absolute;
  left: 50%;
  bottom: -10px;
  width: 18px;
  height: 18px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(0,0,0,.20);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* Cauldron */
.lab-cauldron{
  position: relative;
  width: clamp(260px, 34vw, 420px);
  aspect-ratio: 1/1;
  display:grid;
  place-items:center;
}
.lab-cauldron::after{
  content:"";
  position:absolute;
  left: 50%;
  top: 74%;
  width: 64%;
  height: 18%;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(0,0,0,.58), transparent 70%);
  filter: blur(10px);
  opacity: .85;
  pointer-events:none;
}
.lab-cauldron-img{
  width:100%;
  height:100%;
  object-fit:contain;
  filter: drop-shadow(0 22px 55px rgba(0,0,0,.55));
}

/* Right column */
.lab-right2{
  grid-column: 3;
  grid-row: 1 / -1;
  display:flex;
  align-items:stretch;
}
.teacher-card2{
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.18);
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.teacher-img2{
  width: 100%;
  flex: 1;
  max-height: 100%;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
}
.teacher-name2{ font-weight: 900; }

/* Spark burst */
.spark-burst{
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:0;
}
.spark-burst.go{ opacity:1; }

.spark{
  position:absolute;
  font-size: 40px;
  opacity: 0;
  animation: sparkPop 600ms ease-out forwards;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.35));
}

@keyframes sparkPop{
  0%   { transform: translate(0,0) scale(.65); opacity:0; }
  14%  { opacity:1; }
  100% {
    transform:
      translate(calc(-140px + 280px * var(--r, .5)), -140px)
      scale(1.45);
    opacity:0;
  }
}

/* Wrong boom: blur + shake */
body.boom main,
body.boom header.topbar{
  animation: boomShake 380ms ease-in-out;
  filter: blur(1.4px);
}
@keyframes boomShake{
  0%{ transform: translateX(0); }
  15%{ transform: translateX(-5px); }
  30%{ transform: translateX(5px); }
  45%{ transform: translateX(-4px); }
  60%{ transform: translateX(4px); }
  100%{ transform: translateX(0); }
}

/* Finish */
.lab-finish2{
  margin-top: 12px;
  height: calc(100% - clamp(56px, 7vh, 72px) - 12px);
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.18);
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap: 10px;
  padding: 16px;
  text-align:center;
}

/* Small screens: stack columns */
@media (max-width: 900px){
  .lab-game2{
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .lab-left{ grid-column: 1; grid-row: 1; }
  .lab-center{ grid-column: 1; grid-row: 2; }
  .lab-right2{ grid-column: 1; grid-row: 3; }
}

[hidden]{ display:none !important; }