:root {
  color-scheme: light;
  --bg: #fff8ef;
  --surface: #fffdf8;
  --surface-soft: #fff2e5;
  --ink: #241b16;
  --muted: #7b6f66;
  --line: #eadfce;
  --brand: #ec6b3a;
  --brand-dark: #b84426;
  --green: #2f7a62;
  --blue: #3f6f9f;
  --shadow: 0 14px 38px rgba(116, 70, 27, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fff1e2 0%, #fffaf4 42%, #f7fbf7 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 18px 86px;
  background: rgba(255, 253, 248, 0.78);
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

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

.home-hero {
  padding-top: 4px;
}

.topbar.compact {
  min-height: 54px;
}

.home-hero h1,
.topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}

.topbar.compact h1 {
  flex: 1;
  font-size: 22px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 270px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.icon-button,
.ghost-icon,
.text-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.icon-button,
.ghost-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 23px;
}

.ghost-icon {
  width: 38px;
  height: 38px;
}

.text-button {
  min-width: 50px;
  height: 34px;
  border-radius: 999px;
  color: var(--muted);
}

.intent-card {
  margin-top: 24px;
  border: 1px solid #f0ddc8;
  border-radius: 18px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.intent-card label {
  display: block;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.intent-card textarea {
  width: 100%;
  min-height: 104px;
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  background: #fff7ef;
  color: var(--ink);
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
  outline: none;
}

.intent-card textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(236, 107, 58, 0.24);
}

.quick-intents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-intents button,
.segmented button,
.chips button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0 12px;
}

.quick-intents button:hover,
.segmented button.selected,
.chips button.selected {
  border-color: var(--brand);
  background: #fff0e8;
  color: var(--brand-dark);
  font-weight: 800;
}

.location-strip {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  padding: 10px;
}

.location-strip div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.location-strip span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.location-strip input {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.location-strip button,
.primary-action,
.action-grid button,
.list-item button {
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.location-strip button {
  height: 36px;
}

.hint {
  margin: 9px 4px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.source-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 10px 4px 0;
  border-radius: 999px;
  background: #edf6f1;
  color: var(--green);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.preference-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  overflow: hidden;
}

.preference-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}

.preference-panel summary::-webkit-details-marker {
  display: none;
}

.preference-panel summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.control-group {
  padding: 0 14px 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0 10px;
}

.section-title h2 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.segmented,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.select-wrap select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.loading-panel {
  display: none;
  margin-top: 14px;
  border: 1px solid #f0ddc8;
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
}

.loading-panel.active {
  display: block;
}

.loading-copy {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.loading-copy strong {
  color: var(--brand-dark);
  font-size: 14px;
}

.loading-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: #f1e5d7;
}

.progress-bar {
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--green));
  transition: width 0.28s ease;
}

.primary-action {
  width: 100%;
  height: 56px;
  margin-top: 16px;
  font-size: 18px;
  box-shadow: 0 12px 24px rgba(236, 107, 58, 0.2);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
  box-shadow: none;
}

.restaurant-card,
.empty-state,
.list-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.restaurant-card {
  margin-top: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.restaurant-card .tagline {
  color: var(--green);
  font-weight: 800;
  font-size: 13px;
}

.restaurant-card h2 {
  margin: 8px 0 10px;
  font-size: 30px;
  line-height: 1.16;
}

.ai-review {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 12px;
  border-radius: 12px;
  background: #edf6f1;
  color: var(--green);
  padding: 10px;
}

.ai-review strong {
  font-size: 14px;
}

.ai-review span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.meta-item {
  min-height: 62px;
  border-radius: 12px;
  background: #fff7ef;
  padding: 10px;
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.meta-item strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.reason {
  margin: 14px 0 0;
  border-left: 4px solid var(--brand);
  padding-left: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.action-grid button {
  min-height: 46px;
}

#againButton {
  background: var(--blue);
}

#favoriteButton {
  background: var(--green);
}

#blacklistButton {
  background: #7b6f66;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list-item {
  padding: 14px;
}

.list-item h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.list-item p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.list-item button {
  min-height: 34px;
  padding: 0 12px;
}

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

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 430px);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.95);
  backdrop-filter: blur(12px);
}

.tabbar button {
  height: 62px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.tabbar button.active {
  color: var(--brand-dark);
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 82px;
  left: 20px;
  z-index: 5;
  max-width: 390px;
  margin: 0 auto;
  border-radius: 12px;
  background: rgba(36, 27, 22, 0.92);
  color: #fff;
  padding: 12px 14px;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 360px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .home-hero h1 {
    font-size: 30px;
  }

  .two-column,
  .action-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }
}
