/* ============================================================
   透析患者饮食配餐计算器 · 样式（与 index.html、toux.js 同目录部署）
   由单文件内联结构拆分而来（2026-11-07），原样式内容未做改动
   ============================================================ */

  :root{
    --green:        #2e7d32;
    --green-dark:   #1b5e20;
    --green-bg:     #e8f5e9;
    --green-soft:   #f2f9f3;
    --line:         #d4e5d5;
    --text:         #243426;
    --text-sub:     #6b7d6c;
    --red:          #c62828;
    --warn:         #8a4b00;
    --lime-bg:      #f1f8e9;
    --lime-border:  #dcedc8;
  }
  *{ margin:0; padding:0; box-sizing:border-box; }
  html{ -webkit-text-size-adjust:100%; }
  body{
    font-family:"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans CJK SC",sans-serif;
    background:var(--green-bg);
    color:var(--text);
    line-height:1.6;
    font-size:16px;
    -webkit-font-smoothing:antialiased;
  }
  .page{ max-width:540px; margin:0 auto; padding:22px 16px calc(36px + env(safe-area-inset-bottom)); }

  header.top{ text-align:center; padding:6px 0 4px; }
  header.top .logo{ display:block; margin:0 auto 10px; box-shadow:0 4px 12px rgba(46,125,50,.28); border-radius:11px; }
  h1{ font-size:22px; font-weight:800; color:var(--green-dark); letter-spacing:.5px; }
  .ref{ margin-top:8px; font-size:12px; color:var(--red); line-height:1.5; padding:0 6px; }
  .visitor{
    display:inline-flex; align-items:center; gap:5px; margin-top:10px;
    background:rgba(255,255,255,.78); border-radius:999px; padding:4px 14px;
    font-size:12px; color:var(--text-sub);
  }
  #visitorNum{
    display:inline-block; font-weight:700; color:var(--green-dark); line-height:1;
    font-variant-numeric:tabular-nums;
  }
  #visitorNum.bump{ animation:bump .5s ease; }
  @keyframes bump{
    0%   { transform:scale(1)    translateY(0); }
    35%  { transform:scale(1.28) translateY(-2px); }
    100% { transform:scale(1)    translateY(0); }
  }

  .card{
    background:#fff; border-radius:16px;
    box-shadow:0 2px 14px rgba(27,94,32,.09);
  }
  .form-card{ padding:22px 18px; margin-top:18px; }
  .result-card{ padding:22px 18px; }
  .sec-title{
    display:flex; align-items:center; gap:8px;
    font-size:16px; font-weight:700; color:var(--green-dark);
    margin:24px 0 16px;
  }
  .sec-title::before{ content:''; width:4px; height:16px; border-radius:2px; background:var(--green); flex:none; }
  .sec-title:first-child{ margin-top:0; }

  .grid2{ display:grid; grid-template-columns:1fr 1fr; gap:16px 12px; }
  .grid2 .field{ margin-bottom:0; }
  .field{ margin-bottom:16px; }
  .field.last{ margin-bottom:0; }
  .field label{
    display:block; font-size:16px; font-weight:600; color:#3c4a3e;
    margin-bottom:7px; line-height:24px;
  }
  .label-row{ display:flex; justify-content:space-between; align-items:baseline; }
  .label-row .hint{ font-size:12px; color:#8aa08c; font-weight:400; }

  .input-wrap{ position:relative; }
  input[type=number]{
    width:100%; height:50px; font-size:18px; font-family:inherit; color:var(--text);
    background:#fbfdfb; border:1.5px solid var(--line); border-radius:12px;
    padding:0 58px 0 14px; outline:none;
    transition:border-color .2s, box-shadow .2s;
  }
  input[type=number]:focus{ border-color:var(--green); box-shadow:0 0 0 3px rgba(46,125,50,.16); }
  input[type=number]::placeholder{ color:#a8bba9; font-size:15px; }
  input[type=number]::-webkit-outer-spin-button,
  input[type=number]::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
  input[type=number]{ -moz-appearance:textfield; appearance:textfield; }
  .unit{
    position:absolute; right:14px; top:50%; transform:translateY(-50%);
    font-size:13px; color:#8aa08c; font-weight:600; pointer-events:none;
  }

  .seg{ display:flex; gap:6px; background:#eef5ee; border-radius:12px; padding:4px; }
  .seg-grid{ display:grid; grid-template-columns:1fr 1fr; gap:6px; }
  .pill{ flex:1; cursor:pointer; }
  .pill input{ position:absolute; opacity:0; pointer-events:none; }
  .pill span{
    display:flex; align-items:center; justify-content:center;
    height:42px; border-radius:9px; font-size:15.5px; color:#4c5f4d;
    transition:background .2s, color .2s, box-shadow .2s;
  }
  .seg-grid .pill span{ font-size:15px; }
  .pill input:checked + span{
    background:var(--green); color:#fff; font-weight:600;
    box-shadow:0 2px 6px rgba(46,125,50,.35);
  }
  .pill input:focus-visible + span{ box-shadow:0 0 0 3px rgba(46,125,50,.25); }

  .sel-wrap{ position:relative; }
  select{
    width:100%; height:50px; font-size:17px; font-family:inherit; color:var(--text);
    background:#fbfdfb; border:1.5px solid var(--line); border-radius:12px;
    padding:0 42px 0 14px; outline:none; appearance:none; -webkit-appearance:none;
    transition:border-color .2s, box-shadow .2s;
  }
  select:focus{ border-color:var(--green); box-shadow:0 0 0 3px rgba(46,125,50,.16); }
  .sel-wrap::after{
    content:''; position:absolute; right:18px; top:50%; margin-top:-2px;
    border:6px solid transparent; border-top-color:var(--green); border-bottom-width:0;
    pointer-events:none;
  }

  .field.invalid{ animation:shake .5s; }
  .field.invalid input, .field.invalid select{ border-color:#e53935; }
  .field.invalid .seg{ outline:2px dashed #e53935; outline-offset:3px; }
  @keyframes shake{
    10%,90%{ transform:translateX(-1px); }
    20%,80%{ transform:translateX(2px); }
    30%,50%,70%{ transform:translateX(-3px); }
    40%,60%{ transform:translateX(3px); }
  }

  .calc-btn{
    display:flex; align-items:center; justify-content:center; gap:9px;
    width:100%; height:54px; margin-top:18px;
    background:var(--green); color:#fff; border:none; border-radius:27px;
    font-size:19px; font-weight:700; letter-spacing:3px; font-family:inherit; cursor:pointer;
    box-shadow:0 6px 16px rgba(46,125,50,.35);
    transition:background .2s, transform .1s, box-shadow .2s;
  }
  .calc-btn:active{ background:#256a29; transform:translateY(1px); box-shadow:0 3px 10px rgba(46,125,50,.3); }
  .calc-btn svg{ flex:none; }

  .result-section{ display:none; }
  .result-section.shown{ display:block; animation:fadeSlide .5s ease; }
  @keyframes fadeSlide{ from{ opacity:0; transform:translateY(14px); } to{ opacity:1; transform:none; } }

  .result-list{ font-size:16px; line-height:2.1; }
  .result-list .item{ opacity:0; }
  .result-list .item.hidden{ display:none; }
  .result-section.shown .result-list .item{ animation:riseIn .45s ease both; }
  .result-section.shown .result-list .item:nth-child(1){ animation-delay:.10s; }
  .result-section.shown .result-list .item:nth-child(2){ animation-delay:.17s; }
  .result-section.shown .result-list .item:nth-child(3){ animation-delay:.24s; }
  .result-section.shown .result-list .item:nth-child(4){ animation-delay:.31s; }
  .result-section.shown .result-list .item:nth-child(5){ animation-delay:.38s; }
  .result-section.shown .result-list .item:nth-child(6){ animation-delay:.45s; }
  .result-section.shown .result-list .item:nth-child(7){ animation-delay:.52s; }
  .result-section.shown .result-list .item:nth-child(8){ animation-delay:.59s; }
  @keyframes riseIn{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }

  .underline{
    display:inline-block; min-width:64px; text-align:center;
    border-bottom:2px solid #2c3a2e; padding:0 6px; margin:0 4px;
    color:var(--green-dark); font-weight:700; font-size:17px; line-height:1.5;
    font-variant-numeric:tabular-nums;
  }
  .underline.long{ min-width:96px; }

  .result-tips{
    margin-top:14px; padding-top:12px; border-top:1px dashed #dcebdd;
    font-size:12px; color:#7b8d7c; line-height:1.85;
  }
  .result-tips p{ margin-bottom:3px; }
  .result-tips p:last-child{ margin-bottom:0; }

  .meal-plan{ margin-top:16px; }
  .meal-plan-header{
    background:var(--lime-bg); color:var(--green-dark);
    padding:13px 20px; font-weight:700; font-size:16px;
    border:1px solid var(--lime-border); border-bottom:none;
    border-radius:12px 12px 0 0;
  }
  .meal-plan-body{
    border:1px solid var(--lime-border);
    border-radius:0 0 12px 12px; padding:18px 20px; background:#fff;
  }

  .meal-list{ font-size:16px; line-height:2; }
  .meal-list .item .underline{ min-width:56px; font-size:16.5px; }
  .meal-list .item .underline.wide{ min-width:72px; }

  .notes{
    margin-top:18px; font-size:13px; color:#555; line-height:1.8;
    background:#f9faf9; border:1px solid #e6f0e7; padding:14px 15px; border-radius:10px;
  }
  .notes p{ margin-bottom:5px; }
  .notes p:last-child{ margin-bottom:0; }

  .accordion{ margin-top:16px; }
  .acc-item{
    background:#fff; border-radius:12px; margin-bottom:10px; overflow:hidden;
    box-shadow:0 2px 8px rgba(27,94,32,.07);
  }
  .acc-header{
    padding:15px 18px; font-weight:700; font-size:15.5px; color:var(--green-dark);
    display:flex; justify-content:space-between; align-items:center; gap:10px;
    cursor:pointer; background:var(--lime-bg); user-select:none;
  }
  .acc-arrow{ color:var(--green); flex:none; display:flex; transition:transform .35s ease; }
  .acc-item.open .acc-arrow{ transform:rotate(180deg); }
  .acc-content{
    max-height:0; overflow:hidden; padding:0 18px;
    transition:max-height .4s ease, padding .4s ease;
  }
  .acc-item.open .acc-content{ padding:16px 18px 18px; }

  .acc-content table{ width:100%; border-collapse:collapse; margin-top:10px; font-size:14px; }
  .acc-content th, .acc-content td{ border:1px solid #dde7dd; padding:8px 6px; text-align:center; }
  .acc-content th{ background:#f2f9f3; color:#3c4a3e; }
  .acc-content h4{ margin:15px 0 6px; color:var(--green); font-size:15px; }
  .acc-content ul{ padding-left:20px; font-size:14px; line-height:1.85; color:#444; }
  .acc-content p{ font-size:14px; line-height:1.8; color:#444; margin-bottom:6px; margin-top:6px; }
  .acc-content .src-note{ font-size:12px; color:#8aa08c; margin-top:8px; }
  .highlight-red{ color:var(--red); font-weight:600; }

  .acc-content .swap-table{ font-size:13px; margin-top:12px; }
  .acc-content .swap-table th, .acc-content .swap-table td{ padding:7px 5px; }
  .acc-content .swap-table td:nth-child(1){ text-align:left; }
  .acc-content .swap-table td:nth-child(3){ text-align:left; font-size:12px; color:#7b8d7c; line-height:1.6; }
  .acc-content .swap-table .swap-group td{
    background:#f2f9f3; font-weight:700; color:#3c4a3e; text-align:left;
  }
  .acc-content .swap-table .swap-note td{
    font-size:12px; color:#7b8d7c; text-align:left;
  }

  .footer-qr{
    text-align:center; margin-top:20px; padding:22px 20px;
    background:var(--green); color:#fff; border-radius:16px;
  }
  .footer-qr p{ font-size:16px; font-weight:600; margin-bottom:15px; }
  .footer-qr .sub{ font-size:14px; font-weight:400; margin:12px 0 0; opacity:.9; line-height:1.7; }

  .disclaimer{ text-align:center; font-size:11.5px; color:#8f9b90; margin-top:18px; line-height:1.7; }

  .toast{
    position:fixed; top:18px; left:50%; z-index:99;
    transform:translate(-50%,-90px); opacity:0;
    background:#fff; border-left:4px solid #d97706; color:var(--warn);
    font-size:15px; font-weight:600; padding:12px 18px; border-radius:12px;
    box-shadow:0 8px 24px rgba(0,0,0,.16); max-width:86vw;
    transition:transform .35s ease, opacity .35s ease;
    pointer-events:none;
  }
  .toast.show{ transform:translate(-50%,0); opacity:1; }
  .toast.ok{ border-left-color:var(--green); color:var(--green-dark); }

  @media (prefers-reduced-motion:reduce){
    *{ animation:none !important; transition:none !important; }
    .result-list .item{ opacity:1; }
  }
