/* ===========================================================================
   Salesforce Quiz — ArcelorMittal AI Inspiration Session styling
   Matches the look of docs/demo-flow.html: light, Oswald + Inter,
   orange -> red -> magenta gradient, clean cards with soft shadows.
   =========================================================================== */

:root {
  /* ArcelorMittal palette */
  --am-orange: #ff6a13;
  --am-orange-2: #ff8a00;
  --am-red: #e4002b;
  --am-magenta: #b0186b;
  --am-ink: #1b1f24;
  --am-ink-soft: #3a4048;
  --am-mist: #6b7480;
  --am-line: #e6e9ee;
  --am-bg: #ffffff;
  --am-bg-2: #fbfcfe;
  --am-bg-3: #eef2f7;
  --am-sky: #eaf1f8;
  --grad: linear-gradient(120deg, var(--am-orange-2) 0%, var(--am-red) 48%, var(--am-magenta) 100%);

  /* four distinct answer colours (Kahoot-style recognition) */
  --a: #e4002b; /* red    */
  --b: #1a73e8; /* blue   */
  --c: #ff8a00; /* amber  */
  --d: #2e844a; /* green  */

  --radius: 16px;
  --shadow: 0 4px 16px rgba(27, 31, 36, 0.06);
  --shadow-lg: 0 12px 30px rgba(27, 31, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}
html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  color: var(--am-ink);
  background: linear-gradient(180deg, #ffffff 0%, var(--am-bg-2) 55%, var(--am-sky) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: "Oswald", "Inter", sans-serif;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin: 0 0 0.4em;
  line-height: 1.05;
  color: var(--am-ink);
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 40px);
}

.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- top brand bar ------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--am-line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.brand-logo svg {
  width: 52px;
  height: 24px;
  display: block;
  margin-bottom: 2px;
}
.brand-logo .wordmark {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.3px;
  color: var(--am-ink);
}
.brand-name {
  font-family: "Inter";
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--am-mist);
  text-transform: uppercase;
  border-left: 1px solid var(--am-line);
  padding-left: 12px;
  margin-left: 2px;
}
.top-user {
  font-size: 13px;
  color: var(--am-mist);
}

/* --- eyebrow / badge ----------------------------------------------------- */
.cloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--am-red);
}

/* --- buttons ------------------------------------------------------------- */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s ease,
    box-shadow 0.15s ease, border-color 0.15s ease;
}
button:active {
  transform: translateY(2px) scale(0.99);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none !important;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  padding: 15px 30px;
  font-size: 1.05rem;
  box-shadow: 0 8px 22px rgba(228, 0, 43, 0.28);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(228, 0, 43, 0.36);
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--am-line);
  color: var(--am-ink-soft);
  padding: 12px 22px;
  font-size: 1rem;
  box-shadow: var(--shadow);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--am-orange);
  color: var(--am-orange);
}

/* --- cards --------------------------------------------------------------- */
.card {
  background: #fff;
  border: 1px solid var(--am-line);
  border-radius: var(--radius);
  padding: clamp(22px, 3vw, 38px);
  box-shadow: var(--shadow);
}

/* --- landing ------------------------------------------------------------- */
.landing {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
}
.landing h1 {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 700;
}
.landing p {
  font-size: 1.1rem;
  color: var(--am-ink-soft);
  max-width: 620px;
  line-height: 1.6;
}
.role-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

/* --- host ---------------------------------------------------------------- */
.host-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
/* lobby: big centered "Salesforce Quiz" title (home-page look) */
.lobby-title {
  margin-bottom: 26px;
}
.lobby-title h1 {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 700;
  margin: 6px 0 0;
}
/* "Scan to join" — same heading font/style as the home-page title */
.scan-heading {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 22px;
}

.pin-box {
  text-align: center;
}
.pin-box .label {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.8rem;
  color: var(--am-mist);
  font-weight: 700;
}
.pin-box .pin {
  font-family: "Oswald", sans-serif;
  font-size: clamp(2.8rem, 7vw, 4.6rem);
  font-weight: 700;
  letter-spacing: 8px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.join-panel {
  display: flex;
  gap: 40px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.qr-holder {
  background: #fff;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--am-line);
  box-shadow: var(--shadow);
  line-height: 0;
}
.qr-holder img,
.qr-holder canvas {
  width: 210px;
  height: 210px;
  display: block;
}
.join-url {
  font-size: 1.05rem;
  word-break: break-all;
  color: var(--am-red);
  font-weight: 600;
}

/* lobby player chips */
.players {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}
.player-chip {
  background: color-mix(in srgb, var(--am-orange) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--am-orange) 30%, var(--am-line));
  color: var(--am-ink);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  animation: pop 0.25s ease;
}
@keyframes pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* question view */
.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.q-counter {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--am-mist);
}
.timer {
  font-family: "Oswald", sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 22px rgba(228, 0, 43, 0.28);
}
.timer.low {
  background: var(--am-red);
  animation: pulse 0.6s infinite;
}
@keyframes pulse {
  50% {
    transform: scale(1.08);
  }
}
.q-text {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 800;
  text-align: center;
  margin: 12px 0 20px;
  color: var(--am-ink);
  line-height: 1.2;
}

/* picture on the question (big image above the answers) */
.q-image {
  display: block;
  max-width: min(560px, 100%);
  max-height: 320px;
  margin: 0 auto 26px;
  border-radius: 14px;
  border: 1px solid var(--am-line);
  box-shadow: var(--shadow);
  object-fit: contain;
}

/* picture-as-answer: image sits inside the coloured answer tile */
.answer .opt-img {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}
.answer.has-img {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-height: 180px;
}
.answer.has-img .glyph {
  width: auto;
  text-align: left;
}
.answer.has-img .opt-caption {
  font-size: 1rem;
}

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.answer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border-radius: 14px;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-weight: 700;
  color: #fff;
  min-height: 92px;
  box-shadow: var(--shadow);
}
.answer .glyph {
  font-family: "Oswald", sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  width: 40px;
  text-align: center;
}
.answer.a { background: var(--a); }
.answer.b { background: var(--b); }
.answer.c { background: var(--c); }
.answer.d { background: var(--d); }
.answer.dim {
  opacity: 0.28;
}
.answer.correct {
  outline: 5px solid var(--am-ink);
  transform: scale(1.02);
}
.answer .count {
  margin-left: auto;
  font-size: 1.2rem;
  font-weight: 800;
  opacity: 0.95;
}

/* leaderboard */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--am-bg-2);
  border: 1px solid var(--am-line);
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 1.25rem;
  animation: pop 0.3s ease;
}
.lb-row .rank {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  width: 34px;
  color: var(--am-mist);
}
.lb-row .name {
  font-weight: 700;
  color: var(--am-ink);
}
.lb-row .score {
  margin-left: auto;
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  color: var(--am-ink);
}
.lb-row.top1 {
  border-color: color-mix(in srgb, var(--am-orange) 45%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--am-orange) 12%, #fff), #fff);
}
.lb-row.top1 .rank {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.center {
  text-align: center;
}
.mt {
  margin-top: 22px;
}
.muted {
  color: var(--am-mist);
}

/* --- player -------------------------------------------------------------- */
.player-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.player-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 16px;
}
.player-join {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
/* centered card so the join form never stretches edge-to-edge on desktop */
.join-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--am-line);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 36px);
  box-shadow: var(--shadow-lg);
}
.player-join h1 {
  color: var(--am-ink);
}
.field {
  width: 100%;
  padding: 18px;
  font-size: 1.2rem;
  border-radius: 12px;
  border: 2px solid var(--am-line);
  background: #fff;
  color: var(--am-ink);
  text-align: center;
  font-weight: 700;
}
.field::placeholder {
  color: var(--am-mist);
  font-weight: 500;
}
.field:focus {
  outline: none;
  border-color: var(--am-orange);
}
.player-status {
  text-align: center;
  padding: 12px;
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--am-mist);
}
.player-score {
  text-align: center;
  font-size: 1.1rem;
  padding: 6px;
  color: var(--am-ink-soft);
}
.player-score b {
  font-family: "Oswald", sans-serif;
  color: var(--am-red);
  font-size: 1.5rem;
}

/* big tappable answer tiles on phone */
.tap-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tap {
  border-radius: 16px;
  color: #fff;
  font-family: "Oswald", sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  box-shadow: var(--shadow);
}
.tap.a { background: var(--a); }
.tap.b { background: var(--b); }
.tap.c { background: var(--c); }
.tap.d { background: var(--d); }
.tap.chosen {
  outline: 6px solid var(--am-ink);
}
.tap.faded {
  opacity: 0.32;
}

.big-msg {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Oswald", sans-serif;
  font-size: 1.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 24px;
  border-radius: 16px;
  color: var(--am-ink);
}
.big-msg b {
  color: inherit;
}
.result-correct {
  background: var(--d);
  color: #fff;
}
.result-wrong {
  background: var(--a);
  color: #fff;
}

.tiny {
  font-size: 0.85rem;
  color: var(--am-mist);
}
.err {
  color: var(--am-red);
  font-weight: 700;
  text-align: center;
}

/* --- footer -------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--am-line);
  padding: 22px clamp(16px, 4vw, 40px);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--am-mist);
  font-size: 13px;
  background: var(--am-sky);
}
.foot .dot {
  color: var(--am-orange);
}

@media (max-width: 560px) {
  .answers {
    grid-template-columns: 1fr;
  }
}
