/* =========================================================
   烘焙手帖 · 可交互原型 —— 基础样式
   温暖手作治愈系：奶油白 + 焦糖棕；Georgia / 宋体做标题，无衬线做界面
   ========================================================= */

:root {
  /* 色彩 */
  --bg: #FAF5EC;          /* 奶油白：页面底色 */
  --paper: #FFFCF6;       /* 纸面：输入框、面板 */
  --cream-2: #F3EADB;     /* 浅奶油：悬停 / 弱填充 */
  --cream-3: #EADCC6;     /* 深奶油：强调填充 */
  --line: #E6D9C4;        /* 发丝分隔线 */
  --line-2: #D6C3A6;      /* 较深的线：输入框描边 */
  --caramel: #9C5B27;     /* 焦糖棕：主色 */
  --caramel-2: #B8783A;   /* 浅焦糖：强调 */
  --caramel-deep: #6E3F1C;/* 深焦糖：按下 */
  --caramel-bg: #F5E6D2;  /* 焦糖浅底 */
  --cocoa: #36261A;       /* 正文 */
  --ink-2: #6A5544;       /* 次要文字 */
  --ink-3: #9A8571;       /* 弱文字 */
  --red: #C0392B;         /* 醒目红：通知 */
  --red-deep: #9E2A1F;
  --red-bg: #FCEBE7;
  --green: #66804A;       /* 成功 */
  --green-bg: #EDF1E3;
  --honey: #C8963E;
  --amber-bg: #FBF0D9;

  /* 字体 */
  --serif: Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, SimSun, serif;
  --sans: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* 尺寸 */
  --r-sm: 4px;
  --r: 8px;
  --r-lg: 14px;
  --r-img: 6px;
  --frame: 1440px;
  --header-h: 72px;

  --shadow-pop: 0 18px 48px rgba(54, 38, 26, .16), 0 2px 8px rgba(54, 38, 26, .06);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  min-width: var(--frame);
  background: var(--bg);
  color: var(--cocoa);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--serif); font-weight: 600; letter-spacing: .01em; line-height: 1.3; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
mark { background: #F6DFB8; color: inherit; padding: 0 2px; border-radius: 2px; }
::selection { background: #EBCFA6; }
:focus-visible { outline: 2px solid var(--caramel-2); outline-offset: 2px; }

/* 固定画幅：1440 宽居中 */
.frame { width: var(--frame); margin: 0 auto; }

/* ---------- 文字工具 ---------- */
.serif { font-family: var(--serif); }
.eyebrow {
  font-family: var(--sans);
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--caramel);
}
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-family: var(--serif); font-variant-numeric: oldstyle-nums; }
.clamp-1, .clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }
.req { color: var(--red); margin-left: 2px; }

/* ---------- 图标 ---------- */
.ic { flex: none; vertical-align: middle; }
.ic-fill { fill: currentColor; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--cocoa);
  font-size: 15px; font-weight: 500; white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .1s;
}
.btn:hover { border-color: var(--caramel-2); color: var(--caramel-deep); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--caramel); border-color: var(--caramel); color: #FFF8EE; }
.btn-primary:hover { background: var(--caramel-deep); border-color: var(--caramel-deep); color: #FFF8EE; }
.btn-red { background: var(--red); border-color: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--cream-2); border-color: transparent; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); color: var(--red-deep); background: var(--red-bg); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 14px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); gap: 5px; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.link {
  color: var(--caramel); border-bottom: 1px solid rgba(156, 91, 39, .3);
  transition: border-color .2s, color .2s;
}
.link:hover { color: var(--caramel-deep); border-color: var(--caramel-deep); }
.text-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: 14px;
}
.text-btn:hover { color: var(--caramel-deep); }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field { margin-top: 18px; }
.field-label { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.field-hint { font-size: 12.5px; color: var(--ink-3); }
.field-error { font-size: 13px; color: var(--red); min-height: 0; }
.input, .select, .textarea {
  width: 100%;
  height: 44px; padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--paper);
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.7; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #B8A894; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--caramel-2); box-shadow: 0 0 0 3px rgba(184, 120, 58, .14); }
.input.is-invalid { border-color: var(--red); }
.input-sm { height: 36px; font-size: 14px; padding: 0 12px; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239A8571' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 46px; }
.input-group .input-addon { position: absolute; right: 6px; }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-icon > .input { padding-left: 40px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; user-select: none; }
.check input { accent-color: var(--caramel); width: 16px; height: 16px; margin: 0; }

/* 开关 */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 38px; height: 22px; border-radius: 22px; background: var(--cream-3); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--caramel); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:disabled + .track { opacity: .5; }

/* 分段选择 */
.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); padding: 3px; background: var(--paper); gap: 2px; }
.segmented button { height: 32px; padding: 0 14px; border-radius: 6px; font-size: 14px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.segmented button:hover { color: var(--cocoa); }
.segmented button.is-active { background: var(--caramel); color: #FFF8EE; }

/* ---------- 标签 / 徽标 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 13px; color: var(--ink-2); background: transparent;
  transition: all .2s var(--ease); white-space: nowrap;
}
button.chip:hover, a.chip:hover { border-color: var(--caramel-2); color: var(--caramel-deep); }
.chip.is-active { background: var(--cocoa); border-color: var(--cocoa); color: var(--paper); }
.chip-sm { height: 24px; padding: 0 9px; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 13px; color: var(--ink-3); }
.tag::before { content: "#"; margin-right: 1px; opacity: .7; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 4px;
  font-size: 12px; line-height: 1; white-space: nowrap;
  background: var(--cream-2); color: var(--ink-2);
}
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: #9A6B14; }
.badge-caramel { background: var(--caramel-bg); color: var(--caramel-deep); }
.badge-dark { background: var(--cocoa); color: var(--paper); }
.badge-outline { background: transparent; border: 1px solid var(--line-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; flex: none; }
.count-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}

/* ---------- 图片画框：固定比例 + 等比裁切 ---------- */
.ph { position: relative; overflow: hidden; border-radius: var(--r-img); background: var(--cream-2); }
.ph > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph-4x3 { aspect-ratio: 4 / 3; }
.ph-3x2 { aspect-ratio: 3 / 2; }
.ph-1x1 { aspect-ratio: 1 / 1; }
.ph-16x9 { aspect-ratio: 16 / 9; }
.ph.zoomable { cursor: zoom-in; }
.ph.zoomable > img { transition: transform .5s var(--ease); }
.ph.zoomable:hover > img { transform: scale(1.03); }

/* ---------- 空状态 ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 10px; padding: 56px 24px; color: var(--ink-3);
}
.empty-mark { width: 64px; height: 64px; border-radius: 50%; border: 1px dashed var(--line-2); display: grid; place-items: center; color: var(--caramel-2); margin-bottom: 4px; }
.empty-title { font-family: var(--serif); font-size: 20px; color: var(--cocoa); }

/* ---------- 浮层：模态框 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(54, 38, 26, .34);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s var(--ease);
}
.modal {
  width: 520px; max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  background: var(--paper); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  animation: popIn .26s var(--ease);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 28px 0; }
.modal-title { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.modal-sub { font-size: 14px; color: var(--ink-3); margin-top: 4px; }
.modal-body { padding: 20px 28px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 16px 28px 24px; }
.modal-foot .spacer { flex: 1; }
.modal-close { color: var(--ink-3); margin: -4px -8px 0 0; }
.modal-close:hover { color: var(--cocoa); }

/* 抽屉 */
.overlay.is-drawer { justify-content: flex-end; align-items: stretch; }
.drawer {
  width: 560px; height: 100%; background: var(--paper);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-pop);
  animation: slideIn .28s var(--ease);
}
.drawer .modal-head { padding: 24px 28px 16px; border-bottom: 1px solid var(--line); }
.drawer .modal-body { flex: 1; padding: 24px 28px; }
.drawer .modal-foot { border-top: 1px solid var(--line); padding: 16px 28px; }

/* ---------- 提示 ---------- */
.toast-stack { position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%); z-index: 1200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-radius: 999px;
  background: var(--cocoa); color: var(--paper);
  font-size: 14px; box-shadow: 0 8px 24px rgba(54, 38, 26, .22);
  animation: toastIn .3s var(--ease);
}
.toast .ic { color: #E9C48F; }
.toast.is-error .ic { color: #F29A8D; }
.toast-action { color: #F3C98D; font-weight: 600; margin-left: 6px; }
.toast-action:hover { color: #fff; }
.toast.is-leaving { animation: toastOut .25s var(--ease) forwards; }

/* 画面正中提示（无需确认，自动消失） */
.center-notice {
  position: fixed; left: 50%; top: 50%; z-index: 1300;
  transform: translate(-50%, -50%);
  width: 360px; padding: 30px 30px 26px; text-align: center;
  background: var(--paper); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  animation: noticeIn .3s var(--ease);
  pointer-events: none;
}
.center-notice .cn-mark { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%; background: var(--caramel-bg); color: var(--caramel); display: grid; place-items: center; }
.center-notice .cn-title { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.center-notice .cn-text { color: var(--ink-2); font-size: 14px; margin-top: 6px; }
.center-notice .cn-bar { height: 2px; background: var(--line); border-radius: 2px; margin-top: 18px; overflow: hidden; }
.center-notice .cn-bar::after { content: ""; display: block; height: 100%; background: var(--caramel-2); animation: drain var(--dur, 2.4s) linear forwards; }
.center-notice.is-leaving { animation: noticeOut .25s var(--ease) forwards; }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(30, 21, 14, .92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  animation: fadeIn .2s var(--ease);
}
.lightbox img { max-width: 1080px; max-height: 720px; width: auto; height: auto; border-radius: var(--r-img); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lightbox-cap { color: #EBDDC8; margin-top: 18px; font-size: 14px; display: flex; gap: 14px; align-items: center; }
.lightbox-cap .num { color: #BBA78E; }
.lightbox-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; color: #F3E6D3; border: 1px solid rgba(243, 230, 211, .25); display: grid; place-items: center; }
.lightbox-btn:hover { background: rgba(243, 230, 211, .1); }
.lightbox-btn.prev { left: 48px; }
.lightbox-btn.next { right: 48px; }
.lightbox-close { position: absolute; top: 28px; right: 36px; color: #F3E6D3; }

/* 弹出菜单 */
.popover {
  position: absolute; z-index: 300; min-width: 180px;
  background: var(--paper); border-radius: var(--r);
  box-shadow: var(--shadow-pop); padding: 6px;
  animation: popIn .18s var(--ease);
}
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 6px; font-size: 14px; color: var(--ink-2); text-align: left; }
.menu-item:hover { background: var(--cream-2); color: var(--cocoa); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* 提示条（AI 等） */
.notice-line {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; border-radius: var(--r);
  font-size: 13.5px; line-height: 1.65; color: var(--ink-2);
  background: var(--cream-2);
}
.notice-line .ic { margin-top: 2px; color: var(--caramel); }
.notice-line.is-warn { background: #FBF0DF; }
.notice-line.is-warn .ic { color: #B9741F; }
.notice-line.is-ok { background: var(--green-bg); }
.notice-line.is-ok .ic { color: var(--green); }

/* 原型说明框 */
.proto-hint {
  border: 1px dashed var(--line-2); border-radius: var(--r);
  padding: 10px 14px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7;
  background: rgba(255, 252, 246, .6);
}
.proto-hint b { color: var(--ink-2); font-weight: 600; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--cream-2); color: var(--cocoa); }

/* 骨架闪烁 */
.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--caramel-2); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

/* 滚动条 */
.scroll-y { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.scroll-y::-webkit-scrollbar { width: 8px; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------- 动画 ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
@keyframes noticeIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes noticeOut { to { opacity: 0; transform: translate(-50%, -52%) scale(.98); } }
@keyframes drain { from { width: 100%; } to { width: 0; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes flash { 0% { background: #F8E3C4; } 100% { background: transparent; } }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(192, 57, 43, .45); } 70% { box-shadow: 0 0 0 8px rgba(192, 57, 43, 0); } 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); } }

/* ---------- 原型导航面板 ---------- */
.proto-fab {
  position: fixed; left: 20px; bottom: 20px; z-index: 1000;
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px 0 12px; border-radius: 999px;
  background: var(--cocoa); color: var(--paper); font-size: 13px;
  box-shadow: 0 8px 22px rgba(54, 38, 26, .25);
  opacity: .88; width: 40px; padding: 0 12px; overflow: hidden; white-space: nowrap;
  transition: width .25s var(--ease), opacity .2s;
}
.proto-fab:hover, .proto-fab.is-open { opacity: 1; width: 112px; }
.proto-panel {
  position: fixed; left: 20px; bottom: 70px; z-index: 1000;
  width: 400px; max-height: calc(100vh - 100px);
  background: var(--paper); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  animation: popIn .2s var(--ease);
  font-size: 13.5px;
}
.proto-panel header { padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.proto-panel header h4 { font-size: 18px; }
.proto-panel .pp-body { padding: 8px 20px 18px; overflow: auto; }
.proto-panel .pp-sec { padding-top: 14px; }
.proto-panel .pp-sec-title { font-size: 12px; letter-spacing: .12em; color: var(--ink-3); margin-bottom: 8px; }
.proto-panel .pp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.proto-panel .pp-link { display: flex; gap: 8px; align-items: baseline; padding: 5px 8px; border-radius: 6px; color: var(--ink-2); }
.proto-panel .pp-link:hover { background: var(--cream-2); color: var(--cocoa); }
.proto-panel .pp-link .num { color: var(--caramel); font-size: 12px; min-width: 26px; font-family: var(--mono); }
.proto-panel .pp-link.is-current { background: var(--caramel-bg); color: var(--caramel-deep); }
.proto-panel .pp-row { display: flex; gap: 8px; flex-wrap: wrap; }
.proto-panel .pp-acc { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; color: var(--ink-2); font-size: 13px; }
.proto-panel .pp-acc span:nth-child(odd) { color: var(--ink-3); }
