/* ============================================================
 * Catch & Win — Design System
 * Built from the Key Visual PSD: stadium sky-blue, Morocco red/green,
 * gold highlights, white cards, navy ink. No AI-sparkle clichés.
 * Tablet-first, landscape, large touch targets, offline-safe fonts.
 * ============================================================ */

:root {
  /* brand palette */
  --sky-top: #36b8ef;
  --sky-mid: #1b8fd6;
  --sky-deep: #0a3a86;
  --navy: #0a1c52;
  --ink: #0a1a4f;
  --red: #c8102e;
  --red-dark: #9b0e22;
  --green: #006233;
  --green-bright: #1f9e4a;
  --gold: #ffcc00;
  --gold-deep: #f4a900;
  --white: #ffffff;
  --cloud: #eaf5ff;
  --line: rgba(10, 28, 82, 0.12);

  /* type */
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif;

  /* metrics */
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 18px 40px rgba(7, 26, 70, 0.28);
  --shadow-sm: 0 8px 20px rgba(7, 26, 70, 0.18);
  --tap: 64px; /* min touch target */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--font);
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
img { -webkit-user-drag: none; user-drag: none; }

/* ---------------- Stadium background ---------------- */
.stadium {
  position: fixed; inset: 0; overflow: hidden; z-index: 0;
  background: url('../assets/bg-new.webp') center center / cover no-repeat;
}

/* confetti dots (CSS only, subtle) */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }

/* ---------------- App shell ---------------- */
#app { position: relative; z-index: 10; height: 100%; display: flex; flex-direction: column; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column;
  align-items: center; justify-content: center; padding: 3vh 4vw; }
.screen.active { display: flex; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* top brand bar */
.brandbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; pointer-events: none;
}
.brandbar .logos { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.brandbar .logos img { height: 34px; width: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.brandbar .ln-chip { background: #fff; padding: 4px 10px; border-radius: 6px; display: inline-flex; align-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.brandbar .ln-chip img { height: 26px; filter: none; }
.brandbar .logos-right { pointer-events: auto; display: flex; align-items: center; }
.brandbar .logos-right img { height: 34px; width: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }

/* bottom-left PDV info + top-right logout link */
.pdv-info {
  position: fixed; left: 16px; bottom: 14px; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  background: rgba(10, 28, 82, .55); color: #fff; backdrop-filter: blur(6px);
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 15px;
  box-shadow: var(--shadow-sm);
}
.pdv-info .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(255,204,0,.25); }
.pdv-info .city { opacity: .85; font-weight: 600; }
.logout-link {
  position: fixed; top: 14px; right: 60px; z-index: 31;
  color: #fff; font-weight: 700; font-size: 15px; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; background: none; border: 0;
  text-shadow: 0 2px 6px rgba(7,26,70,.5); padding: 6px 4px;
}
.logout-link:hover { color: var(--gold); }

/* sync badge */
.sync-badge {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 31;
  display: none; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
  background: rgba(255, 204, 0, .95); color: #5a3d00; padding: 6px 14px; border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.sync-badge.show { display: inline-flex; }
.sync-badge .spin { width: 12px; height: 12px; border: 2px solid #5a3d00; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Cards / panels ---------------- */
.card {
  background: rgba(7, 26, 70, 0.75);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  border-radius: var(--radius-lg); box-shadow: 0 16px 48px rgba(0,0,0,.5);
  padding: 34px 38px; width: min(720px, 92vw); text-align: center;
  border: 2px solid rgba(255,255,255,1);
  border-bottom: 2px solid rgba(255,255,255,.4);
  border-right: 2px solid rgba(255,255,255,.4);
}
.card.wide { width: min(1100px, 94vw); }

/* ---------------- Headlines ---------------- */
.h-title {
  font-family: var(--font-display); font-weight: 900; line-height: 1.02;
  font-size: clamp(30px, 5.2vw, 62px); margin: 0 0 6px;
  color: #fff; text-transform: uppercase; letter-spacing: .5px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.h-title .red { color: var(--gold); text-shadow: none; }
.h-sub { font-size: clamp(15px, 2.2vw, 22px); color: rgba(255,255,255,0.85); margin: 0 0 22px; font-weight: 600; }
.kicker { display: inline-block; background: var(--gold); color: var(--navy); font-weight: 900;
  padding: 6px 16px; border-radius: 999px; font-size: 14px; letter-spacing: .6px; text-transform: uppercase;
  margin-bottom: 14px; box-shadow: var(--shadow-sm); }

/* ---------------- Buttons ---------------- */
.btn {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer;
  font-family: var(--font-display); font-weight: 900; letter-spacing: .5px;
  min-height: var(--tap); padding: 0 34px; border-radius: 999px;
  font-size: clamp(17px, 2.4vw, 22px); text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn-primary { 
  background: linear-gradient(180deg, #ff5c5c 0%, #e60000 50%, #c20000 100%); 
  color: #fff; border: 1px solid #990000;
  box-shadow: inset 0 2px 5px rgba(255,255,255,.5), 0 8px 0 #8b0000, 0 12px 18px rgba(0,0,0,.35); 
}
.btn-primary:active { transform: translateY(6px); box-shadow: inset 0 2px 5px rgba(255,255,255,.5), 0 2px 0 #8b0000, 0 6px 10px rgba(0,0,0,.35); }

.btn-gold { 
  background: linear-gradient(180deg, #ffea8a 0%, #ffd700 50%, #cca900 100%); 
  color: var(--navy); border: 1px solid #b39500; text-shadow: 0 1px 0 rgba(255,255,255,.6);
  box-shadow: inset 0 2px 5px rgba(255,255,255,.7), 0 8px 0 #997a00, 0 12px 18px rgba(0,0,0,.35); 
}
.btn-gold:active { transform: translateY(6px); box-shadow: inset 0 2px 5px rgba(255,255,255,.7), 0 2px 0 #997a00, 0 6px 10px rgba(0,0,0,.35); }

.btn-green { 
  background: linear-gradient(180deg, #3adb76 0%, #23c562 50%, #1a994c 100%); 
  color: #fff; border: 1px solid #147339;
  box-shadow: inset 0 2px 5px rgba(255,255,255,.4), 0 8px 0 #0f592c, 0 12px 18px rgba(0,0,0,.35); 
}
.btn-green:active { transform: translateY(6px); box-shadow: inset 0 2px 5px rgba(255,255,255,.4), 0 2px 0 #0f592c, 0 6px 10px rgba(0,0,0,.35); }

.btn-ghost { background: rgba(255,255,255,.18); color: #fff; box-shadow: none; border: 2px solid rgba(255,255,255,.6); }
.btn[disabled] { filter: grayscale(.5) opacity(.55); pointer-events: none; }
.btn.lg { min-height: 78px; font-size: clamp(20px, 3vw, 28px); padding: 0 48px; }

/* ---------------- Inputs ---------------- */
.field { text-align: left; margin: 14px 0; }
.field label { display: block; font-weight: 800; color: var(--navy); margin: 0 0 6px; font-size: 15px; }
.input {
  width: 100%; min-height: var(--tap); border-radius: var(--radius-sm);
  border: 2px solid var(--line); background: #f7fbff; padding: 0 18px;
  font-size: 20px; font-weight: 700; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--sky-mid); box-shadow: 0 0 0 4px rgba(27,143,214,.18); background: #fff; }
.input.code { text-align: center; letter-spacing: 4px; font-family: var(--font-display); font-size: 30px; }
.error-msg { color: var(--red); font-weight: 800; min-height: 22px; margin-top: 8px; font-size: 15px; }

/* number stepper */
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 10px 0 4px; }
.stepper button { width: 72px; height: 72px; border-radius: 50%; border: 0; cursor: pointer;
  font-size: 38px; font-weight: 900; color: #fff; background: linear-gradient(180deg, var(--sky-mid), var(--sky-deep));
  box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center; line-height: 1; }
.stepper button:active { transform: scale(.94); }
.stepper .value { font-family: var(--font-display); font-size: 64px; color: var(--navy); min-width: 120px; }

/* ---------------- Rotate overlay ---------------- */
#rotate-overlay {
  position: fixed; inset: 0; z-index: 9999; display: none;
  background: linear-gradient(160deg, var(--sky-deep), var(--navy));
  color: #fff; align-items: center; justify-content: center; flex-direction: column; gap: 18px; text-align: center; padding: 8vw;
}
#rotate-overlay .rot-ico { font-size: 64px; animation: rot 2s ease-in-out infinite; }
@keyframes rot { 0%,100%{transform:rotate(-12deg)} 50%{transform:rotate(78deg)} }
@media (max-aspect-ratio: 13/10) { body.needs-landscape #rotate-overlay { display: flex; } }

/* ---------------- New Login UI ---------------- */
.login-glass {
  background: rgba(7, 26, 70, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 30px;
  padding: 40px 30px;
  width: min(500px, 90vw);
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.login-glass .kicker { background: var(--gold); color: var(--navy); margin-bottom: 0; align-self: center; }
.login-glass .h-title { color: white; text-shadow: 0 2px 10px rgba(0,0,0,0.3); font-size: clamp(34px, 6vw, 50px); margin: 10px 0 0; }
.login-glass .h-title .red { color: var(--gold); text-shadow: none; }
.login-glass .h-sub { color: rgba(255, 255, 255, 0.8); margin: 0 0 10px; font-weight: 500; font-size: 18px; }
.login-glass .input.code { 
  background: rgba(255, 255, 255, 0.9); 
  border: 2px solid transparent; 
  color: var(--navy); 
  border-radius: 16px;
  height: 64px;
  font-size: 28px;
}
.login-glass .input.code:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255,204,0,.3); background: #fff; }
.login-glass .btn-primary { 
  background: linear-gradient(135deg, var(--gold), var(--gold-deep)); 
  color: var(--navy); 
  border: none;
  border-radius: 16px;
  font-size: 22px;
  height: 64px;
  text-shadow: none;
}
.login-glass .btn-primary:active { transform: scale(0.97); }


/* utilities */
.row { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.mt { margin-top: 18px; } .mt-lg { margin-top: 28px; }
.hidden { display: none !important; }
.spacer { flex: 1; }
