/*
 * Plej.sk – Material Design 3 (základ)
 * Tokeny sú pomenované ako v MD3 (--md-sys-*). Farby súťaže (primary, on-primary, background, pismo)
 * sa dopĺňajú inline v <head> stránky a z nich sa odvodzujú tonálne plochy cez color-mix().
 */

:root {
  /* default farby, ak súťaž žiadne nenastaví */
  --md-sys-color-primary: #bb1119;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-background: #f7f5ee;
  --md-sys-color-on-surface: #1d1b16;

  /* odvodené roly */
  --md-sys-color-surface: color-mix(in srgb, var(--md-sys-color-background) 55%, var(--md-sys-color-card-mix, #fff));
  --md-sys-color-surface-container: color-mix(in srgb, var(--md-sys-color-on-surface) 6%, var(--md-sys-color-surface));
  --md-sys-color-surface-container-high: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, var(--md-sys-color-surface));
  --md-sys-color-on-surface-variant: color-mix(in srgb, var(--md-sys-color-on-surface) 72%, var(--md-sys-color-surface));
  --md-sys-color-outline: color-mix(in srgb, var(--md-sys-color-on-surface) 48%, var(--md-sys-color-surface));
  --md-sys-color-outline-variant: color-mix(in srgb, var(--md-sys-color-on-surface) 16%, var(--md-sys-color-surface));
  --md-sys-color-primary-container: color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-surface));
  --md-sys-color-on-primary-container: color-mix(in srgb, var(--md-sys-color-primary) 70%, var(--md-sys-color-on-surface));
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-error-container: color-mix(in srgb, var(--md-sys-color-error) 14%, var(--md-sys-color-surface));
  --md-sys-color-success: #1b7a3d;
  --md-sys-color-success-container: color-mix(in srgb, var(--md-sys-color-success) 16%, var(--md-sys-color-surface));

  /* tvary */
  --md-sys-shape-xs: 4px;
  --md-sys-shape-md: 12px;
  --md-sys-shape-lg: 16px;
  --md-sys-shape-xl: 28px;
  --md-sys-shape-full: 999px;

  /* elevácia */
  --md-elev-1: 0 1px 2px rgb(0 0 0 / .3), 0 1px 3px 1px rgb(0 0 0 / .15);
  --md-elev-3: 0 1px 3px rgb(0 0 0 / .3), 0 4px 8px 3px rgb(0 0 0 / .15);

  --md-font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --md-motion: 200ms cubic-bezier(.2, 0, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--md-font);
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: .03125em;
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-background);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--md-sys-color-primary); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--md-sys-color-primary) 55%, transparent);
  outline-offset: 2px;
}

.md-skip { position: absolute; left: -9999px; }
.md-skip:focus { left: 8px; top: 8px; z-index: 10; background: var(--md-sys-color-surface); padding: 8px 12px; border-radius: var(--md-sys-shape-md); }

/* ---------- Rozloženie ---------- */

.md-page { padding: 0; }

.md-card {
  max-width: 480px;
  margin: 0 auto;
  background: var(--md-sys-color-surface);
  overflow: hidden;
  min-height: 100vh;
}

.md-card--glow { backdrop-filter: blur(10px); }

@media (min-width: 600px) {
  .md-page { padding: 10px 16px 32px; }
  .md-card {
    min-height: 0;
    border-radius: var(--md-sys-shape-xl);
    box-shadow: var(--md-elev-3);
  }
}

.md-hero { display: block; width: 100%; background: var(--md-sys-color-surface); }
.md-hero img { display: block; width: 100%; }

.md-hero--fallback {
  padding: 40px 24px 24px;
  text-align: center;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.md-hero--fallback h1 { margin: 0; font-size: 2rem; line-height: 2.5rem; font-weight: 700; letter-spacing: 0; }

.md-content { padding: 24px 24px 8px; }
.md-center { text-align: center; }
.md-stack > * + * { margin-top: 16px; }

.md-prizes { display: block; width: 100%; margin-top: 16px; }

/* ---------- Typografia ---------- */

.md-display { font-size: 2.25rem; line-height: 2.75rem; font-weight: 400; letter-spacing: 0; margin: 0; }
.md-headline { font-size: 1.5rem; line-height: 2rem; font-weight: 500; letter-spacing: 0; margin: 0; }
.md-title { font-size: 1.125rem; line-height: 1.75rem; font-weight: 500; letter-spacing: .009em; margin: 0; }
.md-body { font-size: 1rem; line-height: 1.5rem; margin: 0; }
.md-body-m { font-size: .875rem; line-height: 1.25rem; letter-spacing: .018em; margin: 0; }
.md-label { font-size: .75rem; line-height: 1rem; letter-spacing: .033em; }
.md-muted { color: var(--md-sys-color-on-surface-variant); }
strong, b { font-weight: 700; }

/* ---------- Ikona stavu ---------- */

.md-state-icon {
  width: 72px; height: 72px;
  margin: 0 auto;
  display: grid; place-items: center;
}
.md-state-icon svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.md-state-icon--success { color: var(--md-sys-color-success); }
.md-state-icon--error   { color: var(--md-sys-color-error); }
.md-state-icon--info    { color: #1e88e5; }

/* ---------- Tlačidlá ---------- */

.md-btn {
  --_bg: var(--md-sys-color-primary);
  --_fg: var(--md-sys-color-on-primary);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px;
  padding: 10px 24px;
  border: 0;
  border-radius: var(--md-sys-shape-full);
  background: var(--_bg);
  color: var(--_fg);
  font: 500 .875rem/1.25rem var(--md-font);
  letter-spacing: .007em;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow var(--md-motion);
  -webkit-tap-highlight-color: transparent;
}
.md-btn::before { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-motion); }
.md-btn:hover::before { opacity: .08; }
.md-btn:focus-visible::before, .md-btn:active::before { opacity: .12; }
.md-btn:hover { box-shadow: var(--md-elev-1); }
.md-btn--lg { min-height: 56px; padding: 16px 32px; font-size: 1rem; }
.md-btn--block { display: flex; width: 100%; }
.md-btn--tonal { --_bg: var(--md-sys-color-primary-container); --_fg: var(--md-sys-color-on-primary-container); }
.md-btn--outlined { --_bg: transparent; --_fg: var(--md-sys-color-primary); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); }
.md-btn--outlined:hover { box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); }
.md-btn--text { --_bg: transparent; --_fg: var(--md-sys-color-primary); padding-inline: 12px; }
.md-btn--text:hover { box-shadow: none; }
.md-btn[disabled], .md-btn--static {
  --_bg: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
  --_fg: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);
  cursor: default; box-shadow: none; pointer-events: none;
}
.md-btn--static { --_bg: var(--md-sys-color-surface-container-high); --_fg: var(--md-sys-color-on-surface-variant); }
.md-btn.is-loading { pointer-events: none; opacity: .8; }
.md-btn .md-spinner { width: 18px; height: 18px; }

.md-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 24px 0; }
.md-actions--row { flex-direction: row; justify-content: center; flex-wrap: wrap; }

@keyframes md-spin { to { transform: rotate(360deg); } }
.md-spinner { border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: md-spin .8s linear infinite; display: inline-block; }

/* ---------- Banner / hlášky ---------- */

.md-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; margin: 0 24px;
  border-radius: var(--md-sys-shape-md);
  font-size: .875rem; line-height: 1.25rem;
  background: var(--md-sys-color-surface-container);
}
.md-banner--warning, .md-banner--danger { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-surface); }
.md-banner--info { background: var(--md-sys-color-primary-container); }

.md-note { display: flex; gap: 8px; justify-content: center; align-items: flex-start; font-size: .875rem; line-height: 1.25rem; color: var(--md-sys-color-on-surface-variant); }
.md-note svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }

/* ---------- Formulár ---------- */

.md-form { padding: 8px 24px 8px; display: grid; gap: 16px; }

.md-field { position: relative; display: block; }
.md-field__input {
  width: 100%; height: 56px;
  padding: 16px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-xs);
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font: 400 1rem/1.5rem var(--md-font);
  transition: border-color var(--md-motion), box-shadow var(--md-motion);
}
.md-field__input::placeholder { color: transparent; }
.md-field__input:hover { border-color: var(--md-sys-color-on-surface); }
.md-field__input:focus { outline: 0; border-color: var(--md-sys-color-primary); box-shadow: inset 0 0 0 1px var(--md-sys-color-primary); }
.md-field__input:user-invalid { border-color: var(--md-sys-color-error); box-shadow: inset 0 0 0 1px var(--md-sys-color-error); }
.md-field__label {
  position: absolute; left: 12px; top: 16px;
  padding: 0 4px;
  color: var(--md-sys-color-on-surface-variant);
  font: 400 1rem/1.5rem var(--md-font);
  pointer-events: none;
  transform-origin: left top;
  transition: transform var(--md-motion), color var(--md-motion);
  background: var(--md-sys-color-surface);
}
.md-field__input:focus ~ .md-field__label,
.md-field__input:not(:placeholder-shown) ~ .md-field__label {
  transform: translateY(-25px) scale(.75);
}
.md-field__input:focus ~ .md-field__label { color: var(--md-sys-color-primary); }

.md-file { display: grid; gap: 12px; }
.md-file__input {
  width: 100%;
  padding: 12px 16px;
  border: 1px dashed var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-md);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  font: 400 .875rem/1.25rem var(--md-font);
}
.md-file__input::file-selector-button {
  margin-right: 12px; padding: 8px 16px; border: 0; border-radius: var(--md-sys-shape-full);
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  font: 500 .875rem/1.25rem var(--md-font); cursor: pointer;
}
.md-file__preview { max-height: 200px; margin: 0 auto; border-radius: var(--md-sys-shape-md); }

.md-check { display: flex; gap: 12px; align-items: flex-start; font-size: .875rem; line-height: 1.25rem; }
.md-check__box {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 18px; height: 18px; margin: 3px;
  border: 2px solid var(--md-sys-color-on-surface-variant);
  border-radius: 2px; background: transparent; cursor: pointer;
  display: grid; place-content: center;
  transition: background var(--md-motion), border-color var(--md-motion);
}
.md-check__box::after {
  content: ""; width: 10px; height: 6px; margin-top: -2px;
  border-left: 2px solid var(--md-sys-color-on-primary); border-bottom: 2px solid var(--md-sys-color-on-primary);
  transform: rotate(-45deg) scale(0); transition: transform var(--md-motion);
}
.md-check__box:checked { background: var(--md-sys-color-primary); border-color: var(--md-sys-color-primary); }
.md-check__box:checked::after { transform: rotate(-45deg) scale(1); }
.md-check label { cursor: pointer; }

.md-form__submit { display: flex; justify-content: center; padding-top: 4px; }

/* ---------- Skener ---------- */

.qrscanner { position: relative; text-align: center; margin: 0 16px; border-radius: var(--md-sys-shape-xl); overflow: hidden; background: #000; min-height: 280px; }
.qrscanner video, .qrscanner canvas { max-width: 100%; max-height: 100%; }
.qrscanner .arrow-container { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.qr-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.qr-frame { position: relative; width: 240px; height: 240px; }
.qr-frame::before { content: ""; position: absolute; inset: 12px; background: url("/assets/img/qr_code.png") center / contain no-repeat; opacity: .5; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .76); }   /* náznak tvaru QR kódu; svetlá časť je len pod ním, okolie je mierne tmavšie (.76 × opacity .5 = .38) */
.qr-frame::after {
  content: attr(data-hint);
  position: absolute; bottom: -48px; left: 50%; transform: translateX(-50%);
  padding: 4px 12px; border-radius: var(--md-sys-shape-full); white-space: nowrap;
  background: rgb(0 0 0 / .55); color: #fff; font-size: .875rem;
}
.qr-frame .corner { position: absolute; width: 40px; height: 40px; border: 4px solid #fff; }
.qr-frame .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.qr-frame .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.qr-frame .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.qr-frame .br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }

.md-progress { height: 4px; margin: 16px 24px 0; border-radius: var(--md-sys-shape-full); background: var(--md-sys-color-primary-container); overflow: hidden; }
.md-progress::before { content: ""; display: block; height: 100%; width: 40%; background: var(--md-sys-color-primary); border-radius: inherit; animation: md-indeterminate 1.4s var(--md-motion) infinite; }
@keyframes md-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* ---------- Žreby (lístok) ---------- */

.md-ticket {
  margin: 8px auto 0; max-width: 260px; padding: 20px 16px;
  border-radius: var(--md-sys-shape-lg);
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
  text-align: center; font-size: 1.5rem; font-weight: 700;
  position: relative;
}
.md-ticket::before, .md-ticket::after {
  content: ""; position: absolute; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%;
  background: var(--md-sys-color-surface);
}
.md-ticket::before { left: -10px; } .md-ticket::after { right: -10px; }

/* ---------- Pätička ---------- */

.md-legal { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 8px; padding: 16px 24px 0; font-size: .75rem; font-weight: 500; color: var(--md-sys-color-on-surface-variant); }
.md-legal a { color: inherit; }
.md-footer { padding: 24px 24px 32px; text-align: center; font-size: .75rem; color: var(--md-sys-color-on-surface-variant); }
.md-footer a { color: inherit; }

.md-rate { display: flex; gap: 16px; justify-content: center; }
.md-rate__btn { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; color: #fff; text-decoration: none !important; transition: filter .15s, transform .1s; }
.md-rate__btn:hover { filter: brightness(.94); }
.md-rate__btn:active { transform: scale(.96); }
.md-card .md-content a.md-rate__btn.md-rate__btn, .md-rate__btn:hover { color: #fff; }
.md-rate__btn svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.md-rate__btn--no { background: #fd5656; }
.md-rate__btn--yes { background: #09c173; }
.md-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.md-row2 > [hidden] { display: none; }
.md-btn--google, .md-card .md-btn--google { --_bg: #4d8bf2; --_fg: #fff; background: #4d8bf2; color: #fff; border-radius: 999px; font-weight: 500; }
.md-btn--google:hover { background: #4283e8; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
