:root {
  color-scheme: light;
  --ink: #18231f;
  --muted: #647069;
  --paper: #f3ecd9;
  --paper-2: #fffaf0;
  --line: #c9bfa6;
  --green: #173d32;
  --green-2: #245a48;
  --felt: #0e3027;
  --orange: #d85f32;
  --yellow: #f2c75c;
  --red: #a54235;
  --shadow: 0 18px 48px rgba(19, 38, 31, 0.16);
  font-family: Inter, "BIZ UDPGothic", "Yu Gothic UI", "Yu Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.68), transparent 28rem),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(60, 52, 38, 0.025) 48px), var(--paper);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  align-items: center;
  display: flex;
  height: 72px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1240px;
  padding: 0 28px;
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 16px;
  font-weight: 800;
  gap: 10px;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--orange);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  color: white;
  display: inline-flex;
  font-family: serif;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  transform: rotate(-3deg);
  width: 30px;
}

.brand-mark.large {
  font-size: 34px;
  height: 72px;
  width: 72px;
}

.site-header nav {
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 24px;
}

.site-header nav a {
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

main {
  min-height: calc(100vh - 156px);
}

footer {
  align-items: center;
  border-top: 1px solid rgba(60, 54, 41, 0.18);
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 24px;
  justify-content: center;
  min-height: 84px;
  padding: 24px;
}

.hero {
  display: grid;
  grid-template-columns: 130px minmax(280px, 0.8fr) minmax(420px, 1.2fr);
  margin: 30px auto 0;
  max-width: 1240px;
  min-height: 570px;
  padding: 54px 28px 76px;
  position: relative;
}

.hero::before {
  background: var(--felt);
  border-radius: 32px 5px 32px 5px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    var(--shadow);
  content: "";
  inset: 0 18px 26px 68px;
  position: absolute;
  transform: rotate(-0.5deg);
}

.hero-copy,
.pairing-board,
.round-dial {
  position: relative;
  z-index: 1;
}

.hero-copy {
  align-self: center;
  color: white;
  padding: 0 38px 0 20px;
}

.eyebrow {
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.15em;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.hero-copy .eyebrow {
  color: var(--yellow);
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(25px, 2.6vw, 32px);
  line-height: 1.25;
  margin: 0;
}

.hero-copy > p:not(.eyebrow) {
  color: #d8e3dd;
  font-size: 15px;
  line-height: 1.9;
  margin: 22px 0 30px;
  max-width: 32rem;
}

.round-dial {
  align-items: center;
  align-self: start;
  aspect-ratio: 1;
  background:
    radial-gradient(circle, #fff8e7 0 52%, transparent 53%),
    conic-gradient(var(--orange) 0 69%, #b5a989 69% 100%);
  border: 5px solid var(--paper-2);
  border-radius: 50%;
  box-shadow:
    0 0 0 2px var(--ink),
    8px 9px 0 rgba(7, 19, 15, 0.35);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  height: 118px;
  justify-content: center;
  margin-top: -18px;
  text-align: center;
  transform: rotate(-6deg);
}

.round-dial span,
.round-dial small {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.round-dial strong {
  font-family: Georgia, serif;
  font-size: 48px;
  line-height: 0.92;
}

.round-dial.small {
  height: 92px;
  margin: 0;
}

.round-dial.small strong {
  font-size: 36px;
}

.primary {
  background: var(--orange);
  border: 2px solid #fba37c;
  border-radius: 3px;
  box-shadow: 5px 5px 0 #071b15;
  color: #fff;
  font-weight: 900;
  min-height: 48px;
  padding: 10px 22px;
}

.primary:hover {
  background: #eb6a39;
  transform: translateY(-1px);
}

.primary:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.pairing-board {
  align-self: center;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(44, 36, 24, 0.05) 50%, transparent 50.2%),
    var(--paper-2);
  border: 1px solid #d4c8ab;
  box-shadow:
    12px 16px 0 #09271f,
    0 0 0 7px #e3d5b6;
  margin: 0 16px;
  padding: 18px 18px 24px;
  transform: rotate(1deg);
}

.board-top {
  align-items: center;
  border-bottom: 2px solid var(--ink);
  display: flex;
  font-size: 11px;
  font-weight: 900;
  justify-content: space-between;
  letter-spacing: 0.11em;
  margin: 0 2px 15px;
  padding: 0 0 10px;
}

.table-slip {
  align-items: center;
  background: white;
  border: 1px solid #d7cfbd;
  box-shadow: 2px 3px 0 rgba(43, 37, 26, 0.14);
  display: grid;
  gap: 8px;
  grid-template-columns: 42px 1fr 28px 1fr 94px;
  margin: 10px 0;
  min-height: 80px;
  padding: 9px;
  position: relative;
}

.table-number {
  align-items: center;
  background: var(--green);
  border-radius: 50%;
  color: white;
  display: inline-flex;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.player-card {
  border-bottom: 2px solid var(--ink);
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  padding: 9px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.versus {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.result-stamps {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.result-stamps i {
  align-items: center;
  border: 1px dashed #b1a790;
  border-radius: 50%;
  color: #8f836e;
  display: inline-flex;
  font-size: 10px;
  font-style: normal;
  height: 25px;
  justify-content: center;
  width: 25px;
}

.result-stamps i:first-child {
  border-color: var(--red);
  color: var(--red);
  transform: rotate(-8deg);
}

.flow-strip {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(4, 1fr);
  margin: -38px auto 80px;
  max-width: 1080px;
  position: relative;
  z-index: 2;
}

.flow-strip > div {
  align-items: center;
  background: var(--paper-2);
  border: 1px solid var(--line);
  display: grid;
  gap: 1px 10px;
  grid-template-columns: 30px 1fr;
  min-height: 78px;
  padding: 14px;
}

.flow-strip b {
  color: var(--orange);
  font-family: Georgia, serif;
  font-size: 20px;
  grid-row: span 2;
}

.flow-strip span {
  font-size: 14px;
  font-weight: 900;
}

.flow-strip small {
  color: var(--muted);
  font-size: 10px;
}

dialog {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  box-shadow: 10px 12px 0 rgba(10, 32, 24, 0.55);
  color: var(--ink);
  max-height: calc(100vh - 32px);
  max-width: 720px;
  padding: 0;
  width: calc(100% - 32px);
}

dialog::backdrop {
  backdrop-filter: blur(4px);
  background: rgba(5, 28, 21, 0.72);
}

dialog form {
  padding: 26px;
}

.dialog-head {
  align-items: start;
  border-bottom: 2px solid var(--ink);
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 16px;
}

.dialog-head h2 {
  font-size: 24px;
  margin: 0;
}

.icon-button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 22px;
  height: 38px;
  width: 38px;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}

label {
  color: #3c4742;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 7px;
}

label.wide,
.wide-button {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  background: white;
  border: 1px solid #a99e86;
  border-radius: 2px;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 11px;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

.form-note,
.capability-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.form-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  min-height: 1.5em;
}

.trap {
  left: -9999px;
  position: absolute;
}

.board-page {
  margin: 0 auto;
  max-width: 1080px;
  padding: 34px 28px 80px;
}

.board-loading {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: center;
  min-height: 55vh;
}

.event-heading {
  align-items: center;
  border-bottom: 3px solid var(--ink);
  display: flex;
  justify-content: space-between;
  padding: 18px 0 24px;
}

.event-heading h1 {
  font-size: clamp(23px, 3.5vw, 30px);
}

.event-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 10px 24px;
  margin: 10px 0 0;
}

.status-badge {
  background: var(--green);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  color: white;
  font-size: 12px;
  font-weight: 900;
  padding: 8px 13px;
  transform: rotate(2deg);
}

.mode-card {
  align-items: center;
  background: var(--paper-2);
  border: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 24px 0;
  padding: 18px;
}

.mode-card strong {
  display: block;
  font-size: 16px;
}

.mode-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 5px 0 0;
}

.mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-end;
}

.secondary,
.danger,
.result-button {
  background: white;
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  min-height: 42px;
  padding: 8px 14px;
}

.danger {
  border-color: var(--red);
  color: var(--red);
}

.registration-form {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) auto;
}

.registration-form .form-error {
  grid-column: 1 / -1;
  margin: 0;
}

.board-alert {
  background: #fff0c9;
  border: 1px solid #c99528;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
  margin-top: 18px;
  padding: 12px 14px;
}

.tab-row {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
  margin-top: 30px;
}

.tab {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  padding: 12px 18px;
}

.tab.active {
  border-color: var(--orange);
  color: var(--ink);
}

.tab-panel {
  padding-top: 20px;
}

.round-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.round-heading h2 {
  font-size: 18px;
  margin: 0;
}

.round-heading span {
  color: var(--muted);
  font-size: 11px;
}

.board-table-list {
  display: grid;
  gap: 12px;
}

.board-table-list .table-slip {
  grid-template-columns: 46px minmax(0, 1fr) 28px minmax(0, 1fr) 104px;
  margin: 0;
}

.match-status {
  align-items: center;
  background: #eee8d8;
  color: var(--muted);
  display: inline-flex;
  font-size: 10px;
  font-weight: 900;
  justify-content: center;
  min-height: 28px;
  padding: 5px 8px;
  text-align: center;
}

.match-status.confirmed {
  background: #dceadf;
  color: var(--green);
}

.match-status.disputed {
  background: #f6d8cf;
  color: var(--red);
}

.resolve-row,
.report-row {
  background: white;
  border: 1px solid var(--line);
  border-top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin: -12px 8px 12px;
  padding: 12px;
}

.result-button.win {
  background: var(--green);
  color: white;
}

.result-button.draw {
  background: var(--yellow);
}

.standings {
  border-collapse: collapse;
  width: 100%;
}

.standings th,
.standings td {
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  padding: 12px 8px;
  text-align: center;
}

.standings th {
  color: var(--muted);
  font-size: 10px;
}

.standings td:nth-child(2),
.standings th:nth-child(2) {
  text-align: left;
}

.standings .rank {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 900;
}

.player-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
}

.player-chip {
  align-items: center;
  background: var(--paper-2);
  border: 1px solid var(--line);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 9px;
  min-height: 46px;
  padding: 9px 12px;
}

.player-chip i {
  background: #b2aa97;
  border-radius: 50%;
  height: 9px;
  width: 9px;
}

.player-chip.checked i {
  background: #35a86f;
  box-shadow: 0 0 0 3px #d9f1e4;
}

.player-chip.dropped {
  color: var(--muted);
  text-decoration: line-through;
}

.empty-board {
  align-items: center;
  border: 1px dashed var(--line);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 10px;
  justify-content: center;
  min-height: 180px;
  padding: 24px;
  text-align: center;
}

.empty-board b {
  color: var(--ink);
  font-size: 18px;
}

.capability-note {
  margin-top: 24px;
  text-align: center;
}

.info-page {
  margin: 0 auto;
  max-width: 980px;
  padding: 68px 28px 100px;
}

.info-heading {
  align-items: center;
  display: flex;
  gap: 28px;
  margin-bottom: 50px;
}

.guide-cards {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-cards li {
  align-items: start;
  background: var(--paper-2);
  border: 1px solid var(--line);
  display: grid;
  gap: 20px;
  grid-template-columns: 52px 1fr;
  padding: 22px;
}

.guide-cards b {
  color: var(--orange);
  font-family: Georgia, serif;
  font-size: 26px;
}

.guide-cards h2,
.rule-card h2,
.data-card h2 {
  font-size: 17px;
  margin: 0 0 8px;
}

.guide-cards p,
.rule-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  margin: 0;
}

.rule-card {
  background: var(--green);
  color: white;
  margin-top: 30px;
  padding: 28px;
}

.rule-card p {
  color: #d1e2da;
}

.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 18px 0;
}

.score-row b {
  color: var(--yellow);
}

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

.data-card {
  border: 1px solid var(--line);
  min-height: 250px;
  padding: 28px;
}

.data-card.keep {
  background: var(--green);
  color: white;
}

.data-card.never {
  background: var(--paper-2);
}

.data-card ul {
  display: grid;
  font-size: 13px;
  gap: 14px;
  line-height: 1.5;
  margin: 24px 0 0;
  padding-left: 20px;
}

.retention-note {
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
  margin-top: 30px;
  padding-top: 24px;
}

.not-found {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 25px;
  justify-content: center;
  min-height: calc(100vh - 156px);
  padding: 30px;
  text-align: center;
}

.button-link {
  display: inline-flex;
  text-decoration: none;
}

@media print {
  .site-header,
  footer,
  .mode-card,
  .tab-row,
  .capability-note,
  .board-alert {
    display: none !important;
  }

  body {
    background: white;
  }

  .board-page {
    max-width: none;
    padding: 0;
  }

  .tab-panel[hidden] {
    display: none !important;
  }

  .table-slip {
    break-inside: avoid;
    box-shadow: none;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 90px 1fr;
    padding-top: 42px;
  }

  .hero::before {
    inset-left: 46px;
  }

  .pairing-board {
    grid-column: 1 / -1;
    margin: 55px 40px 0 70px;
  }

  .flow-strip {
    grid-template-columns: repeat(2, 1fr);
    margin: 20px 28px 70px;
  }
}

@media (max-width: 640px) {
  .site-header {
    height: 62px;
    padding: 0 18px;
  }

  .site-header nav {
    gap: 14px;
  }

  .site-header nav a:first-child {
    display: none;
  }

  .hero {
    display: block;
    margin: 8px 0 0;
    padding: 45px 24px 48px;
  }

  .hero::before {
    border-radius: 0;
    inset: 0;
    transform: none;
  }

  .round-dial {
    height: 82px;
    margin: -18px 0 20px;
  }

  .round-dial strong {
    font-size: 34px;
  }

  .hero-copy {
    padding: 0;
  }

  .pairing-board {
    box-shadow: 6px 7px 0 #09271f;
    margin: 46px 0 0;
    padding: 12px;
    transform: rotate(0.3deg);
  }

  .pairing-board .table-slip:nth-of-type(4) {
    display: none;
  }

  .table-slip,
  .board-table-list .table-slip {
    gap: 5px;
    grid-template-columns: 35px minmax(0, 1fr) 18px minmax(0, 1fr) 60px;
    min-height: 68px;
    padding: 7px;
  }

  .table-number {
    font-size: 16px;
    height: 30px;
    width: 30px;
  }

  .player-card {
    font-size: 11px;
    padding: 7px 3px;
  }

  .result-stamps {
    gap: 2px;
  }

  .result-stamps i {
    font-size: 8px;
    height: 18px;
    width: 18px;
  }

  .flow-strip {
    display: grid;
    grid-template-columns: 1fr;
    margin: 18px 16px 55px;
  }

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

  label.wide,
  .wide-button {
    grid-column: auto;
  }

  dialog form {
    padding: 18px;
  }

  .board-page,
  .info-page {
    padding: 24px 16px 60px;
  }

  .event-heading {
    align-items: flex-start;
    gap: 18px;
  }

  .status-badge {
    flex: none;
  }

  .mode-card {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-actions {
    justify-content: stretch;
  }

  .mode-actions button {
    flex: 1;
  }

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

  .tab {
    flex: 1;
    padding-left: 8px;
    padding-right: 8px;
  }

  .match-status {
    font-size: 8px;
    padding: 3px;
  }

  .player-grid,
  .data-grid {
    grid-template-columns: 1fr;
  }

  .info-heading {
    align-items: flex-start;
    margin-bottom: 36px;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
