:root {
  --bg: #15111f;
  --bg2: #1e1830;
  --panel: #251e3a;
  --panel2: #2e2648;
  --line: #3b3259;
  --text: #f3effc;
  --muted: #a99fc6;
  --accent: #ff4f7b;
  --accent2: #ffb547;
  --ok: #4fd18b;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(1200px 600px at 20% -10%, #3a1d4f 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #1d2a55 0%, transparent 55%), var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent2); }

.btn { background: var(--accent); border: 0; color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 700; cursor: pointer; transition: transform .08s, filter .15s; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--panel2); border: 1px solid var(--line); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 15px 26px; font-size: 18px; }
input[type=text], select, textarea { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none; width: 100%; }
input[type=text]:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 110px; font-size: 14px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }

/* ---------- Strona główna ---------- */
.home { max-width: 980px; margin: 0 auto; padding: 48px 20px 60px; }
.logo { font-size: clamp(40px, 7vw, 68px); font-weight: 900; letter-spacing: -2px; margin: 0; }
.logo span { color: var(--accent); }
.tagline { color: var(--muted); font-size: 18px; margin: 8px 0 34px; }
.home-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; }
@media (max-width: 820px) { .home-grid { grid-template-columns: 1fr; } }
.panel { background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel h2 { margin: 0 0 14px; font-size: 19px; }
.games { display: grid; gap: 12px; }
.game-tile { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg2); cursor: pointer; text-align: left; width: 100%; }
.game-tile.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg2)); }
.game-tile.soon { opacity: .5; cursor: default; }
.game-tile .icon { font-size: 34px; width: 52px; text-align: center; }
.game-tile b { display: block; font-size: 17px; }
.game-tile small { color: var(--muted); }
.tag { font-size: 11px; background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; margin-left: 6px; color: var(--muted); font-weight: 600; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .btn { flex: 0 0 auto; }
.divider { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0; }
.code-input { text-transform: uppercase; letter-spacing: 6px; font-weight: 800; text-align: center; font-size: 20px !important; }

/* ---------- Pokój ---------- */
.room { display: grid; grid-template-columns: 270px 1fr; gap: 18px; max-width: 1280px; margin: 0 auto; padding: 18px; min-height: 100vh; }
@media (max-width: 900px) { .room { grid-template-columns: 1fr; } .sidebar { order: 2; } }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.topbar .brand { font-weight: 900; font-size: 22px; text-decoration: none; color: var(--text); }
.topbar .brand span { color: var(--accent); }
.roomcode { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 14px; }
.roomcode b { letter-spacing: 4px; font-size: 20px; }
.sidebar .panel { padding: 16px; position: sticky; top: 18px; }
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.player { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg2); border: 1px solid transparent; }
.player.me { border-color: var(--line); }
.player.offline { opacity: .45; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #1a1426; flex: 0 0 auto; font-size: 14px; }
.player .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.player .score { font-weight: 900; font-size: 18px; min-width: 22px; text-align: right; }
.player .badges { font-size: 15px; }
.player .actions { display: none; gap: 4px; }
.player:hover .actions { display: flex; }
.icon-btn { background: transparent; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 6px; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.status-line { color: var(--muted); font-size: 14px; margin-top: 12px; min-height: 20px; }
.host-tools { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

.main h1 { margin: 0 0 6px; font-size: 26px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 700px) { .settings { grid-template-columns: 1fr; } }
.settings .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); font-size: 15px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.lobby-start { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Karty ---------- */
.table { display: grid; gap: 20px; }
.round-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pill { background: var(--panel); border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; font-size: 14px; color: var(--muted); }
.pill b { color: var(--text); }
.timer { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.timer > div { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .25s linear; }
.black-card { background: #0b0910; color: #fff; border-radius: 18px; padding: 26px 26px 22px; min-height: 190px; max-width: 520px; font-size: clamp(20px, 2.6vw, 26px); font-weight: 800; line-height: 1.3; box-shadow: 0 18px 40px #0008, inset 0 0 0 1px #ffffff14; position: relative; }
.black-card .foot { position: absolute; bottom: 14px; left: 26px; right: 26px; display: flex; justify-content: space-between; font-size: 12px; color: #8e85a8; font-weight: 700; }
.blank { display: inline-block; min-width: 90px; border-bottom: 3px solid #fff8; }
.fill { color: var(--accent2); }
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.white-card { background: #fbf8ff; color: #16121f; border-radius: 14px; padding: 14px; min-height: 150px; font-weight: 700; font-size: 16px; line-height: 1.3; cursor: pointer; border: 3px solid transparent; position: relative; text-align: left; box-shadow: 0 6px 16px #0006; transition: transform .1s, border-color .1s; display: flex; flex-direction: column; justify-content: space-between; }
.white-card:hover { transform: translateY(-3px); }
.white-card.selected { border-color: var(--accent); transform: translateY(-6px); }
.white-card .order { position: absolute; top: -10px; right: -10px; background: var(--accent); color: #fff; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.white-card .brandmark { font-size: 10px; color: #9a91b0; font-weight: 800; letter-spacing: .5px; margin-top: 10px; }
.white-card.static { cursor: default; }
.white-card.static:hover { transform: none; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.slot { border-radius: 16px; padding: 10px; background: var(--panel); border: 2px solid var(--line); display: grid; gap: 8px; align-content: start; transition: transform .12s, border-color .12s; }
.slot.clickable { cursor: pointer; }
.slot.clickable:hover { border-color: var(--accent2); transform: translateY(-3px); }
.slot.winner { border-color: var(--accent2); background: color-mix(in srgb, var(--accent2) 18%, var(--panel)); box-shadow: 0 0 0 4px #ffb54733; }
.slot .white-card { min-height: 90px; cursor: inherit; }
.slot .white-card:hover { transform: none; }
.facedown { background: repeating-linear-gradient(45deg, #2e2648, #2e2648 10px, #352c54 10px, #352c54 20px); border-radius: 12px; min-height: 90px; display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.author { font-weight: 800; font-size: 14px; text-align: center; }
.actions-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.big-msg { font-size: 20px; font-weight: 800; }
.waiting { display: flex; flex-wrap: wrap; gap: 6px; }
.waiting span { background: var(--panel2); border-radius: 99px; padding: 4px 10px; font-size: 13px; }
.champion { font-size: 44px; font-weight: 900; margin: 10px 0; }
.scoreboard { display: grid; gap: 6px; max-width: 420px; margin: 16px auto; }
.scoreboard div { display: flex; justify-content: space-between; background: var(--bg2); padding: 10px 14px; border-radius: 10px; }

#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 50; width: min(92vw, 420px); }
.toast { background: var(--panel2); border: 1px solid var(--line); padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px #0008; animation: pop .2s ease-out; }
.toast.error { border-color: var(--accent); }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }
.conn-banner { background: #ff4f7b22; border: 1px solid var(--accent); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
footer.small { color: var(--muted); font-size: 12px; margin-top: 30px; text-align: center; }
.modal-backdrop { position: fixed; inset: 0; background: #0009; display: grid; place-items: center; z-index: 40; padding: 18px; }
.modal { width: min(560px, 100%); box-shadow: 0 30px 60px #000a; }
.edit-panel { max-width: 640px; }
.edit-row { display: flex; gap: 8px; align-items: center; }
.edit-row input.invalid { border-color: var(--accent); }
.edit-num { background: var(--accent); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 13px; flex: 0 0 auto; }
.edit-hint { font-size: 13px; margin: 6px 0 12px; min-height: 18px; }
.edit-hint:last-child { margin-bottom: 0; }
.ok-text { color: var(--ok); font-weight: 700; }
.err-text { color: var(--accent); font-weight: 700; }
.edited { position: absolute; top: 6px; right: 8px; font-size: 14px; cursor: help; }
.slot .white-card { position: relative; padding-right: 26px; }
.pause-banner { border-color: var(--accent2); background: color-mix(in srgb, var(--accent2) 12%, var(--panel)); margin-bottom: 16px; }
.paused-table { opacity: .45; pointer-events: none; filter: grayscale(.4); }
.deck-list { display: grid; gap: 8px; }
.deck-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); cursor: pointer; color: var(--text); font-size: 15px; margin: 0; }
.deck-item.on { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.deck-item input { width: 18px; height: 18px; accent-color: var(--accent); flex: 0 0 auto; }
.deck-name { flex: 1; font-weight: 700; }
.deck-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tag.hot { background: #ff4f7b33; border-color: var(--accent); color: #fff; }
input[type=password] { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none; width: 100%; }
input[type=password]:focus { border-color: var(--accent); }
.panel-deck { display: flex; gap: 16px; padding: 14px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); flex-wrap: wrap; }
.pd-main { flex: 1; display: grid; gap: 8px; min-width: 260px; }
.pd-main .pd-name { font-weight: 800; font-size: 17px; }
.pd-actions { display: grid; gap: 6px; align-content: start; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
