:root {
  color-scheme: light;
  --ink: #242424;
  --muted: #686868;
  --line: #dedbd3;
  --paper: #fffaf0;
  --surface: #ffffff;
  --tomato: #d84a3a;
  --tomato-dark: #aa2e22;
  --leaf: #2f8f62;
  --leaf-dark: #176341;
  --teal: #167c80;
  --plum: #7d4a73;
  --gold: #c88719;
  --shadow: 0 20px 50px rgba(48, 42, 35, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(216, 74, 58, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(47, 143, 98, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.tabs,
.hero-tool,
.section-heading,
.action-row,
.swipe-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 14px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--tomato-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.2;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 6px;
  padding: 8px;
  margin: 0 -4px 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 240, 0.92);
  backdrop-filter: blur(14px);
}

.tab,
.ghost-button,
.primary-button,
.secondary-button,
.wide-button,
.dislike-button,
.like-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  letter-spacing: 0;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
}

.tab {
  flex: 1 0 auto;
  min-width: 76px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
}

.tab.is-active {
  color: #ffffff;
  background: var(--ink);
}

.ghost-button {
  padding: 10px 14px;
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.64);
}

.ghost-button.small {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
}

.primary-button,
.wide-button {
  color: #ffffff;
  background: var(--tomato);
  box-shadow: 0 10px 24px rgba(216, 74, 58, 0.22);
}

.secondary-button {
  color: var(--ink);
  border-color: var(--line);
  background: #ffffff;
}

.dislike-button,
.like-button {
  flex: 1;
  padding: 12px 18px;
}

.dislike-button {
  color: var(--tomato-dark);
  border-color: rgba(216, 74, 58, 0.25);
  background: #fff1ee;
}

.like-button {
  color: var(--leaf-dark);
  border-color: rgba(47, 143, 98, 0.25);
  background: #effaf3;
}

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

button:active {
  transform: translateY(1px);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.hero-tool {
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.hero-copy {
  min-width: 0;
}

.supporting {
  margin: 8px 0 0;
  color: var(--muted);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
  width: min(100%, 360px);
}

.stat-strip div {
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
}

.stat-strip strong,
.stat-strip span {
  display: block;
}

.stat-strip strong {
  font-size: 20px;
  line-height: 1.15;
}

.stat-strip span {
  color: var(--muted);
  font-size: 12px;
}

.dish-feature,
.swipe-card,
.persona-result,
.feedback-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dish-feature {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(0, 1.15fr);
  min-height: 360px;
  overflow: hidden;
}

.dish-visual {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  background: var(--visual-bg, #f7d6c8);
}

.dish-visual svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.dish-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 28px;
}

.dish-name {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.14;
}

.dish-desc {
  margin-bottom: 18px;
  color: var(--muted);
}

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

.tag {
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid rgba(36, 36, 36, 0.08);
  border-radius: 999px;
  color: var(--ink);
  background: #f6f3ec;
  font-size: 12px;
  font-weight: 800;
}

.action-row {
  gap: 10px;
  margin-top: 14px;
}

.action-row button,
.wide-button {
  flex: 1;
  padding: 12px 16px;
}

.wide-button {
  width: 100%;
  margin-top: 10px;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.compact-heading {
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.compact-heading p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.section-heading p:last-child {
  max-width: 220px;
  margin-bottom: 0;
  color: var(--muted);
  text-align: right;
}

.progress-track {
  height: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e0d4;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--leaf);
  transition: width 0.2s ease;
}

.swipe-stage {
  display: grid;
  min-height: 430px;
  place-items: center;
}

.swipe-card {
  width: min(100%, 420px);
  min-height: 430px;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}

.swipe-card.is-left {
  transform: translateX(-80px) rotate(-7deg);
  opacity: 0;
}

.swipe-card.is-right {
  transform: translateX(80px) rotate(7deg);
  opacity: 0;
}

.swipe-card .dish-visual {
  min-height: 240px;
}

.swipe-card .dish-info {
  padding: 22px;
}

.swipe-actions {
  gap: 12px;
  margin-top: 12px;
}

.persona-result {
  padding: 24px;
}

.persona-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--plum);
  font-weight: 900;
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.persona-grid div,
.favorite-item,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.persona-grid div {
  padding: 12px;
}

.persona-grid strong,
.persona-grid span {
  display: block;
}

.persona-grid span {
  color: var(--muted);
  font-size: 12px;
}

.poster-tools {
  margin-top: 16px;
}

#posterCanvas {
  width: min(100%, 360px);
  height: auto;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.favorite-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.favorite-item {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  min-height: 112px;
  padding: 10px;
}

.favorite-item .mini-visual {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--visual-bg, #f7d6c8);
}

.favorite-item .mini-visual svg {
  width: 100%;
  height: 100%;
}

.favorite-item h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.favorite-item p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.favorite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.favorite-item button {
  min-height: 34px;
  flex: 1 0 82px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

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

.feedback-panel {
  margin-top: 22px;
  padding: 20px;
}

.feedback-panel form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.feedback-panel label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.feedback-panel select,
.feedback-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
}

.feedback-panel select {
  min-height: 44px;
  padding: 0 12px;
}

.feedback-panel textarea {
  resize: vertical;
  padding: 12px;
}

.fine-print {
  margin: 18px 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.privacy-panel {
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.privacy-panel summary {
  min-height: 44px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.privacy-panel div {
  padding: 0 14px 14px;
}

.privacy-panel p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .hero-tool,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .topbar-actions .ghost-button {
    flex: 1;
  }

  .section-heading p:last-child {
    max-width: none;
    text-align: left;
  }

  .stat-strip {
    width: 100%;
  }

  .dish-feature {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .dish-feature .dish-visual {
    min-height: 250px;
  }

  .dish-info {
    padding: 22px;
  }

  .dish-name {
    font-size: 26px;
  }

  .action-row {
    flex-direction: column;
  }

  .action-row button {
    width: 100%;
  }

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

  .swipe-stage {
    min-height: 410px;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 25px;
  }

  h2 {
    font-size: 21px;
  }

  .tabs {
    margin-bottom: 14px;
  }

  .tab {
    min-width: 68px;
    padding-inline: 10px;
  }

  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-strip div {
    min-height: 62px;
    padding: 8px;
  }

  .stat-strip div:last-child {
    grid-column: 1 / -1;
  }

  .stat-strip strong {
    overflow-wrap: anywhere;
  }
}
