:root {
  --bg: #f0f2f8;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --primary: #5b6cff;
  --primary-soft: rgba(91, 108, 255, 0.08);
  --primary-border: rgba(91, 108, 255, 0.2);
  --text: #1e2337;
  --muted: #8b93a7;
  --border: rgba(107, 120, 167, 0.14);
  --shadow: 0 8px 40px rgba(33, 43, 89, 0.06);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse at 10% 0%, rgba(91, 108, 255, 0.10), transparent 50%),
    radial-gradient(ellipse at 90% 0%, rgba(72, 196, 244, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
}

.page {
  width: min(1200px, calc(100vw - 48px));
  margin: 28px auto;
  display: grid;
  gap: 20px;
}

.hero,
.panel,
.filters {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero .title-wrap {
  flex-shrink: 0;
}

.hero .title-wrap h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.hero .search-row {
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: center;
}

.hero .search-row .field {
  flex: 1;
}

.hero .search-row .field label {
  display: none;
}

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

.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.input,
.select,
.button {
  height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  outline: none;
  font-size: 14px;
  transition: 0.2s ease;
}

.input,
.select {
  width: 100%;
  padding: 0 14px;
  background: var(--surface-strong);
  border-color: var(--border);
  color: var(--text);
}

.input:focus,
.select:focus {
  border-color: rgba(91, 108, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.10);
}

.button {
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0 20px;
  white-space: nowrap;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, #5b6cff, #7b61ff);
  box-shadow: 0 6px 20px rgba(91, 108, 255, 0.22);
}

.button.secondary {
  color: var(--primary);
  background: var(--primary-soft);
}

.button.ghost {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto 340px;
  gap: 0 20px;
  background: transparent;
}

.grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 10px;
}

.grid-header.left {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow);
}

.grid-header.right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow);
}

.grid-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.grid-status {
  padding: 4px 20px 8px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.grid-list {
  padding: 0 20px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar .button {
  height: 32px;
  font-size: 13px;
  padding: 0 14px;
  border-radius: 8px;
}

.status-line {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

.panel-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.panel-title p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
  min-width: 0;
  min-height: 0;
}

.court-card,
.selected-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid rgba(91, 108, 255, 0.06);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  min-width: 0;
  flex-shrink: 0;
}

.court-card:hover {
  border-color: rgba(91, 108, 255, 0.2);
  background: rgba(91, 108, 255, 0.02);
}

.court-card.selected {
  border-color: rgba(91, 108, 255, 0.35);
  background: linear-gradient(135deg, rgba(91, 108, 255, 0.05), rgba(91, 108, 255, 0.02));
}

.court-check {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.court-main {
  flex: 1;
  min-width: 0;
}

.court-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.court-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  padding: 3px 10px;
  background: #f4f5fc;
  border: 1px solid rgba(91, 108, 255, 0.06);
  font-size: 12px;
  color: var(--muted);
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag {
  padding: 3px 10px;
  background: #f0f2ff;
  color: #4f5ec8;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  flex-shrink: 0;
}

.selected-empty,
.result-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
  background: linear-gradient(180deg, rgba(91, 108, 255, 0.03), transparent);
  border: 1px dashed rgba(91, 108, 255, 0.14);
  padding: 24px;
  font-size: 14px;
  line-height: 1.7;
}

.selected-card strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.remove-button {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(220, 70, 80, 0.15);
  background: rgba(220, 70, 80, 0.06);
  color: #c43e4a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: 0.15s;
}

.remove-button:hover {
  background: rgba(220, 70, 80, 0.12);
  border-color: rgba(220, 70, 80, 0.25);
}

.filters {
  padding: 20px 24px;
  display: grid;
  gap: 14px;
}

.filters-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto auto;
  gap: 12px;
  align-items: end;
}

.filters-row .button {
  height: 44px;
}

.hidden {
  display: none !important;
}

.progress-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(14, 18, 32, 0.36);
  backdrop-filter: blur(8px);
  z-index: 30;
}

.progress-dialog {
  width: min(420px, calc(100vw - 24px));
  background: #fff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(16, 24, 56, 0.18);
  padding: 20px 22px;
  display: grid;
  gap: 12px;
}

.progress-dialog h3 {
  margin: 0;
  font-size: 17px;
}

.progress-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.progress-bar-track {
  position: relative;
  height: 12px;
  overflow: hidden;
  background: #eef1f7;
  border-radius: 999px;
  border: 1px solid rgba(91, 108, 255, 0.08);
}

.progress-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #5b6cff, #7b61ff);
  transition: width 0.2s ease;
}

.progress-bar-fill.indeterminate {
  width: 38%;
  animation: progress-slide 1.1s ease-in-out infinite;
}

.progress-meta {
  font-size: 12px;
  color: var(--muted);
}

.progress-actions {
  display: flex;
  justify-content: flex-end;
}

.progress-actions .button {
  min-width: 108px;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(270%);
  }
}

@media (max-width: 980px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .hero .search-row {
    flex-direction: column;
  }

  .content-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto auto;
  }

  .filters-row {
    grid-template-columns: 1fr;
  }

  .page {
    width: min(100vw - 20px, 100%);
    margin: 12px auto 20px;
  }

  .hero,
  .filters {
    border-radius: 16px;
  }

  .grid-header.left,
  .grid-header.right {
    border-radius: 16px 16px 0 0;
  }

  .grid-list {
    border-radius: 0 0 16px 16px;
  }
}
