:root {
  --bg: #fdf6ec;
  --card: #ffffff;
  --text: #3b2f2a;
  --muted: #8a7d75;
  --accent: #ff6b3d;
  --accent-dark: #e65526;
  --shadow: 0 8px 24px rgba(93, 60, 30, 0.12);
  --radius: 14px;
}

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

[hidden] {
  display: none !important;
}

body {
  font-family: "Noto Sans TC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  text-align: center;
  padding: 28px 16px 0;
}

.site-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.site-subtitle {
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

.tabs {
  display: inline-flex;
  gap: 6px;
  background: #f3e6d8;
  padding: 6px;
  border-radius: 999px;
  margin: 18px auto 0;
}

.tab {
  border: none;
  background: transparent;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.25s, color 0.25s;
}

.tab.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.wheel-hint {
  text-align: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: 1.05rem;
}

.search-bar {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
}

.search-bar input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #ead9c6;
  border-radius: 999px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus {
  border-color: var(--accent);
}

.search-bar button {
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-bar button:hover {
  background: var(--accent-dark);
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 18px 0 24px;
}

.quick-tags-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.quick-tag {
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: transparent;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.quick-tag:hover {
  background: var(--accent);
  color: #fff;
}

.search-status {
  text-align: center;
  color: var(--muted);
  padding: 30px 0;
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  border: 4px solid #ead9c6;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--muted);
}

.empty-emoji {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 10px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.meal-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.meal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(93, 60, 30, 0.18);
}

.meal-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.meal-card-body {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.meal-card h3 {
  font-size: 1rem;
  line-height: 1.4;
  flex: 1;
}

.view-btn {
  border: none;
  background: #fff1e6;
  color: var(--accent-dark);
  font-weight: 700;
  padding: 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.view-btn:hover {
  background: var(--accent);
  color: #fff;
}

.skeleton-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.skeleton-thumb {
  width: 100%;
  aspect-ratio: 1;
}

.skeleton-line {
  height: 14px;
  margin: 14px;
  border-radius: 7px;
}

.skeleton-line:last-child {
  width: 60%;
}

.skeleton {
  background: linear-gradient(90deg, #eee7dd 25%, #f8f2e9 50%, #eee7dd 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 18, 8, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  background: var(--card);
  border-radius: 18px;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--accent);
  color: #fff;
}

.modal-banner {
  position: relative;
}

.modal-banner img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}

.modal-banner h2 {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 40px 60px 16px 20px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px 0;
}

.badge {
  background: #fff1e6;
  color: var(--accent-dark);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.modal-columns {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  padding: 18px 20px 26px;
}

.modal-col h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.ingredient-list {
  list-style: none;
}

.ingredient-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #ead9c6;
  font-size: 0.92rem;
}

.ingredient-amount {
  color: var(--muted);
  text-align: right;
}

.instructions {
  white-space: pre-line;
  line-height: 1.8;
  font-size: 0.95rem;
}

.youtube-btn {
  display: inline-block;
  margin-top: 16px;
  background: #ff0000;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 8px;
  transition: opacity 0.2s;
}

.youtube-btn:hover {
  opacity: 0.85;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 16px;
}

.site-footer a {
  color: var(--accent);
}

@media (max-width: 640px) {
  .modal-columns {
    grid-template-columns: 1fr;
  }
}
