:root {
  --navy: #0e2347;
  --navy-soft: #1b3d70;
  --navy-deep: #050a14;
  --paper: #fffdf8;
  --paper-deep: #f3ead9;
  --red: #a8322c;
  --red-deep: #852722;
  --gold: #c9a961;
  --ink: #2f2f33;
  --muted: #6b6b70;
  --line: #d6c8af;
  --success: #176441;
  --success-soft: #edf7f1;
  --error-soft: #fff3f1;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "PingFang SC", serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--navy-deep);
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  padding: 40px 16px 56px;
  color: var(--ink);
  background: radial-gradient(circle at 50% 20%, #1b3d70 0%, var(--navy) 42%, var(--navy-deep) 100%);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--navy-soft);
  text-underline-offset: 3px;
}

button,
input,
select,
textarea { font: inherit; }

button { min-height: 44px; }

[hidden] { display: none !important; }

.page-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
}

.page-meta:empty { display: none; }

.paper {
  position: relative;
  width: 100%;
  max-width: 860px;
  padding: 48px 56px 52px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--paper) 0%, #f8f1e3 100%);
  border-radius: 6px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, .55),
    inset 0 0 0 1px rgba(201, 169, 97, .35);
}

.paper::before {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border: 1px solid rgba(201, 169, 97, .28);
  border-radius: 2px;
}

.hero {
  position: relative;
  margin-bottom: 24px;
  text-align: center;
}

.university-brand {
  width: min(100%, 216px);
  margin: 0 auto 26px;
}

.university-brand img {
  display: block;
  width: 100%;
  height: auto;
}

.state-kicker {
  margin: 0 0 14px;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 4px;
}

h1,
h2 { color: var(--navy); }

h1 {
  margin: 0 0 7px;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 5px;
}

.form-title {
  margin: 0 0 17px;
  color: var(--red);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 4px;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: 1.5px;
}

.deadline {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.deadline time {
  color: var(--red-deep);
  font-weight: 600;
}

.divider {
  width: 120px;
  height: 1px;
  margin: 18px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.required-legend {
  margin: 0 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.required-mark { color: var(--red); }

.form-content { display: block; }

.form-section {
  position: relative;
  margin: 0 0 34px;
}

.form-section:last-child { margin-bottom: 0; }

.section-heading {
  margin: 0 0 20px;
}

.section-heading h2 {
  margin: 0;
  padding-left: 14px;
  border-left: 3px solid var(--red);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 2px;
}

.section-heading p {
  margin: 7px 0 0 17px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
}

.full { grid-column: 1 / -1; }

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: .5px;
}

.role-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.role-option {
  position: relative;
  cursor: pointer;
}

.role-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.role-option span {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 9px 7px;
  color: #4e4b47;
  background: rgba(255, 255, 255, .7);
  border: 1px solid var(--line);
  border-radius: 3px;
  transition: border-color .2s ease, color .2s ease, background .2s ease, box-shadow .2s ease;
}

.role-option:hover span {
  border-color: #cabb9c;
  background: #fff;
}

.role-option input:checked + span {
  color: var(--navy);
  background: rgba(201, 169, 97, .2);
  border-color: #a98537;
  box-shadow: inset 0 -3px 0 var(--gold), 0 2px 7px rgba(101, 78, 29, .08);
  font-weight: 600;
}

.role-option input:focus-visible + span {
  outline: 3px solid rgba(168, 50, 44, .3);
  outline-offset: 3px;
}

.role-field[aria-invalid="true"] .role-option span {
  border-color: var(--red);
}

label {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .5px;
}

.field-help,
.field-error {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .75);
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

input,
select { min-height: 48px; }

input::placeholder,
textarea::placeholder { color: #8a8680; }

input:hover,
select:hover,
textarea:hover { border-color: #bda980; }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(201, 169, 97, .15);
}

input[readonly] {
  color: var(--muted);
  background: rgba(243, 238, 228, .85);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(168, 50, 44, .1);
}

textarea {
  min-height: 205px;
  resize: vertical;
  line-height: 1.8;
}

.email-row,
.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  margin-top: 8px;
}

.email-row input,
.code-row input { margin-top: 0; }

.accepted-email-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: baseline;
  color: #6d5830 !important;
}

.accepted-email-domains {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px 7px;
}

.accepted-email-item {
  white-space: nowrap;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .93em;
  letter-spacing: 0;
}

.accepted-email-separator {
  margin-left: 7px;
  color: var(--gold);
  font-family: var(--serif);
}

.code-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.human-verification-panel {
  margin-top: 17px;
  padding: 15px 17px;
  background: rgba(201, 169, 97, .08);
  border: 1px dashed rgba(201, 169, 97, .45);
  border-radius: 4px;
}

.human-verification-panel p {
  margin: 0 0 11px;
  color: #57514a;
  font-size: 14px;
}

.button-primary,
.button-secondary,
.button-link,
.submit {
  border-radius: 3px;
  cursor: pointer;
  font-weight: 600;
  transition: background .2s ease, box-shadow .2s ease, transform .15s ease;
}

.button-primary,
.button-secondary {
  min-width: 126px;
  padding: 10px 16px;
  white-space: nowrap;
}

.button-primary {
  color: #fff;
  background: var(--navy);
  border: 1px solid var(--navy);
}

.button-primary:hover { background: var(--navy-soft); }

.button-secondary {
  color: var(--navy);
  background: rgba(255, 255, 255, .78);
  border: 1px solid #b5bfd0;
}

.button-secondary:hover { background: #fff; }

.button-link {
  min-height: 36px;
  padding: 4px 7px;
  color: var(--navy-soft);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .56;
  transform: none !important;
  box-shadow: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid rgba(168, 50, 44, .3);
  outline-offset: 3px;
}

.field-error { color: var(--red-deep); }
.field-error.is-success { color: var(--success); }

.status {
  min-height: 1.65em;
  margin: 13px 0 8px;
  color: var(--red-deep);
  font-size: 14px;
}

.status.is-success { color: var(--success); }
.verification-status { margin-bottom: 0; }

.verified-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 13px 15px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(23, 100, 65, .2);
  border-radius: 4px;
}

.verified-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #fff;
  background: var(--success);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}

.verified-state p {
  margin: 1px 0 0;
  color: #4e6458;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.reason-help {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.reason-count {
  color: var(--muted);
  white-space: nowrap;
}

.reason-count.is-short { color: var(--red-deep); }
.reason-count.is-ready { color: var(--success); }

.privacy-card {
  margin-bottom: 20px;
  padding: 16px 18px;
  color: #55535a;
  background: rgba(201, 169, 97, .08);
  border: 1px solid rgba(201, 169, 97, .28);
  border-radius: 4px;
  font-size: 14px;
}

.privacy-card strong { color: var(--navy); }
.privacy-card p { margin: 5px 0 0; }

.contact-note {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.error-summary {
  margin: 0 0 19px;
  padding: 14px 16px;
  color: var(--red-deep);
  background: var(--error-soft);
  border: 1px solid rgba(168, 50, 44, .24);
  border-radius: 4px;
}

.error-summary ul {
  margin: 6px 0 0;
  padding-left: 1.25em;
}

.error-summary a { color: var(--red-deep); }

.agree {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
}

.agree input {
  width: 20px;
  min-height: 20px;
  height: 20px;
  margin: 3px 0 0;
  padding: 0;
  accent-color: var(--red);
}

.agree-error { margin: 7px 0 18px 30px; }

.submit {
  width: 100%;
  min-height: 52px;
  padding: 15px 18px;
  color: #fff;
  background: linear-gradient(135deg, #b93b3b, #8b2a26);
  border: 0;
  box-shadow: 0 10px 30px rgba(139, 42, 38, .25);
  font-size: 17px;
  letter-spacing: 4px;
}

.submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px rgba(139, 42, 38, .35);
}

.state-card,
.success-card {
  position: relative;
  max-width: 620px;
  margin: 32px auto 8px;
  padding: 34px 30px;
  text-align: center;
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(201, 169, 97, .38);
  border-radius: 5px;
}

.state-card h2,
.success-card h2 {
  margin: 0 0 11px;
  font-size: 27px;
}

.state-card p,
.success-card p {
  margin: 7px 0;
  color: var(--muted);
}

.success-seal {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: 50%;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  transform: rotate(-6deg);
}

.notice {
  margin: 15px 0 0;
  padding: 11px 13px;
  color: #5e5030;
  background: rgba(201, 169, 97, .11);
  border-left: 3px solid var(--gold);
  font-size: 13px;
}

.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;
}

@media (max-width: 640px) {
  body { padding: 24px 12px 40px; }

  .paper {
    padding: 32px 22px 36px;
  }

  .paper::before { inset: 10px; }

  .hero { margin-bottom: 22px; }

  .university-brand {
    width: min(100%, 196px);
    margin-bottom: 22px;
  }

  h1 {
    font-size: 28px;
    letter-spacing: 3px;
  }

  .form-title {
    margin-bottom: 15px;
    font-size: 17px;
    letter-spacing: 3px;
  }

  .sub {
    font-size: 15px;
    letter-spacing: .8px;
  }

  .grid { grid-template-columns: 1fr; }

  .email-row { grid-template-columns: minmax(0, 1fr) 112px; }

  .code-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .email-row .button-secondary {
    width: 112px;
    min-width: 112px;
    padding-inline: 8px;
  }

  textarea { min-height: 180px; }

  .state-card,
  .success-card { padding: 28px 20px; }
}

@media (max-width: 390px) {
  body { padding: 14px 8px 30px; }

  .paper {
    padding: 28px 18px 34px;
  }

  .paper::before { inset: 7px; }

  .hero { margin-bottom: 20px; }

  .university-brand {
    width: min(100%, 184px);
    margin-bottom: 20px;
  }

  h1 { font-size: 27px; }

  .deadline { font-size: 12px; }

  .section-heading h2 { font-size: 18px; }

  .reason-help {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }

  .verified-state {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .verified-state .button-link {
    grid-column: 2;
    justify-self: start;
    margin-left: -7px;
  }

}

@media (max-width: 330px) {
  .email-row {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
  }
  .email-row input {
    padding-inline: 10px;
    font-size: 14px;
  }
  .email-row .button-secondary {
    width: 96px;
    min-width: 96px;
    font-size: 13px;
  }
  .paper { padding-inline: 16px; }
  .university-brand { width: 174px; }
  h1 { font-size: 24px; }
  .form-title { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
