/* AAQC brand palette + fonts — matched directly against the live site at
   aaqc.org.au: navy #0a293d, gold #d4af37, cream #e8d494, headings in
   Newsreader (serif), body in ABeeZee (sans). */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@0,400;0,500;0,600;0,700;1,400&family=ABeeZee:ital@0;1&display=swap');

:root {
  --navy-950: #071b28;
  --navy-900: #0a293d;
  --navy-800: #123a53;
  --navy-700: #1a4d6e;
  --gold-500: #d4af37;
  --gold-400: #ddc061;
  --cream-300: #e8d494;
  --cream-100: #f6efd9;
  --cream-50: #fbf8ef;
  --ink-900: #1a1a1a;
  --ink-600: #55554f;
  --danger: #b3413a;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(10, 41, 61, 0.12);
  --shadow-lift: 0 14px 32px rgba(10, 41, 61, 0.18);
  --font-heading: 'Newsreader', Georgia, serif;
  --font-body: 'ABeeZee', 'Century Gothic', Futura, 'Trebuchet MS', sans-serif;
  /* Subtle geometric motif (abstract star/diamond lattice, gold linework)
     layered onto branded navy surfaces — the homepage hero and the auth
     split-panels — so large areas of navy read as designed, not empty. */
  --pattern-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='84' viewBox='0 0 84 84'%3E%3Cg fill='none' stroke='%23d4af37' stroke-opacity='0.28' stroke-width='1'%3E%3Cpath d='M42 2l20 20-20 20-20-20z'/%3E%3Cpath d='M42 82l20-20-20-20-20 20z'/%3E%3Ccircle cx='42' cy='42' r='13'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream-50);
  background-image:
    radial-gradient(1400px 600px at 100% -10%, rgba(212, 175, 55, 0.14), transparent 62%),
    radial-gradient(1200px 560px at -10% 15%, rgba(10, 41, 61, 0.09), transparent 58%),
    radial-gradient(900px 500px at 50% 115%, rgba(10, 41, 61, 0.06), transparent 60%);
  background-attachment: fixed;
  color: var(--ink-900);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 36px 32px 90px;
}
.page.wide { max-width: 1800px; }
.page.center-viewport { display: flex; flex-direction: column; justify-content: center; padding-top: 36px; padding-bottom: 36px; }
@media (max-width: 640px) {
  .page { padding: 20px 14px 60px; }
  .card { padding: 16px; }
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 560px; }

.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

header.top {
  background: linear-gradient(135deg, var(--navy-950), var(--navy-800));
  color: var(--cream-50);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
  position: sticky;
  top: 0;
  z-index: 20;
}

header.top .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
header.top .brand img { height: 42px; width: auto; display: block; }
header.top .brand .sep { color: var(--gold-500); font-weight: 400; }
header.top .brand .subtitle { font-family: var(--font-body); font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; }

header.top nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
header.top nav a {
  color: var(--cream-100);
  text-decoration: none;
  margin-left: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0.82;
  transition: opacity 0.15s ease, background 0.15s ease;
}
header.top nav a:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }
header.top nav a.active { opacity: 1; background: rgba(212, 175, 55, 0.16); color: var(--gold-400); font-weight: 600; }

@media (max-width: 640px) {
  header.top { flex-wrap: wrap; padding: 12px 16px; gap: 8px; row-gap: 6px; }
  header.top .brand { font-size: 18px; gap: 8px; }
  header.top .brand img { height: 32px; }
  header.top nav { margin-left: auto; }
  header.top nav a { margin-left: 0; padding: 6px 11px; font-size: 13px; }
}

h1, h2, h3 { font-family: var(--font-heading); color: var(--navy-900); font-weight: 600; }
h1 { font-size: 34px; letter-spacing: -0.01em; }
h2 { font-family: var(--font-body); font-size: 19px; font-weight: 700; color: var(--navy-900); }

.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 22px;
  border: 1px solid rgba(10, 41, 61, 0.06);
  border-top: 3px solid var(--gold-500);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

a.card:hover, .card.hoverable:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
  background: var(--navy-800);
  color: white;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--navy-700); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 2px; }
.btn.secondary { background: transparent; color: var(--navy-800); border: 1px solid var(--navy-700); }
.btn.secondary:hover { background: rgba(18, 58, 83, 0.06); }
.btn.gold { background: var(--gold-500); color: var(--navy-950); }
.btn.gold:hover { background: var(--gold-400); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { padding: 6px 14px; font-size: 12px; }
.btn.tally { padding: 10px 14px; font-size: 16px; font-weight: 700; min-width: 44px; }
.btn.full { width: 100%; text-align: center; }
.btn.loading { opacity: 0.7; cursor: wait; }

input, select, textarea {
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1px solid #d8c98a;
  background: var(--cream-50);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22);
}
label { font-size: 13px; color: var(--ink-600); display: block; margin: 10px 0 4px; font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #ece1c0; }
th { color: var(--ink-600); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr.result-row:hover { background: #fbf6e8; }
tr.detail-row { background: #faf7ee; font-size: 13px; }
tr.detail-row td { padding: 6px 8px; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill.current { background: #f7e9c0; color: #8a6a00; }
.pill.done { background: #dde9ee; color: var(--navy-800); }
.pill.waiting { background: #f0e9d3; color: var(--ink-600); }
.pill.head { background: var(--navy-900); color: var(--gold-400); }
.pill.finalized { background: #dcefe0; color: #1f7a3d; }
.pill.pending { background: #f4e2c8; color: #9a5b00; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.muted { color: var(--ink-600); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; margin-top: 6px; min-height: 1px; }
.success { color: #1f7a3d; font-size: 13px; margin-top: 6px; }

.center-box {
  max-width: 400px;
  margin: 90px auto;
  text-align: center;
}

.hero {
  background-image: var(--pattern-gold), linear-gradient(135deg, var(--navy-950), var(--navy-800) 60%, var(--navy-700));
  background-size: 84px 84px, auto;
  color: var(--cream-50);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 56px 48px;
  margin-bottom: 28px;
  border-top: 3px solid var(--gold-500);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(700px 320px at 90% 0%, rgba(212, 175, 55, 0.20), transparent 60%);
  pointer-events: none;
}
.hero .eyebrow {
  display: inline-block; color: var(--gold-400); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 12px; position: relative;
}
.hero h1 { color: #fff; margin: 0 0 12px; font-size: 44px; position: relative; }
.hero p { color: var(--cream-100); margin: 0; font-size: 17px; max-width: 640px; position: relative; }
@media (max-width: 640px) {
  .hero { padding: 32px 22px; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 15px; }
  h1 { font-size: 26px; }
}

.icon-tile {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--cream-100); color: var(--navy-800);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.card:hover .icon-tile { background: var(--gold-500); color: var(--navy-950); transition: background 0.15s ease, color 0.15s ease; }

/* Bigger, centered variant for the homepage's primary "who's logging in?"
   choice — these two cards are the main entry point, not one of several
   equal options, so they get more visual weight than a regular card. */
.role-card { text-align: center; padding: 36px 28px; }
.role-card .icon-tile { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 18px; }
.role-card .icon { width: 32px; height: 32px; }
.role-card h3 { font-size: 22px; margin: 0 0 8px; }

/* Split-panel auth screens (admin/judge login) — a branded navy panel with
   the geometric pattern alongside the actual form, filling the full
   viewport instead of a lone card floating in empty space. */
.auth-split {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
}
.auth-brand {
  background-image: var(--pattern-gold), linear-gradient(160deg, var(--navy-950), var(--navy-800) 55%, var(--navy-700));
  background-size: 84px 84px, auto;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 64px;
  position: relative;
  overflow: hidden;
}
.auth-brand::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(700px 380px at 100% 100%, rgba(212, 175, 55, 0.20), transparent 60%);
  pointer-events: none;
}
.auth-brand > * { position: relative; }
.auth-brand img { height: 56px; width: 56px; object-fit: contain; margin-bottom: 28px; align-self: flex-start; }
.auth-brand h1 { color: #fff; font-size: 32px; margin: 0 0 14px; }
.auth-brand p { color: var(--cream-100); font-size: 15px; line-height: 1.6; max-width: 380px; margin: 0; }
.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-form-side form { width: 100%; max-width: 380px; margin: 0; }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}
@media (max-width: 480px) {
  .auth-form-side { padding: 24px 18px; }
}

.rubric-section {
  border: 1px solid #ece1c0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.rubric-section h3 { margin: 0 0 4px; font-family: var(--font-body); font-size: 16px; }
.rubric-score {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 600;
  color: var(--navy-900);
}
.deduction-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #f1e8cc;
  flex-wrap: wrap;
}
.deduction-row .label { font-size: 14px; flex: 1 1 160px; min-width: 0; }
.deduction-row .points { font-size: 12px; color: var(--ink-600); margin-right: 8px; white-space: nowrap; }
.tally-controls { display: flex; align-items: center; gap: 8px; }
.tally-count { min-width: 26px; text-align: center; font-weight: 700; font-family: var(--font-heading); font-size: 18px; }

.judge-split {
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(360px, 1fr);
  gap: 22px;
  align-items: start;
}
.mushaf-panel { position: sticky; top: 84px; }
@media (max-width: 980px) {
  .judge-split { grid-template-columns: 1fr; }
  .mushaf-panel { position: static; }
}

.question-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.question-tabs button {
  border: 1px solid var(--gold-500);
  background: var(--cream-50);
  color: var(--navy-900);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.question-tabs button:hover:not(:disabled):not(.active) { background: var(--cream-300); }
.question-tabs button.active { background: var(--navy-900); color: var(--gold-400); border-color: var(--navy-900); }
.question-tabs button:disabled { opacity: 0.45; cursor: not-allowed; }
.mushaf-frame-wrap { border: 1px solid #ece1c0; border-radius: 10px; overflow: hidden; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-btn.active { background: var(--navy-900); color: var(--gold-400); border-color: var(--navy-900); }
.tab-panel { animation: tabFadeIn 0.15s ease; }
@keyframes tabFadeIn { from { opacity: 0; } to { opacity: 1; } }
