/* Kanoot — shared colorful theme */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg1: #46178f;
  --bg2: #7b2ff7;
  --card: rgba(255, 255, 255, 0.97);
  --ink: #1f1f2e;
  --muted: #6b6b80;
  --accent: #ffa602;
  --red: #e21b3c;
  --blue: #1368ce;
  --yellow: #d89e00;
  --green: #26890c;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

html, body { height: 100%; }

body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, var(--bg1), var(--bg2) 60%, #2d0a5e);
  background-attachment: fixed;
  color: #fff;
  min-height: 100vh;
}

/* floating decorative blobs */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.12;
  z-index: 0;
  pointer-events: none;
}
body::before {
  width: 40vmin; height: 40vmin;
  background: #ffa602;
  top: -10vmin; right: -10vmin;
  animation: float1 14s ease-in-out infinite;
}
body::after {
  width: 34vmin; height: 34vmin;
  background: #26d0ce;
  bottom: -8vmin; left: -8vmin;
  animation: float1 18s ease-in-out infinite reverse;
}
@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-4vmin, 4vmin) scale(1.15); }
}

main, .page { position: relative; z-index: 1; }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

h1.logo {
  font-size: clamp(2.2rem, 6vw, 4rem);
  text-align: center;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
  margin: 16px 0;
}
h1.logo .k { color: var(--accent); }

.tagline { text-align: center; opacity: 0.85; margin-bottom: 28px; font-size: 1.1rem; }

.card {
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card h2 { margin-bottom: 12px; }
.card h3 { margin: 14px 0 8px; }

.muted { color: var(--muted); font-size: 0.92rem; }

/* ------------------------------------------------------------- buttons */
button, .btn {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  cursor: pointer;
  background: var(--accent);
  color: #2d1a00;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:active, .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.25); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-big { font-size: 1.4rem; padding: 18px 34px; border-radius: 14px; }
.btn-ghost { background: rgba(255,255,255,0.14); color: #fff; border: 2px solid rgba(255,255,255,0.5); }
.btn-danger { background: var(--red); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; box-shadow: 0 2px 0 rgba(0,0,0,0.25); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* -------------------------------------------------------------- inputs */
input[type="text"], input[type="number"], input[type="url"], select, textarea {
  font: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid #d5d5e2;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 3px solid #b89aff; border-color: #7b2ff7; }
label.field { display: block; margin: 10px 0; font-weight: 600; color: var(--ink); }
label.field > span { display: block; margin-bottom: 4px; font-size: 0.9rem; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 140px; }

/* ------------------------------------------------------- answer buttons */
.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.answer-btn {
  color: #fff;
  font-size: clamp(1rem, 3.5vw, 1.6rem);
  font-weight: 800;
  min-height: 84px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-align: left;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3);
}
.answer-btn .shape { font-size: 1.6em; line-height: 1; }
.answer-btn.selected { outline: 5px solid #fff; transform: scale(0.97); }
.answer-btn.dim { opacity: 0.3; }
.answer-btn.win { animation: pulse 0.6s ease-in-out 3; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* -------------------------------------------------------------- avatars */
.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
@media (max-width: 600px) { .avatar-grid { grid-template-columns: repeat(6, 1fr); } }
.avatar-pick {
  font-size: 1.8rem;
  background: #f0eefc;
  border-radius: 10px;
  padding: 8px 0;
  text-align: center;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.1s;
}
.avatar-pick:hover { transform: scale(1.15); }
.avatar-pick.selected { outline: 4px solid var(--bg2); background: #e4d9ff; }

/* --------------------------------------------------------------- lobby */
.pin-banner {
  text-align: center;
  margin: 10px 0 16px;
}
.pin-banner .pin {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  letter-spacing: 12px;
  background: #fff;
  color: var(--bg1);
  border-radius: 16px;
  display: inline-block;
  padding: 6px 30px 6px 42px;
  box-shadow: var(--shadow);
}
.qr-box { width: min(38vmin, 260px); margin: 12px auto; background: #fff; padding: 10px; border-radius: 12px; }
.qr-box svg { display: block; width: 100%; height: auto; }

.player-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 14px 0; }
.player-chip {
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 999px;
  padding: 8px 18px 8px 10px;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.player-chip.ready { background: rgba(38, 137, 12, 0.55); border-color: #6cf05e; }
.player-chip .em { font-size: 1.5rem; }
@keyframes pop-in { from { transform: scale(0); } to { transform: scale(1); } }

/* --------------------------------------------------------------- timer */
.timer-bar-wrap { background: rgba(0,0,0,0.3); border-radius: 999px; height: 18px; overflow: hidden; margin: 10px 0; }
.timer-bar { height: 100%; background: linear-gradient(90deg, #26d0ce, #ffa602); border-radius: 999px; transition: width 0.2s linear; }

.count-big {
  font-size: clamp(5rem, 18vw, 12rem);
  font-weight: 900;
  text-align: center;
  animation: pop-in 0.5s;
  text-shadow: 4px 4px 0 rgba(0,0,0,0.3);
}

/* --------------------------------------------------------------- reveal */
.reveal-box { display: flex; justify-content: center; margin: 12px 0; }
.reveal-wrap { position: relative; display: inline-block; }
.reveal-img, .reveal-wrap img, .reveal-box canvas {
  max-width: 100%;
  max-height: 46vh;
  border-radius: 12px;
  display: block;
}
.censor-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(6, 1fr);
  border-radius: 12px;
  overflow: hidden;
}
.censor-cell { background: #111; transition: opacity 0.5s; }
.censor-cell.gone { opacity: 0; }

/* ---------------------------------------------------------- leaderboard */
.board { width: 100%; border-collapse: collapse; color: var(--ink); }
.board th, .board td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e8e8f2; }
.board tr.me { background: #fdf3d8; }
.board .num { text-align: right; font-variant-numeric: tabular-nums; }

.board-row-anim { animation: slide-in 0.4s ease both; }
@keyframes slide-in { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin: 24px 0; }
.podium .spot { text-align: center; flex: 0 0 26%; }
.podium .spot .who { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.podium .spot .em { font-size: 3rem; display: block; animation: bounce 1.2s infinite; }
.podium .spot .block {
  background: linear-gradient(180deg, #ffd34d, #ffa602);
  border-radius: 12px 12px 0 0;
  font-size: 2.2rem;
  font-weight: 900;
  color: #4b2d00;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.podium .p1 .block { height: 170px; }
.podium .p2 .block { height: 120px; background: linear-gradient(180deg, #e8e8f0, #b9b9c9); color: #333; }
.podium .p3 .block { height: 90px; background: linear-gradient(180deg, #e0a679, #b46f3c); color: #3d2000; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 99; }

/* -------------------------------------------------------- host question */
.host-q {
  font-size: clamp(1.6rem, 4.5vw, 3rem);
  font-weight: 800;
  text-align: center;
  margin: 12px 0;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.25);
}
.host-answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.host-answer {
  color: #fff;
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 800;
  border-radius: 12px;
  min-height: 90px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  box-shadow: var(--shadow);
}
.host-answer .shape { font-size: 1.6em; }
.host-answer.dim { opacity: 0.25; }
.host-answer .count { margin-left: auto; background: rgba(0,0,0,0.3); border-radius: 8px; padding: 2px 12px; }

.answered-counter {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  background: rgba(0,0,0,0.3);
  border-radius: 999px;
  display: inline-block;
  padding: 6px 22px;
}

/* pin drop */
.pin-image-wrap { position: relative; display: inline-block; touch-action: manipulation; }
.pin-image-wrap img { max-width: 100%; max-height: 55vh; border-radius: 12px; display: block; }
.pin-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: 2.2rem;
  filter: drop-shadow(2px 3px 2px rgba(0,0,0,0.5));
  pointer-events: none;
}
.pin-marker.target { font-size: 2.6rem; animation: bounce 1s infinite; }
.pin-marker.small { font-size: 1.4rem; opacity: 0.9; }

/* slider */
.slider-wrap { padding: 20px 6px; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 40px; }
.slider-value {
  font-size: clamp(2.4rem, 9vw, 4rem);
  font-weight: 900;
  text-align: center;
  color: var(--ink);
}

/* --------------------------------------------------------------- header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar .brand { font-size: 1.5rem; font-weight: 900; text-decoration: none; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,0.3); }
.topbar .brand .k { color: var(--accent); }

/* --------------------------------------------------------------- lists */
.item-list { list-style: none; }
.item-list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px; border-radius: 10px; margin-bottom: 8px;
  background: #f4f2fb; color: var(--ink);
}
.item-list li .grow { flex: 1; min-width: 150px; }
.item-list li .title { font-weight: 800; }

.tag {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  background: var(--bg2); color: #fff; border-radius: 6px; padding: 2px 8px;
}
.tag.alt { background: var(--green); }

/* fullscreen states (player) */
.fullstate {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 18px;
}
.fullstate .huge { font-size: clamp(2rem, 9vw, 3.4rem); font-weight: 900; text-shadow: 3px 3px 0 rgba(0,0,0,0.3); }
.fullstate .giant-emoji { font-size: 5rem; animation: bounce 1.4s infinite; }

.state-correct { background: var(--green); border-radius: var(--radius); box-shadow: var(--shadow); }
.state-wrong { background: var(--red); border-radius: var(--radius); box-shadow: var(--shadow); }
.state-correct, .state-wrong { width: 100%; padding: 30px 16px; animation: pop-in 0.35s cubic-bezier(0.34,1.56,0.64,1); }

.shake { animation: shake 0.5s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-10px); }
  40%,80% { transform: translateX(10px); }
}

.hidden { display: none !important; }

footer.tiny { text-align: center; opacity: 0.5; font-size: 0.8rem; padding: 20px 0; }
