/* CourtMixer - Competition mode (Phase 2, v1.10.0).
   Amber = the existing notice palette (bg #fff7e6, border #f0d9a8, text #8d5f1f).
   Rules: no horizontal scrolling, tap targets at least 40px, text never below 12px. */

/* ===== Header chip ===== */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top .brand-logo { min-width: 0; flex-shrink: 1; }
.app-mode-chip {
  flex-shrink: 0; min-height: 40px; padding: 8px 14px; border-radius: 999px;
  background: transparent; color: #5f6d94; border: 1px solid #c8d5fb;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.app-mode-chip.on { background: #fff7e6; color: #8d5f1f; border-color: #f0d9a8; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
/* Cloud sync button: a cloud with a status dot (grey off, blue syncing, green synced, amber/red trouble) */
.sync-chip { position: relative; flex-shrink: 0; width: 42px; height: 40px; padding: 0; border-radius: 999px; background: transparent; border: 1px solid #c8d5fb; color: #5f6d94; display: inline-flex; align-items: center; justify-content: center; }
.sync-chip svg { width: 22px; height: 22px; display: block; }
.sync-chip .sync-dot { position: absolute; right: 5px; bottom: 6px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; background: #b5bfd6; }
.sync-chip.st-ok { color: #1f8a5b; border-color: #a9dcc3; }
.sync-chip.st-ok .sync-dot { background: #22a96e; }
.sync-chip.st-syncing { color: #4f6fff; border-color: #b9c8ff; }
.sync-chip.st-syncing .sync-dot { background: #4f6fff; animation: syncPulse 1s ease-in-out infinite; }
.sync-chip.st-warn { color: #8d5f1f; border-color: #f0d9a8; background: #fff7e6; }
.sync-chip.st-warn .sync-dot { background: #e0a030; }
.sync-chip.st-error { color: #b3261e; border-color: #f2b8b5; background: #fff4f3; }
.sync-chip.st-error .sync-dot { background: #d93025; }
@keyframes syncPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .sync-chip.st-syncing .sync-dot { animation: none; } }

/* ===== Mode switching: social views are only hidden, never altered ===== */
.screen:not(.comp-mode) .comp-only { display: none !important; }
.screen.comp-mode > .tabs:not(.comp-tabs),
.screen.comp-mode > .view,
.screen.comp-mode > .view.active { display: none; }

/* ===== Amber band ===== */
.comp-band {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: 40px; padding: 8px 14px; cursor: pointer;
  background: #fff7e6; border-bottom: 1px solid #f0d9a8; color: #8d5f1f; font-size: 13px; line-height: 1.35;
}
.band-left { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.band-right { flex-shrink: 0; font-weight: 600; }
.band-menu { flex-shrink: 0; font-size: 16px; }

/* ===== Competition tabs (not .tab, so social tab code never touches them) ===== */
.ctab { text-align: center; padding: 12px 6px; min-height: 40px; color: #6f7ca3; font-size: 14px; border: 0; border-radius: 0; background: transparent; cursor: pointer; font-weight: 500; }
.ctab.active { color: #8d5f1f; border-bottom: 2px solid #b47714; font-weight: 700; }

.comp-view { display: grid; gap: 12px; padding: 14px; min-width: 0; overflow-wrap: anywhere; }
.comp-view button { min-height: 40px; }
.comp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.comp-list { display: grid; gap: 6px; }
.comp-list-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: #f5f8ff; color: #1b2340; border: 1px solid #d8e3ff; }
.comp-list-name { font-weight: 700; overflow-wrap: anywhere; }

/* ===== Wizard ===== */
.wiz { display: grid; gap: 12px; min-width: 0; }
.wiz-progress { display: grid; gap: 6px; width: 100%; text-align: left; background: transparent; color: #1b2340; padding: 4px 0; }
.wiz-progress-text { font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.wiz-bar { display: block; height: 6px; border-radius: 3px; background: #e8eeff; overflow: hidden; }
.wiz-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.wiz-why { margin-top: -4px; }
.wiz-body { display: grid; gap: 10px; min-width: 0; }
.wiz-label { font-size: 13px; font-weight: 700; color: #1b2340; }
.wiz-sub { font-size: 13px; font-weight: 700; color: #1b2340; margin-top: 4px; }
.wiz-field { display: grid; gap: 4px; }
.wiz-input, .wiz-select { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; font-size: 16px; border: 1px solid #c8d5fb; border-radius: 10px; background: #fff; color: #1b2340; font-family: inherit; }
.wiz-select { font-size: 14px; }
.wiz-options { display: grid; gap: 6px; }
.wiz-opt { display: grid; gap: 2px; width: 100%; text-align: left; background: #fff; color: #1b2340; border: 1px solid #d8e3ff; padding: 10px 12px; font-weight: 500; }
.wiz-opt.on { border-color: var(--accent); background: #eef3ff; box-shadow: inset 0 0 0 1px var(--accent); }
.wiz-opt:disabled { opacity: .55; cursor: default; }
.wiz-opt-title { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.wiz-opt-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.wiz-rec { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: #e6f8ee; color: #1b7a4f; font-size: 12px; font-weight: 700; vertical-align: 1px; }
.wiz-rec.amber { background: #fff7e6; color: #8d5f1f; border: 1px solid #f0d9a8; }
.wiz-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.wiz-stepper { display: inline-flex; align-items: center; gap: 4px; }
.wiz-step-btn { width: 40px; height: 40px; padding: 0; font-size: 20px; line-height: 1; background: #eef3ff; color: #4f6fff; border: 1px solid #c8d5fb; }
.wiz-step-btn:disabled { opacity: .4; cursor: default; }
.wiz-step-val { min-width: 32px; text-align: center; font-size: 18px; font-weight: 800; }
.wiz-list { display: grid; gap: 6px; }
.wiz-item { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wiz-item .wiz-input { flex: 1 1 120px; }
.wiz-item .wiz-select { flex: 1 1 140px; }
.wiz-swatch { width: 14px; height: 40px; border-radius: 6px; flex-shrink: 0; border: 1px solid #d8e3ff; }
.wiz-adv summary { cursor: pointer; font-size: 13px; font-weight: 700; color: #4f6fff; min-height: 40px; display: flex; align-items: center; }
.wiz-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.wiz-colors-name { flex: 1 0 100%; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.wiz-color { width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.wiz-color.none { background: #fff; color: #5f6d94; border-color: #c8d5fb; font-size: 18px; }
.wiz-color.on { border-color: #1b2340; box-shadow: 0 0 0 2px #fff inset; }
.wiz-warn { padding: 9px 11px; border-radius: 10px; background: #fff7e6; border: 1px solid #f0d9a8; color: #8d5f1f; font-size: 13px; line-height: 1.45; }
.wiz-errors { padding: 9px 11px; border-radius: 10px; background: #fde7e8; border: 1px solid #ef9ba0; color: #a3262c; font-size: 13px; line-height: 1.45; }
.wiz-placeholder { padding: 12px; border-radius: 10px; background: #f5f8ff; border: 1px dashed #c8d5fb; color: #5f6d94; font-size: 13px; line-height: 1.5; }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; }
.wiz-nav button { flex: 1 1 0; max-width: 200px; }
.wiz-link { background: transparent; color: #4f6fff; padding: 8px 4px; font-weight: 600; font-size: 13px; }
.wiz-rest { justify-self: center; }
.wiz-card { border: 1px solid #d8e3ff; border-radius: 12px; padding: 10px 12px; background: #fafcff; display: grid; gap: 3px; }
.wiz-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.wiz-card-line { font-size: 13px; color: #42506f; overflow-wrap: anywhere; }
.wiz-generate:disabled { opacity: .5; cursor: default; }

/* step list (in the shared modal) */
.wiz-steplist { display: grid; gap: 4px; }
.wiz-steprow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; text-align: left; background: #fff; color: #1b2340; border: 1px solid #e3e9fb; font-weight: 500; font-size: 14px; }
.wiz-steprow:disabled { color: #9aa5c4; cursor: default; }
.wiz-stepicon { width: 18px; text-align: center; flex-shrink: 0; }
.wiz-steprow.done .wiz-stepicon { color: #22a96e; }
.wiz-steprow.current { border-color: var(--accent); font-weight: 700; }
.wiz-steprow.current .wiz-stepicon { color: var(--accent); }
.wiz-steprow.review .wiz-stepicon { color: #b47714; }

@media (max-width: 520px) {
  .comp-view { padding: 10px 8px; gap: 10px; }
  .app-mode-chip { padding: 8px 10px; font-size: 12px; }
  .ctab { font-size: 12px; padding: 10px 4px; }
}

/* ===== Phase 3: wizard pieces ===== */
.wiz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wiz-chip { min-height: 40px; padding: 8px 12px; border-radius: 999px; background: #fff; color: #42506f; border: 1px solid #c8d5fb; font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.wiz-chip.on { background: #eef3ff; color: #4f6fff; border-color: #4f6fff; }
.wiz-seg { display: flex; flex-wrap: wrap; }
.wiz-seg .court-segment, .comp-seg .court-segment { min-height: 36px; font-size: 13px; }
.wiz-pair { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid #eef2fb; flex-wrap: wrap; }
.wiz-pair.withdrawn .wiz-pair-name { text-decoration: line-through; color: #8a95b5; }
.wiz-pair-n { width: 24px; color: #8a95b5; font-size: 13px; flex-shrink: 0; }
.wiz-pair-name { flex: 1 1 140px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.wiz-icon { width: 40px; height: 40px; padding: 0; background: #f5f8ff; color: #4f6fff; border: 1px solid #d8e3ff; font-size: 16px; flex-shrink: 0; }
.wiz-icon:disabled { opacity: .35; cursor: default; }
.wiz-addpair { display: grid; gap: 6px; padding: 10px; border-radius: 12px; background: #f5f8ff; border: 1px solid #e3e9fb; }
.wiz-g { display: inline-flex; flex-shrink: 0; }
.wiz-g .gender-seg { min-height: 40px; min-width: 40px; }
.wiz-text { font-size: 15px; min-height: 110px; resize: vertical; }
.wiz-num { max-width: 110px; }
.wiz-roster { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.wiz-preview { padding: 10px 12px; border-radius: 10px; background: #f5f8ff; border: 1px solid #e3e9fb; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.wiz-builder { display: grid; gap: 8px; padding: 10px; border-radius: 12px; border: 1px dashed #c8d5fb; }
.wiz-adv > :not(summary) { margin-top: 8px; }
.wiz-adv > button { display: block; }

/* ===== Courts tab ===== */
.comp-courts { display: grid; gap: 10px; }
@media (min-width: 720px) { .comp-courts { grid-template-columns: 1fr 1fr; } }
.cc-card { display: grid; gap: 6px; }
.cc-card.busy { border-color: #f0d9a8; background: #fffdf7; }
.cc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; }
.elapsed { font-variant-numeric: tabular-nums; color: #8d5f1f; font-weight: 700; }
.cc-sides { display: grid; gap: 2px; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.cc-sides .vs { color: #8a95b5; font-weight: 500; font-size: 12px; }
.cc-why { line-height: 1.45; }
.cc-next { display: grid; gap: 1px; padding: 6px 0; border-bottom: 1px solid #eef2fb; font-size: 14px; overflow-wrap: anywhere; }

/* ===== Standings ===== */
.st-card { padding: 6px 8px; }
.st-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px 40px; gap: 4px; align-items: center; padding: 7px 2px; border-bottom: 1px solid #eef2fb; font-size: 14px; }
.st-head { font-size: 12px; color: #6f7ca3; font-weight: 700; }
.st-row > span { text-align: center; }
.st-row > .st-name { text-align: left; }
.st-x { display: none; }
.st-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.st-head .st-sub { display: none; }
.st-line { border-bottom: 2px solid #4f6fff; }
.st-tied { background: #fffaf0; }
.st-q { display: inline-block; margin-left: 3px; padding: 0 4px; border-radius: 4px; background: #e6f8ee; color: #1b7a4f; font-size: 12px; font-weight: 700; }
.st-link { background: transparent; color: #1b2340; padding: 0; min-height: 0; font-weight: 600; text-align: left; font-size: 14px; overflow-wrap: anywhere; }
@media (min-width: 520px) {
  .st-row { grid-template-columns: 34px minmax(0, 1fr) 30px 30px 30px 40px 46px 58px; }
  .st-x { display: block; }
  .st-sub { display: none; }
}
.ko-round { display: grid; gap: 8px; }
.ko-meeting { border: 1px solid #e3e9fb; border-radius: 10px; padding: 6px 10px; display: grid; gap: 2px; }
.ko-side { font-size: 14px; overflow-wrap: anywhere; }
.ko-side.win { font-weight: 800; color: #1b7a4f; }
.detail-line { display: grid; grid-template-columns: 1fr; gap: 1px; padding: 6px 0; border-bottom: 1px solid #eef2fb; font-size: 13px; overflow-wrap: anywhere; }

/* ===== Results ===== */
.comp-results { display: grid; gap: 8px; }
.res-card { display: grid; gap: 2px; width: 100%; text-align: left; color: #1b2340; font-weight: 500; }
.res-side { font-size: 14px; overflow-wrap: anywhere; }
.res-side.win { font-weight: 800; }
.res-sets { font-size: 13px; color: #42506f; font-variant-numeric: tabular-nums; }

/* ===== Score sheet (below the shared modal, so pickers open on top) ===== */
.comp-sheet { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; align-items: center; justify-content: center; z-index: 900; padding: 12px; }
.comp-sheet-box { background: #fff; border-radius: 14px; width: 100%; max-width: 420px; max-height: 92vh; overflow: auto; padding: 16px; display: grid; gap: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.25); overflow-wrap: anywhere; }
.score-grid { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 6px; align-items: center; }
.score-head { font-size: 12px; font-weight: 700; text-align: center; color: #42506f; overflow-wrap: anywhere; }
.score-who { display: block; font-weight: 500; color: #5f6d94; }
.score-label { font-size: 13px; color: #5f6d94; }
.score-label.small { font-size: 12px; }
.score-box { min-height: 48px; font-size: 22px; font-weight: 800; background: #f5f8ff; color: #1b2340; border: 1px solid #c8d5fb; }
.score-tb { min-height: 40px; font-size: 16px; text-align: center; border: 1px solid #c8d5fb; border-radius: 8px; width: 100%; }
.score-winner { padding: 8px 10px; border-radius: 10px; background: #e6f8ee; color: #1b7a4f; font-weight: 700; }

/* ===== Phase 4: teams ===== */
.wiz-rubber { display: grid; gap: 6px; padding: 8px 0; border-bottom: 1px solid #eef2fb; }
.wiz-pair-n.wide { width: auto; min-width: 34px; font-weight: 700; color: #42506f; }
.lineup-more { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 13px; color: #42506f; }
.st-row.st-row-teams { grid-template-columns: 34px minmax(0, 1fr) 30px 40px; }
@media (min-width: 520px) { .st-row.st-row-teams { grid-template-columns: 34px minmax(0, 1fr) 30px 30px 30px 30px 40px 58px 58px; } }
.res-meeting { display: grid; gap: 6px; }
.res-meeting-head { display: grid; gap: 2px; width: 100%; text-align: left; background: transparent; color: #1b2340; padding: 0; min-height: 40px; font-weight: 500; }
.res-score { font-size: 15px; overflow-wrap: anywhere; }
.res-score .win { font-weight: 800; }
.res-rubber { display: grid; grid-template-columns: minmax(44px, auto) 1fr; gap: 1px 8px; width: 100%; text-align: left; background: #f8faff; color: #1b2340; border: 1px solid #eef2fb; font-weight: 500; font-size: 13px; overflow-wrap: anywhere; }
.res-rubber > span:not(.res-rubber-label) { grid-column: 2; }
.res-rubber .res-rubber-label { grid-row: span 3; font-weight: 800; color: #42506f; overflow-wrap: normal; }
.res-rubber .win { font-weight: 800; }
.res-rubber.dead { opacity: .55; }
.team-roster { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }

/* ===== Awards and fun facts (Phase 6) ===== */
.aw-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.aw-card > * { min-width: 0; }
.aw-head { overflow-wrap: anywhere; font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: #6a769f; }
.aw-sub { font-size: 12.5px; color: var(--muted, #5f6d94); }
.aw-div { overflow-wrap: anywhere; font-weight: 700; font-size: 13px; color: #8d5f1f; margin-top: 4px; }
.aw-row { display: flex; gap: 12px; align-items: flex-start; background: #f8faff; border: 1px solid #e1e9ff; border-radius: 10px; padding: 10px 12px; }
.aw-em { font-size: 22px; line-height: 1.2; flex-shrink: 0; }
.aw-body { min-width: 0; flex: 1; }
.aw-label { font-size: 12px; font-weight: 700; color: #6a769f; text-transform: uppercase; letter-spacing: .03em; }
.aw-who { font-weight: 700; font-size: 15px; color: #1b2340; overflow-wrap: anywhere; margin-top: 2px; }
.aw-and { color: #6a769f; font-weight: 600; }
.aw-note { font-size: 12.5px; color: #5f6d94; margin-top: 2px; overflow-wrap: anywhere; }
.cf-fact { display: flex; gap: 12px; align-items: flex-start; background: #f8faff; border: 1px solid #e1e9ff; border-radius: 10px; padding: 10px 12px; }
.cf-em { font-size: 20px; line-height: 1.4; flex-shrink: 0; }
.cf-tx { font-size: 13.5px; color: #3b4e84; line-height: 1.55; overflow-wrap: anywhere; min-width: 0; }
.cf-tx strong { color: #1b2340; }
/* long division names wrap instead of widening the page (competition only; social is unchanged) */
.comp-seg, .wiz-seg { flex-wrap: wrap; max-width: 100%; }
.comp-seg .court-segment, .wiz-seg .court-segment { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

/* ===== Cloud sync (Phase 7) ===== */
.sync-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; font-weight: 800; letter-spacing: .04em; text-align: center; padding: 10px; background: #f5f8ff; border: 1px solid #d8e3ff; border-radius: 10px; margin: 6px 0 10px; overflow-wrap: anywhere; color: #1b2340; }
.sync-qr { display: flex; justify-content: center; margin: 4px 0 8px; }
.sync-qr svg { width: 180px; height: 180px; }
.sync-link { font-size: 12px; color: #4f6fff; overflow-wrap: anywhere; background: #f8faff; border: 1px solid #e1e9ff; border-radius: 8px; padding: 8px; }
.sync-tick { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-weight: 600; min-height: 40px; }
.sync-tick input { width: 20px; height: 20px; }
.sync-hint { margin-top: 2px; }
.move-banner { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.move-banner span { flex: 1 1 180px; }
.move-x { background: none; border: 0; font-size: 20px; color: #8d5f1f; min-width: 40px; min-height: 40px; cursor: pointer; }

/* ===== Sync v2: choosing between two phones' versions, item by item ===== */
.mg-card { border: 1px solid #e1e9ff; border-radius: 10px; padding: 10px; margin: 8px 0; background: #f8faff; }
.mg-what { font-weight: 700; font-size: 13px; color: #1b2340; margin-bottom: 6px; overflow-wrap: anywhere; }
.mg-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mg-opt { min-height: 48px; border: 1px solid #c8d5fb; border-radius: 9px; background: #fff; padding: 6px 8px; text-align: left; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #5f6d94; min-width: 0; overflow-wrap: anywhere; }
.mg-opt b { color: #42506f; font-size: 12px; }
.mg-opt span { color: #1b2340; font-size: 14px; font-weight: 600; }
.mg-opt.on { border-color: #4f6fff; background: #eef3ff; box-shadow: 0 0 0 1px #4f6fff inset; }
