:root,
[data-theme="dark"] {
  --bg: #0f1419;
  --bg-elevated: #1a2332;
  --bg-card: #212d3d;
  --border: #2d3a4d;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --header-bg: rgba(15, 20, 25, 0.92);
  --overlay: rgba(0, 0, 0, 0.55);
  --overlay-strong: rgba(0, 0, 0, 0.72);
  --header-h: 64px;
  --sync-h: 48px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Serie-Farben */
  --c-original: #fbbf24;
  --c-destiny: #ec4899;
  --c-mystery: #38bdf8;
  --c-christmas: #f87171;
  --c-junior: #4ade80;
  --c-retro: #a78bfa;
  --c-jvh: #f97316;
}

[data-theme="light"] {
  --bg: #f0f2f7;
  --bg-elevated: #ffffff;
  --bg-card: #e8ecf3;
  --border: #cfd6e3;
  --text: #151c28;
  --text-muted: #5a687d;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --shadow: 0 8px 32px rgba(15, 20, 25, 0.1);
  --header-bg: rgba(255, 255, 255, 0.92);
  --overlay: rgba(15, 20, 25, 0.4);
  --overlay-strong: rgba(15, 20, 25, 0.55);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

html,
[data-theme="dark"] {
  color-scheme: dark;
}

[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
}

#app {
  overflow-x: clip;
}

.hidden { display: none !important; }

/* Sync Banner */
.sync-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, #4338ca, #6366f1);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

.admin-pending-banner {
  position: sticky;
  top: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, #b45309, #f59e0b);
  color: #111;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

/* Auth */
.view-auth {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.2), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.12), transparent 50%),
    var(--bg);
}

[data-theme="light"] .view-auth {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.12), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.08), transparent 50%),
    var(--bg);
}

.theme-toggle-auth {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 10;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.brand { text-align: center; margin-bottom: 1.5rem; }
.brand-icon { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.brand h1 { margin: 0; font-size: 1.5rem; font-weight: 700; }
.brand-sub { margin: 0.35rem 0 0; color: var(--text-muted); font-size: 0.9rem; }

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.auth-tab {
  flex: 1;
  padding: 0.6rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--accent);
  color: #fff;
}

.auth-form .field { display: block; margin-bottom: 1rem; }
.field span { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.35rem; }
.field input, .field select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hint { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 1rem; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; }
.success-msg { color: var(--success); font-size: 0.85rem; margin-bottom: 0.75rem; }

.login-back { margin-bottom: 0.75rem; }

/* PIN-Eingabe (Apple-Stil) */
body.pin-open { overflow: hidden; }

.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  padding: 0;
}

.pin-sheet {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  text-align: center;
  animation: pin-slide-up 0.28s ease-out;
}

@keyframes pin-slide-up {
  from { transform: translateY(100%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.pin-back {
  float: left;
  margin-bottom: 0.5rem;
}

.pin-greeting {
  margin: 0.5rem 0 0.15rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pin-title {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.pin-subtitle {
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.pin-dot.filled {
  background: var(--text);
  border-color: var(--text);
}

.pin-dots-error .pin-dot {
  border-color: var(--danger);
}

.pin-dot.shake {
  animation: pin-shake 0.35s ease;
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.pin-error {
  min-height: 1.25rem;
  margin-bottom: 0.5rem;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  max-width: 320px;
  margin: 0 auto;
}

.pin-key {
  min-height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.pin-key:active {
  transform: scale(0.94);
  background: var(--border);
}

.pin-key-empty {
  visibility: hidden;
  pointer-events: none;
}

.pin-key-back {
  font-size: 1.25rem;
}

@media (min-width: 520px) {
  .pin-overlay {
    align-items: center;
    padding: 1rem;
  }

  .pin-sheet {
    border-radius: var(--radius);
    padding-bottom: 1.5rem;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-accent { background: #fff; color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-icon { min-width: 44px; padding: 0.5rem; }

/* App layout */
.view { min-height: 100dvh; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}

.header-left {
  min-width: 0;
  flex: 1;
}

.header-left h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-badge {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.5rem;
}

.header-actions { display: flex; gap: 0.5rem; flex-shrink: 0; align-items: center; }

.header-menu-wrap { position: relative; }

.header-menu-toggle {
  display: inline-flex;
}

.header-menu-toggle .icon {
  display: block;
  width: 24px;
  height: 24px;
}

.header-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 200;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 11rem;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.header-menu.is-open {
  display: flex;
}

.header-menu .btn {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
}

.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

/* Benachrichtigungs-Center */
.notification-wrap { position: relative; }

.notification-btn {
  position: relative;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
}

.notification-btn .icon {
  display: block;
  width: 24px;
  height: 24px;
}

#view-toggle-icon .icon,
.theme-toggle-icon .icon {
  display: block;
  width: 24px;
  height: 24px;
}

.notification-btn.has-alerts {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.45);
}

.notification-btn.has-alerts:hover {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--warning);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.notification-center {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 200;
  width: min(360px, calc(100vw - 1rem));
  max-width: calc(100vw - 1rem);
  max-height: min(70dvh, 520px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  box-sizing: border-box;
}

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

.notification-center-header h2 {
  margin: 0;
  font-size: 1rem;
}

.notification-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

.notification-close:hover {
  background: var(--bg-card);
  color: var(--text);
}

.notification-section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notification-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem 0.5rem;
}

.badge {
  background: var(--warning);
  color: #000;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.pending-list { list-style: none; padding: 0; margin: 0.75rem 0; }
.pending-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.pending-list li > span:first-child {
  min-width: 0;
  word-break: break-word;
}
.pending-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}
.field-inline { display: flex; align-items: center; gap: 0.75rem; max-width: 200px; }
.field-inline span { margin: 0; white-space: nowrap; }

/* Toolbar */
.toolbar { margin-bottom: 1.25rem; }
.search-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.toolbar-row { display: flex; align-items: center; gap: 0.5rem; }
.filter-scroll {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  flex: 1;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

.chip {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* Entries grid – große Kacheln */
.entries-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.entries-grid.view-list {
  grid-template-columns: 1fr;
}

.entry-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.entry-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.entry-card-inner { display: flex; flex-direction: column; }

.entry-image-wrap {
  aspect-ratio: 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-fallback {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-fallback-only {
  min-height: 100%;
}

.image-unavailable {
  margin: 0;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.35;
}

.entry-image-wrap .image-fallback,
.entry-image-wrap img {
  width: 100%;
  height: 100%;
}

.entry-image-wrap img {
  object-fit: contain;
  padding: 0.5rem;
}

@media (max-width: 639px) {
  .entry-image-wrap {
    width: 70%;
    margin-inline: auto;
  }

  .entries-grid.view-list .entry-image-wrap {
    width: 84px;
    min-width: 84px;
  }

  .entry-image-wrap img {
    padding: 0.35rem;
  }

  .app-main {
    padding: 0.75rem;
  }

  .app-header {
    padding-inline: max(0.75rem, env(safe-area-inset-left, 0px))
      max(0.75rem, env(safe-area-inset-right, 0px));
  }

  .header-menu {
    right: 0;
    left: auto;
    width: min(11rem, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
    box-sizing: border-box;
  }

  .notification-center {
    right: 0;
    left: auto;
    width: min(360px, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
  }

  .notification-wrap {
    max-width: calc(100vw - 8rem);
  }

  .sync-banner,
  .admin-pending-banner {
    padding-inline: max(0.75rem, env(safe-area-inset-left, 0px))
      max(0.75rem, env(safe-area-inset-right, 0px));
    font-size: 0.85rem;
    text-align: center;
  }

  .pending-list li {
    flex-direction: column;
    align-items: stretch;
  }

  .pending-actions {
    width: 100%;
  }

  .pending-actions .btn {
    flex: 1;
    min-width: 0;
  }

  .entry-form {
    padding: 1rem;
  }

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

  .modal {
    width: 100%;
    max-width: 100%;
  }

  .modal-content {
    padding: 0.85rem;
  }

  .modal-image-wrap {
    max-height: min(240px, 38dvh);
  }

  .modal-actions {
    flex-wrap: wrap;
  }

  .toast {
    left: max(0.75rem, env(safe-area-inset-left, 0px));
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    transform: none;
    width: auto;
    max-width: calc(100vw - 1.5rem);
    text-align: center;
  }

  .pin-overlay {
    padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  }

  .pin-sheet {
    max-width: 100%;
  }

  .view-auth {
    padding-inline: max(1rem, env(safe-area-inset-left, 0px))
      max(1rem, env(safe-area-inset-right, 0px));
  }
}

.entry-body { padding: 1rem; }
.entry-series {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.4rem;
}
.entry-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.entry-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; }

.gepuzzelt-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.6rem;
}

.gepuzzelt-status,
.gepuzzelt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.gepuzzelt-status .icon,
.gepuzzelt-status-icon .icon,
.gepuzzelt-status-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.gepuzzelt-status.is-done,
.gepuzzelt-status-icon.is-done {
  color: var(--success);
}

.gepuzzelt-status.is-open,
.gepuzzelt-status-icon.is-open {
  color: var(--danger);
}

.gepuzzelt-toggle {
  cursor: pointer;
  margin-right: 0.75rem;
}

/* List view on mobile stays card-like; on desktop list is horizontal */
.entries-grid.view-list .entry-card-inner {
  flex-direction: row;
}
.entries-grid.view-list .entry-image-wrap {
  width: 120px;
  min-width: 120px;
  aspect-ratio: 1;
}

/* Form */
.entry-form {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 720px;
  margin: 0 auto;
}
.entry-form h2 { margin: 0 0 1.25rem; font-size: 1.15rem; }

.entry-form .field {
  display: block;
  margin-bottom: 1rem;
}

#form-gepuzzelt-fields {
  margin-top: 0.75rem;
}

.form-section { margin-bottom: 1.25rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.catalog-hint { margin: 0 0 0.75rem; }
.catalog-no-results { padding: 1rem; margin: 0; }

.catalog-results {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
}

.catalog-results:empty {
  display: none;
  border: none;
  margin-top: 0;
}

.catalog-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.catalog-item:last-child { border-bottom: none; }
.catalog-item:hover, .catalog-item.selected { background: var(--accent-soft); }
.catalog-item-image {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}
.catalog-item-image .image-fallback,
.catalog-item-image img {
  width: 100%;
  height: 100%;
}
.catalog-item-image img {
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
}
.catalog-item-image .image-unavailable {
  font-size: 0.62rem;
  padding: 0.35rem;
}
.catalog-item-info { flex: 1; min-width: 0; }
.catalog-item-info strong {
  display: block;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.catalog-item-info span { font-size: 0.72rem; color: var(--text-muted); }

.catalog-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }

.selected-preview {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}
.selected-preview-image {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.selected-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
}

.selected-preview-image .image-unavailable {
  font-size: 0.65rem;
  padding: 0.35rem;
}

.checkbox-group { display: flex; flex-direction: column; gap: 0.65rem; margin-bottom: 1rem; }
.checkbox { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: 0.95rem; }
.checkbox input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }

.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.form-actions .btn { flex: 1; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.meta { color: var(--text-muted); font-size: 0.85rem; }

/* Modal */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text);
  width: min(480px, calc(100vw - 1rem));
  max-width: calc(100vw - 1rem);
  max-height: calc(100dvh - 1rem);
  margin: auto;
  overflow: hidden;
  box-sizing: border-box;
}

.modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.5rem, env(safe-area-inset-top, 0px))
    max(0.5rem, env(safe-area-inset-right, 0px))
    max(0.5rem, env(safe-area-inset-bottom, 0px))
    max(0.5rem, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
}

.modal::backdrop {
  background: var(--overlay-strong);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - 1rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  color: var(--text);
  box-sizing: border-box;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-image-wrap {
  width: 100%;
  aspect-ratio: 1;
  max-height: min(280px, 42dvh);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.modal-image-wrap.image-fallback {
  position: relative;
}

.modal-image-wrap img,
.modal-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.75rem;
}

.modal-image-wrap .image-unavailable {
  padding: 1rem;
  font-size: 0.8rem;
}

.modal-head {
  padding-right: 2.75rem;
  margin-bottom: 0.75rem;
}

.modal-head .entry-series {
  margin-bottom: 0.5rem;
}

.modal-head h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  line-height: 1.35;
  word-break: break-word;
  color: var(--text);
}

.modal-details {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.modal-details div {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.modal-details div:last-child {
  border-bottom: none;
}

.modal-details div span:first-child {
  color: var(--text-muted);
  flex-shrink: 0;
}

.modal-details div span:last-child {
  text-align: right;
  word-break: break-word;
  color: var(--text);
}

.modal-standort-field {
  margin: 0 0 1.25rem;
}

.modal-standort-field + .gepuzzelt-box {
  margin-top: 0.75rem;
}

.modal-standort-field input {
  width: 100%;
}

.gepuzzelt-box {
  background: var(--bg-card);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin: 0 0 1rem;
  color: var(--text);
  border: 1px solid var(--border);
}

.gepuzzelt-box h4 {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  color: var(--text);
}

.gepuzzelt-box .checkbox.gepuzzelt-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  line-height: 1.2;
}

.gepuzzelt-box .checkbox.gepuzzelt-toggle:last-child {
  margin-bottom: 0;
}

.gepuzzelt-box .checkbox.gepuzzelt-toggle input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  flex-shrink: 0;
}

.gepuzzelt-box .gepuzzelt-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  position: sticky;
  bottom: 0;
  background: var(--bg-elevated);
  padding-top: 0.25rem;
}

.modal-actions .btn {
  flex: 1;
}

@media (min-width: 640px) {
  .modal-content {
    padding: 1.25rem;
  }

  .modal-image-wrap {
    max-height: min(320px, 45dvh);
  }
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 2000;
  font-size: 0.9rem;
}

.file-warning {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3000;
  background: var(--danger);
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Serie colors */
.series-original { background: rgba(251, 191, 36, 0.2); color: var(--c-original); }
.series-destiny { background: rgba(236, 72, 153, 0.2); color: var(--c-destiny); }
.series-mystery { background: rgba(56, 189, 248, 0.2); color: var(--c-mystery); }
.series-christmas, .series-christmas-adventskalender { background: rgba(248, 113, 113, 0.2); color: var(--c-christmas); }
.series-junior { background: rgba(74, 222, 128, 0.2); color: var(--c-junior); }
.series-retro, .series-retro-original, .series-retro-destiny, .series-retro-mystery { background: rgba(167, 139, 250, 0.2); color: var(--c-retro); }
.series-jan-van-haasteren, .series-jan { background: rgba(249, 115, 22, 0.2); color: var(--c-jvh); }
.series-default { background: rgba(148, 163, 184, 0.2); color: var(--c-default); }

/* Desktop */
@media (min-width: 640px) {
  .entries-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
  .app-header { padding: 0.85rem 1.5rem; }
  .app-main { padding: 1.5rem; }
  .header-left h1 { font-size: 1.25rem; }
  .header-menu-toggle { display: none; }
  .header-menu {
    display: flex;
    position: static;
    flex-direction: row;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    gap: 0.5rem;
  }
  .header-menu .btn { width: auto; }
}

@media (min-width: 960px) {
  .entries-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
  .entry-title { font-size: 1rem; }
  .auth-card { padding: 2.5rem; }
}

@media (min-width: 1200px) {
  .entries-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 768px) {
  .entries-grid.view-list .entry-image-wrap {
    width: 160px;
    min-width: 160px;
  }
}
