* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(135deg, #fff7d6, #f7d9ff, #dff3ff);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #242424;
}

.app-container {
  width: 100%;
  padding: 24px;
  position: relative;
  overflow: visible;
}

.card {
  max-width: 620px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 28px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
  position: relative;
  z-index: 2;
}

.axolotl-peek {
  --axolotl-hidden-y: 120px;
  --axolotl-visible-y: -225px;
  --axolotl-settle-y: -210px;
  --axolotl-duck-y: 70px;
  position: absolute;
  top: 24px;
  left: 50%;
  width: min(300px, 66vw);
  aspect-ratio: 520 / 420;
  /* background: url("assets/axolotl-peek-blue.svg") center / contain no-repeat; */
  background: url("assets/axolotl-peek-realistic-blue.png") center / contain no-repeat;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, var(--axolotl-hidden-y)) scale(0.92);
  transform-origin: center bottom;
  z-index: 1;
}

[data-theme="dark"] .axolotl-peek {
  /* background-image: url("assets/axolotl-peek-pink.svg"); */
  background-image: url("assets/axolotl-peek-realistic.png");
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  font-weight: 700;
  color: #7b4bb7;
  margin-bottom: 12px;
}

h1 {
  font-size: 2.4rem;
  margin: 0 0 24px;
  cursor: default;
  user-select: none;
}

.phrase {
  font-size: 1.45rem;
  line-height: 1.5;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 28px;
  white-space: pre-line;
}

button {
  border: none;
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: #7b4bb7;
  color: white;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(123, 75, 183, 0.28);
}

button:active {
  transform: translateY(0);
}

/* Dark mode toggle button - small button in top-left corner */
.dark-mode-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  background: transparent;
  color: #7b4bb7;
  border: none;
  font-size: 1.5rem;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark-mode-btn:hover {
  transform: scale(1.1);
  box-shadow: none;
}

.dark-mode-btn:active {
  transform: scale(1);
}

/* Dark theme colors and styles */
[data-theme="dark"] {
  --bg-gradient: linear-gradient(135deg, #1a1a1a, #2d1b3d, #1a2d3d);
  --card-bg: rgba(40, 40, 40, 0.95);
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --accent-primary: #b88edb;
  --accent-secondary: #f77a7a;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --modal-bg: #2a2a2a;
}

[data-theme="dark"] body {
  background: linear-gradient(135deg, #1a1a1a, #2d1b3d, #1a2d3d);
  color: #e0e0e0;
}

[data-theme="dark"] .card {
  background: rgba(40, 40, 40, 0.95);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .eyebrow {
  color: #b88edb;
}

[data-theme="dark"] h1 {
  color: #e0e0e0;
}

[data-theme="dark"] .phrase {
  color: #e0e0e0;
}

[data-theme="dark"] .category-control label {
  color: #b0b0b0;
}

[data-theme="dark"] .category-select {
  background: #404040;
  border-color: #b88edb;
  color: #e0e0e0;
}

[data-theme="dark"] .footer-note {
  color: #b0b0b0;
}

[data-theme="dark"] button {
  background: #b88edb;
  color: #1a1a1a;
}

[data-theme="dark"] button:hover {
  box-shadow: 0 10px 22px rgba(184, 142, 219, 0.4);
}

[data-theme="dark"] .dark-mode-btn {
  background: transparent;
  color: #b88edb;
}

[data-theme="dark"] .view-favorites-link {
  background: transparent;
  color: #b88edb;
}

[data-theme="dark"] .view-favorites-link:hover {
  color: #f77a7a;
}

[data-theme="dark"] .heart-btn {
  background: transparent;
  border-color: #b88edb;
  color: #b88edb;
}

[data-theme="dark"] .heart-btn:hover {
  color: #f77a7a;
  border-color: #f77a7a;
  box-shadow: 0 4px 12px rgba(247, 122, 122, 0.2);
}

[data-theme="dark"] .heart-btn.liked {
  background: #f77a7a;
  color: white;
  border-color: #f77a7a;
}

[data-theme="dark"] .copy-btn {
  background: transparent;
  border-color: #b88edb;
  color: #b88edb;
}

[data-theme="dark"] .copy-btn:hover:not(:disabled) {
  color: #f77a7a;
  border-color: #f77a7a;
  box-shadow: 0 4px 12px rgba(247, 122, 122, 0.2);
}

[data-theme="dark"] .copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-theme="dark"] .modal-content {
  background: #2a2a2a;
  color: #e0e0e0;
}

[data-theme="dark"] .modal-header {
  border-bottom-color: #404040;
}

[data-theme="dark"] .favorite-item {
  background: #404040;
  border-left-color: #b88edb;
  color: #e0e0e0;
}

[data-theme="dark"] .favorite-item-text {
  color: #e0e0e0;
}

[data-theme="dark"] .favorite-item-remove {
  color: #f77a7a;
  border-color: #f77a7a;
  background: transparent;
}

[data-theme="dark"] .favorite-item-remove:hover {
  background: #f77a7a;
  color: #1a1a1a;
}

[data-theme="dark"] .empty-message {
  color: #707070;
}

[data-theme="dark"] .close-btn {
  color: #e0e0e0;
}

[data-theme="dark"] .close-btn:hover {
  background: #404040;
}

/* View Favorites link - small, subtle button in top-right corner of card */
.view-favorites-link {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  color: #7b4bb7;
  border: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.view-favorites-link:hover {
  color: #e74c3c;
  transform: scale(1.05);
  box-shadow: none;
}

.category-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.category-control label {
  color: #6f6f6f;
  font-size: 0.9rem;
  font-weight: 700;
}

.category-select {
  appearance: auto;
  background: white;
  border: 1px solid #7b4bb7;
  border-radius: 999px;
  color: #242424;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 14px;
}

/* Small heart button - positioned above the main button */
.heart-btn {
  background: transparent;
  color: #7b4bb7;
  border: 1px solid #7b4bb7;
  font-size: 0.9rem;
  padding: 8px 16px;
  margin-bottom: 12px;
  border-radius: 999px;
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-block;
}

.heart-btn:hover {
  color: #e74c3c;
  border-color: #e74c3c;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.15);
}

/* Filled heart state when phrase is favorited */
.heart-btn.liked {
  background: #e74c3c;
  color: white;
  border-color: #e74c3c;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Copy button - positioned above the main button */
.copy-btn {
  background: transparent;
  color: #7b4bb7;
  border: 1px solid #7b4bb7;
  font-size: 0.9rem;
  padding: 8px 16px;
  margin-bottom: 12px;
  margin-left: 8px;
  border-radius: 999px;
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-block;
}

.copy-btn:hover:not(:disabled) {
  color: #b88edb;
  border-color: #b88edb;
  box-shadow: 0 4px 12px rgba(123, 75, 183, 0.15);
}

.copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal styling for viewing favorites */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.8rem;
}

.close-btn {
  background: transparent;
  color: #242424;
  font-size: 2rem;
  padding: 0;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #f0f0f0;
  box-shadow: none;
  transform: none;
}

.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.favorite-item {
  background: #f9f9f9;
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid #7b4bb7;
  font-size: 1rem;
  line-height: 1.5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.favorite-item-text {
  flex: 1;
  text-align: left;
}

.favorite-item-remove {
  background: transparent;
  color: #e74c3c;
  border: 1px solid #e74c3c;
  padding: 4px 8px;
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.favorite-item-remove:hover {
  background: #e74c3c;
  color: white;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.empty-message {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.empty-message p {
  margin: 0;
  font-size: 1rem;
}

.footer-note {
  margin-top: 24px;
  font-size: 0.9rem;
  color: #6f6f6f;
  cursor: default;
  user-select: none;
}

/* ===== Axolotl Title Easter Egg ===== */

.easter-egg-active .card {
  animation: luckyPulse 1.8s ease-in-out infinite;
}

.axolotl-peek.peek {
  animation: axolotlPeek 4.2s ease-in-out;
}

.easter-egg-active h1 {
  color: #0f8f78;
}

[data-theme="dark"] .easter-egg-active h1 {
  color: #7ff0d8;
}

@keyframes luckyPulse {
  0%,
  100% {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
  }

  50% {
    box-shadow: 0 22px 60px rgba(15, 143, 120, 0.28);
  }
}

@keyframes axolotlPeek {
  0% {
    opacity: 0;
    transform: translate(-50%, var(--axolotl-hidden-y)) scale(0.9);
  }

  18% {
    opacity: 1;
    transform: translate(-50%, var(--axolotl-visible-y)) scale(1);
  }

  30%,
  68% {
    opacity: 1;
    transform: translate(-50%, var(--axolotl-settle-y)) scale(1);
  }

  48% {
    opacity: 1;
    transform: translate(-50%, var(--axolotl-settle-y)) scale(1.03) rotate(-1deg);
  }

  82% {
    opacity: 1;
    transform: translate(-50%, var(--axolotl-duck-y)) scale(0.94);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, var(--axolotl-hidden-y)) scale(0.9);
  }
}

@media (max-width: 600px) {
  .card {
    padding: 28px;
  }

  h1 {
    font-size: 2rem;
  }

  .phrase {
    font-size: 1.2rem;
  }

  .axolotl-peek {
    --axolotl-hidden-y: 105px;
    --axolotl-visible-y: -185px;
    --axolotl-settle-y: -172px;
    --axolotl-duck-y: 60px;
    width: min(280px, 82vw);
  }
}
