/* ===========================================================================
   Akamai Functions — intern talk. On-brand styling (Akamai Brand v1.1, 2025).
   Shared by the deck (index.html) and the player app (play.html).
   =========================================================================== */

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/instrument-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/instrument-sans-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;
}

:root {
  /* Primary palette */
  --navy: #002f6c;
  --blue: #00a4eb;
  --orange: #ff8b00;
  --white: #ffffff;
  /* Secondary accents (used sparingly, always with a primary) */
  --green: #00cd63;
  --violet: #201547;
  --lavender: #7a7cff;
  --electric: #0050ff;
  --sand: #fae6c3;
  --red: #f02b1f;
  /* Greys */
  --black: #000000;
  --grey1: #2a2a2b;
  --grey2: #4b4a4d;
  --grey3: #7c7b7f;
  --grey4: #a9a7ad;
  --grey5: #cecece;
  --grey6: #f5f5f5;

  --font: 'Instrument Sans', Arial, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The option / accent color ramp used for poll & quiz tiles (and word cloud). */
.c0 { --accent: var(--blue); }
.c1 { --accent: var(--orange); }
.c2 { --accent: var(--navy); }
.c3 { --accent: var(--green); }
.c4 { --accent: var(--lavender); }
.c5 { --accent: var(--electric); }

/* ---------------------------------------------------------------------------
   Shared bits
   --------------------------------------------------------------------------- */
.kicker {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  font-size: 0.9rem;
}
.wave-mark { display: block; height: 30px; width: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Orange particle-wave field (brand motif) rendered with layered dot gradients. */
.particles {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  background-image:
    radial-gradient(circle at center, rgba(255, 139, 0, 0.9) 0 1.4px, transparent 1.6px),
    radial-gradient(circle at center, rgba(255, 139, 0, 0.45) 0 1.1px, transparent 1.3px);
  background-size: 34px 34px, 21px 21px;
  background-position: 0 0, 10px 10px;
  -webkit-mask-image: radial-gradient(120% 90% at 90% 115%, #000 25%, transparent 62%);
  mask-image: radial-gradient(120% 90% at 90% 115%, #000 25%, transparent 62%);
  opacity: 0.9;
}

/* =========================================================================
   DECK (projector)  — body.deck
   ========================================================================= */
/* Every slide lives on a fixed 1280x720 stage that is scaled (letterboxed) to
   fit the window, so content is laid out once and never overflows. */
body.deck { background: #00112b; color: var(--navy); overflow: hidden; }
#stage {
  position: absolute; left: 50%; top: 50%;
  width: 1280px; height: 720px;
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  transform-origin: center center;
  overflow: hidden; background: var(--grey6);
}
#deck { position: absolute; inset: 0; }
.slide {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 52px 84px;
  animation: slidein 0.45s var(--ease);
}
.slide.active { display: flex; }
@keyframes slidein { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.slide h1 { font-size: 72px; line-height: 1.0; font-weight: 700; letter-spacing: -0.02em; }
.slide h2 { font-size: 46px; line-height: 1.03; font-weight: 700; letter-spacing: -0.01em; }
.slide p.lead { font-size: 24px; line-height: 1.4; color: var(--grey2); max-width: 30ch; margin-top: 18px; }
.slide .grey-sub { color: var(--grey4); }

/* Navy divider slides with the particle wave */
.slide.divider { background: var(--navy); color: var(--white); }
.slide.divider h1 { color: var(--white); }
.slide.divider .kicker { color: var(--orange); }

/* Hero / title slide */
.slide.hero { background: var(--navy); color: var(--white); }
.slide.hero h1 { color: var(--white); }
.slide.hero .accentword { color: var(--blue); }

/* content list */
.points { margin-top: 26px; display: grid; gap: 14px; max-width: 30ch; }
.points li { list-style: none; font-size: 24px; font-weight: 600; display: flex; gap: 12px; align-items: baseline; }
.points li::before { content: ''; flex: 0 0 auto; width: 0.7em; height: 0.7em; border-radius: 3px; background: var(--orange); transform: translateY(0.05em); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 52px; align-items: center; }

/* code block */
pre.code {
  background: var(--violet); color: #dfe3ff; border-radius: 14px; padding: 22px 26px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 19px; line-height: 1.55; overflow: hidden; margin-top: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
pre.code .cmt { color: #8f93c8; }
pre.code .k { color: var(--blue); }
pre.code .s { color: var(--green); }
pre.code .hl { background: rgba(255, 139, 0, 0.22); border-radius: 4px; }

/* Big stat */
.stat { font-size: 150px; font-weight: 700; line-height: 0.85; letter-spacing: -0.03em; color: var(--navy); }
.slide.divider .stat, .slide.hero .stat { color: var(--orange); }

/* language logos row → wasm */
.pipe { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 26px; }
.langchip { font-weight: 700; font-size: 28px; padding: 0.5em 0.8em; border-radius: 12px; background: var(--white); color: var(--navy); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.arrow { font-size: 34px; color: var(--orange); font-weight: 700; }
.cube { font-weight: 700; font-size: 30px; padding: 0.5em 0.9em; border-radius: 14px; background: var(--navy); color: var(--white); }

/* Screenshot frame (EaaS real-world slide) */
.shot-frame { border-radius: 14px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,0.25); border: 1px solid var(--grey5); background: var(--white); }
.shot-frame img { display: block; width: 100%; height: auto; }

/* Presenter progress bar + hint (inside the stage, so they scale with it) */
.deck-chrome { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(0,0,0,0.08); z-index: 40; }
.deck-chrome > i { display: block; height: 100%; background: var(--orange); transition: width 0.4s var(--ease); }
.deck-hint { position: absolute; bottom: 12px; right: 18px; font-size: 13px; color: var(--grey4); z-index: 41; }
.logo-badge { position: absolute; top: 20px; left: 26px; display: flex; align-items: center; gap: 10px; z-index: 41; font-weight: 700; color: var(--navy); }
body.dark-slide .logo-badge { color: var(--white); }
body.dark-slide .deck-hint { color: rgba(255,255,255,0.5); }

/* Join panel (hero) */
.join-panel { display: flex; gap: 40px; align-items: center; margin-top: 30px; flex-wrap: wrap; }
.qr-box { background: var(--white); padding: 14px; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.qr-box img, .qr-box canvas, .qr-box table, .qr-box svg { display: block; width: 190px; height: auto; image-rendering: pixelated; }
.join-url { font-weight: 700; font-size: 24px; color: var(--blue); overflow-wrap: break-word; max-width: 16ch; line-height: 1.15; }
.join-count { font-size: 22px; color: var(--white); opacity: 0.85; margin-top: 6px; }
.join-count b { color: var(--orange); }

/* ---- Interactive question slide (deck) ---- */
.q-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; }
.q-type { font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 15px; padding: 0.4em 0.9em; border-radius: 999px; }
.q-type.poll { background: var(--lavender); color: var(--white); }
.q-type.quiz { background: var(--orange); color: var(--navy); }
.q-type.wordcloud { background: var(--green); color: var(--navy); }
.q-prompt { font-size: 42px; font-weight: 700; line-height: 1.05; margin-top: 10px; max-width: 26ch; }
.q-sub { color: var(--grey3); font-size: 22px; margin-top: 8px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 26px; }
.tiles.n3, .tiles.n5, .tiles.n6 { grid-template-columns: 1fr 1fr; }
.tile {
  position: relative; border-radius: 16px; padding: 16px 20px; min-height: 66px;
  display: flex; align-items: center; gap: 14px; color: var(--white); background: var(--accent);
  font-size: 26px; font-weight: 600; overflow: hidden;
  transition: transform 0.3s var(--ease);
}
.tile.c1 { color: var(--navy); } /* orange tile → navy text */
.tile.c3 { color: var(--navy); } /* green tile → navy text */
.tile .badge { flex: 0 0 auto; width: 1.7em; height: 1.7em; border-radius: 8px; background: rgba(255,255,255,0.28); display: grid; place-items: center; font-weight: 700; }
.tile.c1 .badge, .tile.c3 .badge { background: rgba(0,0,0,0.15); }
.tile .txt { flex: 1; }
.tile .bar { position: absolute; left: 0; bottom: 0; height: 6px; background: rgba(0,0,0,0.35); width: 0; transition: width 0.6s var(--ease); }
.tile .cnt { font-weight: 700; opacity: 0; transition: opacity 0.3s; }
.tile.reveal .cnt { opacity: 1; }
/* poll results: fill tiles proportionally */
.tile .fill { position: absolute; inset: 0; background: rgba(0,0,0,0.18); width: 0; transition: width 0.7s var(--ease); z-index: 0; }
.tile .badge, .tile .txt, .tile .cnt { position: relative; z-index: 1; }
.tile.correct { outline: 5px solid var(--green); outline-offset: 3px; }
.tile.wrong { opacity: 0.45; }
.tile.win-check::after { content: '✓'; position: absolute; right: 1rem; font-size: 1.6em; color: var(--green); z-index: 2; }

.q-foot { display: flex; align-items: center; gap: 18px; margin-top: 22px; }
.answered-pill { font-weight: 700; font-size: 22px; color: var(--grey2); }
.answered-pill b { color: var(--blue); }
.timer { flex: 1; height: 12px; background: var(--grey5); border-radius: 999px; overflow: hidden; }
.timer > i { display: block; height: 100%; background: var(--orange); width: 100%; }

/* Leaderboard */
.leaderboard { display: grid; gap: 7px; margin-top: 14px; max-width: 760px; width: 100%; }
.lb-row {
  display: grid; grid-template-columns: 2.4rem 1fr auto; align-items: center; gap: 14px;
  background: var(--white); color: var(--navy); border-radius: 11px; padding: 8px 18px;
  font-size: 22px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06); transition: transform 0.5s var(--ease);
}
.lb-row .rank { font-weight: 700; color: var(--grey4); }
.lb-row .score { font-weight: 700; color: var(--navy); }
.lb-row.top1 { background: var(--orange); color: var(--navy); transform: scale(1.02); }
.lb-row.top1 .rank, .lb-row.top1 .score { color: var(--navy); }
.lb-row.top2 { background: var(--blue); color: var(--white); }
.lb-row.top2 .rank, .lb-row.top2 .score { color: var(--white); }
/* 3rd stays a white row (navy would vanish on the navy final slide); the bronze
   rank chip marks the podium. Works on both the grey and navy backgrounds. */
.lb-row.top3 .rank { background: #b5722e; color: #fff; border-radius: 999px; width: 1.7em; height: 1.7em; display: grid; place-items: center; }

/* Word cloud (deck) */
.cloud { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: center; align-content: center; margin-top: 20px; max-height: 470px; overflow: hidden; }
.cloud .word {
  font-weight: 700; line-height: 1; padding: 0.3em 0.55em; border-radius: 12px;
  background: var(--white); color: var(--navy); box-shadow: 0 8px 22px rgba(0,0,0,0.07);
  animation: pop 0.4s var(--ease); transition: all 0.5s var(--ease);
}
.cloud .word .v { font-size: 0.5em; color: var(--orange); margin-left: 0.35em; }
.cloud .word.crown { background: var(--orange); color: var(--navy); }
.crownico { display: inline-flex; vertical-align: -0.12em; margin-right: 0.28em; }
.crownico svg { width: 0.9em; height: 0.9em; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.cloud-empty { color: var(--grey4); font-size: 22px; font-weight: 600; margin-top: 24px; }

/* =========================================================================
   ADMIN control panel — body.admin
   ========================================================================= */
body.admin { background: var(--grey6); color: var(--navy); min-height: 100%; }
.admin-wrap { max-width: 1000px; margin: 0 auto; padding: 28px 22px 80px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.admin-head h1 { font-size: 2.2rem; font-weight: 700; }
.tokbox label { font-size: 0.8rem; font-weight: 700; color: var(--grey3); text-transform: uppercase; letter-spacing: 0.08em; }
.tokbox .field { margin-top: 0; width: 200px; font-size: 1rem; padding: 10px 14px; }
.statusbar { margin: 20px 0; background: var(--navy); color: var(--white); border-radius: 14px; padding: 16px 20px; font-weight: 600; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.statusbar .pill { background: rgba(255,255,255,0.14); border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; }
.statusbar .pill b { color: var(--orange); }
.admin-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.admin-actions .btn { width: auto; margin-top: 0; padding: 12px 20px; font-size: 1rem; }
.btn.danger { background: var(--red); color: var(--white); }
.admin-h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.admin-note { color: var(--grey3); margin-bottom: 14px; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.qcard { background: var(--white); border: 2px solid var(--grey5); border-radius: 14px; padding: 14px; }
.qcard.active { border-color: var(--orange); box-shadow: 0 8px 24px rgba(255,139,0,0.2); }
.qcard-type { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 999px; margin-bottom: 8px; }
.qcard-type.poll { background: var(--lavender); color: #fff; }
.qcard-type.quiz { background: var(--orange); color: var(--navy); }
.qcard-type.wordcloud { background: var(--green); color: var(--navy); }
.qcard-prompt { font-weight: 600; min-height: 3em; }
.qcard-actions { display: flex; gap: 8px; margin-top: 10px; }
.mini { font-family: var(--font); font-weight: 700; font-size: 0.9rem; padding: 8px 14px; border: none; border-radius: 10px; background: var(--navy); color: #fff; cursor: pointer; }
.mini.reveal { background: var(--blue); }
.mini.danger { background: var(--red); }
.mini:disabled { opacity: 0.4; cursor: default; }
.modlist { display: grid; gap: 8px; }
.modrow { display: flex; align-items: center; gap: 12px; background: var(--white); border-radius: 12px; padding: 10px 14px; }
.modrow .votes { font-weight: 700; color: var(--orange); min-width: 3em; }
.modrow .t { flex: 1; font-weight: 600; }

/* ---- Live connection map (deck) ---- */
.hero-map { flex: 0 0 auto; }
.hero-map canvas {
  width: 420px; height: auto; border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.mapwrap { margin-top: 16px; position: relative; }
.mapwrap canvas {
  width: 100%; height: auto; max-height: 430px; display: block; border-radius: 18px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08);
}
.mapstats {
  position: absolute; left: 22px; bottom: 18px;
  background: rgba(0, 47, 108, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: 10px 18px; border-radius: 999px; color: var(--white);
  font-size: 22px; font-weight: 600;
}
.mapstats b { color: var(--orange); }

/* =========================================================================
   PLAYER app — body.play
   ========================================================================= */
body.play {
  background: var(--navy);
  color: var(--white);
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 16px 40px;
}
.play-wrap { width: 100%; max-width: 560px; margin: auto; }
.brandbar { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 560px; margin-bottom: 18px; }
.brandbar .name-chip { background: rgba(255,255,255,0.12); border-radius: 999px; padding: 6px 14px; font-weight: 700; }
.brandbar .score-chip { background: var(--orange); color: var(--navy); border-radius: 999px; padding: 6px 14px; font-weight: 700; }

.card { background: var(--white); color: var(--navy); border-radius: 22px; padding: 26px 22px; box-shadow: 0 30px 70px rgba(0,0,0,0.35); }
.card h2 { font-size: 1.7rem; line-height: 1.1; font-weight: 700; }
.card .sub { color: var(--grey3); margin-top: 8px; font-weight: 500; }

.field { width: 100%; font-family: var(--font); font-size: 1.3rem; font-weight: 600; padding: 16px 18px; border: 2px solid var(--grey5); border-radius: 14px; margin-top: 18px; color: var(--navy); }
.field:focus { outline: none; border-color: var(--blue); }
.btn { width: 100%; font-family: var(--font); font-size: 1.25rem; font-weight: 700; padding: 16px; border: none; border-radius: 14px; background: var(--orange); color: var(--navy); margin-top: 14px; cursor: pointer; transition: transform 0.15s var(--ease), filter 0.15s; }
.btn:active { transform: scale(0.98); }
.btn:disabled { filter: grayscale(0.6) opacity(0.6); cursor: default; }
.btn.blue { background: var(--blue); color: var(--white); }

.opts { display: grid; gap: 12px; margin-top: 20px; }
.opt {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  font-family: var(--font); font-size: 1.2rem; font-weight: 700; color: var(--white);
  background: var(--accent); border: none; border-radius: 16px; padding: 18px 18px; cursor: pointer;
  transition: transform 0.15s var(--ease), filter 0.2s;
}
.opt.c1, .opt.c3 { color: var(--navy); }
.opt .badge { flex: 0 0 auto; width: 1.8em; height: 1.8em; border-radius: 9px; background: rgba(255,255,255,0.28); display: grid; place-items: center; }
.opt.c1 .badge, .opt.c3 .badge { background: rgba(0,0,0,0.15); }
.opt:active { transform: scale(0.98); }
.opt:disabled { filter: opacity(0.5); cursor: default; }

.status { text-align: center; padding: 26px 10px; }
.status h2 { margin-top: 14px; }
.watch { text-align: center; }

/* Round status icon badges (replace emoji on player screens) */
.statusicon { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; }
.statusicon svg { width: 48px; height: 48px; }
.statusicon.good { background: var(--green); color: #fff; }
.statusicon.bad { background: var(--red); color: #fff; }
.statusicon.info { background: var(--blue); color: #fff; }
.statusicon.navy { background: var(--navy); color: #fff; }
.statusicon.neutral { background: var(--grey5); color: var(--grey2); }
.statusicon.trophy { background: var(--orange); color: var(--navy); }
.statusicon.live { background: rgba(0, 164, 235, 0.14); }
.pulse { position: relative; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); }
.pulse::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--blue); animation: pulsering 1.7s ease-out infinite; }
@keyframes pulsering { 0% { transform: scale(1); opacity: 0.55; } 100% { transform: scale(3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse::after { animation: none; } }
.result-good { color: var(--green); }
.result-bad { color: var(--red); }
.pts { font-size: 2.6rem; font-weight: 700; color: var(--navy); }

/* word cloud player */
.idea-list { display: grid; gap: 10px; margin-top: 18px; max-height: 46vh; overflow: auto; }
.idea { display: flex; align-items: center; gap: 12px; background: var(--grey6); border-radius: 14px; padding: 12px 14px; }
.idea .t { flex: 1; font-weight: 600; }
.idea .up { flex: 0 0 auto; border: none; background: var(--navy); color: var(--white); font-family: var(--font); font-weight: 700; border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.idea .up.voted { background: var(--green); }
.idea .up:disabled { opacity: 0.5; cursor: default; }
.idea.mine { outline: 2px solid var(--blue); }

.timerbar { height: 10px; background: var(--grey5); border-radius: 999px; overflow: hidden; margin-top: 20px; }
.timerbar > i { display: block; height: 100%; background: var(--orange); width: 100%; transition: width 0.25s linear; }

.tiny { font-size: 0.8rem; color: var(--grey4); text-align: center; margin-top: 22px; }
.play .tiny { color: rgba(255,255,255,0.5); }
