
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px;
  background: #171722;
  color: #f5f3ff;
  font-family: Arial, sans-serif;
}

header {
  position: relative;
  text-align: center;
  max-width: 1100px;
  margin: 0 auto 28px;
}

h1 {
  margin-bottom: 6px;
  color: #c7afff;
}

header p, #status, .save-note {
  color: #aaa8bf;
}

.customizer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  max-width: 1100px;
  margin: auto;
  align-items: start;
}

.preview-panel,
.editor-panel {
  background: #252536;
  border: 1px solid #3a3950;
  border-radius: 16px;
  padding: 24px;

  /* Keep the editor contents stacked vertically. */
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Scroll only the customization options. */
#optionsPanel {
  max-height: 650px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  scrollbar-gutter: stable;
}

h2 {
  margin-top: 0;
}

#avatarCanvas {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  margin: 16px auto;
}

.preview-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 11px 15px;
  color: white;
  background: #6750ad;
  cursor: pointer;
  font-size: 14px;
}

button:hover {
  background: #8167d0;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #c7afff;
  outline-offset: 3px;
}


.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, auto);
  gap: 8px;
  width: 100%;
}


/* Shell Type selector */

.shell-type-heading {
  margin: 0 0 12px;
}

.shell-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.shell-type-button {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid #44435b;
  border-radius: 10px;
  background: #303044;
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.shell-type-button:hover {
  background: #3a3a52;
}

.shell-type-button.selected {
  border-color: #9b8cff;
  background: #40385f;
}

.shell-type-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tab {
  background: #39384e;
  flex: 1 1 auto;
}


/* Keep all customization tabs the same size. */
.tabs .tab {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}


.tab.active {
  background: #7658c8;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Only Shell folders use four columns */
.option-folder .option-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.option-folder .option-card {
  min-width: 0;
  padding: 6px;
}

.option-card img {
  display: block;
  width: 100%;
  max-width: 140px;
  height: 120px;
  object-fit: contain;
}

.option-card {
  background: #343448;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 12px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.option-card.selected {
  border-color: #bc9aff;
  background: #45405f;
}

.option-card img {
  width: 100%;
  max-width: 100px;
  height: 80px;
  object-fit: contain;
}

.option-card img.pixel-art {
  image-rendering: pixelated;
}

.option-card span {
  font-size: 14px;
}

.option-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.save-note {
  font-size: 12px;
  margin-top: 24px;
}

#saveStatus {
  text-align: center;
  font-size: 13px;
  color: #aaa8bf;
  min-height: 18px;
}

@media (max-width: 750px) {
  .customizer {
    grid-template-columns: 1fr;
  }

  body {
    padding: 14px;
  }

  .preview-panel,
  .editor-panel {
    padding: 16px;
  }
}

/* Palette color bar previews */

.palette-preview {
  display: flex;
  width: 100%;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.palette-swatch {
  flex: 1;
  min-width: 0;
}

/* Animated previews in the Animation tab */

.animation-preview {
  display: block;
  width: 120px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  image-rendering: pixelated;
}
.palette-animal-preview {
  display: block;
  width: 120px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  image-rendering: pixelated;
  margin: 0 auto;
}
.option-folder {
  border: 1px solid #555;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.option-folder-title {
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  padding: 8px;
  user-select: none;
}

.option-folder .option-grid {
  margin-top: 12px;
}
/* Larger previews in the Animal tab */
.option-card img.animal-preview {
  max-width: 150px;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  image-rendering: pixelated;
}
/* Square cards in the Animal tab */
.option-card.animal-card {
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 8px;
  gap: 6px;
}
/* Locked shell collections */
.locked-folder {
  background: #20202d;
  border-color: #444354;
}

/* Folder headings */
.option-folder-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Unlock requirement text */
.folder-requirement {
  font-size: 11px;
  font-weight: normal;
  color: #aaa8bf;
  text-align: right;
}

/* Locked folder heading */
.locked-folder .option-folder-title {
  color: #aaa8bf;
}
/* Locked shell thumbnails */
.locked-shell-card {
  position: relative;
}

.locked-shell-card img {
  filter: brightness(0.35);
  transition: filter 0.2s ease;
}

/* Reveal the shell on hover */
.locked-shell-card:hover img {
  filter: brightness(1);
}

/* Lock icon overlay */
.shell-lock-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 16px;
  pointer-events: none;
}
/* Custom lock icon */
.shell-lock-icon {
  position: absolute;
  top: 2px;
  right: 0px;
  width: 32px !important;
  height: 32px !important;
  object-fit: contain;
  image-rendering: pixelated;
  filter: none !important;
  pointer-events: none;
}
#saveStatus {
  text-align: center;
  font-size: 13px;
  color: #aaa8bf;
  min-height: 18px;
  opacity: 1;
  transition: opacity 0.6s ease;
}

#saveStatus.fade-out {
  opacity: 0;
}

#saveButton:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
/* Credits & Disclaimers */
.credits-panel {
  background: #252536;
  border: 1px solid #3a3950;
  border-radius: 16px;
  padding: 24px;

  grid-column: 1;
  grid-row: 2;
}

.credits-panel h2 {
  margin-top: 0;
  color: #c7afff;
}

.credits-notice {
  font-weight: bold;
  color: #e0d1ff;
  margin-bottom: 16px;
}

.credits-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.credits-list li {
  margin-bottom: 10px;
  color: #ccc9df;
  line-height: 1.5;
}

.credits-list a {
  color: #bc9aff;
  text-decoration: underline;
}

.credits-list a:hover {
  color: #e0d1ff;
}

@media (max-width: 750px) {
  .credits-panel {
    grid-column: auto;
    grid-row: auto;
    padding: 16px;
  }
}
@media (min-width: 751px) {
  .editor-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}
/* Keep Preview and Credits together */
.preview-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
}

/* Credits no longer occupy a separate grid row */
.credits-panel {
  grid-column: auto;
  grid-row: auto;
}

/* Editor occupies its own column */
@media (min-width: 751px) {
  .editor-panel {
    grid-column: 2;
    grid-row: auto;
  }
}
/* ========================================
   CHATTERPALS NOTIFICATION ENVELOPE
======================================== */

.notification-container {
  position: absolute;
  top: -75px;
  right: 10px;
  width: 56px;
  height: 56px;
  z-index: 100;
}
#notificationButton {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  width: 64px;
  height: 64px;
  padding: 4px;
  box-sizing: border-box;

  /* Square notification frame */
  background: #252535;
  border: 1px solid #7777a0;
  border-radius: 15px;

  /* Subtle pixel-style depth */
  box-shadow: 0 4px 0 #151520;

  cursor: pointer;
}

#notificationButton:hover {
  background: #35354b;
}

#notificationButton:active {
  box-shadow: 0 2px 0 #151520;
}

#notificationIcon {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;

  /* Move only the envelope image upward */
  transform: translateY(-4px);
}

#notificationButton:hover {
  transform: translateY(-2px);
}

.notification-count {
  position: absolute;
  top: 35px;
  right: 5px;

  min-width: 18px;
  padding: 2px 5px;
  border-radius: 10px;

  background: #e84d55;
  color: white;

  font-size: 12px;
  font-weight: bold;
  text-align: center;
}

/* Anchor the notification envelope to the Customize panel. */
.editor-panel {
  position: relative;
}

/* Keep the dropdown from shifting the envelope. */
.notification-panel {
  position: absolute;
  top: 64px;
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  z-index: 101;
}

/* Ensure the dropdown stays hidden when closed. */
.notification-panel[hidden] {
  display: none;
}

/* ========================================
   CHATTERPALS NOTIFICATION MENU
======================================== */

.notification-panel {
  position: absolute;
  top: 0px;
  right: 65px;

  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  box-sizing: border-box;

  background: #252535;
  border: 2px solid #7777a0;
  border-radius: 12px;

  color: #ffffff;
  box-shadow: 0 6px 0 #151520;

  z-index: 101;
}

/* Keep the menu hidden when closed. */
.notification-panel[hidden] {
  display: none;
}

/* Notification menu heading */
.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding-bottom: 12px;
  margin-bottom: 12px;

  border-bottom: 2px solid #55556f;
}

.notification-header h2 {
  margin: 0;
  font-size: 18px;
  color: #ffffff;
}

/* Dismiss All button */
#dismissAllNotifications {
  padding: 6px 10px;

  background: #41415c;
  border: 2px solid #7777a0;
  border-radius: 6px;

  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
}

#dismissAllNotifications:hover {
  background: #555577;
}

/* Notification content */
.notification-list {
  display: flex;
  flex-direction: column;
  gap: 10px;

  max-height: 350px;
  overflow-y: auto;
}

.notification-list p {
  margin: 0;
  padding: 12px 4px;

  text-align: center;
  font-size: 14px;
  color: #c5c5d5;
}

/* ========================================
   CHATTERPALS NOTIFICATION CARDS
======================================== */

.notification-item {
  display: flex;
  flex-direction: column;
  gap: 8px;

  padding: 12px;
  box-sizing: border-box;

  background: #343448;
  border: 1px solid #55556f;
  border-radius: 8px;
}

.notification-item-title {
  display: block;
  color: #ffffff;
  font-size: 14px;
  font-weight: bold;
}

.notification-item-description {
  margin: 0;
  padding: 0;

  color: #d4d4e5;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

/* Container for future notification action buttons. */
.notification-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.notification-actions button {
  padding: 7px 10px;

  background: #41415c;
  border: 1px solid #7777a0;
  border-radius: 6px;

  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
}

.notification-actions button:hover {
  background: #555577;
}

.notification-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hide Dismiss All when there are no unread notifications. */
#dismissAllNotifications[hidden] {
  display: none;
}

/* Twitch viewer greeting */
.viewer-greeting {
  position: absolute;
  top: -30px;
  right: 0px;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;

  padding: 6px 10px;
  border-radius: 6px;

  background: #242437;
  color: #f5f3ff;
  font-family: inherit;
  z-index: 10;
}

.viewer-greeting[hidden] {
  display: none;
}

.viewer-greeting-label {
  font-size: 10px;
  font-weight: 600;
  color: #aaa6c4;
  letter-spacing: 0.4px;
}

.viewer-greeting-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 650px) {
  .viewer-greeting {
    position: static;
    width: fit-content;
    margin: 10px auto 0;
  }
}

/* ========================================
   RESPONSIVE HEADER ACCOUNT LAYOUT
======================================== */

.header-account {
  position: absolute;
  top: -20px;
  right: 0;

  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* Keep the greeting inside the account layout. */
.header-account .viewer-greeting {
  position: static;
  right: auto;
  width: fit-content;
  margin: 0;
  transform: translateY(-10px);
}

/* Keep the envelope directly below the greeting. */
.header-account .notification-container {
  position: relative;
  top: -10px;
  right: auto;
  width: 64px;
  height: 64px;
}

/* Narrow screens: move account controls below the title. */
@media (max-width: 850px) {
  .header-account {
    position: static;
    margin-top: 16px;
    align-items: center;
  }
}


/* Cosmetics locked by Supabase eligibility */
.option-card.locked-cosmetic {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #55556f;
}

.option-card.locked-cosmetic img,
.option-card.locked-cosmetic canvas {
  filter: grayscale(1);
}

.option-card.locked-cosmetic:hover {
  background: #343448;
}


/* =====================================
   TITLE TAB — LARGE VERTICAL PREVIEWS
   ===================================== */


/* Force Title collections into one vertical column */
.option-grid.title-options-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.option-grid.title-options-grid > .title-option-card {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}


.title-option-card {
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 100px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.title-option-card .title-option-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

.title-option-card span {
  text-align: center;
}

/* Title tab — None option */
.title-none-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-bottom: 12px;
  font-weight: 600;
}

/* =====================================
   TITLE LOCK ICONS AND REQUIREMENTS
   ===================================== */


/* Title lock icon — matches Shell locks */
.title-option-card {
  position: relative;
}

.title-option-card .title-lock-icon {
  position: absolute;
  top: 2px;
  right: 0px;
  width: 32px !important;
  height: 32px !important;
  object-fit: contain;
  image-rendering: pixelated;
  filter: none !important;
  opacity: 1;
  pointer-events: none;
  z-index: 2;
}

/* Gray out only the locked title artwork */
.title-option-card.locked-cosmetic {
  opacity: 1;
}



/* Locked titles stay dimmed unless hovered */
.title-option-card.locked-cosmetic .title-option-preview {
  opacity: 1;
  filter: brightness(0.35);
  transition: filter 0.2s ease;
}

/* Reveal title artwork only while hovering */
.title-option-card.locked-cosmetic:hover .title-option-preview {
  filter: brightness(1);
}

/* Locked title cards remain interactive */
.title-option-card.locked-cosmetic {
  pointer-events: auto;
  cursor: pointer;
}



/* Keep the artwork visible when temporarily selected */
.title-option-card.locked-cosmetic.selected .title-option-preview {
  opacity: 1;
  filter: none;
}


.title-unlock-requirement {
  display: block;
  width: 100%;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  opacity: 0.8;
}

/* =====================================
   ANIMAL LOCK ICONS AND REQUIREMENTS
   ===================================== */

.option-card.animal-card {
  position: relative;
}


/* Locked Animals remain interactive */
.animal-card.locked-cosmetic {
  opacity: 1;
  filter: none;
  pointer-events: auto;
  cursor: pointer;
}

/* Darken locked Animal artwork */
.animal-card.locked-cosmetic canvas,
.animal-card.locked-cosmetic .animal-preview {
  opacity: 1;
  filter: brightness(0.35);
  transition: filter 0.2s ease;
}

/* Match the Title hover background */
.animal-card.locked-cosmetic:hover {
  background: #8167d0;
  border-color: transparent;
  outline: none;
}

/* Reveal Animal artwork only while hovering */
.animal-card.locked-cosmetic:hover canvas,
.animal-card.locked-cosmetic:hover .animal-preview {
  filter: brightness(1);
}


.animal-card .animal-lock-icon {
  position: absolute;
  top: 2px;
  right: 0;
  width: 32px !important;
  height: 32px !important;
  object-fit: contain;
  image-rendering: pixelated;
  opacity: 1;
  filter: none !important;
  pointer-events: none;
  z-index: 2;
}

.animal-unlock-requirement,
.animal-unlock-instruction {
  display: block;
  width: 100%;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}

.animal-unlock-instruction {
  opacity: 0.8;
}

.title-option-card.locked-cosmetic {
  pointer-events: auto;
  cursor: pointer;
}

/* Locked Titles: match Shell and Background hover behavior */
.title-option-card.locked-cosmetic:hover {
  background: #8167d0;
  border-color: transparent;
  outline: none;
}

/* Locked Title previews should not remain highlighted */
.title-option-card.locked-cosmetic.selected {
  background: #303044;
  border-color: transparent;
  outline: none;
}

/* Reveal locked title artwork on hover */
.title-option-card.locked-cosmetic:hover .title-option-preview {
  filter: brightness(1);
}
