:root {
  color-scheme: light;
  --wine: #681411;
  --red: #a9211d;
  --bright-red: #ca3029;
  --cream: #fff7e5;
  --paper: #fffdf7;
  --ink: #281814;
  --muted: #785d54;
  --gold: #e2ad3d;
  --gold-light: #ffe29a;
  --line: rgba(104, 20, 17, 0.14);
  --row-height: clamp(1.75rem, calc((100svh - 10.25rem) / 21), 2.65rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-width: 20rem;
  min-height: 100svh;
  overflow: hidden;
  background: #160b09;
  color: var(--ink);
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 0.2rem solid #fff;
  outline-offset: 0.2rem;
  box-shadow: 0 0 0 0.42rem rgba(202, 48, 41, 0.8);
}

[hidden] {
  display: none !important;
}

.presentation,
.password-stage,
.intro-stage,
.results-stage {
  min-height: 100svh;
}

.password-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 5.5rem, rgba(226, 173, 61, 0.1) 5.6rem 5.75rem, transparent 5.85rem 9rem, rgba(226, 173, 61, 0.07) 9.1rem 9.25rem, transparent 9.35rem),
    radial-gradient(circle at 50% 30%, rgba(169, 33, 29, 0.32), transparent 42%),
    linear-gradient(145deg, #210b09, #5a120f 56%, #210b09);
  opacity: 1;
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.password-stage::before,
.password-stage::after {
  position: absolute;
  width: 19rem;
  height: 19rem;
  border: 1px solid rgba(255, 226, 154, 0.12);
  border-radius: 50%;
  content: "";
}

.password-stage::before {
  top: -8rem;
  left: -7rem;
}

.password-stage::after {
  right: -7rem;
  bottom: -8rem;
}

.password-stage.is-leaving {
  opacity: 0;
  transform: scale(1.025);
  pointer-events: none;
}

.password-card {
  position: relative;
  z-index: 1;
  width: min(100%, 29rem);
  padding: clamp(2rem, 5vw, 3.3rem);
  border: 1px solid rgba(255, 226, 154, 0.34);
  border-radius: 1.5rem;
  background: linear-gradient(145deg, rgba(255, 253, 247, 0.98), rgba(248, 235, 211, 0.96));
  box-shadow: 0 2rem 6rem rgba(12, 2, 1, 0.42), inset 0 1px rgba(255, 255, 255, 0.8);
  text-align: center;
}

.target-emblem {
  display: grid;
  place-items: center;
  width: 4.3rem;
  height: 4.3rem;
  margin: 0 auto 1.25rem;
  border: 0.32rem solid var(--wine);
  border-radius: 50%;
  background: radial-gradient(circle, var(--wine) 0 0.38rem, var(--cream) 0.42rem 0.82rem, var(--wine) 0.86rem 1.18rem, var(--cream) 1.22rem 1.55rem, var(--wine) 1.59rem);
  box-shadow: 0 0.7rem 1.8rem rgba(104, 20, 17, 0.2);
}

.target-emblem span {
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 50%;
  background: var(--gold-light);
}

.password-kicker {
  margin: 0 0 0.45rem;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.password-title {
  margin: 0;
  color: var(--wine);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.password-copy {
  margin: 1rem auto 1.5rem;
  color: var(--muted);
  line-height: 1.55;
}

.password-form {
  text-align: left;
}

.password-form label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.password-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
}

.password-entry input,
.password-entry button {
  min-height: 3.3rem;
  border-radius: 0.72rem;
  font: inherit;
}

.password-entry input {
  min-width: 0;
  padding: 0 1rem;
  border: 1px solid rgba(104, 20, 17, 0.28);
  background: #fffdf7;
  color: var(--ink);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.2em;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.password-entry input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 0.25rem rgba(169, 33, 29, 0.14);
}

.password-entry input[aria-invalid="true"] {
  border-color: var(--bright-red);
}

.password-entry button {
  padding: 0 1.3rem;
  border: 1px solid var(--wine);
  background: linear-gradient(135deg, var(--red), var(--wine));
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.password-entry button:hover:not(:disabled) {
  box-shadow: 0 0.65rem 1.5rem rgba(104, 20, 17, 0.24);
  transform: translateY(-0.1rem);
}

.password-entry button:disabled {
  cursor: default;
  opacity: 0.65;
}

.password-error {
  margin: 0.65rem 0 0;
  color: var(--bright-red);
  font-size: 0.82rem;
  font-weight: 750;
}

.password-form.is-invalid {
  animation: password-shake 360ms ease;
}

@keyframes password-shake {
  25%, 75% {
    transform: translateX(-0.35rem);
  }
  50% {
    transform: translateX(0.35rem);
  }
}

.intro-stage {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(226, 173, 61, 0.12), transparent 56%),
    #120807;
  opacity: 1;
  transition: opacity 2000ms ease, transform 2000ms cubic-bezier(0.22, 1, 0.36, 1);
}

.intro-stage.is-leaving {
  opacity: 0;
  transform: scale(1.025);
  pointer-events: none;
}

.intro-trigger {
  position: relative;
  width: 100vw;
  height: 100svh;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.intro-trigger::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  box-shadow: inset 0 0 5rem rgba(20, 5, 3, 0.24);
}

.intro-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.start-hint {
  position: absolute;
  right: clamp(1rem, 3vw, 3rem);
  bottom: clamp(1rem, 3vw, 2.4rem);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  background: rgba(40, 17, 13, 0.74);
  color: #fffaf0;
  font-size: clamp(0.78rem, 1.2vw, 1rem);
  font-weight: 750;
  letter-spacing: 0.035em;
  box-shadow: 0 0.75rem 2.3rem rgba(29, 7, 4, 0.28);
  backdrop-filter: blur(0.5rem);
}

.start-hint__dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 0 0 rgba(255, 226, 154, 0.68);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  60% {
    box-shadow: 0 0 0 0.65rem rgba(255, 226, 154, 0);
  }
}

.results-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(0.48rem, 1vh, 0.8rem);
  padding: clamp(0.7rem, 1.6vh, 1.15rem) clamp(0.8rem, 2.2vw, 2.2rem) clamp(0.8rem, 1.8vh, 1.3rem);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 92% 8%, transparent 0 2.4rem, rgba(104, 20, 17, 0.04) 2.45rem 2.6rem, transparent 2.65rem 4.3rem, rgba(104, 20, 17, 0.035) 4.35rem 4.5rem, transparent 4.55rem),
    radial-gradient(circle at 4% 93%, rgba(226, 173, 61, 0.15), transparent 25%),
    linear-gradient(135deg, #fff9eb 0%, #f7ead3 100%);
  opacity: 0;
  animation: stage-in 500ms ease forwards;
}

.results-stage::before {
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 0.34rem;
  content: "";
  background: linear-gradient(90deg, var(--wine), var(--gold), var(--bright-red), var(--gold), var(--wine));
}

@keyframes stage-in {
  to {
    opacity: 1;
  }
}

.results-header {
  display: grid;
  grid-template-columns: minmax(17rem, 1fr) minmax(12rem, auto) minmax(17rem, 1fr);
  align-items: center;
  gap: 1rem;
  min-height: clamp(3.65rem, 7.8vh, 5.1rem);
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.05rem;
  color: var(--red);
  font-size: clamp(0.62rem, 0.78vw, 0.78rem);
  font-weight: 850;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--wine);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 2.75vw, 2.75rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.round-status {
  margin: 0;
  padding: 0.58rem 1rem;
  border: 1px solid rgba(104, 20, 17, 0.15);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.72);
  color: var(--muted);
  font-size: clamp(0.72rem, 0.98vw, 0.92rem);
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 0.35rem 1.4rem rgba(72, 31, 18, 0.08);
}

.controls {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.parity-controls {
  display: flex;
  gap: clamp(0.4rem, 0.8vw, 0.7rem);
  transition: opacity 300ms ease, transform 300ms ease;
}

.parity-controls.is-leaving {
  opacity: 0;
  transform: translateY(-0.45rem);
  pointer-events: none;
}

.choice-button,
.winner-button {
  min-width: clamp(6.5rem, 8.8vw, 8.7rem);
  min-height: clamp(2.55rem, 5.3vh, 3.5rem);
  padding: 0.58rem 1.1rem;
  border: 1px solid rgba(104, 20, 17, 0.26);
  border-radius: 0.72rem;
  color: var(--wine);
  font-size: clamp(0.82rem, 1.08vw, 1.04rem);
  font-weight: 850;
  letter-spacing: 0.025em;
  cursor: pointer;
  transition: color 220ms ease, background 220ms ease, border-color 220ms ease, box-shadow 220ms ease, opacity 220ms ease, transform 220ms ease;
}

.choice-button {
  background: rgba(255, 253, 247, 0.86);
}

.choice-button:hover:not(:disabled),
.choice-button.is-selected {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 0.5rem 1.4rem rgba(104, 20, 17, 0.2);
  transform: translateY(-0.12rem);
}

.choice-button:disabled {
  cursor: default;
}

.choice-button.is-muted {
  opacity: 0.35;
}

.winner-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border-color: #c48716;
  background: linear-gradient(135deg, #ffdf87, var(--gold));
  color: #3f2306;
  box-shadow: 0 0.55rem 1.5rem rgba(136, 83, 8, 0.22);
  opacity: 0;
  transform: translateY(0.4rem) scale(0.96);
}

.winner-button.is-visible {
  opacity: 1;
  transform: none;
}

.winner-button:hover:not(:disabled) {
  box-shadow: 0 0.7rem 1.8rem rgba(136, 83, 8, 0.34);
  transform: translateY(-0.12rem);
}

.winner-button:disabled {
  cursor: default;
}

.table-shell {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(104, 20, 17, 0.16);
  border-radius: clamp(0.65rem, 1.3vw, 1.05rem);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: 0 0.9rem 3rem rgba(67, 24, 12, 0.13);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.results-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.col-rank {
  width: 6%;
}

.col-name {
  width: 31%;
}

.col-shot {
  width: 8%;
}

.col-total {
  width: 15%;
}

thead {
  background: linear-gradient(100deg, var(--wine), #8d1c18 55%, var(--red));
  color: #fffaf0;
}

th {
  height: var(--row-height);
  padding: 0 0.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  font-size: clamp(0.64rem, 0.86vw, 0.84rem);
  font-weight: 800;
  letter-spacing: 0.035em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

th:nth-child(2) {
  text-align: left;
}

.total-heading {
  color: var(--gold-light);
}

.result-row {
  position: relative;
  height: var(--row-height);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.86);
  will-change: transform, opacity;
}

.result-row:nth-child(even) {
  background: rgba(248, 235, 211, 0.62);
}

.result-row:last-child {
  border-bottom: 0;
}

.result-row.is-prepared {
  opacity: 0;
  transform: translateY(1rem);
}

.result-row.is-entering {
  animation: row-in 1000ms cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay) forwards;
}

@keyframes row-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

td {
  height: var(--row-height);
  padding: 0 0.5rem;
  color: var(--ink);
  font-size: clamp(0.7rem, 1.03vw, 1.03rem);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.rank-cell {
  color: var(--muted);
  font-weight: 850;
}

.name-cell {
  overflow: hidden;
  font-weight: 770;
  text-align: left;
  text-overflow: ellipsis;
}

.name-layout {
  display: flex;
  align-items: center;
  min-width: 0;
}

.name-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.junior-mark {
  flex: 0 0 auto;
  margin-left: 0.38rem;
  color: var(--red);
  font-size: 0.68em;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.winner-mark {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  margin-left: 0.6rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #543207;
  color: #fff2bb;
  font-size: 0.58em;
  font-weight: 900;
  letter-spacing: 0.07em;
  opacity: 0;
  transform: translateX(-0.35rem);
  transition: opacity 350ms ease 300ms, transform 350ms ease 300ms;
}

.score-value,
.total-value {
  display: inline-block;
  transition: opacity 4000ms ease, filter 4000ms ease, transform 4000ms cubic-bezier(0.22, 1, 0.36, 1), color 700ms ease;
}

.score-cell.is-counted .score-value {
  color: var(--wine);
  font-weight: 900;
}

.score-cell.is-discarded .score-value {
  opacity: 0;
  filter: blur(0.3rem);
  transform: scale(0.45);
}

.total-cell {
  border-left: 1px solid rgba(104, 20, 17, 0.12);
  color: var(--wine);
  font-weight: 900;
}

.total-cell.is-concealed .total-value {
  opacity: 0;
  filter: blur(0.32rem);
  transform: translateY(0.25rem) scale(0.8);
}

.total-cell.is-final .total-value {
  animation: total-pop 1800ms cubic-bezier(0.16, 1, 0.3, 1) calc(700ms + var(--final-index) * 70ms) both;
}

.overall-tiebreak {
  margin-left: 0.16rem;
  color: var(--muted);
  font-size: 0.72em;
  font-weight: 650;
}

.result-row.is-winner .overall-tiebreak {
  color: #7b4304;
}

@keyframes total-pop {
  from {
    opacity: 0;
    filter: blur(0.25rem);
    transform: translateY(0.5rem) scale(0.76);
  }
  to {
    opacity: 1;
    filter: none;
    transform: none;
  }
}

.result-row.is-winner {
  z-index: 1;
  background: linear-gradient(90deg, #ffe9a6, #fff8d9 52%, #ffe9b7 76%, #efbd4d);
  box-shadow: inset 0.28rem 0 var(--gold), 0 0.38rem 1rem rgba(119, 75, 10, 0.2);
  animation: winner-glow 1600ms ease both;
}

@keyframes winner-glow {
  from {
    filter: saturate(0.7);
    box-shadow: inset 0 0 var(--gold), 0 0 0 rgba(119, 75, 10, 0);
  }
}

.result-row.is-winner .rank-cell,
.result-row.is-winner .total-cell {
  color: #7b4304;
}

.result-row.is-winner .winner-mark {
  opacity: 1;
  transform: none;
}

@media (max-width: 72rem) {
  .wide-label {
    display: none;
  }
}

@media (max-width: 56rem), (max-aspect-ratio: 4 / 3) {
  body {
    overflow: auto;
  }

  .intro-image {
    object-fit: contain;
  }

  .results-stage {
    min-width: 47rem;
  }

  .results-header {
    grid-template-columns: minmax(15rem, 1fr) auto minmax(14rem, 1fr);
  }

  .table-shell {
    overflow: auto;
  }
}

@media (max-height: 43.75rem) {
  body {
    overflow: auto;
  }

  .results-stage {
    min-height: 43.75rem;
  }

  .table-shell {
    overflow: auto;
  }
}

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