:root {
  --bg: #1a1a2e;
  --bg-2: #16213e;
  --card: #23253d;
  --text: #eae8ff;
  --text-dim: #9a97b5;
  --accent: #ff6b6b;
  --accent-2: #ffd93d;
  --radius: 18px;
}

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

html,
body {
  min-height: 100%;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 50% -10%, #2b2b4d 0%, var(--bg) 55%, var(--bg-2) 100%);
  color: var(--text);
  line-height: 1.6;
  padding: 24px 16px 48px;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-header {
  text-align: center;
  margin-bottom: 18px;
}

.title {
  font-size: 2.1rem;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 2px;
}

.meals {
  display: flex;
  gap: 10px;
  margin-bottom: 26px;
  background: var(--card);
  padding: 6px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.meal-tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.meal-tab:hover {
  color: var(--text);
}

.meal-tab.is-active {
  background: linear-gradient(135deg, var(--accent), #ff9a3c);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.4);
}

.wheel-wrap {
  position: relative;
  width: min(88vw, 420px);
  aspect-ratio: 1;
  margin-bottom: 22px;
}

#wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow:
    0 0 0 10px var(--card),
    0 18px 48px rgba(0, 0, 0, 0.55),
    inset 0 0 40px rgba(255, 255, 255, 0.06);
}

.pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 42px solid var(--accent-2);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
  user-select: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.wheel-center:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 0 0 4px rgba(255, 217, 61, 0.35);
}

.wheel-center:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.wheel-center-meal {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-2);
}

.wheel-center-hint {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.actions {
  display: flex;
  gap: 14px;
  margin-bottom: 26px;
}

.btn {
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  padding: 13px 30px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff9a3c);
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 107, 107, 0.45);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--accent), #ff9a3c);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 107, 107, 0.4);
}

.btn-ghost {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.result {
  width: 100%;
  margin-bottom: 26px;
}

.result.is-hidden {
  display: none;
}

.result-card {
  background: var(--card);
  border: 1px solid rgba(255, 217, 61, 0.35);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  box-shadow: 0 0 0 3px rgba(255, 217, 61, 0.08), 0 12px 32px rgba(0, 0, 0, 0.4);
  animation: pop-in 0.45s cubic-bezier(0.18, 1.4, 0.5, 1);
}

@keyframes pop-in {
  from {
    transform: translateY(14px) scale(0.94);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.result-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #1a1a2e;
  background: var(--accent-2);
  border-radius: 999px;
  padding: 3px 14px;
  margin-bottom: 10px;
}

.result-name {
  font-size: 1.6rem;
  margin-bottom: 2px;
}

.result-emoji {
  font-size: 2.4rem;
  margin-bottom: 14px;
}

.meal-list {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.list-title {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 12px;
  font-weight: 600;
}

.list-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border-radius: 999px;
  padding: 5px 8px 5px 14px;
  font-size: 0.9rem;
  color: var(--text);
}

.chip .remove {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.chip .remove:hover {
  background: var(--accent);
  color: #fff;
}

.app-footer {
  margin-top: 30px;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
}

.dialog {
  border: none;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  padding: 0;
  width: min(90vw, 360px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.dialog-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog-body h3 {
  font-size: 1.1rem;
}

.dialog-input {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: var(--bg-2);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
}

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

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(16px);
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(255, 217, 61, 0.4);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.9rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 480px) {
  .title {
    font-size: 1.7rem;
  }

  .meal-tab {
    padding: 8px 16px;
    font-size: 0.92rem;
  }

  .btn {
    padding: 12px 24px;
  }
}
