/* ============================================================
   POKERDLE — Main Styles (Dark Green Theme)
   ============================================================ */
 
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,700;0,9..144,900;1,9..144,300;1,9..144,500&family=DM+Mono:wght@400;500&display=swap');
 
/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
 
:root {
  --bg:         #0f1a13;
  --bg-warm:    #131f16;
  --felt:       #1a3d26;
  --felt-dark:  #0e2418;
  --felt-light: #256637;
  --ink:        #e8e0cc;
  --ink-mid:    #b8ae98;
  --ink-faint:  #6a7d66;
  --cream:      #1c2e1f;
  --gold:       #c9a227;
  --gold-light: #dbb84a;
  --gold-pale:  #2a2410;
  --red:        #e05252;
  --card-bg:    #f5f0e4;
  --card-line:  #d8ceb8;
  --shadow:     rgba(0,0,0,0.4);
  --shadow-deep:rgba(0,0,0,0.65);

  /* Rarity colors — brightened for dark bg */
  --common:     #8aab8a;
  --uncommon:   #5b9fd4;
  --rare:       #b07de8;
  --epic:       #e05252;
  --legendary:  #c9a227;
}
 
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 60% at 50% 0%, #1a3d26 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2300ff88' fill-opacity='0.018'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  min-height: 100vh;
  font-family: 'DM Mono', monospace;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
}
 
/* ── Header ───────────────────────────────────────────────── */
header {
  width: 100%;
  padding: 0;
  text-align: center;
  border-bottom: 1px solid rgba(201,162,39,0.25);
  background: var(--felt-dark);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ── Top bar: account + leaderboard ──────────────────────── */
.header-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.2);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Leaderboard button */
.topbar-leaderboard-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-light);
  background: rgba(201,162,39,0.08);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.topbar-leaderboard-btn:hover {
  background: rgba(201,162,39,0.15);
  border-color: rgba(201,162,39,0.55);
}
.topbar-leaderboard-btn .btn-icon { font-size: 0.85rem; }

/* Account button */
.topbar-account-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mid);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.topbar-account-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  color: var(--ink);
}
.topbar-account-btn .btn-icon { font-size: 0.9rem; }

/* Avatar placeholder (for when logged in) */
.topbar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--felt-light), var(--gold));
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--bg);
  flex-shrink: 0;
}

/* ── Header branding (center section) ────────────────────── */
.header-brand {
  padding: 20px 0 18px;
  position: relative;
}

.header-brand::after {
  content: '♠  ♥  ♦  ♣';
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--felt-dark);
  padding: 0 14px;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--ink-faint);
}
 
.site-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}
 
.site-title span {
  color: var(--gold-light);
}
 
.site-subtitle {
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 6px;
}
 
/* ── Page ─────────────────────────────────────────────────── */
.page {
  width: 100%;
  max-width: 680px;
  padding: 52px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
 
/* ── Date line ────────────────────────────────────────────── */
.date-line {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.date-line::before, .date-line::after {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--ink-faint);
  opacity: 0.3;
}
 
/* ── Felt Table ───────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  background: var(--felt);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 40%, var(--felt-light) 0%, var(--felt) 60%, var(--felt-dark) 100%);
  border-radius: 200px / 120px;
  padding: 44px 32px 48px;
  position: relative;
  box-shadow:
    inset 0 2px 16px rgba(0,0,0,0.5),
    inset 0 -2px 8px rgba(255,255,255,0.03),
    0 8px 48px rgba(0,0,0,0.7),
    0 2px 4px rgba(0,0,0,0.4),
    0 0 0 1px rgba(201,162,39,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}
 
.table-wrap::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 190px / 110px;
  border: 1px solid rgba(255,255,255,0.06);
  pointer-events: none;
}

.table-wrap::after {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 185px / 105px;
  border: 1px solid rgba(201,162,39,0.06);
  pointer-events: none;
}
 
/* ── Card Hand ────────────────────────────────────────────── */
.hand {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
}
 
/* ── Card ─────────────────────────────────────────────────── */
.card-wrap {
  perspective: 600px;
  width: 88px;
  height: 132px;
  flex-shrink: 0;
}
 
.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0.2, 0.2, 1.1);
}
 
.card-inner.flipped {
  transform: rotateY(180deg);
}
 
.card-face, .card-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
 
/* Back of card */
.card-back {
  background: #f5f0e4;
  border: 1px solid #d8ceb8;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
 
.card-back-pattern {
  width: calc(100% - 10px);
  height: calc(100% - 10px);
  border-radius: 7px;
  border: 1px solid #c8b89a;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 5px,
      rgba(26, 61, 38, 0.18) 5px,
      rgba(26, 61, 38, 0.18) 6px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 5px,
      rgba(26, 61, 38, 0.12) 5px,
      rgba(26, 61, 38, 0.12) 6px
    ),
    #e8e0cc;
  display: flex;
  align-items: center;
  justify-content: center;
}
 
.card-back-emblem {
  font-size: 1.6rem;
  opacity: 0.45;
  color: var(--felt-dark);
}
 
/* Front of card */
.card-face {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.3);
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 7px;
  user-select: none;
}
 
.card-face.red  { color: #c0392b; }
.card-face.black { color: #1a1410; }
 
.card-corner { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.card-corner.bot { align-self: flex-end; transform: rotate(180deg); }
.card-rank { font-family: 'Fraunces', serif; font-size: 1.1rem; font-weight: 700; }
.card-suit-sm { font-size: 0.8rem; }
.card-center { display: flex; align-items: center; justify-content: center; flex: 1; font-size: 2rem; }
 
/* Highlight ring on card */
.card-wrap.highlighted .card-face {
  box-shadow: 0 0 0 2.5px var(--gold), 0 4px 14px rgba(0,0,0,0.5);
}
 
/* ── Deal prompt ──────────────────────────────────────────── */
#deal-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
 
.deal-btn {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--gold-light);
  border: 2px solid var(--gold);
  padding: 12px 36px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.4);
}
.deal-btn:hover {
  background: var(--gold);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.4);
  transform: translate(-1px,-1px);
}
.deal-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 rgba(0,0,0,0.4); }
 
.deal-note {
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
}
 
/* ── Score area (below table) ─────────────────────────────── */
#score-area {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  width: 100%;
}
 
.score-label {
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
 
.score-value {
  font-family: 'Fraunces', serif;
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
  transition: all 0.3s;
}
 
.score-value .pts-unit {
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--ink-faint);
  margin-left: 4px;
}
 
/* ── Achievements list ────────────────────────────────────── */
#achievements-area {
  width: 100%;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
 
.achievement-card {
  background: var(--cream);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 16px 18px 14px;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 6px;
 
  /* Entry animation */
  animation: slideIn 0.4s cubic-bezier(0.22,1,0.36,1) both;
  opacity: 0;
}
 
@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
 
.ach-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
 
.ach-name {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
}
 
.ach-pts {
  font-family: 'Fraunces', serif;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--gold-light);
}
 
.ach-desc {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--ink-mid);
  line-height: 1.4;
}
 
.ach-detail {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-style: italic;
  margin-top: 2px;
}
 
/* Rarity stripe on left */
.achievement-card[data-rarity="common"]    { border-left: 4px solid var(--common); }
.achievement-card[data-rarity="uncommon"]  { border-left: 4px solid var(--uncommon); }
.achievement-card[data-rarity="rare"]      { border-left: 4px solid var(--rare); }
.achievement-card[data-rarity="epic"]      { border-left: 4px solid var(--epic); }
.achievement-card[data-rarity="legendary"] { border-left: 4px solid var(--legendary); background: #1e1c0e; }
 
/* Rarity badge */
.ach-rarity {
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  font-weight: 500;
  align-self: flex-start;
}
.achievement-card[data-rarity="common"]    .ach-rarity { background: rgba(138,171,138,0.12); color: var(--common); }
.achievement-card[data-rarity="uncommon"]  .ach-rarity { background: rgba(91,159,212,0.12);  color: var(--uncommon); }
.achievement-card[data-rarity="rare"]      .ach-rarity { background: rgba(176,125,232,0.12); color: var(--rare); }
.achievement-card[data-rarity="epic"]      .ach-rarity { background: rgba(224,82,82,0.12);   color: var(--epic); }
.achievement-card[data-rarity="legendary"] .ach-rarity { background: rgba(201,162,39,0.14);  color: var(--legendary); }
 
/* Mini card pip highlights */
.ach-highlights {
  display: flex;
  gap: 5px;
  margin-top: 4px;
  flex-wrap: wrap;
}
 
.pip {
  font-family: 'Fraunces', serif;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1.5px solid currentColor;
  line-height: 1.3;
}
.pip.red   { color: #e05252; background: rgba(224,82,82,0.1); }
.pip.black { color: var(--ink); background: rgba(232,224,204,0.07); }
 
/* ── Share section ────────────────────────────────────────── */
#share-section {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 36px;
  padding-top: 32px;
  border-top: 1.5px dashed rgba(255,255,255,0.1);
  width: 100%;
}
 
.share-label {
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
 
.share-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  background: var(--bg-warm);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 14px 18px;
  width: 100%;
  text-align: center;
  color: var(--ink-mid);
  white-space: pre-wrap;
  line-height: 1.5;
}
 
.share-btn {
  font-family: 'Fraunces', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--gold-light);
  border: 2px solid var(--gold);
  padding: 11px 32px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
}
.share-btn:hover { background: var(--gold); transform: translate(-1px,-1px); box-shadow: 4px 4px 0 rgba(0,0,0,0.3); }
.share-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 rgba(0,0,0,0.3); }
 
.share-copied {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--common);
  opacity: 0;
  transition: opacity 0.3s;
}
.share-copied.show { opacity: 1; }
 
/* ── Animations ───────────────────────────────────────────── */
@keyframes scoreUp {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.08); color: var(--gold-light); }
  100% { transform: scale(1); }
}
.score-bump { animation: scoreUp 0.35s ease; }

/* ── Leaderboard modal (placeholder) ─────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--felt-dark);
  border: 1px solid rgba(201,162,39,0.25);
  border-radius: 8px;
  padding: 32px 28px;
  width: min(480px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  position: relative;
  animation: slideIn 0.3s cubic-bezier(0.22,1,0.36,1) both;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--ink); }

.modal-title {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 24px;
}

.modal-placeholder {
  font-size: 0.75rem;
  color: var(--ink-faint);
  text-align: center;
  padding: 32px 0;
  line-height: 1.6;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 4px;
}
