@layer reset, layout, components, responsive;
@layer reset {
  :root { color-scheme: light; --cream:#faf6ee; --paper:#fffdf8; --ink:#302719; --muted:#6d6456; --sage:#4e6745; --sage-dark:#394f32; --mint:#e5eedf; --peach:#fbe3d5; --border:#e7decf; --shadow:0 4px 14px #60462309; font-family:"Noto Sans TC","Microsoft JhengHei",system-ui,sans-serif; color:var(--ink); background:var(--cream); }
  * { box-sizing:border-box; }
  body { margin:0; }
  button,input,select,textarea { font:inherit; color:inherit; }
  button, summary { cursor:pointer; }
  a { color:var(--sage-dark); text-underline-offset:.2em; }
  h1,h2,h3,p,dl,dd { margin:0; }
  p { line-height:1.65; }
  img { max-width:100%; display:block; }
  svg { flex:none; vertical-align:middle; }
  :focus-visible { outline:3px solid #8b6134; outline-offset:4px; }
  h1:focus { outline:none; }
  .sr-only,.skip:not(:focus) { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
  .skip:focus { position:fixed; z-index:9; left:16px; top:12px; padding:12px; background:white; }
}
@layer layout {
  .side { position:fixed; inset:0 auto 0 0; z-index:2; width:232px; background:#fffaf2; border-right:1px solid var(--border); padding:27px 19px; display:flex; flex-direction:column; }
  .brand { display:flex; align-items:center; gap:10px; color:#372819; text-decoration:none; width:max-content; }
  .brand-icon { background:#e8eddd; color:#4e6745; width:43px; height:43px; display:grid; place-items:center; border-radius:14px; }
  .brand strong { display:block; font-size:20px; letter-spacing:.05em; line-height:1.15; font-weight:850; }
  .brand small { display:block; color:var(--sage); font-size:12px; font-weight:800; letter-spacing:.05em; margin-top:4px; }
  .side nav { margin-top:43px; display:grid; gap:7px; }
  .nav-link { text-decoration:none; font-size:14px; font-weight:730; color:var(--muted); padding:13px 12px; border-radius:13px; display:flex; align-items:center; gap:12px; min-height:44px; }
  .nav-link:hover { background:#f3eee5; }
  .nav-link[aria-current] { background:var(--mint); color:var(--sage-dark); }
  .side-foot { margin-top:auto; padding:13px 7px 0; border-top:1px solid var(--border); color:var(--muted); font-size:12px; }
  .status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#7b965d; margin-right:8px; }
  .shell { margin-left:232px; }
  .topbar { border-bottom:1px solid var(--border); background:#fbf8f1; }
  .top-inner { display:flex; justify-content:space-between; align-items:center; margin:auto; min-height:70px; padding:10px 36px; max-width:1240px; gap:12px; }
  .topbar .brand, .mobile-nav, .health-shortcut, .mobile-only { display:none; }
  .breadcrumb { font-weight:800; color:var(--sage-dark); font-size:15px; }
  .top-actions { display:flex; align-items:center; gap:10px; min-width:0; }
  .content { width:100%; max-width:1240px; margin:auto; padding:32px 36px 0; }
  .site-footer { max-width:1240px; margin:auto; padding:30px 36px; font-size:12px; color:var(--muted); }
  .site-footer span { padding:0 5px; }
  .tools-grid,.recipe-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:15px; }
  .home-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
  .form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
  .wide { grid-column:1 / -1; }
  .row { display:flex; align-items:center; gap:13px; min-width:0; }
  .row p,.row h2,.row h3 { overflow-wrap:anywhere; }
  .stack { display:grid; gap:16px; }
  .grow { flex:1; min-width:0; }
}
@layer components {
  h1 { font-size:clamp(28px,4vw,43px); line-height:1.23; letter-spacing:.02em; font-weight:850; }
  h2 { font-size:21px; line-height:1.45; font-weight:820; }
  h3 { font-size:17px; line-height:1.45; }
  .hero { min-height:302px; background:#f1f3e4; border:1px solid #dde5d0; border-radius:26px; overflow:hidden; position:relative; display:grid; grid-template-columns:1.18fr .82fr; align-items:center; isolation:isolate; }
  .hero-text { padding:28px 0 29px 32px; z-index:1; }
  .hero-label,.kicker { display:flex; align-items:center; gap:6px; color:var(--sage-dark); font-weight:800; font-size:13px; margin-bottom:9px; letter-spacing:.07em; }
  .hero h1 { color:#374b30; font-size:clamp(32px,4.15vw,58px); line-height:1.15; }
  .hero h1 span { color:#bb704b; }
  .hero p { margin:12px 0 17px; color:#555d48; font-size:15px; }
  .hero-art { display:grid; place-items:center; align-self:stretch; position:relative; }
  .hero-art img { width:min(87%,350px); mix-blend-mode:multiply; position:relative; image-rendering:auto; }
  .hero-art::before { content:""; width:min(75%,300px); aspect-ratio:1; position:absolute; background:#e6ebd5; border-radius:50%; opacity:.8; }
  .spark { position:absolute; color:#bd8137; font-size:32px; z-index:1; }
  .spark.one { top:13%; right:18%; }
  .spark.two { bottom:14%; left:5%; font-size:25px; color:#819364; }
  .section-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin:21px 0 9px; }
  .section-head .button { text-wrap:nowrap; }
  .stack > .section-head { margin:0; }
  .panel,.tool-card { background:var(--paper); border:1px solid var(--border); border-radius:18px; box-shadow:var(--shadow); min-width:0; }
  .padded { padding:20px; }
  .tool-card { padding:16px; text-align:left; display:grid; justify-items:start; gap:7px; align-content:start; color:var(--ink); transition:transform .15s, border-color .15s; }
  .tool-card:hover { border-color:#9aaa8d; transform:translateY(-2px); }
  .tool-icon { display:inline-grid; place-items:center; width:54px; height:54px; border-radius:15px; flex:none; }
  .tool-icon.small { width:48px; height:48px; }
  .mint { background:#e1edde; color:#426b52; }
  .peach { background:var(--peach); color:#9f4e35; }
  .yellow { background:#f6ead2; color:#805b29; }
  .tool-card p,.home-card p,.row p,.muted { color:var(--muted); font-size:14px; }
  .tool-link { margin-top:3px; display:flex; align-items:center; gap:5px; color:var(--sage-dark); font-size:13px; font-weight:800; }
  .home-card { padding:15px; min-height:122px; }
  .home-card .badge:last-child { margin-left:auto; }
  .tagline-row { margin-top:11px; display:flex; gap:7px; flex-wrap:wrap; }
  .badge { display:inline-block; border-radius:99px; background:#e7efdd; padding:4px 9px; font-size:12px; font-weight:750; white-space:nowrap; color:#3d5735; }
  .badge.sand { background:#f9ead7; color:#795230; }
  .avatar { display:grid; place-items:center; width:52px; height:52px; overflow:hidden; border-radius:50%; color:#895538; background:#f4e6d7; outline:1px solid #d8bd94; flex:none; }
  .avatar img { width:100%; height:100%; object-fit:cover; }
  .avatar.tiny { width:27px; height:27px; }
  .avatar.tiny svg { width:17px; }
  .avatar.large { width:70px; height:70px; }
  .picker { display:flex; align-items:center; gap:6px; background:var(--paper); border:1px solid var(--border); border-radius:12px; min-height:44px; padding:4px 7px; min-width:0; }
  .picker select { border:0; background:none; font-weight:800; min-height:34px; max-width:180px; padding:2px 3px; font-size:13px; }
  .page-title { display:flex; justify-content:space-between; gap:14px; align-items:end; margin:5px 0 21px; }
  .page-title p { margin-top:8px; color:var(--muted); }
  .button { display:inline-flex; align-items:center; justify-content:center; gap:6px; width:fit-content; border:1px solid transparent; padding:8px 13px; border-radius:11px; min-height:43px; font-weight:770; font-size:14px; text-decoration:none; }
  .button.primary { background:var(--sage); color:white; }
  .button.primary:hover { background:var(--sage-dark); }
  .button.secondary { background:var(--paper); border-color:var(--border); color:#514632; }
  .button.secondary:hover { background:#f7eee0; }
  .button.link { padding:5px 3px; background:none; color:var(--sage-dark); }
  .button.link:hover { text-decoration:underline; }
  .button.danger { background:#fbe3d5; color:#8c382b; }
  .button-row { display:flex; flex-wrap:wrap; align-items:center; gap:9px; }
  .icon-button { border:1px solid var(--border); border-radius:12px; background:var(--paper); color:var(--sage-dark); width:44px; height:44px; place-items:center; }
  .notice { display:flex; align-items:flex-start; gap:10px; background:#f0f2e7; color:#3f5035; border:1px solid #dfe6d5; border-radius:14px; padding:13px 15px; margin:16px 0; font-size:14px; }
  .notice svg { margin-top:2px; }
  .notice p { margin-top:3px; }
  .stack > .notice { margin:0; }
  .cat-overview { padding:17px; display:flex; flex-wrap:wrap; gap:13px; justify-content:space-between; align-items:center; }
  .tabs { display:flex; flex-wrap:wrap; gap:5px; padding:5px; border:1px solid var(--border); border-radius:14px; background:#f4ecdf; width:fit-content; margin:14px 0; }
  .button.tab { background:transparent; color:var(--muted); min-height:38px; }
  .button.tab.active { background:var(--peach); color:#773d27; }
  .facts > div { display:grid; grid-template-columns:minmax(120px, .55fr) minmax(0,1fr); gap:10px; align-items:baseline; border-bottom:1px solid var(--border); padding:12px 0; font-size:14px; }
  .facts > div:last-child { border-bottom:0; }
  .facts dt { color:var(--muted); }
  .facts dd { font-weight:680; white-space:pre-wrap; overflow-wrap:anywhere; }
  .steps { list-style:none; padding:0; margin:0 0 17px; display:flex; gap:8px; }
  .steps li { display:flex; align-items:center; gap:7px; flex:1; background:#f1ebdf; border-radius:12px; padding:9px; color:#655a49; font-size:14px; font-weight:730; }
  .steps li b { display:grid; place-items:center; width:24px; height:24px; border-radius:50%; background:var(--paper); flex:none; }
  .steps li.current { color:#743d29; background:var(--peach); }
  .upload { min-height:200px; border:1px dashed #a8b697; border-radius:16px; background:#f4f6ed; padding:20px; display:grid; align-content:center; justify-items:center; text-align:center; gap:8px; }
  .upload p { font-size:14px; color:var(--muted); max-width:46ch; }
  .file-action { position:relative; overflow:hidden; cursor:pointer; }
  .file-action:focus-within { outline:3px solid #8b6134; outline-offset:3px; }
  .file-action input { position:absolute; inset:0; width:100%; opacity:0; cursor:pointer; }
  .separated { margin-top:14px; }
  .list { overflow:hidden; }
  .list button { display:flex; align-items:center; gap:10px; padding:12px 14px; width:100%; background:none; border:0; text-align:left; min-height:48px; }
  .list button:hover { background:#f1f3e4; }
  .list button + button { border-top:1px solid var(--border); }
  .list button > span:first-child { flex:1; overflow-wrap:anywhere; }
  .empty { font-size:14px; color:var(--muted); padding:16px; }
  .field { display:grid; align-content:start; gap:6px; min-width:0; font-size:14px; font-weight:750; }
  input,textarea,select { min-width:0; min-height:43px; border:1px solid #d9d0bf; border-radius:9px; background:#fffdf8; padding:8px 10px; }
  textarea { resize:vertical; }
  .label-photo { width:100%; max-height:340px; object-fit:contain; background:#eee6d8; border-radius:13px; }
  fieldset { margin:0; min-width:0; border:1px solid var(--border); border-radius:11px; padding:8px; }
  legend { padding:0 4px; font-size:14px; font-weight:750; }
  .values { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
  .values select { font-size:14px; }
  .check-line { display:flex; align-items:center; gap:9px; min-height:44px; color:#4b4235; font-size:14px; line-height:1.5; cursor:pointer; }
  input[type="checkbox"] { min-height:0; accent-color:var(--sage); width:19px; height:19px; flex:none; }
  .nutrient-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:6px; }
  .nutrient-grid > div { display:grid; gap:4px; background:#f5f0e5; border-radius:9px; padding:8px; font-size:13px; overflow-wrap:anywhere; }
  .nutrient-grid span,.meta { font-size:12px; color:var(--muted); overflow-wrap:anywhere; }
  .plan-nav { display:flex; align-items:center; justify-content:space-between; padding:8px; }
  .days { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:5px; margin-bottom:12px; }
  .days button { display:grid; gap:3px; justify-items:center; padding:7px 1px; background:var(--paper); border:1px solid var(--border); border-radius:10px; min-height:49px; }
  .days button[aria-current] { background:var(--peach); color:#733c27; border-color:#efc4ad; }
  .day-section { border-top:1px solid var(--border); }
  .day-head { display:flex; align-items:center; justify-content:space-between; background:none; border:0; width:100%; padding:9px 0; min-height:44px; color:var(--sage-dark); font-weight:800; }
  .day-empty { padding-bottom:7px; }
  .meal-entry { display:flex; align-items:center; gap:9px; padding:8px; background:#f6f1e8; border-radius:12px; }
  .meal-entry + .meal-entry { margin-top:5px; }
  .meal-check { display:grid; place-items:center; width:42px; height:42px; background:var(--paper); border:1px solid #beb6a6; border-radius:10px; flex:none; }
  .meal-check[aria-pressed="true"] { background:var(--sage); color:white; }
  .meal-title { display:grid; text-align:left; background:none; border:0; flex:1; min-width:0; overflow-wrap:anywhere; }
  .meal-title span,.meal-title small,.meal-energy { font-size:12px; color:var(--muted); }
  .meal-energy { white-space:nowrap; }
  .shopping { margin-top:12px; }
  .shopping label { border-top:1px solid var(--border); overflow-wrap:anywhere; }
  dialog { color:var(--ink); background:var(--paper); width:min(620px, calc(100% - 24px)); max-height:85dvh; border:1px solid var(--border); border-radius:18px; padding:18px; }
  dialog::backdrop { background:#342b1c66; }
  .toast { position:fixed; bottom:18px; right:18px; z-index:5; padding:10px 14px; background:#34492f; color:white; border-radius:10px; max-width:min(90vw,340px); font-size:14px; pointer-events:none; animation:toast-hide .2s 4s both; }
  @keyframes toast-hide { to { opacity:0; visibility:hidden; } }
}
@layer responsive {
  @media (max-width:920px) {
    .side { width:195px; padding-inline:13px; }
    .shell { margin-left:195px; }
    .content,.top-inner,.site-footer { padding-inline:20px; }
  }
  @media (max-width:720px) {
    .side,.breadcrumb { display:none; }
    .shell { margin:0 0 calc(64px + env(safe-area-inset-bottom)); }
    .topbar .brand { display:flex; }
    .topbar .brand strong { font-size:16px; }
    .topbar .brand small { font-size:10px; }
    .topbar .brand-icon { width:35px; height:35px; border-radius:11px; }
    .topbar .brand-icon svg { width:19px; }
    .health-shortcut { display:grid; }
    .top-inner { min-height:60px; padding-inline:14px; }
    .top-actions { gap:5px; }
    .picker select { max-width:97px; }
    .picker { padding-inline:4px; gap:3px; }
    .picker .avatar { display:none; }
    .install { font-size:0; padding-inline:8px; }
    .content { padding:14px 13px 0; }
    .site-footer { padding:22px 13px 12px; }
    .mobile-nav { position:fixed; z-index:4; inset:auto 0 0 0; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:2px; background:#fffaf2; padding:4px 4px calc(4px + env(safe-area-inset-bottom)); border-top:1px solid var(--border); }
    .mobile-nav .nav-link { display:grid; gap:2px; justify-items:center; align-content:center; min-height:52px; padding:3px 0; font-size:11px; white-space:nowrap; }
    .toast { bottom:calc(70px + env(safe-area-inset-bottom)); }
    .hero { min-height:235px; grid-template-columns:1.25fr .75fr; }
    .hero-text { padding:20px 0 21px 15px; }
    .hero h1 { font-size:clamp(24px,5.5vw,38px); }
    .hero p { font-size:13px; margin:8px 0 12px; }
    .hero-art img { width:100%; max-width:170px; margin-right:7px; }
    .hero-art::before { width:94%; }
    .spark.one { top:18%; font-size:20px; }
    .spark.two { bottom:17%; }
    .mobile-only { display:block; }
    .section-head h2 { font-size:19px; }
    .tool-card { padding:10px; }
    .tools-grid,.recipe-grid { gap:7px; }
    .tool-card h3 { font-size:14px; }
    .tool-card p { font-size:12px; }
    .tool-link { font-size:11px; }
    .tool-icon { width:44px; height:44px; }
    .tool-icon svg { width:24px; }
    .home-grid { gap:7px; }
    .home-card { padding:10px; }
    .home-card .row { flex-wrap:wrap; gap:8px; }
    .home-card .row .badge { margin:0; }
    .home-card p { font-size:12px; }
    .page-title { flex-wrap:wrap; }
    .page-title p { font-size:14px; }
    .padded { padding:13px; }
    .nutrient-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  }
  @media (max-width:365px) {
    .hero h1 { font-size:23px; }
    .hero-label { font-size:11px; }
    .form-grid { grid-template-columns:1fr; }
    .recipe-grid { grid-template-columns:1fr; }
    .topbar .brand { gap:4px; }
  }
  @media (prefers-reduced-motion:reduce) {
    .tool-card { transition:none; }
  }
}
