/* ui.css — przyciski, okna, przełączniki, 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(210px, 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:disabled { cursor: default; filter: saturate(.6); }
.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); }
/* Oferta (reklama za nagrodę): złoto jak zysk, z przesuwającym się połyskiem. */
.btn.gold { position: relative; overflow: hidden; 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; }
@keyframes sheen { 0%, 55% { transform: translateX(0) skewX(-20deg); } 100% { transform: translateX(520%) skewX(-20deg); } }
.btn.waiting span { animation: breathe 1.1s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.icon-btn {
  width: 44px; height: 44px; 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:active { transform: scale(.95); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.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, 400px); max-height: calc(100dvh - 24px); overflow: auto; 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, 520px); }
.dlg { display: grid; gap: var(--sp-3); justify-items: center; }
.dlg-title { margin: 0; font-size: clamp(22px, 6vw, 27px); font-weight: 900; line-height: 1.15; }
.dlg-sub { margin: -6px 0 0; color: var(--text-2); font-size: 15px; }
.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.4; max-width: 360px; }
.dlg-note { margin: 0; color: var(--text-3); font-size: 13px; }
.big-score {
  font-size: clamp(40px, 12vw, 54px); 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; text-shadow: 0 0 18px color-mix(in srgb, var(--gold) 50%, transparent); animation: recordIn 600ms var(--ease) both; }
@keyframes recordIn { from { opacity: 0; transform: scale(.8); } }
.rank { margin: 0; color: var(--text-2); font-size: 14px; font-weight: 700; }
.rank.waiting { animation: breathe 1.1s ease-in-out infinite; }
.result-stars { display: flex; gap: 6px; justify-content: center; margin-bottom: -4px; }
.result-stars i { color: var(--track); display: grid; }
.result-stars .ic { width: 46px; height: 46px; }
.result-stars i.on { color: var(--gold); filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--gold) 55%, transparent)); animation: starIn 460ms var(--ease) both; }
.result-stars i:nth-child(2) .ic { width: 56px; height: 56px; margin-top: -8px; }
@keyframes starIn { 0% { opacity: 0; transform: scale(.3) rotate(-30deg); } 70% { transform: scale(1.15); } 100% { opacity: 1; transform: none; } }
.actions { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }

.toggles { display: grid; gap: 8px; width: min(100%, 360px); }
.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: 16px; 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); }
.field { display: grid; gap: 8px; width: min(100%, 460px); justify-items: center; }
.field-label { font-size: 13px; font-weight: 800; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.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%; }
.help { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; text-align: left; width: min(100%, 440px); }
.help li { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 12px; font-size: 15px; line-height: 1.35; color: var(--text); }
.help .ic { width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: var(--card-3); color: var(--gold); }

.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"] .toast { top: calc(var(--by) + var(--bh) * 0.46); }
/* Komunikat przy otwartym oknie (np. „reklama niedostępna”) idzie nad okno, u góry ekranu. */
.toast.top, body[data-screen="play"] .toast.top { z-index: 30; top: calc(var(--safe-top, 0px) + 12px); }

/* niski ekran (telefon poziomo): karty w dwóch kolumnach, przyciski w rzędzie */
@media (max-height: 520px) {
  .menu-card { width: min(100%, 760px); grid-template-columns: 1fr 1.25fr; align-items: center; column-gap: var(--sp-4); }
  .menu-card .brand, .menu-card .tagline, .menu-card .menu-foot { grid-column: 1; }
  .menu-card .modes { grid-column: 2; grid-row: 1 / span 3; }
  .mode { min-height: 58px; padding: 8px 12px; }
  .levels-card { width: min(100%, 720px); gap: var(--sp-2); }
  .level-grid { grid-template-columns: repeat(10, 1fr); }
  .actions { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .actions .btn { min-width: 150px; }
  .result-stars .ic { width: 34px; height: 34px; }
  .result-stars i:nth-child(2) .ic { width: 40px; height: 40px; margin-top: -4px; }
  .big-score { font-size: 38px; }
  .dlg { gap: var(--sp-2); }
}
