/* Ekrany gracza — płaski wektor jak w grach: dwa tony, twarde cienie bez rozmycia, kolory sklepu. */
:root {
  --primary: #1c1b33;
  --primary-dark: #0f0e22;
  --accent: #ff6b35;
  --accent-dark: #d9481a;
  --on-accent: #1c1b33;
  --ink: #1c1b33;
  --muted: #6e6d84;
  --bg: #fffaf3;
  --bg-alt: #f6efe4;
  --line: #e9dfcf;
  --line-dark: #dccfb9;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.15; }
a { color: var(--primary); }
.hidden { display: none !important; }

/* pasek sklepu */
.top { background: var(--primary); color: #fff; border-bottom: 5px solid var(--accent); }
.top-in { max-width: 560px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.logo { height: 38px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.shop-name { font: 800 19px/1.1 var(--display); letter-spacing: .2px; }
.game-title { opacity: .85; font-size: 14px; }

main { width: 100%; max-width: 560px; margin: 0 auto; padding: 14px 16px 20px; flex: 1; }
.screen { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 4px 0 var(--line);
}
.card h2 { margin: 0 0 8px; font-size: 24px; }
.card h3 { margin: 0 0 10px; font-size: 18px; }
.big { margin: 0 0 12px; font-size: clamp(28px, 8vw, 36px); font-weight: 800; letter-spacing: -.5px; }

/* obrazek gry na górze */
.hero { position: relative; border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--primary); box-shadow: 0 4px 0 var(--primary-dark); }
.hero-img { display: block; width: 100%; height: 100%; object-fit: cover; animation: drift 14s ease-in-out infinite alternate; }
.hero-badge { position: absolute; top: 12px; left: 12px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 8px; box-shadow: 0 3px 0 var(--accent-dark); }
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.1) translate(-2%, -1%); } }

.perks { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.perks li { display: flex; gap: 10px; align-items: center; background: var(--bg-alt); border-radius: 12px; padding: 9px 12px; font-size: 15px; }
.perk-ico { font-size: 20px; line-height: 1; }

.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="email"], input:not([type]) {
  font: inherit;
  font-size: 18px;
  padding: 12px 14px;
  border: 2px solid var(--line-dark);
  border-radius: 12px;
  width: 100%;
  color: var(--ink);
  background: #fff;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
input.bad { border-color: #b42318; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.4; color: var(--ink); padding: 6px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--primary); }
.check em { color: var(--muted); font-style: normal; }
#consents { display: flex; flex-direction: column; gap: 2px; }

.btn {
  display: inline-block;
  font: 700 17px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 5px 0 var(--accent-dark);
  transition: transform .1s, box-shadow .1s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.big { width: 100%; font: 800 22px/1.1 var(--display); padding: 17px; }
.btn.small { font-size: 15px; padding: 10px 16px; box-shadow: 0 3px 0 var(--accent-dark); }
.btn.ghost { background: #fff; color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary), 0 4px 0 var(--primary); }
.btn.ghost:active { box-shadow: inset 0 0 0 2px var(--primary), 0 1px 0 var(--primary); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--primary); text-decoration: underline; cursor: pointer; }

.fine { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.error { color: #8a1c13; background: #fde8e7; border-radius: 10px; padding: 9px 12px; margin: 0; font-size: 14px; }
.note { background: #fff0c7; color: #5c3d00; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0; }
.note p { margin: 0 0 8px; }
.note p:last-child { margin: 0; }
.hello { margin: 0 0 10px; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stats div { background: var(--bg-alt); border-radius: 14px; padding: 10px 6px; text-align: center; }
.stats span { display: block; font: 800 24px/1.2 var(--display); color: var(--primary); }
.stats small { color: var(--muted); font-size: 12px; }
#noAttempts { margin-top: 0; }

.confirm { margin-top: 14px; background: color-mix(in srgb, var(--accent) 22%, #fff); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.confirm p { margin: 4px 0 6px; }

/* kupon jak bilet */
.ticket {
  margin-top: 14px;
  position: relative;
  border: 2px dashed var(--primary);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ticket small { color: var(--muted); font-weight: 600; }
.ticket b { font: 800 28px/1.15 var(--display); letter-spacing: 2px; color: var(--primary); }
.ticket .link-btn { margin-top: 6px; font-size: 14px; }

.toast { background: #e7f6ee; color: #0f5132; font-weight: 700; padding: 12px 14px; border-radius: 14px; box-shadow: 0 4px 0 #bfe3cf; }

.prizes, .board { margin: 0; padding: 0; list-style: none; }
.prizes li, .board li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.prizes li:last-child, .board li:last-child { border-bottom: 0; }
.prizes li::before { content: attr(data-place); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font: 800 15px var(--display); background: var(--bg-alt); color: var(--primary); flex: none; }
.prizes li:first-child::before { background: #ffc94a; box-shadow: 0 3px 0 #e8a91f; color: #1c1b33; }
.prizes li span { flex: 1; }
.board li .place { font-weight: 800; min-width: 28px; color: var(--muted); }
.board li .nick { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li .score { font-weight: 800; }
.board li.me { background: color-mix(in srgb, var(--accent) 22%, #fff); border-radius: 10px; }
.board .empty { color: var(--muted); justify-content: center; }

/* gra */
#screen-game { gap: 0; }
.game-frame { position: relative; border-radius: 18px; overflow: hidden; background: var(--primary); box-shadow: 0 4px 0 var(--primary-dark); }
#canvas {
  display: block;
  width: 100%;
  height: min(64vh, 520px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
.hint { margin: 0; padding: 12px; text-align: center; font-weight: 700; min-height: 48px; }

.result {
  position: absolute;
  inset: auto 10px 10px 10px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .25);
  display: flex;
  flex-direction: column;
  gap: 9px;
  text-align: center;
  max-height: calc(100% - 20px);
  overflow-y: auto;
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: translateY(30px) scale(.94); opacity: 0; } }
.result-label { color: var(--muted); font-weight: 600; }
.result .dist { font: 800 46px/1 var(--display); color: var(--primary); }
.result-info p { margin: 2px 0; }
.result-info .record { display: inline-block; background: #ffc94a; color: #1c1b33; font-weight: 800; padding: 4px 12px; border-radius: 8px; box-shadow: 0 3px 0 #e8a91f; margin-bottom: 4px; }
.result-info .coupon-line { margin-top: 6px; font-weight: 700; color: var(--primary); }
.result-info .confirm-line { margin-top: 6px; font-size: 14px; background: color-mix(in srgb, var(--accent) 22%, #fff); border-radius: 10px; padding: 8px; }
.result-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 14px; }
.result-links p { width: 100%; margin: 0; color: var(--muted); }
.result-links a { padding: 5px 11px; border-radius: 999px; background: var(--bg-alt); color: var(--primary); font-weight: 700; text-decoration: none; }

.mail-ico { font-size: 44px; }
.spinner { width: 44px; height: 44px; margin: 30vh auto; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.foot { max-width: 560px; width: 100%; margin: 0 auto; padding: 8px 16px 22px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: 13px; color: var(--muted); }
.foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .hero-img, .result, .spinner { animation: none; }
}

.result-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.result-row .btn { flex: 1 1 140px; }
.result-info .target { margin-top: 4px; font-weight: 700; }
.mute-btn { position: absolute; left: 8px; bottom: 8px; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .78); font-size: 17px; line-height: 1; cursor: pointer; box-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.game-frame:has(.result:not(.hidden)) .mute-btn { display: none; }
.back-home { order: 3; margin-left: auto; font-size: 14px; font-weight: 700; color: inherit; text-decoration: none; padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .18); white-space: nowrap; }
.back-home:hover { background: rgba(255, 255, 255, .3); }
@media (max-width: 420px) {
  .top-in .logo { max-width: 92px; height: 32px; }
  .back-home { font-size: 13px; padding: 6px 9px; }
  .top-in { gap: 9px; }
}
