/* ── Reset ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
 
:root {
  --bg-app:     #1a1a1a;
  --bg-dark:    #2e2e2e;
  --bg-panel:   #383838;
  --bg-card:    #444444;
  --bg-list:    #242424;
  --gold:       #c8a84b;
  --silver:     #C0C0C0;
  --bronze:     #CD7F32;
  --gold-dim:   #8a7235;
  --green:      #4caf74;
  --red:        #e05a45;
  --text-pri:   #f0ede6;
  --text-sec:   #a8a5a0;
  --text-dim:   #666360;
  --border:     rgba(255,255,255,0.07);
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  22px;
  --font-mono:  'DM Mono', monospace;
  --font-serif: 'Playfair Display', serif;
}
 
html, body {
  height: 100%;
  background: var(--bg-app);
  font-family: var(--font-mono);
  color: var(--text-pri);
  -webkit-font-smoothing: antialiased;
}
 
/* ── Views ───────────────────────────────────────── */
.view { display: none; }
.view.active { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; }
 
/* ── Phone Frame ─────────────────────────────────── */
.phone-frame {
  width: 100%;
  max-width: 390px;
  min-height: 680px;
  background: var(--bg-dark);
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05);
  position: relative;
}
 
/* ── Header ──────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 20px 14px;
  flex-shrink: 0;
}
 
.back-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text-pri);
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.back-btn:hover { background: rgba(255,255,255,0.14); }
 
.header-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--text-pri);
}
.header-spacer { width: 34px; }
 
.btn-text-sm {
  background: none; border: none;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 0;
  opacity: 0.8;
}
.btn-text-sm:hover { opacity: 1; }
 
/* ── Tabs ────────────────────────────────────────── */
.tabs {
  display: flex; gap: 6px;
  padding: 0 20px 16px;
  flex-shrink: 0;
}
.tab {
  flex: 1; padding: 7px 0;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--text-sec);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.18s;
}
.tab.active {
  background: rgba(255,255,255,0.13);
  color: var(--text-pri);
  border-color: rgba(255,255,255,0.2);
}
.tab:hover:not(.active) { background: rgba(255,255,255,0.05); }
 
/* ── Buttons ─────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: #1a1400;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover   { opacity: 0.9; }
.btn-primary:active  { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
 
.btn-ghost {
  width: 100%;
  padding: 13px;
  background: transparent;
  color: var(--text-sec);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.06); color: var(--text-pri); }
 
.btn-danger {
  width: 100%;
  padding: 13px;
  background: rgba(224, 90, 69, 0.15);
  color: var(--red);
  border: 1px solid rgba(224, 90, 69, 0.3);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: rgba(224, 90, 69, 0.25); }
 
.btn-link {
  background: none; border: none;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
 
.full-width { width: 100%; }
 
/* ── Home View ───────────────────────────────────── */
.suit-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  color: rgba(255,255,255,0.02);
  letter-spacing: 10px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}
 
.home-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 28px;
  gap: 20px;
  position: relative;
  z-index: 1;
}
 
.home-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
 
.app-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-pri);
  letter-spacing: 0.02em;
}
 
.suit-icon {
  font-size: 26px;
  color: var(--text-sec);
}
.suit-icon.red { color: #c04848; }
 
.active-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(76, 175, 116, 0.12);
  border: 1px solid rgba(76, 175, 116, 0.25);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 12px;
  color: var(--green);
  width: 100%;
  justify-content: center;
}
 
.active-banner-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.4s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
 
.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
 
.muted-text {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}
 
/* ── Player Select ───────────────────────────────── */
.search-bar {
  padding: 0 20px 14px;
  flex-shrink: 0;
}
 
.search-bar input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text-pri);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s;
}
.search-bar input:focus { border-color: rgba(255,255,255,0.25); }
.search-bar input::placeholder { color: var(--text-dim); }
 
.player-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 20px 16px;
  overflow-y: auto;
  align-content: start;
}
 
.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}
.player-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}
 
.pc-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  color: var(--text-sec);
}
 
.pc-name {
  font-size: 10px;
  color: var(--text-sec);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}
 
.add-player-row {
  padding: 12px 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}
 
/* ── Buy In View ─────────────────────────────────── */
.buyin-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 20px 24px;
  flex-shrink: 0;
}
 
.buyin-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--text-sec);
}
 
.buyin-player-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-pri);
}
 
.buyin-status {
  font-size: 11px;
  color: var(--text-dim);
}
 
.amount-section {
  flex: 1;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
 
.section-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
 
.chip-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
 
.chip-btn {
  padding: 11px 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sec);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip-btn:hover, .chip-btn.selected {
  background: rgba(200, 168, 75, 0.15);
  border-color: var(--gold-dim);
  color: var(--gold);
}
 
.custom-amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
}
.currency-symbol {
  font-size: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.custom-amount-row input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-pri);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 12px 0;
  outline: none;
}
.custom-amount-row input::placeholder { color: var(--text-dim); }
 
.selected-amount {
  font-size: 13px;
  color: var(--gold);
  text-align: center;
}
 
.buyin-actions {
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
 
.buyout-preview {
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  text-align: center;
}
 
/* ── Lobby ───────────────────────────────────────── */
.lobby-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px 20px 20px;
  flex-shrink: 0;
}
.lobby-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.lobby-stat-val {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-pri);
}
.lobby-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.lobby-divider {
  width: 1px; height: 40px;
  background: var(--border);
  flex-shrink: 0;
}
 
.lobby-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
}
.lobby-row {
  display: grid;
  grid-template-columns: 36px 1fr 64px 36px;
  align-items: center;
  gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
  animation: fadeUp 0.25s ease both;
}
.lobby-row:last-child { border-bottom: none; }
 
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
 
.lobby-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--text-sec);
}
.lobby-name { font-size: 13px; color: var(--text-pri); }
.lobby-buyin {
  font-size: 12px;
  color: var(--text-sec);
  text-align: right;
}
.lobby-status {
  font-size: 10px;
  text-align: center;
}
.status-in    { color: var(--green); }
.status-out   { color: var(--text-dim); }
 
.lobby-footer {
  padding: 14px 20px 24px;
  flex-shrink: 0;
}
 
/* ── Podium Section ──────────────────────────────── */
.podium-section {
  padding: 0 16px 0;
  position: relative;
  flex-shrink: 0;
}
 
.podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding-bottom: 0;
}
 
/* each podium slot */
.podium-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  animation: fadeUp 0.4s ease both;
}

.podium-slot[data-rank="2"] {
  top:10px;
}

.podium-slot[data-rank="3"] {
  top:20px;
}

.p-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-pri);
  position: relative;
}

.podium-slot[data-rank="1"] .p-avatar {
  width: 58px;
  height: 58px;
  border-color: var(--gold);
  border-width: 2.5px;
}

.podium-slot[data-rank="2"] .p-avatar {
  width: 58px;
  height: 58px;
  border-color: var(--silver);
  border-width: 2.5px;
}

.podium-slot[data-rank="3"] .p-avatar {
  width: 58px;
  height: 58px;
  border-color: var(--bronze);
  border-width: 2.5px;
}

.p-name {
  font-size: 10px;
  color: var(--text-sec);
  text-align: center;
  white-space: nowrap;
}
 
.p-profit {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}
.profit-pos { color: var(--green); }
.profit-neg { color: var(--red); }
 
.p-games-badge {
  font-size: 9px;
  background: rgba(255,255,255,0.1);
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 10px;
}

#view-leaderboard.single .p-games-badge {
  display: none;
}
 
/* ── Podium Bases ────────────────────────────────── */
.podium-bases {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 4px 0 0;
}
 
.base {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.03) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom: none;
}
.base span {
  font-family: var(--font-serif);
  font-weight: 700;
  color: rgba(255,255,255,0.2);
}
.base-1 { height: 64px; }
.base-1 span { font-size: 32px; }
.base-2 { height: 54px; }
.base-2 span { font-size: 26px; }
.base-3 { height: 44px; }
.base-3 span { font-size: 20px; }
 
 
/* ── Leaderboard List ────────────────────────────── */
.list-panel {
  flex: 1;
  background: var(--bg-list);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 16px 20px;
  overflow-y: auto;
}
.list-header {
  display: grid;
  grid-template-columns: 24px 1fr 56px;
  gap: 6px;
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.list-header span {
  font-size: 9px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
}

.lh-profit { text-align: right; }
.lh-games  { text-align: center; }
.lh-rank  { text-align: center; }
 
/* ── List Row ────────────────────────────────────── */
.list-row {
  display: grid;
  grid-template-columns: 24px 36px 1fr 55px 36px;
  gap: 8px;
  align-items: center;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  animation: fadeUp 0.3s ease both;
}
.list-row:last-child { border-bottom: none; }
 
.row-rank {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}
 
.row-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-sec);
}
 
.row-name {
  font-size: 12px;
  color: var(--text-pri);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
 
.row-profit {
  font-size: 12px;
  font-weight: 500;
  text-align: centre;
}
 
.row-games {
  font-size: 11px;
  color: var(--text-sec);
  text-align: center;
}
 
.row-change {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
}
 
/* Rank change arrows */
.arrow-up {
  display: inline-block;
  width: 0; height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-bottom: 5px solid var(--green);
}
.arrow-down {
  display: inline-block;
  width: 0; height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 5px solid var(--red);
}
.arrow-neutral {
  display: inline-block;
  width: 7px; height: 1.5px;
  background: var(--text-dim);
  border-radius: 2px;
}
 
.change-up   { color: var(--green); }
.change-down { color: var(--red); }



/* Single tab nav*/
.single-nav {
  width: 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;

  margin: 0px auto 5px;
  padding: 10px 12px;

  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);

  font-size: 14px;
  font-weight: 100;
  color: #fff;
}

.single-nav.hidden {
  display: none;
}

.single-nav button {
  width: 36px;
  height: 36px;

  border: none;
  border-radius: 10px;

  background: rgba(255, 255, 255, 0.10);
  color: white;

  font-size: 18px;
  font-weight: bold;

  cursor: pointer;

  transition: all 0.15s ease;
}

.single-nav button:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.single-nav button:active {
  transform: scale(0.95);
}

#game-label {
  min-width: 120px;
  text-align: center;
  opacity: 0.9;
}


/* POP UP */
.modal-overlay.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--bg-dark);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 28px 24px 20px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  font-size: 28px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--text-pri);
  text-align: center;
}

.modal-msg {
  font-size: 12px;
  color: var(--text-sec);
  text-align: center;
  line-height: 1.6;
  padding: 0 4px;
  white-space: pre-line;
}

.modal-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.modal-actions .btn-ghost,
.modal-actions .btn-primary {
  flex: 1;
  padding: 11px;
  font-size: 13px;
}
 
/* ── Toast ───────────────────────────────────────── */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
  background: rgba(40,40,40,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-pri);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 20px;
  border-radius: 20px;
  z-index: 999;
  backdrop-filter: blur(8px);
  transition: opacity 0.25s;
  white-space: nowrap;
}
.toast.hidden { opacity: 0; pointer-events: none; }
 
/* ── Utils ───────────────────────────────────────── */
.hidden { display: none !important; }
 
/* ── Scrollbars ──────────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }
 
/* ── Mobile full-screen ──────────────────────────── */
@media (max-width: 630px) {
  html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
  background: var(--bg-dark);
  }

  .view {
    display: none;
  }

  .view.active {
    padding: 0;
    margin: 0;
    display: block;
    width: 100%;
    min-height: 100dvh;
  }

  .phone-frame {
    width: 100% !important; 
    max-width: 100% !important;
    min-width: 0  !important;
    min-height: 100dvh;
    height: auto;
    border-radius: 0  !important;
    box-shadow: none  !important;
    margin: 0  !important;
    overflow: visible;
  }
}
