/* ui.css — przyciski, okna, przełączniki, kafle statystyk, półki kolekcji,
   tablica wyników i komunikat. Przycisk ma szerokość z treści (min/max),
   nigdy 100%; cel dotyku ≥ 44 px; ruch 120–220 ms tylko transform/opacity
   i wyłączony przy „mniej ruchu”. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: fit-content;
  min-width: min(220px, 76vw); max-width: min(92vw, 360px); min-height: 50px; padding: 10px 20px; cursor: pointer;
  font-size: 16px; font-weight: 800; line-height: 1.2; text-align: center; border-radius: var(--r-m); border: 1px solid var(--edge);
  background: linear-gradient(180deg, var(--card-3), var(--card-2)); color: var(--text); box-shadow: var(--lift-s);
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast);
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn.primary { color: var(--gold-ink); border-color: transparent; background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, var(--gold-3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(0, 0, 0, .18), 0 8px 18px color-mix(in srgb, var(--gold) 35%, transparent); }
.btn.gold { position: relative; overflow: hidden; min-width: 0; color: var(--gold-ink); border-color: transparent;
  background: linear-gradient(180deg, #ffe7a6, var(--gold-2) 30%, var(--gold) 70%, var(--gold-3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -2px 0 rgba(0, 0, 0, .18), 0 8px 20px color-mix(in srgb, var(--gold) 45%, transparent); }
.btn.gold::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg); animation: sheen 2.6s ease-in-out infinite; }
.btn span { display: inline-grid; }
@keyframes sheen { 0%, 55% { transform: translateX(0) skewX(-20deg); } 100% { transform: translateX(520%) skewX(-20deg); } }
.icon-btn {
  width: 48px; height: 48px; display: grid; place-items: center; cursor: pointer; padding: 0; flex: none;
  background: linear-gradient(180deg, var(--card-3), var(--card-2)); border: 1px solid var(--edge); border-radius: var(--r-m);
  box-shadow: var(--lift-s); transition: transform var(--t-fast) var(--ease);
}
.icon-btn .ic { color: var(--gold); }
.icon-btn:active { transform: scale(.95); }
.icon-btn span { display: grid; }

#overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--veil); overflow: hidden;
  padding: calc(var(--safe-top, 0px) + 12px) 12px calc(var(--safe-bottom, 0px) + 12px);
}
#overlay.in .dialog { animation: dlgIn var(--t-med) var(--ease); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.dialog {
  width: min(92vw, 420px); max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain; text-align: center;
  background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--edge-strong);
  border-radius: var(--r-l); box-shadow: var(--lift); padding: clamp(18px, 4.5vw, 26px);
}
.dialog.wide { width: min(94vw, 540px); }
.dlg { display: grid; gap: var(--sp-3); justify-items: center; }
.dlg-title { margin: 0; font-family: var(--serif); font-size: clamp(24px, 6.4vw, 30px); font-weight: 700; line-height: 1.15; }
.dlg-sub { margin: -6px 0 0; color: var(--text-2); font-size: 15px; line-height: 1.4; }
.dlg-tip { margin: 0; padding: 10px 14px; border-radius: var(--r-s); background: var(--card-3); color: var(--text-2); font-size: 14px; line-height: 1.45; max-width: 380px; }
.dlg-note { margin: 0; color: var(--text-3); font-size: 13px; line-height: 1.45; max-width: 440px; }
.actions { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.field { display: grid; gap: 8px; width: min(100%, 460px); justify-items: center; }
.field-label { font-size: 12.5px; font-weight: 800; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; }
.field-label:empty { display: none; }
.section {
  display: flex; align-items: center; gap: 10px; width: min(100%, 420px); margin: 4px 0 -4px; font-size: 12.5px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
}
.section::before, .section::after { content: ""; flex: 1; height: 1px; background: var(--edge); }
.segmented { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.seg {
  min-height: 44px; min-width: 64px; padding: 0 14px; cursor: pointer; font-size: 15px; font-weight: 700;
  background: var(--card-3); border: 1px solid var(--edge); border-radius: var(--r-s); transition: transform var(--t-fast) var(--ease);
}
.seg.on { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink); border-color: transparent; }
.seg:active { transform: scale(.96); }
.langs .segmented { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); width: 100%; }
.toggles { display: grid; gap: 8px; width: min(100%, 400px); }
.toggle {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px; cursor: pointer;
  text-align: left; font-size: 15.5px; font-weight: 700; background: var(--card-3); border: 1px solid var(--edge); border-radius: var(--r-m);
}
.toggle .ic { color: var(--gold); }
.switch { position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--track); transition: background var(--t-fast); }
.switch b { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .3); transition: transform var(--t-fast) var(--ease); }
.toggle[aria-checked="true"] .switch { background: var(--gold); }
.toggle[aria-checked="true"] .switch b { transform: translateX(18px); }
.help { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; text-align: left; width: min(100%, 460px); }
.help li { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 12px; font-size: 15px; line-height: 1.4; }
.help .ic { width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: var(--card-3); color: var(--gold); }

/* statystyki */
.slot { width: 100%; display: grid; justify-items: center; gap: var(--sp-3); }
.stats-body { width: min(100%, 470px); display: grid; justify-items: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; width: 100%; }
.tile { display: grid; gap: 2px; padding: 12px 10px; border-radius: var(--r-m); background: var(--card-3); border: 1px solid var(--edge); }
.tile b { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--gold); }
.tile small { font-size: 12.5px; color: var(--text-2); font-weight: 700; line-height: 1.25; }
.empty { display: grid; justify-items: center; gap: 10px; max-width: 360px; }
.empty p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.45; }
.empty-art { display: flex; gap: 6px; }
.empty-art .ic { width: 34px; height: 34px; padding: 6px; border-radius: 10px; background: #fffdf8; color: #1b1d22; box-shadow: var(--lift-s); }
.empty-art .ic:nth-child(2) { color: #c3223a; transform: translateY(-6px); }

/* kolekcja */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; width: min(100%, 490px); }
.item {
  display: grid; justify-items: center; gap: 6px; padding: 10px 6px; min-height: 44px; cursor: pointer; border-radius: var(--r-m);
  background: var(--card-3); border: 1px solid var(--edge); transition: transform var(--t-fast) var(--ease);
}
.item.on { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 45%, transparent); }
.item.locked { cursor: default; }
.item.locked .swatch-back, .item.locked .swatch-felt { filter: saturate(.55) brightness(.82); opacity: .85; }
.item:active:not(:disabled) { transform: scale(.97); }
.item b { font-size: 14px; }
.item small { display: flex; align-items: center; gap: 4px; min-height: 18px; font-size: 12px; color: var(--text-2); font-weight: 700; text-align: center; line-height: 1.2; }
.item small .ic { width: 14px; height: 14px; flex: none; }
.item.on small { color: var(--gold); }
.swatch-back { display: block; height: auto; }
.swatch-felt { display: block; width: 66px; height: 66px; border-radius: 12px; box-shadow: inset 0 0 18px rgba(0, 0, 0, .45), 0 3px 8px rgba(0, 0, 0, .3); }

/* tablica wyników */
.board { list-style: none; margin: 0; padding: 0; width: min(100%, 440px); display: grid; gap: 4px; }
.board li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--r-s); background: var(--card-3); font-size: 15px; }
.board li:nth-child(-n+3) .pos { color: var(--gold-ink); background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.board li.me { outline: 2px solid var(--gold); }
.board .pos { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--track); font-weight: 800; font-size: 13px; }
.board .who { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.board b { font-variant-numeric: tabular-nums; }
.board-wait { display: grid; gap: 6px; width: min(100%, 440px); }
.skeleton { display: block; height: 40px; border-radius: var(--r-s); background: var(--card-3); animation: breathe 1.1s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

/* wygrana */
.result-suits { display: flex; gap: 8px; justify-content: center; }
.result-suits i { display: grid; place-items: center; width: 44px; height: 58px; border-radius: 8px; background: linear-gradient(180deg, #fffdf8, #efe7d4);
  color: #1b1d22; box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 6px 14px rgba(0, 0, 0, .3); animation: suitIn 420ms var(--ease) both; }
.result-suits i.red { color: #c3223a; }
.result-suits .ic { width: 26px; height: 26px; }
@keyframes suitIn { 0% { opacity: 0; transform: translateY(14px) rotate(-8deg) scale(.7); } 70% { transform: translateY(-3px) scale(1.06); } 100% { opacity: 1; transform: none; } }
.breakdown { display: grid; gap: 4px; width: min(100%, 320px); }
.breakdown .row { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; color: var(--text-2); }
.breakdown .row b { color: var(--text); font-variant-numeric: tabular-nums; }
.breakdown .total { border-top: 1px solid var(--edge); padding-top: 6px; margin-top: 2px; font-weight: 800; color: var(--text); }
.big-score {
  margin-top: -8px; font-size: clamp(42px, 12vw, 56px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 60%, var(--gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.record { margin: -4px 0 0; font-weight: 900; color: var(--gold); font-size: 16px; animation: recordIn 600ms var(--ease) both; }
@keyframes recordIn { from { opacity: 0; transform: scale(.8); } }
.unlock { margin: 0; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 800;
  color: var(--gold-ink); background: linear-gradient(180deg, var(--gold-2), var(--gold)); animation: recordIn 600ms 900ms var(--ease) both; }
.unlock .ic { width: 18px; height: 18px; }
.rank { margin: 0; color: var(--text-2); font-size: 14px; font-weight: 700; }
.rank.waiting { animation: breathe 1.1s ease-in-out infinite; }

.toast {
  position: fixed; z-index: 15; left: 50%; top: calc(var(--safe-top, 0px) + 12px); max-width: min(90vw, 440px);
  padding: 12px 18px; border-radius: var(--r-m); background: var(--card); border: 1px solid var(--edge-strong); box-shadow: var(--lift);
  font-size: 15px; font-weight: 700; line-height: 1.35; text-align: center; pointer-events: none;
  opacity: 0; transform: translate(-50%, -12px); transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body[data-screen="play"][data-layout="top"] .toast { top: auto; bottom: calc(100% - var(--tool-y) + 12px); }
.toast.top, body[data-screen="play"][data-layout="top"] .toast.top { z-index: 30; top: calc(var(--safe-top, 0px) + 12px); }

/* niski ekran (telefon w poziomie): menu w dwóch kolumnach, przyciski w rzędzie */
@media (max-height: 520px) {
  .menu-card { width: min(100%, 780px); grid-template-columns: 1fr 1.2fr; align-items: center; column-gap: var(--sp-4); }
  .menu-card .brand, .menu-card .tagline, .menu-card .menu-foot { grid-column: 1; }
  .menu-card .modes, .menu-card .continue { grid-column: 2; }
  .menu-card .continue { grid-row: 1; }
  .menu-card .modes { grid-row: 2 / span 2; }
  .mode, .continue { min-height: 56px; padding: 6px 12px; }
  .mode .mode-txt small:not(.meta) { display: none; }
  .actions { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .actions .btn { min-width: 150px; }
  .result-suits i { width: 34px; height: 44px; }
  .big-score { font-size: 38px; }
  .dlg { gap: var(--sp-2); }
}
