/* ==========================================================================
   GBAITA Innovation Arena 2026 — student submission portal
   Brand system: Archivo + Mulish, GBAITA red, warm neutrals.
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Mulish";
  src: url("../fonts/mulish.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --paper-warm: #fbf8f5;
  --surface: #fffdf9;
  --surface-sunk: #f4ece6;
  --ink: #231b1b;
  --ink-soft: #463c3c;
  --muted: #7a6e6c;
  --rule: #e6ded8;
  --rule-strong: #d3c8c0;
  --red: #b00101;
  --red-deep: #8c0101;
  --red-bright: #cf1b1b;
  --rose: #f0d6d2;
  --green: #1f6f43;
  --green-soft: #e3f0e8;
  --amber: #8a5a00;
  --amber-soft: #f7edd8;
  --accent: var(--red);
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(35, 27, 27, 0.05), 0 12px 32px -18px rgba(35, 27, 27, 0.25);
  --shadow-lift: 0 2px 4px rgba(35, 27, 27, 0.06), 0 24px 48px -24px rgba(35, 27, 27, 0.35);
  --font-display: "Archivo", "PingFang TC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans TC", "Noto Sans SC", sans-serif;
  --font-body: "Mulish", "PingFang TC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans TC", "Noto Sans SC", sans-serif;
  --ease: cubic-bezier(0.22, 0.72, 0.2, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper-warm);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main { flex: 1; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
}

p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--red); color: #fff; }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: #fff;
  color: var(--red);
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

.shell {
  width: min(1120px, 100% - 48px);
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  background:
    radial-gradient(1200px 200px at 15% -60%, rgba(255, 255, 255, 0.14), transparent 70%),
    linear-gradient(120deg, var(--red-deep), var(--red) 55%, #c11111);
  color: #fff;
  box-shadow: 0 2px 12px rgba(80, 0, 0, 0.18);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding-block: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  border-radius: var(--radius-sm);
}
.brand-logo { width: 108px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18)); }
.brand-divider { width: 1px; height: 30px; background: rgba(255, 255, 255, 0.35); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.brand-text span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.78);
}
.header-note {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Landing
   -------------------------------------------------------------------------- */

.hero { padding: clamp(40px, 7vw, 84px) 0 8px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.display {
  font-size: clamp(2.4rem, 5.6vw, 4rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.02;
}
.display em {
  font-style: normal;
  color: var(--red);
}
.hero-lede {
  max-width: 56ch;
  margin-top: 22px;
  font-size: clamp(1rem, 1.4vw, 1.14rem);
  line-height: 1.65;
  color: var(--ink-soft);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 26px;
  font-size: 13.5px;
  color: var(--muted);
}
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { flex: none; color: var(--red); }

.how-card {
  position: relative;
  padding: 28px 26px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.how-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--red), #e0552f 60%, #e8a04a);
}
.how-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.how-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 18px;
}
.how-list li { display: grid; grid-template-columns: 34px 1fr; gap: 13px; align-items: start; }
.how-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-sunk);
  color: var(--red);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
}
.how-list strong { display: block; color: var(--ink); font-size: 15px; }
.how-list p { margin-top: 3px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.how-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Group picker
   -------------------------------------------------------------------------- */

.picker { padding: clamp(32px, 5vw, 56px) 0 72px; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 26px;
}
.section-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.section-head p { max-width: 52ch; font-size: 14.5px; color: var(--muted); }

.group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.group-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 172px;
  padding: 22px 22px 20px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
  overflow: hidden;
}
.group-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--accent, var(--red));
}
.group-card::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -70px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--accent, var(--red));
  opacity: 0.06;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.group-card:hover {
  transform: translateY(-3px);
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-lift);
}
.group-card:hover::after { transform: scale(1.25); opacity: 0.1; }

.group-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.group-index {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent, var(--red));
  text-transform: uppercase;
}
.group-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent, var(--red));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, var(--red)) 14%, transparent);
}
.group-name {
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.group-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.group-count { display: inline-flex; align-items: center; gap: 7px; }
.group-count strong { color: var(--ink); font-weight: 700; }
.group-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  color: var(--accent, var(--red));
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.group-card:hover .group-arrow { background: var(--accent, var(--red)); color: #fff; border-color: transparent; }

.group-card.is-last { border-color: color-mix(in srgb, var(--accent, var(--red)) 45%, var(--rule)); }
.group-last-tag {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-sunk);
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Group page
   -------------------------------------------------------------------------- */

.group-page { padding: 28px 0 72px; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-weight: 600;
  border-radius: 4px;
}
.crumbs a:hover { color: var(--red); }
.crumbs span[aria-hidden] { color: var(--rule-strong); }

.group-head {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 28px);
  margin: 22px 0 30px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--rule);
}
.group-badge {
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(64px, 9vw, 88px);
  height: clamp(64px, 9vw, 88px);
  border-radius: var(--radius);
  background: var(--accent, var(--red));
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent, var(--red)) 80%, transparent);
}
.group-head .eyebrow { margin-bottom: 8px; }
.group-head h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.group-head p {
  margin-top: 8px;
  max-width: 60ch;
  font-size: 14.5px;
  color: var(--muted);
}
.group-head > div:last-child { flex: 1 1 280px; min-width: 0; }
.group-head .change-group { margin-top: 10px; font-size: 13.5px; }
.group-head .change-group a { color: var(--red); font-weight: 700; }
.group-head .change-group a:hover { text-decoration: underline; }

/* Stage switch ---------------------------------------------------------- */

.stage-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stage-tab {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  text-align: left;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.stage-tab:hover { border-color: var(--rule-strong); transform: translateY(-1px); }
.stage-tab.is-active {
  border-color: var(--accent, var(--red));
  background: color-mix(in srgb, var(--accent, var(--red)) 4%, #fff);
  box-shadow: 0 0 0 1px var(--accent, var(--red)), var(--shadow);
}
.stage-short {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
}
.stage-tab.is-active .stage-short { background: var(--accent, var(--red)); color: #fff; }
.stage-tab-name { display: block; font-family: var(--font-display); font-weight: 600; font-size: 15.5px; color: var(--ink); }
.stage-tab-window { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.stage-tab-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.stage-tab-count { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Status pills ---------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--open { background: var(--green-soft); color: var(--green); }
.pill--closed { background: #efe9e6; color: #8a7a75; }
.pill--upcoming { background: var(--amber-soft); color: var(--amber); }

/* Layout ---------------------------------------------------------------- */

.stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.72fr);
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel + .panel { margin-top: 24px; }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, #fff, #fdfaf7);
}
.panel-head h2 { font-size: 1.2rem; }
.panel-head p { margin-top: 3px; font-size: 13px; color: var(--muted); }
.panel-deadline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.panel-deadline svg { flex: none; color: var(--red); }
.panel-body { padding: 24px; }

.stage-aside { position: sticky; top: 24px; display: grid; gap: 18px; }

.side-card {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.side-card h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.deadline-big {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}
.deadline-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-sunk);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
}
.countdown.is-urgent { background: #fbe4e0; color: var(--red); }

.side-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.side-list li {
  position: relative;
  padding-left: 22px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.side-list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent, var(--red));
  opacity: 0.75;
}
.side-help { font-size: 13px; color: var(--muted); line-height: 1.6; }
.side-help a { color: var(--red); font-weight: 600; }

/* Upload form ----------------------------------------------------------- */

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 32px 20px;
  text-align: center;
  background:
    repeating-linear-gradient(135deg, rgba(176, 1, 1, 0.025) 0 10px, transparent 10px 20px),
    var(--surface);
  border: 2px dashed var(--rule-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}
.dropzone:hover { border-color: var(--accent, var(--red)); }
.dropzone.is-over {
  border-color: var(--accent, var(--red));
  background: color-mix(in srgb, var(--accent, var(--red)) 5%, #fff);
  transform: scale(1.005);
}
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-sunk);
  color: var(--accent, var(--red));
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.dropzone:hover .dropzone-icon { background: var(--accent, var(--red)); color: #fff; }
.dropzone-title { font-weight: 700; color: var(--ink); font-size: 15.5px; }
.dropzone-hint { font-size: 12.5px; color: var(--muted); max-width: 46ch; }
.dropzone-browse { color: var(--red); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

.selected-files { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.selected-file {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}
.selected-file-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 5px;
  background: var(--surface-sunk);
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.selected-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.selected-file-size { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: #fbe9e7; color: var(--red); border-color: #f3d3cf; }

.view-panel {
  margin-bottom: 24px;
  padding: 20px 24px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.view-head h2 { font-size: 1.2rem; }
.view-head p {
  margin-top: 4px;
  max-width: 72ch;
  font-size: 13px;
  color: var(--muted);
}
.view-panel .work-type { margin: 16px 0 0; }
.view-panel .student-field { margin: 16px 0 0; max-width: 420px; }
.upload-mode {
  margin-top: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent, var(--red));
}

.work-type {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}
.work-type legend {
  margin-bottom: 10px;
  padding: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}
.work-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.work-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.work-option:hover { border-color: var(--rule-strong); }
.work-option input {
  flex: none;
  margin: 3px 0 0;
  accent-color: var(--accent, var(--red));
}
.work-option:has(input:checked) {
  border-color: var(--accent, var(--red));
  background: color-mix(in srgb, var(--accent, var(--red)) 4%, #fff);
  box-shadow: 0 0 0 1px var(--accent, var(--red));
}
.work-option-body { display: grid; gap: 2px; }
.work-option-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.work-option-copy { font-size: 12px; line-height: 1.45; color: var(--muted); }
.work-option.is-disabled { opacity: 0.55; cursor: not-allowed; }
.work-option.is-disabled:hover { border-color: var(--rule); }

.student-field { margin: 0 0 18px; }

.work-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.work-badge.is-group { background: var(--green-soft); color: var(--green); }
.work-badge.is-personal { background: #efeaf8; color: #5b3e96; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.field { display: grid; gap: 6px; }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--ink); letter-spacing: 0.01em; }
.field label .optional { font-weight: 400; color: var(--muted); }
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  background: #fff;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.4;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(176, 1, 1, 0.1);
}
.field input::placeholder,
.field textarea::placeholder { color: #b3a8a4; }
.field select { padding-right: 34px; cursor: pointer; }
.field select:invalid { color: var(--muted); }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.form-actions .hint { font-size: 12.5px; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.1s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 8px 18px -10px rgba(176, 1, 1, 0.75); }
.btn-primary:hover:not(:disabled) { background: var(--red-deep); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--rule-strong); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-soft); color: var(--ink); }
.btn-danger { background: #fff; color: var(--red); border-color: #ecc9c6; }
.btn-danger:hover:not(:disabled) { background: #fbe9e7; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-link { background: none; border: 0; color: var(--red); font-weight: 700; cursor: pointer; padding: 4px; }

/* Upload progress and alerts ------------------------------------------- */

.progress-wrap { margin-top: 20px; }
.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.progress-head strong { color: var(--ink); font-weight: 700; }
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-sunk);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), #e0552f);
  transition: width 0.25s var(--ease);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.alert svg { flex: none; margin-top: 1px; }
.alert--error { background: #fdf0ee; border-color: #f0cdc8; color: #8f1d14; }
.alert--success { background: var(--green-soft); border-color: #c4dfcf; color: #175c37; }
.alert--info { background: var(--amber-soft); border-color: #ead6ac; color: #6f4a00; }

.closed-panel { padding: 28px 24px; }
.closed-panel h2 { font-size: 1.25rem; }
.closed-panel p { margin-top: 8px; max-width: 60ch; font-size: 14px; color: var(--muted); }
.closed-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }

/* Submitted files ------------------------------------------------------- */

.submissions { display: grid; gap: 16px; }

.submission {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
}
.submission-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.submission-who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-sunk);
  color: var(--red);
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
}
.submission-title { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.submission-title strong { display: block; font-size: 13.5px; color: var(--ink); }
.submission-who strong { display: block; font-size: 13.5px; color: var(--ink); }
.submission-who span { display: block; font-size: 11.5px; color: var(--muted); }
.submission-note {
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  background: #fffdf9;
  font-size: 13px;
  color: var(--ink-soft);
}
.submission-note strong { color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; display: block; margin-bottom: 3px; }

.file-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
}
.file-row + .file-row { border-top: 1px solid #f0eae5; }
.file-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 5px;
  background: var(--surface-sunk);
  color: var(--red);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.file-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.file-meta { display: block; font-size: 11.5px; color: var(--muted); }
.file-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}
.file-download:hover { border-color: var(--red); color: var(--red); background: #fff7f6; }

.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--surface-sunk);
  color: var(--red);
}
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13px; }

/* Footer ---------------------------------------------------------------- */

.site-footer { background: #241c1c; color: rgba(255, 255, 255, 0.7); margin-top: 48px; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  padding-block: 28px;
}
.footer-logo { width: 84px; opacity: 0.9; }
.footer-copy { font-size: 13px; }
.footer-note { margin-left: auto; font-size: 12px; color: rgba(255, 255, 255, 0.5); }

/* Boot / errors --------------------------------------------------------- */

.boot {
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 120px 20px;
  text-align: center;
  color: var(--muted);
}
.boot-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.4; }
  50% { transform: scale(1); opacity: 1; }
}

.noscript {
  padding: 16px;
  background: #fff3cd;
  color: #6f4a00;
  text-align: center;
  font-size: 14px;
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #f2ece7 25%, #faf6f2 37%, #f2ece7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */

.admin-page { padding: 34px 0 72px; }

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 60vh;
  padding: 40px 0;
}
.login-card {
  width: min(420px, 100%);
  padding: 34px 32px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}
.login-logo { width: 120px; margin-bottom: 22px; }
.login-card h1 { font-size: 1.7rem; }
.login-card .lede { margin-top: 8px; font-size: 14px; color: var(--muted); }
.login-card form { margin-top: 24px; display: grid; gap: 14px; }
.login-card .field input { font-size: 16px; }

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.admin-head h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.admin-head p { margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.stat-label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.stat-value { margin-top: 6px; font-family: var(--font-display); font-size: 1.65rem; font-weight: 650; color: var(--ink); letter-spacing: -0.02em; }
.stat-sub { margin-top: 2px; font-size: 11.5px; color: var(--muted); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.toolbar .field { min-width: 150px; }
.toolbar .field.grow { flex: 1; min-width: 220px; }
.toolbar select,
.toolbar input {
  width: 100%;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
}
.toolbar .btn { flex: none; }

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}
.bulk-bar strong { color: var(--ink); }

.table-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-wrap { overflow-x: auto; }
table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 820px;
}
.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  text-align: left;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.admin-table td { padding: 12px 14px; border-bottom: 1px solid #f0eae5; vertical-align: top; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: #fffbf8; }
.admin-table .cell-file { min-width: 240px; }
.admin-file { display: flex; align-items: center; gap: 10px; }
.admin-file .file-name { max-width: 300px; }
.admin-file .file-meta { font-size: 11px; }
.admin-table .cell-group { white-space: nowrap; font-weight: 700; color: var(--ink); }
.admin-table .cell-stage { white-space: nowrap; }
.admin-table .cell-uploader { min-width: 150px; }
.admin-table .cell-uploader .work-badge { display: inline-block; margin: 0 0 4px; }
.admin-table .cell-uploader strong { display: block; color: var(--ink); font-weight: 600; }
.admin-table .cell-uploader span { display: block; font-size: 11.5px; color: var(--muted); }
.admin-table .cell-note { max-width: 240px; font-size: 12.5px; color: var(--muted); }
.admin-table .cell-note p { overflow-wrap: anywhere; }
.admin-table .cell-date { white-space: nowrap; font-size: 12px; color: var(--muted); }
.admin-table .cell-actions { white-space: nowrap; text-align: right; }
.row-action-text { display: none; }
.zip-hint { margin: -2px 0 16px; font-size: 12px; color: var(--muted); }
.row-actions { display: inline-flex; gap: 6px; }
.chip-stage {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-sunk);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}

.admin-note {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.admin-empty { padding: 56px 24px; text-align: center; color: var(--muted); }

.admin-footer { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Responsive ------------------------------------------------------------ */

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .how-card { max-width: 560px; }
  .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-layout { grid-template-columns: 1fr; }
  .stage-aside { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 32px, 1120px); }
  .header-inner { min-height: 62px; }
  .brand-logo { width: 88px; }
  .brand-text strong { font-size: 15px; }
  .brand-text span { font-size: 10.5px; }
  .header-note { display: none; }
  .brand-divider { height: 24px; }

  .hero { padding-top: 34px; }
  .display { font-size: clamp(2.1rem, 9vw, 3rem); }
  .hero-meta { gap: 8px 16px; font-size: 12.5px; }
  .how-card { padding: 22px 20px; }

  .picker { padding-top: 34px; }
  .group-grid { grid-template-columns: 1fr; gap: 12px; }
  .group-card { min-height: 140px; padding: 18px 18px 16px; gap: 14px; }

  .group-page { padding-top: 20px; }
  .group-head { gap: 14px; flex-wrap: wrap; align-items: center; }
  .group-head > div:last-child { flex: 1 1 100%; }
  .group-head .eyebrow { display: none; }
  .group-badge { width: 58px; height: 58px; font-size: 1.5rem; }
  .group-head h1 { font-size: 1.8rem; }

  .stage-switch { grid-template-columns: 1fr; gap: 10px; }
  .stage-tab { grid-template-columns: auto 1fr auto; padding: 13px 14px; }
  .stage-short { width: 36px; height: 36px; }

  .stage-aside { grid-template-columns: 1fr; }
  .panel-head, .panel-body { padding: 18px 16px; }
  .panel-body { padding-top: 18px; }

  .work-options { grid-template-columns: 1fr; }
  .view-panel { padding: 18px 16px; }
  .view-panel .student-field { max-width: none; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .form-actions .hint { text-align: center; }

  .submission-head { padding: 11px 13px; }
  .file-row { padding: 10px 13px; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 9px; }
  .file-icon { width: 30px; height: 30px; font-size: 8.5px; }
  .file-name { font-size: 12.5px; }
  .file-download { padding: 5px 9px; font-size: 11px; }
  .file-download span { display: none; }

  .footer-inner { padding-block: 22px; }
  .footer-note { margin-left: 0; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 1.35rem; }

  .admin-head { align-items: flex-start; }
  .admin-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .admin-actions .btn { width: 100%; padding: 10px 8px; font-size: 13px; }
  .admin-actions .btn:last-child { grid-column: 1 / -1; }
  .eyebrow { font-size: 10.5px; letter-spacing: 0.12em; }
  .eyebrow::before { display: none; }
  .toolbar { padding: 14px; }
  .toolbar .field, .toolbar .field.grow { min-width: 100%; }
  .toolbar .btn { width: 100%; }


}

@media (max-width: 880px) {
  /* The admin table becomes one card per file on a phone. */
  .table-card { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  .table-wrap { overflow: visible; }
  table.admin-table { display: block; min-width: 0; width: 100%; }
  .admin-table thead { display: none; }
  .admin-table tbody { display: grid; gap: 12px; }
  .admin-table tr {
    display: block;
    padding: 14px 16px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .admin-table td {
    display: block;
    position: relative;
    padding: 4px 0 4px 88px;
    border: 0;
  }
  .admin-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: 7px;
    width: 78px;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .admin-table td.cell-file { padding: 0 0 10px; }
  .admin-table td.cell-file::before,
  .admin-table td.cell-actions::before { display: none; }
  .admin-table td.cell-actions {
    margin-top: 6px;
    padding: 10px 0 0;
    border-top: 1px solid var(--rule);
  }
  .admin-table .row-actions { display: flex; width: 100%; gap: 8px; }
  .admin-table .row-actions .btn { flex: 1; }
  .admin-table .file-name { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .admin-table .cell-note { max-width: none; }
  .admin-table .cell-date, .admin-table .cell-group, .admin-table .cell-stage { white-space: normal; }
  .row-action-text { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header, .site-footer, .stage-switch, .form-actions, .dropzone, .selected-files, .toolbar, .admin-actions { display: none !important; }
  body { background: #fff; }
  .panel, .side-card, .submission { box-shadow: none; }
}
