/* ── Reset ────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --paper: #ffffff;
  --ink: #222;
  --ink-light: #666;
  --ink-faint: #999;
  --ink-ghost: #CDCAC4;
  --common: #4CAF50;
  --uncommon: #E88D4F;
  --rare: #9B59B6;
  --epic: #E74C8B;
  --legendary: #F1C40F;
  --mythic: #1ABC9C;
  --accent: #C3A6E0;
  --font: 'DM Sans', -apple-system, sans-serif;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: default;
}




/* ── Sketchy border (hand-drawn feel) ────────────────────── */
.sketchy-border {
  border: 2px solid var(--ink);
  border-radius: 2px;
  /* Slight perspective skew for hand-drawn feel */
  box-shadow:
    1px 1px 0 var(--ink),
    -0.5px 0.5px 0 rgba(0, 0, 0, 0.08);
}

/* ── Screen Management ───────────────────────────────────── */
.screen {
  display: none;
  height: 100vh;
  width: 100vw;
  position: relative;
  z-index: 1;
}

.screen.active {
  display: flex;
}

/* ═════════════════════════════════════════════════════════════
   LANDING
   ═════════════════════════════════════════════════════════════ */
#landing {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.ca-banner {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--paper);
  padding: 8px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  z-index: 10;
  max-width: 90vw;
  display: none;
}

.ca-label {
  font-weight: bold;
  color: var(--ink-light);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.ca-value {
  font-family: monospace;
  background: #f5f5f5;
  padding: 4px 8px;
  border-radius: 3px;
  color: var(--ink);
  white-space: break-spaces;
  word-break: break-all;
}

.btn-copy {
  background: var(--ink);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: transform 0.1s;
}

.btn-copy:hover {
  transform: scale(1.05);
}

.btn-copy:active {
  transform: scale(0.95);
}

.shape-bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  pointer-events: none;
  background-image:
    /* Common Circle */
    url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='10' fill='%234CAF50' /%3E%3C/svg%3E"),
    /* Epic Hexagon */
    url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='12,2 21.5,7.5 21.5,18.5 12,24 2.5,18.5 2.5,7.5' fill='%23E74C8B' /%3E%3C/svg%3E"),
    /* Rare Triangle */
    url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='12,2 22,20 2,20' fill='%239B59B6' /%3E%3C/svg%3E"),
    /* Legendary Diamond */
    url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='12,2 22,12 12,22 2,12' fill='%23F1C40F' /%3E%3C/svg%3E"),
    /* Mythic Star */
    url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='12,0 15,9 24,12 15,15 12,24 9,15 0,12 9,9' fill='%231ABC9C' /%3E%3C/svg%3E"),
    /* Uncommon Square */
    url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='3' y='3' width='18' height='18' rx='4' fill='%23E88D4F' /%3E%3C/svg%3E");
  background-size: 80px 80px;
  background-position:
    0 0,
    40px 40px,
    20px 60px,
    60px 20px,
    10px 30px,
    70px 70px;
  background-repeat: repeat;
}

.landing-content {
  text-align: center;
  max-width: 420px;
  padding: 20px;
}

/* Logo */
.logo-area {
  margin-bottom: 28px;
}

.logo-shapes-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 6px;
}

.logo-balloon {
  animation: bob 2.5s ease-in-out infinite;
}

.logo-balloon:nth-child(2) {
  animation-delay: 0.3s;
}

.logo-balloon:nth-child(3) {
  animation-delay: 0.6s;
}

.logo-balloon:nth-child(4) {
  animation-delay: 0.9s;
}

@keyframes bob {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

.logo-text {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--ink);
}

.logo-dot {
  color: var(--ink-light);
}

/* Online count */
.online-count {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  font-size: 14px;
  color: var(--common);
  margin-bottom: 8px;
}

.green-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--common);
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.4
  }
}

.tagline {
  font-size: 15px;
  color: var(--ink-light);
  margin-bottom: 28px;
  letter-spacing: 0.2px;
}

/* Landing buttons */
.landing-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 260px;
  padding: 14px 24px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.play-btn {
  background: var(--accent);
  border-color: var(--ink);
}

.play-btn:hover {
  background: #B294D6;
}

.claim-btn {
  margin-left: 10px;
  background: var(--legendary);
  color: var(--bg);
  font-weight: bold;
  border-radius: 4px;
  padding: 4px 12px;
  box-shadow: 2px 2px 0 var(--bg-card);
  animation: pulse 2s infinite ease-in-out;
}

.claim-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.claim-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.guest-btn {
  background: white;
}

.guest-btn:hover {
  background: #f5f5f5;
}

.guest-note {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 4px;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--paper);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  text-align: left;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

@media (max-width: 600px) {
  .modal {
    padding: 20px;
    width: 95%;
  }
}

.modal h2 {
  font-size: 22px;
  margin-bottom: 10px;
  font-weight: 700;
}

.modal-desc {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.btn-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink-light);
  padding: 4px;
}

.btn-close:hover {
  color: var(--ink);
}

.import-input {
  width: 100%;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  background: white;
  margin-top: 5px;
  outline: none;
}

.import-btn {
  background: #f8f8f8;
}

.import-btn:hover {
  background: #eeeeee;
}

/* Admin Dashboard */
.admin-modal {
  max-width: 750px;
  width: 95%;
}

.admin-stat-row {
  font-size: 16px;
  margin-bottom: 20px;
  padding: 10px;
  background: #fdf6e3;
  border: 1px dashed var(--ink-ghost);
}

.admin-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.admin-controls .btn {
  flex: 1;
  font-size: 14px;
}

.admin-message-area label {
  display: block;
  margin-bottom: 5px;
  font-weight: 700;
}

.admin-wallet-log {
  margin-top: 20px;
  border-top: 1px solid var(--ink-ghost);
  padding-top: 15px;
}

.admin-wallet-log label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--epic);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.wallet-log-container {
  background: #fdf6e3;
  height: 150px;
  overflow-y: auto;
  padding: 8px;
  font-family: monospace;
  font-size: 11px;
}

.log-entry {
  padding: 5px;
  border-bottom: 1px dashed #ccc;
  word-break: break-all;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-key {
  color: #e74c3c;
  font-weight: bold;
}

.log-text {
  color: #2c3e50;
  font-weight: 500;
  display: block;
  margin-top: 2px;
  background: rgba(0, 0, 0, 0.03);
  padding: 4px;
  border-radius: 2px;
}

.log-player {
  color: var(--epic);
  font-weight: bold;
}

.log-time {
  color: #888;
  margin-right: 5px;
}

/* Global Message Overlay */
.global-message-overlay {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
  width: 90%;
  max-width: 600px;
  animation: slideDown 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.global-message-box {
  background: #222;
  color: #fff;
  padding: 16px 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.msg-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #ffd000;
  margin-bottom: 4px;
}

.msg-text {
  font-size: 18px;
  font-weight: 700;
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -100px);
    opacity: 0;
  }

  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.cursor-pointer {
  cursor: pointer;
}

/* Wallet fields */
.wallet-field {
  margin-bottom: 14px;
}

.wallet-field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-faint);
  margin-bottom: 4px;
  font-weight: 600;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-row code {
  flex: 1;
  font-family: var(--font);
  font-size: 12px;
  background: white;
  border: 1.5px solid var(--ink-ghost);
  padding: 8px 10px;
  border-radius: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

.blurred {
  filter: blur(5px);
  opacity: 0.6;
  user-select: none;
  transition: all 0.2s;
}

.blurred.visible {
  filter: blur(0);
  opacity: 1;
  user-select: all;
}

.btn-copy {
  background: white;
  border: 1.5px solid var(--ink-ghost);
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  border-radius: 2px;
  color: var(--ink-light);
  white-space: nowrap;
}

.btn-copy:hover {
  background: #f0f0f0;
  color: var(--ink);
}

.wallet-warning {
  font-size: 12px;
  color: #c0392b;
  background: #FDF0EE;
  border: 1.5px solid #F0D0CA;
  padding: 10px 12px;
  border-radius: 2px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.modal-play-btn {
  width: 100%;
}

/* Help content */
.help-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-step {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.5;
}

.help-step strong {
  color: var(--ink);
}

/* ═════════════════════════════════════════════════════════════
   GAME SCREEN
   ═════════════════════════════════════════════════════════════ */
#game {
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────── */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 46px;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  flex-shrink: 0;
  z-index: 100;
}

.cursor-pointer {
  cursor: pointer;
}

.game-header .logo-text {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  line-height: 1;
  padding: 5px 2px;
  user-select: none;
}

.game-header .logo-text .text-accent {
  font-size: 16px;
  font-weight: 700;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-balloon {
  margin-right: -2px;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
}

.header-live {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 10px;
  background: white;
  color: var(--ink-light);
  margin-left: 6px;
}

.btn-small {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.btn-small:hover {
  background: #f0f0f0;
}

/* Wallet & Balance Bar (Top) */
.wallet-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 8px 16px;
  background: white;
  border-bottom: 1px solid var(--ink-ghost);
  font-size: 13px;
  color: var(--ink);
  z-index: 15;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.wallet-balance {
  font-size: 14px;
}

.wallet-balance strong {
  font-size: 16px;
  color: var(--common);
  /* A nice green for token balance */
}

.wallet-key-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-label {
  color: var(--ink-faint);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* ── Sidebars ────────────────────────────────────────────── */
.sidebar-left {
  position: fixed;
  top: 54px;
  left: 12px;
  width: 185px;
  background: var(--paper);
  padding: 14px;
  z-index: 10;
  max-height: calc(100vh - 70px);
  overflow-y: auto;
}

.sidebar-left h3,
.sidebar-right h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.2px;
}

.rarity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--ink-ghost);
  font-size: 12px;
}

.sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.sidebar-icon svg {
  width: 100%;
  height: 100%;
}

.rarity-row:first-of-type {
  border-top: none;
}

.rarity-icons {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.r-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.rarity-info {
  flex: 1;
  min-width: 0;
}

.rarity-info strong {
  display: block;
  font-size: 12px;
  line-height: 1.3;
}

.rarity-range {
  font-size: 10px;
  color: var(--ink-faint);
}

.rarity-pct {
  font-size: 11px;
  color: var(--ink-faint);
  flex-shrink: 0;
}

/* Inline Wallet Elements in Header */
.wallet-balance {
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wallet-balance strong {
  font-size: 15px;
  color: var(--common);
}

.wallet-key-container {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.wallet-guest-prompt {
  display: flex;
}

/* Leaderboard Content (Now in Right Sidebar) */
.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.leaderboard-header h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.leaderboard-columns {
  display: flex;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ink-ghost);
  gap: 8px;
}

.col-rank {
  width: 16px;
  text-align: center;
}

.col-player {
  flex: 1;
}

.col-stats {
  width: 80px;
  text-align: center;
}

.col-score {
  width: 60px;
  text-align: right;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.lb-row {
  display: flex;
  align-items: center;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.05);
  gap: 8px;
}

.lb-row.is-me {
  background: rgba(26, 188, 156, 0.05);
  border-radius: 4px;
  padding: 6px 4px;
}

.lb-rank {
  width: 16px;
  font-weight: 700;
  color: var(--ink-muted);
  text-align: center;
}

.lb-player {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-stats {
  width: 80px;
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
}

.lb-stat-badge {
  display: flex;
  align-items: center;
  gap: 3px;
}

.lb-score {
  width: 60px;
  text-align: right;
  font-weight: 700;
  color: var(--theme);
}

/* Right sidebar (Leaderboard) */
.sidebar-right {
  position: fixed;
  top: 54px;
  right: 12px;
  width: 280px;
  background: var(--paper);
  padding: 14px;
  z-index: 10;
  max-height: calc(100vh - 130px);
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

/* Minimized Game Log Pill */
.game-log-container {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.game-log-pill {
  background: var(--paper);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s;
}

.game-log-pill:hover {
  transform: translateY(-2px);
}

.game-log-content {
  width: 260px;
  background: var(--paper);
  padding: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  max-height: 250px;
  overflow-y: auto;
}

.game-log-content h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  font-size: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.log-rarity {
  font-weight: 600;
  flex-shrink: 0;
  min-width: 65px;
}

.log-winner {
  color: var(--ink-light);
  flex-shrink: 0;
}

.log-amount {
  font-weight: 600;
  color: var(--ink);
  margin-left: auto;
  flex-shrink: 0;
}

.log-time {
  font-size: 10px;
  color: var(--ink-faint);
  flex-shrink: 0;
  min-width: 50px;
  text-align: right;
}

.log-empty {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ── Arena ────────────────────────────────────────────────── */
.arena {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: url("data:image/svg+xml,%3Csvg width='24' height='28' viewBox='0 0 24 28' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M 1.2 1.2 L 1.2 18 L 4.8 13.2 L 8.4 21.6 L 10.8 20.4 L 7.2 12 L 13.2 12 Z' fill='white' stroke='black' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 1 1, auto;
  /* Ensure the board is always visible and contained */
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.12) 2px, transparent 2px);
  background-size: 40px 40px;
  touch-action: none;
}

/* ── Game Shapes ──────────────────────────────────────────── */
.game-shape {
  position: absolute;
  left: 0;
  top: 0;
  cursor: url("data:image/svg+xml,%3Csvg width='24' height='28' viewBox='0 0 24 28' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M 1.2 1.2 L 1.2 18 L 4.8 13.2 L 8.4 21.6 L 10.8 20.4 L 7.2 12 L 13.2 12 Z' fill='white' stroke='black' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 1 1, auto;
  z-index: 5;
  will-change: transform;
  pointer-events: auto;
}

.game-shape .shape-svg {
  display: block;
  transition: transform 0.15s ease-out;
}

.game-shape:hover .shape-svg {
  transform: scale(1.25);
}

/* Spawn entrance — scale inner SVG, fade outer (preserves position transform) */
.game-shape.shape-entering {
  animation: shapeEnterFade 0.6s ease forwards;
}

.game-shape.shape-entering .shape-svg {
  animation: shapeEnterScale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes shapeEnterFade {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes shapeEnterScale {
  0% {
    transform: scale(0.2);
  }

  100% {
    transform: scale(1);
  }
}

/* Pop exit — scale inner SVG, fade outer */
.game-shape.shape-popping {
  animation: shapePopFade 0.4s ease-out forwards;
  pointer-events: none;
}

.game-shape.shape-popping .shape-svg {
  animation: shapePopScale 0.4s ease-out forwards;
}

@keyframes shapePopFade {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes shapePopScale {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.4);
  }

  100% {
    transform: scale(0);
  }
}


/* Shimmer for rare+ shapes */
.shape-shimmer {
  animation: shimmerPulse 2.5s ease-in-out infinite;
}

.shimmer-1 {
  animation-duration: 2.5s;
  /* rare — same as base */
}

.shimmer-2 {
  animation-duration: 2s;
}

/* epic */
.shimmer-3 {
  animation-duration: 1.6s;
}

/* legendary */
.shimmer-4 {
  animation-duration: 1.2s;
}

/* mythic */

@keyframes shimmerPulse {

  0%,
  100% {
    filter: brightness(1) drop-shadow(0 0 3px rgba(255, 255, 255, 0.15));
  }

  50% {
    filter: brightness(1.35) drop-shadow(0 0 12px rgba(255, 255, 255, 0.5));
  }
}

/* Shape Animations (All Tiers) */
.shape-common .shape-svg,
.log-common .log-shape-icon svg {
  animation: animPulse 3s ease-in-out infinite;
  transform-origin: center;
}

.shape-uncommon .shape-svg,
.log-uncommon .log-shape-icon svg {
  animation: animFloat 2.5s ease-in-out infinite;
  transform-origin: center;
}

.shape-rare .shape-svg,
.log-rare .log-shape-icon svg {
  animation: animFlip 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  transform-origin: center;
}

.shape-epic .shape-svg,
.log-epic .log-shape-icon svg {
  animation: animRock 2s ease-in-out infinite;
  transform-origin: center;
}

.shape-legendary .shape-svg,
.log-legendary .log-shape-icon svg {
  animation: animRotate 4s linear infinite;
  transform-origin: center;
}

.shape-mythic .shape-svg,
.log-mythic .log-shape-icon svg {
  animation: animMythic 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  transform-origin: center;
}

@keyframes animPulse {

  0%,
  100% {
    scale: 1;
  }

  50% {
    scale: 1.15;
  }
}

@keyframes animFloat {

  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -4px;
  }
}

@keyframes animFlip {

  0%,
  100% {
    rotate: y 0deg;
  }

  50% {
    rotate: y 180deg;
  }
}

@keyframes animRock {

  0%,
  100% {
    rotate: -15deg;
  }

  50% {
    rotate: 15deg;
  }
}

@keyframes animRotate {
  0% {
    rotate: 0deg;
  }

  100% {
    rotate: 360deg;
  }
}

@keyframes animMythic {

  0%,
  100% {
    rotate: 0deg;
    scale: 1;
  }

  25% {
    rotate: 15deg;
    scale: 1.15;
  }

  50% {
    rotate: -15deg;
    scale: 0.9;
  }

  75% {
    rotate: 10deg;
    scale: 1.15;
  }
}

/* ── Cursors ──────────────────────────────────────────────── */
.player-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  transition: left 0.08s linear, top 0.08s linear;
}

.cursor-arrow {
  width: 0;
  height: 0;
  border-left: 6px solid currentColor;
  border-right: 6px solid transparent;
  border-bottom: 10px solid transparent;
  border-top: 10px solid currentColor;
}

.cursor-label {
  position: absolute;
  left: 14px;
  top: 12px;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-light);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* Own cursor — NO transitions for instant response */
.own-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 100;
}

/* Cursors hidden toggle */
.cursors-hidden .player-cursor {
  display: none;
}

/* Pop reward text */
.pop-reward {
  pointer-events: none;
  z-index: 50;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  animation: rewardFloat 1.2s ease-out forwards;
}

@keyframes rewardFloat {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    margin-top: -40px;
  }
}

/* ── Payout Notification ──────────────────────────────────── */
.payout-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  background: white;
  padding: 20px;
  z-index: 200;
  max-width: 300px;
  box-shadow: 8px 8px 0 var(--ink-ghost);
  animation: payoutIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.payout-notification.out {
  animation: payoutOut 0.5s ease-in forwards;
}

.payout-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--rare);
}

.payout-body {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.4;
  margin-bottom: 12px;
}

.payout-link {
  display: inline-block;
  font-size: 12px;
  color: var(--epic);
  text-decoration: underline;
  font-weight: 600;
}

@keyframes payoutIn {
  from {
    transform: translateX(120%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes payoutOut {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(120%);
  }
}

/* ── Recent Winners Pill ──────────────────────────────────── */
.recent-winners-pill {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recent-winners-pill:hover {
  background: #f9f9f9;
}

.winners-badge {
  background: #E74C3C;
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--ink-ghost);
  border-radius: 2px;
}

/* ── Responsive ───────────────────────────────────────────── */
/* ── Mobile Overlay Specifics ── */
.mobile-modal {
  text-align: center;
  max-width: 280px;
  padding: 30px 20px;
}

.mobile-icon {
  font-size: 40px;
  margin-bottom: 15px;
}

.mobile-modal h2 {
  margin-bottom: 10px;
  color: var(--ink);
}

.mobile-modal p {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.5;
  margin-bottom: 12px;
}

@media (max-width: 800px) {

  .sidebar-left,
  .sidebar-right {
    display: none;
  }

  /* Show mobile overlay by default on small screens if not already handled by JS */
  #mobileOverlay.detected {
    display: flex !important;
  }

  .landing-content {
    padding: 16px;
  }

  .logo-text {
    font-size: 36px;
  }
}

/* ── Log Shape Icons ─────────────────────────────────────── */
.log-shape-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.log-shape-icon svg {
  display: block;
}

.log-shimmer .log-shape-icon svg {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.log-entry .log-rarity {
  font-weight: 600;
}

.log-entry .log-amount {
  font-weight: 700;
}

/* ── Mobile Admin Prompt ────────────────────────────────── */
.mobile-admin-prompt {
  text-align: center;
  padding: 20px;
}

.mobile-admin-prompt .desktop-emoji {
  font-size: 64px;
  display: block;
  margin-bottom: 15px;
  animation: bounce 2s infinite;
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-20px);
  }

  60% {
    transform: translateY(-10px);
  }
}

.mobile-admin-prompt p {
  font-weight: bold;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.4;
}