/* === Design Tokens (Pajamas-inspired) === */
:root {
  /* Background */
  --color-background: #fafafa;
  --color-background-subtle: #f0f0f0;

  /* Text — all meet WCAG AA on #fafafa */
  --color-text: #1f2937;
  --color-text-secondary: #4b5563;
  --color-text-muted: #6b7280;

  /* Primary */
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;

  /* Neutral */
  --color-border: #e5e7eb;
  --color-border-strong: #d1d5db;

  /* Semantic */
  --color-success: #22c55e;
  --color-success-bg: #dcfce7;
  --color-warning: #f59e0b;
  --color-warning-bg: #fef3c7;
  --color-danger: #ef4444;
  --color-danger-bg: #fee2e2;
  --color-info: #0ea5e9;
  --color-info-bg: #e0f2fe;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-xs: 13px;
  --font-size-sm: 15px;
  --font-size-md: 17px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;
}

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

body {
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  color: var(--color-text);
  background: var(--color-background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

/* === App Header === */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-background);
}

.header-content {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  max-width: 740px;
  margin: 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.header-btn {
  background: none;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* === Header Search Icon === */
.header-icon-btn {
  background: none;
  border: none;
  padding: var(--space-1);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.header-icon-btn:hover {
  color: var(--color-primary);
}

/* === Views === */
.view {
  display: none;
  max-width: 740px;
  margin: 0 auto;
  padding: var(--space-4);
}

.view-active {
  display: block;
}

#view-player {
  max-width: 740px;
}

/* === Now Playing Bar === */
.now-playing-bar {
  max-width: 740px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

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

.now-playing-info {
  flex: 1;
  min-width: 0;
}

.now-playing-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing-play {
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

/* === Book List (1 col mobile, 2 col desktop) === */
.book-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 640px) {
  .book-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-4);
  }
}

/* === Book Card (compact grid card) === */
.book-card {
  display: flex;
  flex-direction: row;
  gap: var(--space-3);
  padding: var(--space-3);
  cursor: pointer;
  transition: background 150ms ease;
  border-radius: var(--radius-lg);
  min-width: 0;
}

.book-card:active {
  background: var(--color-background-subtle);
}

.book-list-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-7) 0;
}

.section-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

.pro-tebe-section {
  margin-bottom: var(--space-5);
}
.pro-tebe-section .section-label {
  margin-top: 0;
}
.novinky-section .section-label {
  margin-top: 0;
}

.book-cover-wrapper {
  position: relative;
  width: 48px;
  min-width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-background-subtle);
}

.book-cover-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Favorite button overlay on cover */
.favorite-btn {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.favorite-btn svg {
  width: 10px;
  height: 10px;
}

.favorite-btn.active {
  background: rgba(239, 68, 68, 0.8);
}

/* Ownership banner overlay on cover bottom */
.cover-ownership {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  padding: 1px 0;
  letter-spacing: 0.3px;
}

.cover-ownership-sample {
  background: rgba(0, 0, 0, 0.5);
  color: white;
}

.book-cover-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
  gap: var(--space-1);
}

/* Play button — under cover */
.book-play-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: white;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  align-self: center;
  transition: background 150ms ease, color 150ms ease;
}

.book-play-btn svg {
  width: 12px;
  height: 12px;
}

.book-play-btn:active {
  background: var(--color-primary);
  color: white;
}

.book-card-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.book-card-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-card-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-card-meta.meta-expanded {
  white-space: normal;
  overflow: visible;
}

.book-card-series {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}
.series-link {
  color: var(--color-primary);
  cursor: pointer;
}

.book-card-desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card-desc.desc-full,
.series-book-desc.desc-full {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* === Series Cards === */
.series-card {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3);
  cursor: pointer;
  border-radius: var(--radius-lg);
}

.series-cover-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
}

.series-cover-col .book-cover-wrapper {
  width: 48px;
  height: 48px;
}

.series-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.series-count {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.series-expanded {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--space-2) 0 0 0;
}

.series-book-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  grid-template-rows: auto auto;
  align-items: start;
  gap: 0 var(--space-3);
  padding: var(--space-2) 0;
}

.series-book-play {
  grid-row: 1 / -1;
  align-self: center;
  width: 32px;
  height: 32px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.series-book-header {
  grid-row: 1;
  font-size: 13px;
  min-width: 0;
}

.series-book-num {
  font-weight: 600;
  color: var(--color-text-muted);
}

.series-book-title {
  font-weight: 400;
}

.series-book-dur {
  grid-row: 1;
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: right;
  white-space: nowrap;
}

.series-book-desc {
  grid-column: 2 / -1;
  grid-row: 2;
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  padding-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


.meta-link {
  color: var(--color-primary);
  cursor: pointer;
  transition: color 150ms ease;
}

.meta-link:hover,
.meta-link:active {
  color: var(--color-primary-hover);
}

.meta-link-more {
  font-style: italic;
  font-size: var(--font-size-xs);
  color: var(--color-primary);
}

.names-rest {
  font-size: 12px;
}

.hidden {
  display: none;
}

.book-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

/* === Tag Badges === */
.tag-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  cursor: default;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--color-background-subtle);
  color: var(--color-text-muted);
  line-height: 1.5;
}
.tag-genre-scifi { background: #dbeafe; color: #1d4ed8; }
.tag-genre-fantasy { background: #ede9fe; color: #6d28d9; }
.tag-genre-historicky { background: #fef3c7; color: #92400e; }
.tag-genre-thriller { background: #fee2e2; color: #991b1b; }
.tag-genre-humor { background: #dcfce7; color: #166534; }
.tag-genre-klasika { background: #ccfbf1; color: #0d9488; }
.tag-genre-romanticke { background: #fce7f3; color: #be185d; }
.tag-genre-nonfiction { background: #f3f4f6; color: #374151; }
.tag-genre-horor { background: #ede9fe; color: #5b21b6; }
.tag-genre-pohadky { background: #ffedd5; color: #c2410c; }


/* === Series Badge (legacy, use .book-card-series instead) === */
.series-badge {
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 500;
}

.book-card-sample {
  /* sample books shown at full opacity; "Ukázka" banner on cover is sufficient */
}

/* === Filter Chips === */
.filter-chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-2) 0;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: rgba(99, 102, 241, 0.08);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.filter-chip button {
  background: none;
  border: none;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
  padding: 0 0 0 4px;
  line-height: 1;
}

/* Genre pills */
.genre-pill {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-background);
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.genre-pill.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* === Library Tabs (inside header) === */
.library-tabs {
  display: flex;
  align-items: center;
  flex: 1;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
}
.library-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--color-text);
  font-weight: 600;
  border-bottom-color: var(--color-primary);
}

/* === Tabs Row (tabs + sort) === */
.tabs-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* === Library Navigation === */
.library-nav {
  background: var(--color-background);
  padding: 0 var(--space-3);
}

.filter-toggle-btn {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 12px;
  color: var(--color-primary);
  cursor: pointer;
  white-space: nowrap;
}

.filter-section {
  padding-bottom: var(--space-1);
}

.sort-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  overflow-x: auto;
  padding: var(--space-1) 0;
  scrollbar-width: none;
}
.sort-row::-webkit-scrollbar { display: none; }

.genre-chip.excluded {
  opacity: 0.4;
  text-decoration: line-through;
}

.genre-manage-link {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  font-style: italic;
}

/* === Genre Settings Popup === */
.genre-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.genre-settings-popup {
  background: var(--color-background);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  max-width: 400px;
  width: 90%;
}

.genre-settings-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.genre-settings-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.genre-settings-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.genre-settings-chips .genre-chip {
  padding: 6px 16px;
  font-size: 14px;
}

.genre-settings-close {
  width: 100%;
  padding: var(--space-2);
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
}

/* === Genre Cloud === */
.genre-cloud {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  padding: var(--space-2) 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.genre-cloud::-webkit-scrollbar { display: none; }

.genre-chip {
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid currentColor;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.genre-chip.active {
  color: #fff !important;
}

/* === Author/Narrator Clouds === */
.meta-cloud {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  overflow-x: auto;
  padding: var(--space-1) 0;
  scrollbar-width: none;
}
.meta-cloud::-webkit-scrollbar { display: none; }

.meta-cloud-label {
  font-size: 12px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.meta-chip {
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border, #ddd);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--color-text-secondary);
}
.meta-chip.active {
  background: var(--color-text);
  color: var(--color-background);
  border-color: var(--color-text);
}
.meta-chip-more {
  border: none;
  color: var(--color-primary);
  font-style: italic;
}

/* === Filter Chips === */
.active-filters {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  padding: var(--space-1) 0;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
}
.filter-chip button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

/* === Book Count (inside sort row) === */
.book-count {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.sort-toggle {
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
}

/* === Active Filters === */
.active-filters {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  flex-wrap: wrap;
}

/* === Search Pill (inline in genre cloud) === */
.search-pill {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-background);
  cursor: text;
}
.search-pill-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.search-pill-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 12px;
  color: var(--color-text);
  width: 90px;
  padding: 0;
}
.search-pill:focus-within {
  border-color: var(--color-primary);
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal {
  background: var(--color-background);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* === Toast === */
.toast-container {
  position: fixed;
  bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  left: var(--space-4);
  right: var(--space-4);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 600px;
  margin: 0 auto;
  pointer-events: none;
}

.toast {
  background: #1f2937;
  color: white;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast button {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  font-size: var(--font-size-sm);
  cursor: pointer;
  white-space: nowrap;
}

/* === Update Toast (shown by inline script before app.js loads) === */
.update-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: var(--space-4);
  right: var(--space-4);
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  background: var(--color-background);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 9999;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  animation: slideDown 300ms ease;
}

.update-toast button {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* === Utility === */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* === Player === */
.player-back-btn {
  margin-bottom: var(--space-2);
}

.player-header {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.player-cover {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--color-background-subtle);
}

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

.player-title {
  font-size: var(--font-size-md);
  font-weight: 700;
  line-height: 1.3;
}

.player-author {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.player-chapter {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.player-description {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  margin-bottom: var(--space-3);
}

/* === Extended Skips === */
.extended-skips {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2);
  gap: 4px;
}

.skip-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: #E7E8E5;
  border: none;
  cursor: pointer;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text);
}

.skip-pill-sm {
  font-size: 10px;
}

.skip-divider {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.3;
  flex-shrink: 0;
  padding: 0 2px;
}

/* === Main Controls === */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-5) 0;
}

.player-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-btn-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-text);
  color: var(--color-background);
}

/* === Utility Items (inline sleep, cache) === */
.utility-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--color-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.utility-item svg { width: 14px; height: 14px; }
.utility-item svg.spin,
.player-btn-play svg.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.utility-item.active {
  color: var(--color-primary);
}

.cache-indicator {
  cursor: default;
  pointer-events: none;
}

.utility-label {
  font-variant-numeric: tabular-nums;
}

/* === Time === */
.player-time {
  display: flex;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  padding: 0;
  margin-top: -8px;
}


/* === Sleep Timer Modal === */
.sleep-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.sleep-option {
  padding: var(--space-3);
  font-size: var(--font-size-md);
  font-weight: 500;
  text-align: center;
  background: var(--color-background-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text);
}

.sleep-option:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.sleep-option-cancel {
  grid-column: 1 / -1;
  background: none;
  color: var(--color-text-muted);
  border-color: transparent;
}

/* === Sleep Rewind Toast === */
.sleep-rewind-toast {
  position: fixed;
  bottom: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  max-width: 400px;
  margin: 0 auto;
  background: #1f2937;
  color: #f9fafb;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.sleep-rewind-toast.hidden {
  display: none;
}

.sleep-rewind-question {
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.sleep-rewind-answer {
  font-size: var(--font-size-xs);
  color: #9ca3af;
}

.sleep-rewind-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.sleep-rewind-btn {
  padding: var(--space-1) var(--space-3);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
}

.sleep-rewind-dismiss {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: var(--font-size-lg);
  cursor: pointer;
  padding: 0 var(--space-1);
}

/* === Player Detail / Suggestions === */
.player-detail {
  margin-top: var(--space-6);
}

.suggestions-section {
  margin-bottom: var(--space-5);
}

.series-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-4);
  padding: 0 var(--space-2);
}

.suggestions-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
}

.suggestions-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}
@media (min-width: 640px) {
  .suggestions-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === Player Narrator === */
.player-narrator {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* === Player Tags === */
.player-tags {
  margin-top: var(--space-1);
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

/* === Player Description === */
.player-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-top: var(--space-2);
  text-align: left;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* === Login Form (inside modal) === */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.modal-header h2 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--font-size-2xl);
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.login-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  margin-bottom: var(--space-1);
  color: var(--color-text-secondary);
}

.login-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-background);
  color: var(--color-text);
  outline: none;
}

.login-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.login-error {
  font-size: var(--font-size-sm);
  color: var(--color-danger);
  min-height: 20px;
  margin: var(--space-2) 0;
}

.login-submit {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-md);
  font-weight: 500;
  color: white;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.login-submit:hover {
  background: var(--color-primary-hover);
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* === Profile Menu (avatar + dropdown) === */
.profile-menu {
  position: relative;
  flex-shrink: 0;
}

.avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}

.profile-dropdown {
  position: fixed;
  top: 48px;
  right: var(--space-3);
  min-width: 160px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 150;
  padding: var(--space-2) 0;
}

.profile-dropdown-name {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-1);
}

.profile-dropdown-item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}

.profile-dropdown-item:hover {
  background: var(--color-background-subtle);
}

/* === Guest Limit Banner === */
.guest-banner {
  background: var(--color-warning-bg);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.guest-banner button {
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

/* === Sleep Timer === */
.sleep-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 11px;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.sleep-btn.active {
  color: var(--color-primary);
}
