/* Reset & base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --accent: #2d5a27;
  --accent-hover: #234a1f;
  --accent-light: #e8f0e7;
  --border: #e0e0e0;
  --danger: #c0392b;
  --danger-hover: #a93226;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  /* No padding here — the sticky nav needs full-width; page padding lives on .main-content */
  max-width: 600px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  padding: 2rem 0 1.5rem;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Home grid */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  min-height: 130px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}

.action-card:active {
  transform: scale(0.97);
}

.action-icon {
  font-size: 2rem;
  line-height: 1;
}

.action-label {
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.filter-search {
  flex: 2;
  min-width: 180px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
  color: var(--text);
}

.filter-select {
  flex: 1;
  min-width: 120px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* Active filter chips */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.active-filters:empty {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff;
  padding: 0.3rem 0.5rem 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.chip-remove:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Step title */
.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.page-btn {
  padding: 0.45rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.page-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page-info {
  font-size: 0.9rem;
  color: var(--text-secondary);
  min-width: 3rem;
  text-align: center;
}

/* Game list */
.game-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}

.game-cover {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.game-cover-placeholder {
  background: var(--border);
}

.game-list-info {
  flex: 1;
  min-width: 0;
}

.game-list-item:active {
  transform: scale(0.98);
}

.game-list-name {
  font-weight: 600;
}

.game-list-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.chevron {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem 0;
}

.empty-state-sm {
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* Game detail */
.game-image-wrap {
  text-align: center;
  margin-bottom: 1rem;
}

.game-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
  object-fit: contain;
}

.game-header {
  margin-bottom: 1.5rem;
}

.game-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.game-year {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.85rem;
}

.tag-type {
  background: #dceefb;
  color: #1a5f8a;
}

.tag-category {
  background: #e8e0f0;
  color: #5b3d8f;
}

.tag-mechanic {
  background: #e0f0e3;
  color: #2d6a32;
}

.game-tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 0.35rem;
}

.game-tags-section {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.game-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.quickref {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.quickref-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.quickref-text {
  white-space: pre-line;
  line-height: 1.7;
  font-size: 0.95rem;
}

.mechanics-section {
  margin-top: 1.5rem;
}

.mechanics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Detail action buttons */
.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.btn-rules {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-rules:hover {
  background: var(--accent-hover);
}

.btn-bgg {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-bgg:hover {
  background: var(--accent-light);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.25);
  color: #fff;
  font-size: 0.75rem;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 0.35rem;
}

/* Game actions */
.game-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--accent-light);
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-danger {
  flex: 1;
  background: var(--surface);
  color: var(--danger);
  border: 1px solid var(--border);
}

.btn-danger:hover {
  background: #fdecea;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  background: transparent;
  transition: background 0.15s;
}

.btn-icon-danger {
  color: var(--danger);
}

.btn-icon-danger:hover {
  background: #fdecea;
}

.btn-icon-muted {
  color: #888;
}

.btn-icon-muted:hover {
  background: var(--border);
  color: var(--text);
}

/* ==============================
   Import page (gameshelf style)
   ============================== */
.import-hero {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
}

.import-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
  width: 100%;
  text-align: center;
}

.import-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.import-desc a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.import-desc a:hover {
  text-decoration: underline;
}

.import-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.import-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.import-input-row {
  display: flex;
  gap: 0;
}

.import-input {
  flex: 1;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
}

.import-btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem 1.1rem;
  font-size: 1.1rem;
}

.import-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.import-success {
  background: var(--accent-light);
  color: var(--accent);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 500;
  margin-top: 1rem;
}

.import-success a {
  color: var(--accent);
  font-weight: 600;
  margin-left: 0.25rem;
  text-decoration: none;
}

.import-success a:hover {
  text-decoration: underline;
}

.import-info {
  background: #f0f0f0;
  color: var(--text-secondary);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-top: 1rem;
}

.import-error {
  background: #fdecea;
  color: var(--danger);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-top: 1rem;
}

/* ==============================
   Rules page
   ============================== */
.rules-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

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

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0;
}

.section-header + .pdf-viewer,
.section-header + .rules-url-form {
  margin-top: 0;
}

.pdf-viewer {
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.pdf-iframe {
  width: 100%;
  height: 500px;
  border: none;
}

.rules-url-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.rules-url-form.hidden {
  display: none;
}

.rules-url-actions {
  display: flex;
  gap: 0.5rem;
}

/* Player aids */
.player-aids-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.player-aid-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.player-aid-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.player-aid-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
}

.player-aid-label {
  font-size: 0.8rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.upload-form .btn-sm {
  align-self: flex-start;
}

.file-input {
  padding: 0.5rem;
  font-size: 0.9rem;
}

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.lightbox-close:hover {
  opacity: 1;
}

/* Form */
.form-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Spinner */
.spinner-inline {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hero action card (Discover) */
.action-card-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-decoration: none;
  box-shadow: var(--shadow);
  min-height: 140px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, background 0.15s;
}

.action-card-hero:active {
  transform: scale(0.97);
}

.action-card-hero:hover {
  background: var(--accent-hover);
}

.action-card-hero .action-icon {
  font-size: 2.5rem;
}

.action-card-hero .action-label {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.action-desc {
  font-size: 0.85rem;
  opacity: 0.85;
  text-align: center;
}

/* Settings link */
.settings-link {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.settings-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Vibe grid (Discover page) */
.vibe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.vibe-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  text-align: center;
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}

.vibe-btn:active {
  transform: scale(0.96);
}

.vibe-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* Category pills */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  background: #e8e0f0;
  color: #5b3d8f;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}

.pill-btn:hover {
  background: #d4c8e4;
}

.pill-type {
  background: #dceefb;
  color: #1a5f8a;
}

.pill-type:hover {
  background: #c5e0f5;
}

.pill-category {
  background: #e8e0f0;
  color: #5b3d8f;
}

.pill-mechanic {
  background: #e0f0e3;
  color: #2d6a32;
}

.pill-mechanic:hover {
  background: #cfe6d3;
}

.filter-pills {
  margin-bottom: 0.75rem;
}

.pill-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}

.pill-row::-webkit-scrollbar {
  display: none;
}

.filter-chip-type {
  background: #1a5f8a;
}

.filter-chip-category {
  background: #5b3d8f;
}

.filter-chip-mechanic {
  background: #2d6a32;
}

/* Filter row (discover page) */
.filter-row {
  margin-bottom: 0.75rem;
}

.filter-row-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.filter-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.filter-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* Small tags for discover game list */
.tag-sm {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.4;
}

.game-list-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.2rem;
}

.game-list-item-discover {
  align-items: flex-start;
  padding: 0.85rem 1rem;
}

/* Game edit — vibe checklist */
.edit-vibes-form {
  margin-top: 1rem;
}

.vibe-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.vibe-check-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.vibe-check-item:hover {
  background: var(--accent-light);
}

.vibe-check-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.vibe-check-label {
  font-weight: 600;
  font-size: 1rem;
}

/* Vibe management page */
.vibe-add-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.vibe-add-form .form-input {
  flex: 1;
}

.vibe-manage-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.vibe-manage-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}

.vibe-edit-input {
  flex: 1;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  min-width: 0;
}

.vibe-delete-inline {
  flex-shrink: 0;
}

.vibe-delete-btn {
  font-size: 1.4rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vibe-save-bar {
  max-width: 400px;
  margin-top: 1rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.vibe-save-bar .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Multi-select mode */
.game-list-item-wrap {
  display: flex;
  align-items: stretch;
}

.game-list-item-wrap .game-list-item {
  flex: 1;
  min-width: 0;
}

.game-select-check {
  display: none;
  align-items: center;
  padding: 0 0.5rem 0 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  cursor: pointer;
}

.select-mode .game-select-check {
  display: flex;
}

.select-mode .game-select-check + .game-list-item {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.game-select-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Floating bulk action bar */
.bulk-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

#bulk-count {
  font-size: 0.9rem;
  font-weight: 600;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Responsive */
@media (max-width: 400px) {
  .filters {
    flex-direction: column;
  }

  .filter-select {
    min-width: 100%;
  }

  .player-aids-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Top navigation bar
   ========================================================= */
.top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;          /* allow second row on narrow screens */
  gap: 0.5rem;
  padding: 0 1.25rem;
  min-height: 52px;
  background: var(--accent);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.4rem 0;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.nav-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  white-space: nowrap;
}
.nav-link:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-user {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-logout-form {
  margin: 0;
}

.nav-logout-btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  /* Prevent tiny tap targets on touch */
  min-height: 32px;
}
.nav-logout-btn:hover {
  background: rgba(255,255,255,0.28);
}

/* Mobile: two-row nav — links drop to a second row below brand+user */
@media (max-width: 600px) {
  .top-nav {
    padding: 0.5rem 0.75rem;
    gap: 0.4rem;
  }

  .nav-brand {
    font-size: 0.9rem;
  }

  /* Push nav-links to their own full-width row */
  .nav-links {
    order: 3;
    width: 100%;
    flex: none;
    justify-content: space-around;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 0.35rem;
    padding-bottom: 0.2rem;
  }

  .nav-link {
    font-size: 0.78rem;
    padding: 0.3rem 0.4rem;
    text-align: center;
    flex: 1;
  }

  .nav-user {
    max-width: 90px;
    font-size: 0.78rem;
  }
}

/* =========================================================
   Main content wrapper
   — carries the horizontal page padding (body has none) so the sticky
     nav can span full width without negative-margin hacks.
   ========================================================= */
.main-content {
  padding: 1rem 1rem 2rem;
}

/* =========================================================
   Login page
   ========================================================= */
.login-hero {
  /* fill the screen on the login page (no nav present) */
  min-height: calc(100dvh - 2rem); /* subtract .main-content top+bottom padding */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 2rem 0;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.login-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.login-input {
  width: 100%;
  font-size: 1rem;
  padding: 0.65rem 0.9rem;
}

.login-btn {
  width: 100%;
  padding: 0.7rem;
  font-size: 1rem;
}

.login-error {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6cb;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  text-align: left;
}

.login-note {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-top: 1.25rem;
  line-height: 1.5;
}

/* =========================================================
   Import page — username label
   ========================================================= */
.import-username-label {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}
