/* 涮烤计时器样式 —— 令牌与组件规范见 DESIGN.md（UI 改动必须先读） */
:root {
  color-scheme: light;
  --canvas: #f7f3ed;
  --surface: #ffffff;
  --surface-soft: #fff8f0;
  --surface-strong: #f0e9df;
  --ink: #241b17;
  --muted: #766a63;
  --line: #e7ddd3;
  --brand: #db4b2f;
  --brand-dark: #b93420;
  --brand-soft: #ffded2;
  --raw: #6e8ca8;
  --medium: #d9940a;
  --done: #2f9e57;
  --over: #a8492f;
  --safety: #c22030;
  --shadow: 0 18px 50px rgba(69, 44, 31, .12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(219, 75, 47, .25);
  outline-offset: 2px;
}

button:active {
  transform: scale(.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: .46;
  transform: none;
}

[hidden] {
  display: none !important;
}

#appShell {
  width: min(100%, 600px);
  height: 100dvh;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(10px + var(--safe-top)) 16px calc(34px + var(--safe-bottom));
}

body.has-done-sheet #appShell {
  padding-bottom: calc(150px + var(--safe-bottom));
}

/* ---------- 顶条（轻量：品牌 + 拍照 + 声音 + 设置） ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.topbar h1 {
  min-width: 0;
  flex: 1;
  margin: 0;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 auto;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 17px;
}

.camera-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 13px;
  flex: 0 0 auto;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #f0b8a6;
  font-size: 13px;
  font-weight: 700;
}

.notice {
  margin-bottom: 10px;
  padding: 11px 13px;
  border-radius: 13px;
  font-size: 12px;
  line-height: 1.5;
}

.reliability-notice {
  color: #205673;
  background: #e8f4fa;
  border: 1px solid #c2dfec;
}

.reliability-notice.warning {
  color: #913c31;
  background: #fff0eb;
  border-color: #f2c9bd;
}

/* ---------- 计时区 ---------- */
#timerZone {
  margin-bottom: 18px;
}

#readyBanner,
#flipBanner {
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 750;
}

#readyBanner {
  color: #164c31;
  background: #d9f4e5;
  border: 1px solid #a9dfc0;
}

#flipBanner {
  color: #69420d;
  background: #fff0d2;
  border: 1px solid #f2cf8b;
}

.capacity-banner {
  margin-bottom: 10px;
  padding: 9px 11px;
  color: #7a431d;
  border: 1px solid #efca90;
  border-radius: 11px;
  background: #fff4dc;
  font-size: 11px;
  line-height: 1.45;
}

.timer-zone {
  margin-bottom: 12px;
}

.timer-zone-head,
.timer-zone > summary {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.timer-zone-head strong,
.timer-zone > summary strong {
  color: var(--ink);
  font-size: 14px;
}

.attention-zone .timer-zone-head strong {
  color: var(--over);
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* 计时卡：照片为底 + 阶段色遮罩 + 大倒计时 + 阶段标签 + 底部进度条 */
.timer-card {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.timer-card.must-cook {
  border: 2px solid var(--safety);
}

.timer-card.pending {
  border-style: dashed;
  border-color: #d8c8bc;
}

.timer-card.completed {
  opacity: .8;
}

.timer-photo {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 0;
  background: var(--surface-strong);
}

.timer-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.timer-photo .veil {
  position: absolute;
  inset: 0;
  background: rgba(31, 23, 19, .14);
}

/* 扇形倒计时遮罩（v2.2）：已逝部分自 12 点顺时针铺开，剩余扇形随之顺时针收缩；颜色沿用四阶段令牌 */
.timer-photo .pie {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: conic-gradient(rgba(255, 255, 255, .38) 0turn var(--pie-elapsed, 0turn), var(--pie-color, rgba(118, 106, 99, .92)) var(--pie-elapsed, 0turn) 1turn);
  box-shadow: 0 2px 10px rgba(31, 23, 19, .22);
}

.timer-photo .pie::after {
  content: '';
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: rgba(31, 23, 19, .58);
}

.timer-card.pending .pie,
.timer-card.completed .pie {
  display: none;
}

.stage-raw .pie { --pie-color: rgba(110, 140, 168, .92); }
.stage-medium .pie { --pie-color: rgba(217, 148, 10, .92); }
.stage-done .pie { --pie-color: rgba(47, 158, 87, .92); }
.stage-overcooked .pie { --pie-color: rgba(168, 73, 47, .94); }

.timer-card.pending .veil { background: rgba(118, 106, 99, .38); }
.timer-card.completed .veil { background: rgba(118, 106, 99, .45); }

.timer-photo .countdown {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  text-align: center;
  text-shadow: 0 1px 8px rgba(31, 23, 19, .5);
}

.timer-photo .countdown.long {
  font-size: 13px;
  line-height: 1.3;
}

.timer-photo .countdown .ov-tag {
  display: block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .12em;
}

.stage-chip {
  position: absolute;
  left: 6px;
  top: 6px;
  max-width: calc(100% - 12px);
  padding: 3px 8px;
  overflow: hidden;
  border-radius: 999px;
  color: #fff;
  background: rgba(31, 23, 19, .55);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-chip.flip-flash {
  color: #4a2d06;
  background: #f3b95d;
  animation: pulse-amber 1s ease-in-out infinite;
}

.must-cook-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  background: var(--safety);
  font-size: 9px;
  font-weight: 800;
}

.timer-photo .progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg,
    rgba(110, 140, 168, .9) 0%,
    rgba(217, 148, 10, .9) calc(var(--p-raw, 40) * 1%),
    rgba(47, 158, 87, .9) calc(var(--p-best, 74) * 1%),
    rgba(47, 158, 87, .9) 88%,
    rgba(168, 73, 47, .95) 100%);
}

.timer-photo .fill {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .55);
  clip-path: inset(0 0 0 calc(var(--pct, 0%)));
  transition: clip-path .5s linear;
}

.timer-photo .marker {
  position: absolute;
  top: -1px;
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 6px rgba(31, 23, 19, .45);
  transform: translateX(-2px);
}

.timer-photo .flip-tick {
  position: absolute;
  top: 0;
  width: 0;
  height: 4px;
  border-left: 2px dashed rgba(31, 23, 19, .7);
  transform: translateX(-1px);
}

.timer-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 4px 6px 4px 10px;
}

.timer-info .dish-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-primary-action {
  min-width: 64px;
  min-height: 40px;
  padding: 6px 10px;
  flex: 0 0 auto;
  color: #fff;
  border-radius: 11px;
  background: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.start-action {
  background: var(--done);
}

.complete-action {
  background: var(--brand-dark);
}

.undo-action {
  color: var(--brand-dark);
  border: 1px solid #e8b5a6;
  background: #fff;
}

.timer-details {
  padding: 2px 10px 10px;
  border-top: 1px dashed var(--line);
}

.timer-details .note {
  margin: 7px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.timer-detail-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.safety-flag {
  min-height: 44px;
  padding: 7px 10px;
  color: #fff;
  border: 0;
  border-radius: 999px;
  background: var(--safety);
  font-size: 11px;
  font-weight: 800;
}

.readd,
.remove {
  min-height: 44px;
  padding: 6px 9px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.readd {
  margin-left: auto;
}

/* ---------- 菜品网格（首屏主界面） ---------- */
#gridSection {
  margin-top: 2px;
}

.grid-search {
  margin-bottom: 10px;
}

.group-tabs {
  display: flex;
  gap: 6px;
  margin: 0 -16px 12px;
  padding: 0 16px 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.group-tabs::-webkit-scrollbar {
  display: none;
}

.group-tabs button {
  min-height: 44px;
  padding: 8px 14px;
  flex: 0 0 auto;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
}

.group-tabs button.active {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

/* 「全部」= 大标签/重置位：横向滚动时冻结在标签条最左列（竖向滚动随页面正常隐藏，v2.2） */
.group-tabs .tab-all {
  position: sticky;
  left: 0;
  z-index: 2;
  padding: 8px 20px;
  margin-left: 0;
  font-size: 14px;
  font-weight: 800;
  background: var(--surface);
  box-shadow: 8px 0 10px -6px rgba(69, 44, 31, .35);
}

.group-tabs .tab-all.active {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

.dish-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dish-group-title {
  grid-column: 1 / -1;
  margin: 12px 1px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.dish-card {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
}

.dish-card.must-cook {
  border: 2px solid var(--safety);
}

.dish-photo {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-strong);
}

.dish-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cuisine-corner {
  position: absolute;
  bottom: 5px;
  left: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  background: rgba(31, 23, 19, .55);
  font-size: 9px;
  font-weight: 700;
}

.dish-meta {
  display: block;
  padding: 7px 9px 9px;
}

.dish-meta .dish-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dish-meta .dish-secs {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

/* ---------- 到点浮层（非模态） ---------- */
.done-sheet {
  position: fixed;
  right: 14px;
  bottom: calc(14px + var(--safe-bottom));
  left: 14px;
  z-index: 26;
  width: min(calc(100% - 28px), 560px);
  margin: 0 auto;
  padding: 10px 12px 12px;
  border: 1px solid #a9dfc0;
  border-radius: 16px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 14px 40px rgba(22, 76, 49, .2);
}

.done-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #164c31;
  font-size: 13px;
}

.done-sheet-head button {
  min-height: 36px;
  padding: 4px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.done-sheet-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.done-sheet-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 4px 4px 4px 8px;
  border-radius: 11px;
  background: #eef9f2;
}

.done-sheet-row .name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.done-sheet-row .must-cook-tag {
  padding: 2px 6px;
  flex: 0 0 auto;
  border-radius: 999px;
  color: #fff;
  background: var(--safety);
  font-size: 9px;
  font-weight: 800;
}

.done-sheet-row button {
  min-width: 72px;
  min-height: 40px;
  flex: 0 0 auto;
  color: #fff;
  border-radius: 10px;
  background: var(--done);
  font-size: 12px;
  font-weight: 800;
}

/* ---------- 设置面板 ---------- */
#settingsOverlay {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(36, 27, 23, .46);
  backdrop-filter: blur(2px);
}

#settingsSheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: flex;
  width: min(100%, 600px);
  max-height: 86dvh;
  flex-direction: column;
  padding: 8px 16px 0;
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  box-shadow: 0 -18px 54px rgba(52, 33, 24, .22);
  transform: translate(-50%, 105%);
  transition: transform .28s cubic-bezier(.22, .8, .3, 1);
  visibility: hidden;
}

#settingsSheet.open {
  transform: translate(-50%, 0);
  visibility: visible;
}

.control-field {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.control-field select {
  min-width: 0;
  min-height: 44px;
  flex: 1;
  padding: 0 30px 0 10px;
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  background: var(--surface-strong);
}

.settings-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 8px;
  text-align: left;
}

.danger-text {
  color: var(--safety);
}

.settings-privacy {
  margin: 14px 2px 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.secondary {
  min-height: 44px;
  padding: 10px 15px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-weight: 650;
}

.primary {
  background: var(--brand);
  color: #fff;
  font-weight: 750;
}

footer {
  padding: 24px 0 8px;
  color: #998b82;
  font-size: 11px;
  text-align: center;
}

/* ---------- 安全卡（设置面板内） ---------- */
.safety-card {
  margin-top: 14px;
  padding: 15px 16px;
  border: 1px solid #ead9c1;
  border-radius: var(--radius-md);
  background: #fff9e9;
}

.safety-card strong {
  font-size: 13px;
}

.safety-card p {
  margin: 5px 0 0;
  color: #78654b;
  font-size: 11px;
  line-height: 1.55;
}

.safety-guide {
  margin-top: 10px;
  border-top: 1px solid #ead9c1;
}

.safety-guide > summary,
.temperature-reference > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  color: #7a431d;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.safety-guide-body {
  padding: 0 2px 5px;
}

.safety-guide-body ol {
  margin: 0;
  padding-left: 20px;
  color: #665747;
  font-size: 12px;
  line-height: 1.65;
}

.safety-guide-body li + li {
  margin-top: 7px;
}

.safety-guide-body .safety-caveat {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: #7e463b;
  background: #ffede6;
}

.temperature-reference {
  margin-top: 8px;
  border-top: 1px dashed #dfcbb4;
}

.temperature-reference p {
  margin: 0 0 8px;
}

.safety-guide a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- 识别抽屉（Mobile bottom sheet） ---------- */
#drawerOverlay {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(36, 27, 23, .46);
  backdrop-filter: blur(2px);
}

#drawer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: flex;
  width: min(100%, 600px);
  height: min(92dvh, 920px);
  flex-direction: column;
  padding: 8px 16px 0;
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  box-shadow: 0 -18px 54px rgba(52, 33, 24, .22);
  transform: translate(-50%, 105%);
  transition: transform .28s cubic-bezier(.22, .8, .3, 1);
  visibility: hidden;
}

#drawer.open {
  transform: translate(-50%, 0);
  visibility: visible;
}

.sheet-handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: #d9d1cb;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 0 9px;
}

.drawer-head h2 {
  margin: 0;
  font-size: 22px;
}

.drawer-head .icon-button {
  background: var(--surface-strong);
  border-color: transparent;
}

.eyebrow {
  margin: 0 0 3px;
  color: #9a8073;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .12em;
}

.drawer-safety-legend {
  margin: -2px 0 9px;
  padding: 8px 10px;
  color: #7b4a24;
  border-radius: 10px;
  background: #fff5dc;
  font-size: 11px;
  line-height: 1.4;
}

.sheet-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 1px 18px;
}

.recognition-status {
  margin: 2px 0 10px;
  padding: 10px 12px;
  color: #205673;
  border: 1px solid #c2dfec;
  border-radius: 11px;
  background: #e8f4fa;
  font-size: 12px;
  line-height: 1.45;
}

.recognition-status.warning {
  color: #913c31;
  border-color: #f2c9bd;
  background: #fff0eb;
}

.candidate-area {
  margin-top: 12px;
}

.candidate-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 1px 9px;
}

.candidate-title strong {
  font-size: 15px;
}

.candidate-title span,
.hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.hint {
  margin: 8px 1px;
}

.hint.error {
  padding: 10px 12px;
  color: #913c31;
  border-radius: 11px;
  background: #fff0eb;
}

.recognition-history-list {
  display: grid;
  gap: 10px;
}

.recognition-history-item {
  position: relative;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fcfaf7;
}

.recognition-history-head {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
}

.recognition-thumb {
  display: grid;
  width: 64px;
  height: 56px;
  min-height: 56px;
  overflow: hidden;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 10px;
}

.recognition-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recognition-history-meta {
  display: block;
  min-width: 0;
}

.recognition-history-meta strong,
.recognition-history-meta span {
  display: block;
}

.recognition-history-meta strong {
  font-size: 13px;
}

.recognition-history-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.recognition-delete {
  width: 44px;
  min-height: 44px;
  padding: 0;
  color: #9a7468;
  background: transparent;
  font-size: 14px;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.candidate-chip {
  min-width: 0;
  min-height: 44px;
  padding: 8px 9px;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-chip.selected,
.candidate-chip[aria-pressed="true"] {
  color: var(--brand-dark);
  border-color: #ed9a84;
  background: var(--brand-soft);
}

.history-empty {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

@media (min-width: 520px) {
  .candidate-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.library-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 12px;
  color: #9a8c83;
  font-size: 11px;
}

.library-divider::before,
.library-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.search-box {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8f5f1;
}

.search-box > span {
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

#searchInput,
#dishSearch {
  min-width: 0;
  min-height: 46px;
  flex: 1;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-strong);
}

.tabs button {
  min-height: 44px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
}

.tabs button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 12px rgba(65, 43, 32, .08);
}

#dishGrid h3 {
  margin: 16px 1px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

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

.search-results {
  margin-top: 10px;
}

.chip {
  min-height: 44px;
  padding: 9px 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  font-size: 13px;
}

.chip.selected,
.chip[aria-pressed="true"] {
  color: var(--brand-dark);
  border-color: #ed9a84;
  background: var(--brand-soft);
  font-weight: 750;
}

.selection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -16px;
  padding: 11px 16px calc(11px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}

.selection-bar > div {
  min-width: 0;
  flex: 1;
}

.selection-bar strong,
.selection-bar span {
  display: block;
}

.selection-bar strong {
  font-size: 13px;
}

.selection-bar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.selection-bar .primary {
  min-width: 128px;
  padding: 10px 15px;
}

/* ---------- 撤销 toast ---------- */
.undo-toast {
  position: fixed;
  right: 14px;
  bottom: calc(14px + var(--safe-bottom));
  left: 14px;
  z-index: 28;
  display: flex;
  width: min(calc(100% - 28px), 560px);
  min-height: 54px;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  padding: 7px 8px 7px 14px;
  color: #fff;
  border-radius: 15px;
  background: #2f2723;
  box-shadow: 0 12px 34px rgba(36, 27, 23, .28);
  font-size: 12px;
}

body.has-done-sheet .undo-toast {
  bottom: calc(160px + var(--safe-bottom));
}

.undo-toast span {
  min-width: 0;
  flex: 1;
}

.undo-toast button {
  min-width: 64px;
  min-height: 44px;
  color: #ffd2c5;
  background: transparent;
  font-weight: 800;
}

/* ---------- 确认弹窗 ---------- */
#confirmOverlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(36, 27, 23, .52);
}

.confirm-box {
  width: min(330px, 92vw);
  padding: 20px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.confirm-msg {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.55;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.confirm-actions .danger {
  background: var(--over);
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: max(18px, var(--safe-top)) 14px max(18px, var(--safe-bottom));
  background: rgba(20, 15, 13, .88);
  backdrop-filter: blur(6px);
}

.image-preview-box {
  position: relative;
  display: grid;
  width: min(100%, 560px);
  max-height: 90dvh;
  place-items: center;
}

.image-preview-box img {
  display: block;
  max-width: 100%;
  max-height: 86dvh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .4);
}

.image-preview-close {
  position: absolute;
  top: -14px;
  right: -4px;
  z-index: 1;
  width: 44px;
  min-height: 44px;
  padding: 0;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  background: rgba(24, 18, 16, .8);
  font-size: 17px;
}

@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 148, 10, .5); }
  50% { box-shadow: 0 0 0 6px rgba(217, 148, 10, 0); }
}

@media (min-width: 640px) {
  #appShell {
    padding-right: 20px;
    padding-left: 20px;
  }

  #drawer,
  #settingsSheet {
    bottom: 18px;
    border-radius: 26px;
  }

  .selection-bar {
    border-radius: 0 0 26px 26px;
  }
}

@media (max-width: 390px) {
  #appShell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .timer-photo .countdown {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
