/* 3·2·1 Futbol iOS Design System — Freekick 3D (Full Responsive, Flat, Zero Shadow, Uppercase) */

:root {
  --bg-top: #2F4BB0;
  --bg: #1B2D6E;
  --bg-deep: #10194A;
  --purple: #7B3FE4;
  --yellow: #FFD23F;
  --blue: #3B8BFF;
  --green: #35D07F;
  --red: #FF5470;
  --ink: #1D2B64;
  --muted: #B8C4EE;
  --panel-fill: rgba(16, 25, 74, 0.72);
  --panel-border: rgba(255, 255, 255, 0.14);
  --ghost-fill: rgba(255, 255, 255, 0.16);
  --font: 'Nunito', ui-rounded, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Baloo 2', 'Nunito', ui-rounded, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-deep);
  color: #FFFFFF;
  font-family: var(--font);
}

#app-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

#gl-canvas, #swipe-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#gl-canvas { z-index: 1; }
#swipe-canvas { z-index: 5; touch-action: none; }

/* ==================== SCREENS ==================== */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(18px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.screen > * {
  width: 100%;
  max-width: 460px;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* Soft dark gradient scrim on main menu so logo & flat buttons pop over live 3D stadium */
#screen-menu {
  background: linear-gradient(180deg, rgba(16, 25, 74, 0.62) 0%, rgba(16, 25, 74, 0.25) 48%, rgba(16, 25, 74, 0.78) 100%);
}

/* Game screen overlay must let pointer swipes pass straight through to #swipe-canvas! */
.screen-game {
  pointer-events: none !important;
  padding: 0;
  align-items: stretch;
}

.screen-game > * {
  max-width: none;
}

/* ==================== TOPBAR ==================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-fill);
  border: 1.5px solid var(--panel-border);
  padding: 6px 13px;
  height: 38px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.92rem;
  color: var(--yellow);
}

.trophy-ico {
  width: 15px;
  height: 15px;
  color: var(--yellow);
  flex-shrink: 0;
}

/* ==================== FLAT ZERO-SHADOW BUTTONS (iOS BigButtonStyle & PillButtonStyle) ==================== */
.btn {
  appearance: none;
  border: none;
  outline: none;
  box-shadow: none;
  font-family: var(--font);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 16px;
  height: 46px;
  padding: 0 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #FFFFFF;
  transition: opacity 0.08s ease-out, transform 0.08s ease-out;
}

.btn-lg {
  width: 100%;
  height: 54px;
  font-size: 17px;
}

.btn:active:not(:disabled) {
  opacity: 0.7;
  transform: scale(0.98);
}

.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-blue { background: var(--blue); color: #FFFFFF; }
.btn-green { background: var(--green); color: #FFFFFF; }
.btn-ghost { background: var(--ghost-fill); color: #FFFFFF; }
.btn-danger { background: var(--red); color: #FFFFFF; }

.btn-pill {
  appearance: none;
  border: none;
  box-shadow: none;
  font-family: var(--font);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  height: 32px;
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.08s ease-out, transform 0.08s ease-out;
}

.btn-pill:active { opacity: 0.7; transform: scale(0.97); }
.btn-pill-yellow { background: var(--yellow); color: var(--ink); }

.icon-btn {
  appearance: none;
  border: none;
  box-shadow: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--panel-fill);
  border: 1.5px solid var(--panel-border);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-weight: 900;
  font-size: 12.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.08s ease-out, transform 0.08s ease-out;
}

.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { opacity: 0.7; transform: scale(0.95); }
.icon-btn-sm { width: 34px; height: 34px; }
.icon-btn-sm svg { width: 16px; height: 16px; }

.panel-card {
  background: var(--panel-fill);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--panel-border);
  border-radius: 22px;
  padding: 14px;
}

/* ==================== 1. MAIN MENU ==================== */
.menu-spacer {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

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

.logo-tiles {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-tile {
  width: 48px;
  height: 54px;
  border-radius: 12px;
  background: #FFFFFF;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.logo-tile.t1 { transform: rotate(-8deg) translateY(4px); }
.logo-tile.t2 { transform: rotate(3deg) translateY(-3px); }
.logo-tile.t3 { transform: rotate(9deg) translateY(4px); }

.logo-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--yellow);
  text-transform: uppercase;
}

.logo-sub {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.menu-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.menu-row-2 .btn {
  padding: 0 10px;
  font-size: clamp(12px, 3.4vw, 14.5px);
  white-space: nowrap;
}

/* ==================== 2. ACTIVE HUD & CALLOUTS ==================== */
.game-hud {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 520px);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.hud-chip {
  background: rgba(16, 25, 74, 0.84);
  border: 1.5px solid var(--panel-border);
  border-radius: 14px;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hud-left {
  color: #FFFFFF;
  white-space: nowrap;
}

.hud-center {
  flex: 1;
  justify-content: center;
  font-size: 16px;
}

.streak-badge {
  background: var(--yellow);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
}

.hud-pause {
  pointer-events: auto;
  flex-shrink: 0;
}

/* Dramatic Callout Banner */
.callout {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  animation: calloutPop 0.22s ease;
}

.callout-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 11vw, 54px);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  color: var(--yellow);
  text-shadow: 0 4px 0 var(--ink);
}

.callout.miss .callout-title {
  color: var(--red);
}

.callout-sub {
  margin-top: 6px;
  display: inline-block;
  background: rgba(16, 25, 74, 0.88);
  border: 1.5px solid var(--panel-border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #FFFFFF;
}

.callout-sub:empty { display: none; }

.hint-bubble {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 460px);
  background: var(--purple);
  border-radius: 18px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 800;
  color: #FFFFFF;
  pointer-events: none;
}

.hint-bubble button {
  pointer-events: auto;
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(10, 16, 48, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg);
  border: 1.5px solid var(--panel-border);
  border-radius: 22px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-sm { max-width: 320px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--yellow);
}

.modal-big-title {
  font-family: var(--font-display);
  text-align: center;
  font-size: 1.65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--yellow);
}

.record-pill {
  align-self: center;
  background: var(--green);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
}

.help-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 18px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
}

.modal-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.results-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tot-box {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.tot-lbl {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.tot-val {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #FFFFFF;
}

.tot-val.yellow { color: var(--yellow); }
.tot-val.green { color: var(--green); }

.hidden { display: none !important; }

@keyframes calloutPop {
  from { opacity: 0; transform: translateX(-50%) scale(0.75); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}
