:root {
  color-scheme: light;

  /* Skin: Wimbledon (AELTC purple + deep grass green) */
  --bg-grad-a: #1c6b3f;
  --bg-grad-mid: #123f28;
  --bg-grad-b: #2a1245;
  --bg-grad-mid-stop: 65%;
  --bg-highlight: rgba(255, 205, 90, 0.32);
  --surface-2: #f2e9fb;
  --surface-3: #d9c2f0;
  --border: #b6a1cf;
  --border-strong: #4a2373;
  --accent: #4b2585;
  --accent-dark: #321a59;
  --accent-tint: #ece0fb;
  --accent-glow: rgba(75, 37, 133, 0.35);
  --toolbar-bg: rgba(18, 10, 30, 0.95);
  --toolbar-border: rgba(150, 100, 200, 0.55);
  --muted: #5c4f6e;
  --mode-display-bg: #351552;
  --skin-toggle-bg: #4b2585;

  /* Fixed across skins: functional/semantic colors */
  --surface: #ffffff;
  --text: #0b2415;
  --red: #e6322f;
  --blue: #076bd6;
  --chip-border: #9fd27a;
  --paused-bg: #edf3e5;
  --backdrop: rgba(23, 49, 31, 0.42);
  --danger-bg: #ffe8e2;
  --danger-border: #f08070;
  --warning-bg: #fff0a6;
  --warning-border: #efbf1f;
  --warning-text: #624000;
  --shadow: 0 16px 34px rgba(2, 45, 24, 0.26);
}

:root[data-skin="frenchopen"] {
  /* Skin: Roland Garros (terracotta clay + court green) */
  --bg-grad-a: #d9702f;
  --bg-grad-mid: #a8431f;
  --bg-grad-b: #163826;
  --bg-grad-mid-stop: 48%;
  --bg-highlight: rgba(255, 200, 130, 0.4);
  --surface-2: #fbe7d7;
  --surface-3: #f0c093;
  --border: #d9a274;
  --border-strong: #a83f1d;
  --accent: #b5451f;
  --accent-dark: #7c2f14;
  --accent-tint: #fbdcc4;
  --accent-glow: rgba(181, 69, 31, 0.35);
  --toolbar-bg: rgba(45, 20, 10, 0.95);
  --toolbar-border: rgba(181, 69, 31, 0.55);
  --muted: #7a5136;
  --mode-display-bg: #762711;
  --skin-toggle-bg: #a83f1d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  background:
    radial-gradient(circle at 18% 0%, var(--bg-highlight), transparent 32%),
    linear-gradient(180deg, var(--bg-grad-a) 0%, var(--bg-grad-mid) var(--bg-grad-mid-stop), var(--bg-grad-b) 100%);
  content: "";
  inset: 0;
  position: fixed;
  z-index: -1;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.42;
}

.app {
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 100% 96px, 96px 100%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 22px 60px rgba(0, 38, 21, 0.26);
  min-height: 100dvh;
  padding: 0 6px 92px;
  max-width: 520px;
  margin: 0 auto;
}

.app-header {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  left: 0;
  margin: 0 -6px;
  padding: 14px 6px 10px;
  position: sticky;
  right: 0;
  top: 0;
  z-index: 5;
}

.app-header .status-strip,
.app-header .app-notice {
  margin-bottom: 0;
}

.app-header .app-notice {
  margin-top: 10px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.icon-btn,
.tool-btn {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  display: inline-flex;
  font-size: 18px;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  min-width: 40px;
  padding: 0 12px;
}

.primary-btn {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  gap: 8px;
  height: 44px;
  justify-content: center;
  padding: 0 16px;
  width: 100%;
}

.secondary-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent-dark);
  font-weight: 700;
  min-height: 40px;
  padding: 9px 12px;
}

.danger-btn {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 8px;
  color: #b72f35;
  font-weight: 700;
  min-height: 40px;
  padding: 9px 12px;
}

.compact-danger-btn {
  border-radius: 5px;
  font-size: 11px;
  min-height: 26px;
  padding: 3px 7px;
}

.compact-action-btn {
  border-radius: 6px;
  font-size: 12px;
  min-height: 32px;
  padding: 5px 8px;
  white-space: nowrap;
}

.setup {
  display: grid;
  gap: 16px;
  min-height: 100dvh;
  padding: 28px 16px;
  place-items: center;
}

.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  max-width: 440px;
  padding: 22px;
  width: 100%;
}

.setup-lead {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
  margin: 0;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.setup-selection-grid {
  display: grid;
  gap: 10px;
}

.setup-field-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.setup-preserve-option {
  align-items: start;
  background: var(--accent-tint);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 12px;
}

.setup-preserve-option input {
  accent-color: var(--accent);
  height: 20px;
  margin: 1px 0 0;
  padding: 0;
  width: 20px;
}

.setup-preserve-copy {
  display: grid;
  gap: 4px;
}

.setup-preserve-copy strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.setup-preserve-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.setup-warning,
.app-notice {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 7px;
  color: var(--warning-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  padding: 9px 10px;
}

.setup-actions {
  display: grid;
  gap: 8px;
}

.setup-actions.with-back {
  grid-template-columns: 0.7fr 1fr;
}

.field {
  display: grid;
  gap: 7px;
}

label,
.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
input,
textarea {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  padding: 0 11px;
  width: 100%;
}

select,
input {
  height: 42px;
}

.team-picker {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, 1fr);
}

.team-picker-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  min-height: 44px;
  padding: 0 4px;
}

.team-picker-btn.red.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.team-picker-btn.white.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.team-picker-btn.none.active {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

textarea {
  min-height: 130px;
  padding: 10px 11px;
  resize: vertical;
}

.top-row {
  align-items: stretch;
  display: flex;
  gap: 0;
  margin-bottom: 12px;
}

.session-mode-display {
  align-items: center;
  background: var(--mode-display-bg);
  border-radius: 21px 0 0 21px;
  display: flex;
  flex: 1 1 auto;
  height: 42px;
  justify-content: flex-start;
  min-height: 42px;
  overflow: hidden;
  padding: 7px 34px 7px 16px;
  position: relative;
}

.session-mode-display::after {
  background: var(--surface);
  border-radius: 50%;
  content: "";
  height: 42px;
  position: absolute;
  right: -21px;
  top: 0;
  width: 42px;
}

.session-mode-display strong {
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.status-strip {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 10px;
}

.app-notice {
  margin-bottom: 10px;
}

.stat {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
  margin-top: 3px;
}

.score-stat {
  align-items: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

.score-stat .switch {
  flex: 0 0 auto;
  height: 30px;
  width: 58px;
}

.score-stat .switch::after {
  height: 24px;
  width: 24px;
}

.score-stat .switch:checked::after {
  transform: translateX(28px);
}

.new-session-btn {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 800;
}

.skin-toggle-btn {
  align-items: center;
  background: var(--skin-toggle-bg);
  border: 3px solid var(--surface);
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  letter-spacing: 0.5px;
  margin-left: -21px;
  position: relative;
  width: 42px;
  z-index: 1;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(5, 64, 36, 0.18);
  margin-top: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.panel-head {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
}

.panel-head h2 {
  font-size: 16px;
}

.panel-body {
  display: grid;
  gap: 5px;
  padding: 5px;
}

.court-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 4px;
}

.match-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.court-badge {
  align-items: center;
  background: var(--accent-dark);
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-size: 18px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 28px;
}

.pair-grid {
  align-items: center;
  display: grid;
  gap: 4px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  min-width: 0;
}

.pair {
  background: var(--surface-2);
  border-radius: 6px;
  min-width: 0;
  padding: 0;
}

.pair .chips {
  justify-content: center;
}

.score-controls {
  align-items: center;
  display: grid;
  gap: 4px;
  grid-template-columns: 56px minmax(32px, 1fr) 56px auto;
}

.score-picker-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  display: inline-flex;
  font-size: 16px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  align-items: center;
  min-width: 56px;
  padding: 0;
  text-align: center;
}

.score-outcome {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  min-width: 34px;
  text-align: center;
}

.score-clear-btn {
  min-width: 38px;
}

.score-picker-panel {
  gap: 12px;
}

.score-picker-team {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px;
}

.score-picker-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, 1fr);
}

.score-value-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  min-height: 48px;
}

.score-value-btn.selected {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.pair-title {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 5px;
}

.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.chip {
  align-items: center;
  background: #fff;
  border: 1px solid var(--chip-border);
  border-radius: 5px;
  color: var(--text);
  display: inline-flex;
  font-size: 15px;
  font-weight: 700;
  justify-content: center;
  line-height: 1.15;
  min-height: 28px;
  min-width: 0;
  overflow: hidden;
  padding: 3px 0;
  white-space: nowrap;
}

.pair .chip:not(.numeric) {
  flex: 1 1 0;
  max-width: calc((100% - 2px) / 2);
}

.chip-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  padding: 0 1px;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
  width: 100%;
}

.pair .chip.cjk .chip-text {
  min-width: 4em;
}

.chip.numeric {
  flex: 0 0 34px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  min-height: 30px;
  width: 34px;
}

.chip.red {
  border-color: #f0a195;
  color: var(--red);
}

.chip.white {
  border-color: #8ec5ff;
  color: var(--blue);
}

.chip.neutral {
  border-color: var(--border);
  color: var(--text);
}

.chip.paused {
  background: var(--paused-bg);
  color: var(--muted);
}

.rest {
  background: #ffffff;
  border: 1px solid var(--warning-border);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 5px;
}

.rest .chips {
  flex-wrap: wrap;
  overflow: visible;
}

.rest-badge {
  background: #74797f;
  border-color: #74797f;
  color: #fff;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  padding: 18px 4px;
  text-align: center;
}

.toolbar {
  align-items: center;
  background: var(--toolbar-bg);
  border-top: 1px solid var(--toolbar-border);
  bottom: 0;
  display: grid;
  gap: 5px;
  grid-template-columns: 42px minmax(58px, 1fr) repeat(3, minmax(58px, 1fr));
  left: 0;
  margin: 0 auto;
  max-width: 520px;
  padding: 10px 10px 16px;
  position: fixed;
  right: 0;
}

.plus-btn {
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-size: 28px;
  font-weight: 800;
  height: 48px;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0 0 3px;
  width: 100%;
}

.tool-btn {
  height: 48px;
  min-width: 0;
  font-size: 12px;
  padding: 0 5px;
  width: 100%;
}

.toolbar-back-btn {
  font-size: 15px;
  font-weight: 800;
  grid-column: 3 / -1;
}

.round-step-btn {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  padding-bottom: 3px;
}

.request-form {
  display: grid;
  gap: 10px;
}

.request-status {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
}

.settings-row,
.toggle-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.toggle-row {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.options-body {
  gap: 8px;
}

.option-field {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.kohaku-setup-flow {
  display: grid;
  gap: 8px;
}

.kohaku-setup-stage {
  display: grid;
  gap: 8px;
  max-height: 112px;
  overflow: hidden;
}

.kohaku-setup-stage.is-complete {
  animation: kohaku-setup-complete 420ms ease forwards;
  pointer-events: none;
}

.kohaku-setup-stage.is-hidden {
  display: none;
}

@keyframes kohaku-setup-complete {
  0% {
    max-height: 112px;
    opacity: 1;
    transform: translateY(0);
  }

  65% {
    opacity: 0;
    transform: translateY(-8px);
  }

  100% {
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
  }
}

.kohaku-action-row {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr);
}

.kohaku-card-edit-btn {
  justify-content: flex-start;
  min-height: 68px;
  text-align: left;
}

.kohaku-setup-step {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 12px;
  text-align: left;
}

.kohaku-setup-step strong {
  color: var(--accent-dark);
  font-size: 15px;
}

.kohaku-setup-step span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.kohaku-setup-arrow {
  color: var(--accent);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.kohaku-first-card-hint {
  background: var(--accent-tint);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
  margin: 0;
  padding: 14px 12px;
  text-align: center;
}

.kohaku-manage-all-btn {
  justify-content: center;
}

.kohaku-card-list {
  display: grid;
  gap: 8px;
}

.kohaku-manager-panel {
  gap: 12px;
  max-height: 92dvh;
}

.kohaku-manager-actions {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px;
}

.kohaku-manager-list {
  overflow: visible;
}

.kohaku-round-status {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  min-height: 24px;
  padding: 2px 8px;
}

.kohaku-round-status.displayed {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.kohaku-round-status.upcoming {
  background: var(--surface);
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .kohaku-setup-stage.is-complete {
    animation-duration: 1ms;
  }
}

.team-setup-notice {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 7px;
  color: var(--warning-text);
  display: grid;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
  padding: 9px;
}

.team-setup-notice strong {
  font-size: 13px;
}

.team-setup-notice .secondary-btn {
  justify-self: start;
}

.score-tools {
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
}

.score-management {
  display: grid;
  gap: 6px;
}

.score-management summary {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  list-style: none;
}

.score-management summary::-webkit-details-marker {
  display: none;
}

.score-management-menu {
  display: grid;
  gap: 6px;
}

.switch {
  appearance: none;
  background: #c7cbd1;
  border-radius: 999px;
  flex: 0 0 58px;
  height: 30px;
  position: relative;
  width: 58px;
}

.switch::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(0, 39, 19, 0.26);
  content: "";
  height: 24px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: transform 0.18s ease;
  width: 24px;
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::after {
  transform: translateX(28px);
}

.participant-list,
.rounds-feed {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 10px;
}

.history-round {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  scroll-margin-bottom: 90px;
}

.history-round-head {
  align-items: center;
  background: var(--surface-3);
  color: var(--text);
  display: flex;
  font-size: 14px;
  justify-content: space-between;
  padding: 10px 12px;
}

.history-round-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.standings-wrap {
  overscroll-behavior-x: contain;
  overflow-x: auto;
}

.results-scroll-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 4px 2px 1px;
}

.standings-section {
  display: grid;
  gap: 6px;
}

.standings-section h3 {
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.2;
  padding: 2px 2px 0;
}

.standings-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 500px;
  width: 100%;
}

.standings-table th,
.standings-table td {
  border-bottom: 1px solid var(--border);
  padding: 6px 5px;
  text-align: center;
  white-space: nowrap;
}

.standings-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.standings-table td:first-child,
.standings-table th:first-child {
  background: #fff;
  left: 0;
  min-width: 34px;
  position: sticky;
  width: 34px;
  z-index: 2;
}

.standings-table th:first-child {
  background: var(--surface-2);
  z-index: 4;
}

.standings-table td:nth-child(2),
.standings-table th:nth-child(2) {
  background: #fff;
  box-shadow: 5px 0 7px -7px rgba(17, 40, 25, 0.7);
  left: 34px;
  min-width: 92px;
  position: sticky;
  text-align: left;
  z-index: 2;
}

.standings-table th:nth-child(2) {
  background: var(--surface-2);
  z-index: 4;
}

.standings-table .chip {
  min-width: 42px;
  padding: 3px 7px;
}

.team-standing-label {
  border: 1px solid var(--border);
  border-radius: 5px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  min-width: 52px;
  padding: 4px 8px;
}

.team-standing-label.red {
  border-color: #f0a195;
  color: var(--red);
}

.team-standing-label.white {
  border-color: #8ec5ff;
  color: var(--blue);
}

.participant-row,
.history-row {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  padding: 10px;
}

.participant-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 8px;
}

.participant-row.paused {
  background: var(--paused-bg);
  color: var(--muted);
}

.participant-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.pause-action-btn {
  min-width: 48px;
}

.meta {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.participant-team.red {
  color: var(--red);
  font-weight: 900;
}

.participant-team.white {
  color: var(--blue);
  font-weight: 900;
}

.drawer {
  animation: bottom-sheet-backdrop-in 220ms ease-out both;
  background: var(--backdrop);
  inset: 0;
  position: fixed;
  z-index: 10;
}

.drawer-panel {
  animation: bottom-sheet-slide-in 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
  background: var(--surface);
  border-radius: 8px 8px 0 0;
  bottom: 0;
  box-shadow: 0 -16px 42px rgba(23, 49, 31, 0.24);
  display: grid;
  gap: 14px;
  left: 0;
  margin: 0 auto;
  max-height: 86dvh;
  max-width: 520px;
  overflow: auto;
  padding: 16px;
  position: absolute;
  right: 0;
  will-change: transform;
}

.drawer.is-static,
.drawer.is-static > .drawer-panel {
  animation: none;
}

.drawer.is-closing {
  animation: bottom-sheet-backdrop-out 260ms ease-in both;
  pointer-events: none;
}

.drawer.is-closing > .drawer-panel {
  animation: bottom-sheet-slide-out 280ms cubic-bezier(0.4, 0, 1, 1) both;
}

@keyframes bottom-sheet-slide-in {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes bottom-sheet-slide-out {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(100%);
  }
}

@keyframes bottom-sheet-backdrop-in {
  from {
    background-color: transparent;
  }

  to {
    background-color: var(--backdrop);
  }
}

@keyframes bottom-sheet-backdrop-out {
  from {
    background-color: var(--backdrop);
  }

  to {
    background-color: transparent;
  }
}

.active-panel-sheet {
  gap: 0;
  max-height: 90dvh;
  padding: 10px;
}

.active-panel-sheet > .panel {
  border: 0;
  box-shadow: none;
  margin: 0;
  overflow: visible;
}

.active-panel-actions {
  background: var(--surface);
  bottom: 0;
  display: grid;
  padding: 10px 5px max(5px, env(safe-area-inset-bottom));
  position: sticky;
  z-index: 5;
}

.drawer-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.drawer-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 0.7fr 1fr;
}

.inline-actions {
  display: flex;
  gap: 8px;
}

.captain-panel {
  gap: 10px;
  max-height: 92dvh;
}

.captain-layout {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.captain-team {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
}

.captain-team h3 {
  font-size: 13px;
  line-height: 1.2;
}

.captain-team.red h3 {
  color: var(--red);
}

.captain-team.white h3 {
  color: var(--blue);
}

.captain-player-list {
  display: grid;
  gap: 5px;
}

.captain-player {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  display: grid;
  gap: 1px 5px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 42px;
  padding: 5px 6px;
  position: relative;
  text-align: left;
}

.captain-player.red {
  border-color: #f0a195;
}

.captain-player.white {
  border-color: #8ec5ff;
}

.captain-player.selected {
  background: var(--accent-tint);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.captain-player-name {
  grid-column: 1;
  grid-row: 1 / span 2;
  font-size: 14px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  position: relative;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 1;
}

.captain-player-name.numeric {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.captain-player.selected .captain-player-name {
  grid-column: 2;
}

.captain-player-total {
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  display: inline-flex;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  grid-column: 2;
  grid-row: 1 / span 2;
  height: 28px;
  justify-content: center;
  min-width: 30px;
  padding: 0 7px;
  position: relative;
  z-index: 2;
}

.captain-player.selected .captain-player-total {
  grid-column: 3;
}

.captain-order {
  align-items: center;
  background: var(--accent);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  grid-column: 1;
  grid-row: 1 / span 2;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.captain-preview {
  display: grid;
  gap: 6px;
}

.captain-preview-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 4px;
}

.captain-preview-card.invalid {
  border-color: var(--danger-border);
  box-shadow: inset 0 0 0 1px var(--danger-border);
}

.preview-pair-grid {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.vs-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  padding: 0 2px;
  text-transform: uppercase;
}

@media (min-width: 460px) {
  .pair-grid {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .preview-pair-grid {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
}
