:root {
  --visa-blue: #1434cb;
  --visa-navy: #07133f;
  --ink: #11172f;
  --muted: #55607c;
  --line: rgba(20, 52, 203, 0.16);
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --yellow: #ffd441;
  --pink: #f59abb;
  --cyan: #c9f4f6;
  --visa-gradient:
    linear-gradient(
      90deg,
      #ccebf4 0%,
      #b1d9ee 8%,
      #a2b7df 16%,
      #b1b9d8 28%,
      #c4bfcf 40%,
      #dfd1b0 52%,
      #f7e68a 64%,
      #fadb89 76%,
      #fbc1a7 88%,
      #ffa5cc 100%
    );
  font-family: "Visa Dialect", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@font-face {
  font-family: "Visa Dialect";
  src: url("assets/fonts/VisaDialect-Regular-Web.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Visa Dialect";
  src: url("assets/fonts/VisaDialect-Semibold-Web.woff2") format("woff2");
  font-weight: 760;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Visa Dialect";
  src: url("assets/fonts/VisaDialect-Bold-Web.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--visa-gradient);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    var(--screen-background-image, none),
    var(--visa-gradient);
  background-position:
    right top,
    center;
  background-size:
    auto 100vh,
    cover;
  background-repeat: no-repeat;
}

.scoreboard-page {
  --screen-background-image: url("assets/visa-full-background.png");
  --visa-gradient: linear-gradient(90deg, #ccebf4 0%, #ccebf4 100%);
  background-color: #ccebf4;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.brand-art {
  display: none;
}

.screen-layout {
  --screen-pad: clamp(16px, 3.2vmin, 52px);
  display: grid;
  height: 100vh;
  height: 100svh;
  padding: var(--screen-pad);
  align-items: center;
}

.scoreboard {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(820px, 57vw);
  min-width: 560px;
  height: calc(100vh - (var(--screen-pad) * 2));
  height: calc(100svh - (var(--screen-pad) * 2));
  max-height: calc(100vh - (var(--screen-pad) * 2));
  max-height: calc(100svh - (var(--screen-pad) * 2));
}

.screen-title {
  margin: 0 0 clamp(10px, 1.6vmin, 18px);
  color: var(--visa-blue);
  font-size: clamp(44px, 6.2vmin, 104px);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
}

.screen-kicker {
  margin: 0 0 clamp(6px, 1.1vmin, 12px);
  color: var(--visa-navy);
  font-size: clamp(16px, 2vmin, 30px);
  font-weight: 800;
  text-transform: uppercase;
}

.screen-card {
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(7, 19, 63, 0.16);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(58px, 0.34fr) minmax(0, 1.5fr) minmax(150px, 0.72fr);
  gap: clamp(12px, 1.7vmin, 18px);
  align-items: center;
  min-height: 0;
  overflow: hidden;
  padding: clamp(5px, 0.9vmin, 9px) clamp(14px, 2.2vmin, 30px);
  border-bottom: 1px solid var(--line);
  line-height: 1.1;
}

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

.score-row:nth-child(1) {
  background: linear-gradient(90deg, rgba(255, 212, 65, 0.75), rgba(255, 255, 255, 0.48));
}

.score-row:nth-child(2),
.score-row:nth-child(3) {
  background: rgba(255, 255, 255, 0.4);
}

.score-row.last-added {
  background: rgba(255, 255, 255, 0.3);
}

.score-row:nth-child(1).last-added {
  background: linear-gradient(90deg, rgba(255, 212, 65, 0.58), rgba(255, 255, 255, 0.32));
}

.score-row.last-added .player::after {
  content: "";
  display: inline-block;
  width: 0.28em;
  height: 0.28em;
  margin-left: 0.28em;
  border-radius: 50%;
  background: var(--visa-blue);
  vertical-align: 0.2em;
  opacity: 0.42;
}

.score-row.is-updating {
  animation: rowRollIn 900ms ease both;
}

.score-row.has-updated {
  animation: rowGlow 680ms ease both;
}

.rank {
  color: var(--visa-blue);
  font-size: clamp(24px, 4.2vmin, 46px);
  font-weight: 900;
  line-height: 1.14;
}

.player {
  min-width: 0;
  overflow: hidden;
  color: var(--visa-navy);
  font-size: clamp(20px, 3.45vmin, 39px);
  font-weight: 400;
  line-height: 1.24;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.points {
  color: var(--visa-blue);
  font-size: clamp(21px, 3.6vmin, 40px);
  font-weight: 760;
  line-height: 1.18;
  text-align: right;
  white-space: nowrap;
}

.is-updating .player,
.is-updating .points {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

@keyframes rowRollIn {
  0% {
    opacity: 0.46;
    transform: translateY(7px);
    filter: blur(2px);
  }

  48% {
    opacity: 1;
    filter: blur(0);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes rowGlow {
  0% {
    box-shadow: inset 0 0 0 rgba(255, 212, 65, 0);
  }

  35% {
    box-shadow: inset 0 0 34px rgba(255, 212, 65, 0.34);
  }

  100% {
    box-shadow: inset 0 0 0 rgba(255, 212, 65, 0);
  }
}

.empty-state {
  padding: 44px 28px;
  color: var(--visa-navy);
  font-size: clamp(24px, 3vw, 42px);
  font-weight: 850;
  text-align: center;
}

.admin-body {
  min-height: 100vh;
  padding: 22px;
}

.admin-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.admin-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 6px;
}

.admin-header h1 {
  margin: 0;
  color: var(--visa-blue);
  font-size: clamp(34px, 6vw, 64px);
  line-height: 0.96;
  letter-spacing: 0;
}

.admin-header p {
  margin: 8px 0 0;
  color: var(--visa-navy);
  font-weight: 760;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 18px 55px rgba(7, 19, 63, 0.14);
  backdrop-filter: blur(16px);
}

.panel-section {
  padding: 18px;
}

.panel-title {
  margin: 0 0 14px;
  color: var(--visa-navy);
  font-size: 19px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(20, 52, 203, 0.22);
  border-radius: 6px;
  padding: 11px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  outline: 0;
}

.field input:focus {
  border-color: var(--visa-blue);
  box-shadow: 0 0 0 3px rgba(20, 52, 203, 0.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  min-height: 46px;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--visa-blue);
  color: #fff;
  font-weight: 850;
}

.btn.secondary {
  border: 1px solid rgba(20, 52, 203, 0.26);
  background: rgba(255, 255, 255, 0.72);
  color: var(--visa-blue);
}

.btn.danger {
  background: #d8225d;
}

.btn:disabled {
  opacity: 0.55;
}

.message {
  min-height: 22px;
  color: var(--visa-navy);
  font-weight: 760;
}

.table-wrap {
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.admin-table th,
.admin-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.admin-table td {
  color: var(--visa-navy);
  font-weight: 760;
}

.admin-table td:nth-child(1),
.admin-table td:nth-child(3) {
  width: 92px;
}

.admin-table td:nth-child(4) {
  width: 190px;
  text-align: right;
}

.row-actions {
  display: inline-flex;
  gap: 8px;
}

.small-btn {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--visa-blue);
  background: rgba(20, 52, 203, 0.08);
  font-weight: 820;
}

.small-btn.delete {
  color: #c0154c;
  background: rgba(216, 34, 93, 0.1);
}

.login {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
}

.login-card {
  width: min(420px, 100%);
}

.hidden {
  display: none !important;
}

@media (max-aspect-ratio: 5 / 4) {
  body {
    background-size:
      auto 100vh,
      cover;
    background-position:
      right top,
      center;
  }

  .scoreboard {
    width: min(760px, 100%);
    min-width: 0;
    margin-top: clamp(120px, 21vh, 220px);
  }
}

@media (max-width: 820px) {
  .admin-wrap {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .screen-layout {
    padding: 18px;
  }
}

@media (max-width: 820px) and (orientation: portrait) {
  .score-row {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .points {
    grid-column: 2;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .score-row.is-updating,
  .score-row.has-updated {
    animation: none;
  }
}
