/* Offline bundled Kahoot! Montserrat Fonts (Latin + Latin-Ext + Cyrillic + Cyrillic-Ext / Kazakh) */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/montserrat-500-v31-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/montserrat-500-v31-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/montserrat-500-v31-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/montserrat-500-v31-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/montserrat-700-v31-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/montserrat-700-v31-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/montserrat-700-v31-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/montserrat-700-v31-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/montserrat-900-v31-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/montserrat-900-v31-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/montserrat-900-v31-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/montserrat-900-v31-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Exact Reverse-Engineered Kahoot! Design Tokens */
:root {
  --k-font: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --k-white: #ffffff;
  --k-black: #000000;
  --k-dark: #333333;
  --k-grey-0: #fafafa;
  --k-grey-1: #f2f2f2;
  --k-grey-2: #cccccc;
  --k-grey-3: #b2b2b2;
  --k-grey-4: #6e6e6e;

  /* Official Brand Purple */
  --k-purple-0: #c2a5df;
  --k-purple-1: #864cbf;
  --k-purple-2: #46178f;
  --k-purple-3: #25076b;

  /* Official 4 Answer Colors */
  --k-red: #e21b3c;
  --k-red-dark: #c60929;
  --k-red-wrong: #ff3355;

  --k-blue: #1368ce;
  --k-blue-dark: #0542b9;
  --k-blue-light: #45a3e5;

  --k-yellow: #d89e00;
  --k-yellow-bright: #ffa602;
  --k-yellow-dark: #b38000;

  --k-green: #26890c;
  --k-green-dark: #106b03;
  --k-green-correct: #66bf39;

  /* Active Theme Variables */
  --bg-main: #46178f;
  --bg-deep: #25076b;
  --bg-shape-1: rgba(0, 0, 0, 0.14);
  --bg-shape-2: rgba(255, 255, 255, 0.08);

  /* Official Shadow Tokens */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
  --shadow-md: 0 2px 4px 0 rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 4px 12px 0 rgba(0, 0, 0, 0.22);
  --shadow-btn: inset 0 -4px 0 0 rgba(0, 0, 0, 0.25);
  --shadow-btn-active: inset 0 -2px 0 0 rgba(0, 0, 0, 0.25);
}

.theme-classic {
  --bg-main: #46178f;
  --bg-deep: #25076b;
  --bg-shape-1: rgba(20, 4, 56, 0.26);
  --bg-shape-2: rgba(154, 72, 232, 0.24);
}
.theme-midnight {
  --bg-main: #122159;
  --bg-deep: #091133;
  --bg-shape-1: rgba(5, 10, 35, 0.32);
  --bg-shape-2: rgba(53, 138, 251, 0.18);
}
.theme-emerald {
  --bg-main: #0f6b4a;
  --bg-deep: #08402c;
  --bg-shape-1: rgba(4, 34, 23, 0.28);
  --bg-shape-2: rgba(102, 191, 57, 0.18);
}
.theme-crimson {
  --bg-main: #8c1434;
  --bg-deep: #4e091b;
  --bg-shape-1: rgba(40, 3, 12, 0.30);
  --bg-shape-2: rgba(255, 80, 120, 0.18);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: var(--k-font);
  color: var(--k-dark);
  background: var(--bg-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: var(--k-font);
}

/* Iconic Kahoot! Geometric Stage Backdrop */
.kahoot-stage {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.06), transparent 55%),
              linear-gradient(155deg, var(--bg-main) 0%, var(--bg-deep) 100%);
  overflow: hidden;
  transition: background 0.4s ease;
}

.kahoot-stage::before,
.kahoot-stage::after {
  content: '';
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

/* Left giant rotated square (exact kahoot.it motif) */
.kahoot-stage::before {
  width: 72vmax;
  height: 72vmax;
  background: var(--bg-shape-1);
  transform: rotate(45deg);
  bottom: -24vmax;
  left: -34vmax;
  border-radius: 12px;
}

/* Top-right giant circle (exact kahoot.it motif) */
.kahoot-stage::after {
  width: 64vmax;
  height: 64vmax;
  background: var(--bg-shape-2);
  border-radius: 50%;
  top: -20vmax;
  right: -16vmax;
}

.kahoot-stage > * {
  position: relative;
  z-index: 1;
}

/* Authentic 3D Kahoot! Push Button */
.k-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 4px;
  font-weight: 700;
  font-size: 16px;
  min-height: 48px;
  padding: 0 20px;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-btn);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease, opacity 0.15s ease;
  text-decoration: none;
}

.k-btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.k-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: var(--shadow-btn-active);
}

.k-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.k-btn-dark { background: #333333; color: #fff; }
.k-btn-white { background: #ffffff; color: #333333; }
.k-btn-blue { background: var(--k-blue); color: #fff; }
.k-btn-green { background: var(--k-green); color: #fff; }
.k-btn-red { background: var(--k-red); color: #fff; }
.k-btn-purple { background: var(--k-purple-2); color: #fff; }
.k-btn-ghost {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: none;
  backdrop-filter: blur(8px);
}
.k-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
}

/* Exact 4 Answer Color Classes */
.ans-color-0 { background-color: var(--k-red); color: #fff; }
.ans-color-1 { background-color: var(--k-blue); color: #fff; }
.ans-color-2 { background-color: var(--k-yellow); color: #fff; }
.ans-color-3 { background-color: var(--k-green); color: #fff; }

/* True/False maps cleanly to Kahoot Blue (True) & Red (False) */
.tf-color-0 { background-color: var(--k-blue); color: #fff; }
.tf-color-1 { background-color: var(--k-red); color: #fff; }

/* Language Switcher Pill (top-right like kahoot.it) */
.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: #333333;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.12s ease;
}
.lang-pill:hover { transform: scale(1.04); }

/* Shared Question / Multiplier Pills (Host & Player) */
.q-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  padding: 7px 16px;
  border-radius: 999px;
  white-space: nowrap;
}
.q-badge-double {
  background: var(--k-yellow-bright);
  color: #1d1d1b;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

/* Iconic Kahoot Rotating Diamond Loader */
.k-loader {
  width: 72px;
  height: 72px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  animation: k-spin-step 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.k-loader span {
  display: block;
  border-radius: 5px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
}
.k-loader span:nth-child(1) { background: var(--k-red); }
.k-loader span:nth-child(2) { background: var(--k-blue); }
.k-loader span:nth-child(3) { background: var(--k-yellow); }
.k-loader span:nth-child(4) { background: var(--k-green); }

@keyframes k-spin-step {
  0%   { transform: rotate(0deg) scale(1); }
  25%  { transform: rotate(90deg) scale(0.92); }
  50%  { transform: rotate(180deg) scale(1); }
  75%  { transform: rotate(270deg) scale(0.92); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes k-pop-in {
  0% { opacity: 0; transform: scale(0.75) translateY(14px); }
  65% { opacity: 1; transform: scale(1.04) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes k-pulse-urgent {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes k-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.shake { animation: k-shake 0.38s ease; }

/* Global Toast Notification */
.k-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(90px);
  background: #252525;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}
.k-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.hidden { display: none !important; }

/* Full-screen Confetti Canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 500;
}
