:root {
  --bg-top: #fff7ed;
  --bg-bottom: #fffdf8;
  --card-bg: rgba(255, 255, 255, 0.88);
  --card-border: rgba(255, 255, 255, 0.7);
  --text-main: #1f2937;
  --text-soft: #6b7280;
  --primary: #f97316;
  --primary-deep: #ea580c;
  --accent: #fb923c;
  --danger: #ef4444;
  --danger-deep: #dc2626;
  --shadow: 0 20px 45px rgba(249, 115, 22, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(251, 146, 60, 0.28), transparent 34%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button,
input {
  font: inherit;
}

.page {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 22px;
}

.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(251, 146, 60, 0.25), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 7vw, 56px);
  line-height: 1.05;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 16px;
}

.decision-panel {
  margin-top: 24px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 237, 213, 0.95), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(251, 146, 60, 0.2);
}

.result-label {
  color: var(--text-soft);
  font-size: 14px;
}

.result-text {
  margin-top: 10px;
  font-size: clamp(28px, 8vw, 46px);
  font-weight: 800;
  color: var(--primary-deep);
  line-height: 1.15;
  word-break: break-word;
}

.result-hint {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 14px;
}

.decision-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head {
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 22px;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.section-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.menu-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.add-form {
  display: flex;
  gap: 10px;
}

.add-form input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.add-form input:focus {
  border-color: rgba(249, 115, 22, 0.55);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
  transform: translateY(-1px);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  font-weight: 700;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 12px 24px rgba(249, 115, 22, 0.24);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.button-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger-deep);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-soft);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.food-list,
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.food-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.food-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 237, 213, 0.9);
}

.food-item.is-excluded {
  background: rgba(241, 245, 249, 0.92);
  border-color: rgba(203, 213, 225, 0.9);
}

.food-name {
  font-weight: 600;
  word-break: break-word;
}

.food-name.is-excluded {
  color: var(--text-soft);
  text-decoration: line-through;
}

.food-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.toggle-button {
  flex-shrink: 0;
  border: 0;
  background: rgba(249, 115, 22, 0.12);
  color: var(--primary-deep);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.toggle-button.is-excluded {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.delete-button {
  flex-shrink: 0;
  border: 0;
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger-deep);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
}

.history-item:last-child {
  border-bottom: 0;
}

.history-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  border-radius: 50%;
  background: rgba(249, 115, 22, 0.14);
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 700;
}

.history-food {
  display: flex;
  align-items: center;
  min-width: 0;
  font-weight: 600;
}

.history-time {
  color: var(--text-soft);
  font-size: 13px;
  flex-shrink: 0;
  margin-left: 12px;
}

.empty-text,
.form-message {
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.result-animate {
  animation: resultPulse 0.42s ease;
}

@keyframes resultPulse {
  0% {
    transform: scale(0.96);
    opacity: 0.45;
    filter: brightness(1.08);
  }

  60% {
    transform: scale(1.03);
    opacity: 1;
    filter: brightness(1.02);
  }

  100% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
}

.form-message.success {
  color: #15803d;
}

.form-message.error {
  color: var(--danger-deep);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .page {
    padding: 16px 14px 28px;
  }

  .card {
    padding: 18px;
    border-radius: 22px;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }

  .decision-actions,
  .add-form,
  .section-head-row {
    flex-direction: column;
  }

  .button,
  .delete-button {
    width: 100%;
  }

  .food-actions {
    width: 100%;
    flex-direction: column;
  }

  .toggle-button {
    width: 100%;
  }

  .food-list {
    grid-template-columns: 1fr;
  }

  .history-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .history-time {
    margin-left: 38px;
  }
}
