/* AI Act Risk Assessment Card Game — AIM Learning Solutions
   Charter: Dark Blue #1F4653 · Light Blue #2FABB9 · Orange #F36107
            Yellow #FEDF3F · Green #64AA2F · Grey #EEECE1
   Fonts: Poppins (headings) · Roboto (UI & body)
   Charter rule: accent colours sparingly, strong contrast, flat typography. */

/* Fonts are self-hosted (public/fonts): no request leaves the participant's
   browser for a third party. Files are the Google Fonts woff2 builds. */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/poppins-600-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: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/poppins-600-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/poppins-700-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: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/poppins-700-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/roboto-400-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: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/roboto-400-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/roboto-500-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: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/roboto-500-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/roboto-700-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: 'Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/roboto-700-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* AIM palette */
  --aim-dark: #1F4653;
  --aim-blue: #2FABB9;
  --aim-orange: #F36107;
  --aim-yellow: #FEDF3F;
  --aim-green: #64AA2F;

  /* Cool neutrals tinted toward the dark blue hue */
  --ink: #21424E;            /* primary text, near aim-dark */
  --ink-soft: #58707B;       /* secondary text */
  --surface: #FBFCFC;        /* page background, faint blue-grey tint */
  --surface-raised: #FFFFFF; /* panels */
  --line: #DCE5E8;           /* borders */
  --line-strong: #C3D2D7;

  /* Interactive accent (single) */
  --action: #218A96;         /* darkened aim-blue for AA contrast on white */
  --action-bright: var(--aim-blue);
  --action-tint: #E9F5F7;

  /* Risk semantics — calm at rest, full only when selected */
  --risk-un-text: #C24E04;
  --risk-un-line: #E98A4C;
  --risk-un-tint: #FCEFE5;
  --risk-un-full: var(--aim-orange);

  --risk-hi-text: #8A6D00;
  --risk-hi-line: #E0C32F;
  --risk-hi-tint: #FCF6DC;
  --risk-hi-full: var(--aim-yellow);

  --risk-li-text: #44761E;
  --risk-li-line: #8FC163;
  --risk-li-tint: #EFF6E7;
  --risk-li-full: var(--aim-green);

  --radius: 12px;
  --shadow-card: 0 2px 12px rgba(31, 70, 83, 0.10);
  --shadow-soft: 0 1px 4px rgba(31, 70, 83, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  color: var(--ink);
  /* faint horizontal-line texture per AIM charter backgrounds */
  background:
    repeating-linear-gradient(180deg, transparent 0 27px, rgba(31, 70, 83, 0.022) 27px 28px),
    var(--surface);
  min-height: 100vh;
}

h1, h2 { font-family: "Poppins", "Roboto", sans-serif; }

a { color: var(--action); }

/* ---------- Header ---------- */
header.bar {
  background: var(--aim-dark);
  color: #fff;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
header.bar h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
header.bar .meta { font-size: 12.5px; opacity: 0.75; margin-left: auto; text-align: right; }

/* AIM logo chip — charter requires the logo on a clear background */
.brand-chip {
  flex: none;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 3px 8px;
  line-height: 0;
}
.brand-chip img { height: 26px; width: auto; display: block; }

main { padding: 24px 20px 48px; max-width: 1180px; margin: 0 auto; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 16px; font-size: 18px; font-weight: 600; color: var(--ink); }
.panel h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ---------- Guidance ---------- */
.intro {
  margin: -6px 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 68ch;
}
.intro strong { color: var(--ink); }

.hint {
  margin: -8px 0 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 62ch;
}
.hint.center { margin: 10px auto 0; }
.hint strong { color: var(--ink); }

.stepper {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}
.stepper li {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 4px;
  border-radius: 999px;
  background: #EFF3F4;
  color: var(--ink-soft);
}
.stepper li.on {
  background: var(--action);
  color: #fff;
  font-weight: 700;
}
.stepper li.done {
  background: var(--action-tint);
  color: var(--action);
}

/* ---------- Time progress ---------- */
.timebar {
  height: 4px;
  border-radius: 999px;
  background: #E4EAEC;
  margin: -6px 0 16px;
  overflow: hidden;
}
.timebar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: var(--action-bright);
  transition: width 0.25s linear, background 0.3s ease;
}
.timebar-fill.low { background: var(--aim-orange); }

/* ---------- Official answer line ---------- */
.official-line { font-size: 15px; font-weight: 500; color: var(--ink); text-align: center; }
.official-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
}
.official-badge.unacceptable { background: var(--risk-un-full); }
.official-badge.high { background: var(--risk-hi-full); color: var(--aim-dark); }
.official-badge.limited { background: var(--risk-li-full); }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 5px; }
input, select, button { font: inherit; color: inherit; }
input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 14px;
}
input:focus { outline: 2px solid var(--action-bright); outline-offset: 1px; border-color: var(--action); }

button {
  background: var(--action);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s ease;
}
button:hover { background: #1B7680; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost {
  background: transparent;
  color: var(--action);
  border: 1px solid var(--line-strong);
}
button.ghost:hover { background: var(--action-tint); }

.grid { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ---------- Session code ---------- */
.session-code {
  font-family: "Poppins", sans-serif;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--aim-dark);
  line-height: 1.1;
}

/* ---------- Host group cards ---------- */
.group-card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.group-card h3 {
  color: var(--ink);
  margin-bottom: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.group-card .players { font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; min-height: 18px; }
.group-card .phase {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--action-tint);
  color: var(--action);
}
.group-card .progress { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #EFF3F4;
  font-size: 12.5px;
  margin: 2px 2px 2px 0;
}
.player-chip.voted { background: var(--risk-li-tint); color: var(--risk-li-text); }

/* ---------- Risk dots ---------- */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.unacceptable { background: var(--risk-un-full); }
.dot.high { background: #EDC51B; }
.dot.limited { background: var(--risk-li-full); }
.dot.empty { background: var(--line-strong); }

/* ---------- Timer ---------- */
.timer {
  font-family: "Poppins", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
}
.timer.warn { color: var(--risk-un-text); }
.timer.idle { color: var(--ink-soft); font-weight: 500; }

/* ---------- Card stage: the card is the hero ---------- */
.card-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
/* The card image already carries its own navy frame and rounded corners.
   No extra white box around it — just the image, larger. */
.card-img-wrap {
  max-width: min(640px, 100%);
  width: 100%;
  line-height: 0;
}
.card-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

/* ---------- Vote buttons: outlined at rest, full when selected ---------- */
.vote-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 640px;
}
.vote-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 16px 10px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  border: 2px solid;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  background: #fff;
}
.vote-btn:active { transform: scale(0.98); }

.vote-btn.unacceptable { border-color: var(--risk-un-line); color: var(--risk-un-text); }
.vote-btn.unacceptable:hover { background: var(--risk-un-tint); }
.vote-btn.unacceptable.selected { background: var(--risk-un-full); border-color: var(--risk-un-full); color: #fff; }

.vote-btn.high { border-color: var(--risk-hi-line); color: var(--risk-hi-text); }
.vote-btn.high:hover { background: var(--risk-hi-tint); }
.vote-btn.high.selected { background: var(--risk-hi-full); border-color: #E0C32F; color: var(--aim-dark); }

.vote-btn.limited { border-color: var(--risk-li-line); color: var(--risk-li-text); }
.vote-btn.limited:hover { background: var(--risk-li-tint); }
.vote-btn.limited.selected { background: var(--risk-li-full); border-color: var(--risk-li-full); color: #fff; }

.vote-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Reveal ---------- */
.reveal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 640px;
}
.reveal-cell {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.reveal-cell .name { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reveal-cell .badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  flex: none;
}
.badge.unacceptable { background: var(--risk-un-tint); color: var(--risk-un-text); }
.badge.high { background: var(--risk-hi-tint); color: var(--risk-hi-text); }
.badge.limited { background: var(--risk-li-tint); color: var(--risk-li-text); }
.badge.empty { background: #EFF3F4; color: var(--ink-soft); }

.tally {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-size: 14px;
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.tally span { display: flex; align-items: center; gap: 6px; }
.tally strong { color: var(--ink); }

/* ---------- Utility ---------- */
.center { text-align: center; }
.muted { color: var(--ink-soft); font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- Game layout: history sidebar + main ---------- */
.game-grid {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.game-main {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
}
.history-pane {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}
.history-pane h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
}
.history-item img { width: 100%; display: block; }
.history-item .badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}
.history-item:hover { border-color: var(--action); }

/* ---------- Card viewport: scrollable + zoomable ---------- */
.card-viewport {
  width: 100%;
  max-width: 640px;
  max-height: 72vh;
  overflow: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-card);
}
.card-viewport img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
}
.card-tools { display: flex; gap: 8px; align-items: center; }
button.sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Viewer overlay ---------- */
.viewer {
  position: fixed;
  inset: 0;
  background: rgba(15, 35, 43, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.viewer-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; max-height: 100%; }
.viewer-inner img {
  max-height: calc(100vh - 110px);
  max-width: min(92vw, 560px);
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}
.viewer-tools { display: flex; gap: 10px; }
.viewer-tools .ghost { background: #fff; }

/* ---------- Deck grid (full deck + session cards) ---------- */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.deck-card {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.deck-card img { width: 100%; display: block; }
.deck-card:hover { transform: translateY(-2px); border-color: var(--action); }

.deck-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface);
  z-index: 50;
  overflow-y: auto;
}

/* ---------- Result board ---------- */
.stats-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 18px 0 6px;
}
.stat {
  background: var(--action-tint);
  border-radius: 12px;
  padding: 18px 26px;
  text-align: center;
  min-width: 150px;
}
.stat-n {
  font-family: "Poppins", sans-serif;
  font-size: 34px;
  font-weight: 700;
  color: var(--aim-dark);
  line-height: 1.1;
}
.stat-l { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 18px 22px 26px;
  text-align: center;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-raised);
  margin-top: 30px;
}
.site-footer .muted { margin-top: 4px; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .game-grid { grid-template-columns: 1fr; }
  .history-pane {
    position: static;
    max-height: none;
    order: 2;
  }
  .history-list { flex-direction: row; overflow-x: auto; }
  .history-item { flex: 0 0 90px; }
  .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  main { padding: 12px 10px 40px; }
  .panel, .game-main { padding: 16px 14px; }
  .session-code { font-size: 34px; letter-spacing: 5px; }
  .timer { font-size: 22px; }
  .vote-row { flex-direction: row; gap: 6px; }
  .vote-btn { padding: 13px 4px; font-size: 13px; }
  .card-viewport { max-height: 64vh; }
  .stepper li { font-size: 10.5px; padding: 5px 2px; }
}
