:root {
  --ink: #071b3f;
  --muted: #617087;
  --line: #d9e0e9;
  --line-strong: #bcc8d7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-blue: #f4f7fb;
  --accent: #071b3f;
  --accent-strong: #03122d;
  --accent-soft: #fff3bf;
  --gold: #fdbb18;
  --gold-soft: #fff8df;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --success: #137333;
  --success-soft: #edf7ef;
  --shadow: 0 18px 50px rgba(21, 43, 68, 0.10);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(253,187,24,.10), transparent 28rem),
    radial-gradient(circle at 100% 0%, rgba(7,27,63,.07), transparent 32rem),
    #f1f4f8;
  color: var(--ink);
}

button, input, select { font: inherit; }

.page-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 32px auto 64px;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.site-header {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 24px;
  align-items: center;
  padding: 34px 38px 30px;
  border-bottom: 4px solid var(--gold);
  background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
}

.logo-placeholder {
  width: 94px;
  height: 94px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
}

.site-logo {
  width: 94px;
  height: 94px;
  display: block;
  object-fit: contain;
}


.eyebrow {
  margin: 0 0 5px;
  color: #9a7000;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .15em;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 3.2vw, 44px);
  line-height: 1.04;
  letter-spacing: -.03em;
}

.intro {
  max-width: 1000px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.intro strong { color: var(--ink); }

form { padding: 0 38px 38px; }

.meet-panel, .submitter-panel {
  background: var(--surface-blue);
  border: 1px solid #d7e0eb;
  box-shadow: inset 4px 0 0 var(--gold);
  border-radius: var(--radius);
  padding: 22px;
}

.meet-panel { margin-top: 30px; }
.submitter-panel { margin-top: 28px; }

h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.01em;
}

.meet-grid, .submitter-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.meet-grid { grid-template-columns: 1fr 1fr minmax(180px,.45fr); }
.submitter-grid { grid-template-columns: 1fr 1fr; }

label { display: grid; gap: 7px; }
label > span { font-size: 13px; font-weight: 750; color: #31445b; }
label b { color: var(--danger); }

input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
  transition: border-color .12s, box-shadow .12s, background-color .12s;
}

input:focus, select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(253,187,24,.18);
}

input.invalid, select.invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.small-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}


.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 32px 0 14px;
}
.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.logic-key {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.logic-key span {
  padding: 6px 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}
.logic-key strong { color: var(--ink); }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.bout-table {
  width: 100%;
  min-width: 1300px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.bout-table th, .bout-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  vertical-align: middle;
}
.bout-table tr:last-child td { border-bottom: 0; }
.bout-table th:last-child, .bout-table td:last-child { border-right: 0; }

.bout-table thead th {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-align: center;
  padding: 9px 7px;
}
.bout-table thead .subhead th {
  background: var(--gold-soft);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
}

.bout-table td:first-child {
  width: 58px;
  text-align: center;
  font-weight: 850;
  background: var(--gold-soft);
  color: var(--ink);
}

.bout-table input, .bout-table select {
  min-height: 38px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 13px;
}

.score-input { text-align: center; font-weight: 800; }
.winner-select { min-width: 170px; }
.result-select { min-width: 108px; font-weight: 800; }

.fall-time-wrap {
  display: grid;
  gap: 3px;
}
.fall-time-wrap[hidden] { display: none !important; }
.fall-help { color: var(--muted); font-size: 9px; text-align: center; }

.row-status {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  line-height: 1.15;
  color: var(--danger);
  min-height: 10px;
}

tr.has-error > td:first-child {
  background: var(--danger-soft);
  color: var(--danger);
}

tr.complete > td:first-child {
  background: var(--success-soft);
  color: var(--success);
}

.review-strip {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--gold-soft);
}
.review-strip strong { display: block; }
.review-strip span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

.primary-button, .secondary-button {
  border: 0;
  border-radius: 9px;
  min-height: 44px;
  padding: 10px 18px;
  font-weight: 800;
  cursor: pointer;
}
.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(7,27,63,.20);
  border-bottom: 3px solid var(--gold);
}
.primary-button:hover { background: var(--accent-strong); }
.secondary-button { background: var(--surface-soft); color: var(--ink); border: 1px solid var(--line); }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  z-index: 20;
}

dialog {
  border: 0;
  padding: 0;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(15, 31, 49, .28);
}
dialog::backdrop { background: rgba(18, 31, 46, .55); }
.dialog-card {
  min-width: min(440px, calc(100vw - 40px));
  padding: 32px;
  text-align: center;
}
.success-mark {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 28px;
  font-weight: 900;
}
.dialog-card p { color: var(--muted); }
.receipt-line strong { color: var(--ink); }
.dialog-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }

@media (max-width: 820px) {
  .page-shell { width: min(100% - 18px, 760px); margin-top: 12px; }
  .site-header { grid-template-columns: 70px 1fr; padding: 22px 18px; gap: 15px; }
  .logo-placeholder { width: 64px; height: 64px; }
  .site-logo { width: 64px; height: 64px; }
  form { padding: 0 14px 22px; }
  .meet-grid, .submitter-grid { grid-template-columns: 1fr; }
  .section-heading, .review-strip { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .table-wrap { overflow: visible; border: 0; }
  .bout-table { min-width: 0; display: block; }
  .bout-table thead { display: none; }
  .bout-table tbody { display: grid; gap: 12px; }
  .bout-table tr {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    background: #fff;
  }
  .bout-table td {
    border: 0 !important;
    padding: 0;
    min-width: 0;
  }
  .bout-table td:first-child {
    grid-column: 1 / -1;
    width: auto;
    padding: 8px 10px;
    border-radius: 8px;
    text-align: left;
  }
  .bout-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin: 0 0 4px;
  }
  .bout-table td:first-child::before { display: none; }
  .winner-cell, .result-cell, .fall-cell { grid-column: span 1; }
  .winner-select, .result-select { min-width: 0; }
}
