:root {
  --bg: #f0f4f8;
  --text: #111;
  --button-bg: #000;
  --button-text: #fff;
  --button-hover-bg: #222;
  --tooltip: #333;
  --tooltip-text: #fff;
  --toggle-bg: #000;
  --toggle-text: #fff;
}
[data-theme="dark"] {
  --bg: #111827;
  --text: #f9fafb;
  --button-bg: #fff;
  --button-text: #000;
  --button-hover-bg: #ddd;
  --tooltip: #e5e7eb;
  --tooltip-text: #111;
  --toggle-bg: #fff;
  --toggle-text: #000;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 20px;
  font-family: Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}
.container {
  max-width: 700px;
  width: 100%;
}
h2 {
  text-align: center;
  margin-top: 30px;
  margin-bottom: 10px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 12px;
  justify-items: center;
}
.hangul-button {
  position: relative;
  padding: 14px;
  font-size: 1.5rem;
  border: none;
  border-radius: 8px;
  background-color: var(--button-bg);
  color: var(--button-text);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  user-select: none;
}
.hangul-button:hover {
  background-color: var(--button-hover-bg);
  animation: bounce 0.4s ease;
}
.hangul-button .tooltip {
  visibility: hidden;
  background-color: var(--tooltip);
  color: var(--tooltip-text);
  text-align: center;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.2s;
  z-index: 1;
}
.hangul-button:hover .tooltip {
  visibility: visible;
  opacity: 1;
}
/* Bounce animation keyframes */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}
/* Bounce animation class for mobile tap */
.hangul-button.bounce {
  animation: bounce 0.4s ease;
}
.theme-toggle {
  margin-top: 20px;
  padding: 8px 16px;
  font-size: 1rem;
  border: 2px solid var(--toggle-text);
  border-radius: 6px;
  background-color: var(--toggle-bg);
  color: var(--toggle-text);
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
  user-select: none;
}
@media (max-width: 480px) {
  .hangul-button {
    font-size: 1.2rem;
    padding: 12px;
  }
}
footer {
  margin-top: 40px;
  text-align: center;
  color: var(--text);
  font-size: 0.9rem;
}
