/* ============================================================
 * base.css — 结构 / 布局 / 组件
 * 所有颜色、字体、圆角、阴影均读取主题变量（见 themes.css）。
 * 9 套模板通过 <body data-theme="xxx"> 切换：既换配色，也换网格布局
 * 与装饰元素（布局见 themes.css 各模板段）。
 * ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body, system-ui, sans-serif);
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .4s ease;
}

/* 背景渐变层（每个模板自定义 --bg-decor） */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background: var(--bg-decor, none);
}

/* 装饰层（光斑 / 圆环 / 扫描线等花里胡哨的元素，模板自定义） */
.deco {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}

/* 粒子画布 */
#particleCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 主布局：CSS Grid，模板在此基础上重排 ---------- */
.app {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 20px 60px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  grid-template-areas:
    "social"
    "token"
    "req"
    "claim"
    "records"
    "footer";
}
.mod-social  { grid-area: social; }
.mod-token   { grid-area: token; }
.mod-req     { grid-area: req; }
.mod-claim   { grid-area: claim; }
.mod-records { grid-area: records; }
.mod-footer  { grid-area: footer; }

/* ---------- 区块标题 ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head, var(--font-body));
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--text);
}
.section-title svg { width: 20px; height: 20px; color: var(--accent); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius, 18px);
  padding: 26px;
  box-shadow: var(--card-shadow, none);
  transition: background-color .4s ease, border-color .4s ease, box-shadow .4s ease;
}

/* ---------- 联系方式 ---------- */
.social-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform .25s ease, color .25s ease, box-shadow .25s ease, background-color .25s ease;
}
.social-icon svg { width: 22px; height: 22px; fill: currentColor; }
.social-icon:hover {
  transform: translateY(-3px) scale(1.06);
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: var(--glow);
}

/* ---------- 代币卡片 ---------- */
.token-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  justify-content: center;   /* 移动端默认居中 */
  text-align: center;
}
.token-logo {
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--logo-color, var(--accent-2));
  background: var(--surface-2);
  border: 2px solid var(--accent);
  box-shadow: var(--glow);
}
.token-logo svg { width: 52px; height: 52px; fill: currentColor; }

.token-main { flex: 1 1 300px; min-width: 0; }

.token-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.token-name {
  font-family: var(--font-head, var(--font-body));
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  margin: 0;
  color: var(--text);
  line-height: 1.15;
}
.chain-badge {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

/* 桌面端：左对齐布局 */
@media (min-width: 640px) {
  .token-inner { justify-content: flex-start; text-align: left; }
  .token-heading { justify-content: flex-start; }
}

/* 代币信息区（动态渲染，4 个关键字段全空时整块隐藏） */
.token-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.token-meta.is-empty { display: none; }
@media (min-width: 640px) { .token-meta { grid-template-columns: 1fr 1fr; } }

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: .92rem;
}
.meta-label { color: var(--accent); font-weight: 600; flex: 0 0 auto; }
.meta-value {
  color: var(--text-muted);
  font-family: var(--mono, 'JetBrains Mono', ui-monospace, monospace);
  word-break: break-all;
}
.meta-value.link { color: var(--accent); }
.meta-value.link:hover { text-decoration: underline; }

/* 合约地址复制按钮 */
.meta-copy {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--accent);
  cursor: pointer;
  transition: all .2s ease;
}
.meta-copy svg { width: 14px; height: 14px; fill: currentColor; }
.meta-copy:hover { background: var(--accent); color: var(--on-accent); }
.meta-copy.is-copied { background: var(--success); color: #fff; border-color: var(--success); }

.token-desc {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
  font-size: .95rem;
}

/* ---------- 需求列表 ---------- */
.req-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.req-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-muted);
  line-height: 1.55;
}
.req-list li svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  color: var(--accent);
}

/* ---------- 领取表单 ---------- */
.claim-form { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 640px) { .claim-form { flex-direction: row; } }

.claim-input {
  flex: 1;
  padding: 14px 16px;
  font-size: 16px;   /* >=16px 防止 iOS 聚焦自动缩放 */
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.claim-input::placeholder { color: var(--text-muted); opacity: .7; }
.claim-input:focus { border-color: var(--accent); box-shadow: var(--glow-focus); }

.btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--glow);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--glow-strong); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.tip-msg {
  margin: 14px 0 0;
  min-height: 1.5em;
  text-align: center;
  font-size: .92rem;
}
.tip-msg.is-ok   { color: var(--success); }
.tip-msg.is-err  { color: var(--danger); }
.tip-msg.is-info { color: var(--accent-2); }

/* ---------- 提交记录表格 ---------- */
.records-scroll { overflow-x: auto; }
.records-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.records-table th, .records-table td {
  padding: 12px 10px;
  text-align: left;
  font-size: .9rem;
  vertical-align: middle;
}
.records-table thead th {
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border-strong);
}
.records-table tbody td {
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}
.records-table tbody tr:hover td { color: var(--text); background: var(--row-hover); }

.records-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 0;
  font-size: .95rem;
}
.records-footer { margin-top: 20px; text-align: center; }

/* ---------- 主题/模板切换器（浮动） ---------- */
.theme-switcher {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.theme-switcher .ts-toggle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  transition: transform .2s ease;
}
.theme-switcher .ts-toggle:hover { transform: rotate(30deg); }
.theme-switcher .ts-toggle svg { width: 20px; height: 20px; }

.theme-panel {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  max-height: 70vh;
  overflow-y: auto;
}
.theme-panel.is-open { display: flex; }
.theme-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: .85rem;
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
  white-space: nowrap;
}
.theme-opt:hover { background: var(--row-hover); color: var(--text); }
.theme-opt.is-active { color: var(--accent); font-weight: 600; }
.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  flex: 0 0 auto;
}

/* ---------- 页脚 ---------- */
.footer-note {
  margin: 0;
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
  opacity: .75;
}
/* （注：内容由AI生成） */
