:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --card: #f7f7f5;
  --accent: #ff5a36;
  --accent-fg: #ffffff;
  --accent-text: #c53a16; /* 밝은 배경 위 주황 글자 (대비 4.5 이상) */
  color-scheme: light;
  --bubble-me: #1a1a1a;
  --bubble-me-fg: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111;
    --fg: #f2f2f2;
    --muted: #9a9a9a;
    --line: #2b2b2b;
    --card: #1c1c1c;
    --bubble-me: #f2f2f2;
    --bubble-me-fg: #111111;
    --accent-text: #ff7a5c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111111;
  --fg: #f2f2f2;
  --muted: #9a9a9a;
  --line: #2b2b2b;
  --card: #1c1c1c;
  --bubble-me: #f2f2f2;
  --bubble-me-fg: #111111;
  --accent-text: #ff7a5c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* 첫 화면: 검색창이 가운데 */
.brand { text-align: center; margin-top: 30vh; transition: margin .25s ease; }
.brand h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; margin: 0; }
.brand .dot { color: var(--accent-text); }
.brand .mark { margin: 0 0 6px; font-size: 14px; font-weight: 800; letter-spacing: 0.5px; color: var(--accent-text); }
main.talking .brand .mark { display: none; }

/* 배너의 바뀌는 단어: 점심 → 저녁 → 야식 → 간식 */
.brand h1 { line-height: 1.25; }
.rot { display: inline-block; height: 1.25em; line-height: 1.25; overflow: hidden; vertical-align: top; }
.rot > span {
  display: inline-block; color: var(--accent-text);
  transition: transform .35s ease, opacity .35s ease;
}
.rot > span.out { transform: translateY(-100%); opacity: 0; }
.rot > span.pre { transform: translateY(100%); opacity: 0; transition: none; }
@media (prefers-reduced-motion: reduce) { .rot > span { transition: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tagline { color: var(--muted); margin: 8px 0 24px; font-size: 15px; }

/* 대화가 시작되면 검색창이 아래로 */
main.talking .brand { margin-top: 12px; }
main.talking .brand h1 { font-size: 18px; }
main.talking .tagline { display: none; }
main.talking .chat { flex: 1; padding-bottom: 24px; }
main.talking .msg, main.talking .pick { scroll-margin-bottom: calc(250px + env(safe-area-inset-bottom)); }
main.talking .dock { position: sticky; bottom: 0; background: var(--bg); padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); }

.ask {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
  background: var(--bg);
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.ask input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent; color: var(--fg);
  font-size: 16px; /* iOS 확대 방지 */
  padding: 10px 0;
}
.ask button {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; cursor: pointer; flex: none;
}

.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px;
  scrollbar-width: none;
}
.chip-rows { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 999px; padding: 9px 14px; font-size: 14px; cursor: pointer;
}
.chip:active { transform: scale(.97); }

/* 이동 방법: 검색창 위 아이콘 (걸어서 / 차로) */
.mode { display: flex; gap: 4px; padding: 3px; margin: 0 0 8px 8px; background: var(--card); border-radius: 12px; align-self: flex-start; width: max-content; }
.mode button {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: transparent; color: var(--muted); border-radius: 9px;
  min-height: 36px; padding: 6px 12px; font-size: 14px; cursor: pointer;
}
.mode button small { font-weight: 600; font-size: 12px; }
.mode button[aria-checked="true"] { background: var(--bg); color: var(--accent-text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.locbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 14px; padding: 12px 12px 12px 16px; margin: 0 0 16px;
}
.locbar[hidden] { display: none; }
.locbar p { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 1.45; word-break: keep-all; }
.locbar button {
  flex: none; border: 0; border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 700;
  background: var(--accent); color: var(--accent-fg); cursor: pointer;
}
.locbar button:disabled { opacity: .6; }
main.talking .locbar { margin-top: 8px; }
.notice { color: var(--muted); font-size: 12px; text-align: center; margin: 8px 0 0; }

.chat { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; font-size: 15px; }
.msg.me { align-self: flex-end; background: var(--bubble-me); color: var(--bubble-me-fg); border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--card); border-bottom-left-radius: 6px; }
.msg.typing { color: var(--muted); }

.pick {
  align-self: stretch; background: var(--card); border-radius: 18px; padding: 16px;
}
.pick .food { font-size: 13px; color: var(--accent-text); font-weight: 700; margin: 0 0 4px; }
.pick h2 { font-size: 20px; margin: 0 0 6px; letter-spacing: -0.3px; }
.pick .meta { color: var(--muted); font-size: 14px; margin: 0 0 2px; }
.pick .meta a { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }
.pick .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.pick .actions a, .pick .actions button {
  display: block; text-align: center; text-decoration: none;
  border-radius: 12px; padding: 12px 8px; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
}
.pick .actions .primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pick .actions .wide { grid-column: 1 / -1; }
.pick .actions button:disabled { color: var(--muted); cursor: default; }

/* 같은 종류 더보기 목록 */
.more { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--line); }
.more li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.more-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.more-name { color: var(--fg); font-weight: 700; font-size: 15px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-meta { color: var(--muted); font-size: 13px; }
.more-go {
  flex: none; text-decoration: none; font-size: 13px; font-weight: 600; color: var(--accent-text);
  border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px;
}
.demo-tag { display: inline-block; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }

/* 하단 링크 */
.foot { display: flex; justify-content: center; gap: 14px; padding: 12px 0 4px; font-size: 12px; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
main.talking .foot { display: none; }

/* 소개·개인정보처리방침 같은 글 페이지 */
main.doc { padding-block: 32px 48px; line-height: 1.7; font-size: 15px; }
main.doc h1 { font-size: 26px; margin: 8px 0 12px; letter-spacing: -0.3px; text-wrap: balance; }
main.doc h2 { font-size: 17px; margin: 28px 0 6px; }
main.doc p, main.doc li { max-width: 65ch; }
main.doc a { color: var(--accent-text); }
main.doc .mark { margin: 0; font-weight: 800; }
main.doc .mark a { text-decoration: none; }
main.doc .doc-back { margin-top: 36px; }
