/* Szurkolói szelfi – nyilvános felület */
:root {
  --navy: #0b1f3a;
  --navy-2: #13305a;
  --blue: #1f5fbf;
  --red: #d6202f;
  --red-dark: #a91623;
  --white: #ffffff;
  --text: #eef3fb;
  --muted: #9fb2cf;
  --card: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.14);
  --error: #ff6b78;
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -200px, var(--navy-2), var(--navy)) fixed, var(--navy);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: #8fc1ff; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 31, 58, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.lang-switch { display: flex; gap: 4px; }
.lang-switch a {
  display: inline-block;
  padding: 6px 9px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.lang-switch a.active { background: var(--red); color: var(--white); }

.container {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.site-footer {
  text-align: center;
  padding: 16px 16px max(16px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 13px;
}

.hero { text-align: center; margin: 8px 0 20px; }
.hero h1 { font-size: clamp(24px, 6vw, 32px); line-height: 1.2; margin: 6px 0 0; }
.event-name {
  display: inline-block;
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--red);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
}
.card h1 { margin-top: 0; font-size: 24px; }

.center { text-align: center; }
.lead { font-size: 16px; color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Űrlap */
.form { display: flex; flex-direction: column; gap: 16px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: 14px; }
.field input {
  font: inherit;
  font-size: 16px; /* iOS zoom ellen */
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  color: #0b1f3a;
}
.field input:focus { outline: 3px solid rgba(31, 95, 191, 0.6); outline-offset: 1px; }
.has-error input { border-color: var(--error); }
.hint { color: var(--muted); font-size: 13px; }
.error, .form-error { color: var(--error); font-size: 13px; font-weight: 600; }
.form-error { text-align: center; margin: 10px 0 0; }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--red); }

/* Gombok */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 20px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  color: var(--white);
  background: var(--navy-2);
  transition: transform .08s ease, background .2s ease, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--red); }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { background: rgba(255, 255, 255, 0.12); border: 1px solid var(--border); }
.btn-link { background: none; color: var(--muted); min-height: 40px; font-weight: 600; }
.btn-block { width: 100%; }

/* Keretválasztó */
.frame-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.frame-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}
.frame-preview {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border);
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.02)),
    repeating-conic-gradient(#28456f 0% 25%, #1d3a63 0% 50%) 50% / 20px 20px;
  transition: border-color .2s, transform .15s;
}
.frame-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.frame-option:hover .frame-preview, .frame-option:focus .frame-preview { border-color: var(--red); transform: translateY(-2px); }
.frame-name { font-size: 14px; font-weight: 600; text-align: center; }

/* Kamera */
.page-camera .container { max-width: 640px; padding-top: 12px; }
.camera-app { display: flex; flex-direction: column; gap: 14px; }
.stage-wrap { display: flex; justify-content: center; }
/* A szélességet a keret képaránya (--ar, JS állítja) és a rendelkezésre álló magasság határozza meg */
.stage {
  --stage-h: 64vh;
  position: relative;
  width: 100%;
  width: min(100%, calc(var(--stage-h) * var(--ar, 0.8)));
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
@supports (height: 1dvh) { .stage { --stage-h: 64dvh; } }
.stage video, .stage canvas, .stage .frame-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.stage video { object-fit: cover; }
.stage video.mirrored { transform: scaleX(-1); }
.stage .frame-overlay { object-fit: fill; pointer-events: none; z-index: 2; }
.review-canvas { display: none; z-index: 3; }

.stage-message {
  position: absolute;
  inset: auto 12px 12px;
  z-index: 4;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 14px;
  text-align: center;
}
.stage-message[hidden] { display: none; }

.countdown {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30vmin;
  font-weight: 800;
  color: var(--white);
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
}
.countdown.show { opacity: 1; animation: pulse 1s infinite; }
@keyframes pulse { 0% { transform: scale(1.3); opacity: .4; } 30% { transform: scale(1); opacity: 1; } 100% { opacity: .9; } }

.flash { position: absolute; inset: 0; z-index: 6; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }

.frame-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scroll-snap-type: x mandatory;
  justify-content: safe center;
}
.frame-chip {
  flex: none;
  height: 76px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #1d3a63;
  cursor: pointer;
  scroll-snap-align: center;
}
.frame-chip img { display: block; height: 100%; width: auto; }
.frame-chip.active { border-color: var(--red); box-shadow: 0 0 0 3px rgba(214, 32, 47, .35); }

.controls { display: none; align-items: center; justify-content: center; gap: 16px; }
.controls-live { justify-content: space-between; padding: 0 8px; }
.controls-review .btn { flex: 1; }

.btn-round {
  flex-direction: column;
  gap: 2px;
  width: 92px;
  min-height: 64px;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 600;
}
.btn-round svg { width: 24px; height: 24px; fill: currentColor; }
.btn-round.active { background: var(--blue); }
.btn-round[hidden] { visibility: hidden; display: inline-flex; }
.btn-label { line-height: 1.15; text-align: center; }

.btn-shutter {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 5px solid var(--white);
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(214, 32, 47, .35);
  cursor: pointer;
  transition: transform .1s;
  flex: none;
}
.btn-shutter:active { transform: scale(.9); }
.btn-shutter:disabled { opacity: .5; }

/* Állapotok */
[data-state="live"] .controls-live { display: flex; }
[data-state="fallback"] .controls-fallback { display: flex; }
[data-state="fallback"] video { display: none; }
[data-state="review"] .controls-review,
[data-state="sending"] .controls-review { display: flex; }
[data-state="review"] .review-canvas,
[data-state="sending"] .review-canvas { display: block; }
[data-state="review"] video, [data-state="sending"] video,
[data-state="review"] .frame-overlay, [data-state="sending"] .frame-overlay { visibility: hidden; }
[data-state="sending"] .frame-strip { pointer-events: none; opacity: .5; }

.done-icon {
  width: 84px;
  height: 84px;
  margin: 4px auto 8px;
  border-radius: 50%;
  background: #1e9e5a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.done-icon svg { width: 48px; height: 48px; fill: #fff; }

@media (min-width: 700px) {
  .frame-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
