@import url("https://fonts.googleapis.com/css2?family=Nanum+Square+Round:wght@400;700&display=swap");

:root {
  --bg: #ffd400;
  --bg-end: #ffe77a;
  --card: #ffffff;
  --text: #1b1b1b;
  --muted: #4b4b4b;
  --stroke: #f0d46a;
  --shadow: 0 18px 30px rgba(0, 0, 0, 0.12);
  --accent: #1f1f1f;
  --lang-bg: #fff8cf;
  --lang-active-bg: #1b1b1b;
  --lang-active-text: #ffffff;
  --wave-bg: #ffffff;
  --wave-active-bg: #1b1b1b;
  --wave-active-text: #ffffff;
  --result-bg: #fff5b3;
  --result-border: #1b1b1b;
}

[data-theme="dark"] {
  --bg: #1a1a2e;
  --bg-end: #16213e;
  --card: #1f2a48;
  --text: #e0e0e0;
  --muted: #a0a0b0;
  --stroke: #2e3a5a;
  --shadow: 0 18px 30px rgba(0, 0, 0, 0.4);
  --accent: #e0e0e0;
  --lang-bg: #2e3a5a;
  --lang-active-bg: #ffd400;
  --lang-active-text: #1b1b1b;
  --wave-bg: #2e3a5a;
  --wave-active-bg: #ffd400;
  --wave-active-text: #1b1b1b;
  --result-bg: #2e3a5a;
  --result-border: #ffd400;
}

* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-end) 100%);
  color: var(--text);
  font-family: "Nanum Square Round", "Arial Rounded MT Bold", sans-serif;
  margin: 0;
  min-height: 100vh;
  padding: 40px 20px 64px;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

  .card {
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow);
  }

h1,
h2 {
  margin: 10px 0 12px;
}

h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

h2 {
  font-size: 1.3rem;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 1rem;
}

.subtitle,
.hint,
.tip,
.small,
#card-desc,
#extra {
  line-height: 1.55;
}

.lang-switch {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.lang-btn {
  border: 1px solid var(--stroke);
  background: var(--lang-bg);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.lang-btn.is-active {
  background: var(--lang-active-bg);
  color: var(--lang-active-text);
}

.lang-label {
  font-size: 0.9rem;
}

.section-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.wave-btn {
  border: 2px solid var(--accent);
  background: var(--wave-bg);
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.wave-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.wave-btn.is-active {
  background: var(--wave-active-bg);
  color: var(--wave-active-text);
}

.result-card {
  background: var(--result-bg);
  border-radius: 18px;
  padding: 16px 18px;
  border: 1px dashed var(--result-border);
}

.result-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.result-body {
  font-size: 1.1rem;
}

.tip {
  margin-top: 16px;
}

details summary {
  cursor: pointer;
  font-weight: 700;
}

details p {
  margin-top: 12px;
  color: var(--muted);
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  background: var(--card);
  border: 2px solid var(--stroke);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.3s, border-color 0.3s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

body,
.card,
.lang-btn,
.lang-btn.is-active,
.wave-btn,
.wave-btn.is-active,
.result-card,
.theme-toggle {
  transition: background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.ad-container {
  width: 100%;
  text-align: center;
  overflow: hidden;
}

@media (max-width: 640px) {
  body {
    padding: 28px 16px 52px;
  }

  .card {
    padding: 22px;
  }
}
