* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #10261a;
  color: #eef5ee;
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.screen.hidden { display: none; }

.panel {
  background: #163b26;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.panel h1 { margin-top: 0; }
.panel label { display: block; text-align: left; font-size: 13px; color: #cfe8d6; margin-bottom: 4px; }
.panel input, .panel select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
  color: #eef5ee;
  font-size: 15px;
  margin-bottom: 12px;
}
.panel select option { color: #10261a; }
.panel button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.12);
  color: #eef5ee;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 10px;
}
.panel button:hover { background: rgba(255,255,255,0.2); }
.start-actions { display: flex; flex-direction: column; gap: 4px; }
.join-row { display: flex; gap: 8px; }
.join-row input { margin-bottom: 0; text-transform: uppercase; }
.join-row button { width: auto; flex-shrink: 0; }
.error { color: #ff9b9b; font-size: 13px; min-height: 18px; }
.room-code { font-size: 32px; font-weight: 700; letter-spacing: 4px; margin: 12px 0; }
.hint { font-size: 13px; color: #cfe8d6; }

.reveal-panel { max-width: 640px; }
.reveal-section { margin-top: 14px; }
.reveal-section.hidden { display: none; }
.reveal-label { font-size: 12px; color: #cfe8d6; margin: 0 0 6px; text-align: left; }
.reveal-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  min-height: 70px;
}
.reveal-hand .card { width: 58px; height: 93px; }

.trick-pile { cursor: pointer; }

#confetti-layer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.3; }
}

.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10;
}

.table {
  background: #1d5c3a;
  border-radius: 16px;
  padding: 16px;
  width: 100%;
  max-width: 760px;
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.hud-top, .hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.player-tag { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.pts { color: #cfe8d6; }

.trick-pile {
  display: flex;
  margin-left: 6px;
}
.trick-pile .mini-card {
  width: 20px;
  height: 29px;
  border-radius: 3px;
  background: url('../img/cards/hatlap.jpg') center / cover;
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 1px 2px rgba(0,0,0,0.35);
  margin-left: -8px;
}
.trick-pile .mini-card:first-child { margin-left: 0; }

.center-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: 700;
  color: #fff3cc;
  text-shadow: 0 2px 10px rgba(0,0,0,0.7);
  background: rgba(0,0,0,0.4);
  padding: 14px 32px;
  border-radius: 14px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 5;
}
.center-toast.show { opacity: 1; }

.announce-badges { display: flex; gap: 4px; }
.announce-badges .badge {
  background: rgba(255,213,74,0.25);
  color: #ffe9a8;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.match-score {
  background: rgba(0,0,0,0.25);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
}
.match-score-wrap { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.12);
  color: #eef5ee;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.icon-btn:hover { background: rgba(255,255,255,0.22); }

.help-panel { max-width: 480px; text-align: left; }
.help-panel h2 { text-align: center; }
.help-list { padding-left: 18px; margin: 0 0 16px; font-size: 13px; line-height: 1.6; }
.help-list li { margin-bottom: 8px; }

.opp-hand, .your-hand {
  display: flex;
  justify-content: center;
  gap: 6px;
  min-height: 80px;
  align-items: center;
  flex-wrap: wrap;
}

.mid-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin: 8px 0;
  min-height: 90px;
}

.talon-area { position: relative; text-align: center; }

.trump-suit-label.hidden, .closed-label.hidden { display: none; }
.closed-label {
  background: rgba(166,38,38,0.35);
  color: #ffd9d9;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  align-self: center;
  white-space: nowrap;
}
.trump-suit-label {
  background: rgba(0,0,0,0.25);
  color: #eef5ee;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  align-self: center;
  white-space: nowrap;
}
.stock-count {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #cfe8d6;
}

.trick-area { display: flex; gap: 10px; min-width: 120px; justify-content: center; }

.card {
  width: 84px;
  height: 135px;
  border-radius: 6px;
  background: #faf6ec;
  border: 1px solid #c9bd9a;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  user-select: none;
  flex-shrink: 0;
  overflow: hidden;
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.card.back {
  background: url('../img/cards/hatlap.jpg') center / cover;
  border-color: rgba(255,255,255,0.3);
}
.card.playable { cursor: pointer; transition: transform 0.15s; }
.card.playable:hover { transform: translateY(-6px); }
.card.raised {
  transform: translateY(-18px);
  box-shadow: 0 8px 14px rgba(0,0,0,0.45);
  outline: 2px solid #ffd54a;
}
.card.raised:hover { transform: translateY(-22px); }
.card.selected { outline: 2px solid #ffd54a; }
.card.locked { opacity: 0.45; filter: grayscale(40%); }

.suit-piros { color: #a3282e; }
.suit-zold  { color: #2f6e2f; }
.suit-tok   { color: #8a5a10; }
.suit-makk  { color: #333333; }

.actions { display: flex; gap: 8px; }
.actions button {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.4);
  color: #eef5ee;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.actions button:hover { background: rgba(255,255,255,0.22); }
.actions button.hidden { display: none; }

/* ==========================================================================
   MOBIL NEZET (<=600px) - onallo elrendezes, a fenti (desktop) szabalyokat
   nem modositja, csak felulirja mobilon. Ide kerul MINDEN mobil-specifikus
   stilus, hogy ne keveredjen a desktop beallitasokkal.
   ========================================================================== */
@media (max-width: 600px) {
  html, body { height: 100%; overflow: hidden; }

  #screen-game.screen {
    padding: 0;
    align-items: stretch;
    background: #1d5c3a;
    min-height: 100dvh;
    height: 100dvh;
  }

  .table {
    max-width: none;
    min-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    padding: 10px 8px;
    overflow-y: auto;
  }

  /* az ellenfel sora felul kompakt marad, a sajat sorom alul kompakt marad,
     a kozepso resz (mid-row) nyeli el a szabad helyet - igy nyomodik szet
     az ellenfel lapja felfele, a sajatom lefele */
  .mid-row { flex: 1; margin: 4px 0; min-height: 0; }
  .opp-hand { min-height: 0; margin-top: 6px; }
  .your-hand { min-height: 0; margin-bottom: 6px; }

  /* meccs-eredmeny kulon sorba kerul, ha nem fer ki az ellenfel sora mellett -
     nincs fix szelesseg-budget/absolute pozicio, a flex-wrap oldja meg
     automatikusan, igy nem csuszhatnak ra egymasra a elemek */
  .hud-top { flex-wrap: wrap; row-gap: 6px; }
  .hud-top .player-tag { flex-wrap: wrap; }
  .match-score-wrap { margin-left: auto; }

  /* a sajat sorom alatt csak nev + bemondas-jelveny + utes-kupac latszik */
  .hud-bottom { flex-direction: column; align-items: stretch; gap: 8px; }
  .hud-bottom .player-tag { justify-content: center; }

  /* takaras utan a lefordult adu feligg ráusszon a talonra; a kulon
     "Takarva!" felirat mobilon felesleges, a ráúszó lap mar magatol jelzi */
  .trump-card-area.stock-closed { margin-left: -34px; z-index: 2; }
  .closed-label { display: none !important; }
  .hud-bottom .actions { justify-content: center; flex-wrap: wrap; }

  .card { width: 62px; height: 100px; }
}
