:root {
  /* FIM brand: FIM Blue #0031A7 and white */
  --fim-blue: #0031a7;
  --bg: #f0f3fa;          /* very light FIM Blue tint */
  --surface: #ffffff;
  --ink: #0f1a33;
  --muted: #4a5a80;
  --line: #ccd6ed;        /* FIM Blue 20% */
  --accent: var(--fim-blue);
  --accent-ink: #ffffff;
  --unread: #cad7f2;     /* light FIM Blue for questions not yet opened */
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 1.0625rem; line-height: 1.45;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}
.logo { display: block; height: auto; width: auto; }
.logo[hidden] { display: none; }
.ask .logo {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 1.25rem);
  left: 1.25rem;
  max-height: 56px; max-width: 40vw;
}
.board .logo { max-height: 72px; max-width: 30vw; }
.title { color: var(--fim-blue); font-weight: 700; letter-spacing: -0.01em; margin: 0 0 1rem; }
.status { min-height: 1.4rem; font-size: .95rem; color: var(--muted); }

/* Participant screen */
.ask { max-width: 40rem; margin: 0 auto; padding: 6rem 1.25rem 2rem; min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center; }
.ask .title { font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.15; }
.ask form { display: flex; flex-direction: column; gap: .75rem; }
.ask textarea {
  font: inherit; font-size: 1.25rem; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 10px; padding: .9rem 1rem;
  min-height: 8rem; resize: vertical;
}
.ask textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.ask button {
  font: inherit; font-weight: 700; font-size: 1.125rem; background: var(--accent);
  color: var(--accent-ink); border: 0; border-radius: 10px; padding: .85rem 1rem; cursor: pointer;
}
.ask button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.ask button:disabled { opacity: .5; cursor: default; }

.qr { margin: 2rem 0 0; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.qr img { width: min(200px, 55vw); height: auto; border-radius: 8px; display: block; }
.qr figcaption { font-size: 1rem; color: var(--muted); }

/* Questions screen */
.board { padding: 2rem clamp(1.25rem, 3vw, 3rem); }
.board header {
  display: grid;
  grid-template-columns: 1fr minmax(0, 60%) 1fr;  /* logo | centered title | count */
  align-items: center; gap: 1rem; margin-bottom: 1.5rem;
}
.board header .logo { grid-column: 1; grid-row: 1; justify-self: start; max-width: 100%; }
.board header .title { grid-column: 2; grid-row: 1; text-align: center; }
.board header .right { grid-column: 3; grid-row: 1; justify-self: end;
  display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; text-align: right; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.save {
  font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer;
  background: var(--surface); color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 10px; padding: .5rem .9rem;
}
.save:hover { background: var(--accent); color: var(--accent-ink); }
.save:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.save:disabled { opacity: .4; cursor: default; background: var(--surface); color: var(--accent); }
@media (max-width: 40rem) {
  .board header { grid-template-columns: 1fr auto; }
  .board header .right { grid-column: 2; }
  .board header .title { grid-column: 1 / -1; grid-row: 2; }
}
.board .title { font-size: clamp(1.75rem, 3.2vw, 3rem); line-height: 1.1; margin: 0; }
.board .status { font-size: 1.1rem; }
#wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));  /* newest top-left, then top-right, then next row */
  gap: 1.25rem;
}
@media (max-width: 40rem) { #wall { grid-template-columns: 1fr; } }
.question {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: stretch;
  width: 100%; margin: 0; padding: 0; text-align: left; cursor: pointer;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 0; border-radius: 12px; overflow: hidden;
  font-size: clamp(1.2rem, 1.6vw, 1.6rem); line-height: 1.3;
}
/* Number inside the dark blue band on the left */
.qnum {
  display: flex; align-items: flex-start; justify-content: center;
  min-width: 4.2em; padding: 1rem .6rem;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: .8em; letter-spacing: .02em; line-height: 1.6;
}
.qnum.empty { min-width: 5px; padding: 0; }
.qtext { padding: 1rem 1.25rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.question.unread { background: var(--unread); }
.question:hover { box-shadow: 0 0 0 2px var(--line); }
.question:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Pop-up */
#pop {
  width: min(90vw, 64rem); max-height: 85vh; overflow: auto;
  border: 0; border-top: 8px solid var(--accent); border-radius: 16px;
  padding: clamp(2rem, 5vw, 4rem); background: var(--surface); color: var(--ink);
  cursor: pointer;
}
#pop::backdrop { background: rgb(0 20 70 / 0.6); }
.pop-num { margin: 0 0 .75rem; font-size: clamp(1.2rem, 2vw, 1.6rem); font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.pop-text {
  margin: 0; font-size: clamp(1.8rem, 4vw, 3.5rem); line-height: 1.2; font-weight: 700;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.close {
  position: absolute; top: .75rem; right: .75rem;
  width: 3rem; height: 3rem; border: 0; border-radius: 50%;
  background: var(--bg); color: var(--accent); font-size: 2rem; line-height: 1; cursor: pointer;
}
.close:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.empty { grid-column: 1 / -1; text-align: center; margin: 3rem 0 0; color: var(--muted); font-size: 1.4rem; }

/* Verification code screen */
[hidden] { display: none !important; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.gate form {
  width: min(100%, 24rem); display: flex; flex-direction: column; gap: .75rem;
  background: var(--surface); border-top: 6px solid var(--accent); border-radius: 14px; padding: 2rem;
}
.gate-logo { max-height: 56px; max-width: 60%; width: auto; height: auto; align-self: flex-start; margin-bottom: .75rem; }
.gate label { font-weight: 700; color: var(--accent); font-size: 1.2rem; }
.gate input {
  font: inherit; font-size: 1.25rem; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 10px; padding: .75rem 1rem;
}
.gate input:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.gate button {
  font: inherit; font-weight: 700; font-size: 1.1rem; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 10px; padding: .8rem 1rem; cursor: pointer;
}
.gate button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.gate-error { min-height: 1.3rem; color: #b3261e; font-size: .95rem; }
