body {
  font-family: 'Nanum Gothic', sans-serif;
  margin: 0;
  padding: 0;
  #background: url('https://www.transparenttextures.com/patterns/cream-dust.png'), linear-gradient(to bottom, #fefbf3, #fbd9d5);
  background-size: 300px 300px; /* Adjust size of the pattern */
  background-color: #ccddff;
  background-blend-mode: overlay; /* Combine the gradient and texture */
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

header {
  background-color: #ccddff;
  color: #5a4d41;
  padding: 0;
  text-align: center;
  font-size: 1.5em;
}

nav {
  display: flex;
  justify-content: center;
  gap: 5px;
  #background-color: #fbd9d5;
  background-color: #d5d9fb;
  padding: 0em;
}

h1 {
  font-family: 'Nanum Myeongjo', serif; /* A Korean-style serif font */
  font-size: 2.5em;
  text-align: center;
  #color: #5a4d41; /* Traditional Korean muted brown */
  color: #0a0d41; 
  background: linear-gradient(to right, #ccddff, #d5d9fb, #f3fbfe); /* Pastel gradient */
  padding: 0px 0px;
  border: 1px solid #d5d9fb;
  border-radius: 15px;
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.1); /* Subtle shadow */
  text-shadow: 2px 2px 5px rgba(255, 223, 204, 0.5); /* Glow effect */
  margin-top: 0px;
  margin-bottom: 0px;
  letter-spacing: 2px; /* Adds spacing for a clean look */
}

h1::before {
  content: "✿ "; /* Decorative Hangul-inspired symbol */
  font-size: 0.8em;
  color: #ff9a9e;
}

h1::after {
  content: " ✿";
  font-size: 0.8em;
  color: #ff9a9e;
}


.card {
  width: 375px; /* 2.5 inches converted to pixels */
  height: 525px; /* 3.5 inches converted to pixels */
  border: 1px solid #fbd9d5;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin: 20px auto;
  #color: #5a4d41;
  color: #0a0d41; 
  text-align: center;
  border-radius: 10px;
  background-color: #fefbf3;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}

/* Text for the Korean card */
.korean-word {
  font-size: 2.5em;
  font-weight: bold;
}

.example-sentence {
  font-size: 1.4em;
  font-style: italic;
  font-weight: bold;
  color: #0a162d;
  margin-top: 10px;
}

/* Text for the Translation card */
.translation-word {
  font-size: 2em;
  font-weight: bold;
  text-transform: uppercase;
  margin: 10px 0;
}

.card-container {
  perspective: 1000px;
  margin: 0px auto;
  width: 375px; /* 2.5 inches */
  height: 525px; /* 3.5 inches */
}


/* Flip effect when card is flipped */
.card.flipped {
  transform: rotateY(180deg);
}

/* Default Styles for Desktop */
#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}

#get-card-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
  gap: 10px; /* Spacing between buttons */
  margin: 20px auto;
}


.spectacular-button {
  background: linear-gradient(45deg, #9e9aff, #c4d0fa);
  border: none;
  /* lekerekites */
  border-radius: 15px;
  padding: 10px 20px;
  color: white;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 0px;
  transition: transform 0.2s, box-shadow 0.2s;

  outline: none; /* Remove focus outline */
  box-shadow: none; /* Remove any potential box-shadow */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
  user-select: none; /* Prevent text selection */
  appearance: none; /* Normalize appearance across browsers */
}

.spectacular-button:hover {
  transform: scale(1.1);
  box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
}

.spectacular-button:active {
  transform: scale(1.05);
  box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
}

.spectacular-button:focus {
  outline: none; /* Remove focus outline when the button is clicked */
  box-shadow: none; /* Prevent focus box-shadow */
}

.card-container {
  perspective: 1000px;
  width: 375px;
  height: 525px;
  margin: 0px;
}

.card {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.3s;
  position: relative;
  margin-top: 10px;
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background-size: cover;
  background-position: center;
  border-radius: 10px;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
}

.card-front {
  background-color: #fefbf3;
}

.card-back {
  background-color: #d4d9f9;
  transform: rotateY(180deg);
}
/* Spacing and Text Styling */
.korean-word, .translation-word {
  font-size: 2em;
  font-weight: bold;
  margin-bottom: 25px;
  text-align: center;
}

.example-sentence {
  font-size: 1.4em;
  font-style: italic;
  font-weight: bold;
  color: #1a263d;
  margin-top: 10px;
  text-align: center;
  margin-top: 5px;
}

/* Mobile Layout */
@media (max-width: 600px) {
  #game-container {
    margin-top: 10px;
  }

  .spectacular-button {
    font-size: 1em;
    padding: 10px 20px;
    margin-bottom: 0px;
  }

  .card-container {
    width: 260px;
    height: 364px;
  }

  .korean-word, .translation-word {
    font-size: 1.5em;
    margin-bottom: 8px;
  }

  .example-sentence {
    font-size: 1em;
    margin-top: 4px;
  }
  #category-controls {
    display: hidden;
    flex-wrap: wrap; /* Allow buttons to wrap to the next line */
    justify-content: center; /* Center-align buttons */
    gap: 0px; /* Spacing between buttons */
    max-width: 90%; /* Limit the width of the category container */
    margin: 30px auto; /* Center the container horizontally */
  }
}
/* Common styling for word type backgrounds */
.word-type {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1; /* Ensure it's behind the text */
  border-radius: 10px;
  opacity: 0.2; /* Translucent effect */
}

/* Specific colors for each word type */
/* Commented out on 2025-11-29
.word-type-verb {
  background-color: blue;
}

.word-type-noun {
  background-color: red;
}

.word-type-adjective {
  background-color: yellow;
}

.word-type-adverb {
  background-color: green;
}

.word-type-preposition {
  background-color: pink;
}
*/
#category-controls {
  display: hidden;
  flex-wrap: wrap; /* Allow buttons to wrap to the next line */
  justify-content: center; /* Center-align buttons */
  gap: 10px; /* Spacing between buttons */
  max-width: 330px; /* Limit the width of the category container */
  margin: 30px auto; /* Center the container horizontally */
}

.category-button {
  background: #d5d9fb;
  border: 1px solid #a3a8e5;
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 0.9rem;
  font-weight: bold;
  color: #5a4d41;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  flex: 1 0 auto; /* Allow buttons to shrink and grow as needed */
  max-width: 150px; /* Limit individual button width */
  text-align: center; /* Center-align text within buttons */
  outline: none; /* Remove focus outline */
  box-shadow: none; /* Remove any potential box-shadow */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
  user-select: none; /* Prevent text selection */
  appearance: none; /* Normalize appearance across browsers */
}

.category-button:focus,
.toggle-button:focus {
  outline: none; /* Remove focus outline when the button is clicked */
  box-shadow: none; /* Prevent focus box-shadow */
}
.category-button.selected,
.toggle-button.selected {
  background: #9e9aff;
  color: white;
  font-weight: bold;
}

.toggle-button {
  flex: 1 0 auto; /* Allow buttons to shrink and grow as needed */
  max-width: 150px; /* Limit individual button width */
  text-align: center; /* Center-align text within buttons */
  outline: none; /* Remove focus outline */
  box-shadow: none; /* Remove any potential box-shadow */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
  user-select: none; /* Prevent text selection */
  appearance: none; /* Normalize appearance across browsers */
  background: linear-gradient(45deg, #9e9aff, #c4d0fa);
  border: 1px solid #a3a8e5;
  border-radius: 20px;
  padding: 10px 15px;
  font-size: 0.9rem;
  font-weight: bold;
  color: white;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  margin: 0px auto;
  display: block;
}

.toggle-button:hover {
  background: #9e9aff;
  transform: scale(1.1);
}

.category-button:hover,
.toggle-button:hover {
  transform: scale(1.1);
}

.category-inverse-button {
  background: #57e1d3;
  border: 1px solid #33cac0;
  border-radius: 20px;
  padding: 10px 15px;
  font-size: 0.9rem;
  color: #37474f;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  margin-top: 15px;
}

.category-inverse-button:hover {
  background: #33cac0;
  transform: scale(1.1);
}

#tool-buttons-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
  gap: 8px; /* Spacing between buttons */
}

/* Footer styling */
#footer {
  background: linear-gradient(to top, #d5d9fb, #ccddff); /* Same gradient as body */
  text-align: center; /* Center-align content */
  padding: 20px; /* Add some padding */
  border-top: 2px solid #d5d9fb; /* Add a subtle border to separate footer */
  font-family: 'Nanum Gothic', sans-serif; /* Match the page font */
}

#footer img {
  margin: 0 auto; /* Center the image */
  display: block; /* Treat the image as a block-level element */
  max-width: 100%; /* Ensure responsiveness */
  height: auto;
}

/* Hide the category controls by default */
.hidden {
  display: none; !important;
}

.flex {
  display: flex;
}

#speakButton {
  background: #e5f7d6;
}

#speakButton:hover {
  background: #c9ebb3;
  transform: scale(1.1);
}

.card-overlay {
  position: absolute;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  color: #333;
  z-index: 2;
}

.top-left {
  top: 10px;
  left: 10px;
}

.top-right {
  top: 10px;
  right: 10px;
}

#searchBox {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #ccc;
  font-size: 1rem;
  margin-left: 10px;
}

.search-results {
  position: relative;
  left: 0;
  z-index: 10;
  list-style: none;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  width: 200px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  padding: 0;
}

.search-results li {
  padding: 6px 10px;
  cursor: pointer;
}

.search-results li:hover {
  background: #f0f0f0;
}

.tool-button {
  background: #e0d3ff;
  border: 1px solid #baa6e4;
  border-radius: 50%;
  padding: 12px;
  font-size: 1.2rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.tool-button:hover {
  transform: scale(1.1);
}

/* Help box styling */
#helpBox {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #c0a2ff;
  border-radius: 12px;
  padding: 20px 30px;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 999;
  font-family: sans-serif;
  color: #333;
}

#helpBox.hidden {
  display: none;
}

#helpBox h3 {
  margin-top: 0;
  text-align: center;
  color: #333;
}

#helpBox ul {
  padding-left: 20px;
  font-size: 0.95em;
  color: #444;
}

#search-container {
  display: block;
  display: contents;
  align-items: center;
}

#tool-buttons-container {
  display: flex;
  flex-direction: row;
  align-items: center;           /* vertical alignment of children (✔️) */
  justify-content: center;       /* ✅ horizontally center the button group */
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px auto;             /* optional for vertical spacing and centering in block layout */
}
