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

:root {
  color-scheme: light;
  --bg: #fbf9f5;
  --surface: #ffffff;
  --surface-soft: #f5f3ef;
  --surface-muted: #efeeea;
  --text: #1b1c1a;
  --text-muted: #434841;
  --line: #e3e2de;
  --line-strong: #c3c8be;
  --primary: #4e644b;
  --primary-soft: #d0eac9;
  --primary-soft-strong: #b4cdae;
  --secondary-soft: #e5e2db;
  --tertiary-soft: #ffd9e3;
  --shadow: 0 4px 15px rgba(78, 100, 75, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

body.is-busy {
  overflow: hidden;
}

body.is-share-view .hero-copy .eyebrow,
body.is-share-view .control-band,
body.is-share-view .chat-shell,
body.is-share-view .replace-dish-btn,
body.is-share-view #sharePlanBtn,
body.is-share-view #regenerateBtn {
  display: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.page {
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 14px 16px 40px;
}

.hero-band {
  display: grid;
  gap: 16px;
}

.hero-copy {
  position: relative;
  overflow: hidden;
  padding: 23px 36px 22px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.34), transparent 28%),
    linear-gradient(145deg, #d6ddd3 0%, #cbd3cb 36%, #b7c3b8 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(14px);
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -24px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  filter: blur(6px);
}

.hero-copy > * {
  position: relative;
  z-index: 1;
}

.hero-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(78, 100, 75, 0.88);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.22);
}

.eyebrow,
.card-label {
  display: block;
  margin-bottom: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.hero-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: var(--primary);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  color: #ffffff;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: auto;
  text-wrap: balance;
}

.hero-text {
  margin-top: 14px;
  max-width: 24ch;
  color: rgba(255, 255, 255, 0.94);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 500;
}

.voice-dock {
  display: grid;
  gap: 12px;
}

.primary-voice-btn {
  min-height: 64px;
  padding: 18px 24px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(78, 100, 75, 0.18);
}

.mini-actions,
.result-actions,
.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-btn,
.icon-text-btn,
.speak-day-btn,
.preset-btn,
.replace-dish-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--secondary-soft);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
}

.voice-action-btn,
.share-action-btn,
.replace-dish-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ui-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: currentColor;
  flex: 0 0 16px;
}

.preset-btn.is-active {
  background: var(--primary-soft);
  border-color: var(--primary-soft-strong);
  color: #374c34;
}

.control-band {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.setting-card,
.chat-shell,
.result-shell,
.day-card,
.dish-card,
.bubble-body {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.setting-card {
  padding: 16px;
  border-radius: 20px;
}

.voice-setting-row {
  display: grid;
  gap: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.card-hint,
.status-text,
.dish-ingredients,
.dish-steps,
.bubble-role,
.bubble-text {
  color: var(--text-muted);
}

.card-hint,
.status-text,
.dish-ingredients {
  font-size: 14px;
  line-height: 1.55;
}

.chat-shell,
.result-shell {
  margin-top: 24px;
  padding: 16px;
  border-radius: 22px;
}

.chat-shell {
  background: linear-gradient(180deg, #f4fbf1 0%, #ffffff 100%);
}

.chat-head,
.result-head,
.day-head,
.dish-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.chat-timeline {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.chat-bubble {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: flex-start;
}

.chat-bubble[data-role="user"] .bubble-avatar {
  background: var(--secondary-soft);
}

.chat-bubble[data-role="assistant"] .bubble-avatar {
  background: var(--primary-soft);
}

.bubble-avatar {
  width: 36px;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.bubble-body {
  padding: 12px 14px;
  border-radius: 18px;
}

.bubble-role {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
}

.bubble-text {
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-line;
}

.result-head h2 {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.week-grid {
  display: grid;
  gap: 28px;
  margin-top: 22px;
}

.day-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.day-head {
  align-items: center;
}

.day-head::before {
  content: "";
  width: 6px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(78, 100, 75, 0.08);
}

.day-head > div {
  flex: 1;
}

.day-label {
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.speak-day-btn {
  background: transparent;
  border-color: var(--line);
}

.dish-list {
  display: grid;
  gap: 12px;
}

.dish-card {
  border-radius: 20px;
  overflow: hidden;
}

.dish-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.dish-topline {
  align-items: center;
}

.dish-kind,
.dish-benefit {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.dish-kind {
  background: var(--tertiary-soft);
  color: #5f3d48;
}

.dish-benefit {
  background: var(--primary-soft);
  color: #374c34;
}

.dish-name {
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
}

.dish-ingredients {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.dish-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  font-size: 14px;
  line-height: 1.6;
}

.dish-actions {
  display: flex;
  justify-content: flex-end;
}

.replace-dish-btn {
  min-height: 38px;
  background: transparent;
  border-color: var(--line);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(251, 249, 245, 0.82);
  backdrop-filter: blur(4px);
  z-index: 1000;
}

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

.loading-card {
  min-width: 220px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  justify-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 3px solid #e5e2db;
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

.loading-text {
  color: var(--text-muted);
  line-height: 1.5;
}

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

@media (min-width: 900px) {
  .page {
    width: min(100%, 980px);
    padding-top: 20px;
  }

  .hero-band {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: stretch;
  }

  .control-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 20px;
  }
}
