:root {
  --menu-blue: #70acd8;
  --menu-blue-pale: #eaf6ff;
  --menu-cream-pale: #fff5ec;
  --menu-red: #e94545;
}

.menu-main,
.recognition-view {
  width: min(calc(100% - 48px), 1202px);
  margin: 0 auto;
}

.menu-choice-page { padding-top: 52px; }
.menu-choice-page > h1,
.upload-view > h1,
.result-view > h1 {
  margin: 0;
  color: #444;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.3;
}
.input-route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 76px;
  margin-top: 68px;
}
.route-card {
  min-height: 378px;
  padding: 47px 52px;
  border-radius: 16px;
}
.route-card-photo { background: var(--menu-blue-pale); }
.route-card-manual { background: var(--menu-cream-pale); }
.route-card h2 { margin: 0; font-size: 28px; line-height: 1.75; letter-spacing: -.7px; }
.route-card p { min-height: 54px; margin: 28px 0 48px; color: #787878; font-size: 12px; line-height: 1.75; }
.route-button {
  width: 170px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 16px;
  border: 0;
  border-radius: 22px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.route-button span { font-size: 24px; font-weight: 300; line-height: 1; }
.route-button-blue { background: var(--menu-blue); }
.route-button-dark { background: #4a4a4a; }

.recognition-view { display: none; }
.recognition-view.is-active { display: block; }
.upload-view { padding: 52px 0 72px; }
.upload-layout {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 24px;
  margin-top: 51px;
}
.upload-panel,
.upload-guide {
  min-height: 626px;
  padding: 39px 36px;
  border: 1px solid #aaa;
  border-radius: 16px;
}
.drop-zone {
  position: relative;
  height: 340px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 16px;
  background: #e5e5e5;
  cursor: pointer;
}
.upload-preview[hidden] { display: none !important; }
.drop-zone.is-dragging { outline: 3px solid rgb(112 172 216 / 35%); }
.add-photo {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 13px;
  transform: translate(-50%, -50%);
}
.add-photo[hidden] { display: none !important; }
.add-photo b { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #5f5f5f; color: #fff; font-size: 34px; font-weight: 300; line-height: 1; }
.add-photo em { color: #555; font-size: 13px; font-style: normal; }
.upload-preview { width: 100%; height: 100%; display: block; object-fit: cover; }
.upload-panel > p { margin: 16px 0 0; color: #777; font-size: 12px; }
.upload-panel > p + p { margin-top: 12px; }
.upload-panel .upload-error { color: #d64040; }
.upload-guide h2 { margin: 0; font-size: 17px; }
.example-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 27px; margin-top: 32px; }
.example-grid figure { margin: 0; }
.example-grid img { width: 100%; aspect-ratio: 1.25; display: block; border-radius: 10px; object-fit: cover; }
.example-grid figure:nth-child(2) img { object-position: left center; }
.example-grid figcaption { margin-top: 13px; color: #777; font-size: 11px; }
.guide-divider { height: 1px; margin: 67px 0 59px; background: #bbb; }
.upload-guide ul { margin: 28px 0 0; padding: 0; color: #777; font-size: 11px; line-height: 2.15; list-style: none; }
.upload-guide li::before { content: "· "; }
.screen-primary {
  width: 200px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 77px auto 0;
  border: 0;
  border-radius: 8px;
  background: var(--menu-blue);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.screen-primary:disabled { background: #ddd; cursor: default; }

body.is-processing .site-header { display: none; }
.processing-view.is-active {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 60px;
}
.processing-view h1 { margin: 0 0 18px; color: #424242; font-size: 28px; }
.processing-view p { margin: 0 0 72px; color: #aaa; font-size: 14px; }
.progress-ring {
  width: 146px;
  height: 146px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--menu-blue) var(--progress), #ececec 0);
}
.progress-ring::before { width: 119px; height: 119px; border-radius: 50%; background: white; content: ""; }
.progress-ring span { position: absolute; color: var(--menu-blue); font-size: 30px; font-weight: 700; }

.result-view { min-height: calc(100vh - 72px); padding: 52px 0 72px; }
.result-description { margin: 17px 0 0; color: #8a8a8a; font-size: 12px; }
.result-tabs { display: flex; gap: 38px; margin-top: 72px; }
.result-tabs button { position: relative; padding: 0 0 16px; border: 0; background: transparent; color: #bbb; font-size: 13px; cursor: pointer; }
.result-tabs button::after { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: transparent; content: ""; }
.result-tabs button.is-active { color: #4bad76; font-weight: 600; }
.result-tabs button.is-active::after { background: #4bad76; }
.result-tabs button[data-result-tab="low"].is-active { color: var(--menu-red); }
.result-tabs button[data-result-tab="low"].is-active::after { background: var(--menu-red); }
.food-list { display: grid; gap: 22px; margin-top: 24px; }
.food-row {
  min-height: 90px;
  display: grid;
  grid-template-columns: 58px minmax(180px, 1fr) 64px 94px 1px 32px 32px;
  align-items: center;
  gap: 18px;
  padding: 16px 31px;
  border: 1px solid #c7c7c7;
  border-radius: 12px;
}
.food-row img { width: 52px; height: 52px; display: block; border-radius: 9px; object-fit: cover; }
.food-copy strong { display: block; margin-bottom: 8px; color: #525252; font-size: 13px; }
.food-copy span { color: #888; font-size: 10px; }
.food-gi { color: #777; font-size: 10px; text-align: right; }
.serving-select { height: 34px; padding: 0 12px; border: 1px solid #ddd; border-radius: 5px; background: white; color: #777; font-size: 11px; }
.food-divider { width: 1px; height: 34px; background: #bbb; }
.icon-button { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #aaa; cursor: pointer; }
.icon-button svg { width: 20px; height: 20px; stroke: currentcolor; }
.add-food-button { height: 44px; margin-top: 27px; padding: 0 18px; border: 1px solid var(--menu-blue); border-radius: 7px; background: white; color: var(--menu-blue); font-size: 12px; cursor: pointer; }
.result-confirm { margin-top: 105px; }

.food-modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 28px; }
.food-modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; border: 0; background: rgb(0 0 0 / 56%); }
.food-picker {
  position: relative;
  z-index: 1;
  width: min(1202px, 100%);
  max-height: min(840px, calc(100vh - 56px));
  overflow-y: auto;
  padding: 42px 50px 48px;
  border-radius: 28px;
  background: white;
}
.picker-search { height: 57px; display: flex; align-items: center; gap: 20px; padding: 0 20px; border: 1px solid #bbb; border-radius: 6px; }
.picker-search span { width: 18px; height: 18px; border: 2px solid #777; border-radius: 50%; }
.picker-search span::after { width: 8px; height: 2px; display: block; margin: 13px 0 0 12px; transform: rotate(45deg); background: #777; content: ""; }
.picker-search input { min-width: 0; flex: 1; border: 0; outline: 0; color: #777; font-size: 12px; }
.picker-categories { display: flex; gap: 12px; margin: 22px 0 25px; }
.picker-categories button { min-width: 62px; height: 30px; padding: 0 16px; border: 1px solid #aaa; border-radius: 15px; background: white; font-size: 11px; cursor: pointer; }
.picker-categories button.is-active { border-color: var(--menu-blue); background: var(--menu-blue); color: white; }
.picker-summary { margin: 0 0 15px 6px; color: #777; font-size: 10px; }
.picker-list { display: grid; gap: 20px; }
.picker-option { min-height: 80px; display: grid; grid-template-columns: 1fr 70px 28px; align-items: center; padding: 14px 26px; border: 1px solid #ccc; border-radius: 7px; background: white; text-align: left; cursor: pointer; }
.picker-option strong { display: block; margin-bottom: 6px; color: #555; font-size: 12px; }
.picker-option small { color: #888; font-size: 10px; }
.picker-option > span { color: #777; font-size: 10px; text-align: center; }
.picker-option i { color: #ddd; font-size: 25px; font-style: normal; }
.picker-option.is-selected { border: 2px solid var(--menu-blue); background: #edf7ff; }
.picker-option.is-selected strong,
.picker-option.is-selected small,
.picker-option.is-selected i { color: var(--menu-blue); }
.picker-complete { margin-top: 45px; }

@media (max-width: 820px) {
  .menu-main, .recognition-view { width: calc(100% - 32px); }
  .menu-choice-page, .upload-view, .result-view { padding-top: 32px; }
  .input-route-grid { gap: 20px; margin-top: 36px; }
  .route-card { min-height: 320px; padding: 34px 28px; }
  .route-card h2 { font-size: 23px; }
  .upload-layout { grid-template-columns: 1fr; margin-top: 32px; }
  .upload-panel, .upload-guide { min-height: 0; }
  .food-row { grid-template-columns: 52px 1fr 60px 82px 28px 28px; gap: 10px; padding: 14px 16px; }
  .food-divider { display: none; }
  .food-picker { padding: 30px 24px 36px; border-radius: 20px; }
}

@media (max-width: 560px) {
  .input-route-grid { grid-template-columns: 1fr; }
  .route-card { min-height: 290px; }
  .upload-panel, .upload-guide { padding: 22px 18px; border-radius: 12px; }
  .drop-zone { height: 260px; }
  .example-grid { gap: 9px; }
  .guide-divider { margin: 36px 0; }
  .screen-primary { width: 180px; margin-top: 46px; }
  .processing-view h1 { font-size: 22px; }
  .result-view { min-height: calc(100vh - 108px); }
  .result-tabs { gap: 22px; margin-top: 45px; }
  .food-row { grid-template-columns: 45px 1fr 70px 27px 27px; min-height: 82px; padding: 12px; }
  .food-row img { width: 43px; height: 43px; }
  .food-gi { display: none; }
  .serving-select { width: 70px; padding: 0 6px; }
  .food-modal { padding: 10px; }
  .food-picker { max-height: calc(100vh - 20px); padding: 22px 14px 30px; border-radius: 16px; }
  .picker-categories { overflow-x: auto; padding-bottom: 4px; }
  .picker-categories button { flex: 0 0 auto; }
  .picker-option { grid-template-columns: 1fr 44px 24px; padding: 12px 14px; }
}

@media (max-width: 370px) {
  .menu-main, .recognition-view { width: calc(100% - 24px); }
  .food-row { grid-template-columns: 40px 1fr 58px 25px; }
  .food-row img { width: 38px; height: 38px; }
  .food-row [data-delete-food] { display: none; }
  .serving-select { width: 58px; }
}

/* 메뉴 직접 선택 */
.direct-main { width: min(calc(100% - 48px), 1202px); margin: 0 auto; }
.direct-stage { display: none; padding: 52px 0 70px; }
.direct-stage.is-active { display: block; }
.direct-stage h1 { margin: 0; color: #444; font-size: 25px; }
.direct-search { height: 57px; display: flex; align-items: center; gap: 20px; margin-top: 49px; padding: 0 20px; border: 1px solid #bbb; border-radius: 7px; }
.direct-search span { width: 18px; height: 18px; border: 2px solid #777; border-radius: 50%; }
.direct-search span::after { width: 8px; height: 2px; display: block; margin: 13px 0 0 12px; transform: rotate(45deg); background: #777; content: ""; }
.direct-search input { min-width: 0; flex: 1; border: 0; outline: 0; font-size: 12px; }
.direct-categories { display: flex; gap: 12px; margin-top: 30px; }
.direct-categories button { min-width: 62px; height: 30px; padding: 0 16px; border: 1px solid #999; border-radius: 15px; background: white; font-size: 11px; cursor: pointer; }
.direct-categories button.is-active { border-color: var(--menu-blue); background: var(--menu-blue); color: white; }
.direct-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 37px; }
.column-label { margin: 0 0 16px 6px; color: #777; font-size: 10px; }
.selected-column { padding-left: 1px; border-left: 1px solid #bbb; }
.selected-column > .column-label, .selected-column > div { margin-left: 26px; }
.direct-result-list, .direct-selected-list { display: grid; gap: 21px; }
.direct-food-option { min-height: 80px; display: grid; grid-template-columns: 1fr 55px 26px; align-items: center; padding: 14px 24px; border: 1px solid #c5c5c5; border-radius: 8px; background: white; text-align: left; cursor: pointer; }
.direct-food-option strong { display: block; margin-bottom: 7px; color: #555; font-size: 12px; }
.direct-food-option small { color: #888; font-size: 10px; }
.direct-food-option em { color: #777; font-size: 10px; font-style: normal; }
.direct-food-option i { color: #ddd; font-size: 24px; font-style: normal; }
.direct-food-option.is-selected, .direct-food-option.selected-food { border: 2px solid var(--menu-blue); background: #edf7ff; }
.direct-food-option.is-selected strong, .direct-food-option.is-selected small, .direct-food-option.is-selected em, .direct-food-option.is-selected i,
.direct-food-option.selected-food strong, .direct-food-option.selected-food small, .direct-food-option.selected-food em, .direct-food-option.selected-food i { color: var(--menu-blue); }
.empty-selection { min-height: 80px; display: flex; justify-content: center; flex-direction: column; padding: 0 25px; border: 1px solid #c5c5c5; border-radius: 8px; }
.empty-selection strong { margin-bottom: 7px; font-size: 12px; }
.empty-selection span { color: #888; font-size: 10px; }
.direct-next { margin-top: 165px; }
.manual-review > p { margin: 17px 0 0; color: #888; font-size: 12px; }
.manual-tab { width: max-content; margin-top: 72px; padding-bottom: 15px; border-bottom: 2px solid var(--menu-blue); color: var(--menu-blue); font-size: 13px; }
.manual-review-list { display: grid; gap: 22px; margin-top: 24px; }
.manual-review-row { min-height: 90px; display: grid; grid-template-columns: 1fr 64px 94px 1px 32px 32px; align-items: center; gap: 18px; padding: 16px 31px; border: 1px solid #c7c7c7; border-radius: 12px; }
.manual-review-row strong { display: block; margin-bottom: 8px; color: #525252; font-size: 13px; }
.manual-review-row div span { color: #888; font-size: 10px; }
.manual-review-row em { color: #777; font-size: 10px; font-style: normal; text-align: right; }
.manual-review-row select { height: 34px; padding: 0 12px; border: 1px solid #ddd; border-radius: 5px; background: white; color: #777; font-size: 11px; }
.manual-confirm { margin-top: 105px; }

/* 메뉴 확정 */
.confirmed-main { min-height: calc(100vh - 72px); display: flex; align-items: center; flex-direction: column; padding-top: 238px; text-align: center; }
.confirmed-mark { width: 106px; height: 106px; display: grid; place-items: center; border: 4px solid var(--menu-blue); border-radius: 50%; }
.confirmed-mark span { width: 47px; height: 27px; transform: rotate(-45deg); border-bottom: 5px solid var(--menu-blue); border-left: 5px solid var(--menu-blue); }
.confirmed-main h1 { margin: 58px 0 0; color: #444; font-size: 27px; }
.confirmed-main p { margin: 24px 0 0; color: #777; font-size: 12px; }
.confirmed-button { margin-top: 96px; }

@media (max-width: 820px) {
  .direct-main { width: calc(100% - 32px); }
  .direct-columns { gap: 20px; }
  .selected-column > .column-label, .selected-column > div { margin-left: 14px; }
  .manual-review-row { grid-template-columns: 1fr 55px 82px 28px 28px; gap: 10px; padding: 14px 16px; }
  .manual-review-row .food-divider { display: none; }
}
@media (max-width: 560px) {
  .direct-stage { padding-top: 32px; }
  .direct-search { margin-top: 32px; }
  .direct-categories { overflow-x: auto; padding-bottom: 4px; }
  .direct-categories button { flex: 0 0 auto; }
  .direct-columns { grid-template-columns: 1fr; }
  .selected-column { padding-top: 18px; padding-left: 0; border-top: 1px solid #bbb; border-left: 0; }
  .selected-column > .column-label, .selected-column > div { margin-left: 0; }
  .direct-next { margin-top: 65px; }
  .manual-review-row { grid-template-columns: 1fr 64px 27px 27px; }
  .manual-review-row > em { display: none; }
  .manual-review-row select { width: 64px; padding: 0 5px; }
  .confirmed-main { min-height: calc(100vh - 108px); padding: 135px 20px 60px; }
  .confirmed-mark { width: 82px; height: 82px; }
  .confirmed-mark span { width: 37px; height: 21px; }
  .confirmed-main h1 { margin-top: 42px; font-size: 23px; }
  .confirmed-button { margin-top: 65px; }
}


/* =========================================================
   모바일 메뉴 입력 홈 (Figma 360x800 원본 기준)
   - 기존 PC 화면/링크 기능 유지
   - 767px 이하에서만 원본 배치로 변경
   ========================================================= */
@media (max-width: 767px) {
  body[data-page="menu-home"] {
    min-width: 320px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    background: #fff;
  }

  body[data-page="menu-home"] .site-header {
    height: 64px;
    border-bottom: 0;
    background: #fff;
  }

  body[data-page="menu-home"] .header-inner {
    width: 100%;
    height: 64px;
    flex-wrap: nowrap;
    align-content: normal;
    padding: 16px 21px 0;
  }

  body[data-page="menu-home"] .brand {
    width: 63px;
    height: 23px;
    flex: 0 0 63px;
    order: initial;
  }

  body[data-page="menu-home"] .profile-button {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    order: initial;
    margin-left: auto;
    overflow: hidden;
  }

  body[data-page="menu-home"] .desktop-nav { display: none; }

  body[data-page="menu-home"] .menu-main.menu-choice-page {
    width: 100%;
    min-height: calc(100svh - 120px);
    margin: 0;
    padding: 80px 16px 80px;
  }

  body[data-page="menu-home"] .menu-choice-page > h1 { display: none; }

  body[data-page="menu-home"] .input-route-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 0;
  }

  body[data-page="menu-home"] .route-card {
    position: relative;
    width: 100%;
    min-height: 248px;
    height: 248px;
    padding: 27px 17px 29px;
    border: 0;
    border-radius: 16px;
  }

  body[data-page="menu-home"] .route-card-photo { background: #eff8ff; }
  body[data-page="menu-home"] .route-card-manual { background: #fff9f3; }

  body[data-page="menu-home"] .route-card h2 {
    margin: 0;
    color: #3f3f3f;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -.45px;
    white-space: nowrap;
  }

  body[data-page="menu-home"] .route-card h2 br { display: none; }

  body[data-page="menu-home"] .route-card p {
    width: 255px;
    min-height: 0;
    margin: 17px 0 0;
    color: #666;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: -.25px;
  }

  body[data-page="menu-home"] .route-card-manual p br { display: none; }

  body[data-page="menu-home"] .route-button {
    position: absolute;
    right: 15px;
    bottom: 29px;
    width: 135px;
    height: 30px;
    min-height: 30px;
    gap: 18px;
    padding: 0 13px 0 23px;
    border-radius: 15px;
    color: #3f3f3f;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    touch-action: manipulation;
  }

  body[data-page="menu-home"] .route-button-blue { background: #73acd9; }
  body[data-page="menu-home"] .route-button-dark { background: #474747; color: #fff; }

  body[data-page="menu-home"] .route-button span {
    margin-left: auto;
    font-size: 24px;
    font-weight: 300;
    line-height: .8;
  }
}

/* 모바일 사진 입력 3단계 — 제공 디자인을 사용하되, 시스템 상태바(시간/신호/Wi-Fi/배터리) 영역 44px은 표시하지 않음.
   실제 서비스 웹에서는 브라우저/OS 상태바를 디자인에 중복해서 그리지 않는다. */
.mobile-photo-flow { display: none; }

@media (max-width: 767px) {
  body[data-page="photo-recognition"] {
    min-width: 0;
    overflow-x: hidden;
    background: #fff;
  }

  body[data-page="photo-recognition"] .site-header {
    display: none;
  }

  body[data-page="photo-recognition"] .recognition-app,
  body[data-page="photo-recognition"] .recognition-view.upload-view {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  body[data-page="photo-recognition"] .upload-view > h1,
  body[data-page="photo-recognition"] .upload-view > .upload-layout,
  body[data-page="photo-recognition"] .upload-view > .screen-primary {
    display: none;
  }

  .mobile-photo-flow {
    position: relative;
    width: 100%;
    display: block;
    overflow: hidden;
    background: #fff;
    line-height: 0;
  }

  .mobile-photo-artwork {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
  }

  .mobile-photo-hit,
  .mobile-photo-confirm {
    position: absolute;
    z-index: 3;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-photo-hit:focus-visible,
  .mobile-photo-confirm:focus-visible {
    outline: 2px solid #73acd9;
    outline-offset: -2px;
  }

  /* 공통 뒤로가기: 원본 y≈52~82에서 상태바 44px을 제외한 위치 */
  .mobile-photo-back {
    left: 5.5%;
    top: 0.3%;
    width: 12%;
    height: 6%;
  }

  /* 1단계 안내 화면의 확인 버튼 */
  .mobile-photo-guide-confirm {
    left: 6.9%;
    top: 80.6%;
    width: 87.1%;
    height: 6.2%;
  }

  /* 2단계 사진 추가 영역 */
  .mobile-photo-add {
    left: 6.4%;
    top: 14%;
    width: 87%;
    height: 27.2%;
  }

  /* 3단계 바텀시트 선택 영역 */
  .mobile-photo-gallery {
    left: 7.2%;
    top: 65.9%;
    width: 85.6%;
    height: 6.1%;
  }

  .mobile-photo-camera {
    left: 7.2%;
    top: 71.9%;
    width: 85.6%;
    height: 6.1%;
  }

  .mobile-photo-source-confirm {
    left: 6.7%;
    top: 79.7%;
    width: 86.9%;
    height: 6.2%;
  }

  /* 2단계의 실제 동작 버튼. 선택 전에는 SVG의 회색 버튼 그대로 보이도록 투명 처리. */
  .mobile-photo-confirm {
    left: 6.9%;
    top: 80.6%;
    width: 87.1%;
    height: 6.2%;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #73acd9;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
  }

  .mobile-photo-confirm:not(:disabled) {
    display: flex;
  }

  .mobile-photo-flow[data-step="guide"] .mobile-photo-add,
  .mobile-photo-flow[data-step="guide"] .mobile-photo-gallery,
  .mobile-photo-flow[data-step="guide"] .mobile-photo-camera,
  .mobile-photo-flow[data-step="guide"] .mobile-photo-source-confirm,
  .mobile-photo-flow[data-step="guide"] .mobile-photo-confirm {
    display: none;
  }

  .mobile-photo-flow[data-step="upload"] .mobile-photo-guide-confirm,
  .mobile-photo-flow[data-step="upload"] .mobile-photo-gallery,
  .mobile-photo-flow[data-step="upload"] .mobile-photo-camera,
  .mobile-photo-flow[data-step="upload"] .mobile-photo-source-confirm {
    display: none;
  }

  .mobile-photo-flow[data-step="source"] .mobile-photo-guide-confirm,
  .mobile-photo-flow[data-step="source"] .mobile-photo-add,
  .mobile-photo-flow[data-step="source"] .mobile-photo-confirm {
    display: none;
  }
}

/* =========================================================
   모바일 사진 인식 후속 화면
   - 제공된 360x800 시안을 기준으로 기존 동적 DOM/API를 그대로 사용한다.
   - 시안의 iOS 상태바(시간/신호/Wi-Fi/배터리)는 실제 웹에 그리지 않는다.
   ========================================================= */
.mobile-recognition-header,
.mobile-recognition-back,
.mobile-picker-back { display: none; }

@media (max-width: 767px) {
  body[data-page="photo-recognition"] {
    padding-bottom: 0;
  }

  /* 업로드 단계에서는 하단 네비게이션을 숨기고, 처리/결과에서만 고정 노출 */
  body[data-page="photo-recognition"] .recognition-bottom-nav {
    display: none;
  }
  body[data-page="photo-recognition"][data-recognition-view="processing"] .recognition-bottom-nav,
  body[data-page="photo-recognition"][data-recognition-view="result"] .recognition-bottom-nav {
    display: grid;
  }
  body[data-page="photo-recognition"].is-food-picker-open .recognition-bottom-nav {
    display: none;
  }

  /* ---------- 인식 처리 중 ---------- */
  body[data-page="photo-recognition"] .processing-view.is-active {
    position: relative;
    width: 100%;
    min-height: calc(100dvh - 56px - env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 20px 80px;
    background: #fff;
  }

  .mobile-recognition-back {
    position: absolute;
    z-index: 5;
    top: 18px;
    left: 18px;
    width: 42px;
    height: 42px;
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
  }
  .mobile-recognition-back::before,
  .mobile-picker-back::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border-bottom: 2px solid #333;
    border-left: 2px solid #333;
    transform: translate(-32%, -50%) rotate(45deg);
    content: "";
  }

  body[data-page="photo-recognition"] .processing-view h1 {
    margin: 216px 0 13px;
    color: #444;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.6px;
    text-align: center;
  }
  body[data-page="photo-recognition"] .processing-view p {
    margin: 0 0 70px;
    color: #b9b9b9;
    font-size: 14px;
    line-height: 1.4;
  }
  body[data-page="photo-recognition"] .progress-ring {
    width: 144px;
    height: 144px;
    flex: 0 0 auto;
  }
  body[data-page="photo-recognition"] .progress-ring::before {
    width: 116px;
    height: 116px;
  }
  body[data-page="photo-recognition"] .progress-ring span {
    font-size: 30px;
  }

  /* ---------- 인식한 메뉴 ---------- */
  body[data-page="photo-recognition"] .result-view.is-active {
    width: 100%;
    min-height: 100dvh;
    padding: 0 16px calc(92px + env(safe-area-inset-bottom, 0px));
    background: #fff;
  }

  .mobile-recognition-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -2px;
  }
  .mobile-recognition-header a:first-child img {
    width: 63px;
    height: auto;
    display: block;
  }
  .mobile-recognition-header a:last-child img {
    width: 30px;
    height: 30px;
    display: block;
    border-radius: 50%;
  }

  body[data-page="photo-recognition"] .result-view > h1 {
    margin: 14px 0 2px;
    color: #444;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -1.1px;
  }
  body[data-page="photo-recognition"] .result-description {
    margin: 4px 0 0;
    color: #7d7d7d;
    font-size: 13px;
    line-height: 1.45;
    letter-spacing: -0.25px;
  }

  body[data-page="photo-recognition"] .result-tabs {
    display: grid;
    grid-template-columns: max-content max-content;
    gap: 34px;
    margin-top: 25px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  body[data-page="photo-recognition"] .result-tabs::-webkit-scrollbar { display: none; }
  body[data-page="photo-recognition"] .result-tabs button {
    min-height: 40px;
    padding: 0 1px 10px;
    color: #b8b8b8;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
  }
  body[data-page="photo-recognition"] .result-tabs button.is-active {
    color: #6cad89;
  }
  body[data-page="photo-recognition"] .result-tabs button.is-active::after {
    height: 2px;
    background: #6cad89;
  }
  body[data-page="photo-recognition"] .result-tabs button[data-result-tab="low"].is-active {
    color: #73acd9;
  }
  body[data-page="photo-recognition"] .result-tabs button[data-result-tab="low"].is-active::after {
    background: #73acd9;
  }

  body[data-page="photo-recognition"] .food-list {
    gap: 17px;
    margin-top: 8px;
  }
  body[data-page="photo-recognition"] .food-row {
    position: relative;
    min-height: 72px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 94px 30px;
    grid-template-rows: 1fr;
    align-items: center;
    gap: 8px;
    padding: 12px 13px 12px 15px;
    border: 2px solid #e2e2e2;
    border-radius: 13px;
    background: #fff;
  }
  body[data-page="photo-recognition"] .food-row.needs-confirmation {
    cursor: pointer;
  }
  body[data-page="photo-recognition"] .food-row img,
  body[data-page="photo-recognition"] .food-gi,
  body[data-page="photo-recognition"] .food-divider,
  body[data-page="photo-recognition"] .icon-button[data-edit-food] {
    display: none;
  }
  body[data-page="photo-recognition"] .food-copy {
    min-width: 0;
  }
  body[data-page="photo-recognition"] .food-copy strong {
    margin: 0 0 9px;
    overflow: hidden;
    color: #5d5d5d;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body[data-page="photo-recognition"] .food-copy span {
    display: block;
    overflow: hidden;
    color: #7d7d7d;
    font-size: 12px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body[data-page="photo-recognition"] .serving-select {
    width: 94px;
    height: 37px;
    padding: 0 28px 0 12px;
    border: 1px solid #dedede;
    border-radius: 6px;
    background-color: #fff;
    color: #777;
    font-size: 12px;
  }
  body[data-page="photo-recognition"] .icon-button[data-delete-food] {
    width: 30px;
    height: 38px;
    color: #c9c9c9;
  }
  body[data-page="photo-recognition"] .icon-button[data-delete-food] svg {
    width: 22px;
    height: 22px;
  }

  body[data-page="photo-recognition"] .add-food-button {
    height: 45px;
    margin-top: 24px;
    padding: 0 18px;
    border: 1.5px solid #73acd9;
    border-radius: 8px;
    color: #73acd9;
    font-size: 13px;
    font-weight: 600;
  }
  body[data-page="photo-recognition"] .add-food-button span {
    margin-right: 7px;
    font-size: 25px;
    font-weight: 300;
    vertical-align: -2px;
  }
  body[data-page="photo-recognition"] .result-confirm {
    width: 200px;
    height: 54px;
    margin: 57px auto 0;
    border-radius: 8px;
    font-size: 15px;
  }

  /* ---------- 인식 결과 수정 / 직접 추가 ---------- */
  body[data-page="photo-recognition"] .food-modal {
    z-index: 500;
    display: block;
    padding: 0;
    background: #fff;
  }
  body[data-page="photo-recognition"] .food-modal[hidden] { display: none; }
  body[data-page="photo-recognition"] .modal-backdrop { display: none; }
  body[data-page="photo-recognition"] .food-picker {
    position: fixed;
    inset: 0;
    width: 100%;
    max-height: none;
    overflow-y: auto;
    padding: 80px 16px 102px;
    border-radius: 0;
    background: #fff;
    scrollbar-width: thin;
  }
  .mobile-picker-back {
    position: fixed;
    z-index: 505;
    top: 16px;
    left: 18px;
    width: 42px;
    height: 42px;
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  body[data-page="photo-recognition"] .picker-search {
    height: 48px;
    gap: 14px;
    padding: 0 14px;
    border: 2px solid #dedede;
    border-radius: 9px;
  }
  body[data-page="photo-recognition"] .picker-search span {
    width: 14px;
    height: 14px;
    border-width: 2px;
  }
  body[data-page="photo-recognition"] .picker-search span::after {
    width: 7px;
    margin: 10px 0 0 9px;
  }
  body[data-page="photo-recognition"] .picker-search input {
    font-size: 15px;
  }

  body[data-page="photo-recognition"] .picker-categories {
    gap: 7px;
    margin: 10px 0 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  body[data-page="photo-recognition"] .picker-categories::-webkit-scrollbar { display: none; }
  body[data-page="photo-recognition"] .picker-categories button {
    min-width: 50px;
    height: 30px;
    flex: 0 0 auto;
    padding: 0 14px;
    border-color: #bbb;
    border-radius: 16px;
    background: #fff;
    color: #444;
    font-size: 12px;
    font-weight: 600;
  }
  body[data-page="photo-recognition"] .picker-categories button.is-active {
    border-color: #73acd9;
    background: #73acd9;
    color: #fff;
  }
  body[data-page="photo-recognition"] .picker-summary {
    margin: 6px 0 13px 6px;
    color: #777;
    font-size: 12px;
  }

  body[data-page="photo-recognition"] .picker-list {
    gap: 16px;
  }
  body[data-page="photo-recognition"] .picker-option {
    min-height: 72px;
    grid-template-columns: minmax(0, 1fr) 48px 28px;
    gap: 8px;
    padding: 13px 14px 13px 15px;
    border: 2px solid #e2e2e2;
    border-radius: 13px;
    background: #fff;
  }
  body[data-page="photo-recognition"] .picker-option strong {
    margin-bottom: 9px;
    color: #5d5d5d;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
  }
  body[data-page="photo-recognition"] .picker-option small {
    color: #7d7d7d;
    font-size: 12px;
    line-height: 1.25;
  }
  body[data-page="photo-recognition"] .picker-option > span {
    color: #777;
    font-size: 12px;
  }
  body[data-page="photo-recognition"] .picker-option i {
    color: #e0e0e0;
    font-size: 27px;
    line-height: 1;
  }
  body[data-page="photo-recognition"] .picker-option.is-selected {
    border-color: #4f82aa;
    background: #eaf6ff;
  }
  body[data-page="photo-recognition"] .picker-option.is-selected strong,
  body[data-page="photo-recognition"] .picker-option.is-selected small,
  body[data-page="photo-recognition"] .picker-option.is-selected > span,
  body[data-page="photo-recognition"] .picker-option.is-selected i {
    color: #73acd9;
  }

  body[data-page="photo-recognition"] .picker-complete {
    position: fixed;
    z-index: 510;
    right: 16px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    width: auto;
    height: 50px;
    margin: 0;
    border-radius: 8px;
    font-size: 15px;
  }
}


/* ===== Mobile recognition: low-confidence correction ===== */
@media (max-width: 767px) {
  /* The supplied mobile mockups include a phone status bar. The web UI intentionally omits it. */
  body[data-page="photo-recognition"][data-recognition-view="result"][data-result-tab="low"] .result-tabs button[data-result-tab="low"].is-active {
    color: #c03435;
  }

  body[data-page="photo-recognition"][data-recognition-view="result"][data-result-tab="low"] .result-tabs button[data-result-tab="low"].is-active::after {
    background: #c03435;
  }

  body[data-page="photo-recognition"][data-recognition-view="result"][data-result-tab="low"] .result-tabs button[data-result-tab="recognized"] {
    color: #c1c1c1;
  }

  body[data-page="photo-recognition"][data-recognition-view="result"][data-result-tab="low"] .food-list {
    margin-top: 8px;
  }

  body[data-page="photo-recognition"][data-recognition-view="result"][data-result-tab="low"] .food-row.needs-confirmation {
    border-color: #e3e3e3;
    background: #fff;
  }

  /* Low-confidence items are corrected by tapping the whole card. */
  body[data-page="photo-recognition"][data-recognition-view="result"][data-result-tab="low"] .food-row.needs-confirmation:active {
    background: #fafafa;
  }

  /* Low-confidence correction search screen. Positions are shifted up because no iOS status bar is rendered. */
  body[data-page="photo-recognition"].is-low-confidence-picker .food-picker {
    padding-top: 54px;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .mobile-picker-back {
    top: 7px;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-search {
    height: 31px;
    padding: 0 11px;
    border-width: 1.5px;
    border-radius: 8px;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-search input {
    font-size: 13px;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-categories {
    gap: 5px;
    margin: 8px 0 6px;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-categories button {
    min-width: 43px;
    height: 25px;
    padding: 0 12px;
    border-width: 1px;
    font-size: 11px;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-summary {
    margin: 4px 0 10px 6px;
    font-size: 11px;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-list {
    gap: 16px;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-option {
    min-height: 72px;
    grid-template-columns: minmax(0, 1fr) 45px 26px;
    padding: 13px 13px 13px 15px;
    border-width: 2px;
    border-radius: 13px;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-option.is-selected {
    border-color: #4f82aa;
    background: #eaf6ff;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-complete {
    right: 21px;
    bottom: calc(61px + env(safe-area-inset-bottom, 0px));
    left: 21px;
    height: 50px;
    border-radius: 8px;
    background: #73acd9;
  }

  body[data-page="photo-recognition"].is-low-confidence-picker .picker-complete:disabled {
    background: #d6d6d6;
    color: #fff;
  }
}
