/* 升糖指数 GI 查询 gi-table */
:root {
  --gi-green: #059669;
  --gi-green-soft: #ecfdf5;
  --gi-amber: #d97706;
  --gi-amber-soft: #fffbeb;
  --gi-orange: #ea580c;
  --gi-orange-soft: #fff7ed;
}

/* 左栏筛选 */
.gi-fields { display: grid; gap: 14px; }
.gi-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .gi-inline { grid-template-columns: 1fr; } }
.gi-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.gi-actions .btn { flex: 1; min-width: 130px; }

.gi-legend { margin-top: 16px; padding: 12px 14px; background: var(--gi-orange-soft); border-radius: 12px; font-size: 13px; line-height: 1.9; color: #374151; }
.gi-legend b { color: #111827; }
.gi-legend .lg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 5px 0 10px; vertical-align: 1px; }
.gi-legend .lg-dot:first-child { margin-left: 0; }
.gi-dot-low { background: var(--gi-green); }
.gi-dot-mid { background: var(--gi-amber); }
.gi-dot-high { background: var(--gi-orange); }

/* 结果区 */
.gi-stat-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; font-size: 14px; color: #6b7280; }
.gi-stat-row b { color: var(--gi-orange); font-size: 20px; font-family: ui-monospace, Menlo, Consolas, monospace; }

.gi-list { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 12px; }
.gi-row {
  display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background .15s;
}
.gi-row:last-child { border-bottom: none; }
.gi-row:hover { background: #f8fafc; }
.gi-name { font-weight: 600; color: #111827; font-size: 14px; }
.gi-cat { font-size: 12px; color: #9ca3af; }
.gi-val { font-size: 13px; color: #6b7280; white-space: nowrap; }
.gi-val b { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; color: #111827; }
.gi-go { font-size: 12px; color: #cbd5e1; }
@media (max-width: 560px) {
  .gi-row { grid-template-columns: 1fr auto auto; }
  .gi-cat, .gi-go { display: none; }
}

/* 等级徽章 + 行左色条 */
.gi-badge { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.gi-badge.gi-low { background: var(--gi-green-soft); color: var(--gi-green); }
.gi-badge.gi-mid { background: var(--gi-amber-soft); color: var(--gi-amber); }
.gi-badge.gi-high { background: var(--gi-orange-soft); color: var(--gi-orange); }
.gi-row { border-left: 4px solid transparent; }
.gi-row.gi-low { border-left-color: var(--gi-green); }
.gi-row.gi-mid { border-left-color: var(--gi-amber); }
.gi-row.gi-high { border-left-color: var(--gi-orange); }

/* 详情卡 */
.gi-detail { margin-top: 16px; border: 1px solid #e5e7eb; border-radius: 14px; padding: 16px 18px; background: #fff; }
.gi-detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.gi-detail-head h3 { margin: 0; font-size: 18px; color: #111827; }
.gi-detail-meta { font-size: 13px; color: #6b7280; margin-bottom: 12px; }

.gi-gl-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--gi-orange-soft); border-radius: 12px; margin-bottom: 10px; }
.gi-gl-row .gk { font-size: 13px; color: #374151; }
.gi-gl-num { font-size: 26px; font-weight: 800; color: var(--gi-orange); font-family: ui-monospace, Menlo, Consolas, monospace; }
.gi-gl-badge { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.gi-gl-badge.gl-low { background: var(--gi-green-soft); color: var(--gi-green); }
.gi-gl-badge.gl-mid { background: var(--gi-amber-soft); color: var(--gi-amber); }
.gi-gl-badge.gl-high { background: var(--gi-orange-soft); color: var(--gi-orange); }
.gi-carbs-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: #374151; margin-bottom: 10px; }
.gi-carbs-row b { font-family: ui-monospace, Menlo, Consolas, monospace; color: #111827; font-size: 15px; }
.gi-grams-input { width: 90px; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
.gi-parts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.gi-part { border: 1px solid #e5e7eb; background: #fff; border-radius: 10px; padding: 6px 14px; font-size: 13px; color: #6b7280; cursor: pointer; line-height: 1.5; transition: all .15s; }
.gi-part:hover { border-color: var(--gi-orange); }
.gi-part.is-on { border-color: var(--gi-orange); background: var(--gi-orange-soft); color: var(--gi-orange); font-weight: 600; }
.gi-advice { font-size: 13px; line-height: 1.8; color: #374151; margin: 0; padding: 10px 14px; background: #f9fafb; border-radius: 10px; }

/* 空态 */
.gi-empty-note { text-align: center; color: #9ca3af; font-size: 14px; padding: 28px 10px; }
.gi-empty-note .emoji { font-size: 40px; display: block; margin-bottom: 8px; }

/* 黑夜模式 */
@media (prefers-color-scheme: dark) {
  .gi-legend, .gi-gl-row { background: rgba(234, 88, 12, .14); color: #fed7aa; }
  .gi-gl-row .gk { color: #fed7aa; }
  .gi-legend b { color: #f3f4f6; }
  .gi-stat-row { color: #9ca3af; }
  .gi-list { border-color: #374151; }
  .gi-row { border-bottom-color: #1f2937; }
  .gi-row:hover { background: #1f2937; }
  .gi-name { color: #f3f4f6; }
  .gi-cat { color: #9ca3af; }
  .gi-val { color: #9ca3af; }
  .gi-val b { color: #f3f4f6; }
  .gi-badge.gi-low { background: rgba(5,150,105,.18); color: #6ee7b7; }
  .gi-badge.gi-mid { background: rgba(217,119,6,.18); color: #fbbf24; }
  .gi-badge.gi-high { background: rgba(234,88,12,.18); color: #fb923c; }
  .gi-detail { background: #111827; border-color: #374151; }
  .gi-detail-head h3 { color: #f3f4f6; }
  .gi-gl-num { color: #fb923c; }
  .gi-gl-badge.gl-low { background: rgba(5,150,105,.18); color: #6ee7b7; }
  .gi-gl-badge.gl-mid { background: rgba(217,119,6,.18); color: #fbbf24; }
  .gi-gl-badge.gl-high { background: rgba(234,88,12,.18); color: #fb923c; }
  .gi-carbs-row { color: #d1d5db; }
  .gi-carbs-row b { color: #f3f4f6; }
  .gi-grams-input { background: #1f2937; border-color: #4b5563; color: #f3f4f6; }
  .gi-part { background: #1f2937; border-color: #374151; color: #9ca3af; }
  .gi-part.is-on { background: rgba(234,88,12,.18); color: #fb923c; }
  .gi-advice { background: #1f2937; color: #d1d5db; }
  .gi-detail-meta { color: #9ca3af; }
}
