:root {
  color-scheme: light;
  font-family: ui-rounded, "Avenir Next", Avenir, system-ui, sans-serif;
  color: #262626;
  background: #f8f7f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #272727;
  --muted: #676763;
  --paper: #f8f7f4;
  --face: #ffffff;
  --lip: #2a2a2a;
  --line: #5a5a5a;
  --accent: #d6f25b;
  --arena-green: #26a85f;
  --arena-green-lip: #126238;
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  width: min(100% - 40px, 1080px);
  margin-inline: auto;
  padding: 22px 0 max(20px, env(safe-area-inset-bottom));
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
}

.wordmark {
  color: var(--ink);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.06em;
  text-decoration: none;
}

.wordmark span {
  color: #77776f;
}

.header-note,
.site-footer {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.game-view,
.results-view {
  width: 100%;
  margin: auto 0;
  padding: 32px 0 36px;
  animation: settle-in 180ms var(--ease-out) both;
}

.round-heading {
  width: min(100%, 620px);
  margin: 0 auto 24px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: #555550;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  margin: 0 auto 23px;
  border-radius: 999px;
  background: #e3e1da;
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms var(--ease-spring);
}

h1 {
  margin: 0;
  font-size: clamp(25px, 4vw, 38px);
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.supporting-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.choices {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  width: min(100%, 920px);
  margin: 0 auto;
}

.photo-choice {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  height: calc(clamp(280px, 36vw, 420px) + 6px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.photo-choice:disabled {
  cursor: progress;
}

.photo-choice__lip,
.photo-choice__face {
  position: absolute;
  border-radius: 17px;
}

.photo-choice__lip {
  z-index: 0;
  inset: 6px 0 0;
  background: var(--lip);
  transition: transform 110ms ease-out;
}

.photo-choice__face {
  z-index: 1;
  inset: 0 0 6px;
  display: block;
  overflow: hidden;
  border: 3px solid var(--line);
  background: #e8e6df;
  transform: translateY(0);
  transition:
    border-color 120ms ease-out,
    transform 110ms var(--ease-out);
}

.photo-choice__backdrop {
  display: none;
}

.photo-choice__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: linear-gradient(145deg, #dad8d0, #eeece5 48%, #cfcec7);
}

.photo-choice:hover:not(:disabled) .photo-choice__face {
  border-color: #333333;
  transform: translateY(-3px);
}

.photo-choice:active:not(:disabled) .photo-choice__face,
.photo-choice.is-selected .photo-choice__face {
  border-color: var(--accent);
  transform: translateY(4px);
}

.photo-choice:active:not(:disabled) .photo-choice__lip,
.photo-choice.is-selected .photo-choice__lip {
  transform: none;
}

.photo-choice:focus-visible {
  outline: 4px solid #52660f;
  outline-offset: 8px;
}

.message-view,
.results-view {
  text-align: center;
}

.message-view {
  margin: auto;
  padding: 48px 0;
  color: var(--muted);
}

.message-view h1 {
  color: var(--ink);
}

.loading-mark {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 14px;
  border: 3px solid #deddd6;
  border-top-color: #555550;
  border-radius: 50%;
  animation: turn 700ms linear infinite;
}

.action-button {
  position: relative;
  min-height: 58px;
  padding: 14px 26px 18px;
  border: 0;
  border-radius: 999px;
  background: #505050;
  color: #ffffff;
  font-size: 19px;
  font-weight: 850;
  letter-spacing: -0.015em;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--lip);
  transition:
    transform 100ms ease-out,
    background-color 120ms ease-out,
    box-shadow 100ms ease-out;
}

.action-button:hover {
  background: #5a5a5a;
}

.action-button:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--lip);
}

.action-button:focus-visible {
  outline: 4px solid #52660f;
  outline-offset: 5px;
}

.ranking-list {
  display: grid;
  gap: 10px;
  width: min(100%, 620px);
  margin: 28px auto;
  padding: 0;
  list-style: none;
  text-align: left;
}

.ranking-row {
  display: grid;
  grid-template-columns: 34px 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 8px 14px;
  border: 2px solid #d8d6ce;
  border-radius: 16px;
  background: var(--face);
}

.ranking-rank {
  font-size: 18px;
  font-weight: 850;
  text-align: center;
}

.ranking-thumb {
  width: 72px;
  height: 68px;
  border: 2px solid #666660;
  border-radius: 10px;
  object-fit: cover;
}

.ranking-score {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.play-again {
  width: min(100%, 420px);
}

.site-footer {
  padding-top: 10px;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  clip-path: inset(50%);
}

@keyframes settle-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 28px, 520px);
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .header-note {
    max-width: 130px;
    text-align: right;
  }

  .game-view,
  .results-view {
    padding-block: 20px 25px;
  }

  .round-heading {
    margin-bottom: 18px;
  }

  .progress-track {
    margin-bottom: 18px;
  }

  .choices {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
    width: min(100%, 440px);
  }

  .photo-choice__image {
    height: clamp(145px, 27svh, 235px);
  }

  .photo-choice {
    height: calc(clamp(145px, 27svh, 235px) + 6px);
  }

  .action-button {
    width: 100%;
    min-height: 60px;
    font-size: 23px;
  }
}

@media (max-height: 700px) and (max-width: 680px) {
  .game-view,
  .results-view {
    padding-block: 13px;
  }

  .round-heading {
    margin-bottom: 12px;
  }

  .photo-choice__image {
    height: clamp(125px, 25svh, 180px);
  }

  .photo-choice {
    height: calc(clamp(125px, 25svh, 180px) + 6px);
  }
}

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

  .game-view,
  .results-view {
    animation-name: none;
  }

  .photo-choice:hover:not(:disabled) .photo-choice__face,
  .photo-choice:hover:not(:disabled) .photo-choice__lip,
  .photo-choice:active:not(:disabled) .photo-choice__face,
  .photo-choice:active:not(:disabled) .photo-choice__lip,
  .photo-choice.is-selected .photo-choice__face,
  .photo-choice.is-selected .photo-choice__lip {
    transform: none;
  }
}

.welcome-view {
  width: min(100%, 680px);
  margin: auto;
  padding: 32px 18px;
  text-align: center;
  animation: settle-in 180ms var(--ease-out) both;
}

.welcome-view .supporting-copy {
  margin: 14px auto 34px;
  font-size: 17px;
}

.start-button {
  min-width: 230px;
  min-height: 64px;
  background: var(--arena-green);
  box-shadow: 0 6px 0 var(--arena-green-lip);
  font-size: 22px;
}

.start-button:hover {
  background: #218e52;
}

.start-button:active {
  box-shadow: 0 1px 0 var(--arena-green-lip);
}

body.arena-active {
  overflow: hidden;
  background: #101110;
}

body.arena-active .app-shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  overflow: hidden;
}

body.arena-active .site-header,
body.arena-active .site-footer {
  display: none;
}

body.arena-active .game-view {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  margin: 0;
  padding: 0;
  animation: none;
}

body.arena-active .round-heading {
  width: 100%;
  flex: 0 0 auto;
  margin: 0;
}

body.arena-active .progress-track {
  height: 6px;
  margin: 0;
  border-radius: 0;
  background: #414541;
}

body.arena-active .progress-fill {
  background: #54e68a;
}

body.arena-active .choices {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  background: #101110;
}

body.arena-active .photo-choice {
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  appearance: none;
  background: transparent;
}

body.arena-active .photo-choice__lip {
  display: none;
}

body.arena-active .photo-choice__face {
  inset: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #161816;
  transform: none;
  transition: transform 100ms ease-out, filter 100ms ease-out;
}

body.arena-active .photo-choice__backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(22px) brightness(0.42);
  transform: scale(1.08);
}

body.arena-active .photo-choice__image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

body.arena-active .arena-lightning {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 0;
  display: block;
  width: 100%;
  height: clamp(42px, 11vw, 66px);
  overflow: visible;
  pointer-events: none;
  transform: translateY(-50%);
}

body.arena-active .arena-lightning__ink {
  fill: none;
  stroke: #241822;
  stroke-linecap: round;
  stroke-linejoin: bevel;
  stroke-width: 20px;
}

body.arena-active .arena-lightning__charge {
  fill: none;
  stroke: #f13c49;
  stroke-linecap: round;
  stroke-linejoin: bevel;
  stroke-width: 13px;
}

body.arena-active .arena-lightning__shine {
  fill: none;
  stroke: #ffd5c9;
  stroke-linecap: round;
  stroke-linejoin: bevel;
  stroke-width: 3px;
}

body.arena-active .photo-choice:active:not(:disabled) .photo-choice__face,
body.arena-active .photo-choice.is-selected .photo-choice__face {
  filter: brightness(0.78) saturate(0.92);
  transform: scale(0.985);
}

body.arena-active .photo-choice:focus-visible {
  z-index: 2;
  outline: 4px solid #54e68a;
  outline-offset: -5px;
}

.arena-lightning {
  display: none;
}

.ranking-confetti {
  position: fixed;
  z-index: 20;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

.confetti-piece {
  position: absolute;
  top: -14px;
  display: block;
  width: 8px;
  height: 13px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall var(--confetti-duration) cubic-bezier(0.2, 0.65, 0.4, 1)
    var(--confetti-delay) both;
}

.confetti-piece--dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -4vh, 0) rotate(0deg);
  }

  10% {
    opacity: 1;
  }

  100% {
    opacity: 0.82;
    transform: translate3d(var(--confetti-drift), 108dvh, 0) rotate(var(--confetti-spin));
  }
}

@keyframes confetti-reduced {
  from {
    opacity: 0;
  }

  to {
    opacity: 0.82;
  }
}

body.arena-active .message-view {
  margin: auto;
}

@media (prefers-reduced-motion: reduce) {
  body.arena-active .photo-choice:active:not(:disabled) .photo-choice__face,
  body.arena-active .photo-choice.is-selected .photo-choice__face {
    transform: none;
  }

  .ranking-confetti .confetti-piece {
    animation-name: confetti-reduced;
    animation-duration: 150ms !important;
    animation-delay: 0ms !important;
    transform: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-view,
  .game-view,
  .results-view {
    animation: none;
  }

  .action-button,
  .photo-choice__face,
  .progress-fill {
    transition: none;
  }

  .loading-mark {
    animation: none;
  }
}
.quiet-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.26em;
  cursor: pointer;
}

.quiet-action:focus-visible,
.account-shell input:focus-visible {
  outline: 3px solid var(--arena-green-lip);
  outline-offset: 3px;
}

.account-button {
  background: var(--accent);
  color: var(--ink);
}

.account-button:hover {
  background: #c7e849;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.welcome-actions .action-button {
  margin: 0;
  text-decoration: none;
}

.arena-owner {
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.account-shell {
  width: min(100% - 36px, 640px);
  padding-top: max(18px, env(safe-area-inset-top));
}

.account-sign-in {
  width: min(100%, 420px);
  margin: clamp(36px, 11vh, 100px) auto 0;
}

.account-shell .supporting-copy {
  font-size: 1rem;
}

.credentials-form,
.form-field,
.share-controls,
.upload-panel {
  display: grid;
  gap: 10px;
}

.credentials-form {
  gap: 18px;
  margin-top: 28px;
}

.form-field label {
  font-weight: 750;
}

.form-field small {
  color: var(--muted);
  font-size: 0.9rem;
}

.account-shell input:not([type=file]) {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--face);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.account-shell .action-button {
  min-height: 48px;
  margin: 0;
  justify-content: center;
}

.account-shell button:disabled {
  opacity: 0.58;
  cursor: default;
}

.arena-dashboard {
  margin-top: 40px;
}

.dashboard-heading,
.dashboard-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.publication-state {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 750;
}

.publication-state.is-published {
  border-color: var(--arena-green-lip);
  background: #dcf5e4;
  color: var(--arena-green-lip);
}

.dashboard-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #cbc8bb;
}

.dashboard-section h2 {
  margin: 0;
  font-size: 1.22rem;
}

.photo-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.upload-panel {
  margin: 14px 0 12px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: center;
}

.upload-panel .supporting-copy {
  margin: 0;
}

.owner-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.owner-photos li {
  min-width: 0;
}

.owner-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #e3e1da;
  object-fit: cover;
}

.owner-photos span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.share-section {
  display: grid;
  gap: 12px;
  padding-bottom: 20px;
}

.share-section > .supporting-copy {
  margin: 0;
}

.share-section > .quiet-action {
  justify-self: center;
}

.account-error {
  padding: 12px;
  border-radius: 10px;
  background: #fbe8e3;
  color: #72281d;
  white-space: pre-line;
}

@media (min-width: 580px) {
  .share-controls {
    grid-template-columns: 1fr auto;
  }

  .share-controls .quiet-action {
    justify-self: start;
  }
}
