/* ============ Meme Cup 2026 ============ */

:root {
  --bg: #0b0e1a;
  --bg2: #141a30;
  --ink: #f4f6ff;
  --muted: #8b93b5;
  --red: #ff2d55;
  --gold: #ffc53d;
  --green: #1c7c3c;
  --green-dark: #135c2b;
  --card: #171d36;
  --display: Impact, "Arial Black", "Helvetica Neue", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: radial-gradient(120% 100% at 50% 0%, var(--bg2) 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.is-active { display: flex; }

/* ============ Poster / shared header ============ */

.poster-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--ink);
}
.brand span { color: var(--gold); }

.matchday {
  font-family: var(--display);
  font-size: 0.95rem;
  color: var(--red);
  letter-spacing: 0.12em;
  text-align: right;
}

.poster-card {
  background:
    linear-gradient(160deg, rgba(255, 45, 85, 0.12), rgba(0, 0, 0, 0) 45%),
    linear-gradient(340deg, rgba(255, 197, 61, 0.10), rgba(0, 0, 0, 0) 45%),
    var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.poster-tagline {
  font-family: var(--display);
  color: var(--gold);
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  margin-bottom: 18px;
}

.poster-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.poster-team { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.flag {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

.team-name {
  font-family: var(--display);
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  min-height: 2.3em;
  display: flex;
  align-items: center;
}

.team-role {
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  color: var(--muted);
}

.vs-burst {
  font-family: var(--display);
  font-size: 1.6rem;
  color: var(--red);
  transform: rotate(-8deg);
  text-shadow: 0 0 18px rgba(255, 45, 85, 0.55);
}

.scouting {
  margin-top: 20px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 197, 61, 0.4);
  color: var(--gold);
  font-size: 0.85rem;
  line-height: 1.4;
}

.poster-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 18px 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
  min-height: 1.2em;
}
.poster-stats b { color: var(--ink); }

/* ============ Buttons ============ */

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  padding: 14px 18px;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 12px;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--red), #ff5f3d);
  border: none;
  box-shadow: 0 10px 30px rgba(255, 45, 85, 0.35);
  font-size: 1.2rem;
}

.btn-ghost { background: transparent; color: var(--muted); }

.hint-line {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 12px;
}

/* ============ Game screen ============ */

.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.game-matchup {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-transform: uppercase;
  max-width: 45%;
}

.kick-dots { display: flex; gap: 6px; }
.kick-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.kick-dot.is-current { background: var(--gold); box-shadow: 0 0 10px rgba(255, 197, 61, 0.7); }
.kick-dot.is-goal { background: #3ddc68; }
.kick-dot.is-fail { background: var(--red); }

.game-score {
  font-family: var(--display);
  color: var(--gold);
  font-size: 0.95rem;
  white-space: nowrap;
}

.pitch {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 10 / 11;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 26px, rgba(0, 0, 0, 0.05) 26px 52px),
    linear-gradient(180deg, var(--green-dark) 0%, var(--green) 70%, #2a9a4d 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* crowd strip */
.pitch::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 9%;
  background:
    repeating-linear-gradient(90deg, #232a4a 0 8px, #31395f 8px 16px, #1d2340 16px 24px);
  opacity: 0.9;
}

.goal {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 10%;
  height: 46%;
  border: 5px solid #f5f5f5;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 9px),
    rgba(0, 0, 0, 0.18);
}

.zones {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  z-index: 3;
}

.zone {
  appearance: none;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.zone.is-armed {
  background: radial-gradient(circle, rgba(255, 197, 61, 0.35) 0%, rgba(255, 197, 61, 0.08) 70%);
  border-color: var(--gold);
}
.zones.is-locked .zone { pointer-events: none; }

/* ============ Keeper ============ */

.keeper {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 12%;
  height: 55%;
  transform: translateX(-50%);
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
  z-index: 2;
  will-change: transform;
}

.keeper-head {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e8b88a;
  z-index: 1;
}

.keeper-body {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: 78%;
  height: 88%;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #ffd54d 0%, #f4ac18 100%);
}

.keeper-arms {
  position: absolute;
  top: 20%;
  left: -30%;
  right: -30%;
  height: 12%;
  border-radius: 999px;
  background: #ffd54d;
  transition: transform 0.3s ease;
}

.keeper.is-diving .keeper-arms { transform: rotate(20deg) scaleX(1.25); }

/* ============ Ball ============ */

.ball {
  position: absolute;
  left: 50%;
  bottom: 7%;
  transform: translate(-50%, 0);
  font-size: clamp(34px, 11vw, 52px);
  line-height: 1;
  z-index: 4;
  transition: transform 0.38s cubic-bezier(0.25, 0.8, 0.4, 1), opacity 0.3s ease;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
  pointer-events: none;
  will-change: transform;
}
.ball.is-charging { animation: ballShake 0.12s infinite; }

@keyframes ballShake {
  0% { margin-left: -1px; }
  50% { margin-left: 1px; }
  100% { margin-left: -1px; }
}

/* ============ Power bar ============ */

.power-wrap { margin-top: 12px; }

.power-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

/* sweet spot: 60–100 of a 0–115 scale */
.power-sweet {
  position: absolute;
  left: 52.2%;
  width: 34.8%;
  top: 0; bottom: 0;
  background: rgba(61, 220, 104, 0.22);
  border-left: 1px solid rgba(61, 220, 104, 0.6);
  border-right: 1px solid rgba(255, 45, 85, 0.7);
}

.power-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #3ddc68, var(--gold) 60%, var(--red));
  transition: none;
}

.power-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ============ Commentary ============ */

.commentary {
  margin-top: 14px;
  min-height: 2.6em;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.kicker-line {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 6px;
  min-height: 1.2em;
}

/* ============ Result screen ============ */

.result-rank {
  font-family: var(--display);
  font-size: clamp(1.9rem, 9vw, 2.6rem);
  text-align: center;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-top: 10px;
  text-shadow: 0 0 30px rgba(255, 197, 61, 0.35);
}

.result-sub {
  text-align: center;
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.9rem;
}

.result-emoji {
  text-align: center;
  font-size: 2rem;
  margin-top: 16px;
  letter-spacing: 0.15em;
}

.result-score {
  text-align: center;
  font-family: var(--display);
  font-size: 2.2rem;
  margin-top: 4px;
}
.result-score span { color: var(--red); font-size: 2.8rem; }

.result-meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 10px 0 14px;
}
.result-meta b { color: var(--ink); }

#card-canvas {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  display: block;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.share-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.share-row .btn { font-size: 0.82rem; padding: 12px 6px; }

/* ============ SEO content + static pages ============ */

.content {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #c9cfe6;
  font-size: 0.92rem;
  line-height: 1.65;
  -webkit-user-select: text;
  user-select: text;
}

.content h2 {
  font-family: var(--display);
  color: var(--ink);
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}

.content h3 {
  font-family: var(--display);
  color: var(--gold);
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  margin: 22px 0 8px;
}

.content p { margin-bottom: 12px; }
.content ul { margin: 0 0 12px 20px; }
.content li { margin-bottom: 6px; }
.content a { color: var(--gold); }
.content strong { color: var(--ink); }
.content code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
}

.table-wrap { overflow-x: auto; margin-bottom: 12px; }

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.content th, .content td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.content th {
  color: var(--gold);
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.06em;
}

.fineprint { color: var(--muted); font-size: 0.8rem; }

.site-footer {
  margin-top: 28px;
  padding: 18px 0 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.site-footer nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.85rem;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* static pages (about, privacy) */
.app-page .content { margin-top: 8px; border-top: none; }
.page-title {
  font-family: var(--display);
  font-size: 1.7rem;
  margin: 8px 0 16px;
}

.ad-slot {
  margin-top: 16px;
  min-height: 90px;
  border-radius: 10px;
  overflow: hidden;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 50;
}
.toast.is-visible { opacity: 1; }
