.cfp-wrap {
  background: #131a2a;
  border: 1px solid #24304a;
  border-radius: 14px;
  padding: 18px;
}
.cfp-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid #24304a;
}
.cfp-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cfp-pill {
  position: relative;
  overflow: hidden;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: #0b0f1a;
  border: 1px solid #2e3d5c;
  color: #e2e8f0;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.cfp-pill-progress { padding-bottom: 7px; }
.cfp-prog-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  transition: width 0.25s ease;
}
.cfp-pill-gold { border-color: #f59e0b; color: #fbbf24; background: rgba(245, 158, 11, 0.14); }
.cfp-pill-upset.has-upsets { border-color: #f59e0b; color: #fbbf24; }
.cfp-pill-proj { border-color: rgba(56, 189, 248, 0.45); color: #38bdf8; background: rgba(56, 189, 248, 0.1); font-size: 12px; }
.cfp-pill-h2h { border-color: rgba(56, 189, 248, 0.6); color: #7dd3fc; background: rgba(56, 189, 248, 0.14); font-size: 12px; }
@keyframes cfpPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.cfp-pop { animation: cfpPop 0.32s ease; }

.cfp-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.cfp-toggle-btn[aria-pressed="true"] {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
}
.cfp-menu-wrap { position: relative; }
.cfp-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 218px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cfp-dd-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: #e2e8f0;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cfp-dd-item:hover { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }
.cfp-dd-tag { font-size: 10.5px; color: #94a3b8; font-weight: 500; }

.cfp-reassure {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: #94a3b8;
  margin-bottom: 12px;
}
.cfp-reassure strong { color: #cbd5e1; }
.cfp-reassure-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cfp-inline-link {
  background: none;
  border: none;
  padding: 0;
  color: #38bdf8;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.cfp-inline-link:hover { color: #7dd3fc; }

/* View Mode Segmented Switcher */
.cfp-view-switch {
  display: inline-flex;
  background: #0b0f1a;
  border: 1px solid #2e3d5c;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.cfp-view-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.cfp-view-btn.is-active {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
}

/* Friend Shared Banner & 1v1 Head-to-Head Bar */
.cfp-friend-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.45);
  font-size: 13px;
  color: #e2e8f0;
}
.cfp-friend-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cfp-h2h-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.14), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(56, 189, 248, 0.5);
  font-size: 12.5px;
  color: #e2e8f0;
}
.cfp-h2h-left { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cfp-h2h-title { font-weight: 800; color: #38bdf8; letter-spacing: 0.02em; }
.cfp-h2h-champs { color: #cbd5e1; font-weight: 600; }
.cfp-h2h-champs strong { color: #fbbf24; }
.cfp-h2h-actions { display: flex; align-items: center; gap: 8px; }

.cfp-editor {
  background: #0b0f1a;
  border: 1px solid #2e3d5c;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.cfp-ed-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.cfp-ed-title-wrap { flex: 1; min-width: 220px; }
.cfp-ed-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 5px;
}
.cfp-ed-input {
  width: 100%;
  background: #131a2a;
  border: 1px solid #2e3d5c;
  border-radius: 8px;
  color: #f1f5f9;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
}
.cfp-ed-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.cfp-ed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cfp-ed-row {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #131a2a;
  border: 1px solid #24304a;
  border-radius: 8px;
  padding: 4px 6px;
}
.cfp-ed-row.is-bye { border-color: rgba(245, 158, 11, 0.5); }
.cfp-ed-seed { font-size: 11px; font-weight: 700; color: #94a3b8; min-width: 44px; text-align: center; }
.cfp-ed-row.is-bye .cfp-ed-seed { color: #fbbf24; }
.cfp-ed-name {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 13px;
  padding: 4px 2px;
}
.cfp-ed-name:focus { outline: none; background: rgba(56, 189, 248, 0.08); border-radius: 4px; }
.cfp-ed-mv {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid #2e3d5c;
  background: #0b0f1a;
  color: #cbd5e1;
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.cfp-ed-mv:hover:not(:disabled) { border-color: #38bdf8; color: #38bdf8; }
.cfp-ed-mv:disabled { opacity: 0.3; cursor: default; }
.cfp-paste-box { margin-top: 12px; padding-top: 12px; border-top: 1px solid #24304a; }
.cfp-paste-area {
  width: 100%;
  min-height: 110px;
  background: #131a2a;
  border: 1px solid #2e3d5c;
  border-radius: 8px;
  color: #f1f5f9;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 8px;
}

.cfp-mobile-jump {
  display: none;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.cfp-jump-btn {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: 999px;
  background: #0b0f1a;
  border: 1px solid #2e3d5c;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.cfp-jump-btn:hover { border-color: #38bdf8; color: #38bdf8; }

/* View visibility rules (zero-CLS on both desktop and mobile!) */
.cfp-scroll { overflow-x: auto; padding-bottom: 6px; min-height: 440px; scroll-behavior: smooth; }
.cfp-cards-wrap { display: none; min-height: 440px; }
.cfp-wrap.is-cards-mode .cfp-scroll { display: none; }
.cfp-wrap.is-cards-mode .cfp-cards-wrap { display: block; }
.cfp-wrap.is-cards-mode .cfp-mobile-jump { display: none; }

@media (max-width: 768px) {
  .cfp-scroll { display: none; }
  .cfp-cards-wrap { display: block; }
  .cfp-wrap.is-tree-mode .cfp-scroll { display: block; }
  .cfp-wrap.is-tree-mode .cfp-cards-wrap { display: none; }
  .cfp-wrap.is-tree-mode .cfp-mobile-jump { display: flex; }
}

.cfp-stage { position: relative; min-width: 980px; }
.cfp-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.cfp-tree {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
}
.cfp-col {
  flex: 1;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cfp-col-head {
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  padding-bottom: 6px;
  border-bottom: 1px solid #24304a;
  line-height: 1.35;
}
.cfp-col-sub { display: block; font-size: 9.5px; font-weight: 500; color: #64748b; text-transform: none; margin-top: 2px; }
.cfp-col-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 16px;
}
.cfp-match-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cfp-match-meta {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  min-height: 15px;
  white-space: nowrap;
  overflow: hidden;
}
.cfp-match-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.cfp-match-meta .is-bye-tag { color: #f59e0b; }
.cfp-meta-tags { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
.cfp-upset-tag {
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.5);
  white-space: nowrap;
}
.cfp-split-tag {
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.55);
  white-space: nowrap;
}
.cfp-agree-tag {
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
  white-space: nowrap;
}
.cfp-match {
  background: #0b0f1a;
  border: 1px solid #2e3d5c;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.cfp-match.is-next {
  border-color: rgba(56, 189, 248, 0.78);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18), 0 0 16px rgba(56, 189, 248, 0.14);
}
.cfp-match.is-upset { border-color: rgba(245, 158, 11, 0.72); }
.cfp-match.is-split { border-color: rgba(244, 63, 94, 0.75); box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.25); }
.cfp-match-finals { border: 2px solid #f59e0b; }
.cfp-match-finals.is-next {
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.28), 0 0 18px rgba(245, 158, 11, 0.22);
}
.cfp-slot {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 6px;
  border: none;
  border-bottom: 1px solid #1e293b;
  background: transparent;
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.cfp-slot:last-child { border-bottom: none; }
.cfp-slot:hover:not(:disabled) { background: rgba(56, 189, 248, 0.15); }
.cfp-slot:disabled { opacity: 0.42; cursor: default; }
.cfp-slot.is-win { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.cfp-slot.is-lose { opacity: 0.5; }
.cfp-abbr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 17px;
  padding: 0 3px;
  border-radius: 4px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #ffffff;
  flex-shrink: 0;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.cfp-seed { font-size: 10px; color: #94a3b8; min-width: 14px; font-weight: 700; flex-shrink: 0; }
.cfp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cfp-score-inp {
  width: 24px;
  height: 19px;
  padding: 0 1px;
  border-radius: 4px;
  border: 1px solid #334155;
  background: #131a2a;
  color: #f8fafc;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
}
.cfp-score-inp:focus { outline: none; border-color: #38bdf8; }
.cfp-slot.is-win .cfp-score-inp { border-color: rgba(52, 211, 153, 0.6); color: #6ee7b7; }

.cfp-friend-foot {
  padding: 3px 7px;
  font-size: 9.5px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.9);
  border-top: 1px solid #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cfp-friend-foot.is-split { color: #fda4af; background: rgba(244, 63, 94, 0.1); }
.cfp-friend-foot.is-agree { color: #6ee7b7; background: rgba(16, 185, 129, 0.08); }

/* Mobile Round-by-Round Focus Cards */
.cfp-round-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.cfp-rtab {
  background: #0b0f1a;
  border: 1px solid #2e3d5c;
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  color: #cbd5e1;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
.cfp-rtab-name { display: block; font-size: 11.5px; font-weight: 800; line-height: 1.2; }
.cfp-rtab-sub { display: block; font-size: 10px; font-weight: 600; color: #94a3b8; margin-top: 2px; }
.cfp-rtab.is-active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
  color: #ffffff;
}
.cfp-rtab.is-active .cfp-rtab-sub { color: #7dd3fc; }
.cfp-rtab.is-done { border-color: rgba(52, 211, 153, 0.55); }
.cfp-rtab.is-done .cfp-rtab-sub { color: #34d399; }

.cfp-cards-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #94a3b8;
}
.cfp-cards-head strong { color: #e2e8f0; font-size: 13.5px; }
.cfp-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.cfp-cards-grid.is-single { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
.cfp-card-slot {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid #1e293b;
  background: transparent;
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}
.cfp-card-slot:last-child { border-bottom: none; }
.cfp-card-slot:hover:not(:disabled) { background: rgba(56, 189, 248, 0.14); }
.cfp-card-slot:disabled { opacity: 0.42; cursor: default; }
.cfp-card-slot.is-win { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.cfp-card-slot.is-lose { opacity: 0.52; }
.cfp-card-slot .cfp-abbr { min-width: 36px; height: 22px; font-size: 10px; }
.cfp-card-slot .cfp-seed { font-size: 12px; min-width: 22px; }
.cfp-card-slot .cfp-score-inp { width: 46px; height: 30px; font-size: 13px; }
.cfp-cards-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 10px;
}

.cfp-tb-box {
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  background: #0b0f1a;
  border: 1px solid #24304a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.cfp-tb-label { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.03em; }
.cfp-tb-input {
  width: 54px;
  background: #131a2a;
  border: 1px solid #2e3d5c;
  border-radius: 6px;
  color: #fbbf24;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 3px 4px;
}
.cfp-champ-box {
  margin-top: 10px;
  padding: 11px 9px;
  border-radius: 10px;
  border: 1px solid #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.06));
  text-align: center;
}
.cfp-champ-label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #fbbf24; }
.cfp-champ-name { margin-top: 4px; font-size: 14px; font-weight: 800; color: #ffffff; }
.cfp-champ-persona { margin-top: 4px; font-size: 10.5px; font-weight: 700; color: #38bdf8; }
.cfp-champ-cta {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(245, 158, 11, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cfp-champ-cta .btn { width: 100%; min-height: 30px; padding: 0 8px; font-size: 11.5px; white-space: nowrap; }
.cfp-status { margin-top: 10px; font-size: 13px; color: #34d399; min-height: 18px; }

/* Celebration Result & Share Modal */
.cfp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.8);
  backdrop-filter: blur(6px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cfp-modal {
  width: 100%;
  max-width: 780px;
  max-height: 92vh;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  position: relative;
}
.cfp-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 18px;
  cursor: pointer;
}
.cfp-modal-close:hover { border-color: #38bdf8; color: #38bdf8; }
.cfp-modal-grid {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 22px;
  align-items: center;
}
.cfp-modal-preview {
  background: #0b0f1a;
  border: 1px solid #2e3d5c;
  border-radius: 12px;
  padding: 8px;
}
.cfp-modal-preview canvas { width: 100%; height: auto; display: block; border-radius: 8px; }
.cfp-modal-kicker {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cfp-modal-title { margin: 10px 0 6px; font-size: 24px; font-weight: 800; line-height: 1.2; color: #ffffff; }
.cfp-modal-quip { margin: 0 0 12px; font-size: 14px; color: #cbd5e1; line-height: 1.5; }
.cfp-modal-h2h {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.45);
  font-size: 12.5px;
  color: #e2e8f0;
  line-height: 1.45;
}
.cfp-modal-h2h strong { color: #38bdf8; }
.cfp-modal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.cfp-modal-actions { display: flex; flex-direction: column; gap: 8px; }
.cfp-modal-subrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cfp-modal-note { margin: 10px 0 0; font-size: 12px; color: #94a3b8; }

@media (max-width: 900px) {
  .cfp-wrap { padding: 14px; }
  .cfp-ed-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .cfp-modal-grid { grid-template-columns: 1fr; }
  .cfp-modal-preview { max-width: 240px; margin: 0 auto; }
  .cfp-cards-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cfp-ed-grid { grid-template-columns: 1fr; }
  .cfp-modal-subrow { grid-template-columns: 1fr; }
  .cfp-cards-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .cfp-round-tabs { gap: 4px; }
  .cfp-rtab { padding: 7px 4px; }
  .cfp-rtab-name { font-size: 10.5px; }
  .cfp-rtab-sub { font-size: 9.5px; }
}