/* ============================================================
   MM-Play Kahoot — shared theme (admin & player)
   Pastel soft profesional
   ============================================================ */
:root {
  --bg: #f4f1fb;
  --surface: #ffffff;
  --surface-2: #faf8ff;
  --text: #3b3a52;
  --text-soft: #6b6a82;
  --muted: #9b9ab2;
  --line: #ece9f6;
  --line-soft: #f1eef9;
  --lavender: #a78bfa;
  --lavender-deep: #8b5cf6;
  --pink: #f7a8c4;
  --mint: #7dd3c0;
  --sky: #9bc4e2;
  --butter: #ffe08a;
  --peach: #ffb5a7;

  /* tile warna Kahoot (soft tapi tegas) */
  --t-red: #e8685a;
  --t-blue: #4d9de0;
  --t-yellow: #f0b429;
  --t-green: #4cb782;

  --shadow-sm: 0 2px 8px rgba(91, 80, 145, .06);
  --shadow: 0 10px 30px rgba(91, 80, 145, .10);
  --shadow-lg: 0 20px 50px rgba(91, 80, 145, .18);
  --radius: 18px;
  --radius-lg: 26px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #efe6ff 0%, transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, #ffe4f1 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
ul, ol { list-style: none; }

/* ---------- topbar ---------- */
.kk-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px;
  background: rgba(244, 241, 251, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.kk-back {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-soft);
  box-shadow: var(--shadow-sm); transition: .18s;
}
.kk-back:hover { color: var(--lavender-deep); border-color: var(--lavender); }
.kk-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.kk-brand .dot { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--lavender), var(--pink)); display: grid; place-items: center; color: #fff; font-size: 14px; }
.kk-title { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 14px; font-weight: 700; font-size: 14.5px;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1); white-space: nowrap;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: background .2s;
}
.btn:hover::after { background: rgba(255,255,255,.08); }
.btn-primary {
  background: linear-gradient(135deg, var(--lavender) 0%, var(--lavender-deep) 100%);
  color: #fff; box-shadow: 0 8px 24px rgba(139, 92, 246, .38);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(139, 92, 246, .48); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 4px 12px rgba(139, 92, 246, .3); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.btn-ghost { background: rgba(255, 255, 255, .85); color: var(--text); border: 2px solid var(--line); }
.btn-ghost:hover { background: #fff; border-color: var(--lavender); box-shadow: 0 4px 16px rgba(139,92,246,.1); }
.btn-danger { background: #fff0ef; color: #c64a3a; border: 2px solid #f6c9c2; }
.btn-danger:hover { background: #ffe6e4; border-color: #f0a8a0; box-shadow: 0 4px 12px rgba(198,74,58,.12); }
.btn-block { width: 100%; }

/* ---------- screen system ---------- */
.kk-wrap { max-width: 980px; margin: 0 auto; padding: 28px 24px 60px; }
.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow);
}
.card-head { text-align: center; margin-bottom: 22px; }
.card-head h1 { font-size: 28px; letter-spacing: -.5px; }
.card-head p { color: var(--text-soft); font-size: 14.5px; margin-top: 6px; }

/* ---------- tiles (answer) ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  position: relative; border: none; border-radius: 18px;
  padding: 28px 20px; color: #fff; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; gap: 14px; text-align: left;
  box-shadow: var(--shadow); transition: transform .15s cubic-bezier(0.34,1.56,0.64,1), box-shadow .15s ease; 
  overflow: hidden; min-height: 100px; cursor: pointer;
}
.tile::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.15) 0%, transparent 60%);
  pointer-events: none;
}
.tile:hover:not(:disabled) { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow-lg); }
.tile:active:not(:disabled) { transform: scale(.97); }
.tile:disabled { cursor: default; }
.tile .shape {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: rgba(255, 255, 255, .28); display: grid; place-items: center; font-size: 20px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
}
.tile .txt { flex: 1; line-height: 1.3; }
.tile .mark { font-size: 24px; opacity: 0; transition: .18s; }
.tile.locked .mark { opacity: 1; }
.tile.t-red { background: linear-gradient(145deg, #f4796c 0%, var(--t-red) 100%); box-shadow: 0 8px 24px rgba(232,104,90,.35); }
.tile.t-blue { background: linear-gradient(145deg, #66b0ec 0%, var(--t-blue) 100%); box-shadow: 0 8px 24px rgba(77,157,224,.35); }
.tile.t-yellow { background: linear-gradient(145deg, #ffc24d 0%, var(--t-yellow) 100%); box-shadow: 0 8px 24px rgba(240,180,41,.35); }
.tile.t-green { background: linear-gradient(145deg, #62c897 0%, var(--t-green) 100%); box-shadow: 0 8px 24px rgba(76,183,130,.35); }
.tile.correct { 
  outline: 4px solid #fff; 
  box-shadow: 0 0 0 6px #2fa571, 0 12px 32px rgba(47,165,113,.4);
  animation: correctPop .35s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes correctPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.tile.wrong { filter: saturate(.6) brightness(.92); opacity: .75; }
.tile.dim { opacity: .45; }

/* ---------- timer ring ---------- */
.ring { position: relative; width: 84px; height: 84px; }
.ring svg { transform: rotate(-90deg); }
.ring .bg { stroke: var(--line); }
.ring .fg { stroke: var(--lavender-deep); transition: stroke-dashoffset .3s linear; }
.ring .num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 26px; font-weight: 800; color: var(--lavender-deep);
}
.ring.warn .fg { stroke: #e8685a; }
.ring.warn .num { color: #e8685a; }

/* ---------- chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
  background: rgba(167,139,250,.1); border: 1.5px solid rgba(139,92,246,.2); color: var(--text-soft);
  padding: 7px 14px; border-radius: 20px;
  transition: transform .15s, box-shadow .15s;
}
.chip:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139,92,246,.12); }
.chip b { color: var(--lavender-deep); font-size: 14px; }

/* ---------- lobby ---------- */
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: center; }
.pin-box {
  text-align: center; background: linear-gradient(135deg, #efe6ff, #ffe4f1);
  border-radius: var(--radius); padding: 30px; border: 1px dashed var(--lavender);
}
.pin-box .label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.pin-code {
  font-size: 54px; font-weight: 800; letter-spacing: 8px; color: var(--lavender-deep);
  margin: 8px 0 6px; font-variant-numeric: tabular-nums;
}
.pin-box .hint { font-size: 12.5px; color: var(--text-soft); }
.players-panel h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.players-panel h3 .count { font-size: 12px; background: var(--lavender); color: #fff; padding: 2px 9px; border-radius: 20px; }
.player-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 240px; overflow: auto; }
.player-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line-soft); font-size: 13.5px; font-weight: 600;
  animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.player-chip .av { width: 30px; height: 30px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.player-chip .av-img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--line); background: var(--surface-2); }

/* ---------- podium ---------- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin: 10px 0 26px; }
.podium .step { text-align: center; }
.podium .crown { font-size: 30px; margin-bottom: 4px; }
.podium .blk {
  width: 130px; border-radius: 14px 14px 0 0; padding: 16px 10px; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: var(--shadow);
}
.podium .blk .nm { font-weight: 800; font-size: 14px; }
.podium .blk .sc { font-size: 13px; opacity: .92; font-weight: 700; }
.podium .step:nth-child(1) .blk { background: linear-gradient(180deg, #ffd86b, #f0b429); height: 150px; color: #6b4a12; }
.podium .step:nth-child(2) .blk { background: linear-gradient(180deg, #d8dee8, #aeb9c9); height: 120px; color: #3a4252; }
.podium .step:nth-child(3) .blk { background: linear-gradient(180deg, #f0c9a6, #cf9b6a); height: 96px; color: #5a3815; }

.board { display: flex; flex-direction: column; gap: 8px; }
.brow {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1.5px solid var(--line-soft);
  transition: transform .15s, box-shadow .15s;
  animation: rowSlideIn .3s ease-out both;
}
@keyframes rowSlideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
.brow:hover { transform: translateX(4px); box-shadow: var(--shadow-sm); }
.brow.me { 
  background: linear-gradient(135deg, rgba(167,139,250,.15), rgba(247,168,196,.12)); 
  border-color: var(--lavender);
  box-shadow: 0 4px 16px rgba(139,92,246,.1);
}
.brow .rk { 
  width: 28px; height: 28px; border-radius: 8px; 
  background: linear-gradient(135deg, var(--line), #e8e4f8);
  color: var(--text-soft); font-weight: 800; font-size: 12px; display: grid; place-items: center;
  flex-shrink: 0;
}
.brow:first-child .rk { background: linear-gradient(135deg, #ffd700, #ffb300); color: #7a5000; }
.brow:nth-child(2) .rk { background: linear-gradient(135deg, #e0e0e0, #bdbdbd); color: #555; }
.brow:nth-child(3) .rk { background: linear-gradient(135deg, #ffcc80, #ff9800); color: #6d3a00; }
.brow .av { width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.brow .nm { font-weight: 700; font-size: 14px; flex: 1; }
.brow .sc { 
  font-weight: 800; font-size: 15px;
  background: linear-gradient(135deg, var(--lavender), var(--lavender-deep));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ---------- question header ---------- */
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.q-head .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.q-text { 
  text-align: center; font-size: 24px; font-weight: 800; letter-spacing: -.4px; line-height: 1.4; 
  margin-bottom: 22px; padding: 18px; 
  background: linear-gradient(135deg, #faf8ff 0%, #f4f0fe 100%);
  border-radius: 16px; border: 1.5px solid var(--line-soft);
}
.q-img { display: flex; justify-content: center; margin-bottom: 18px; }
.q-img img {
  max-width: 100%; max-height: 220px; border-radius: 16px; object-fit: contain;
  box-shadow: var(--shadow); border: 2px solid var(--line);
}

/* ---------- live answer bars (admin) ---------- */
.answer-stats { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.astat { display: flex; align-items: center; gap: 12px; }
.astat .sw { width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0; }
.astat .bar { flex: 1; height: 14px; border-radius: 8px; background: var(--line); overflow: hidden; }
.astat .bar i { display: block; height: 100%; border-radius: 8px; transition: width .35s ease; }
.astat .ct { width: 34px; text-align: right; font-weight: 800; font-size: 14px; color: var(--text-soft); }

/* ---------- waiting / status big ---------- */
.big-status { 
  text-align: center; padding: 40px 20px;
  animation: fadeInScale .6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(.88); }
  to { opacity: 1; transform: scale(1); }
}
.big-status .emoji { 
  font-size: 68px; margin-bottom: 14px; display: block;
  animation: floatEmoji 3s ease-in-out infinite;
}
@keyframes floatEmoji {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.big-status h2 { font-size: 26px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.3px; }
.big-status p { color: var(--text-soft); font-size: 14.5px; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%; margin: 20px auto 0;
  border: 4px solid rgba(167,139,250,.2); border-top-color: var(--lavender-deep);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- result banner (player) ---------- */
.result-banner { 
  text-align: center; padding: 30px 24px; border-radius: var(--radius-lg); margin-bottom: 18px;
  animation: resultPop .5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes resultPop {
  from { opacity: 0; transform: scale(.8) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.result-banner.win { 
  background: linear-gradient(135deg, #d4f7eb 0%, #b8efd9 50%, #c8f5e4 100%);
  border: 2px solid #7dd3c0;
  box-shadow: 0 8px 32px rgba(125,211,192,.25);
}
.result-banner.lose { 
  background: linear-gradient(135deg, #ffe3dc 0%, #ffccc2 50%, #ffddd6 100%);
  border: 2px solid #ffb5a7;
  box-shadow: 0 8px 32px rgba(255,181,167,.25);
}
.result-banner .em { 
  font-size: 56px; display: block; margin-bottom: 8px;
  animation: emBounce .6s cubic-bezier(0.34, 1.56, 0.64, 1) .1s both;
}
@keyframes emBounce {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}
.result-banner h3 { font-size: 24px; font-weight: 800; margin: 8px 0 6px; letter-spacing: -.3px; }
.result-banner .gain { 
  font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, var(--lavender-deep), #7c3aed);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 80px);
  background: #2d2a45; color: #fff; padding: 12px 22px; border-radius: 14px;
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow-lg); z-index: 100;
  opacity: 0; transition: .3s; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  /* wrap & card */
  .kk-wrap { padding: 16px 14px 80px; }
  .card { padding: 20px 18px; border-radius: 20px; }
  .card-head h1 { font-size: 22px; }

  /* topbar */
  .kk-topbar { padding: 10px 14px; gap: 8px; }
  .kk-brand { font-size: 14px; }
  .kk-brand .dot { width: 22px; height: 22px; font-size: 12px; }
  .kk-back { padding: 7px 10px; font-size: 12px; }
  .kk-title { font-size: 12px; }

  /* tiles */
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 16px 12px; font-size: 14px; min-height: 72px; gap: 10px; border-radius: 14px; }
  .tile .shape { width: 28px; height: 28px; font-size: 15px; }

  /* timer ring */
  .ring { width: 60px; height: 60px; }
  .ring svg { width: 60px; height: 60px; }
  .ring .num { font-size: 20px; }

  /* question header */
  .q-head { gap: 8px; margin-bottom: 12px; }
  .q-head .meta { gap: 6px; }
  .chip { font-size: 11px; padding: 5px 9px; }
  .q-text { font-size: 17px; margin-bottom: 14px; }

  /* lobby */
  .lobby-grid { grid-template-columns: 1fr; gap: 16px; }
  .pin-box { padding: 20px 16px; }
  .pin-code { font-size: 40px; letter-spacing: 6px; }
  .player-grid { grid-template-columns: 1fr 1fr; }

  /* podium */
  .podium { gap: 8px; }
  .podium .blk { width: 80px; padding: 12px 6px; }
  .podium .blk .nm { font-size: 11px; }
  .podium .blk .sc { font-size: 11px; }
  .podium .crown { font-size: 22px; }
  .podium .step:nth-child(1) .blk { height: 110px; }
  .podium .step:nth-child(2) .blk { height: 88px; }
  .podium .step:nth-child(3) .blk { height: 70px; }

  /* result banner */
  .result-banner { padding: 18px 14px; }
  .result-banner .em { font-size: 38px; }
  .result-banner h3 { font-size: 18px; }

  /* big status (lobby player) */
  .big-status { padding: 28px 14px; }
  .big-status .emoji { font-size: 52px; }
  .big-status h2 { font-size: 20px; }

  /* buttons */
  .btn { padding: 11px 18px; font-size: 13.5px; }
  .foot-actions { gap: 10px; }
}
