@import url('https://fonts.googleapis.com/css2?family=Lora:ital@0;1&display=swap');

* {
  box-sizing: border-box;
}

@keyframes blink {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }

  100% {
    opacity: 1;
  }
}

.blink {
  animation: blink 2s ease-in-out 100ms infinite forwards;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: none;
}

/* Visually hidden utility class for screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

body {
  font-family: Lora, Futura, sans-serif;
  margin-left: 0;
  margin-right: 0;
  background-color: hsl(0deg 0% 12.15%);
  color: hsl(0, 0%, 80%);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

hr {
  width: 55vw;
  margin: 8vh auto 0 auto;
  border-color: hsl(0deg 10.39% 36.15%);
}

a {
  color: hsl(259, 100%, 64%);
  transition: color 300ms linear;
}

a:visited {
  color: hsl(259, 50%, 64%);
}

a:hover {
  color: hsl(30, 100%, 61%);
}

h1,
h2,
h3 {
  font-family: Lora, Futura, serif;
  color: white;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

header,
main {
  width: 1180px;
  max-width: 100%;
  margin: 0rem auto;
}

main .instruct {
  padding: 0.1rem;
  background: #33333333;
  border-radius: 10px;
  display: block;
  font-style: italic;
  border: 1px solid #444;
}

main h3 {
  text-align: center;
}

a {
  text-decoration: none;
  font-weight: bold;
}

ul {
  list-style: none;
  display: table;
  width: 100%;
  padding: 0;
}

li {
  width: 19%;
  float: left;
  line-height: 1.5;
  margin: 5px 0.5%;
}

.loader {
  width: 48px;
  height: 48px;
  border: 5px solid #FFF;
  border-bottom-color: transparent;
  border-radius: 50%;
  display: block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes rotation {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

#board {
  width: 100%;
  height: auto;
  min-height: 420px;
  border-radius: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-gap: 1rem;
  padding: 1rem 0.2rem;
  position: relative;
  /* border: 1px solid hsl(0deg 10.39% 36.15%); */
}

#board span {
  display: flex;
  transform-style: preserve-3d;
  transform: rotateY(90deg);
  transition: transform 0.3s ease-in-out;
  will-change: transform;
  padding: 6px;
  flex-direction: column;
  justify-content: center;
}

#board span p {
  margin: 5px auto;
  text-align: center;
}

.reversed-badge {
  font-size: 0.6em;
  font-weight: 700;
  color: #e03;
  letter-spacing: 0.5px;
  margin-left: 4px;
  vertical-align: super;
  font-style: normal;
}

#board span.active {
  will-change: transform;
  transform: rotateY(0deg);
  transition: transform 0.5s cubic-bezier(0.18, 1.13, 0.9, 1.15);
}

#board span.flipped {
  will-change: transform;
  transform: rotateX(-180deg);
  transition: transform 0.5s cubic-bezier(0, 1.16, 1, 0.99);
}

#board span img {
  max-height: 400px;
  display: block;
  margin: 10px auto;
}

#controls {
  left: 0;
  bottom: 0;
  margin: 0;
}

button {
  font-family: inherit;
  padding: 1em 2em;
  background: transparent;
  border-radius: 0.8rem;
  border: 1px solid #454545;
  color: whitesmoke;
  margin: 0 10px;
  width: calc(94%);
  cursor: pointer;
  transition: all 0.3s ease-in-out;
}

button:hover {
  background: #8a2be23d;
  /* color: #111; */
  transition: all 0.15s ease-in-out;
}

button:focus-visible {
  outline: 2px solid #8a2be2;
  outline-offset: 2px;
}

#prompt {
  text-decoration: line-through;
}

.github-link {
  position: fixed;
  right: 0;
  top: 0;
}

.features {
  display: flex;
  margin: 20px;
  padding: 10px;
  gap: 15px;
}

.feature {
  padding: 10px;
  background: #222;
}

.feature p {
  padding-left: 3%;
}

.feature h4 {
  white-space: nowrap;
}

.hero {
  margin-bottom: 1rem;
}

#hero-title {
  text-align: center;
  font-size: 1.5rem;
}

.hero-description {
  padding: 15px 30px;
  line-height: 1.4em;
}

.logo-outer {
  width: 300px;
  display: block;
  margin: 0 auto;
}



footer {
  width: 100%;
  padding: 20px;
  margin: 2rem auto;
  font-size: 13px;
  display: inline-block;
}

footer p {
  text-align: right;
  margin: 5px auto;
}

/* Buy Me a Coffee */
.bmc-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 20px;
}

.bmc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFDD00;
  color: #1a1a1a !important;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 11px;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 3px 12px rgba(255, 221, 0, 0.25);
  letter-spacing: 0.2px;
}

.bmc-btn:visited {
  color: #1a1a1a !important;
}

.bmc-btn:hover {
  background: #FFE833;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 221, 0, 0.4);
  color: #1a1a1a !important;
}

.bmc-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 221, 0, 0.25);
}


@media screen and (max-width: 800px) {
  body {
    padding-bottom: 80px;
  }

  main h3 {
    font-size: 1rem;
  }

  main .instruct {
    margin: 0 10px;
  }

  .hero-description {
    padding: 15px;
  }

  #controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #311e58;
    padding: 8px 5px;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  }

  #controls li {
    width: 32%;
    margin: 2px 0.5%;
  }

  #board {
    height: auto;
    grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
    margin-bottom: 20px;
  }

  #board span {
    display: block;
    width: 100%;
  }

  .features {
    flex-direction: column;
    margin: 0;
  }

  button {
    font-size: 11px;
    white-space: nowrap;
    padding: 0.8em 0.5em;
    margin: 0;
    width: 100%;
  }

  .footer-menu {
    float: right;
  }
}

/*
 Library Page Styles */
.library-header {
  text-align: center;
  padding: 2rem 1rem;
}

.library-header h1 {
  font-size: 2.5rem;
  margin: 0;
}

.filter-section {
  padding: 1rem;
  text-align: center;
  position: sticky;
  top: 0;
  background: hsl(0deg 0% 12.15%);
  z-index: 100;
  border-bottom: 1px solid #444;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.filter-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 auto;
  max-width: 800px;
}

.filter-btn {
  padding: 0.5rem 1.5rem;
  background: transparent;
  border: 1px solid #454545;
  color: whitesmoke;
  cursor: pointer;
  border-radius: 5px;
  font-family: inherit;
  font-style: italic;
  transition: all 0.3s ease-in-out;
  margin: 0;
  width: auto;
}

.filter-btn:hover {
  background: #8a2be23d;
  border-color: #8a2be2;
}

.filter-btn.active {
  background: #8a2be23d;
  border-color: #8a2be2;
}

.filter-btn:focus-visible {
  outline: 2px solid #8a2be2;
  outline-offset: 2px;
}

.library-content {
  padding: 2rem 1rem;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 2rem;
  max-width: 1800px;
  margin: 0 auto;
}

.library-card {
  background: #222;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 1.5rem;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.library-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(138, 43, 226, 0.3);
}

.library-card img {
  max-width: 200px;
  height: auto;
  display: block;
  margin: 0 auto 1rem;
  border-radius: 5px;
}

.library-card h3 {
  text-align: center;
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
  color: white;
}

.card-meanings {
  margin: 1rem 0;
}

.meaning-upright,
.meaning-reversed {
  margin-bottom: 1rem;
}

.meaning-upright h4 {
  color: #4CAF50;
  margin: 0.5rem 0;
  font-size: 1rem;
}

.meaning-reversed h4 {
  color: #FF9800;
  margin: 0.5rem 0;
  font-size: 1rem;
}

.meaning-upright p,
.meaning-reversed p {
  margin: 0.5rem 0;
  line-height: 1.6;
  font-size: 0.9rem;
}

.card-description {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #444;
}

.card-description h4 {
  color: #9370DB;
  margin: 0.5rem 0;
  font-size: 1rem;
}

.card-description p {
  margin: 0.5rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #ccc;
}

.read-more-btn {
  background: transparent;
  border: none;
  color: #8a2be2;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.25rem 0;
  margin-top: 0.5rem;
  text-decoration: underline;
  font-style: normal;
  width: auto;
  transition: color 0.2s ease-in-out;
}

.read-more-btn:hover {
  color: #FF9800;
  background: transparent;
}

.read-more-btn:focus-visible {
  outline: 2px solid #8a2be2;
  outline-offset: 2px;
  border-radius: 2px;
}

.error,
.no-results {
  text-align: center;
  padding: 2rem;
  color: #FF9800;
  font-size: 1.2rem;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1rem;
}

.main-nav a {
  font-size: 1.1rem;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: background 0.3s ease-in-out;
}

.main-nav a:hover {
  background: #8a2be23d;
}

.ad-container {
  max-width: 960px;
  margin: 40px auto 20px;
  padding: 20px;
  text-align: center;
  background: #1a1a1a;
  border-radius: 8px;
  border: 1px solid #333;
}

.ad-container::before {
  content: 'Advertisement';
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}


@media screen and (max-width: 800px) {
  .library-header h1 {
    font-size: 1.8rem;
  }

  .library-grid {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 1.5rem;
  }

  .library-card {
    padding: 1rem;
  }

  .library-card img {
    max-width: 150px;
  }

  .filter-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }

  .filter-btn {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  .main-nav {
    flex-direction: row;
    gap: 0.5rem;
  }

  .filter-section {
    position: relative;
  }
}

/* Feedback Widget Styles */
.feedback-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  transform: scale(0.6);
  height: 100px;
  border-radius: 100%;
  background: linear-gradient(135deg, #57317b, #9370DB);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(138, 43, 226, 0.4);
  transition: all 0.3s ease;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(138, 43, 226, 0.6);
}

.feedback-fab:active {
  transform: scale(0.95);
}

.feedback-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.feedback-modal.active {
  display: flex;
}

.feedback-modal-content {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #333;
}

.feedback-header h3 {
  margin: 0;
  color: white;
  font-size: 1.5rem;
}

.feedback-close {
  background: none;
  border: none;
  color: #999;
  font-size: 32px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  line-height: 1;
}

.feedback-close:hover {
  color: white;
}

#feedback-form {
  padding: 24px;
}

.feedback-field {
  margin-bottom: 20px;
}

.feedback-field label {
  display: block;
  margin-bottom: 8px;
  color: #ccc;
  font-weight: 500;
}

.feedback-field select,
.feedback-field input,
.feedback-field textarea {
  width: 100%;
  padding: 12px;
  background: #222;
  border: 1px solid #444;
  border-radius: 6px;
  color: white;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
}

.feedback-field select:focus,
.feedback-field input:focus,
.feedback-field textarea:focus {
  outline: none;
  border-color: #8a2be2;
}

.feedback-field textarea {
  resize: vertical;
  min-height: 100px;
}

.feedback-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.feedback-cancel,
.feedback-submit {
  padding: 10px 24px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-weight: 500;
}

.feedback-cancel {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
}

.feedback-cancel:hover {
  background: #333;
  border-color: #666;
}

.feedback-submit {
  background: linear-gradient(135deg, #8a2be2, #9370DB);
  color: white;
}

.feedback-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #9370DB, #8a2be2);
  box-shadow: 0 2px 8px rgba(138, 43, 226, 0.4);
}

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

.feedback-success {
  padding: 40px 24px;
  text-align: center;
}

.success-icon {
  width: 60px;
  height: 60px;
  background: #4CAF50;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
  color: white;
  animation: successPop 0.5s ease-out;
}

@keyframes successPop {
  0% {
    transform: scale(0);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

.feedback-success h4 {
  margin: 0 0 10px 0;
  color: white;
  font-size: 1.3rem;
}

.feedback-success p {
  margin: 0;
  color: #ccc;
}

@media screen and (max-width: 800px) {
  .feedback-fab {
    bottom: 80px;
    right: 20px;
    width: 56px;
    transform: scale(0.8);
    height: 56px;
    font-size: 24px;
  }

  .feedback-modal-content {
    width: 95%;
    margin: 10px;
  }

  .feedback-header {
    padding: 16px 20px;
  }

  #feedback-form {
    padding: 20px;
  }
}

/* Share and History Styles */
.share-button {
  width: 44px;
  height: 44px;
  padding: 0;
  font-style: normal;
  margin: 8px;
  background: #8a2be28f;
  border: none;
  color: white;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.share-button:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(138, 43, 226, 0.5);
}

.share-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.history-item {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  transition: border-color 0.2s ease;
}

.history-item:hover {
  border-color: #8a2be2;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-info strong {
  color: #8a2be2;
  font-size: 0.95rem;
}

.history-info span {
  color: #999;
  font-size: 0.8rem;
}

.history-share-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  font-style: normal;
  color: white;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-share-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(138, 43, 226, 0.4);
}

.history-share-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.history-cards {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 4px;
  background: #1f1f1f;
  border-radius: 4px;
}

.history-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 50px;
  flex-shrink: 0;
}

.history-card img {
  width: 50px;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.history-card.reversed img {
  transform: rotate(180deg);
}


.scroll-to-top {
  display: block;
  width: 300px;
  right: 0px;
  position: fixed;
  font-size: 14px;
  padding: 15px;
  bottom: 0;
  border-radius: 0;
  background: #1f1f1f;
}

@media screen and (max-width: 800px) {
  .scroll-to-top {
    width: 100%;
  }

  .share-button-corner {
    width: 40px;
    height: 40px;
    font-size: 18px;
    top: 8px;
    right: 8px;
  }
}

/* Share Button Styles */
.share-button-corner {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: linear-gradient(135deg, #57317b, #9370DB);
  border: none;
  color: white;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.share-button-corner:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(138, 43, 226, 0.5);
}

.share-button-corner:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Library Filter Toggle */
.filter-toggle {
  background: #2a2a2a;
  border: 1px solid #444;
  color: whitesmoke;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-toggle:hover {
  background: #333;
  border-color: #8a2be2;
}

.filter-toggle:focus-visible {
  outline: 2px solid #8a2be2;
  outline-offset: 2px;
}

.filter-arrow {
  font-size: 14px;
  transition: transform 0.3s ease;
  color: #8a2be2;
  font-weight: bold;
}

.filter-toggle span:not(.filter-arrow) {
  font-weight: 500;
}

/* Cookie Consent Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  border-top: 2px solid #8a2be2;
  padding: 20px;
  z-index: 9999;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.cookie-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.cookie-content p {
  margin: 0;
  color: #ccc;
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
  min-width: 250px;
}

.cookie-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.cookie-link {
  color: #8a2be2;
  text-decoration: underline;
  font-size: 14px;
  transition: color 0.2s;
}

.cookie-link:hover {
  color: #9370DB;
}

.cookie-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.cookie-accept {
  background: linear-gradient(135deg, #8a2be2, #9370DB);
  color: white;
}

.cookie-accept:hover {
  background: linear-gradient(135deg, #9370DB, #8a2be2);
  box-shadow: 0 2px 8px rgba(138, 43, 226, 0.4);
  transform: translateY(-1px);
}

.cookie-decline {
  background: transparent;
  color: #999;
  border: 1px solid #444;
}

.cookie-decline:hover {
  background: #333;
  border-color: #666;
  color: #ccc;
}

@media screen and (max-width: 800px) {
  .cookie-banner {
    padding: 15px;
  }

  .cookie-content {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .cookie-content p {
    font-size: 13px;
    text-align: center;
  }

  .cookie-actions {
    justify-content: center;
    width: 100%;
  }

  .cookie-btn {
    flex: 1;
    min-width: 100px;
  }
}

/* ============================================================
   Affiliate Product Card — footer placement
   ============================================================ */
.affiliate-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, #1e1228 0%, #2a1a40 100%);
  border: 1px solid #4a2a7a;
  border-radius: 14px;
  padding: 18px 22px;
  max-width: 600px;
  margin: 0 auto 24px;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.affiliate-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(138, 43, 226, 0.12), transparent 70%);
  pointer-events: none;
}

.affiliate-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(138, 43, 226, 0.35);
  border-color: #8a2be2;
}

.affiliate-card:visited {
  color: inherit;
}

/* Image wrapper: cream bg so mix-blend-mode:multiply kills the white */
.affiliate-card__img-wrap {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  background: #f5f0e8;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.affiliate-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
  border-radius: 10px;
}

.affiliate-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.affiliate-card__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #8a6faa;
  margin: 0 0 4px;
  font-style: normal;
}

.affiliate-card__title {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.3;
  font-family: Lora, serif;
}

.affiliate-card__desc {
  color: #aaa;
  font-size: 0.8rem;
  margin: 0 0 12px;
  line-height: 1.4;
}

.affiliate-card__cta {
  display: inline-flex;
  align-items: center;
  align-self: end;
  width: 222px;
  gap: 6px;
  background: linear-gradient(135deg, #8a2be2, #9370DB);
  color: #fff !important;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  transition: opacity 0.2s ease;
}

@media screen and (max-width: 600px) {
  .affiliate-card__cta {
    width: 100%;
    justify-content: center;
  }

  .affiliate-card__title {
    text-align: center;
  }
}

.affiliate-card:hover .affiliate-card__cta {
  opacity: 0.88;
}

.affiliate-card__arrow {
  transition: transform 0.2s ease;
}

.affiliate-card:hover .affiliate-card__arrow {
  transform: translateX(3px);
}

.affiliate-card__disclaimer {
  display: block;
  text-align: center;
  font-size: 10px;
  color: #555;
  margin-top: 4px;
  font-style: italic;
}

/* ============================================================
   Post-draw nudge banner — shown after cards are revealed
   ============================================================ */
@keyframes nudgeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.deck-nudge {
  display: none;
  /* shown via JS after draw */
  align-items: center;
  gap: 14px;
  background: linear-gradient(90deg, #2a1a40 0%, #1e1228 100%);
  border: 1px solid #4a2a7a;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 16px 0 4px;
  cursor: pointer;
  text-decoration: none;
  animation: nudgeSlideUp 0.5s ease forwards;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.deck-nudge:hover {
  border-color: #8a2be2;
  box-shadow: 0 4px 20px rgba(138, 43, 226, 0.25);
}

.deck-nudge:visited {
  color: inherit;
}

.deck-nudge__img {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f0e8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-nudge__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
}

.deck-nudge__text {
  flex: 1;
  min-width: 0;
}

.deck-nudge__text p {
  margin: 0;
  color: #ccc;
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: left !important;
}

.deck-nudge__text strong {
  color: #fff;
}

.deck-nudge__btn {
  flex-shrink: 0;
  background: linear-gradient(135deg, #8a2be2, #9370DB);
  color: #fff !important;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 20px;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.deck-nudge:hover .deck-nudge__btn {
  opacity: 0.88;
}

.deck-nudge__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #555;
  font-size: 18px;
  cursor: pointer;
  padding: 0 0 0 6px;
  line-height: 1;
  width: auto;
  margin: 0;
  transition: color 0.2s;
}

.deck-nudge__close:hover {
  color: #999;
  background: none;
}

@media screen and (max-width: 600px) {
  .affiliate-card {
    flex-direction: column;
    text-align: center;
    padding: 16px;
  }

  .affiliate-card__label,
  .affiliate-card__desc {
    text-align: center;
  }

  .deck-nudge {
    flex-wrap: wrap;
    gap: 10px;
  }

  .deck-nudge__text p {
    font-size: 0.75rem;
  }
}

/* ============================================================
   Confirmation Popover
   ============================================================ */
.confirm-popover {
  position: absolute;
  z-index: 5000;
  background: linear-gradient(160deg, #1e1228 0%, #2a1a40 100%);
  border: 1px solid #4a2a7a;
  border-radius: 12px;
  padding: 14px 18px 12px;
  min-width: 150px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(138, 43, 226, 0.15);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.confirm-popover--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* small triangle pointing down */
.confirm-popover::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #4a2a7a;
}

.confirm-popover__msg {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: #ccc;
  text-align: center;
  font-style: italic;
}

.confirm-popover__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.confirm-popover__btn {
  padding: 6px 18px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  margin: 0;
  width: auto;
}

.confirm-popover__btn--yes {
  background: linear-gradient(135deg, #8a2be2, #9370db);
  color: #fff;
  border-color: transparent;
}

.confirm-popover__btn--yes:hover {
  background: linear-gradient(135deg, #9370db, #8a2be2);
  box-shadow: 0 2px 10px rgba(138, 43, 226, 0.45);
  transform: translateY(-1px);
}

.confirm-popover__btn--no {
  background: transparent;
  color: #888;
  border-color: #3a2a50;
}

.confirm-popover__btn--no:hover {
  background: #2a1a40;
  color: #bbb;
  border-color: #5a3a7a;
}

/* ============================================================
   Interstitial Ad Overlay
   ============================================================ */
@keyframes interstitialFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes interstitialSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.interstitial-ad {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 6, 20, 0.82);
  backdrop-filter: blur(6px);
  animation: interstitialFadeIn 0.35s ease forwards;
}

.interstitial-inner {
  background: linear-gradient(160deg, #1e1228 0%, #2a1a40 60%, #1a1030 100%);
  border: 1px solid #4a2a7a;
  border-radius: 18px;
  padding: 28px 24px 22px;
  width: min(380px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  box-shadow: 0 8px 48px rgba(138, 43, 226, 0.35), 0 2px 12px rgba(0, 0, 0, 0.6);
  animation: interstitialSlideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.interstitial-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #6a5080;
  font-style: italic;
  align-self: flex-start;
}

.interstitial-body {
  min-height: 250px;
  min-width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #130d1e;
  border-radius: 10px;
  border: 1px solid #2e1850;
  overflow: hidden;
}

.interstitial-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.interstitial-skip {
  padding: 10px 28px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid #4a2a7a;
  background: transparent;
  color: #888;
  width: auto;
}

.interstitial-skip:not(:disabled) {
  background: linear-gradient(135deg, #8a2be2, #9370DB);
  border-color: transparent;
  color: #fff;
  cursor: pointer;
}

.interstitial-skip:not(:disabled):hover {
  background: linear-gradient(135deg, #9370DB, #8a2be2);
  box-shadow: 0 4px 16px rgba(138, 43, 226, 0.45);
  transform: translateY(-1px);
}

.interstitial-skip:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.interstitial-sub {
  margin: 0;
  font-size: 11px;
  color: #5a4570;
  font-style: italic;
  text-align: center;
}

@media screen and (max-width: 420px) {
  .interstitial-inner {
    padding: 20px 14px 16px;
  }

  .interstitial-body {
    min-width: 260px;
    min-height: 210px;
  }
}