:root {
  --bg: #08050d;
  --bg-soft: #100a18;

  --panel: #171020;
  --panel-light: #21152d;
  --panel-line: #392345;

  --pink: #ff4fa3;
  --pink-soft: #ff8ac6;
  --purple: #a855f7;
  --cyan: #4de8ff;
  --green: #5cffb1;
  --yellow: #ffe66d;
  --red: #ff5c7a;

  --ink: #fff7fc;
  --ink-dim: #cdbbd0;

  --shadow-pink: rgba(255, 79, 163, 0.25);
  --shadow-purple: rgba(168, 85, 247, 0.2);
  --shadow-cyan: rgba(77, 232, 255, 0.18);
}


/* ============================================================
   RESET
   ============================================================ */

* {
  box-sizing: border-box;
}

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

  background:
    radial-gradient(
      circle at 15% 10%,
      rgba(255, 79, 163, 0.12),
      transparent 30%
    ),
    radial-gradient(
      circle at 85% 20%,
      rgba(168, 85, 247, 0.12),
      transparent 30%
    ),
    radial-gradient(
      circle at 50% 100%,
      rgba(77, 232, 255, 0.08),
      transparent 35%
    ),
    var(--bg);

  color: var(--ink);

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}


/* ============================================================
   MAIN LAYOUT
   ============================================================ */

.wrap {
  width: 100%;
  max-width: 760px;

  margin: 0 auto;

  padding:
    42px
    20px
    70px;
}


/* ============================================================
   BOARD
   ============================================================ */

.board-frame {
  position: relative;

  overflow: hidden;

  background:
    linear-gradient(
      145deg,
      rgba(255, 79, 163, 0.045),
      transparent 35%
    ),
    linear-gradient(
      325deg,
      rgba(168, 85, 247, 0.05),
      transparent 40%
    ),
    var(--panel);

  border: 1px solid var(--panel-line);

  border-radius: 18px;

  padding: 28px 24px;

  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02),
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 45px rgba(168, 85, 247, 0.08);

  backdrop-filter: blur(8px);
}


/*
 * Pride-ish decorative glow at the top of the board.
 */

.board-frame::before {
  content: "";

  position: absolute;

  top: 0;
  left: 0;
  right: 0;

  height: 3px;

  background:
    linear-gradient(
      90deg,
      var(--pink),
      var(--purple),
      var(--cyan),
      var(--green),
      var(--yellow),
      var(--pink)
    );

  background-size: 200% 100%;

  animation: pride-flow 8s linear infinite;

  box-shadow:
    0 0 15px rgba(255, 79, 163, 0.4),
    0 0 30px rgba(168, 85, 247, 0.25);
}


@keyframes pride-flow {
  from {
    background-position: 0% 0;
  }

  to {
    background-position: 200% 0;
  }
}


/* ============================================================
   HEADER
   ============================================================ */

header {
  display: flex;

  justify-content: space-between;
  align-items: baseline;

  gap: 20px;

  border-bottom: 1px solid var(--panel-line);

  padding-bottom: 16px;

  margin-bottom: 18px;
}


h1 {
  margin: 0;

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 22px;

  font-weight: 800;

  letter-spacing: 2px;

  color: var(--pink-soft);

  text-shadow:
    0 0 8px rgba(255, 79, 163, 0.6),
    0 0 22px rgba(255, 79, 163, 0.25);
}


/* ============================================================
   LIVE INDICATOR
   ============================================================ */

.live-dot {
  display: inline-block;

  width: 8px;
  height: 8px;

  border-radius: 50%;

  margin-right: 7px;

  background: var(--green);

  box-shadow:
    0 0 5px var(--green),
    0 0 14px rgba(92, 255, 177, 0.8);

  animation:
    pulse 2s infinite ease-in-out;
}


@keyframes pulse {
  0%,
  100% {
    opacity: 1;

    transform: scale(1);
  }

  50% {
    opacity: 0.45;

    transform: scale(0.8);
  }
}


.sub {
  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 11px;

  letter-spacing: 0.7px;

  color: var(--cyan);

  opacity: 0.8;
}


/* ============================================================
   LEADERBOARD
   ============================================================ */

.rows {
  display: flex;

  flex-direction: column;

  gap: 9px;
}


/* ============================================================
   PLAYER ROW
   ============================================================ */

.row {
  position: relative;

  display: grid;

  grid-template-columns:
    38px
    1fr
    auto;

  align-items: center;

  gap: 12px;

  padding: 13px 14px;

  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025),
      rgba(255, 255, 255, 0.01)
    );

  border: 1px solid rgba(255, 255, 255, 0.055);

  border-radius: 10px;

  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}


.row:hover {
  transform: translateY(-1px);

  border-color:
    rgba(255, 79, 163, 0.35);

  background:
    linear-gradient(
      90deg,
      rgba(255, 79, 163, 0.07),
      rgba(168, 85, 247, 0.04)
    );

  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.25),
    0 0 18px rgba(255, 79, 163, 0.06);
}


/* ============================================================
   RANK
   ============================================================ */

.rank {
  display: flex;

  align-items: center;
  justify-content: center;

  width: 30px;
  height: 30px;

  border-radius: 8px;

  background: var(--panel-light);

  border: 1px solid var(--panel-line);

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 12px;

  font-weight: 700;

  color: var(--ink-dim);
}


/*
 * Top three get some personality.
 */

.row:nth-child(1) .rank {
  color: var(--yellow);

  border-color:
    rgba(255, 230, 109, 0.35);

  box-shadow:
    0 0 12px rgba(255, 230, 109, 0.08);
}


.row:nth-child(2) .rank {
  color: var(--pink-soft);

  border-color:
    rgba(255, 138, 198, 0.3);
}


.row:nth-child(3) .rank {
  color: var(--cyan);

  border-color:
    rgba(77, 232, 255, 0.3);
}


/* ============================================================
   NAME
   ============================================================ */

.name {
  min-width: 0;

  font-size: 15px;

  font-weight: 650;

  letter-spacing: 0.1px;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

  color: var(--ink);
}


/* ============================================================
   SCORE
   ============================================================ */

.score-block {
  display: flex;

  align-items: center;

  gap: 10px;

  justify-self: end;
}


.score {
  min-width: 72px;

  text-align: right;

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-variant-numeric:
    tabular-nums;

  font-size: 25px;

  font-weight: 700;

  letter-spacing: -1px;

  color: var(--cyan);

  text-shadow:
    0 0 7px rgba(77, 232, 255, 0.55),
    0 0 20px rgba(77, 232, 255, 0.18);

  transition:
    transform 0.15s ease,
    color 0.15s ease;
}


.score.bump {
  transform: scale(1.18);

  color: var(--green);

  text-shadow:
    0 0 8px var(--green),
    0 0 22px rgba(92, 255, 177, 0.45);
}


.score.neg {
  color: var(--pink);

  text-shadow:
    0 0 7px rgba(255, 79, 163, 0.6),
    0 0 20px rgba(255, 79, 163, 0.2);
}


/* ============================================================
   BUTTONS
   ============================================================ */

button {
  appearance: none;

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-weight: 700;

  cursor: pointer;

  border-radius: 8px;

  border: 1px solid var(--panel-line);

  background: #21152d;

  color: var(--ink);

  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease,
    transform 0.12s ease,
    box-shadow 0.12s ease;
}


button:hover {
  background: #2c1a3c;

  border-color:
    rgba(255, 79, 163, 0.45);

  box-shadow:
    0 0 14px rgba(255, 79, 163, 0.1);
}


button:active {
  transform: translateY(1px);
}


button:focus-visible {
  outline: 2px solid var(--cyan);

  outline-offset: 2px;
}


/* ============================================================
   UPDATE BUTTON
   ============================================================ */

.btn-update {
  padding: 7px 12px;

  font-size: 11px;

  letter-spacing: 0.3px;

  color: var(--pink-soft);

  background:
    rgba(255, 79, 163, 0.06);

  border-color:
    rgba(255, 79, 163, 0.22);
}


.btn-update:hover {
  color: white;

  background:
    rgba(255, 79, 163, 0.15);

  border-color:
    rgba(255, 79, 163, 0.55);

  box-shadow:
    0 0 15px rgba(255, 79, 163, 0.14);
}


/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty {
  text-align: center;

  color: var(--ink-dim);

  padding: 40px 10px;

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 12px;
}


/* ============================================================
   STATUS
   ============================================================ */

.status {
  min-height: 16px;

  margin-top: 11px;

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 11px;

  color: var(--green);

  opacity: 0.9;
}


.status.error {
  color: var(--red);

  text-shadow:
    0 0 8px rgba(255, 92, 122, 0.35);
}


/* ============================================================
   ACTIVITY LOG
   ============================================================ */

.log {
  margin-top: 28px;

  padding-top: 20px;

  border-top: 1px solid var(--panel-line);
}


.log h2 {
  margin: 0 0 11px;

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 11px;

  font-weight: 700;

  text-transform: uppercase;

  letter-spacing: 1.2px;

  color: var(--pink-soft);

  text-shadow:
    0 0 8px rgba(255, 79, 163, 0.25);
}


.log-list {
  display: flex;

  flex-direction: column;

  gap: 7px;

  max-height: 250px;

  overflow-y: auto;

  padding-right: 6px;
}


/* ============================================================
   SCROLLBAR
   ============================================================ */

.log-list::-webkit-scrollbar {
  width: 5px;
}

.log-list::-webkit-scrollbar-track {
  background: transparent;
}

.log-list::-webkit-scrollbar-thumb {
  background: #392345;

  border-radius: 10px;
}

.log-list::-webkit-scrollbar-thumb:hover {
  background: var(--purple);
}


/* ============================================================
   LOG ENTRIES
   ============================================================ */

.log-entry {
  display: flex;

  flex-direction: column;

  gap: 3px;

  padding-bottom: 7px;

  border-bottom:
    1px solid rgba(255, 255, 255, 0.045);

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 11px;

  color: var(--ink-dim);
}


.log-line {
  display: flex;

  justify-content: space-between;

  align-items: baseline;

  gap: 10px;
}


.log-entry .who {
  color: var(--pink-soft);
}


.log-entry .delta.pos {
  color: var(--green);

  text-shadow:
    0 0 7px rgba(92, 255, 177, 0.3);
}


.log-entry .delta.neg {
  color: var(--pink);

  text-shadow:
    0 0 7px rgba(255, 79, 163, 0.3);
}


.log-entry .when {
  white-space: nowrap;

  color: #8f7c94;
}


.log-reason {
  color: #a995ad;

  padding-left: 2px;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  font-size: 11px;
}


.log-empty {
  color: #8f7c94;

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 11px;
}


/* ============================================================
   MODAL OVERLAY
   ============================================================ */

.modal-overlay {
  position: fixed;

  inset: 0;

  background:
    radial-gradient(
      circle at center,
      rgba(168, 85, 247, 0.08),
      transparent 45%
    ),
    rgba(5, 3, 8, 0.82);

  backdrop-filter: blur(8px);

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 20px;

  z-index: 50;
}


.modal-overlay.hidden {
  display: none;
}


/* ============================================================
   MODAL
   ============================================================ */

.modal {
  position: relative;

  width: 100%;

  max-width: 360px;

  padding: 24px;

  background:
    linear-gradient(
      145deg,
      rgba(255, 79, 163, 0.07),
      transparent 45%
    ),
    var(--panel);

  border:
    1px solid var(--panel-line);

  border-radius: 16px;

  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.65),
    0 0 40px rgba(168, 85, 247, 0.12);

  animation:
    modal-in 0.18s ease-out;
}


.modal::before {
  content: "";

  position: absolute;

  top: 0;
  left: 20px;
  right: 20px;

  height: 2px;

  border-radius: 2px;

  background:
    linear-gradient(
      90deg,
      var(--pink),
      var(--purple),
      var(--cyan)
    );

  box-shadow:
    0 0 12px rgba(255, 79, 163, 0.3);
}


@keyframes modal-in {
  from {
    opacity: 0;

    transform:
      translateY(8px)
      scale(0.98);
  }

  to {
    opacity: 1;

    transform:
      translateY(0)
      scale(1);
  }
}


/* ============================================================
   MODAL TEXT
   ============================================================ */

.modal h3 {
  margin: 0 0 5px;

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 17px;

  font-weight: 800;

  color: var(--pink-soft);

  text-shadow:
    0 0 10px rgba(255, 79, 163, 0.3);
}


.modal .modal-sub {
  margin: 0 0 19px;

  color: var(--ink-dim);

  font-size: 12px;
}


.modal label {
  display: block;

  margin-bottom: 5px;

  color: var(--ink-dim);

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 11px;

  font-weight: 700;

  letter-spacing: 0.3px;
}


.modal .field {
  margin-bottom: 15px;
}


/* ============================================================
   FORM ELEMENTS
   ============================================================ */

.modal select,
.modal input[type="number"],
.modal textarea {
  width: 100%;

  padding: 9px 10px;

  background:
    rgba(5, 3, 8, 0.7);

  border:
    1px solid #3b2945;

  border-radius: 8px;

  color: var(--ink);

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size: 13px;

  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}


.modal select:focus,
.modal input[type="number"]:focus,
.modal textarea:focus {
  outline: none;

  background:
    rgba(5, 3, 8, 0.9);

  border-color: var(--purple);

  box-shadow:
    0 0 0 2px rgba(168, 85, 247, 0.12),
    0 0 15px rgba(168, 85, 247, 0.08);
}


.modal textarea {
  resize: vertical;

  min-height: 70px;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}


.modal .field-hint {
  margin-top: 5px;

  color: #8f7c94;

  font-size: 10px;

  line-height: 1.4;
}


/* ============================================================
   MODAL ERROR
   ============================================================ */

.modal .modal-error {
  min-height: 15px;

  margin-top: -5px;

  margin-bottom: 10px;

  color: var(--red);

  font-size: 11px;

  text-shadow:
    0 0 7px rgba(255, 92, 122, 0.25);
}


/* ============================================================
   MODAL ACTIONS
   ============================================================ */

.modal .modal-actions {
  display: flex;

  justify-content: flex-end;

  gap: 8px;

  margin-top: 19px;
}


.modal .modal-actions button {
  padding: 8px 15px;

  font-size: 11px;
}


/* Cancel */

.modal .modal-actions button:first-child {
  color: var(--ink-dim);

  background:
    rgba(255, 255, 255, 0.025);
}


.modal .modal-actions button:first-child:hover {
  color: white;

  border-color:
    rgba(255, 255, 255, 0.2);
}


/* Apply */

.modal .btn-primary {
  color: #180b13;

  background:
    linear-gradient(
      135deg,
      var(--pink-soft),
      var(--pink)
    );

  border-color:
    var(--pink);

  font-weight: 800;

  box-shadow:
    0 0 16px rgba(255, 79, 163, 0.15);
}


.modal .btn-primary:hover {
  color: #fff;

  background:
    linear-gradient(
      135deg,
      var(--pink),
      var(--purple)
    );

  border-color:
    var(--pink-soft);

  box-shadow:
    0 0 22px rgba(255, 79, 163, 0.3);
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 560px) {

  .wrap {
    padding: 12px 8px 40px;
  }

  .board-frame {
    padding: 20px 12px;
    border-radius: 14px;
  }

  header {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding-bottom: 15px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 21px;
    letter-spacing: 1.5px;
  }

  .sub {
    font-size: 11px;
  }

  /* Bigger, easier-to-tap player cards */
  .row {
    grid-template-columns: 38px 1fr;
    gap: 10px;
    padding: 14px 12px;
    border-radius: 11px;
  }

  .rank {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .name {
    font-size: 16px;
  }

  .score-block {
    grid-column: 2;
    justify-self: stretch;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
  }

  .score {
    text-align: left;
    min-width: 0;
    font-size: 27px;
  }

  .btn-update {
    padding: 9px 13px;
    font-size: 12px;
    min-height: 36px;
  }

  .status {
    font-size: 11px;
    margin-top: 12px;
  }

  .log {
    margin-top: 24px;
    padding-top: 18px;
  }

  .log h2 {
    font-size: 12px;
  }

  .log-entry {
    font-size: 12px;
  }

  .log-reason {
    font-size: 12px;
  }

  .log-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .log-entry .when {
    font-size: 10px;
  }

  /* Modal should use more of the phone screen */
  .modal-overlay {
    padding: 12px;
  }

  .modal {
    max-width: none;
    width: 100%;
    padding: 22px 20px;
    border-radius: 14px;
  }

  .modal h3 {
    font-size: 19px;
  }

  .modal .modal-sub {
    font-size: 13px;
  }

  .modal label {
    font-size: 12px;
  }

  .modal select,
  .modal input[type="number"],
  .modal textarea {
    padding: 11px 12px;
    font-size: 14px;
    border-radius: 9px;
  }

  .modal textarea {
    min-height: 85px;
  }

  .modal .modal-actions button {
    padding: 10px 16px;
    font-size: 12px;
    min-height: 40px;
  }
}

}