/* Shithead – Neon-Arcade-Variante (Grün/Filz-Akzent). */

:root {
  --bg:       #0a0a14;
  --bg-2:     #0c241a;
  --fg:       #e9f2ec;
  --muted:    #8fb6a3;
  --accent:   #3aa86b;
  --accent-2: #6fe6a6;
  --card-bg:  #f6f4ee;
  --card-ink: #1a1a1a;
  --red:      #d23b4e;
  --board-bg: rgba(255, 255, 255, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: radial-gradient(900px 500px at 50% -10%, var(--bg-2), var(--bg) 60%);
  color: var(--fg); font: 16px/1.5 ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; align-items: center;
  overscroll-behavior: none;
}
.bg-grid {
  position: fixed; inset: 0; z-index: -1;
  background-image: linear-gradient(rgba(58, 168, 107, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(111, 230, 166, 0.05) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(800px 460px at 50% 0%, #000 30%, transparent 80%);
}

.top { width: 100%; max-width: 520px; padding: 1rem 1.1rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.back { color: var(--muted); text-decoration: none; font-weight: 600; letter-spacing: 0.03em; }
.back:hover { color: var(--accent); }
.wrap { width: 100%; max-width: 520px; padding: 0.4rem 1.1rem 2.5rem; display: flex; flex-direction: column; align-items: center; }
.game-title {
  margin: 0.3rem 0 0.6rem; font-size: clamp(1.8rem, 7vw, 2.5rem); font-weight: 900; letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(58, 168, 107, 0.4));
}
.btn {
  font: inherit; font-weight: 700; color: var(--fg); background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; padding: 0.5rem 1rem; cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-primary { border-color: transparent; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #08160e; box-shadow: 0 8px 24px -10px var(--accent); }

/* Karten */
.card {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 2.5rem; height: 3.3rem; border-radius: 8px; background: var(--card-bg); color: var(--card-ink);
  border: 1px solid rgba(0, 0, 0, 0.25); box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.6); user-select: none;
}
.card .c-rank { font-size: 1.05rem; font-weight: 900; line-height: 1; }
.card .c-suit { font-size: 0.9rem; line-height: 1; }
.card.s-heart, .card.s-diamond { color: var(--red); }
.card.s-club, .card.s-spade { color: #1a1a1a; }
.card .sp { position: absolute; bottom: 1px; right: 2px; font-size: 0.5rem; line-height: 1; font-style: normal; color: #2a7a4e; }
.card.mini .sp { font-size: 0.42rem; bottom: 0; right: 1px; }
.card.big .sp { font-size: 0.72rem; bottom: 3px; right: 4px; }
.card.mini { width: 1.7rem; height: 2.3rem; border-radius: 6px; }
.card.mini .c-rank { font-size: 0.78rem; } .card.mini .c-suit { font-size: 0.62rem; }
.card.big { width: 3.4rem; height: 4.5rem; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.7), 0 0 22px -8px var(--accent); }
.card.big .c-rank { font-size: 1.5rem; } .card.big .c-suit { font-size: 1.2rem; }
.card-back {
  background: repeating-linear-gradient(45deg, #14463a, #14463a 5px, #0e3329 5px, #0e3329 10px);
  border: 1px solid rgba(111, 230, 166, 0.25);
}
.card-back::after { content: ""; position: absolute; inset: 4px; border: 1px solid rgba(111, 230, 166, 0.18); border-radius: 5px; }

.card--ok { cursor: pointer; outline: 2px solid transparent; }
.card--ok:hover { transform: translateY(-5px); box-shadow: 0 8px 18px -6px var(--accent); }
.card--sel { transform: translateY(-8px); outline: 2px solid var(--accent-2); box-shadow: 0 0 0 2px var(--accent), 0 8px 20px -6px var(--accent); }
.card--dim { opacity: 0.45; }
.card--swap { cursor: pointer; }
.card--swap:hover { outline: 2px solid var(--accent); }

/* Gegner */
.opponents { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 0.8rem; }
.opp { padding: 0.45rem 0.4rem; border-radius: 10px; background: var(--board-bg); border: 1px solid rgba(255, 255, 255, 0.08); }
.opp--turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px -6px var(--accent); }
.opp--out { opacity: 0.5; }
.opp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.3rem; margin-bottom: 0.3rem; }
.opp-name { font-weight: 800; font-size: 0.82rem; }
.opp-counts { font-size: 0.66rem; color: var(--muted); white-space: nowrap; }
.opp-up { display: flex; gap: 0.2rem; justify-content: center; min-height: 2.3rem; }
.opp-up .none, .none { color: var(--muted); font-size: 0.8rem; }

/* Mitte: Nachzieh + Ablage */
.center { width: 100%; display: flex; align-items: center; justify-content: center; gap: 1.6rem; min-height: 5rem; margin: 0.3rem 0; }
.deck, .pile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.deck-n { font-size: 0.72rem; color: var(--muted); font-weight: 700; }
.deck-empty, .pile-empty { color: var(--muted); font-size: 0.8rem; }
.pile-n { font-size: 0.72rem; color: var(--muted); }

.msg { width: 100%; text-align: center; color: var(--muted); font-size: 0.9rem; min-height: 1.3em; margin: 0.4rem 0; }

/* Eigene Tischkarten (verdeckt + offen gestapelt) */
.mytable { width: 100%; text-align: center; margin-top: 0.3rem; }
.mylabel { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 800; }
.table-cards { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.3rem; min-height: 3.5rem; }
.stack { position: relative; display: inline-block; width: 2.5rem; height: 3.6rem; }
.stack .card-back { position: absolute; inset: 0; }
.stack .card.over { position: absolute; left: 0; top: 0.3rem; }

/* Hand */
.hand { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.3rem; min-height: 3.4rem; margin-top: 0.9rem; }

/* Aktionen */
.actions { min-height: 2.6rem; display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-top: 0.6rem; }
.act-hint { color: var(--muted); font-size: 0.85rem; }

/* Overlay / Ergebnis */
.overlay { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(8, 8, 16, 0.78); backdrop-filter: blur(4px); animation: fade-in 0.2s ease; }
.overlay[hidden] { display: none; }
.overlay-card { position: relative; width: 100%; max-width: 360px; text-align: center; background: linear-gradient(180deg, var(--bg-2), var(--bg)); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 16px; padding: 1.4rem 1.3rem; box-shadow: 0 24px 70px -20px #000, 0 0 50px -22px var(--accent); }
.overlay-close { position: absolute; top: 0.6rem; right: 0.6rem; width: 1.9rem; height: 1.9rem; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.05); color: var(--muted); font-size: 0.9rem; font-weight: 800; cursor: pointer; line-height: 1; }
.overlay-close:hover { color: var(--fg); border-color: var(--accent); }
.overlay-title { margin: 0 0 0.3rem; font-size: clamp(1.4rem, 6vw, 1.9rem); font-weight: 900; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.overlay-sub { margin: 0 0 0.8rem; color: var(--muted); }
.result { margin: 0.6rem 0 0.8rem; }
.res-row { display: flex; justify-content: center; padding: 0.28rem 0.6rem; border-radius: 8px; font-weight: 700; }
.res-row--me { background: rgba(58, 168, 107, 0.18); color: var(--fg); }
.streak { margin: 0.2rem 0 1rem; color: var(--muted); font-size: 0.9rem; }
.streak b { color: var(--accent-2); }
.lb-form { margin: 0.3rem 0 1rem; }
.lb-form-label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--accent); margin-bottom: 0.4rem; }
.lb-form-row { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
#sh-name { flex: 1; min-width: 7rem; font: inherit; font-weight: 700; color: var(--fg); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 10px; padding: 0.55rem 0.7rem; }
#sh-name:focus { outline: none; border-color: var(--accent); }
.lb-result { margin: 0 0 0.6rem; font-weight: 800; color: var(--accent); }
.overlay-actions { display: flex; gap: 0.7rem; justify-content: center; }

/* Bestenliste */
.leaderboard { width: 100%; max-width: 520px; margin-top: 1.4rem; }
.lb-title { margin: 0 0 0.2rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.lb-sub { margin: 0 0 0.7rem; font-size: 0.8rem; color: var(--muted); }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-empty { color: var(--muted); font-size: 0.9rem; padding: 0.4rem 0; }
.lb-row { display: grid; grid-template-columns: 2.6rem 1fr auto; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; margin-bottom: 0.35rem; border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 10px; background: var(--board-bg); }
.lb-rank { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.lb-row--me { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 22px -10px var(--accent); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .overlay { animation: none; } .card--ok:hover { transform: none; } }
