:root {
  --primary: #062147;
  --primary-dark: #04152e;
  --secondary: #0f2942;
  --accent: #f05123;
  --cyan: #00d4ff;
  --win-bg: #dcfce7;
  --win-border: #16a34a;
  --gold-hl: #fef08a;
  --gold-border: #eab308;
  --swap-hl: #dbeafe;
  --swap-border: #00d4ff;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #cbd5e1;
  --bye-bg: #f8fafc;
  --line-color: #64748b;
  --club-watermark: none;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: #1e293b;
  margin: 0;
  padding: 0;
  transition: background 0.25s;
}

/* ========================================================================= */
/* 1. FRAMELESS TOP CORPORATE AD BANNER (NO BOXES OR BORDERS)                */
/* ========================================================================= */
.iab-leaderboard-slot {
  background: transparent;
  padding: 10px 16px;
  display: none;
  justify-content: center;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.iab-leaderboard-slot.has-items { display: flex; }

.leaderboard-banner-item.corporate-seamless {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 4px 8px;
  text-decoration: none;
  color: #0f172a;
  transition: transform 0.15s, opacity 0.15s;
}
.leaderboard-banner-item.corporate-seamless:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}
.leaderboard-banner-item img {
  height: 48px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
}

.leaderboard-banner-item.bonspiel-labeled {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 4px 8px;
  text-decoration: none;
  color: #0f172a;
}

/* ========================================================================= */
/* 2. FULL-BLEED CURLING ICE MASTHEAD (FRAMELESS SITE LOGO)                  */
/* ========================================================================= */
.dmp-masthead {
  position: relative;
  background-color: #062147;
  background-image:
    radial-gradient(circle at 82% 50%, transparent 0, transparent 38px, rgba(240, 81, 35, 0.22) 39px, rgba(240, 81, 35, 0.22) 72px, transparent 73px, transparent 105px, rgba(0, 212, 255, 0.22) 106px, rgba(0, 212, 255, 0.22) 148px, transparent 149px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(125deg, #041329 0%, #062147 58%, #0a3164 100%);
  background-size: 100% 100%, 40px 40px, 40px 40px, 100% 100%;
  color: #ffffff;
  border-bottom: 4px solid var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.22);
  margin-bottom: 18px;
}
.dmp-masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 81.8%, rgba(0, 212, 255, 0.16) 82%, transparent 82.2%),
    linear-gradient(180deg, transparent 49%, rgba(255,255,255,0.08) 50%, transparent 51%);
  pointer-events: none;
}

.dmp-utility-strip {
  background: rgba(4, 15, 32, 0.78);
  border-bottom: 1px solid rgba(0, 212, 255, 0.14);
  padding: 6px 24px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  z-index: 2;
}
.dmp-utility-left {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.dmp-presenting-logos {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.presenting-partner-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f8fafc;
  text-decoration: none;
  font-weight: 800;
  font-size: 12px;
  opacity: 0.95;
  transition: opacity 0.15s;
}
.presenting-partner-link:hover { opacity: 1; color: var(--cyan); }
.presenting-partner-link img {
  height: 26px;
  width: auto;
  max-width: 110px;
  object-fit: contain;
}

.dmp-masthead-inner {
  max-width: 1640px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
  z-index: 2;
}
.dmp-brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-decoration: none;
}

/* Frameless Site Logo: Zero box, zero border, zero shadow frame */
.dmp-crest-frame {
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dmp-crest-frame img {
  height: 58px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
.dmp-title-group {
  display: flex;
  flex-direction: column;
}
.dmp-wordmark {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: #ffffff;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.45);
}
.dmp-wordmark span.pro-accent { color: var(--accent); }
.dmp-club-subtitle {
  font-size: 12px;
  font-weight: 800;
  color: var(--cyan);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ========================================================================= */
/* 3. RIGHT-RAIL 300px SIDEBAR (UNBOXED, BORDERLESS NATIVE ADS)              */
/* ========================================================================= */
.workspace-with-sidebar {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
.workspace-main-col {
  flex: 1;
  min-width: 0;
}
.packers-right-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: none;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 18px;
}
.packers-right-sidebar.has-items { display: flex; }
@media (max-width: 1180px) {
  .workspace-with-sidebar { flex-direction: column; }
  .packers-right-sidebar {
    width: 100%;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
  }
  .native-ad-unit { flex: 1; min-width: 220px; }
}

.native-ad-unit {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  text-decoration: none;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6px 0;
  transition: transform 0.15s, opacity 0.15s;
}
.native-ad-unit:hover {
  transform: translateY(-2px);
  opacity: 0.92;
}
.native-ad-unit.platform-ad .native-ad-canvas {
  background: transparent !important;
  color: #0f172a;
  padding: 8px 4px;
  min-height: auto;
}

.native-ad-header {
  background: transparent !important;
  border: none !important;
  padding: 0 0 4px 0;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #64748b;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.native-ad-canvas {
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: transparent !important;
  gap: 8px;
}
.native-ad-canvas img {
  max-height: 110px;
  max-width: 260px;
  width: auto;
  object-fit: contain;
}
.native-ad-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}
.native-ad-tagline {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}
.native-ad-cta {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 2px;
}

/* ========================================================================= */
/* 4. SHARED UI COMPONENTS, BUTTONS, ROCK DOTS & BRACKETS                    */
/* ========================================================================= */
.app-container {
  max-width: 1620px;
  margin: 0 auto;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}
.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.club-selector, .profile-selector, .team-finder {
  padding: 7px 10px;
  border: 2px solid var(--cyan);
  border-radius: 6px;
  font-weight: 700;
  font-size: 12.5px;
  background: #041329;
  color: #f8fafc;
}
.club-selector { min-width: 170px; border-color: #facc15; }
.profile-selector { min-width: 195px; }
.team-finder { min-width: 160px; }

.cloud-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
}
.cloud-pill.connecting { background: #fef9c3; color: #854d0e; border-color: #fde047; }
.cloud-pill.connected { background: #dcfce7; color: #15803d; border-color: #86efac; }
.cloud-pill.demo { background: #fef08a; color: #854d0e; border-color: #eab308; }
.cloud-pill.error { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

.rock-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(15, 23, 42, 0.45);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.6), 0 1px 2px rgba(0,0,0,0.2);
}
.rock-red { background: #dc2626; }
.rock-yellow { background: #facc15; }
.rock-blue { background: #2563eb; }
.rock-green { background: #16a34a; }
.rock-black { background: #1e293b; }
.rock-white { background: #f8fafc; border-color: #64748b; }
.rock-orange { background: #ea580c; }
.rock-granite { background: #94a3b8; }

label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #475569;
  display: block;
  margin-bottom: 2px;
}
input, textarea, select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
}
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-top: 2px;
}
.checkbox-row input { width: auto; margin: 0; }

button, .btn-link {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s, opacity 0.15s;
}
button:hover:not(:disabled), .btn-link:hover { background: var(--primary-dark); }
button:disabled { opacity: 0.45; cursor: not-allowed !important; }
button.secondary, .btn-link.secondary { background: #334155; }
button.warning, .btn-link.warning { background: var(--accent); color: #fff; }
button.success, .btn-link.success { background: #15803d; color: #fff; }
button.outline, .btn-link.outline {
  background: #fff;
  color: var(--secondary);
  border: 1px solid var(--border);
}
button.danger { background: #c53030; }
button.lock-active { background: #b91c1c !important; color: #fff !important; }
button.auth-active, .btn-link.auth-active { background: #15803d !important; color: #fff !important; }
button.owner-btn, .btn-link.owner-btn { background: #7c3aed !important; color: #fff !important; }

.version-footer {
  max-width: 1620px;
  margin: 18px auto 12px auto;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  flex-wrap: wrap;
  gap: 8px;
}

/* ========================================================================= */
/* 5. HEADER CONTEXT SWITCHING (LANDING PAGE vs. BRACKET WORKSPACE)          */
/* ========================================================================= */

.toolbar-controls select,
.club-selector,
.profile-selector,
.team-finder {
  width: auto !important;
  max-width: 280px;
}

body.show-landing .bracket-view-only {
  display: none !important;
}

body:not(.show-landing) .landing-view-only {
  display: none !important;
}

.btn-logged-in-profile {
  background: #15803d !important;
  color: #ffffff !important;
  border: 1px solid #4ade80 !important;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.35);
  transition: background 0.15s, transform 0.15s;
}
.btn-logged-in-profile:hover {
  background: #166534 !important;
  transform: translateY(-1px);
}
/* Hide diagnostic Cloud Sync pill from public and club views */
#cloudStatusPill { display: none !important; }