:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #212529;
  --muted: #6c6c6c;
  --accent: #0e6ba8;
  --accent-strong: #0a4b74;
  --panel: #ffffff;
  --border: #d9d2c7;
  --table-highlight: #e5e7eb;
  --table-border: #b6bcc2;
  --danger: #b00020;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--bs-body-font-family, system-ui);
  background: var(--bg);
  color: var(--bs-body-color, var(--ink));
}

.header {
  position: relative;
}

.lang-switch {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.lang-switch:hover {
  color: var(--accent);
}

.app {
  display: grid;
  gap: 24px;
}

.panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel-collapsed {
  min-width: 0;
  overflow: hidden;
}

.panel-collapsed-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.panel-summary {
  font-size: 14px;
  line-height: 1.4;
  flex-shrink: 0;
  min-width: 0;
}

.panel-collapsed-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}


.btn-expand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.btn-expand:hover {
  color: var(--accent);
}

.btn-expand .chevron {
  transition: transform 0.2s ease;
}

.btn-expand[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.label {
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

.textarea {
  width: 100%;
  resize: vertical;
}

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

.csv-preview {
  border-radius: 8px;
  font-size: 12px;
  color: var(--bs-body-color, var(--ink));
}

.csv-preview .highlight {
  background: var(--table-highlight);
}

.csv-preview thead th {
  border-bottom: 2px solid var(--table-border);
}



.mode {
  display: grid;
  gap: 6px;
}

.schedule {
  display: grid;
  gap: 6px;
  grid-template-columns: 120px 120px 1fr;
  align-items: center;
}

.input {
  width: 100%;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hidden {
  display: none !important;
}

.privacy {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.event-meta {
  margin: 4px 0 12px;
  font-size: 24px;
  font-weight: 600;
  color: var(--muted);
}

.count {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.error {
  color: var(--danger);
  min-height: 18px;
  font-size: 13px;
}

.results h2 {
  margin: 0 0 12px;
}

.results-grid {
  --cols: 4;
  --gap: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}

.powered-footer {
  text-align: right;
}

.result-col {
  flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
}

.export-only {
  display: none;
}

.exporting .export-only {
  display: block;
}

.exporting .export-actions {
  display: none !important;
}

.exporting .export-hide {
  display: none !important;
}

.shuffle-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  animation: shuffle-pulse 1s ease-in-out infinite;
}

@keyframes shuffle-pulse {
  0% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.35;
  }
}

@media (max-width: 600px) {
  .panel-collapsed-row {
    flex-wrap: wrap !important;
  }

  .panel-summary {
    flex: 1 1 100%;
    min-width: 0;
    overflow-wrap: break-word;
  }

  .panel-collapsed-actions {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  .results-grid {
    --cols: 1;
  }

  .result-col {
    flex: 0 0 100%;
  }

  .schedule {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: var(--bg);
  }

  .header,
  .panel,
  .privacy,
  .error,
  .actions,
  .export-actions,
  .lang-switch,
  .ridede,
  .no-print-export {
    display: none !important;
  }

  .app {
    padding: 0;
  }

  .results h2.export-hide {
    display: none !important;
  }

  .results h2:not(.export-hide) {
    margin-top: 0;
  }

  .card {
    break-inside: avoid;
  }

  .export-only {
    display: block;
  }
}

.ridede a {
  text-decoration: none;
  color: inherit;
  font-weight: 600;
}

.github-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
}

.github-source:hover {
  color: var(--ink);
}

.ridede-logo {
  height: 1.2em;
  width: auto;
  vertical-align: middle;
}
