:root {
  color-scheme: light dark;
  --green: #1a7f37;
  --border: #d0d7de;
  --bg-checked: #eaf7ee;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  padding: 1rem;
  max-width: 700px;
  margin-inline: auto;
}

.print-only { display: none; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-header h1 { margin: 0; font-size: 1.5rem; flex: 1; }

.back-link {
  text-decoration: none;
  font-size: 1rem;
  color: inherit;
  opacity: 0.7;
}

.subtitle { opacity: 0.7; margin-top: 0.25rem; }

.print-btn, .index-mode-row {
  font: inherit;
}

.print-btn, .producer-link {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
}

.producer-link {
  text-decoration: none;
  color: inherit;
  font-size: 0.95rem;
  white-space: nowrap;
}

.producer-jump {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.producer-jump a {
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.summary {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.index-mode-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
}

.index-mode-row .ready { color: var(--green); font-weight: 600; }

.meta { opacity: 0.6; font-size: 0.85rem; margin: 0.5rem 0 0; }

.position-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.position-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  text-align: center;
}

.position-card .qr {
  width: 100%;
  max-width: 160px;
  margin: 0 auto 0.5rem;
}

.position-card .qr svg {
  width: 100%;
  height: auto;
  display: block;
}

.position-card h2 { margin: 0.25rem 0 0.5rem; font-size: 1.1rem; }

.mode-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.mode-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.mode-header h2 { margin: 0; font-size: 1.2rem; }
.mode-percent { font-weight: 700; font-size: 1.1rem; opacity: 0.8; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 0.5rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 1.05rem;
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.checklist-item.checked {
  background: var(--bg-checked);
  text-decoration: line-through;
  opacity: 0.75;
}

.empty { opacity: 0.6; font-style: italic; }

.producer-position { margin-bottom: 1.25rem; }
.producer-position:last-child { margin-bottom: 0; }

.producer-position h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 1rem;
  margin: 0 0 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.producer-position h3 a {
  color: inherit;
  text-decoration: none;
}

.producer-position h3 a:hover { text-decoration: underline; }

.position-percent { font-weight: 600; font-size: 0.85rem; opacity: 0.75; white-space: nowrap; }

.companion-section { margin-bottom: 1.5rem; }

.companion-section h3 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

.companion-group h4 {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.95rem;
  opacity: 0.8;
}

.companion-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.companion-row:last-child { border-bottom: none; }

.companion-label { font-size: 0.9rem; }

.companion-url-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.companion-url {
  flex: 1;
  font-size: 0.78rem;
  word-break: break-all;
  opacity: 0.75;
}

.copy-btn {
  flex-shrink: 0;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: inherit;
  font-family: inherit;
}

@media (prefers-color-scheme: dark) {
  :root { --border: #3d444d; --bg-checked: #123821; }
  .checklist-item.checked { color: #eee; }
}

@media print {
  .no-print { display: none !important; }
  .print-only { display: block; margin-bottom: 1rem; }
  body { max-width: none; padding: 0; }
  .mode-section { border: none; break-inside: avoid; padding: 0; margin-bottom: 1.5rem; }
  .mode-section:has(.producer-position) { break-inside: auto; }
  .producer-position { break-inside: avoid; }
  .mode-percent { display: none; }
  .checklist-item { padding: 0.35rem 0; }
  .checklist-item.checked { background: none; }
}
