/* 酿酒之星 · 配方设计
   跟门户同一套配色（深底 + 青色点缀），这样从首页点进来不像跳到了别的网站。
   纯静态、零依赖，没有构建步骤。 */

:root {
  --bg: #0a0d10;
  --card: #101820;
  --card2: #0d141b;
  --line: rgba(24, 224, 255, 0.14);
  --line-strong: rgba(24, 224, 255, 0.32);
  --cyan: #18e0ff;
  --cyan-dim: #7fe6f7;
  --amber: #ffb242;
  --green: #07c160;
  --red: #ff6b6b;
  --text: #e7eef3;
  --muted: #8d9aa5;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
b, strong { color: #fff; font-weight: 600; }

.wrap { width: min(1180px, 94vw); margin: 0 auto; }

/* ============ 顶栏 ============ */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 13, 16, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(24, 224, 255, 0.9), rgba(24, 224, 255, 0.35));
  color: #04202a; font-weight: 800; font-size: 17px;
  box-shadow: 0 0 20px rgba(24, 224, 255, 0.32);
}
.brand-text { font-size: 16px; font-weight: 700; letter-spacing: 0.4px; }
.brand-text em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.nav-links { display: flex; gap: 22px; font-size: 13px; color: #c4ced6; }
.nav-links a:hover { color: var(--cyan); }

/* ============ 页头 ============ */
.page { padding: 26px 0 60px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 26px; letter-spacing: 0.5px; }
.lead { margin-top: 8px; color: var(--muted); max-width: 760px; }
.lead b { color: var(--cyan-dim); }

/* ============ 布局 ============ */
/* **结果在左、编辑在右**（2026-10-13 按用户习惯调的：他习惯算出来的数在左边）。
   为什么用 order 而不是把两块 HTML 对调：视觉顺序一行 CSS 就能翻过来，
   DOM 不用动 —— 省掉搬一百多行 HTML 的风险，id 都是按 id 取的，跟顺序无关。
   窄屏那档会把 order 复原（见文件末尾），手机上仍然是"先编辑、后看结果"。 */
.layout { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 18px; align-items: start; }
.edit { display: flex; flex-direction: column; gap: 14px; order: 1; }
.result { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 78px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.card h2 { font-size: 15px; letter-spacing: 0.5px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card > h2 { margin-bottom: 12px; }

.hint { font-size: 12px; color: var(--muted); line-height: 1.75; margin-top: 10px; }
.sum { font-size: 12px; color: var(--cyan-dim); margin-top: 10px; }

/* ============ 批次参数 ============ */
.grid-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 12px; }
.grid-params label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.unit { color: #6f7c86; }

input[type="number"], select, input[type="text"] {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--card2); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; appearance: none;
}
input[type="number"]:focus, select:focus { outline: none; border-color: var(--line-strong); }
select { cursor: pointer; }
select option { background: #0d141b; color: var(--text); }

/* ============ 配方行 ============ */
.rows { display: flex; flex-direction: column; gap: 8px; }

/* 麦芽行：下拉 + 用量 + 删 */
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 118px 28px;
  gap: 8px; align-items: center;
}
/* 酒花行字段多，用 flex 换行，窄屏也不会挤成一团 */
.hop-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hop-row .hop-sel { flex: 1 1 190px; min-width: 150px; }
.row-yeast { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-yeast select { flex: 1 1 240px; }

/* 带单位的小输入框：单位跟在数字后面，短一点不占地方 */
.mini-field { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #6f7c86; }
.mini-field input { width: 72px; padding: 7px 8px; }

.btn-mini {
  font-family: inherit; font-size: 12px; cursor: pointer;
  background: rgba(24, 224, 255, 0.08); color: var(--cyan-dim);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px;
}
.btn-mini:hover { background: rgba(24, 224, 255, 0.16); color: #fff; }

.btn-del {
  font-family: inherit; font-size: 16px; line-height: 1; cursor: pointer;
  background: none; border: 0; color: #5b6771; padding: 4px;
}
.btn-del:hover { color: var(--red); }

/* ============ 结果面板 ============ */
.heads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.heads + .heads { margin-top: 10px; }
.head-item {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 12px; position: relative; min-height: 84px;
}
.head-item .k { display: block; font-size: 11px; color: var(--muted); }
.head-item b {
  display: block; font-size: 23px; font-weight: 700; line-height: 1.25; margin-top: 3px;
  font-variant-numeric: tabular-nums; color: #fff;
}
.head-item .v { font-size: 11px; color: var(--muted); }
/* ============ 酒体颜色：一整杯酒（2026-10-13 加）============
   为什么不用原来的小色块：颜色是配方里最直观的一个结果，26×26 的方块太不起眼。
   杯身是内联 SVG（不是图片），酒体那一条的 fill 由 JS 按 SRM 实时改。 */
.beer-view {
  display: flex; align-items: center; gap: 16px;
  margin-top: 12px; padding: 12px 14px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 11px;
}
.beer-glass { width: 62px; height: 92px; flex: none; }
.glass-body { fill: rgba(255, 255, 255, 0.05); stroke: rgba(255, 255, 255, 0.30); stroke-width: 2.5; stroke-linejoin: round; }
.beer-foam { fill: rgba(255, 255, 255, 0.86); }
.beer-foam-edge { fill: rgba(255, 255, 255, 0.42); }
.beer-glint { fill: rgba(255, 255, 255, 0.16); }
.beer-meta { display: flex; flex-direction: column; min-width: 0; }
.beer-meta .k { font-size: 11px; color: var(--muted); }
.beer-meta b { font-size: 22px; font-weight: 700; line-height: 1.25; color: #fff; font-variant-numeric: tabular-nums; }
.beer-meta .v { font-size: 11px; color: var(--muted); }
.beer-word { font-size: 12px; color: var(--cyan-dim); margin-top: 5px; }

.water { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.water h3 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.water-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; }
.water-grid div {
  display: flex; align-items: baseline; justify-content: space-between;
  background: var(--card2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
}
.water-grid span { font-size: 12px; color: var(--muted); }
.water-grid b { font-size: 15px; font-variant-numeric: tabular-nums; }

.msgs { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.msg { font-size: 12px; line-height: 1.7; padding-left: 16px; position: relative; }
.msg::before { position: absolute; left: 0; top: 0; }
.msg-warn { color: var(--amber); }
.msg-warn::before { content: '!'; font-weight: 700; }
.msg-note { color: var(--muted); }
.msg-note::before { content: '·'; }

/* ============ 风味标签 ============ */
.flavor-box { display: flex; flex-wrap: wrap; gap: 6px; }
.flavor-tag {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 178, 66, 0.10); border: 1px solid rgba(255, 178, 66, 0.28);
  color: var(--amber);
}
.flavor-tag.muted { background: rgba(255, 255, 255, 0.04); border-color: var(--line); color: var(--muted); }

/* ============ 保存区 ============ */
.save-card { display: flex; flex-direction: column; gap: 9px; }
.btn-primary, .btn-line {
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
}
.btn-primary { background: linear-gradient(135deg, #24e6ff, #0aa8c9); color: #03222b; }
.btn-line { background: none; border-color: var(--line-strong); color: var(--cyan-dim); }
.btn-primary:disabled, .btn-line:disabled { opacity: 0.42; cursor: not-allowed; }
.btn-primary:not(:disabled):hover, .btn-line:not(:disabled):hover { filter: brightness(1.08); }

.src-note { font-size: 11px; color: #6f7c86; line-height: 1.8; }

/* ============ 嵌在控制台里（`/recipe/?embed=1`）============
   控制台左栏已经有导航了，自己这套顶栏再顶一遍很乱 ⇒ 收起来，上边距也收紧一点。 */
body.embed .nav { display: none; }
body.embed .page { padding: 4px 0 40px; }

/* 下发那一行：设备下拉 + 按钮 */
.send-row { display: flex; gap: 8px; }
.send-row select {
  flex: 1 1 auto; min-width: 0; font-family: inherit; font-size: 13px;
  padding: 9px 10px; border-radius: 10px;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line-strong);
}
.send-row select:disabled { opacity: 0.5; }
/* 第二块（保存）前面的标题：跟上面那块拉开一点 */
.save-h2 { margin-top: 8px; }

/* ============ 反向求解（2026-10-12 加）============
   ⚠️ 2026-10-13 位置换了：原来在结果卡片最上面，现在挪到**数值和啤酒杯下面**。
   用户的原话是"一进来先看算出来的数，再调目标"—— 所以顺序变成：
     先给结果（OG / FG / 酒精度 / 苦度 / 色度 / 啤酒杯），再给"我想要什么"的目标栏。
   margin-top 给 16px：上面是啤酒杯那块，不留空隙会贴在一起。 */
.target-bar {
  display: grid;
  /* 三个目标：OG / 酒精度 / 苦度（2026-10-13 加酒精度后从 2 列改 3 列） */
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
  margin: 16px 0 4px;
  background: rgba(24, 224, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.target-field { display: flex; flex-direction: column; gap: 5px; }
.target-field.wide { grid-column: 1 / -1; }
.target-field label { font-size: 11px; color: var(--muted); }
.target-field input,
.target-field select {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.target-field input:focus,
.target-field select:focus { outline: none; border-color: var(--line-strong); }
.btn-target {
  grid-column: 1 / -1;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #03222b;
  background: linear-gradient(135deg, #24e6ff, #0aa8c9);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.btn-target:hover { filter: brightness(1.08); }

/* ============ 风格对照（2026-10-12 加）============ */
.style-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
  padding: 10px 12px;
  background: rgba(24, 224, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.style-bar label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.style-bar select {
  flex: 1 1 180px;
  min-width: 0;
  font-family: inherit;
  font-size: 12px;
  padding: 6px 8px;
  color: var(--text);
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.style-summary { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.style-summary .st-ok,
.style-summary .st-off {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: help;
}
.style-summary .st-ok { color: var(--green); background: rgba(7, 193, 96, 0.12); }
.style-summary .st-off { color: var(--amber); background: rgba(255, 178, 66, 0.12); }

/* 酵母投量、反解结果里的数字要跳出来（它们是这两块的重点） */
#yeast-pitch b,
#target-hint b { color: var(--cyan-dim); }

/* ============ 窄屏 ============ */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  /* 复原成"先编辑、后结果"：手机上打开这一页就是想改配方，
     不该先让人滚一屏数字才能碰到输入框 */
  .edit { order: 0; }
  .result { position: static; }
  .heads { grid-template-columns: repeat(2, 1fr); }
  .target-bar { grid-template-columns: 1fr; }
}
