/* Alpha UFC — share UX rebuild; fonts ~12% larger */
:root {
  --bg: #0D0D0F;
  --surface: #1A1A1E;
  --fg: #F5F5F5;
  --muted: #8A8A8E;
  --border: #2A2A2E;
  --accent: #3B82F6;
  --ufc-red: #DC2626;
  --ufc-red-dim: #991B1B;
  --amber: #B45309;
  --amber-bg: rgba(180, 83, 9, 0.55);
  --conflict: #7F1D1D;
  --conflict-bg: rgba(127, 29, 29, 0.72);
  --ok: #22C55E;
  --missing: #EF4444;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
}
a { color: var(--accent); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 48px; }

.ufc-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 20px 0 8px; margin-bottom: 18px;
}
.ufc-header .header-share { margin-left: auto; margin-right: 8px; }
.ufc-header .brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--fg);
}
.ufc-header .brand:hover { opacity: 0.92; }
.ufc-header .brand img {
  width: 44px; height: 44px; border-radius: 10px;
  filter: drop-shadow(0 0 12px rgba(59,130,246,0.55));
}
.ufc-header .brand span { font-weight: 800; letter-spacing: -0.02em; font-size: 1.05rem; }
.header-share {
  flex: 0 0 auto;
  background: #DC2626; color: #fff; font-weight: 800;
  font-size: 1.02rem; padding: 11px 20px; border-radius: 14px;
  border: 1px solid #F87171;
  box-shadow: 0 0 18px rgba(220,38,38,0.55);
  cursor: pointer;
}
.header-share:hover { background: #B91C1C; }
.ufc-mark {
  /* T.T screenshot: dark translucent pill, thin red border, amber bolt flare, ⚡ UFC ⚡ */
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; letter-spacing: 0.06em; font-size: 1.05rem;
  color: #fff; text-decoration: none;
  background: rgba(13, 13, 15, 0.85);
  border: 1px solid #9F1239;
  padding: 10px 18px; border-radius: 999px;
  box-shadow: inset 0 0 18px rgba(220, 38, 38, 0.22), 0 0 16px rgba(251, 146, 60, 0.28);
  text-shadow: 0 0 12px rgba(220,38,38,0.55);
  flex: 0 0 auto;
}
.ufc-mark:hover {
  background: rgba(220,38,38,0.2);
  border-color: #DC2626;
}
.ufc-mark .bolt {
  color: #FBBF24; font-size: 1.15em;
  filter: drop-shadow(0 0 8px rgba(251,191,36,0.95));
}

.punchline {
  text-align: center; font-size: 1.28rem; font-weight: 600;
  margin: 12px 0 8px; color: var(--fg);
}
.joke-rotator {
  text-align: center; color: var(--muted); font-size: 1.02rem;
  font-style: italic; min-height: 1.4em; margin: 0 0 28px;
  padding: 11px 15px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
}

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; margin-bottom: 18px;
}
.panel h2 {
  margin: 0 0 10px; font-size: 1.18rem; font-weight: 800;
  display: flex; align-items: center; gap: 8px;
}
.help {
  color: var(--muted); font-size: 0.92rem; margin: 0 0 12px; line-height: 1.5;
}
.help code {
  background: #0D0D0F; border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px; font-size: 0.88rem; color: #E5E7EB;
}

textarea#rawInput {
  width: 100%; min-height: 150px; resize: vertical;
  background: #0D0D0F; color: var(--fg);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem; line-height: 1.45;
}
textarea#rawInput:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 1.02rem; border-radius: 14px;
  padding: 13px 20px; border: none; cursor: pointer; text-decoration: none;
}
.btn-ufc {
  background: var(--ufc-red); color: #fff;
  box-shadow: 0 0 22px rgba(220,38,38,0.5);
  border: 1px solid #F87171;
}
.btn-ufc:hover { background: #B91C1C; }
.btn-ghost {
  background: transparent; color: var(--fg);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.upload-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px;
}
input[type="file"] { color: var(--muted); max-width: 100%; font-size: 0.95rem; }
.progress {
  display: none; width: 100%; height: 8px; background: #0D0D0F;
  border-radius: 999px; overflow: hidden; margin-top: 10px; border: 1px solid var(--border);
}
.progress.show { display: block; }
.progress > span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--ufc-red), #FBBF24);
  transition: width 0.2s ease;
}
.ocr-status { color: var(--muted); font-size: 0.92rem; margin-top: 6px; min-height: 1.2em; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.bout-table {
  width: 100%; border-collapse: collapse; font-size: 1.02rem; min-width: 720px;
}
table.bout-table th {
  text-align: left; color: var(--muted); font-weight: 600;
  padding: 9px 6px; border-bottom: 1px solid var(--border);
  white-space: nowrap; font-size: 0.95rem;
}
table.bout-table td {
  padding: 7px 6px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.bout-table tr.flag-amber {
  background: var(--amber-bg);
  box-shadow: inset 6px 0 0 0 var(--amber);
}
table.bout-table tr.flag-amber td { color: #FFF7ED; }
table.bout-table tr.flag-conflict {
  background: var(--conflict-bg);
  box-shadow: inset 6px 0 0 0 #DC2626;
}
table.bout-table tr.flag-conflict td { color: #FEE2E2; }
/* CONFLICT must read darker/redder than CHECK amber — never the same hue */
table.bout-table tr.flag-conflict .flag-pill.red { background: #991B1B; }
table.bout-table tr.flag-amber .flag-pill.amber { background: #D97706; color: #111; }
table.bout-table input,
table.bout-table select {
  width: 100%; min-width: 80px;
  background: #0D0D0F; color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 9px; font-size: 0.98rem;
}
table.bout-table .del-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 8px; padding: 7px 9px; cursor: pointer;
  font-size: 0.95rem;
}
table.bout-table .del-btn:hover { color: var(--conflict); border-color: var(--conflict); }
.flag-pill {
  display: inline-block; font-size: 0.78rem; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; letter-spacing: 0.03em;
}
.flag-pill.amber { background: var(--amber); color: #111; }
.flag-pill.red { background: var(--conflict); color: #fff; }

.status-bar {
  margin-top: 12px; color: var(--muted); font-size: 0.95rem; min-height: 1.3em;
}
.status-bar.warn { color: var(--amber); }
.status-bar.err { color: var(--conflict); }
.status-bar.ok { color: var(--ok); }

.cards-view { display: none; }
.cards-view.active { display: block; }
.input-view.hidden, .event-panel.hidden { display: none; }
.bout-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px; margin-bottom: 12px;
}
.bout-card.conflict { border-color: var(--conflict); box-shadow: 0 0 0 1px rgba(239,68,68,0.35); }
.bout-card .vs {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
}
.fighter { flex: 1 1 140px; }
.fighter .name { font-weight: 800; font-size: 1.24rem; }
.fighter .meta { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.vs-mid {
  font-weight: 900; color: var(--ufc-red); letter-spacing: 0.1em; font-size: 1.05rem;
  text-shadow: 0 0 10px rgba(220,38,38,0.6);
}
.officials { margin-top: 10px; color: var(--muted); font-size: 0.96rem; }
.missing { color: var(--missing); font-weight: 700; }

.promo-strip {
  margin-top: 28px; text-align: center;
  padding: 18px; border-radius: 14px;
  border: 1px dashed var(--border);
  background: linear-gradient(180deg, rgba(26,26,30,0.9), rgba(13,13,15,0.6));
  color: var(--muted); font-size: 1rem;
}
.promo-strip strong { color: var(--fg); }
.promo-strip .tag {
  display: inline-block; margin-bottom: 6px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em;
  color: var(--accent); text-transform: uppercase;
}

.back-link {
  display: inline-block; margin: 8px 0 0; color: var(--muted);
  text-decoration: none; font-size: 0.95rem;
}
.back-link:hover { color: var(--fg); }

@media print {
  .input-view, .row-actions, .promo-strip, .back-link,
  .no-print, button, .btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 14pt; }
  .cards-view { display: block !important; }
  .bout-card {
    break-inside: avoid; border: 1px solid #333; background: #fff;
    box-shadow: none; margin-bottom: 10px;
  }
  .vs-mid { color: #DC2626; text-shadow: none; }
  .fighter .meta, .officials { color: #444; }
  .print-header { display: block !important; text-align: center; margin-bottom: 16px; }
  .print-header a { color: #000; }
  .missing { color: #DC2626; }
}
.print-header { display: none; }

/* Desktop share fallback (laptop / no navigator.share) */
.desktop-share-panel {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.desktop-share-panel[hidden] { display: none !important; }
.desktop-share-card {
  background: var(--surface, #1a1a1e);
  border: 1px solid var(--border, #333);
  border-radius: 14px;
  padding: 18px 20px;
  max-width: 640px; width: 100%;
  max-height: 90vh; overflow: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.desktop-share-card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.desktop-share-card textarea {
  width: 100%; box-sizing: border-box;
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem; line-height: 1.35;
  background: #0d0d0f; color: var(--fg, #eee);
  border: 1px solid var(--border, #444);
  border-radius: 10px; padding: 10px 12px;
  resize: vertical;
}
.desktop-share-card .btn { text-decoration: none; display: inline-flex; align-items: center; }


/* Event branding + flags + wide names */
.ufc-header { overflow: visible !important; min-height: 72px; align-items: center; }
.header-right { display:flex; align-items:center; justify-content:flex-end; gap:10px; min-width:0; overflow:visible !important; }
.event-brand {
  display:inline-flex; align-items:center; gap:10px; flex-wrap:wrap;
  font-weight:900; font-size:1.05rem;
  max-width:min(70vw,420px); overflow:visible;
}
.event-brand img, #eventBrandLogo {
  height: 64px !important; width: auto !important;
  max-height: 64px !important; max-width: none !important;
  object-fit: contain !important; object-position: center !important;
  overflow: visible !important; display: inline-block !important; flex: 0 0 auto;
}
.event-panel .event-fields { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; }
.event-label { display:flex; flex-direction:column; gap:6px; font-weight:700; font-size:.9rem; }
.event-label input[type=text] { min-width:220px; padding:10px 12px; border-radius:10px; border:1px solid #333; background:#111; color:#fff; }
.event-preview { margin-top:10px; }
.event-preview img { max-height:64px; max-width:160px; object-fit:contain; }
.punchline { font-size:1.02rem; line-height:1.45; margin:10px 0 8px; }
.punchline-yes { font-weight:800; margin:0 0 6px; }
.punchline-cta a { color:#F87171; font-weight:800; }
.flag { font-style:normal; margin-right:2px; }
.bout-table input[data-k=name],
.bout-table input[data-k=opponent],
.bout-table input[data-k=referee],
.bout-table input[data-k=scorecard] { min-width:9.5rem; width:100%; }
.bout-table th:nth-child(2), .bout-table td:nth-child(2),
.bout-table th:nth-child(4), .bout-table td:nth-child(4) { min-width:10rem; }
.country-cell { display:inline-flex; align-items:center; gap:4px; }

/* T.T: UFC pill MUST DIE when event branding exists — beats .ufc-mark { display:inline-flex } */
body.branding-on .ufc-mark,
.ufc-header.branding-on .ufc-mark,
#headerRight.branding-on .ufc-mark,
.ufc-mark[hidden],
#ufcMarkDefault[hidden] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}
body.branding-on #eventBrandMark,
.ufc-header.branding-on #eventBrandMark {
  display: inline-flex !important;
  visibility: visible !important;
  align-items: center;
  gap: 8px;
}
body.branding-on #eventBrandName { display: inline !important; font-weight: 900; }
body.branding-on #eventBrandLogo:not([hidden]) { display: inline-block !important; height:64px !important; width:auto !important; max-height:64px !important; max-width:none !important; object-fit:contain !important; overflow:visible !important; }


/* Shared /ufc/m/:id — card-only surface, zero editor chrome, zero UFC */
body.shared-mobile .event-panel,
body.shared-mobile .input-view,
body.shared-mobile .back-link,
body.shared-mobile #editAgainBtn,
body.shared-mobile .ufc-mark,
body.shared-mobile #ufcMarkDefault {
  display: none !important;
}
body.shared-mobile .cards-view {
  display: block !important;
}
body.shared-mobile .cards-view .panel.no-print h2,
body.shared-mobile .cards-view .panel.no-print > .help {
  /* keep Share card controls; hide "Card view" chrome noise optional */
}
