* { box-sizing: border-box; margin: 0; padding: 0; }

:root, [data-theme="dark"] {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface2: #16213e;
  --color: #f0f0f0;
  --subtitle: #888;
  --card-bg: #1e1e30;
  --card-border: rgba(255,255,255,0.07);
  --card-hover-border: rgba(255,255,255,0.2);
  --result-bg: #1a1a2e;
  --result-border: rgba(255,255,255,0.08);
  --tag-bg: rgba(255,255,255,0.08);
  --tag-color: #bbb;
  --toggle-bg: rgba(255,255,255,0.1);
  --toggle-hover: rgba(255,255,255,0.18);
  --shadow: rgba(0,0,0,0.5);
}

[data-theme="light"] {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --surface2: #f0ede8;
  --color: #1a1a2e;
  --subtitle: #777;
  --card-bg: #ffffff;
  --card-border: rgba(0,0,0,0.08);
  --card-hover-border: rgba(0,0,0,0.2);
  --result-bg: #ffffff;
  --result-border: rgba(0,0,0,0.08);
  --tag-bg: rgba(0,0,0,0.06);
  --tag-color: #555;
  --toggle-bg: rgba(0,0,0,0.07);
  --toggle-hover: rgba(0,0,0,0.13);
  --shadow: rgba(0,0,0,0.12);
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--color);
  font-family: 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px 80px;
  transition: background 0.3s, color 0.3s;
}

/* ── 테마 토글 ── */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--toggle-bg);
  color: var(--color);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  backdrop-filter: blur(6px);
  z-index: 100;
}
.theme-toggle:hover {
  background: var(--toggle-hover);
  transform: scale(1.1);
}

/* ── 헤더 ── */
header {
  text-align: center;
  margin-bottom: 52px;
}
h1 {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}
.subtitle {
  font-size: 1rem;
  color: var(--subtitle);
}

/* ── 카테고리 카드 ── */
.categories {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 640px;
  margin-bottom: 40px;
}

.card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: 20px;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s, background 0.3s;
  user-select: none;
}

.card:hover {
  border-color: var(--card-hover-border);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px var(--shadow);
}

.card.active {
  border-color: transparent;
  transform: translateY(-4px);
  box-shadow: 0 12px 32px var(--shadow);
}

.card[data-category="korean"].active  { background: linear-gradient(145deg, #c0392b, #922b21); }
.card[data-category="western"].active { background: linear-gradient(145deg, #1a6b9e, #154360); }
.card[data-category="chinese"].active { background: linear-gradient(145deg, #b7950b, #7d6608); }
.card[data-category="japanese"].active{ background: linear-gradient(145deg, #884ea0, #6c3483); }

.card.active .card-icon,
.card.active .card-label { color: #fff; }

.card-icon {
  font-size: 2.4rem;
  line-height: 1;
}
.card-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color);
  transition: color 0.2s;
}

/* ── 결과 패널 ── */
.result {
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.result.open {
  max-height: 400px;
}

.result-inner {
  background: var(--result-bg);
  border: 1.5px solid var(--result-border);
  border-radius: 24px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  animation: popIn 0.35s ease;
  transition: background 0.3s;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.food-emoji {
  font-size: 4.5rem;
  line-height: 1;
  margin-bottom: 4px;
}

.food-name {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.food-desc {
  font-size: 1rem;
  color: var(--subtitle);
  line-height: 1.6;
  max-width: 400px;
}

.food-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.tag {
  background: var(--tag-bg);
  color: var(--tag-color);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.3s, color 0.3s;
}

/* ── 반응형 ── */
@media (max-width: 500px) {
  h1 { font-size: 2rem; }
  .categories { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 24px 12px; }
}
