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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: radial-gradient(ellipse at center, #1d6b3a 0%, #124a26 100%);
  color: #f0ede4;
  min-height: 100vh;
}

h1 { text-align: center; padding: 1.5rem 0 0.1rem; text-shadow: 0 2px 6px rgba(0,0,0,.4); letter-spacing: 0.5px; }
h2 { font-size: 1.05rem; margin: 1rem 0 0.4rem; }
.tagline { text-align: center; color: rgba(240,237,228,.6); font-size: 0.9rem; margin-bottom: 0.4rem; }
.muted { color: rgba(240, 237, 228, 0.65); font-size: 0.85rem; }
.muted a { color: inherit; }
.center { text-align: center; }
.hidden { display: none !important; }
.invite-line { margin: 0.6rem 0 0.2rem; }

/* ---- panels & forms ---- */

.view { max-width: 960px; margin: 0 auto; padding: 0.5rem; }

.panel {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 1.2rem;
  max-width: 420px;
  margin: 1rem auto;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

label { display: block; margin: 0.7rem 0 0.2rem; font-size: 0.9rem; }

input, select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.92);
  color: #222;
  font-size: 1rem;
}
select { cursor: pointer; }
input:focus, select:focus {
  outline: 2px solid #e3a72f;
  outline-offset: 1px;
}

button {
  margin-top: 0.7rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,.18);
  color: #f0ede4;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
button:hover:not(:disabled) { background: rgba(255,255,255,.3); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: #e3a72f; color: #2b2005; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #f0b83f; }
button.wide { width: 100%; }

details {
  margin: 0.8rem 0 0.2rem;
  background: rgba(0,0,0,.22);
  border-radius: 8px;
  padding: 0.5rem 0.8rem 0.7rem;
}
summary { cursor: pointer; font-size: 0.9rem; user-select: none; }
summary::marker { color: rgba(240,237,228,.5); }

.divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.1rem 0 0.3rem;
  color: rgba(240,237,228,.55);
  font-size: 0.85rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid rgba(255,255,255,.18);
}

.join-row { display: flex; gap: 0.5rem; }
.join-row input { min-width: 0; }

/* ---- header ---- */

#room-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.2rem;
}
#room-header .spacer { flex: 1; }
#room-header button { margin-top: 0; padding: 0.3rem 0.7rem; font-size: 1rem; }

#room-menu {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  margin-bottom: 0.6rem;
}
#room-menu button { margin-top: 0; padding: 0.35rem 0.7rem; font-size: 0.85rem; }
#room-menu #room-meta { flex-basis: 100%; }

/* ---- presence ---- */

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}
.dot.online { background: #46e07a; box-shadow: 0 0 6px rgba(70, 224, 122, 0.8); }
.dot.away { background: #e3a72f; }
.dot.offline { background: #9a9a9a; }
.bot-tag { margin-right: 5px; font-size: 0.85em; }

.remove-bot {
  margin: 0 0 0 0.6rem;
  padding: 0.05rem 0.45rem;
  font-size: 0.75rem;
  border-radius: 6px;
  background: rgba(194, 34, 24, 0.35);
}
.remove-bot:hover:not(:disabled) { background: rgba(194, 34, 24, 0.6); }

/* ---- lobby ---- */

#lobby-players { list-style: none; margin: 0.5rem 0; }
#lobby-players li { padding: 0.35rem 0.5rem; border-bottom: 1px solid rgba(255,255,255,.12); }
#lobby-players li.me { font-weight: 700; }

/* ---- tafel ---- */

#table {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

#players-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.player-chip {
  background: rgba(0,0,0,.3);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  text-align: center;
  min-width: 104px;
}
.player-chip.turn { border-color: #e3a72f; animation: turn-pulse 2s ease-in-out infinite; }
@keyframes turn-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(227,167,47,.35); }
  50% { box-shadow: 0 0 18px rgba(227,167,47,.75); }
}
.player-chip.me { background: rgba(0,0,0,.45); }
.opp-name { font-weight: 600; }
.chip-score { font-size: 0.8rem; color: #f5d789; }

.opp-fan {
  display: flex;
  justify-content: center;
  margin: 0.3rem 0 0.1rem;
  min-height: 22px;
}
.mini-back {
  width: 15px;
  height: 22px;
  border-radius: 3px;
  background: repeating-linear-gradient(135deg, #7a1f1f 0 3px, #942929 3px 6px);
  border: 1px solid #f0ede4;
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
  margin-left: -9px;
  flex-shrink: 0;
}
.mini-back:first-child { margin-left: 0; }
.opp-count { font-size: 0.78rem; color: rgba(240,237,228,.8); margin-bottom: 0.1rem; }
.opp-badges { font-size: 0.75rem; color: rgba(240,237,228,.75); min-height: 1em; }

#center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.8rem 0;
  min-height: 180px;
}

#pile { display: flex; gap: 0.4rem; min-height: 84px; align-items: center; }
#pile .card.fresh { animation: card-in 0.22s ease-out; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
}
.empty-pile {
  border: 2px dashed rgba(255,255,255,.3);
  border-radius: 8px;
  padding: 1.6rem 1.2rem;
  color: rgba(255,255,255,.5);
  font-size: 0.85rem;
}

#game-log {
  font-size: 0.74rem;
  color: rgba(240,237,228,.5);
  max-height: 72px;
  overflow-y: auto;
  text-align: center;
  width: 100%;
  max-width: 480px;
  mask-image: linear-gradient(to bottom, transparent, black 30%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 30%);
}

/* ---- eigen hand ---- */

#me {
  background: rgba(0,0,0,.3);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 0.8rem;
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}
#me.your-turn {
  border-color: rgba(227,167,47,.7);
  box-shadow: 0 0 18px rgba(227,167,47,.25);
}

#status-bar { min-height: 1.4em; margin-bottom: 0.5rem; font-size: 0.95rem; }
#status-bar.action { color: #f5d789; font-weight: 600; }

#hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  padding: 0.3rem 0 0.5rem;
}
/* Gelijke rangen overlappen; tussen groepen zit een klein gaatje */
#hand .card { margin-left: -16px; }
#hand .card.new-group { margin-left: 9px; }
#hand .card:first-child { margin-left: 0; }

#actions button { margin: 0.2rem 0.3rem; }

/* ---- kaarten ---- */

.card {
  width: 52px;
  height: 74px;
  background: #fdfdf8;
  color: #1a1a1a;
  border-radius: 7px;
  border: 1px solid #999;
  box-shadow: 0 2px 4px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  transition: transform 0.1s;
}
.card.red { color: #c22218; }
.card.joker { background: linear-gradient(150deg, #fdfdf8 55%, #f3e3ff 100%); }
.card.joker .rank { font-size: 1.7rem; }
.card .rank { font-size: 1.25rem; line-height: 1; }
.card .suit { font-size: 1.15rem; line-height: 1.2; }
.card.small { width: 38px; height: 54px; }
.card.small .rank { font-size: 0.95rem; }
.card.small .suit { font-size: 0.85rem; }
.card.selectable { cursor: pointer; }
.card.selectable:hover { transform: translateY(-6px); }
.card.selected {
  transform: translateY(-12px);
  outline: 2px solid #e3a72f;
  box-shadow: 0 6px 14px rgba(0,0,0,.45), 0 0 10px rgba(227,167,47,.5);
}

.card-badge {
  display: inline-block;
  background: #fdfdf8;
  color: #1a1a1a;
  border-radius: 4px;
  padding: 0 0.3rem;
  font-weight: 700;
}
.card-badge.red { color: #c22218; }

/* ---- overlay & toast ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.overlay .panel { background: #17402a; }

.result-table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; }
.result-table th, .result-table td { padding: 0.35rem 0.5rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,.15); }

.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: #2b2005;
  color: #f5d789;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  max-width: 90vw;
}

/* ---- mobiel ---- */

@media (max-width: 600px) {
  .card { width: 44px; height: 62px; border-radius: 6px; }
  .card .rank { font-size: 1.05rem; }
  .card .suit { font-size: 0.95rem; }
  #hand .card { margin-left: -19px; }
  #hand .card.new-group { margin-left: 7px; }
  .card.selected { transform: translateY(-10px); }

  .player-chip { min-width: 88px; padding: 0.35rem 0.5rem; font-size: 0.9rem; }
  .mini-back { width: 11px; height: 16px; margin-left: -7px; }
  .opp-count { font-size: 0.72rem; }

  #center { min-height: 130px; padding: 0.4rem 0; }
  #pile { min-height: 66px; }
  #game-log { max-height: 64px; font-size: 0.72rem; }
  #actions button { padding: 0.6rem 1.3rem; } /* grotere tap targets */
}
