:root {
  color-scheme: light dark;
  --bg: #fbf7f2;
  --fg: #2b2320;
  --accent: #d6633c;
  --card-bg: #ffffff;
  --border: #e8ddd2;
  --danger-bg: #fef2f2;
  --danger-border: #ef4444;
  --danger-fg: #7f1d1d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1815;
    --fg: #f2ece5;
    --accent: #e8875a;
    --card-bg: #262019;
    --border: #3a3128;
    --danger-bg: #3a1414;
    --danger-border: #ef4444;
    --danger-fg: #fca5a5;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
}

.nav-links a {
  color: var(--fg);
  text-decoration: none;
  margin-left: 1.25rem;
}

.nav-links a:hover {
  color: var(--accent);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.hero {
  text-align: center;
  padding: 3rem 1rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.tagline {
  font-size: 1.2rem;
  opacity: 0.85;
  margin-bottom: 1.5rem;
}

.cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}

.section {
  margin-top: 2rem;
}

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.status {
  opacity: 0.7;
  margin: 1.5rem 0;
}

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

.cat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.cat-card.cat-highlight {
  box-shadow: 0 0 0 4px var(--accent);
}

.cat-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.cat-photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--border);
}

.cat-info {
  padding: 1rem;
}

.cat-info h3 {
  margin: 0 0 0.25rem;
}

.cat-breed {
  margin: 0;
  opacity: 0.8;
}

.cat-meta {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.9rem;
  opacity: 0.7;
}

.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.cat-profile {
  max-width: 1065px;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover {
  text-decoration: underline;
}

.cat-profile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.5rem;
}

.cat-profile-header h1 {
  margin: 0;
}

.cat-profile-meta {
  opacity: 0.75;
  margin: 0 0 1.5rem;
}

.cat-age {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 1rem;
}

.cat-tagline {
  font-size: 1.3rem;
  line-height: 1.5;
  margin: 0 0 1.5rem;
}

.cat-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cat-gallery:has(> img:only-child) {
  grid-template-columns: minmax(240px, 420px);
}

.cat-gallery img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
}

.cat-bio {
  font-size: 2.2rem;
  line-height: 1.5;
  margin-bottom: 2rem;
}

.tv-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.tv-round-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.tv-round-label {
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  opacity: 0.6;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tv-round-value {
  font-size: clamp(1.3rem, 2.6vw, 2.2rem);
  font-weight: 800;
  color: var(--accent);
}

.bingo-tv {
  display: grid;
  grid-template-columns: 2fr 3fr;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.tv-current {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  text-align: center;
  padding: 1rem 1rem 4rem;
  overflow: hidden;
}

.call-letter {
  font-size: min(16vw, 22vh);
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
}

.call-number {
  font-size: min(32vw, 46vh);
  font-weight: 900;
  line-height: 1;
}

.tv-history {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1.5rem 1.25rem 5rem;
}

.tv-history-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  opacity: 0.7;
  font-weight: 600;
}

.tv-example-video {
  position: fixed;
  right: 1.5rem;
  bottom: 5.5rem;
  width: var(--example-w, min(33vw, 480px));
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 5;
}

.tv-example-label {
  display: block;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 600;
  opacity: 0.7;
  margin-bottom: 0.35rem;
}

.tv-example-video video,
.tv-example-video img {
  display: block;
  width: 100%;
  aspect-ratio: 1122 / 1402;
  object-fit: cover;
  border-radius: 8px;
}

.tv-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
}

.tv-controls .cta {
  border: none;
  font-size: 1.1rem;
  padding: 0.75rem 1.75rem;
  cursor: pointer;
}

.tv-controls .cta:disabled {
  opacity: 0.5;
  cursor: default;
}

.secondary-btn {
  display: inline-block;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

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

.tv-controls .secondary-btn {
  display: inline-block;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}

.round-select {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  cursor: pointer;
  max-width: 16rem;
}

.bingo-board {
  flex: 1;
  min-height: 0;
  width: 25%;
  align-self: flex-end;
  display: flex;
  gap: 0.5rem;
}

.bingo-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.bingo-column-letter {
  flex: 0 0 auto;
  text-align: center;
  font-weight: 800;
  font-size: clamp(1rem, 2.2vw, 1.8rem);
  color: var(--accent);
}

.bingo-cell {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 700;
  font-size: clamp(0.8125rem, 1.875vw, 1.5rem);
}

.bingo-cell.called {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.bingo-cell.recent-1 {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}

.bingo-cell.recent-2 {
  background: #eab308;
  color: #2b2320;
  border-color: #eab308;
}

.bingo-cell.recent-3 {
  background: #ec4899;
  color: #fff;
  border-color: #ec4899;
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  opacity: 0.6;
  font-size: 0.9rem;
}

.break-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.break-menu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
  border-right: 1px solid var(--border);
}

.break-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.break-menu h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  margin: 0 0 1rem;
}

.break-subtitle {
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  opacity: 0.75;
  margin: 0 0 2.5rem;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.menu-list li {
  display: flex;
  align-items: baseline;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
}

.menu-item {
  flex: 0 0 auto;
}

.menu-dots {
  flex: 1;
  border-bottom: 3px dotted var(--border);
  margin: 0 0.75rem;
  height: 0.6em;
}

.menu-price {
  flex: 0 0 auto;
  color: var(--accent);
}

.break-volunteer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem;
  gap: 1rem;
}

.break-volunteer h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  margin: 0;
}

.break-volunteer-text {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  max-width: 32rem;
  line-height: 1.5;
  opacity: 0.85;
  margin: 0;
}

.volunteer-qr {
  width: min(45vw, 320px);
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 1rem;
}

.volunteer-url {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.inventory-page {
  max-width: 1100px;
}

.inventory-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.inventory-header h1 {
  margin: 0 0 0.25rem;
}

.inventory-subtitle {
  margin: 0;
  opacity: 0.7;
}

.sync-status {
  font-weight: 600;
}

.sync-status.sync-ok {
  color: #16a34a;
}

.sync-status.sync-offline {
  color: inherit;
}

.sync-status.sync-error {
  color: #ef4444;
}

.inventory-search {
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  font-size: 1rem;
  min-width: 220px;
}

.reorder-banner {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border: 1px solid var(--danger-border);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.5rem;
}

.inventory-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.inventory-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.inventory-row-label {
  flex: 0 0 4.5rem;
  font-weight: 700;
  opacity: 0.6;
}

.inventory-row-slots {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
  gap: 0.6rem;
}

@media (max-width: 560px) {
  .inventory-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }
}

.inventory-slot {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.5rem;
  text-align: center;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

.inventory-slot-id {
  font-weight: 700;
  font-size: 0.95rem;
}

.inventory-slot-summary {
  font-size: 0.78rem;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-slot.low-stock {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-fg);
}

.inventory-slot.highlight {
  box-shadow: 0 0 0 3px var(--accent);
}

.inventory-slot.dimmed {
  opacity: 0.35;
}

.inventory-labels {
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.inventory-labels summary {
  cursor: pointer;
  font-weight: 700;
}

.inventory-labels-note {
  opacity: 0.75;
  margin: 0.75rem 0;
}

.inventory-labels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.5rem;
}

.inventory-label-link {
  display: block;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
}

.inventory-label-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.inventory-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.inventory-modal[hidden] {
  display: none;
}

.inventory-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.inventory-modal-panel {
  position: relative;
  background: var(--card-bg);
  border-radius: 14px;
  padding: 1.75rem;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.inventory-modal-panel h2 {
  margin: 0 0 1rem;
}

.inventory-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--fg);
  opacity: 0.6;
}

.inventory-modal-close:hover {
  opacity: 1;
}

.modal-bins {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.modal-bin-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.modal-bin-row.low-stock {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.modal-bin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-bin-letter {
  font-weight: 800;
  color: var(--accent);
  font-size: 1.2rem;
}

.modal-bin-remove {
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--fg);
  opacity: 0.5;
}

.modal-bin-remove:hover {
  opacity: 1;
}

.modal-bin-row label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  opacity: 0.75;
  min-width: 0;
}

.modal-bin-row input {
  width: 100%;
  min-width: 0;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-size: 0.95rem;
  font-family: inherit;
}

.modal-bin-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  min-width: 0;
}

.modal-bin-actions {
  display: flex;
  gap: 0.6rem;
}

.modal-bin-actions .secondary-btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.pokemon-page {
  max-width: 1400px;
}

.pokemon-subtitle {
  opacity: 0.7;
  margin: 0 0 1.5rem;
}

.pokemon-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.pokemon-nav a {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.pokemon-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pokemon-nav a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pokemon-trainers {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pokemon-trainer h2 {
  margin: 0 0 0.75rem;
}

.pokemon-trainer h2 a {
  color: inherit;
  text-decoration: none;
}

.pokemon-trainer h2 a:hover {
  color: var(--accent);
}

.pokemon-empty {
  opacity: 0.6;
  margin: 0;
}

.pokemon-table-wrap {
  overflow-x: auto;
}

.pokemon-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.pokemon-table th,
.pokemon-table td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.pokemon-table th {
  opacity: 0.6;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pokemon-table td:first-child {
  font-weight: 700;
}

.pokemon-table td:last-child {
  white-space: normal;
  min-width: 18rem;
  opacity: 0.85;
}

.pokemon-table tbody tr:hover {
  background: var(--bg);
}

body:has(.pokemon-page) .site-header {
  display: none;
}

body:has(.pokemon-page) .site-footer {
  display: none;
}
