*,
:root {
  --color-bg: #fdfaf8; /* soft neutral background */
  --color-primary: #138086; /* teal */
  --color-secondary: #534666; /* purple */
  --color-accent: #dc8665; /* coral */
  --color-accent-light: #cd7672; /* lighter coral for hover */
  --color-highlight: #eeb462; /* gold accent */
  --color-text: #2c2c2c; /* dark text */
  font-family: "Merienda", cursive;
}
html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;

  background-color: var(--color-bg);
  color: var(--color-text);
}
/* Used the the menu */
.hidden {
  display: none !important;
}
.site-container {
  width: 95%;
  margin: 0 auto;
  text-align: center;
}
button:hover {
  cursor: pointer;
}
#overlay {
  position: fixed; /* covers the whole screen */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  opacity: 0; /* start invisible */
  pointer-events: none; /* don't block clicks when hidden */
  transition: opacity 0.3s ease;
  z-index: 5;
}
#overlay.active {
  opacity: 1;
  pointer-events: auto; /* allow click-to-close */
}
#context-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  border: black 2px solid;
  background-color: var(--color-bg);
  padding: 10px;
  width: fit-content;
  max-width: 90vw; /* prevents it from overflowing the screen */
  min-width: max-content;
}
#context-menu button {
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 5px;
  padding: 0.2rem;
  margin: 2%;
  transition: transform 0.2s ease;
  font-size: calc(1rem + 0.5vw);
  width: 100%;
}
#context-menu button:hover {
  background: var(--color-accent-light);
  transform: scale(1.1);
}
#context-menu input {
  margin: 2%;
}
#topic-title {
  color: var(--color-primary);
  display: inline-block;
}
#topic-title:hover {
  color: var(--color-text);
  cursor: pointer;
}
#menu-controls {
  display: flex;
  justify-content: center;
  white-space: nowrap;
  padding: 10px;
}
#menu-controls button {
  font-size: 1rem;
}
#flashcard-container {
  position: relative;
  aspect-ratio: 3/2;
  width: min(90vw, 600px);
  margin: 0 auto;
  background: white;
  border: 3px solid var(--color-secondary);
  box-shadow: rgba(50, 50, 93, 0.25) 0px 10px 27px -5px,
    rgba(0, 0, 0, 0.3) 0px 8px 13px -8px;

  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;

  transition: transform 0.6s;
  transform-style: preserve-3d;
  perspective: 1000px;
}
#card-content {
  white-space: normal;
  word-wrap: break-word;
  overflow-y: auto;
  max-height: 80%;
  padding: 10px;
  box-sizing: border-box;
}
.idx-display {
  position: absolute;
  top: 5%;
  left: 5%;
  margin: 0;
  color: var(--color-highlight);
}
.idx-display:hover {
  color: var(--color-text);
  cursor: pointer;
}
.help-display {
  position: absolute;
  top: 5%;
  right: 5%;
  margin: 0;
  cursor: help;
}
.help-text {
  position: absolute;
  top: 50%;
  right: 120%;
  transform: translateY(-50%);
  margin-right: 8px;

  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 0.9rem;

  white-space: nowrap;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 9999;
  padding: 2px;
}

/* Hover behavior */
.help-display:hover .help-text {
  opacity: 1;
}

.flip-animation {
  animation: flip 0.6s ease-in-out;
}

@keyframes flip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

#controls-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

#display-controls,
#card-controls {
  display: flex;
  justify-content: center;
  gap: 2%;
  width: min(85vw, 450px);
  margin: 0 auto;
  margin-top: 10px;
}
#display-controls button,
#card-controls button {
  width: 30%;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 8px;
  box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px,
    rgba(60, 64, 67, 0.15) 0px 1px 3px 1px;
  padding: 0;
  margin: 0;
  transition: transform 0.2s ease;
  font-size: calc(1rem + 0.5vw);
}
#display-controls button:hover,
#card-controls button:hover {
  background: var(--color-accent-light);
  transform: scale(1.1);
}
