:root {
  --bg-0: #09131f;
  --bg-1: #11273b;
  --bg-2: #0f2f3c;
  --panel: rgba(8, 18, 30, 0.66);
  --card: rgba(9, 21, 36, 0.78);
  --text: #ecf6ff;
  --muted: #aac2d8;
  --border: rgba(130, 188, 230, 0.26);
  --accent: #76d3ff;
  --accent-2: #39f6ca;
  --warn: #ffcf64;
  --ok: #84ffc2;
  --bad: #ff9d9d;
  --bg-image-url: url("/assets/bg-main.png");
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background-image:
    linear-gradient(140deg, rgba(9, 19, 31, 0.92), rgba(17, 39, 59, 0.88) 48%, rgba(15, 47, 60, 0.9)),
    radial-gradient(1000px 620px at -8% -10%, rgba(118, 211, 255, 0.2), transparent 64%),
    radial-gradient(980px 620px at 100% 0%, rgba(57, 246, 202, 0.14), transparent 68%),
    var(--bg-image-url),
    linear-gradient(140deg, var(--bg-0), var(--bg-1) 48%, var(--bg-2));
  background-size: auto, auto, auto, cover, auto;
  background-position: 0 0, 0 0, 0 0, center center, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='%2376d3ff' stroke-opacity='.08' stroke-width='1'%3E%3Cpath d='M0 60h240M0 120h240M0 180h240M60 0v240M120 0v240M180 0v240'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.3;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 12% 18%, rgba(118, 211, 255, 0.16), transparent 40%);
}

.layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 42px 18px;
}

.panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 26px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-ghost {
  position: absolute;
  right: clamp(10px, 2.6vw, 24px);
  bottom: clamp(12px, 2.8vw, 24px);
  width: clamp(72px, 13vw, 150px);
  height: auto;
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
  filter: saturate(1.1) brightness(0.94);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(118, 211, 255, 0.75), rgba(57, 246, 202, 0.75));
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3.3vw, 2.35rem);
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: 8px;
  margin-bottom: 22px;
  color: var(--muted);
  max-width: 680px;
}

.view-switch {
  margin-bottom: 16px;
  display: inline-flex;
  gap: 8px;
  border: 1px solid rgba(130, 188, 230, 0.28);
  border-radius: 999px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.16);
}

.view-btn {
  border: 0;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.view-btn.is-active {
  color: var(--text);
  background: rgba(118, 211, 255, 0.2);
}

.view-pane {
  min-width: 0;
}

.wallet-form {
  position: relative;
}

.wallet-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.input-row {
  display: flex;
  gap: 10px;
}

.input-row input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 0.97rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  background: rgba(0, 0, 0, 0.2);
}

.input-row input[type="text"]::placeholder {
  color: rgba(170, 194, 216, 0.75);
}

.input-row input[type="text"]:focus {
  outline: 2px solid rgba(118, 211, 255, 0.36);
  outline-offset: 2px;
}

.projection-toggle {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: none;
}

.projection-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #76d3ff;
  cursor: pointer;
}

button:not(.view-btn):not(.leaderboard-wallet-btn) {
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.02em;
  background: linear-gradient(125deg, var(--accent), var(--accent-2));
  color: #02242f;
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease;
}

button:not(.view-btn):not(.leaderboard-wallet-btn):hover {
  filter: brightness(1.06);
}

button:not(.view-btn):not(.leaderboard-wallet-btn):active {
  transform: translateY(1px);
}

.suggestions {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(8, 15, 27, 0.92);
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
}

.suggestion-item {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.suggestion-item + .suggestion-item {
  border-top: 1px solid rgba(130, 188, 230, 0.18);
}

.suggestion-item:hover {
  background: rgba(118, 211, 255, 0.12);
}

.suggestion-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.suggestion-main {
  min-width: 0;
}

.suggestion-name {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
}

.suggestion-address {
  display: block;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--warn);
}

.card {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(165deg, rgba(118, 211, 255, 0.08), transparent 38%),
    linear-gradient(180deg, rgba(9, 21, 36, 0.94), rgba(9, 21, 36, 0.8));
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: fadeIn 200ms ease;
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.hidden {
  display: none;
}

.copy-success {
  border-color: rgba(130, 188, 230, 0.54);
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(130, 188, 230, 0.24),
    0 0 26px rgba(118, 211, 255, 0.18);
  transform: translateY(-1px);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid rgba(118, 211, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(118, 211, 255, 0.12);
  flex-shrink: 0;
}

.card-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-family: "IBM Plex Mono", monospace;
  word-break: break-word;
}

.wallet-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.79rem;
}

.pill {
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  background: rgba(255, 207, 100, 0.18);
  color: var(--warn);
  white-space: nowrap;
  border: 1px solid rgba(255, 207, 100, 0.28);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill.net-positive {
  background: rgba(132, 255, 194, 0.15);
  color: var(--ok);
  border-color: rgba(132, 255, 194, 0.28);
}

.pill.net-negative {
  background: rgba(255, 157, 157, 0.15);
  color: var(--bad);
  border-color: rgba(255, 157, 157, 0.3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(130, 188, 230, 0.22);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.17);
}

.stat-with-icon {
  padding-right: 76px;
}

.stat-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 23px;
  height: 23px;
  object-fit: contain;
  opacity: 0.96;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.34));
}

.stat-badge-key {
  width: 42px;
  height: 42px;
}

.stat-badge-jackpot {
  width: 44px;
  height: 44px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.08rem, 2.2vw, 1.2rem);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.meta-grid span {
  border: 1px solid rgba(130, 188, 230, 0.2);
  border-radius: 11px;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.14);
}

.projected-week-note {
  margin: 10px 0 2px;
  color: #8cc4e4;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.share-tools {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.secondary-btn {
  border: 1px solid rgba(130, 188, 230, 0.38);
  background: rgba(118, 211, 255, 0.16);
  color: var(--text);
  height: 36px;
  padding: 0 14px;
  font-size: 0.84rem;
  font-weight: 700;
}

.secondary-btn:disabled {
  cursor: default;
}

.secondary-btn.is-busy {
  opacity: 0.8;
  filter: saturate(0.9);
}

.secondary-btn.is-done {
  border-color: rgba(132, 255, 194, 0.48);
  background: rgba(132, 255, 194, 0.22);
}

.share-status {
  margin: 0;
  min-height: 18px;
  font-size: 0.82rem;
  color: var(--muted);
}

.global-card {
  padding-top: 16px;
}

.global-title {
  margin: 0 0 10px;
  font-size: 1.04rem;
  letter-spacing: 0.01em;
}

.global-projection-toggle {
  margin-top: 0;
  margin-bottom: 4px;
}

.global-metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.global-net.positive {
  color: var(--ok);
}

.global-net.negative {
  color: var(--bad);
}

.leaderboard-wrap {
  margin-top: 14px;
  border: 1px solid rgba(130, 188, 230, 0.2);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
}

.leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(130, 188, 230, 0.16);
}

.leaderboard-head h3 {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.leaderboard-count {
  font-size: 0.8rem;
  color: var(--muted);
}

.leaderboard-scroll {
  overflow-x: auto;
}

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

.leaderboard-table th,
.leaderboard-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(130, 188, 230, 0.12);
  white-space: nowrap;
}

.leaderboard-table th {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.leaderboard-table td {
  font-size: 0.86rem;
}

.leaderboard-wallet-btn {
  border: 0;
  padding: 0;
  width: 100%;
  text-align: left;
  background: transparent;
  color: #a8d2f0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.84rem;
}

.leaderboard-wallet-btn:hover {
  color: #d6ecff;
  text-decoration: none;
}

.leaderboard-table tr:last-child td {
  border-bottom: 0;
}

.leaderboard-player {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.leaderboard-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(130, 188, 230, 0.45);
  background: rgba(255, 255, 255, 0.1);
  flex: 0 0 auto;
}

.leaderboard-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #082739;
  background: linear-gradient(135deg, #8ad9ff, #50f0c7);
}

.leaderboard-player-meta {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.1;
}

.leaderboard-player-name {
  color: #d6ecff;
  font-weight: 600;
}

.leaderboard-player-address {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.73rem;
}

.play-cta-wrap {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.play-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 520px);
  min-height: 66px;
  padding: 16px 22px;
  border-radius: 16px;
  border: 2px solid rgba(146, 173, 198, 0.72);
  background:
    linear-gradient(180deg, rgba(88, 95, 102, 0.46), rgba(33, 38, 44, 0.54) 14%, rgba(24, 28, 34, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.2));
  color: #dce8f4;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: clamp(0.86rem, 1.45vw, 1rem);
  line-height: 1.12;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.62);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.46),
    0 9px 24px rgba(0, 0, 0, 0.38);
  transition: transform 110ms ease, filter 110ms ease, border-color 110ms ease, box-shadow 110ms ease;
}

.play-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 36%);
}

.play-cta:hover {
  border-color: rgba(176, 207, 236, 0.86);
  filter: brightness(1.05);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.24),
    inset 0 -2px 0 rgba(0, 0, 0, 0.5),
    0 12px 30px rgba(0, 0, 0, 0.42),
    0 0 22px rgba(153, 206, 255, 0.2);
}

.play-cta:active {
  transform: translateY(1px);
  filter: brightness(1);
}

@media (max-width: 900px) {
  .layout {
    padding-top: 30px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pill {
    font-size: 0.95rem;
  }

  .global-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .panel {
    padding: 20px;
    border-radius: 18px;
  }

  .input-row {
    flex-direction: column;
  }

  button:not(.view-btn):not(.leaderboard-wallet-btn) {
    height: 44px;
  }

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

  .card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .pill {
    width: 100%;
    white-space: normal;
  }

  .share-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .view-switch {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .secondary-btn {
    width: 100%;
    height: 40px;
  }

  .play-cta {
    min-height: 58px;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 0.78rem;
    letter-spacing: 0.07em;
  }

  .panel-ghost {
    width: clamp(62px, 20vw, 94px);
    opacity: 0.16;
  }
}

@media (max-width: 520px) {
  .layout {
    padding: 20px 12px;
  }

  .panel {
    padding: 16px;
  }

  h1 {
    font-size: 1.45rem;
  }

  .subtitle {
    font-size: 0.92rem;
  }

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

  .global-metrics {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 14px;
  }

  .stat {
    padding: 10px;
  }

  .stat-with-icon {
    padding-right: 66px;
  }

  .stat-badge {
    right: 8px;
  }

  .stat-badge-key {
    width: 34px;
    height: 34px;
  }

  .stat-badge-jackpot {
    width: 36px;
    height: 36px;
  }

  .meta-grid span {
    font-size: 0.82rem;
  }

  .play-cta-wrap {
    margin-top: 14px;
  }

  .play-cta {
    min-height: 52px;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
  }

  .panel-ghost {
    right: 8px;
    bottom: 10px;
    width: 56px;
    opacity: 0.13;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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