/* ============================================================
   SILNÉ ČLOVEČE — vizuál v štýle Silné reči
   tmavé pozadie + limetkový akcent #f1ff9d + biele logo
   ============================================================ */
:root {
  --bg: #141414;
  --panel: #1f1f1f;
  --panel2: #2a2a2a;
  --lime: #f1ff9d;
  --lime-strong: #d9e84a;
  --text: #f5f2e8;
  --muted: #9a9a90;
  --red: #e84545;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.screen { display: none; height: 100dvh; width: 100vw; }
.screen.active { display: flex; align-items: center; justify-content: center; }

.btn {
  border: 2px solid var(--lime);
  background: transparent;
  color: var(--lime);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.7em 1.6em;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, background 0.15s;
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: var(--lime); color: #141414; }
.btn-primary:hover { background: var(--lime-strong); }
.btn-ghost:hover { background: rgba(241, 255, 157, 0.12); }
.btn-big { font-size: 1.5rem; padding: 0.8em 2.4em; }
.btn-small { font-size: 0.95rem; padding: 0.45em 1em; border-color: var(--muted); color: var(--muted); }

/* ---------- MENU ---------- */
#screen-menu {
  background: radial-gradient(ellipse at 50% 30%, #242415 0%, var(--bg) 65%);
}
.menu-box { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; text-align: center; padding: 2rem; }
.menu-logo { width: min(320px, 70vw); }
.menu-title {
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  letter-spacing: 0.04em;
  color: var(--lime);
  text-shadow: 0 4px 30px rgba(241, 255, 157, 0.25);
}
.menu-sub { color: var(--muted); font-size: 1.2rem; margin-top: -0.6rem; }
.menu-foot { display: flex; gap: 0.8rem; margin-top: 0.5rem; }
.menu-social { display: flex; gap: 0.6rem; color: var(--muted); font-size: 0.9rem; }
.menu-social a { color: var(--muted); text-decoration: none; }
.menu-social a:hover { color: var(--lime); }

/* ---------- SETUP ---------- */
/* obrazovka sa musí dať scrollovať, keď sa karty nezmestia (mobil) */
#screen-setup.active { align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.setup-box { display: flex; flex-direction: column; align-items: center; gap: 1rem; width: min(1100px, 96vw); padding: 1rem; margin: auto; }
.setup-logo { width: 160px; }
.setup-box h2 { color: var(--lime); font-size: 1.8rem; }
.setup-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; width: 100%; }
.slot-card {
  background: var(--panel);
  border: 3px solid var(--slot-color, var(--lime));
  border-radius: 18px;
  padding: 0.9rem 0.7rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.55rem;
  transition: opacity 0.2s;
}
.slot-card.slot-off { opacity: 0.42; border-style: dashed; }
.slot-avatar-wrap {
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--panel2), #111);
  border: 3px solid var(--slot-color);
  overflow: hidden; cursor: pointer;
  display: flex; justify-content: center;
}
.slot-avatar { height: 160px; margin-top: 4px; object-fit: cover; pointer-events: none; }
.slot-name { font-weight: 700; font-size: 1.05rem; color: var(--slot-color); }
.slot-type-row { display: flex; flex-direction: column; gap: 0.3rem; width: 100%; }
.slot-type {
  border: 1.5px solid #3c3c3c; background: var(--panel2); color: var(--muted);
  border-radius: 8px; padding: 0.4em; font-size: 0.92rem; cursor: pointer; font-family: inherit;
}
.slot-type.sel { background: var(--slot-color); color: #141414; font-weight: 700; border-color: var(--slot-color); }
.setup-hint { color: var(--muted); font-size: 0.95rem; }
.setup-actions { display: flex; gap: 1rem; }

/* ---------- PICKER ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.75);
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--panel);
  border: 2px solid var(--lime);
  border-radius: 20px;
  padding: 1.4rem;
  max-width: min(1000px, 94vw);
  max-height: 90dvh;
  display: flex; flex-direction: column; gap: 1rem; align-items: center;
}
.modal-box h3 { color: var(--lime); font-size: 1.5rem; }
.picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.7rem; overflow-y: auto; width: min(900px, 88vw); padding: 0.2rem;
}
.pick-item {
  background: var(--panel2); border-radius: 14px; padding: 0.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  cursor: pointer; border: 2px solid transparent;
}
.pick-item img { height: 120px; object-fit: contain; }
.pick-item span { font-size: 0.85rem; text-align: center; }
.pick-item:hover { border-color: var(--lime); }
.pick-sel { border-color: var(--lime) !important; background: #33361f; }
.pick-taken { opacity: 0.3; cursor: not-allowed; }

/* ---------- HRA ---------- */
.game-layout { display: flex; width: 100%; height: 100dvh; gap: 0.5rem; padding: 0.5rem; }
.board-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; }
#board { width: 100%; height: 100%; max-height: calc(100dvh - 1rem); }

.side-panel {
  width: clamp(230px, 24vw, 320px);
  display: flex; flex-direction: column; gap: 0.7rem;
  background: var(--panel); border-radius: 18px; padding: 0.9rem;
  overflow-y: auto;
}
.side-logo { width: 70%; align-self: center; }

.turn-banner {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--panel2); border: 3px solid var(--lime);
  border-radius: 14px; padding: 0.55rem 0.7rem;
}
.turn-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: top; background: #111; flex: 0 0 64px; }
.turn-banner > div { min-width: 0; flex: 1; }
/* celé meno, zalomené na max. 2 riadky namiesto orezania */
.turn-name {
  font-weight: 800; font-size: 1.05rem; line-height: 1.18;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
/* pevná výška na 1 riadok — meniaci sa text nesmie hýbať kockou pod bannerom */
.turn-msg { color: var(--muted); font-size: 0.85rem; height: 1.2em; line-height: 1.2em; overflow: hidden; }

.dice-area { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.dice { width: 92px; height: 92px; cursor: pointer; transition: transform 0.12s; }
.dice svg { width: 100%; height: 100%; }
.dice:active { transform: scale(0.92); }
.dice-active { animation: diceGlow 1.2s ease-in-out infinite; border-radius: 20px; }
@keyframes diceGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(241, 255, 157, 0.4)); }
  50% { filter: drop-shadow(0 0 18px rgba(241, 255, 157, 0.95)); }
}
/* pevná výška na 2 riadky — hint sa mení, ale kocka a promo ostávajú na mieste */
.dice-hint {
  color: var(--lime); font-weight: 700; font-size: 0.95rem; text-align: center;
  height: 2.6em; line-height: 1.3em; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}

/* promo karta */
.promo-card {
  margin-top: auto;
  background: linear-gradient(160deg, #2c2c1d, var(--panel2));
  border: 2px solid var(--lime);
  border-radius: 16px;
  padding: 0.8rem;
  display: flex; flex-direction: column; gap: 0.5rem; align-items: center;
  text-align: center; cursor: pointer;
  width: 100%;
}
.promo-in { animation: promoIn 0.5s ease; }
@keyframes promoIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.promo-img-wrap { position: relative; width: 100%; }
/* pomer strán fotiek shows je ~768:461 (5:3) — zachovaj ho, žiadne orezanie/skreslenie */
.promo-img { display: block; width: 100%; height: auto; aspect-ratio: 768 / 461; object-fit: contain; border-radius: 10px; }
.promo-label {
  position: absolute; top: 0.5rem; left: 0.5rem;
  background: rgba(20, 20, 20, 0.75); padding: 0.25em 0.6em; border-radius: 6px;
  font-size: 0.65rem; letter-spacing: 0.14em; color: var(--red); font-weight: 800;
}
.promo-info { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; width: 100%; }
.promo-title { font-weight: 800; font-size: 1rem; color: var(--lime); }
.promo-meta { font-size: 0.85rem; color: var(--muted); }

.side-foot { display: flex; gap: 0.5rem; justify-content: center; }

/* figúrky */
.pulse-ring { animation: pulse 1s ease-in-out infinite; transform-origin: center; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ---------- VÝHERCA ---------- */
.winner-box { text-align: center; }
.winner-confetti { font-size: 3rem; animation: bounce 0.8s ease infinite alternate; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-12px); } }
.winner-avatar { height: 220px; object-fit: contain; }
.winner-box h2 { color: var(--lime); font-size: 2rem; }
.winner-sub { color: var(--muted); }
.winner-promo { background: var(--panel2); border-radius: 14px; padding: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }

.rules-box { max-width: min(640px, 92vw); }
.rules-text { text-align: left; line-height: 1.55; overflow-y: auto; font-size: 1rem; }
.rules-text ul { padding-left: 1.4rem; margin: 0.6rem 0; }
.rules-text li { margin: 0.35rem 0; }

/* ---------- na výšku (portrait tablet) ---------- */
@media (orientation: portrait) {
  .game-layout { flex-direction: column; }
  .side-panel { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-around; padding: 0.6rem; gap: 0.55rem; }
  .side-logo { display: none; }
  /* pevné šírky — meniaci sa text nesmie rozhadzovať riadok ani zalamovať */
  .dice-area { flex: 0 0 150px; width: 150px; }
  .dice { width: 74px; height: 74px; }
  .dice-hint { font-size: 0.85rem; height: 2.2em; }
  .turn-banner { flex: 1 1 0; min-width: 0; }
  .promo-card { margin-top: 0; flex: 1 1 100%; padding: 0.5rem; gap: 0.4rem; }
  /* obrázok cez celú šírku karty (bez orezania, výška sa dopočíta z pomeru strán);
     popis a tlačidlo idú do jedného riadku pod ním, nech sa karta zmestí bez scrollovania */
  .promo-info { flex-direction: row; justify-content: space-between; align-items: center; gap: 0.5rem; }
  .promo-text { text-align: left; min-width: 0; flex: 1; }
  .promo-title { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .promo-meta { font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .promo-card .btn { font-size: 0.85rem; padding: 0.45em 1em; flex-shrink: 0; }
  #board { max-height: calc(100dvh - 240px); }
  .setup-slots { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- telefón (úzky displej) ----------
   karty hráčov naležato v jednom stĺpci, aby sa logo aj tlačidlá
   Späť/Štart zmestili na obrazovku bez scrollovania */
@media (max-width: 540px) {
  .setup-box { gap: 0.55rem; padding: 0.6rem; }
  .setup-logo { width: 100px; }
  .setup-box h2 { font-size: 1.25rem; }
  .setup-slots { grid-template-columns: 1fr; gap: 0.45rem; }
  .slot-card {
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.6rem; row-gap: 0.25rem;
    padding: 0.45rem 0.6rem;
    align-items: center;
  }
  .slot-avatar-wrap { width: 60px; height: 60px; grid-row: 1 / 3; border-width: 2px; }
  .slot-avatar { height: 86px; margin-top: 2px; }
  .slot-name { font-size: 0.95rem; text-align: left; justify-self: start; }
  .slot-type-row { flex-direction: row; gap: 0.3rem; }
  .slot-type { flex: 1; font-size: 0.78rem; padding: 0.35em 0.15em; }
  .setup-hint { font-size: 0.78rem; text-align: center; }
  .setup-actions { gap: 0.6rem; }
  .btn-big { font-size: 1.15rem; padding: 0.6em 1.7em; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; }
  .pick-item img { height: 92px; }
  .pick-item span { font-size: 0.75rem; }
}
