/* ============================================================================
 * layout.css — 工具站页面版式
 * ============================================================================
 * 规则取值保持稳定：请勿改动既有规则。
 * 色值 / 圆角 / 字体栈统一走 tokens.css 的 --tool-* 令牌。
 *
 * 依赖：assets/css/tokens.css、assets/css/header.css 的 :root 令牌
 * © qiqicto.com 其其网ICT工具箱 · 未经许可禁止复制分发
 * ========================================================================== */

/* ============ 工具站页面样式 ============ */
body {
  background: var(--tool-bg);
  color: var(--theme-black-color);
  font-family: var(--theme-font-family);
  font-size: 15px;
  line-height: 1.7;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}
.wrap { margin: 0 auto; max-width: var(--container-width); padding: 0 20px; }

/* 顶部说明条 */
.notice {
  background: var(--tool-surface);
  border-bottom: 1px solid var(--tool-line);
  color: var(--theme-light-color);
  font-size: 13px;
  padding: 8px 0;
}
.notice .wrap { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.notice b { color: var(--theme-color); font-weight: 600; }

/* Hero */
.hero { padding: 44px 0 8px; }
.hero h2 { font-size: 30px; font-weight: 600; line-height: 1.35; margin: 0 0 10px; }
.hero p { color: var(--theme-light-color); margin: 0 0 6px; max-width: 720px; }
.hero .meta { color: var(--theme-light-color); font-size: 13px; margin-top: 14px; }
.hero .meta span { margin-right: 16px; white-space: nowrap; }

/* 区块标题 */
.sec { margin-top: 34px; }
.sec > h3 {
  align-items: baseline; display: flex; font-size: 19px; font-weight: 600;
  gap: 10px; margin: 0 0 14px;
}
.sec > h3 small { color: var(--theme-light-color); font-size: 13px; font-weight: 400; }

/* 工具卡片网格 */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card {
  background: var(--tool-surface); border: 1px solid var(--tool-line); border-radius: var(--tool-radius-l);
  display: block; padding: 18px; position: relative; transition: box-shadow .2s, transform .2s, border-color .2s;
  text-decoration: none;
}
.card:hover { border-color: var(--tool-accent-line); box-shadow: var(--tool-shadow-hover); transform: translateY(-2px); }
.card .card-icon {
  align-items: center; background: var(--tool-accent-weak); border-radius: var(--tool-radius-l);
  color: var(--theme-color); display: flex; font-size: 17px; height: 38px;
  justify-content: center; margin-bottom: 12px; width: 38px;
}
.card h4 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.card p { color: var(--theme-light-color); font-size: 13px; margin: 0; }
.card .flag {
  border-radius: var(--tool-radius-s); font-size: 11px; line-height: 1; padding: 3px 6px;
  position: absolute; right: 14px; top: 14px;
}
.card .flag.on { background: var(--theme-color); color: var(--tool-surface); }
.card .flag.soon { background: var(--tool-line); color: var(--theme-light-color); }
.card.is-soon { opacity: .78; }
.card.is-soon:hover { border-color: var(--tool-line-strong); box-shadow: var(--tool-shadow-hover-soft); }
.card[hidden] { display: none; }
.empty-hint {
  background: var(--tool-surface); border: 1px dashed var(--tool-line-strong); border-radius: var(--tool-radius-l);
  color: var(--theme-light-color); display: none; padding: 26px; text-align: center;
}
.empty-hint.show { display: block; }

/* 工具工作区 */
.panel {
  background: var(--tool-surface); border: 1px solid var(--tool-line); border-radius: var(--tool-radius-l);
  margin-top: 16px; overflow: hidden;
}
.panel-head {
  align-items: center; border-bottom: 1px solid var(--tool-line);
  display: flex; gap: 12px; padding: 16px 20px;
}
.panel-head h3 { font-size: 17px; font-weight: 600; margin: 0; }
.panel-head .tip { color: var(--theme-light-color); font-size: 12px; margin-left: auto; text-align: right; }
.panel-body { padding: 20px; }
.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--theme-light-color); font-size: 12px; }
.field input, .field select {
  background: var(--tool-surface); border: 1px solid var(--theme-border-color); border-radius: var(--tool-radius-m);
  color: var(--theme-black-color); font-family: inherit; font-size: 15px;
  height: 40px; min-width: 210px; outline: 0; padding: 0 12px;
}
.field input:focus, .field select:focus { border-color: var(--theme-color); }
.field select { min-width: 130px; }
.btn {
  background: var(--theme-color); border: 0; border-radius: var(--tool-radius-m); color: var(--tool-surface);
  cursor: pointer; font-family: inherit; font-size: 15px; height: 40px;
  padding: 0 22px; transition: opacity .2s;
}
.btn:hover { opacity: .88; }
.btn.ghost { background: none; border: 1px solid var(--theme-border-color); color: var(--theme-black-color); }
.btn.ghost:hover { border-color: var(--theme-color); color: var(--theme-color); opacity: 1; }
.msg { color: var(--tool-danger); display: none; font-size: 13px; margin-top: 12px; }
.msg.show { display: block; }

/* 结果 */
.result { margin-top: 20px; }
.result-grid {
  border: 1px solid var(--tool-line); border-radius: var(--tool-radius-l); display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); overflow: hidden;
}
.result-grid .cell { border-bottom: 1px solid var(--tool-line); padding: 12px 16px; }
.result-grid .cell:nth-child(odd) { background: var(--tool-surface-alt); }
.cell .k { color: var(--theme-light-color); font-size: 12px; margin-bottom: 3px; }
.cell .v { font-size: 15px; font-weight: 600; word-break: break-all; }
.cell .v.mono { font-family: var(--tool-mono); font-weight: 500; }
.cell .v.accent { color: var(--theme-color); }
.hostbar { display: flex; height: 34px; margin-top: 16px; }
.hostbar .seg {
  align-items: center; color: var(--tool-surface); display: flex; font-size: 12px;
  justify-content: center; overflow: hidden; white-space: nowrap;
}
.hostbar .seg.net { background: var(--tool-neutral); }
.hostbar .seg.host { background: var(--theme-color); }
.hostbar .seg.bc { background: var(--tool-neutral-dark); }

/* 说明块 */
.note-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 16px; }
.note {
  background: var(--tool-surface); border: 1px solid var(--tool-line); border-radius: var(--tool-radius-l); padding: 18px;
}
.note h4 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.note p { color: var(--theme-light-color); font-size: 13px; margin: 0; }
.note ul { color: var(--theme-light-color); font-size: 13px; margin: 8px 0 0; padding-left: 18px; }

/* 页脚 */
footer.site-footer {
  background: var(--tool-footer-bg); color: var(--tool-footer-fg); font-size: 13px;
  margin-top: 46px; padding: 28px 0 34px;
}
footer.site-footer a { color: var(--tool-footer-fg); text-decoration: none; }
footer.site-footer a:hover { color: var(--tool-surface); }
footer.site-footer .fnav { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
footer.site-footer .fnav a:first-child { color: var(--tool-surface); font-weight: 600; }
footer.site-footer .cp { color: var(--tool-footer-fg-dim); line-height: 1.9; }
footer.site-footer .cp .sep { margin: 0 8px; }

@media (max-width: 767px) {
  .hero { padding: 26px 0 4px; }
  .hero h2 { font-size: 23px; }
  .field input, .field select { min-width: 0; width: 100%; }
  .field { width: 100%; }
  .form-row .btn { width: 100%; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .result-grid .cell:nth-child(odd) { background: var(--tool-surface); }
  .result-grid .cell:nth-child(4n+1), .result-grid .cell:nth-child(4n+2) { background: var(--tool-surface-alt); }
}

/* ============================================================================
 * 以下为架构重构新增的区块样式（原版没有这些元素）
 * ========================================================================== */

/* --- 面包屑 --- */
.crumb { color: var(--theme-light-color); font-size: 13px; padding: 18px 0 0; }
.crumb a { color: var(--theme-light-color); text-decoration: none; }
.crumb a:hover { color: var(--theme-color); }
.crumb .sep { color: var(--tool-line-strong); font-style: normal; margin: 0 8px; }
.crumb em { color: var(--theme-black-color); font-style: normal; }

/* --- 工具页标题区 --- */
.tool-head { padding: 20px 0 4px; }
.tool-head h1 { font-size: 27px; font-weight: 600; line-height: 1.35; margin: 0 0 8px; }
.tool-head p { color: var(--theme-light-color); margin: 0; max-width: 780px; }

/* --- 结论区（结论只能由本地规则引擎产出，见 tool-page.js 说明） --- */
.conclusion {
  background: var(--tool-accent-weak); border-left: 3px solid var(--theme-color);
  border-radius: var(--tool-radius-m); margin-top: 16px; padding: 16px 18px;
}
.conclusion h4 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.conclusion p { font-size: 14px; margin: 0; }
.conclusion .basis { color: var(--theme-light-color); font-size: 12px; margin-top: 10px; }
.conclusion[hidden] { display: none; }

/* --- 关联工具 --- */
.rel-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.rel-item {
  align-items: center; background: var(--tool-surface);
  border: 1px solid var(--tool-line); border-radius: var(--tool-radius-m);
  color: var(--theme-black-color); display: flex; font-size: 14px;
  gap: 10px; padding: 10px 14px; text-decoration: none;
}
.rel-item .fa { color: var(--theme-color); text-align: center; width: 16px; }
a.rel-item { transition: border-color .2s, color .2s; }
a.rel-item:hover { border-color: var(--tool-accent-line); color: var(--theme-color); }
.rel-item span { flex: 1; }
.rel-item em {
  background: var(--tool-line); border-radius: var(--tool-radius-s);
  color: var(--theme-light-color); font-size: 11px; font-style: normal; padding: 2px 6px;
}
.rel-item.is-soon { opacity: .8; }
.rel-item.is-soon .fa { color: var(--theme-light-color); }

/* --- 免责声明 --- */
.disclaimer {
  color: var(--theme-light-color); font-size: 12px; line-height: 1.8; margin-top: 14px;
}

/* --- 被搜索筛空的区块整体收起，避免留下空标题 --- */
.sec[hidden] { display: none; }

/* --- 区块计数徽标（数字由 registry.js 依据数据写入） --- */
.sec h3 .count {
  background: var(--tool-line); border-radius: var(--tool-radius-s);
  color: var(--tool-neutral-dark); font-size: 12px; font-weight: 400;
  margin-left: 6px; padding: 1px 7px; vertical-align: 2px;
}
.sec h3 .count:empty { display: none; }

/* --- 无 JavaScript 时的说明（目录页的清单与导航由浏览器渲染） --- */
.fallback {
  background: var(--tool-surface-alt); border: 1px solid var(--tool-line);
  border-radius: var(--tool-radius-m); color: var(--tool-neutral-dark);
  font-size: 13px; line-height: 1.8; margin-top: 18px; padding: 14px 16px;
}
.fallback b { color: var(--theme-black-color); }
/* --- 地址占比条：段内标签最小宽度 ------------------------------------------
   hostbar 三段按「网络 1 : 可用主机 N : 广播 1」的真实比例分配 flex 宽度，
   /24 这类大网段下左右两段只会分到几像素，段内文字被 overflow:hidden 裁掉，
   看起来像一条光秃秃的色带。给每段设最小宽度，保证「网络 / 广播」标签始终可读，
   中间「可用主机 N」仍占绝对主导，比例观感不变。
   注意：以上 .hostbar 原始规则在 layout.css 迁移冻结段内，不能改，只能在此覆盖。 */
.hostbar .seg { min-width: 76px; }

/* --- 表单标签颜色：迁移冻结段内为 60% 灰，用户反馈看不清；
   冻结段不改，在此按令牌覆盖为亮黑（复选框组标签在 tool-ui.css 同步）。 --- */
.field label { color: var(--theme-black-color); }



/* ============================================================================
 * 移动端与表单控件修正（2026-10-09）
 * ----------------------------------------------------------------------------
 * 1) 控件溢出：表单控件此前没有 border-box 复位，width:100% 之外还要再加左右
 *    内边距与边框（输入框 26px、文本域 30px），多出来的部分被 .panel 的
 *    overflow:hidden 裁掉 —— 手机上看到的就是「输入框超出页面、右边框消失」。
 * 2) 下拉小三角：原生 select 外观在 iOS / Android / 桌面各不相同，与本站圆角
 *    控件不搭；这里统一自绘（纯 CSS 双渐变三角，不引外部图片、不写死色值）。
 * 3) iOS 聚焦放大：Safari 对字号小于 16px 的可聚焦控件会在聚焦瞬间放大整页，
 *    手机上表现为「点一下输入框整页变大」。窄屏控件字号统一提到 16px。
 * 4) 按钮排布：工具页的 .form-row / .actions-row / .io-toolbar 三种按钮容器
 *    在窄屏表现各不相同（整行 / 半行 / 挤一行），统一成「等宽两列，单个占满」。
 * 注：以上全部是新增覆盖，上面的迁移段原样式保持不动。
 * ========================================================================== */

/* --- 1. 表单控件盒模型：宽度把内边距与边框算进去，不再溢出容器 --- */
input, select, textarea { box-sizing: border-box; }

/* --- 2. 下拉框统一外观：自绘右下角小三角 ---
   选择器要带 .field 前缀：迁移段里的 \.field input, .field select\ 设了
   background 简写与 padding，权重 (0,1,1) 高于裸 select，必须同级靠后再覆盖。 --- */
.field select,
.form-row select,
.tool-table select,
select {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--tool-neutral-dark) 50%),
    linear-gradient(135deg, var(--tool-neutral-dark) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 13px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 34px;
  text-overflow: ellipsis;
}

@media (max-width: 767px) {
  /* 字段独占一行：页面里 .field 带了行内 flex / min-width（如 flex:0 1 300px），
     行内值优先级最高，只能用 !important 让位，否则窄屏会被挤成几像素宽 */
  .field { flex: 1 1 100% !important; min-width: 0 !important; width: 100%; }
  .form-row { gap: 12px; }

  /* 按钮：等宽两列，落单自动占满整行（覆盖迁移段的 .form-row .btn{width:100%}） */
  .form-row .btn,
  .actions-row .btn,
  .io-toolbar .btn { flex: 1 1 44%; min-width: 0; padding-left: 10px; padding-right: 10px; width: auto; }

  /* iOS：可聚焦控件字号不小于 16px，聚焦时不再放大整页 */
  .field input, .field select, .field textarea,
  input, select, textarea { font-size: 16px; }

  /* 卡片留白略收，给内容让出宽度 */
  .panel-body { padding: 16px; }
  .panel-head { padding: 14px 16px; }
}
