:root {
  /* Dark theme (default) */
  --bg-primary: #0b1622;
  --bg-secondary: #1a2332;
  --bg-tertiary: #151f2e;
  --bg-quaternary: #32445b;
  --text-primary: #8596a5;
  --text-secondary: #a8b5c4;
  --overlay-bg: #101820;
  --overview-border: #475a6d;
  --button-bg: #1f2a38;
  --activity-high: #abbacd;
  --activity-low: #7c899a;
}

[data-theme="light"] {
  --bg-primary: #e7f0f8;
  --bg-secondary: #f8f8f8;
  --bg-tertiary: #b7e0f7;
  --bg-quaternary: #97cdec;
  --text-primary: #0b5f97;
  --text-secondary: #0b5f97;
  --overlay-bg: #e7f0f8;
  --overview-border: #5fb3e4;
  --button-bg: #cfe8f7;
  --activity-high: #4b90b8;
  --activity-low: #73b2d6;
}

[data-theme="brown"] {
  --bg-primary: #271c19;
  --bg-secondary: #f8f8f8;
  --bg-tertiary: #55423d;
  --bg-quaternary: #af7f76;
  --text-primary: #faeee7;
  --text-secondary: #faeee7;
  --overlay-bg: #271c19;
  --overview-border: #3b2b27;
  --button-bg: #6b534c;
  --activity-high: #af7f76;
  --activity-low: #74544d;
}

/* --- Global Styles --- */
body {
  background-color: var(--bg-primary);
  margin: 0;
  padding: 0;
  color: var(--text-primary);
}

/* --- Banner Rotator --- */
.banner-rotator {
  position: relative;
  width: 100%;
  height: 330px;
  overflow: hidden;
}

.banner-rotator img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  object-position: center 15%;
  transition: opacity 1s ease-in-out;
  opacity: 1;
}

.banner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  /* background: linear-gradient(to top, #060d22cc 0%, transparent 60%);
  background: linear-gradient(180deg, rgba(6, 13, 34, 0) 40%, rgba(6, 13, 34, 0.6) 100%); */
  z-index: 1;
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  padding-right: 2rem;
  box-sizing: border-box;
}

/* The quote container on right side, initially hidden */
.banner-quote {
  display: none;
  /* toggle via JS */
  color: white;
  font-style: italic;
  padding: 1rem 2rem;
  text-align: right;
  max-height: 50%;
  min-height: 10%;
  max-width: 30%;
  min-width: 5%;
  overflow-y: auto;
  white-space: pre-wrap;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  /* allow text selection if needed */
  border-radius: 0 0 0 12px;

  margin-top: auto;
  /* push it down inside flex container */
  margin-bottom: 2rem;
  /* add some space from bottom */

  transition: opacity 1s ease-in-out;

  scrollbar-width: none;
  /* for Firefox */
  -ms-overflow-style: none;
  /* for IE and Edge */
}

.banner-quote::-webkit-scrollbar {
  display: none;
}

/* --- Section Separator --- */
.separator-bar {
  height: 45px;
  background-color: var(--bg-tertiary);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 5px;
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0 1rem;
}

/* --- Card Grid --- */
.card-grid {
  border-radius: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 85px));
  background: var(--bg-tertiary);
  margin-bottom: 2rem;
  gap: 22px 22px;
  padding: 22px;
}

#characters-card-grid,
#actors-card-grid,
#games-card-grid,
#manga-card-grid,
#anime-card-grid,
#tv-shows-card-grid,
#movies-card-grid,
#books-card-grid,
#music-card-grid {
  background: none;
  border: 4px solid var(--overview-border);
  margin-bottom: 0 !important;
}

/* --- Card Styles --- */
.card {
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.15s ease-in-out;
  width: 85px;
  height: 115px;
  overflow: visible;
}

.card-image {
  /*
  width: 340px; 
  height: 460px;
  transform: scale(0.25);
*/
  transform-origin: top left;
  overflow: hidden;
  border-radius: 4px;
}

.card img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  border-radius: 4px;
}

.card a {
  display: block;
  max-height: 115px;
  overflow: hidden;
  border-radius: 4px;
}

.card[data-media-type="music"] {
  width: 85px;
  height: 85px;
}

.card[data-media-type="music"] .card-image {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
}

.card[data-media-type="music"] .card-image img {
  width: 178.8%;
  /* 152/85 = 1.788 - scales image to match your 152px container */
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  border-radius: 4px;
  /* Use transform for positioning instead of object-position */
  transform: translateX(-21.7%);
  /* Centers the zoomed portion: (178.8-100)/2/178.8 ≈ 21.2% */
  transform-origin: center;
}

/* Override base <a> rule so music cards aren't clipped by 115px limit */
.card[data-media-type="music"] a {
  max-height: 150px;
  /* match music card height */
  overflow: hidden;
  border-radius: 4px;
}

/* Hover title overlay */
.hover-title-overlay {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: var(--button-bg);
  padding: 6px 10px;
  min-height: 24px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  max-width: 1000px;
}

/* Hover title text */
.hover-title-text {
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hovered state */
.card:hover .hover-title-overlay {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  margin-bottom: 8px;
}


/* --- Edit Button --- */
.edit-card-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  display: none;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
}



/* --- Section Headers --- */
.status-header,
.favorites-header {
  margin-bottom: 10px;
  font-weight: bold;
  font-size: 1.3rem;
  color: var(--text-primary);
}

/* --- Stats Section Layout --- */
.stats-section {
  display: flex;
  justify-content: center;
  gap: 6.30rem;

}

.stats-activity {
  flex: 1;
  background: var(--bg-tertiary);
  height: 250px;
  border-radius: 12px;
}

.favorites-row {
  display: flex;
  justify-content: center;
  gap: 6rem;
  margin-bottom: 0rem;
}

.favorites-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 40%;
}

.favorites-header {
  display: inline;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 0.8rem;
  cursor: pointer;
  text-decoration: none;
}

h2 {
  margin: 0;
  margin-bottom: 0.8rem;
  margin-top: 0.7rem;
}

.activity-graph {
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-width: 600px;
}

.activity-graph h3 {
  color: var(--text-primary);
  max-width: 530px;
  margin-bottom: 1rem;
}

.extra-stats-class h3 {
  color: var(--text-primary);
  max-width: 530px;
  margin-bottom: 1rem;
}

.activity-grid {
  background: var(--bg-tertiary);
  display: flex;
  gap: 8px;
  padding: 15px;
  border-radius: 4px;
  max-width: 530px;
}

.activity-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.activity-none {
  background-color: var(--bg-primary);
  pointer-events: none;
}

.activity-low {
  background-color: var(--activity-low);
}

.activity-high {
  background-color: var(--activity-high);
}

.stats-summary-box {
  width: 554px;
  padding: 0;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.extra-stats-class h2 {
  font-size: 1.3rem;
  margin-bottom: 0.1rem;
  color: var(--text-primary);
  width: fit-content;
  margin-left: 1.5rem;
}

.stats-blocks {
  display: flex;
  padding: 1.4rem 1.5rem 0.9rem;
  gap: 0.8rem;
}

.stats-block {
  flex: 1;
  text-align: center;
  background: var(--bg-primary);
  border-radius: 4px;
  padding: 0.8rem 0.4rem;
  position: relative;
  transition: all 0.3s;
  display: none;
}

.stats-block.visible {
  display: block;
}

.stats-block.hidden {
  display: none;
}

.stats-block.highlight {
  box-shadow: 0 0 0 2px var(--block-color);
}

.stats-bar {
  display: flex;
  height: 10px;
  margin: 0 1.5rem;
  border-radius: 6px;
  overflow: visible;
  position: relative;
}

.stats-bar-segment {
  height: 100%;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  filter: brightness(0.85);
  border-right: 1px solid rgb(46, 46, 46);
}

.stats-bar-segment:last-child {
  border-right: none;
}

.stats-bar-segment:first-child {
  border-radius: 6px 0 0 6px;
}

.stats-bar-segment:last-child {
  border-radius: 0 6px 6px 0;
}

.stats-bar-segment:hover {
  filter: brightness(1.1);
}

.stats-bar-segment::after {
  content: attr(data-percentage);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.stats-bar-segment:hover::after {
  opacity: 1;
}

.stats-block-count {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stats-block-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

.extra-stats {
  display: flex;
  padding: 0.9rem 1.5rem 1.4rem;
  gap: 0.8rem;
}

.extra-stat-row {
  flex: 1;
  text-align: center;
  background: var(--bg-primary);
  border-radius: 4px;
  padding: 0.8rem 0.4rem;
  position: relative;
  cursor: pointer;
  transition: all 0.3s;
}

.extra-stat-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.extra-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.extra-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

.discover-button,
.notifications-wrapper,
.community-button {
  position: relative;
  display: inline-block;
  font-family: Arial, sans-serif;
}

.discover-button,
.notifications-button,
.community-button {
  background-color: transparent;
  border: none;
  color: var(--text-primary);
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  user-select: none;
}

.notifications-button {
  margin-right: 14vw;
  gap: 6px;
}

.notifications-button:hover {
  color: var(--activity-high);
}

.discover-button,
.community-button {
  text-decoration: none;
}

.discover-button svg {
  fill: var(--activity-high);
}

.discover-button:hover,
.discover-button:hover svg,
.community-button:hover,
.community-button:hover svg {
  color: var(--activity-high);
  /* bright yellow/orange for text */
  fill: var(--activity-high);
  /* same bright color for the flame SVG */
  transition: color 0.3s ease, fill 0.3s ease;
}

.notifications-button .notification-icon {
  fill: var(--activity-high);
  transition: fill 0.3s ease;
}

/* Pink icon and text when notifications exist */
.notifications-button.has-notifications {
  color: #e91e63;
  /* pink */
}

.notifications-button.has-notifications .notification-icon {
  fill: #e91e63;
}

/* Dropdown container */
.notifications-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #222;
  color: white;
  min-width: 190px;
  max-height: 300px;
  overflow-y: auto;
  border-radius: 4px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
  margin-top: 6px;
  padding: 10px 10px;
  z-index: 1000;
  margin-right: 13vw;

}

#notifications-dropdown {
  white-space: nowrap;
}

#notifications-dropdown[hidden] {
  display: none !important;
}

/* Notification list */
.notifications-dropdown ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notifications-dropdown li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid #444;
}

.notifications-dropdown li:last-child {
  border-bottom: none;
}

.notifications-dropdown li a {
  color: #fff;
  text-decoration: underline;
  flex-grow: 1;
  margin-right: 10px;
}

.notifications-dropdown li a:hover {
  color: #e91e63;
}

.dismiss-notification {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 6px;
  user-select: none;
  transition: color 0.3s ease;
  margin-bottom: 4px;
}

.dismiss-notification:hover {
  color: #e91e63;
}

.no-notifications {
  margin: 0;
  padding: 6px 4px;
  font-style: italic;
  color: #aaa;
}

.favorites-section {
  max-width: 1400px;
  margin: 0 auto;
}

.recent-activity ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-activity li {
  padding: 0.4rem 0;
  font-size: 1rem;
  border-bottom: 2px solid var(--bg-tertiary);
}

.recent-activity {
  max-width: 35rem;
}

.recent-activity a {
  text-decoration: none;
  color: inherit;
  margin-left: 0.5rem;
}

.recent-activity a:hover {
  color: var(--activity-high);
  /* on hover, maybe yellow to match your theme */
}

.recent-activity-hidden {
  display: none;
}

.activity-entry {
  position: relative;
  /* Add this */
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
}

.activity-left {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 27rem;
}

.activity-right {
  flex-shrink: 0;
  font-size: 1em;
}

.activity-thumbnail {
  position: absolute;
  top: 50%;
  left: calc(100% + 1rem);
  /* 1rem gap from the right edge of the link box */
  transform: translateY(-50%);
  display: none;
  z-index: 10;
}

.activity-thumbnail img {
  width: 120px;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

/* For music thumbnails - apply the same zoomed crop */
.activity-thumbnail[data-media-type="music"] {
  width: 120px;
  height: 120px;
  overflow: hidden;
  border-radius: 0.5rem;
}

.activity-thumbnail[data-media-type="music"] img {
  width: 178.8%;
  /* Same scale factor as before */
  object-fit: cover;
  object-position: center center;
  /* Adjust translateX to match your desired crop position */
  transform: translateX(-22.3%);
  transform-origin: center;
  border-radius: 0.5rem;
}

/* Show thumbnail only on hover */
.activity-entry:hover .activity-thumbnail {
  display: block;
}

.show-more-activity-wrapper {
  text-align: right;
  margin-top: 0.5rem;
}

#show-more-activity-btn {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#show-more-activity-btn:hover {
  background-color: var(--bg-quaternary);
}

#advanced-activity-btn,
#toggle-activity-btn {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: var(--button-bg);
  color: var(--text-primary);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#advanced-activity-btn:hover,
#toggle-activity-btn:hover {
  background-color: var(--bg-quaternary);
}

@media (hover: none),
(pointer: coarse) {
  .activity-thumbnail {
    display: none !important;
  }
}

/* --- Responsive --- */
@media (orientation: portrait) {

  .hover-title-overlay {
    display: none;
  }

  .status-header,
  .favorites-header {
    font-size: 2rem;
  }

  .extra-stats-class h3,
  .activity-graph h3 {
    font-size: 1.5rem;
  }

  .stats-section {
    display: flex;
    flex-direction: column;
    /* stack items vertically */
    justify-content: center;
    /* centers them along main axis (vertical now) */
    gap: 12rem;
    /* vertical spacing between sections */
    align-items: center;
    margin-top: 6rem;
    margin-bottom: 10rem;
    max-width: 67vw;
    margin-left: 10rem;
  }

  .extra-stats-class {
    transform: scale(1.6);
  }

  .activity-graph {
    transform: scale(1.6);
  }

  .stats-summary-box {
    max-width: 40rem !important;
  }

  .separator-bar {
    height: 5rem;
    justify-content: center;
    /* horizontal center */
    align-items: center;
    /* vertical center */
  }

  .notifications-button,
  .discover-button,
  .community-button {
    font-size: 2.5rem;
  }

  .notifications-button {
    margin-right: 0;
  }

  .notifications-button .notification-icon,
  .community-icon,
  .discover-icon,
  .music-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .no-notifications,
  .notifications-dropdown {
    font-size: 2.5rem;
  }

  .stats-summary-box {
    min-width: 0;
    max-width: 32rem;
    max-width: 70vw;
  }

  #advanced-activity-btn {
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
  }

  #toggle-activity-btn {
    display: none;
  }

  .favorites-section {
    max-width: 47rem;
  }

  /* Favorites section mobile layout */
  .favorites-row {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
  }

  .favorites-column {
    max-width: 100%;
    width: 100%;
    transform: scale(1.2);
    padding-block: 2rem;
  }

  .favorites-column h2 {
    margin-top: 0;
  }

  /* Single row horizontal scrollable layout for mobile */
  .card-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
    gap: 1rem;
    padding: 1.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 2rem;
  }

  /* Larger cards for mobile */
  .card {
    width: 225px;
    height: 300px;
    flex-shrink: 0;

  }

  .card a {
    max-height: 300px;
  }

  .card[data-media-type="music"] {
    width: 225px;
    height: 225px;
  }

  .card[data-media-type="music"] .card-image img {
    height: unset;
    width: 210%;
  }

  .card[data-media-type="music"] a {
    max-height: 225px;
  }

  .recent-activity a {
    font-size: 1.3rem;
  }

  .stats-block-label {
    font-size: 1rem;
  }

  .extra-stat-label {
    font-size: 0.9rem;
  }

  /* Show thumbnail only on hover */
  .activity-entry:hover .activity-thumbnail {
    display: none;
  }

}

/* Music Player Button */
.music-player-btn {
  background: none;
  border: 1px solid var(--text-primary);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  user-select: none;
}

.music-player-btn input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.music-player-btn input[type="checkbox"]:checked~span {
  color: var(--activity-high);
}

.music-player-btn:has(input:checked) {
  border-color: var(--activity-high);
  background: rgba(171, 186, 205, 0.1);
}

.music-player-btn:hover {
  border-color: var(--activity-high);
  color: var(--activity-high);
}

/* Music Player Container */
.music-player-container {
  position: fixed;
  z-index: 9999;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  overflow: hidden;
}

.music-player-btn {
  background: none !important;
  border: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 6px !important;
  user-select: none;
}

.music-player-btn input[type="checkbox"] {
  display: none;
}

.music-player-btn .music-icon {
  fill: var(--text-primary);
  transition: fill 0.3s ease, border-color 0.3s ease;
  border: 2px solid var(--text-primary);
  border-radius: 20%;
  padding: 4px;
}

.music-player-btn:has(input:checked) .music-icon {
  fill: var(--activity-high);
}

.music-player-btn:hover .music-icon {
  fill: var(--activity-high);
  border-color: var(--activity-high);
}

.music-player-container {
  position: fixed !important;
  z-index: 9999 !important;
  line-height: 0 !important;
}

.music-player-container iframe {
  display: block !important;
  border: none !important;
}