/* ===== WHITNEY (OTF) ===== */
@font-face {
  font-family: 'Whitney';
  src: url('fonts/whitneybook.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Whitney';
  src: url('fonts/whitneybold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* UI font: Whitney; Question font: Georgia */
:root{
  --ui: 'Whitney','Helvetica Neue',Arial,sans-serif;
  --qfont: Georgia, 'Times New Roman', serif;
}

.avatar{ width:28px; height:28px; border-radius:50%; vertical-align:middle; margin-right:8px; box-shadow:0 1px 2px rgba(0,0,0,.25); }
.lb-user{ display:flex; align-items:center; gap:.5rem; }
.lb-user .names{ display:flex; flex-direction:column; line-height:1.1; }
.lb-user .dname{ font-weight:700; }
.lb-user .pname{ opacity:.75; font-size:.9rem; }
#myDiscordChip{ display:flex; align-items:center; gap:.5rem; padding:.4rem .7rem; border-radius:999px; background:#f6f6f6; }
#myDiscordChip.hidden{ display:none; }


/* UI font: Whitney; Question font: Georgia */
:root{
  --ui: 'Whitney','Helvetica Neue',Arial,sans-serif;
  --qfont: Georgia, 'Times New Roman', serif;
  --bg: #f1efe7;
  --paper: #f7f3e9;
  --ink: #1c1917;
  --muted: #6b625a;
  --accent: #7d0000;
  --outline: #d6d1c6;
  --orange: #f97316;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font-family:var(--ui); background:var(--bg); color:var(--ink)}

.page{max-width:1100px;margin:0 auto;padding-bottom:48px}

/* full-bleed header, even if inside a centered layout */
.topbar{
  position: sticky; top: 0; z-index: 100;
  background:#780a0a; color:#fff;
  padding:16px 24px;
  /* escape the centered container margins */
  width:100vw; margin-left:calc(50% - 50vw); margin-right:calc(50% - 50vw);
  display:flex; align-items:center; justify-content:space-between;
}
.page{ max-width:1100px; margin:0 auto; min-height:100vh; }

.brand{opacity:.95}
.right{display:flex;gap:12px;align-items:center}
#timer{font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: rgba(255,255,255,.14); padding: 6px 10px; border-radius: 8px;}

.screen{padding:0 16px}
.hidden{display:none}
.card{
  background:#fff;border:1px solid var(--outline);border-radius:14px;padding:20px;max-width:740px;
  box-shadow:0 12px 28px rgba(0,0,0,.06)
}
.title{margin:0 0 8px}
.big{font-size:22px;font-weight:700}
.muted{color:var(--muted)}
.small{font-size:12px}
.row{display:flex;gap:12px;margin-top:10px}
.field{display:flex;flex-direction:column;gap:6px;margin:10px 0 4px}
input{padding:10px 12px;border-radius:10px;border:1px solid var(--outline);font-family:var(--ui);font-size:16px}

button{cursor:pointer;border:none;padding:12px 16px;border-radius:12px;font-weight:700;font-family:var(--ui)}
button.primary{background:var(--orange);color:#fff}
button.ghost{background:#fff;border:1px solid var(--outline)}
button.danger{background:#111;color:#fff}
button:disabled{opacity:.5;cursor:not-allowed}

.examrow{display:grid;grid-template-columns:1fr 240px;gap:16px}
.paper{
  background:var(--paper);border:1px solid var(--outline);border-radius:12px;padding:22px 24px;
  box-shadow:0 10px 24px rgba(0,0,0,.05);min-height:380px
}
.qheader{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:8px}
.qnum{font-weight:700}
.subject{font-size:12px;color:var(--muted)}
.qtext{font-family:var(--qfont);font-size:20px;line-height:1.45;margin:10px 0 16px}
.options{display:grid;gap:10px}
.opt{
  display:grid;grid-template-columns:26px 1fr;gap:10px;align-items:start;
  padding:10px;border-radius:10px;border:1px solid var(--outline);background:#fff;
  transition:background .2s ease
}
.opt:hover{background:#faf7ef}
.opt div{font-family:var(--qfont);font-size:18px;line-height:1.4}
.opt input{margin-top:3px}

.board{margin-top:26px}
#leaderboard{width:100%;border-collapse:collapse;background:#fff;border:1px solid var(--outline);border-radius:12px;overflow:hidden}
#leaderboard th,#leaderboard td{padding:10px;border-bottom:1px solid #e8e6dd;text-align:left}
#leaderboard thead{background:#f0ede3}


/* --- Mobile tweaks --- */
@media (max-width: 768px){
  html, body { height: auto; }
  .page{ padding: 0 12px 72px; max-width: 100%; }

  .topbar{
    padding: 12px 16px;
    font-size: 15px;
  }
  #timer{ padding: 4px 8px; }

  /* Stack exam layout vertically */
  .examrow{
    display: block;       /* instead of grid */
  }
  .paper{
    padding: 18px 16px;
    min-height: auto;
  }

  /* Put nav buttons UNDER the question, full width */
  .navcol{
    position: sticky; bottom: 0;
    background: #fff; border-top: 1px solid var(--outline);
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
    padding: 10px 12px; margin-top: 12px;
  }
  .navcol button{ width: 100%; padding: 12px; }

  /* Larger touch targets for options */
  .options{ gap: 12px; }
  .opt{
    grid-template-columns: 28px 1fr;
    padding: 12px;
  }
  .opt div{ font-size: 17px; line-height: 1.45; }
  .opt input{ width: 22px; height: 22px; }

  /* Cards & tables */
  .card{ padding: 16px; border-radius: 12px; max-width: 100%; }
  #leaderboard th, #leaderboard td{ padding: 8px; font-size: 14px; }
  .lb-user .names .pname{ font-size: .85rem; }
}

/* Improve viewport height on iOS Safari */
@supports (height: 100dvh){
  .page{ min-height: 100dvh; }
}

.credit{
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: -6px;
  margin-bottom: 12px;
  font-style: italic;
}
