* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.pagina {
  display: none;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.pagina.aktief {
  display: flex;
}

#main-menu,
#settings,
#rules,
#play,
#join,
#create-lobby {
  justify-content: center;
  align-items: center;
}

/* ── SHARED BACKGROUND (all non-game screens) ── */
#main-menu,
#settings,
#rules,
#play,
#join,
#create-lobby,
#lobby {
  background-color: var(--navy);
  background-image:
    linear-gradient(45deg, rgba(201, 168, 76, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(201, 168, 76, 0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(201, 168, 76, 0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(201, 168, 76, 0.04) 75%);
  background-size: 40px 40px;
  background-position: 0 0, 0 20px, 20px -20px, -20px 0px;
  font-family: 'Crimson Pro', Georgia, serif;
  color: var(--text-primary);
}

/* ── MENU CARD (the panel) ── */
.menu-kaart {
  background: linear-gradient(160deg, var(--felt) 0%, #061a0e 100%);
  border: 1px solid rgba(201, 168, 76, 0.5);
  box-shadow: var(--shadow-deep), var(--shadow-gold), inset 0 1px 0 rgba(201, 168, 76, 0.15);
  border-radius: var(--radius);
  width: 320px;
  height: 500px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.menu-kaart h1 {
  font-size: 2rem;
  font-family: 'Playfair Display', Georgia, serif;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
}

.avatar-cirkel {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  border: 2px solid var(--gold);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.2);
  transition: all 0.2s ease;
}

.avatar-cirkel:hover {
  border-color: var(--gold-light);
  box-shadow: var(--shadow-gold);
  transform: translateY(-2px);
}

.menu-knoppen {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  flex: 1;
  justify-content: center;
}

.menu-knoppen button {
  width: 100%;
  padding: 0.65rem;
  font-size: 1rem;
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  color: var(--gold-light);
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.menu-knoppen button:hover {
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: var(--navy);
  border-color: var(--gold-light);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

/* ── SETTINGS ── */
#settings {
  position: relative;
}

.slider-rij {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.slider-rij label {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 0.95rem;
  width: 60px;
  color: var(--text-secondary);
}

.slider-rij input[type="range"] {
  flex: 1;
  accent-color: var(--gold);
}

.kaart-footer {
  width: 100%;
  margin-top: auto;
  padding-top: 12px;
}

.back-knop {
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  border: 1px solid var(--gold);
  border-radius: 20px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--gold-light);
  padding: 6px 20px;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.back-knop:hover {
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: var(--navy);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

/* ── RULES ── */
#rules {
  position: relative;
}

#rules .menu-kaart {
  width: 620px;
}

.rules-inhoud {
  overflow-y: auto;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.rules-inhoud::-webkit-scrollbar {
  width: 6px;
}

.rules-inhoud::-webkit-scrollbar-track {
  background: var(--navy-mid);
}

.rules-inhoud::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 3px;
}

.rules-inhoud p {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ── SPELER NAAM ── */
.speler-naam {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: -8px;
}

/* ── NAAM WIJZIGEN ── */
.naam-rij {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.naam-rij label {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  width: 60px;
  color: var(--text-secondary);
}

.naam-invoer-rij {
  display: flex;
  flex: 1;
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
}

.naam-invoer-rij input {
  flex: 1;
  padding: 5px 10px;
  font-size: 14px;
  font-family: 'Crimson Pro', Georgia, serif;
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 4px;
  outline: none;
  min-width: 0;
  max-width: 100%;
  background: rgba(10, 20, 35, 0.8);
  color: var(--text-primary);
}

.naam-invoer-rij input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.2);
}

.naam-invoer-rij button {
  padding: 5px 12px;
  font-size: 14px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  color: var(--gold-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.naam-invoer-rij button:hover {
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: var(--navy);
  box-shadow: var(--shadow-gold);
}

/* ── PLAY ── */
#play {
  position: relative;
}

/* ── CREATE LOBBY ── */
#create-lobby {
  position: relative;
}

.create-rij {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.create-rij label {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  width: 55px;
  color: var(--text-secondary);
}

.create-rij input {
  flex: 1;
  padding: 5px 10px;
  font-size: 14px;
  font-family: 'Crimson Pro', Georgia, serif;
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 4px;
  outline: none;
  min-width: 0;
  background: rgba(10, 20, 35, 0.8);
  color: var(--text-primary);
}

.create-rij input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.2);
}

.code-rij {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.lobby-code {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 4px;
  color: var(--gold-light);
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
}

.code-rij button {
  padding: 4px 10px;
  font-size: 14px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  color: var(--gold-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.code-rij button:hover {
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: var(--navy);
  box-shadow: var(--shadow-gold);
}

.create-spacer {
  flex: 1;
}

.mode-knoppen {
  display: flex;
  gap: 10px;
  width: 100%;
}

.mode-knop {
  flex: 1;
  padding: 8px;
  font-size: 14px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-knop:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.mode-knop.aktief-mode {
  background: linear-gradient(135deg, var(--gold), #8a6020);
  color: var(--navy);
  border-color: var(--gold-light);
  box-shadow: var(--shadow-gold);
}

.create-btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  color: var(--gold-light);
  cursor: pointer;
  margin-top: 4px;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.create-btn:hover {
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: var(--navy);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

/* ── JOIN ── */
#join {
  position: relative;
}

.code-display {
  width: 100%;
  text-align: center;
  padding: 10px 0;
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 6px;
  background: rgba(10, 20, 35, 0.8);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 6px;
  color: var(--gold-light);
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.num-knop {
  padding: 14px;
  font-size: 18px;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.num-knop:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.num-delete {
  background: linear-gradient(135deg, #3a0a0a, #200505);
  border-color: rgba(180, 30, 30, 0.5);
  color: #e07070;
}

.num-delete:hover {
  background: linear-gradient(135deg, var(--crimson), #5a0f0f);
  color: white;
  border-color: #d44;
  box-shadow: 0 0 16px rgba(180, 30, 30, 0.4);
}

.num-confirm {
  background: linear-gradient(135deg, #0a3a15, #051a08);
  border-color: rgba(46, 160, 80, 0.5);
  color: #70c090;
}

.num-confirm:hover {
  background: linear-gradient(135deg, #1a7a3a, #0a4a18);
  color: white;
  border-color: #4caf76;
  box-shadow: 0 0 16px rgba(46, 160, 80, 0.4);
}

/* ── LOBBY ── */
#lobby {
  width: 100vw;
  height: 100vh;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 40px 60px 20px;
  overflow: hidden;
}

.lobby-code-badge {
  position: absolute;
  top: 16px;
  right: 20px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  border: 1px solid var(--gold);
  border-radius: 20px;
  padding: 5px 14px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 3px;
  color: var(--gold-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.lobby-code-badge:hover {
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: var(--navy);
  box-shadow: var(--shadow-gold);
}

.lobby-code-copy {
  font-size: 14px;
}

/* Speler layout */
.lobby-top,
.lobby-onder {
  display: flex;
  justify-content: center;
  width: 100%;
  padding-top: 20px;
}

.lobby-midden {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  flex: 1;
  gap: 200px;
}

.lobby-links,
.lobby-rechts {
  display: flex;
  align-items: center;
}

.lobby-center {
  flex: 1;
}

.speler-kaart {
  background: linear-gradient(160deg, var(--felt) 0%, #061a0e 100%);
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: var(--radius);
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(201, 168, 76, 0.1);
  width: 120px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Knoppen onderaan */
.lobby-knoppen {
  width: 100%;
}

#host-knoppen,
#speler-knoppen {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

#speler-knoppen {
  justify-content: flex-start;
}

.lobby-knop {
  padding: 10px 28px;
  font-size: 14px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  color: var(--gold-light);
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.lobby-knop:hover {
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: var(--navy);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

/* ── LOBBY NAAM ── */
.lobby-naam-titel {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 26px;
  font-weight: bold;
  color: var(--gold-light);
  letter-spacing: 3px;
  white-space: nowrap;
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
}

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Crimson+Pro:wght@400;600&display=swap');

/* ─────────────────────────────────────────────
   CSS VARIABLES (global, safe to keep unscoped)
───────────────────────────────────────────── */
:root {
  --navy: #0d1b2a;
  --navy-mid: #112236;
  --navy-light: #1a3350;
  --felt: #0a2e1a;
  --felt-light: #0d3d22;
  --gold: #c9a84c;
  --gold-light: #e8c96a;
  --crimson: #8b1a1a;
  --crimson-light: #b02020;
  --card-red: #d63030;
  --card-blue: #1a5fa8;
  --card-green: #1a7a3a;
  --card-yellow: #c9a020;
  --text-primary: #f0e6d3;
  --text-secondary: #a89880;
  --text-dim: #6a5c50;
  --shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-gold: 0 0 20px rgba(201, 168, 76, 0.3);
  --radius: 10px;
}

/* ─────────────────────────────────────────────
   MATCH PAGE ONLY — all rules scoped under #match
───────────────────────────────────────────── */

#match {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--navy);
  background-image:
    linear-gradient(45deg, rgba(201, 168, 76, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(201, 168, 76, 0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(201, 168, 76, 0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(201, 168, 76, 0.04) 75%);
  background-size: 40px 40px;
  background-position: 0 0, 0 20px, 20px -20px, -20px 0px;
  font-family: 'Crimson Pro', Georgia, serif;
  color: var(--text-primary);
}

#match header {
  background: linear-gradient(135deg, var(--crimson) 0%, #5a0f0f 100%);
  border-bottom: 2px solid var(--gold);
  padding: 8px 0;
  min-height: 40px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: visible;
}

#match header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg,
      transparent,
      transparent 40px,
      rgba(255, 255, 255, 0.02) 40px,
      rgba(255, 255, 255, 0.02) 41px);
  pointer-events: none;
}

#match .infoList {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  list-style-type: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

#match .infoList li:nth-child(1) {
  justify-self: start;
  align-content: center;
}

#match .infoList li:nth-child(2) {
  justify-self: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--gold-light);
  text-align: center;
}

#match .infoList li:nth-child(2) ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#match .infoList li:nth-child(3) {
  justify-self: end;
  margin-right: 12px;
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  color: var(--gold-light);
}

#match #MyScore {
  color: white;
  font-weight: 700;
}

#match .infoButtons {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
}

#match .infoButtons li {
  list-style: none;
}

#match button {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  font-weight: 600;
  height: auto;
  padding: 4px 10px;
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
  color: var(--gold-light);
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#match button:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: var(--navy);
  border-color: var(--gold-light);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

#match button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

#match button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--text-dim);
  color: var(--text-dim);
}

#match .topArea {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 6px 0;
}

#match .buttons {
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-self: start;
  margin-left: 10px;
}

#match .TurnWho {
  justify-self: end;
  margin-right: 10px;
  text-align: right;
}

#match .TurnWho p {
  margin: 0;
  font-family: 'Playfair Display', serif;
}

#match #TurnText {
  font-size: 15px;
  color: var(--gold-light);
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.5);
}

#match #PhaseText {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

#match .OpponentArea {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

#match .OpponentName {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Outer wrapper: absolutely positioned on left/right edge, centred vertically */
#match .sideOpponent {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

#OpponentLeft {
  left: 10px;
}

#OpponentRight {
  right: 10px;
}

/* Inner wrapper: laid out like the top opponent, then rotated 90° */
#OpponentLeft .sideOpponentInner {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
  transform-origin: center center;
  transform: rotate(90deg);
}

#OpponentRight .sideOpponentInner {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
  transform-origin: center center;
  transform: rotate(-90deg);
}

/* Hand: cards overlap left-to-right (same as top opponent), just rotated with the parent */
#LeftOppHand,
#RightOppHand {
  flex-direction: row;
}

#LeftOppHand .card,
#RightOppHand .card {
  margin-top: 0;
  margin-left: -40px;
}

#LeftOppHand .card:first-child,
#RightOppHand .card:first-child {
  margin-left: 0;
}

/* Side combo area: matches the top opponent Combinations box, rotates with parent */
#match .sideComboList {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 30px;
  overflow: visible;
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: var(--radius);
  background: rgba(10, 20, 35, 0.6);
  backdrop-filter: blur(4px);
  padding: 8px;
  width: 300px;
  min-height: 150px;
}

#match .OpponentHand,
#match .MyHand {
  display: flex;
}

#match .OpponentHand .card,
#match .MyHand .myCard {
  position: relative;
  margin-left: -40px;
}

#match .MyHand .myCard:first-child,
#match .OpponentHand .card:first-child {
  margin-left: 0;
}

#match .card img,
#match .myCard img {
  height: 15vh;
  width: auto;
  border-radius: 6px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

#match .myCard {
  cursor: grab;
  transition: transform 0.15s ease, z-index 0s;
}

#match .myCard:hover {
  z-index: 100;
  transform: translateY(-8px);
}

#match .myCard:active {
  cursor: grabbing;
}

#match .take {
  height: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

#match .Deck {
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease;
}

#match .Deck:hover {
  transform: translateY(-4px);
}

#match .DiscardPile {
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease;
}

#match .DiscardPile:hover {
  transform: translateY(-4px);
}

#match .DiscardPile .myCard {
  position: absolute;
  top: 0;
  left: 0;
}

#match .Combinations {
  width: 40%;
  height: 200px;
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: var(--radius);
  align-self: center;
  display: flex;
  flex-direction: column;
  background: rgba(10, 20, 35, 0.6);
  backdrop-filter: blur(4px);
  padding: 8px;
}

#match .Combinations button {
  margin-top: auto;
  align-self: center;
  margin-bottom: 6px;
}

#match .comboList {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  overflow-y: auto;
}

#match .combo {
  display: flex;
  align-items: center;
}

#match .combo .card {
  width: 90px;
  height: 130px;
  position: relative;
  margin-left: -40px;
}

#match .combo .card:hover {
  z-index: 100;
}

#match .combo .card:first-child {
  margin-left: 0;
}

#match .MyHand {
  height: 20%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#match #NextRoundBtn {
  display: flex;
  justify-content: center;
  padding: 8px;
}

#match #nextRoundBtn {
  background: linear-gradient(135deg, var(--card-green), #0a4a18);
  border-color: #4caf76;
  color: white;
  font-size: 15px;
  padding: 8px 24px;
  border-radius: 25px;
  letter-spacing: 1px;
}

#match #nextRoundBtn:hover {
  background: linear-gradient(135deg, #2ecc71, #1a8a40);
  color: white;
  box-shadow: 0 0 20px rgba(46, 204, 113, 0.4);
}

#match .Popup {
  width: 340px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 24px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--felt) 0%, #061a0e 100%);
  border: 1px solid rgba(201, 168, 76, 0.5);
  box-shadow: var(--shadow-deep), var(--shadow-gold), inset 0 1px 0 rgba(201, 168, 76, 0.2);
  z-index: 1000;
  color: var(--text-primary);
}

#match .Popup h2 {
  font-family: 'Playfair Display', serif;
  color: var(--gold-light);
  font-size: 20px;
  margin: 0 0 16px 0;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.3);
  padding-bottom: 10px;
}

#match .Popup h3 {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 14px;
  margin: 14px 0 6px 0;
  letter-spacing: 0.5px;
}

#match .Popup p,
#match .Popup li {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 4px 0;
}

#match .Popup ul {
  padding-left: 16px;
  margin: 6px 0;
}

#match #ESCPopup {
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

#match #ESCPopup button {
  width: 100%;
  padding: 8px;
  font-size: 14px;
}

#match #LeaveBtn {
  background: linear-gradient(135deg, var(--crimson), #5a0f0f);
  border-color: #d44;
  color: white;
}

#match #LeaveBtn:hover {
  background: linear-gradient(135deg, var(--crimson-light), var(--crimson));
  color: white;
  box-shadow: 0 0 16px rgba(180, 30, 30, 0.5);
}

#match #MakeComboPopup {
  width: 820px;
  max-width: 95vw;
}

#match #comboArea {
  display: flex;
  justify-content: space-between;
  margin: 20px 0;
  gap: 8px;
}

#match .cardSlot {
  width: 90px;
  height: 130px;
  background: rgba(10, 30, 20, 0.8);
  border: 2px dashed rgba(201, 168, 76, 0.4);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-dim);
  transition: all 0.2s;
}

#match .cardSlot:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201, 168, 76, 0.05);
  box-shadow: inset 0 0 12px rgba(201, 168, 76, 0.1);
}

#match .cardSlot.filled {
  border-style: solid;
  border-color: var(--gold);
  color: white;
}

#match #confirmComboBtn {
  margin-top: 8px;
  padding: 10px 28px;
  background: linear-gradient(135deg, var(--gold), #8a6020);
  border: none;
  border-radius: 25px;
  color: var(--navy);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.3);
}

#match #confirmComboBtn:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.5);
  transform: translateY(-1px);
}

#match #ScorePopup {
  width: 380px;
  text-align: center;
}

#match #ScorePopupTitle {
  font-size: 24px;
}

#match #ScorePopupResult {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.2);
}

#match #closeScorePopup {
  margin-top: 14px;
  width: 100%;
  padding: 8px;
}

#match #WaitingPopup {
  width: 280px;
  text-align: center;
}

#match #GameOverPopup {
  width: 380px;
  text-align: center;
}

#match #GameOverResult {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.2);
}

#match #TabPopup {
  width: 320px;
}

#match #JokerSwapPopup {
  width: 500px;
  max-width: 95vw;
}

#match #JokerSwapHand {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}

#match #cancelJokerSwap {
  width: 100%;
  padding: 8px;
  margin-top: 6px;
}

#match .rulesTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
}

#match .rulesTable th,
#match .rulesTable td {
  border: 1px solid rgba(201, 168, 76, 0.2);
  padding: 5px 8px;
  text-align: left;
}

#match .rulesTable th {
  background: rgba(201, 168, 76, 0.15);
  color: var(--gold-light);
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.5px;
}

#match .rulesTable tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.03);
}

#match .joker-swappable {
  cursor: pointer;
}

#match .joker-swappable img {
  outline: 2px solid var(--gold);
  border-radius: 6px;
}

#match .joker-swappable:hover img {
  outline: 3px solid var(--gold-light);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
}

#match .selectable {
  cursor: pointer;
  border-radius: 6px;
  transition: transform 0.1s;
}

#match .selectable:hover {
  outline: 2px solid #2ecc71;
  transform: translateY(-4px);
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.3);
}

#match .hidden {
  display: none !important;
}

/* ── Invalid Action Popup ─────────────────────────── */
#match #InvalidActionPopup {
  width: 320px;
  text-align: center;
}

#match #InvalidActionPopup p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border: 1px solid rgba(180, 30, 30, 0.35);
}

#match #closeInvalidAction {
  padding: 8px 32px;
  background: linear-gradient(135deg, var(--gold), #8a6020);
  border: none;
  border-radius: 25px;
  color: var(--navy);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.3);
}

#match #closeInvalidAction:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.5);
  transform: translateY(-1px);
}

/* ── Confirm Action Popup ─────────────────────────── */
#match #ConfirmActionPopup {
  width: 360px;
  text-align: center;
}

#match #ConfirmActionPopup p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.2);
}

#match .confirm-popup-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

#match #confirmActionYes {
  padding: 8px 24px;
  background: linear-gradient(135deg, var(--gold), #8a6020);
  border: none;
  border-radius: 25px;
  color: var(--navy);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.3);
}

#match #confirmActionYes:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.5);
  transform: translateY(-1px);
}

#match #confirmActionNo {
  padding: 8px 24px;
  background: linear-gradient(135deg, var(--crimson), #5a0f0f);
  border: 1px solid #d44;
  border-radius: 25px;
  color: white;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

#match #confirmActionNo:hover {
  background: linear-gradient(135deg, var(--crimson-light), var(--crimson));
  box-shadow: 0 0 16px rgba(180, 30, 30, 0.5);
  transform: translateY(-1px);
}

/* ── Extend Combo Popup ───────────────────────────── */
#match #ExtendComboPopup {
  width: 520px;
  max-width: 95vw;
}

#match #ExtendComboPreview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  min-height: 90px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(201, 168, 76, 0.35);
  border-radius: 8px;
  margin: 10px 0;
}

#match #ExtendComboHand {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 18px;
}

#match #ExtendComboHand .card {
  cursor: pointer;
  transition: transform 0.15s;
}

#match #ExtendComboHand .card:hover {
  transform: translateY(-5px);
}

#match #ExtendComboHand .card.selected-for-extend {
  outline: 2px solid #2ecc71;
  border-radius: 6px;
  transform: translateY(-6px);
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.35);
}

#match .extend-popup-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}

#match #confirmExtendCombo {
  padding: 8px 24px;
  background: linear-gradient(135deg, var(--gold), #8a6020);
  border: none;
  border-radius: 25px;
  color: var(--navy);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.3);
}

#match #confirmExtendCombo:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.5);
  transform: translateY(-1px);
}

#match #cancelExtendCombo {
  padding: 8px 24px;
  background: transparent;
  border: 1px solid rgba(201, 168, 76, 0.5);
  border-radius: 25px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

#match #cancelExtendCombo:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

/* ── Extend button on own combo ───────────────────── */
#match .combo-extend-btn {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 3px 0;
  background: linear-gradient(135deg, var(--gold), #8a6020);
  border: none;
  border-radius: 4px;
  color: var(--navy);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.25);
}

#match .combo-extend-btn:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 2px 14px rgba(201, 168, 76, 0.45);
}

#match ::-webkit-scrollbar {
  width: 6px;
}

#match ::-webkit-scrollbar-track {
  background: var(--navy-mid);
}

#match ::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 3px;
}

#match ::-webkit-scrollbar-thumb:hover {
  background: var(--gold-light);
}