:root {
  --bg: #090a09;
  --cream: #f3f0e9;
  --text: #ffffff;
  --text-dark: #111111;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #DB6329;
  --cta: #AF4F21;
  --cta-text: #ffffff;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
}

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

html {
  scroll-behavior: auto;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

@media (prefers-reduced-motion) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

h1, h2, h3, h4 {
  font-family: Georgia, serif;
  font-weight: normal;
}

h1 {
  font-size: 2.5rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.5rem;
  line-height: 1.3;
}

p {
  margin-bottom: 1em;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  color: inherit;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 12px 16px;
  transition: background 0.2s, border-color 0.2s;
  min-height: 44px;
  min-width: 44px;
}

button:hover {
  background: var(--glass);
}

button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.primary-button {
  background: var(--cta);
  border-color: var(--cta);
  color: var(--cta-text);
}

.primary-button:hover {
  background: color-mix(in srgb, var(--cta), black 20%);
}

.secondary-button {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.action-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.taste-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.taste-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  position: relative;
}

.taste-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 50%;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-weight: bold;
}

.match-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

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

.saved-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.plan-summary {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.rating-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text);
  margin-top: 8px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.hint {
  font-size: 0.875rem;
  color: var(--text);
  margin-top: 4px;
}

.section-heading {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.food-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.food-image {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
}

.tag {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 8px;
  font-size: 0.875rem;
  margin: 4px;
  display: inline-block;
}

#main-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg);
}

.back-link {
  color: var(--text);
  font-size: 1rem;
}

#main {
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.disclosure {
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 24px;
}

.guide {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.guide-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.guide-steps button {
  flex: 1;
  min-width: 120px;
  padding: 8px 12px;
  font-size: 0.875rem;
}

#guide-status {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text);
}

.palette-container {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

#palette-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

#palette-picker button {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
}

#palette-picker button.selected {
  border-color: var(--accent);
}

#reset-palette {
  width: 100%;
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.phone-container {
  display: flex;
  justify-content: center;
}

.phone {
  width: 380px;
  height: 760px;
  background: #000;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  border: 8px solid #333;
}

.phone-header {
  background: #000;
  color: var(--text);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
}

.status-bar {
  font-size: 0.875rem;
  color: var(--text);
}

.dynamic-island {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 8px;
  font-size: 0.875rem;
}

#phone-content {
  height: calc(100% - 120px);
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
}

.phone-screen {
  display: none;
}

.phone-screen.active {
  display: block;
}

.phone-screen img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#phone-nav {
  display: flex;
  background: var(--glass);
  border-top: 1px solid var(--border);
  padding: 8px 0;
}

#phone-nav button {
  flex: 1;
  padding: 8px;
  font-size: 0.875rem;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 0;
}

#phone-nav button.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 100;
}

.dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: min(340px, calc(100vw - 32px));
  z-index: 101;
  display: none;
}

.dialog.show {
  display: block;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

#announcement {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  z-index: 100;
  display: none;
}

.embedded {
  display: none;
}

.embedded #main-header {
  display: none;
}

.embedded #main {
  padding: 0;
  grid-template-columns: 1fr;
}

.embedded .guide {
  display: none;
}

.embedded .palette-container {
  display: none;
}

.embedded .phone-container {
  padding: 24px;
}

@media (min-width: 768px) {
  #main {
    grid-template-columns: 280px 1fr;
    gap: 48px;
  }

  .embedded #main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  body {
    padding: 12px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .guide-steps {
    grid-template-columns: 1fr 1fr;
  }

  .phone {
    width: 100%;
    max-width: 380px;
    height: auto;
    aspect-ratio: 380 / 760;
  }

  .embedded .phone {
    max-width: 100%;
  }
}

@media (max-width: 1100px) {
  .embedded #main {
    padding: 12px;
  }
}

/* Integrate the semantic guide, native dialog, and self-contained phone. */
body { padding: 0; }
#standalone-header { max-width: 900px; margin: auto; padding: 24px 24px 8px; }
#standalone-header h1 { margin: 14px 0 8px; font-style: italic; }
#main, .embedded #main { display: block; max-width: 900px; margin: auto; padding: 20px 24px; }
.disclosure { max-width: 740px; margin: 0 auto 24px; color: #c7c6bf; line-height: 1.5; }
.demo-layout { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 380px); gap: 48px; justify-content: center; align-items: start; }
.demo-guide { min-width: 0; }
.guide, .palette-container { background: none; border: 0; padding: 0; border-radius: 0; }
.guide h2 { font-family: inherit; font-weight: 600; margin-bottom: 12px; }
.guide p, .hint { color: #bdbfb8; }
.guide-steps { display: grid; grid-template-columns: 1fr; }
.guide-steps button { text-align: left; min-width: 0; }
.guide-steps button[aria-current="step"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
#guide-status { min-height: 44px; color: #bdbfb8; }
.palette-container { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.palette-container h3 { font-family: inherit; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
#palette-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#palette-picker button { aspect-ratio: auto; min-width: 0; padding: 9px 8px; font-size: 14px; border: 1px solid #444; }
#palette-picker button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
#reset-demo { width: 100%; margin-top: 12px; color: #ddd; font-size: 14px; }
.phone-container, .embedded .phone-container { padding: 0; min-width: 0; }
.phone { display: flex; flex-direction: column; width: 380px; max-width: 100%; height: 760px; border: 6px solid #333531; border-radius: 44px; background: #11130f; box-shadow: 0 22px 65px #0006; }
.phone-header { display: block; padding: 8px 18px 12px; flex-shrink: 0; background: radial-gradient(ellipse at top right, color-mix(in srgb, var(--accent) 25%, #11130f), #11130f); }
.status-bar { display: flex; justify-content: space-between; font-size: 14px; height: 34px; padding: 2px 6px 0; }
.dynamic-island { position: absolute; left: 50%; top: 9px; width: 92px; height: 24px; transform: translateX(-50%); background: #000; border: 0; padding: 0; border-radius: 20px; }
#phone-title { font-family: inherit; font-size: 28px; font-weight: 650; color: var(--accent); letter-spacing: -.04em; }
#phone-title:focus { outline: none; }
#phone-content { flex: 1; min-height: 0; height: auto; padding: 14px 14px 20px; background: #11130f; font-size: 14px; overscroll-behavior: contain; }
#phone-content h3, #phone-content .section-heading { font-family: inherit; font-size: 21px; font-weight: 600; line-height: 1.25; letter-spacing: -.025em; }
#phone-content p { color: #c1c4ba; }
#phone-content button { padding: 10px 12px; font-size: 14px; }
#phone-nav { flex-shrink: 0; margin: 0 7px 10px; padding: 3px; border: 1px solid #ffffff25; border-radius: 30px; background: linear-gradient(#ffffff16, #ffffff08); backdrop-filter: blur(22px); box-shadow: inset 0 1px 0 #ffffff12; }
#phone-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 7px 2px; min-width: 44px; font-size: 14px; line-height: 1; border-radius: 24px; }
#phone-nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; }
#phone-nav button.active, #phone-nav button[aria-current="page"] { color: var(--accent); background: #ffffff12; border: 0; box-shadow: inset 0 -2px 0 var(--accent); }
.food-card { background: #ffffff05; border-radius: 20px; }
.food-card > :not(img) { margin-left: 14px; margin-right: 14px; }
.food-card > h3 { margin-top: 12px; }
.food-card > :last-child { margin-bottom: 14px; }
.food-image { height: 200px; }
#phone-content .food-image { width: 100%; height: 200px; object-fit: cover; }
.food-copy { padding-top: 12px; padding-bottom: 4px; }
.food-copy h3 { margin-bottom: 6px; }
.stat-row { gap: 12px; align-items: center; }
.stat-row span:last-child { text-align: right; }
.taste-value { text-align: right; font-variant-numeric: tabular-nums; }
.rating-labels { gap: 20px; justify-content: space-between; }
.rating-labels span:last-child { text-align: right; }
.action-row { flex-wrap: wrap; justify-content: flex-start; }
.action-row button { flex: 1; }
.taste-row { display: grid; grid-template-columns: 80px 1fr 40px; gap: 10px; margin: 16px 0; }
.taste-track { height: 7px; border-radius: 6px; overflow: hidden; }
.saved-row { flex-wrap: wrap; }
.saved-row img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; }
.match-card .avatar { width: 56px; height: 56px; font-size: 18px; margin-bottom: 12px; color: var(--accent); }
dialog#overlay { color: #f3f0e9; background: #1b1d19; border: 1px solid #ffffff30; border-radius: 24px; padding: 24px; width: min(360px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; margin: auto; }
dialog::backdrop { background: #000b; backdrop-filter: blur(5px); }
dialog h2 { font-family: inherit; font-weight: 600; font-size: 23px; margin-bottom: 12px; }
dialog label { display: block; margin: 14px 0 8px; }
dialog input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--accent); }
dialog select { width: 100%; padding: 11px; border-radius: 10px; border: 1px solid #666; background: #292c26; color: white; }
dialog output { display: block; font-size: 18px; color: var(--accent); margin: 12px 0; }
dialog .dialog-actions { flex-wrap: wrap; }
dialog .dialog-actions button { flex: 1; padding: 10px; font-size: 14px; }
footer { max-width: 900px; margin: auto; padding: 8px 24px 24px; color: #aaa; font-size: 14px; text-align: center; }
footer p { margin-bottom: 6px; }
.visually-hidden, #announcement { display: block; position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.embedded { display: block; min-height: 0; }
.embedded #standalone-header { display: none; }
.embedded .guide, .embedded .palette-container { display: block; }
:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (max-width: 700px) {
  #standalone-header { padding: 20px 16px 0; }
  #main, .embedded #main { padding: 16px 12px; }
  .demo-layout { grid-template-columns: minmax(0, 380px); gap: 24px; }
  .guide h2 { font-size: 21px; margin-bottom: 6px; }
  .guide p { font-size: 14px; margin-bottom: 8px; }
  .guide-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .guide-steps button { font-size: 14px; padding: 9px 8px; }
  #guide-status { min-height: 0; margin-top: 8px; }
  .palette-container { margin-top: 12px; padding-top: 12px; }
  #palette-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
  .palette-container .hint { display: none; }
  #reset-demo { margin-top: 0; }
  .phone { width: 100%; height: 720px; aspect-ratio: auto; border-width: 5px; border-radius: 34px; }
  #phone-content { padding-left: 11px; padding-right: 11px; }
  #phone-nav { margin-left: 3px; margin-right: 3px; }
  #phone-nav button { font-size: 14px; padding-left: 0; padding-right: 0; }
  .food-image { height: 185px; }
  #phone-content .food-image { height: 185px; }
  .disclosure { margin-bottom: 16px; }
}
