/* Shared mobile-first forms, with the same input layout in preview and capture. */
:root { --radius: 12px; --radius-lg: 16px; --shadow-sm: 0 2px 8px #19191508; }
body { background: var(--canvas); }
body:has(.configurator-page), body:has(.entry-page) { overflow: hidden; }
button, .button, .button-secondary, .button-quiet, .icon-button { min-height: 44px; }
input, select, textarea { font-size: 16px; max-width: 100%; min-width: 0; }
.icon-button { width: 44px; border: 1px solid var(--line); border-radius: 10px; background: white; display: grid; place-items: center; flex: 0 0 auto; }
.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button, .button-secondary, .button-quiet { gap: .45rem; justify-content: center; }
.section-header, .capture-toolbar, .form-actions { flex-wrap: wrap; }
.section-header > div, .capture-toolbar > div, .person-name { min-width: 0; }
h1, h2, h3, strong, .person-name { overflow-wrap: anywhere; }
.discipline-grid { display: grid; gap: 1rem; }
.discipline-grid .card { padding: 1.1rem; }
.discipline-grid .form-actions { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.discipline-list { display: grid; gap: 1rem; margin-top: 1rem; }
.discipline-admin-row { padding: 1rem; }
.discipline-admin-row h2 { margin: .6rem 0; }
.discipline-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.leaders-list { padding: .25rem 1rem; }
.leader-row { display: flex; gap: 1rem; width: 100%; text-align: left; align-items: center; background: white; border: 0; border-bottom: 1px solid var(--line); padding: 1rem 0; }
.leader-row:last-child { border-bottom: 0; }
.leader-row > span { flex: 1; }
.leader-row small { display: block; margin-top: .25rem; color: var(--muted); }
.leader-rank { width: 2rem; color: var(--sgr-red); font-size: 1.3rem; }
.compact-select { min-height: 44px; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: white; }
.sort-pills { display: flex; gap: .35rem; }
.sort-pill { border: 1px solid var(--line); border-radius: 8px; background: white; padding: .55rem .8rem; }
.sort-pill.active { color: var(--sgr-red); background: var(--sgr-red-soft); border-color: var(--sgr-red); }
.configurator-backdrop, .entry-backdrop { position: fixed; inset: 0; z-index: 110; background: #19191580; display: grid; place-items: center; }
.configurator-page, .entry-page { background: var(--canvas); width: 100%; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.config-header, .entry-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--line); background: white; flex-shrink: 0; }
.config-header h2, .entry-header h2 { margin: .2rem 0 0; font-size: 1.3rem; }
.config-header small, .entry-header small { color: var(--muted); }
.config-steps { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); flex-shrink: 0; background: white; border-bottom: 1px solid var(--line); }
.config-steps button { display: flex; flex-direction: column; gap: .3rem; align-items: center; padding: .6rem .2rem; border: 0; border-bottom: 3px solid transparent; background: transparent; font-size: .72rem; color: var(--muted); }
.config-steps button span { border: 1px solid var(--line); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.config-steps button.active { color: var(--sgr-red); border-bottom-color: var(--sgr-red); font-weight: 600; }
.config-layout { display: grid; grid-template-columns: minmax(0,1fr); overflow: auto; min-height: 0; flex: 1; }
.config-settings, .config-preview { min-width: 0; padding: 1rem; }
.config-settings .field { margin-bottom: 1rem; }
.config-settings fieldset, .team-entry fieldset, .score-group { padding: 0; margin: 1rem 0; border: 0; min-width: 0; }
.config-settings legend, .score-group legend, .team-entry legend { font-weight: 600; padding: .5rem 0; }
.config-settings h3 { margin: 0 0 1rem; }
.config-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom)); }
.config-actions > button { flex: 1 1 130px; }
.mode-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; }
.mode-options legend { grid-column: 1/-1; }
.mode-option { position: relative; display: flex; padding: .75rem; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: 10px; background: white; }
.mode-option:has(input:checked) { border-color: var(--sgr-red); background: var(--sgr-red-soft); }
.mode-option input { width: 18px; min-height: 18px; margin: 0; }
.mode-option span { display: flex; gap: .45rem; align-items: center; font-size: .85rem; }
.mode-option svg { width: 18px; height: 18px; }
.config-preview { display: none; background: white; }
.preview-visible .config-settings { display: none; }
.preview-visible .config-preview { display: block; }
.preview-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.preview-title h3 { margin: 0; }
.preview-rank { display: flex; justify-content: space-between; gap: .5rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.post-settings summary { padding: .75rem 0; cursor: pointer; }
.individual-post { border-bottom: 1px solid var(--line) !important; }
.score-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .7rem; }
.score-cell { min-width: 0; padding: .6rem; border: 1px solid var(--line); border-radius: 10px; background: white; }
.score-cell.active { border-color: var(--sgr-red); }
.score-cell label { display: flex; flex-direction: column; font-size: .9rem; font-weight: 600; gap: .15rem; margin-bottom: .4rem; }
.score-cell small { font-weight: 400; color: var(--muted); }
.score-cell input, .score-cell select { width: 100%; padding: .65rem; min-height: 46px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.score-cell select { margin-bottom: .4rem; font-size: 16px; padding: .4rem; }
.quick-values { display: flex; flex-wrap: wrap; gap: .4rem; padding: .65rem 0; }
.quick-values > button { min-width: 44px; padding: .5rem .75rem; }
.score-summary { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; padding: 1rem; background: var(--sgr-red-soft); border-radius: 10px; margin-top: 1rem; }
.field-error { color: var(--danger); background: #fff2f0; padding: .8rem; border-radius: 8px; overflow-wrap: anywhere; }
.entry-page form { overflow: auto; padding: 1rem; min-height: 0; flex: 1; }
.entry-actions { display: flex; flex-wrap: wrap; gap: .5rem; background: var(--canvas); padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom)); }
.entry-actions > button { flex: 1 1 150px; }
.capture-toolbar { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.capture-toolbar h1 { margin: 0; }
.capture-toolbar p { margin: .5rem 0 1rem; }
.capture-filters { display: grid; grid-template-columns: minmax(0,1fr); gap: .75rem; margin: 1rem 0; }
.capture-people, .match-list { display: grid; gap: .6rem; }
.capture-person { display: flex; width: 100%; align-items: center; text-align: left; justify-content: space-between; gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: white; }
.capture-person small, .capture-rank-row small { display: block; color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.entry-state { flex-shrink: 0; font-size: .75rem; max-width: 40%; text-align: right; }
.state-complete { color: var(--success); }
.state-in_progress { color: #8f570b; }
.match-card { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); width: 100%; gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: white; text-align: left; }
.match-card > span:last-of-type { text-align: right; }
.match-card small { grid-column: 1/-1; color: var(--muted); }
.team-entry { display: grid; gap: 1rem; }
.team-entry .field { margin-bottom: 1rem; }
.capture-rank-row { display: grid; grid-template-columns: 2.5rem minmax(0,1fr) auto; gap: .5rem; align-items: center; padding: 1rem; border-bottom: 1px solid var(--line); background: white; }
.conflict-card { background: #fff8f0; border: 1px solid #e1b890; padding: 1rem; border-radius: 10px; margin: 1rem 0; }
.conflict-values { display: grid; gap: 1rem; }
.conflict-values pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; }
.compare-scores > div { display: flex; justify-content: space-between; gap: .75rem; border-bottom: 1px solid var(--line); padding: .4rem 0; }
.compare-scores dt { font-size: .85rem; }
.compare-scores dd { margin: 0; flex-shrink: 0; }
.modal { max-height: 92dvh; }
@media (min-width: 640px) {
  .discipline-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .capture-filters { grid-template-columns: minmax(0,2fr) minmax(0,1fr); align-items: end; }
  .score-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .team-entry, .conflict-values { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .entry-page { max-width: 760px; height: min(92dvh,1000px); border-radius: 14px; }
}
@media (min-width: 1000px) {
  .configurator-page { max-width: 1240px; height: 92dvh; border-radius: 14px; }
  .config-layout { grid-template-columns: minmax(0,1fr) 400px; }
  .config-preview, .preview-visible .config-settings { display: block; }
  .config-preview { border-left: 1px solid var(--line); }
  .config-preview .score-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .config-preview-toggle { display: none; }
  .config-settings, .config-preview { padding: 1.5rem; }
  .config-steps button { flex-direction: row; justify-content: center; font-size: .9rem; gap: .65rem; }
  .capture-people { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 399px) {
  .brand img { max-width: 120px; }
  .brand strong { font-size: .85rem; }
  .app-header { padding-inline: .75rem; gap: .5rem; }
  .header-actions { gap: .3rem; }
  .viewer-link-pill { padding-inline: .5rem; font-size: .75rem; }
  .mode-option { padding: .55rem; gap: .3rem; }
  .mode-option span { gap: .25rem; font-size: .75rem; }
  .section-header .button { width: 100%; }
}
