/* ============================================
   酱豆工具箱 · Web 端 Soft UI 样式
   参考: tool.jamdou.com + 项目记忆约束
   ============================================ */

/* ---------- 变量 ---------- */
:root {
  --bg-base: #e0e5ec;
  --bg-deep: #d4dae3;
  --card-bg: #e0e5ec;
  --text-main: #1f2937;
  --text-sub: #718096;
  --btn-grad: linear-gradient(135deg, #4a88e8, #2a62b0);
  --hero-grad: linear-gradient(135deg, #2a62b0, #4a88e8, #6aa3f5);
  --shadow-dark: rgba(163, 177, 198, 0.55);
  --shadow-light: rgba(255, 255, 255, 0.95);
  --radius: 22px;
  --radius-sm: 14px;
  --radius-lg: 30px;
  --shadow-out: 8px 8px 20px var(--shadow-dark), -8px -8px 20px var(--shadow-light);
  --shadow-out-lg: 12px 12px 30px var(--shadow-dark), -12px -12px 30px var(--shadow-light);
  --shadow-in: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
  --shadow-in-lg: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light);
}

/* ---------- 重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--bg-base) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 布局容器 ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

/* ---------- 顶部品牌 Banner ---------- */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 32px 36px;
  margin-bottom: 32px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-out-lg);
}
.hero-left { flex: 1; min-width: 0; }
.hero-logo-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}
.hero-logo-box {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--shadow-out);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.hero-logo-box img { width: 40px; height: 40px; object-fit: contain; }
.hero-logo-box .logo-fallback {
  font-size: 28px;
  font-weight: 700;
  color: var(--btn-grad);
  background: var(--btn-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}
.hero-desc {
  font-size: 15px;
  color: var(--text-sub);
  margin-top: 6px;
}
.hero-right { flex-shrink: 0; }
.btn-qr {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--btn-grad);
  color: #fff;
  border: none;
  border-radius: 40px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 4px 4px 12px rgba(74, 136, 232, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-qr:hover { transform: translateY(-2px); box-shadow: 6px 6px 16px rgba(74, 136, 232, 0.45); }
.btn-qr:active { transform: translateY(0); }
.btn-qr .icon { width: 20px; height: 20px; background-color: #fff; }

/* ---------- 区块标题 ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin: 36px 0 18px;
}
.section-title .bar {
  width: 5px;
  height: 22px;
  border-radius: 3px;
  background: var(--btn-grad);
}

/* ---------- 快速入口 4 宫格 ---------- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}
.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 12px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-out);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: var(--text-main);
}
.quick-item:hover { transform: translateY(-3px); }
.quick-item:active { box-shadow: var(--shadow-in); }
.quick-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quick-icon-wrap .icon { width: 28px; height: 28px; background-color: #fff; }
.quick-label { font-size: 14px; font-weight: 600; color: var(--text-main); }
.quick-sub { font-size: 12px; color: var(--text-sub); }

/* ---------- 微信扫码区 ---------- */
.qr-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 28px 32px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-out-lg);
  margin: 28px 0;
}
.qr-box {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-out);
  padding: 10px;
  flex-shrink: 0;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-text { flex: 0 1 auto; text-align: center; }
.qr-text h3 { font-size: 18px; color: var(--text-main); margin-bottom: 6px; }
.qr-text p { font-size: 14px; color: var(--text-sub); }

/* ---------- 工具卡片网格 ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tool-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-out);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light); }
.tool-card:active { transform: translateY(0); box-shadow: var(--shadow-in); }
.tool-cover {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tool-cover .icon { width: 30px; height: 30px; background-color: #fff; }
.tool-info { flex: 1; min-width: 0; }
.tool-name { font-size: 15px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-desc { font-size: 12px; color: var(--text-sub); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 20px;
  color: #fff;
  background: var(--btn-grad);
}
.tool-badge.hot { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
.tool-badge.new { background: linear-gradient(135deg, #00b894, #00cec9); }

/* ---------- 分类筛选标签 ---------- */
.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}
.cat-tab {
  padding: 8px 18px;
  background: var(--card-bg);
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  cursor: pointer;
  box-shadow: var(--shadow-out);
  transition: all 0.2s;
  border: none;
}
.cat-tab:hover { color: var(--text-main); }
.cat-tab.active {
  color: #fff;
  background: var(--btn-grad);
  box-shadow: 4px 4px 10px rgba(74, 136, 232, 0.35);
}

/* ---------- 模态弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 41, 59, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  width: 100%;
  max-width: 760px;
  background: linear-gradient(180deg, var(--bg-base), var(--bg-deep));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-out-lg);
  overflow: hidden;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid rgba(163, 177, 198, 0.2);
}
.modal-back {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--card-bg);
  border: none;
  box-shadow: var(--shadow-out);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: box-shadow 0.2s;
}
.modal-back:active { box-shadow: var(--shadow-in); }
.modal-back .icon { width: 20px; height: 20px; background-color: var(--text-main); }
.modal-title-wrap { flex: 1; min-width: 0; }
.modal-title { font-size: 22px; font-weight: 700; color: var(--text-main); }
.modal-sub { font-size: 13px; color: var(--text-sub); margin-top: 2px; }
.modal-fav {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--card-bg);
  border: none;
  box-shadow: var(--shadow-out);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-fav:active { box-shadow: var(--shadow-in); }
.modal-fav .icon { width: 20px; height: 20px; background-color: var(--text-sub); }
.modal-fav.active .icon { background-color: #f6a825; }

.modal-body { padding: 24px 28px 28px; }
.modal-intro {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.7;
  margin-bottom: 18px;
  padding: 16px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-in);
}
.modal-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.feature-item {
  padding: 14px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-out);
  text-align: center;
}
.feature-item .ft { font-size: 13px; font-weight: 600; color: var(--text-main); }
.feature-item .fd { font-size: 11px; color: var(--text-sub); margin-top: 4px; }

/* ---------- 工具工作区 ---------- */
.tool-workspace {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-in);
  padding: 22px;
  min-height: 200px;
}

/* ---------- 通用表单元素 ---------- */
.input, .textarea, .select {
  width: 100%;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-main);
  box-shadow: var(--shadow-in);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.input:focus, .textarea:focus, .select:focus { border-color: #4a88e8; }
.textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--btn-grad);
  color: #fff;
  border: none;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 4px 4px 10px rgba(74, 136, 232, 0.3);
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); box-shadow: 6px 6px 14px rgba(74, 136, 232, 0.4); }
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: var(--card-bg);
  color: var(--text-main);
  box-shadow: var(--shadow-out);
}
.btn.secondary:active { box-shadow: var(--shadow-in); }
.btn.sm { padding: 8px 16px; font-size: 13px; }
.btn .icon { width: 18px; height: 18px; background-color: #fff; }
.btn.secondary .icon { background-color: var(--text-main); }

/* ---------- 工具内通用布局 ---------- */
.tool-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tool-row > * { flex: 1; min-width: 0; }
.tool-row > .btn, .tool-row > .btn.sm { flex: 0 0 auto; }
.tool-label { font-size: 13px; font-weight: 600; color: var(--text-main); margin-bottom: 6px; display: block; }
.tool-output {
  padding: 14px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-out);
  font-size: 14px;
  color: var(--text-main);
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 48px;
}
.tool-output.empty { color: var(--text-sub); font-style: italic; }
.tool-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tool-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tool-section { margin-bottom: 20px; }
.tool-section:last-child { margin-bottom: 0; }

/* ---------- 计算器专用 ---------- */
.calc-display {
  padding: 18px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-in);
  text-align: right;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
  min-height: 70px;
  overflow: hidden;
  word-break: break-all;
}
.calc-expr { font-size: 14px; color: var(--text-sub); min-height: 20px; }
.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.calc-key {
  padding: 16px 0;
  background: var(--card-bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-out);
  transition: box-shadow 0.15s;
  font-family: inherit;
}
.calc-key:active { box-shadow: var(--shadow-in); }
.calc-key.op { color: #4a88e8; }
.calc-key.eq { background: var(--btn-grad); color: #fff; box-shadow: 4px 4px 10px rgba(74, 136, 232, 0.3); }
.calc-key.wide { grid-column: span 2; }

/* ---------- 游戏画布 ---------- */
.game-canvas {
  display: block;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-in);
  touch-action: none;
}
.game-info {
  display: flex;
  justify-content: space-around;
  gap: 12px;
  margin-bottom: 14px;
}
.game-stat {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-out);
}
.game-stat .label { font-size: 12px; color: var(--text-sub); }
.game-stat .value { font-size: 22px; font-weight: 700; color: var(--text-main); }

/* ---------- 占位(未上线) ---------- */
.placeholder {
  text-align: center;
  padding: 40px 20px;
}
.placeholder .icon { width: 64px; height: 64px; background-color: var(--text-sub); margin: 0 auto 16px; display: block; }
.placeholder h3 { font-size: 18px; color: var(--text-main); margin-bottom: 8px; }
.placeholder p { font-size: 14px; color: var(--text-sub); margin-bottom: 20px; }

/* ---------- 底部 ---------- */
.footer {
  text-align: center;
  padding: 32px 16px;
  font-size: 13px;
  color: var(--text-sub);
}
.footer a { color: #4a88e8; text-decoration: none; }

/* ---------- 搜索框 ---------- */
.search-bar {
  position: relative;
  margin-bottom: 24px;
}
.search-bar .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; background-color: var(--text-sub); }
.search-bar .input { padding-left: 44px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--text-main);
  color: #fff;
  border-radius: 30px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-8px); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .container { padding: 14px 14px 40px; }
  .hero { flex-direction: column; align-items: flex-start; padding: 24px 22px; }
  .hero-title { font-size: 22px; }
  .hero-desc { font-size: 13px; }
  .btn-qr { width: 100%; justify-content: center; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .quick-item { padding: 16px 8px; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .tool-card { padding: 14px; gap: 10px; }
  .tool-cover { width: 44px; height: 44px; }
  .tool-cover .icon { width: 24px; height: 24px; }
  .tool-name { font-size: 14px; }
  .tool-desc { font-size: 11px; }
  .qr-section { flex-direction: column; text-align: center; }
  .modal { border-radius: 20px; }
  .modal-header { padding: 18px 18px 14px; }
  .modal-body { padding: 18px; }
  .modal-title { font-size: 18px; }
  .modal-features { grid-template-columns: 1fr; }
  .tool-grid-2, .tool-grid-3 { grid-template-columns: 1fr; }
  .calc-key { padding: 14px 0; font-size: 16px; }
  .section-title { font-size: 18px; }
}
