/* ---------- Menu główne (ta sama kolorystyka co gra – ciemny szejktivi.pl) ---------- */

.screen { height: calc(100vh - var(--topbar-h)); overflow: hidden; }
#topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.who-name { font-weight: 700; }
.who-rating { font-size: 12px; color: var(--gold); }
.who-ratings { display: flex; gap: 8px; }
.who-rating.cpu { color: #9fd3ff; }
button.secondary, .pill.secondary { background: rgba(255, 255, 255, .1); box-shadow: none; }
button.danger, .pill.danger { background: #c8352a; box-shadow: 0 4px 12px rgba(200, 53, 42, .35); }
button.small, .pill.small { padding: 5px 12px; font-size: 13px; }
.small { font-size: 12.5px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.form-error { color: #ff8a80; font-size: 13.5px; min-height: 18px; margin-top: 6px; }

/* ---------- Logowanie ---------- */
#screen-login { display: grid; place-items: center; }
.login-card {
  width: min(420px, 92vw);
  display: flex; flex-direction: column; gap: 12px;
  padding: 28px 30px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .5);
}
.login-card h1 { margin: 0; color: var(--gold); font-size: 26px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login-card input, .deck-name-input {
  padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .35);
  color: #fff; font: 15px "Segoe UI", system-ui, sans-serif;
}
.login-card input:focus, .deck-name-input:focus { outline: 2px solid var(--twitch); }
.login-buttons { display: flex; gap: 10px; }
.deck-warning { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 12px; }
.deck-warning .form-error { margin: 0; }
.deck-fix { align-self: center; white-space: nowrap; }
.deck-empty { width: 100%; margin: 0 0 6px; }
.twitch-login {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 12px;
  background: var(--twitch); color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 4px 14px rgba(145, 70, 255, .4);
}
.twitch-login:hover { filter: brightness(1.12); }
.login-or { margin: 12px 0 2px; text-align: center; color: var(--muted); font-size: 12px; }
.who-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--twitch); }
.pill.twitch-link { background: var(--twitch); }
.login-buttons button { flex: 1; }

/* ---------- Graj + zakładki ---------- */
#screen-menu { display: flex; flex-direction: column; align-items: center; padding: 18px 16px 12px; gap: 14px; }
#play-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.play-big {
  font-size: 34px; font-weight: 900; letter-spacing: 1px;
  padding: 14px 72px; border-radius: 40px;
  background: linear-gradient(135deg, #ffe066, var(--gold) 50%, #e0a800);
  color: #2a0a40;
  box-shadow: 0 8px 30px rgba(var(--gold-rgb), .45), inset 0 -3px 0 rgba(0, 0, 0, .15);
}
.play-big:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); }
.play-big.cancel { background: linear-gradient(135deg, #ff6b5e, #c8352a); color: #fff; box-shadow: 0 8px 30px rgba(200, 53, 42, .5); }
#tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#tabs button { background: rgba(255, 255, 255, .08); box-shadow: none; padding: 9px 22px; }
#tabs button.active { background: var(--twitch); box-shadow: 0 4px 12px rgba(145, 70, 255, .35); }

#window { flex: 1; min-height: 0; width: min(1500px, 100%); display: flex; }
.win {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.win-title { margin: 0 0 10px; color: var(--gold); }

/* wybór trybu */
.play-options { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.play-option {
  width: 300px; padding: 26px 22px; border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: rgba(10, 3, 22, .6); border: 1px solid var(--line); box-shadow: none;
}
.play-option:hover:not(:disabled) { border-color: var(--gold); box-shadow: 0 0 24px rgba(var(--gold-rgb), .25); }
.po-icon { font-size: 44px; }
.po-title { font-size: 22px; font-weight: 800; color: var(--gold); }
.po-desc { font-size: 13.5px; color: var(--muted); font-weight: 400; }

/* poziomy trudności */
.diff-list { display: flex; flex-direction: column; gap: 10px; max-width: 640px; margin: 10px auto 16px; }
.diff {
  display: grid; grid-template-columns: 50px 140px 1fr; align-items: center; text-align: left;
  padding: 12px 18px; border-radius: 16px; background: rgba(10, 3, 22, .6); border: 1px solid var(--line); box-shadow: none;
}
.diff:hover:not(:disabled) { border-color: var(--gold); }
.diff-icon { font-size: 28px; }
.diff-name { font-size: 18px; font-weight: 800; }
.diff-desc { font-size: 13px; color: var(--muted); font-weight: 400; }
.diff-Easy .diff-name { color: #6fdc7a; }
.diff-Medium .diff-name { color: #c9e86a; }
.diff-Normal .diff-name { color: var(--gold); }
.diff-Hard .diff-name { color: #ff9a4a; }
.diff-Extreme .diff-name { color: #ff5a5a; }
.diff-ranked { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #1a0c00; background: var(--gold); }
.diff-note { max-width: 640px; margin: 0 auto 14px; text-align: center; }

/* lobby */
.lobby { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.lobby-top { display: flex; justify-content: space-between; align-items: center; }
.lobby-list { display: flex; flex-direction: column; gap: 6px; }
.lobby-row, .lobby-out {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 14px; background: rgba(10, 3, 22, .55); border: 1px solid var(--line);
}
.lobby-out { border-color: var(--gold); }
.lp-name { flex: 1; font-weight: 700; }
.lp-rating { color: var(--gold); font-size: 13px; }
#lobby-tab {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 10px; border-radius: 0 16px 16px 0;
  background: var(--twitch);
}
.lobby-icon { font-size: 18px; }
#lobby-count { font-size: 20px; font-weight: 900; }
.lobby-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
#invites { position: fixed; right: 16px; top: calc(var(--topbar-h) + 12px); z-index: 88; display: flex; flex-direction: column; gap: 8px; }
/* Przy otwartej powtórce zaproszenia schodzą niżej, żeby nie zasłaniać przycisku zamknięcia. */
body:has(#menu-overlay:not(.hidden)) #invites { top: auto; bottom: 120px; }
.invite {
  padding: 12px 16px; border-radius: 16px; background: var(--panel-solid);
  border: 2px solid var(--gold); box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  animation: invite-pop .3s ease-out;
}
@keyframes invite-pop { from { transform: translateY(-10px); opacity: 0; } }
.invite-text { font-weight: 700; margin-bottom: 8px; }
.invite-buttons { display: flex; gap: 8px; }

/* karty, filtry, podgląd */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.chip { padding: 5px 14px; font-size: 13px; background: rgba(255, 255, 255, .08); box-shadow: none; }
.chip.active { background: var(--gold); color: #2a0a40; }
.with-preview, .editor { display: flex; gap: 16px; align-items: flex-start; }
.wp-main { flex: 1; min-width: 0; }
.preview-box {
  position: sticky; top: 0;
  width: 280px; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.preview-box .card { --card-w: 170px; --card-h: 236px; flex: none; }
.preview-box h3 { margin: 2px 0 0; font-size: 19px; color: var(--gold); text-align: center; }
.menu-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.menu-grid .card { --card-h: 170px; --card-w: 122px; }
.menu-grid.small .card { --card-h: 140px; --card-w: 101px; }
.cwrap { position: relative; cursor: pointer; transition: transform .12s; padding-bottom: 14px; } /* miejsce na licznik pod kartą */
.cwrap:hover { transform: translateY(-3px); }
/* Karta, której nie masz: znak zapytania (bez filtra szarości – obciążał procesor). */
.card.unknown .art { background: radial-gradient(circle at 50% 40%, #2d1d4d, #120822); color: rgba(185, 167, 214, .55); font-size: 3.4em; font-weight: 900; }
.card.unknown .power { opacity: .7; }
.card.unknown .name { color: var(--muted); }
.cwrap.maxed .card { opacity: .45; }
.owned-badge {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 3; /* pod kartą – nie zasłania nazwy */
  padding: 1px 10px; border-radius: 10px; font-size: 12px; font-weight: 800;
  background: var(--twitch); color: #fff; white-space: nowrap;
}
.cwrap.locked .owned-badge { background: #3a2a52; color: var(--muted); }

/* talie */
.deck-list { display: flex; flex-wrap: wrap; gap: 16px; }
.deck-tile {
  position: relative; width: 170px; padding: 10px; border-radius: 16px; cursor: pointer;
  background: rgba(10, 3, 22, .55); border: 2px solid var(--line);
  display: flex; flex-direction: column; gap: 6px; transition: transform .12s, border-color .12s;
}
.deck-tile:hover { transform: translateY(-3px); border-color: var(--twitch); }
.deck-tile.active { border-color: var(--gold); box-shadow: 0 0 18px rgba(var(--gold-rgb), .3); }
.deck-tile.invalid { border-color: #c8352a; }
.deck-cover { height: 200px; border-radius: 12px; background: #1a0a30 center top / cover; }
.deck-cover.big { height: 230px; width: 100%; }
.deck-name { font-weight: 800; text-align: center; }
.deck-meta { font-size: 12.5px; color: var(--muted); text-align: center; }
.deck-badge { position: absolute; top: 16px; left: 16px; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 800; background: var(--gold); color: #2a0a40; }
.deck-badge.bad { background: #c8352a; color: #fff; }
.deck-tile.add { align-items: center; justify-content: center; min-height: 270px; border-style: dashed; }
.deck-plus { font-size: 60px; color: var(--gold); }
.editor-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.deck-name-input { flex: 1; min-width: 200px; font-size: 18px; font-weight: 700; }
.deck-side { width: 260px; flex: none; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; }
.deck-side .preview-box { position: static; width: 100%; }
.deck-side > * { flex-shrink: 0; } /* okładka i podgląd się nie spłaszczają – wysokość edytora liczy JS */
.deck-side .deck-cover.big { height: 150px; }
/* Edytor wypełnia okno – panele talii i kolekcji przewijają się niezależnie. */
.win:has(> .editor) { display: flex; flex-direction: column; overflow-y: auto; }
.win > .editor { flex: 1; min-height: 0; align-items: stretch; } /* min-height z JS: wysokość paska bocznego */
.editor > .deck-side { overflow-y: auto; }
.ed-panel { flex: 1; min-width: 0; overflow-y: auto; padding: 10px 12px; border-radius: 16px; background: rgba(10, 3, 22, .4); border: 1px solid var(--line); }
.ed-head { font-weight: 800; font-size: 17px; color: var(--gold); }
.ed-panel > .muted { margin: 2px 0 6px; }
.cwrap.in-deck .owned-badge { background: var(--gold); color: #2a0a40; }
.cover-btn { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); z-index: 4; padding: 1px 5px; font-size: 13px; border-radius: 50%; background: rgba(20, 8, 40, .9); box-shadow: none; opacity: .55; }
.cover-btn:hover, .cover-btn.on { opacity: 1; }
/* ogólne button:hover nadpisuje transform – bez tego gwiazdka uciekała w bok */
.cover-btn:hover:not(:disabled) { transform: translateX(-50%) translateY(-1px); }
.cover-btn.on { background: var(--gold); }
.deck-total { font-weight: 800; font-size: 16px; text-align: center; padding: 4px; border-radius: 10px; }
.deck-total.ok { background: rgba(63, 154, 58, .35); }
.deck-total.bad { background: rgba(200, 53, 42, .35); }
.deck-rows { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; }
.deck-row {
  display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px;
  border-radius: 10px; background: rgba(10, 3, 22, .55); border-left: 4px solid var(--zc, var(--line));
}
.dr-power { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #e6e6e6; color: #1a1a1a; font-weight: 900; font-size: 12px; flex: none; }
.dr-name { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-count { font-size: 12.5px; color: var(--gold); font-weight: 800; }
.icon-btn { padding: 2px 8px; font-size: 14px; background: rgba(255, 255, 255, .08); box-shadow: none; border-radius: 8px; }
.icon-btn.on { background: var(--gold); }
.icon-btn.big { font-size: 18px; padding: 6px 14px; }

/* historia */
.history { display: flex; flex-direction: column; gap: 6px; }
.hrow {
  display: grid; grid-template-columns: 90px 1.2fr 1fr 60px 1.4fr 120px auto; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 14px; background: rgba(10, 3, 22, .55); border-left: 5px solid var(--line);
}
.hrow.win { border-left-color: #3fbf5a; }
.hrow.loss { border-left-color: #c8352a; }
.hrow.draw { border-left-color: var(--muted); }
.h-result { font-weight: 800; }
.hrow.win .h-result { color: #6fdc7a; }
.hrow.loss .h-result { color: #ff8a80; }
.h-opp { font-weight: 700; }
.h-rounds, .h-date { color: var(--muted); font-size: 13px; }
.h-rating { font-weight: 800; text-align: right; }
.h-rating.up { color: #6fdc7a; }
.h-rating.down { color: #ff8a80; }
.h-reward { font-size: 12.5px; color: var(--gold); }

/* ranking */
table.ranking { width: 100%; border-collapse: collapse; }
table.ranking th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; padding: 8px 12px; }
table.ranking td { padding: 9px 12px; border-top: 1px solid var(--line); }
table.ranking tr.me td { background: rgba(var(--gold-rgb), .12); font-weight: 800; }
table.ranking td:nth-child(3) { color: var(--gold); font-weight: 800; }

/* powtórka */
#menu-overlay { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; background: rgba(8, 2, 18, .85); }
.replay {
  width: min(1200px, 96vw); height: 92vh; display: flex; flex-direction: column; gap: 8px;
  padding: 14px 18px; border-radius: 20px; background: var(--panel-solid); border: 1px solid var(--line);
}
.replay-head, .replay-foot { display: flex; align-items: center; gap: 12px; }
.rp-tools { margin-left: auto; display: flex; gap: 6px; }
.rp-player { font-weight: 700; }
.rp-round { color: var(--gold); font-weight: 800; }
.replay-board { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.rrow {
  position: relative; flex: 1; min-height: 0; display: flex; align-items: center; gap: 8px; padding: 4px 8px; container-type: size;
  border-radius: 10px; background: rgba(10, 3, 22, .5); border-left: 4px solid var(--zc);
}
.rcards { flex: 1; display: flex; gap: 4px; justify-content: center; height: 100%; align-items: center; }
/* Karta mieści się w rzędzie także przy niskim oknie i rękach obu graczy. */
.rcards .card { --card-h: min(118px, 100cqh); --card-w: calc(var(--card-h) * .72); }
.rhand { flex: none; display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; padding: 2px 8px; opacity: .9; }
.rhand .card { --card-h: min(84px, 7vh); --card-w: calc(var(--card-h) * .72); }
.replay-divider { height: 3px; background: linear-gradient(90deg, transparent, var(--gold), transparent); margin: 2px 0; }
.replay-foot { flex-wrap: wrap; }
.replay-text { flex: 1; min-width: 300px; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, .3); color: #eee6ff; font-size: 14px; min-height: 38px; }
.player-controls {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-radius: 16px; background: rgba(0, 0, 0, .35);
}
.rp-slider { flex: 1; accent-color: var(--gold); }
.rp-step { min-width: 70px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.reward-title { color: var(--gold); font-weight: 800; margin: 10px 0 0; }

/* Nagroda za wygraną z komputerem – wybór 1 z 3 kart */
.reward-picker { display: flex; flex-direction: column; align-items: center; max-width: 720px; }
.reward-picker .card { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.reward-picker .card:hover { transform: translateY(-5px); box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(var(--gold-rgb), .5); }
.reward-picker .card.busy { opacity: .6; pointer-events: none; }

/* Grupy kart: Stream, Offstream, rZeCzY, Boosts, Na stół wroga */
.card-groups { display: flex; flex-direction: column; gap: 14px; }
.cg-title { margin: 0 0 8px; font-size: 16px; display: flex; align-items: center; gap: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.cg-count { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.card-group .menu-grid { row-gap: 16px; }
.group-Stream .cg-title { color: var(--stream); }
.group-Offstream .cg-title { color: var(--offstream); }
.group-RZeczy .cg-title { color: var(--rzeczy); }
.group-Boost .cg-title { color: var(--gold); }
.group-EnemyAbility .cg-title { color: #d79bff; }

/* Okno karty (zakładka Karty): duża karta po lewej, informacje po prawej */
.card-detail { position: relative; display: flex; gap: 28px; align-items: flex-start; text-align: left; width: min(860px, 94vw); padding: 26px 30px; }
.card-detail-close { position: absolute; top: 12px; right: 12px; }
.cd-card { flex: none; padding: 12px; }
.cd-card .card { --card-h: min(62vh, 460px); --card-w: calc(var(--card-h) * .72); cursor: default; }
.cd-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 6px; }
.cd-info h3 { margin: 0; font-size: 30px; color: var(--gold); }
.cd-info .ptags { justify-content: flex-start; }
.cd-info .ptag { font-size: 13px; padding: 3px 12px; }
.cd-info .pstats { font-size: 16px; }
.cd-info .psection { width: 100%; }
.cd-owned { margin-top: 4px; padding: 6px 12px; border-radius: 10px; font-weight: 700; font-size: 14px; }
.cd-owned.have { background: rgba(63, 154, 58, .3); }
.cd-owned.missing { background: rgba(255, 255, 255, .08); color: var(--muted); }
@media (max-width: 700px) { .card-detail { flex-direction: column; align-items: center; } }
.cd-info .psection-title { font-size: 13px; }
.cd-info .prule-head { font-size: 17px; }
.cd-info .prule-desc, .cd-info .pnote, .cd-info .pflavor { font-size: 15.5px; line-height: 1.45; }
.cd-info .psection { padding: 10px 14px; }
.cd-owned { font-size: 15px; }

/* ---------- Telefon: menu, zakładki i okna ---------- */
@media (max-width: 760px) {
  .screen { height: calc(100dvh - var(--topbar-h)); }
  #screen-menu { padding: 8px 6px 6px; gap: 8px; }
  #play-wrap { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .play-big { font-size: 22px; padding: 8px 44px; }
  #resume-wrap .pill { padding: 8px 14px; font-size: 14px; }
  /* Zakładki w jednym przewijanym rzędzie – więcej miejsca na okno */
  #tabs { gap: 6px; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; max-width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  #tabs::-webkit-scrollbar { display: none; }
  #tabs button { flex: none; padding: 7px 13px; font-size: 13.5px; }
  .card-group .menu-grid { row-gap: 20px; }
  .owned-badge { font-size: 11px; }
  .win { padding: 12px 10px; border-radius: 16px; }
  .win-title { font-size: 20px; }
  .play-options { margin: 8px 0; gap: 10px; }
  .play-option { width: 100%; padding: 16px 14px; }

  .po-icon { font-size: 32px; }
  .diff { grid-template-columns: 36px 1fr; padding: 10px 12px; column-gap: 8px; }
  .diff-desc { grid-column: 2; }
  .diff-icon { grid-row: span 2; font-size: 24px; }
  /* Karty: bez bocznego podglądu – dotknięcie karty otwiera jej okno */
  .with-preview > .preview-box { display: none; }
  .menu-grid { gap: 8px; justify-content: center; }
  .menu-grid .card { --card-h: 128px; --card-w: 92px; }
  .menu-grid.small .card { --card-h: 116px; --card-w: 84px; }
  .filters { gap: 4px; }
  .chip { padding: 4px 10px; font-size: 12.5px; }
  /* Talie i edytor: panele jeden pod drugim */
  .deck-list { gap: 10px; justify-content: center; }
  .deck-tile { width: 150px; }
  .deck-cover { height: 160px; }
  .deck-tile.add { min-height: 220px; }
  .win:has(> .editor) { overflow-y: auto; display: block; }
  .editor { flex-direction: column; }
  .win > .editor { flex: none; }
  .deck-side { width: 100%; position: static; }
  .editor > .deck-side, .ed-panel { overflow: visible; }
  .deck-side .preview-box { display: none; }
  .deck-rows { max-height: none; }
  .deck-name-input { min-width: 0; font-size: 16px; }
  /* Historia: wiersz w dwóch liniach */
  .hrow { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px 10px; }
  .hrow > * { min-width: 0; }
  /* Ranking: mniejsze odstępy */
  table.ranking th, table.ranking td { padding: 7px 6px; font-size: 13.5px; }
  /* Powtórka */
  .replay { width: 100vw; height: 100dvh; border-radius: 0; padding: 8px; }
  .replay-text { min-width: 0; font-size: 13px; }
  .rcards .card { --card-h: min(80px, 100cqh); }
  .rhand .card { --card-h: min(56px, 6.5dvh); }
  .player-controls { flex-wrap: wrap; padding: 6px 8px; }
  /* Okno karty i zaproszenia */
  .card-detail { padding: 18px 14px; gap: 12px; }
  .cd-card .card { --card-h: min(46dvh, 340px); }
  .cd-info h3 { font-size: 24px; }
  #invites { right: 8px; left: 8px; }
  #lobby-tab { padding: 8px 6px; }
  .reward-picker { max-width: 96vw; }
}

/* Poziom postaci i doświadczenie */
.who-level { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; color: var(--gold); cursor: help; }
.xp-bar { width: 70px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.xp-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ffe27a); }
.diff-xp { display: inline-block; margin-top: 2px; color: var(--gold); font-weight: 700; font-size: 12.5px; }
.xp-line { color: var(--gold); font-weight: 800; margin: 6px 0 0; }
@media (max-width: 760px) { .xp-bar { width: 44px; } body[data-screen="game"] .who-level { display: none; } }

/* Ekwipunek: plecak po lewej, sklep po prawej */
#tabs button.has-items:not(.active) { box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold); }
.inventory-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
.inventory-side { padding: 14px 16px; border-radius: 16px; background: rgba(10, 3, 22, .3); border: 1px solid rgba(255, 255, 255, .08); min-width: 0; }
.inventory-side h3 { display: flex; align-items: center; gap: 10px; margin: 0; }
.inventory-side .empty { color: var(--muted); padding: 18px 4px; }
.wallet { margin-left: auto; color: var(--gold); font-size: 16px; font-weight: 900; }
.who-rating.gold { cursor: pointer; }
.chest-tile button:disabled { opacity: .5; cursor: not-allowed; }
.shop-item button { white-space: nowrap; padding-inline: 14px; }
.inventory-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.chest-tile {
  width: 150px; padding: 14px 10px; border-radius: 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(10, 3, 22, .55); border: 1px solid rgba(var(--gold-rgb), .5); box-shadow: 0 0 18px rgba(var(--gold-rgb), .15);
}
.chest-icon { font-size: 56px; line-height: 1.1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.chest-name { font-weight: 800; }
.chest-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.chest-line { color: var(--gold); font-weight: 700; margin: 4px 0 0; }
@media (max-width: 760px) {
  .inventory-split { grid-template-columns: 1fr; }
  .inventory-grid { justify-content: center; gap: 10px; }
  .chest-tile { width: 140px; }
}

/* Kopie ponad limit (po zmianie balansu) i przycisk „Przemiel” */
.cwrap.over .owned-badge { background: #c8352a; color: #fff; }
.cg-title .grind-btn { margin-left: auto; padding: 3px 10px; font-size: 12.5px; }

/* Newsy na stronie głównej */
.news { max-width: 860px; margin: 26px auto 0; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.news-head { margin: 0; font-size: 18px; color: var(--gold); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.news-item { display: flex; gap: 18px; align-items: flex-start; padding: 14px; border-radius: 16px; background: rgba(10, 3, 22, .45); border: 1px solid var(--line); }
.news-card { flex: none; width: 120px; }
.news-card .card { --card-h: 168px; --card-w: 120px; cursor: default; }
.news-text { flex: 1; min-width: 0; }
.news-text h4 { margin: 0 0 2px; font-size: 17px; }
.news-date { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.news-text p { margin: 0 0 8px; line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .news-item { gap: 12px; padding: 10px; }
  .news-card { width: 84px; }
  .news-card .card { --card-h: 118px; --card-w: 84px; }
}

/* Balans: zmienione karty (stara → nowa) i okienko po najechaniu – strzałka niesie listę zmian */
.balance { margin: 2px 0 12px; }
.balance-head { margin: 0; font-size: 15px; }
.balance-hint { font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; }
.balance-list { display: flex; flex-wrap: wrap; gap: 8px; }
.balance-row { display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); cursor: help; }
.balance-row:hover, .balance-row.open { border-color: var(--gold); background: rgba(var(--gold-rgb), .08); }
.balance-row .card { --card-h: 78px; --card-w: 56px; cursor: inherit; }
.balance-arrow { color: var(--gold); font-weight: 800; }
.balance-empty { flex: none; width: 56px; height: 78px; display: grid; place-items: center; padding: 4px; border: 1px dashed var(--line); border-radius: 8px;
  font-size: 10.5px; color: var(--muted); text-align: center; }
.balance-pop { position: fixed; z-index: 70; display: flex; align-items: center; gap: 0; padding: 14px; border-radius: 16px; pointer-events: none;
  background: var(--panel-solid); border: 1px solid var(--gold); box-shadow: 0 12px 34px rgba(0, 0, 0, .65); max-width: calc(100vw - 16px); }
.balance-pop .card { --card-h: 210px; --card-w: 151px; }
.balance-pop .balance-empty { width: 151px; height: 210px; font-size: 14px; }
.balance-change { position: relative; margin: 0 26px 0 10px; padding: 10px 12px; min-width: 90px; max-width: 200px; border-radius: 8px 0 0 8px;
  background: rgba(var(--gold-rgb), .22); color: var(--text); font-size: 13.5px; font-weight: 600; line-height: 1.35; text-align: center; }
.balance-change::after { content: ''; position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  border: 24px solid transparent; border-left: 20px solid rgba(var(--gold-rgb), .22); border-right: 0; }
@media (max-width: 760px) {
  .balance-row .card, .balance-row .balance-empty { --card-h: 64px; --card-w: 46px; width: 46px; height: 64px; }
  .balance-pop { padding: 10px; }
  .balance-pop .card { --card-h: 136px; --card-w: 98px; }
  .balance-pop .balance-empty { width: 98px; height: 136px; font-size: 12px; }
  .balance-change { margin: 0 18px 0 6px; padding: 7px 8px; min-width: 70px; max-width: 120px; font-size: 12px; }
  .balance-change::after { border-width: 18px; border-left-width: 14px; border-right: 0; }
}

/* Informacja o nocnym szkoleniu sieci nad listą botów */
.diff-training { margin: 0 0 12px; padding: 8px 12px; border-radius: 12px; text-align: center; font-weight: 700; color: var(--gold); background: rgba(var(--gold-rgb), .08); border: 1px solid rgba(var(--gold-rgb), .35); }

/* Nick – link do profilu gracza */
button.nick, .nick { background: none; box-shadow: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
button.nick:hover:not(:disabled), .nick:hover { transform: none; filter: none; color: var(--gold); text-decoration: underline; }

/* Profil gracza */
.modal.profile { position: relative; width: min(860px, 94vw); max-height: 90dvh; overflow-y: auto; text-align: left; padding: 24px 28px; }
.pf-head { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; padding-right: 34px; }
.pf-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid var(--gold); }
.pf-noavatar { display: grid; place-items: center; font-size: 32px; font-weight: 800; background: rgba(var(--gold-rgb), .15); color: var(--gold); }
.pf-title { flex: 1; min-width: 0; }
.pf-title h2 { margin: 0 0 4px; overflow-wrap: anywhere; }
.pf-level { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.pf-xp { width: 140px; }
.pf-cover { flex: none; }
.pf-cover .card { --card-h: 112px; --card-w: 80px; cursor: default; }
.pf-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pf-tile { padding: 12px; border-radius: 14px; background: rgba(10, 3, 22, .5); border: 1px solid var(--line); }
.pf-val { font-size: 20px; font-weight: 800; color: var(--gold); overflow-wrap: anywhere; }
.pf-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.pf-sub { font-size: 12.5px; margin-top: 4px; }
.pf-section { margin: 20px 0 8px; font-size: 16px; }
table.ranking.pf-table td:nth-child(3) { color: inherit; font-weight: 400; }
@media (max-width: 760px) {
  .modal.profile { padding: 18px 14px; }
  .pf-head { flex-wrap: wrap; gap: 12px; }
  .pf-avatar { width: 56px; height: 56px; }
  .pf-tiles { grid-template-columns: repeat(2, 1fr); }
  .pf-cover { display: none; }
}

/* ---------- Full HD i większe: większe karty i tekst w menu (talie, karty, historia, ranking, profil) ---------- */
@media (min-width: 1600px) {
  .small { font-size: 14px; }
  .chip { font-size: 14.5px; }
  .menu-grid .card { --card-h: 200px; --card-w: 144px; }
  .menu-grid.small .card { --card-h: 168px; --card-w: 121px; }
  .preview-box .card { --card-w: 200px; --card-h: 278px; }
  .preview-box h3 { font-size: 21px; }
  .owned-badge { font-size: 13.5px; }
  .cg-title { font-size: 18px; }
  .cg-count { font-size: 14px; }
  .deck-meta, .chest-meta, .news-date { font-size: 14px; }
  .dr-name { font-size: 15px; }
  .dr-count { font-size: 14px; }
  .po-desc, .diff-desc { font-size: 15px; }
  .diff-xp { font-size: 14px; }
  .h-rounds, .h-date { font-size: 14.5px; }
  .h-reward { font-size: 14px; }
  table.ranking th { font-size: 13px; }
  table.ranking td { font-size: 16px; }
  .cd-info .ptag, .cd-info .psection-title { font-size: 14.5px; }
  .pf-label { font-size: 13px; }
  .pf-sub { font-size: 14px; }
  .news-text p { font-size: 16px; }
  .form-error { font-size: 15px; }
}

/* Edytor talii: pasek boczny mieści podgląd z najdłuższym opisem bez przewijania. */
.deck-side .preview-box .card { --card-w: 150px; --card-h: 208px; }
@media (min-width: 1600px) {
  .deck-side { width: 340px; }
  .deck-side .deck-cover.big { height: 72px; background-position: center 30%; }
  .deck-side .preview-box .card { --card-w: 140px; --card-h: 194px; }
  .deck-side .preview-box { gap: 6px; padding-top: 10px; padding-bottom: 10px; }
}

/* Ekwipunek – przedmioty różnych rodzajów, takie same zgrupowane (×N) */
.chest-icon { position: relative; }
.item-count { position: absolute; right: -14px; bottom: 2px; font-size: 14px; font-weight: 900; padding: 1px 7px; border-radius: 999px; background: var(--gold); color: #2a0a40; }
.chest-tile.kind-welcome { border-color: rgba(255, 120, 200, .6); box-shadow: 0 0 18px rgba(255, 120, 200, .2); }

/* Przełącznik języka (flagi): pasek u góry i ekran logowania */
.lang-switch { display: inline-flex; gap: 4px; align-items: center; }
.lang-btn {
  width: 32px; height: 32px; padding: 0; border-radius: 50%; font-size: 17px; line-height: 1;
  display: grid; place-items: center; background: rgba(255, 255, 255, .08); box-shadow: none; opacity: .55;
}
.lang-btn:hover:not(:disabled) { opacity: 1; transform: none; }
.lang-btn.active { opacity: 1; box-shadow: 0 0 0 2px var(--gold); background: rgba(var(--gold-rgb), .15); }
#login-lang { display: flex; justify-content: center; margin: -4px 0 10px; }
@media (max-width: 760px) {
  #topbar-right .lang-switch { gap: 2px; }
  #topbar-right .lang-btn { width: 26px; height: 26px; font-size: 14px; }
}

/* Ikona konta w pasku (avatar albo litera) – otwiera profil */
.who-icon { padding: 0; border: 0; background: none; box-shadow: none; border-radius: 50%; cursor: pointer; flex: none; }
.who-icon:hover:not(:disabled) { transform: none; filter: brightness(1.15); box-shadow: 0 0 0 2px var(--gold); }
.who-icon .who-avatar { display: block; }
.who-initial { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 900; font-size: 16px;
  background: rgba(var(--gold-rgb), .15); color: var(--gold); border: 2px solid var(--gold); }

/* Profil – sekcja Konto */
.pf-account { margin-bottom: 6px; }
.pf-rows { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; padding: 12px 14px; border-radius: 14px; background: rgba(10, 3, 22, .5); border: 1px solid var(--line); }
.pf-row-label { color: var(--muted); font-size: 14px; }
.pf-row-value { font-weight: 700; overflow-wrap: anywhere; }
.pf-lang { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.pf-lang-options { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-lang-options button:disabled { opacity: 1; box-shadow: 0 0 0 2px var(--gold); }
@media (max-width: 760px) { .pf-rows { grid-template-columns: 1fr; gap: 2px; } .pf-row-value { margin-bottom: 6px; } }
@media (max-width: 760px) { #topbar-right .who { display: none; } /* na telefonie sama ikona konta – szczegóły w profilu */ }
.po-xp { margin-top: 6px; font-size: 12.5px; color: var(--gold); font-weight: 700; }

/* Telefon: edytor talii – kolekcja z opisami u góry, talia w stałym pasku na dole (karty o 25% mniejsze niż w menu). */
@media (max-width: 760px) {
  .win:has(> .ed-dock) { padding-bottom: 0; }
  .win:has(> .ed-dock) .menu-grid { gap: 12px 6px; justify-content: flex-start; }
  .ed-item { width: calc((100% - 12px) / 3); display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 0; }
  .ed-item:hover { transform: none; }
  .ed-card { position: relative; padding-bottom: 14px; }
  .ed-item .card { --card-h: 87px; --card-w: 63px; }
  .ed-item.in .card { box-shadow: 0 0 0 2px var(--gold); }
  .ed-tools { display: flex; gap: 6px; }
  .ed-tools button { padding: 2px 12px; font-size: 15px; line-height: 1.2; border-radius: 999px; background: rgba(255, 255, 255, .12); box-shadow: none; }
  .ed-tools .ed-star { filter: grayscale(1); opacity: .6; }
  .ed-tools .ed-star.on { filter: none; opacity: 1; background: rgba(var(--gold-rgb), .25); }
  .ed-dock {
    position: sticky; bottom: 0; z-index: 5; margin: 12px -10px 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--panel-solid); border-top: 1px solid rgba(var(--gold-rgb), .5); box-shadow: 0 -8px 24px rgba(0, 0, 0, .55);
  }
  .dock-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
  .dock-head .deck-total { margin: 0; font-size: 15px; }
  .dock-head .pill { margin-left: auto; padding: 4px 10px; font-size: 12.5px; }
  .dock-cards { display: flex; gap: 4px; overflow: hidden; }
  .dock-card { position: relative; flex: none; }
  .dock-card .card { --card-h: 64px; --card-w: 46px; pointer-events: none; }
  .dock-n { position: absolute; top: -3px; right: -3px; z-index: 4; padding: 0 5px; border-radius: 8px; font-size: 11px; font-weight: 800; background: var(--gold); color: #2a0a40; }
  .ed-dock .form-error { margin-top: 4px; font-size: 12px; }
  .editor-bar .deck-name-input { flex: 1 1 100%; }
  .editor-bar .pill { padding: 6px 12px; font-size: 13.5px; }
}

/* Zakładka Główna: liczba nieprzeczytanych wpisów */
#tabs button { position: relative; }
.tab-badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; background: #e0443a; color: #fff; }
.news-cats { margin-bottom: 4px; }
.news-item.fresh { border-color: rgba(var(--gold-rgb), .6); box-shadow: 0 0 16px rgba(var(--gold-rgb), .15); }
.news-new { display: inline-block; padding: 1px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; vertical-align: middle; background: var(--gold); color: #2a0a40; }
.win > .news { margin-top: 10px; max-width: none; }

/* Graj: kafelki trybów */
.mode-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mode-tile {
  display: flex; flex-direction: column; gap: 4px; padding: 6px 6px 10px; text-align: center; border-radius: 14px;
  background: rgba(10, 3, 22, .55); border: 2px solid var(--line); box-shadow: none; color: inherit;
}
.mode-tile.active { border-color: var(--gold); box-shadow: 0 0 16px rgba(var(--gold-rgb), .3); }
.mode-tile:disabled { cursor: default; opacity: .55; }
.mode-art { position: relative; height: 84px; border-radius: 10px; background: #1a0a30 center 20% / cover; }
.mode-soon { position: absolute; right: 6px; top: 6px; padding: 1px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; background: rgba(20, 6, 38, .9); color: var(--gold); }
.mode-name { font-weight: 800; font-size: 16px; color: var(--gold); }
.mode-desc { font-size: 12px; color: var(--muted); line-height: 1.3; font-weight: 400; }
.play-sub { margin: 14px 0 6px; color: var(--gold); font-size: 16px; }

/* Ranking: tryby i podtryby */
.ranking-tabs .filters { margin-bottom: 6px; }
.ranking-tabs .filters.sub .chip { font-size: 12px; padding: 3px 10px; }
.hrow.rush .h-result { color: var(--gold); }

/* Telefon: podgląd talii z dolnego paska edytora */
.modal.deck-view { width: min(480px, 96vw); text-align: left; }
.modal.deck-view h2 { font-size: 18px; margin-right: 30px; }
.deck-view-list { display: flex; flex-direction: column; gap: 6px; max-height: 70dvh; overflow-y: auto; margin-top: 8px; }
.dv-item { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.dv-item .card { --card-h: 58px; --card-w: 42px; }
.dv-name { font-weight: 700; }
.dv-count { font-weight: 800; color: var(--gold); }
.dv-item .ed-minus { padding: 3px 14px; font-size: 16px; border-radius: 999px; background: rgba(255, 255, 255, .12); box-shadow: none; }
.ed-dock { cursor: pointer; }
@media (max-width: 760px) {
  .mode-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .mode-tile { padding: 4px 4px 8px; border-radius: 12px; }
  .mode-art { height: 58px; border-radius: 8px; }
  .mode-name { font-size: 13.5px; }
  .mode-desc { font-size: 10.5px; }
  .ed-item .hand-desc { font-size: 10px; }
  .tab-badge { margin-left: 4px; min-width: 16px; font-size: 10px; line-height: 16px; }
}

/* Karty: ile brakuje do pełnej kolekcji */
.cards-missing { margin: 0 0 8px; padding: 8px 14px; border-radius: 12px; font-weight: 700; color: var(--gold);
  background: rgba(var(--gold-rgb), .08); border: 1px solid rgba(var(--gold-rgb), .35); }
.cards-missing.done { color: #8fe08a; background: rgba(120, 220, 120, .08); border-color: rgba(120, 220, 120, .35); }
