﻿/* /styles/common.css - 简洁 + 网格入口 + 兼容降级 */
:root{
  --bg:#f4f7fb;
  --card:#ffffff;
  --muted:#6b7280;
  --accent:#2563eb;
  --radius:12px;
  --shadow:0 6px 18px rgba(17,24,39,0.06);
  --max-width:980px;
  font-family:Inter, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:linear-gradient(180deg,#f7fafc 0%, var(--bg) 100%);
  color:#0f172a;
  font-size:16px;
  line-height:1.45;
}

/* 框架与容器 */
.page-wrapper{min-height:100vh;display:flex;flex-direction:column}
.page-content{
  flex:1 0 auto;
  display:flex;flex-direction:column;align-items:center;
  padding-block:clamp(20px,6vh,80px);
  padding-inline:clamp(16px,6vw,120px);
  background:linear-gradient(180deg,rgba(247,250,252,0.95) 0%, rgba(244,247,251,0.8) 100%);
  border-radius:16px;
  box-shadow:0 8px 28px rgba(17,24,39,0.04);
}
.container{width:100%;max-width:var(--max-width);margin:0 auto}

/* 页眉 */
.header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}
.brand{display:flex;gap:12px;align-items:center}
.logo{
  width:52px;height:52px;border-radius:12px;
  background:linear-gradient(135deg,var(--accent),#7c3aed);
  display:flex;align-items:center;justify-content:center;
  color:#fff;font-weight:700;font-size:18px;box-shadow:var(--shadow)
}
.site-title{font-weight:700;font-size:18px}

/* 卡片 */
.card{
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
  border:1px solid rgba(15,23,42,0.06);
}
.card-title{margin:0 0 10px 0}

/* 按钮与徽标 */
.btn{
  display:inline-block;
  padding:8px 12px;
  border-radius:10px;
  border:none;
  text-decoration:none;
  cursor:pointer;
  font-weight:600;
}
.btn-primary{background:var(--accent);color:#fff}
.btn-ghost{background:transparent;color:var(--accent);border:1px solid rgba(37,99,235,0.12)}
.user-chip{
  padding:6px 10px;border:1px solid rgba(15,23,42,0.12);
  border-radius:999px;background:#fff;color:var(--muted);
  font-size:13px;line-height:1
}

/* 布局辅助 */
.row{display:flex;gap:12px;align-items:center}
.col{display:flex;flex-direction:column;gap:12px}
.small{font-size:13px;color:var(--muted)}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}

/* 页脚 */
.site-footer{
  width:100%;max-width:var(--max-width);
  height:48px;display:flex;align-items:center;justify-content:center;
  color:var(--muted);font-size:14px;margin:12px auto 0
}

/* —— 聊天区（如有使用） —— */
.chat-window{
  height:60vh;min-height:320px;overflow:auto;overscroll-behavior:contain;
  padding:12px;border-radius:10px;background:linear-gradient(180deg,#fbfdff,#ffffff);
  border:1px solid rgba(15,23,42,0.06);
  white-space:pre-wrap;font-family:Menlo, ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size:14px;
}
.msg-area{display:flex;gap:8px}
.msg-input{flex:1;padding:10px;border-radius:10px;border:1px solid rgba(15,23,42,0.12)}

/* —— 入口网格 Tile —— */
.tile-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));
  gap:12px;
}
.tile{
  display:flex;align-items:flex-start;gap:12px;
  padding:14px;border-radius:14px;background:#fff;
  border:1px solid rgba(15,23,42,0.08);
  box-shadow:var(--shadow);
  text-decoration:none;color:inherit;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
  position:relative;isolation:isolate;
}
.tile:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 28px rgba(17,24,39,0.08);
  border-color:rgba(37,99,235,0.18);
  background:#fcfdff;
}
.tile:active{transform:translateY(0)}
.tile-icon{
  width:40px;height:40px;flex:none;
  display:flex;align-items:center;justify-content:center;
  border-radius:12px;
  background:linear-gradient(135deg, var(--tile-accent, var(--accent)), #6a8ef5);
  box-shadow:0 6px 18px rgba(37,99,235,0.18);
  font-size:20px;color:#fff
}
.tile-title{font-weight:700;margin:2px 0 4px 0}
.tile-desc{color:var(--muted)}
.tile-body{min-width:0}

/* —— 兼容降级：Legacy —— */
html.compat-legacy :root{--radius:8px;--shadow:none}
html.compat-legacy .page-content{border-radius:8px;box-shadow:none}
html.compat-legacy .card{box-shadow:none}
html.compat-legacy .logo{background:#4b6bff;box-shadow:none}
html.compat-legacy .tile{box-shadow:none;transition:none}
html.compat-legacy .tile:hover{transform:none;box-shadow:none}
html.compat-legacy .tile-grid{display:flex;flex-wrap:wrap;gap:10px}
html.compat-legacy .tile{flex:1 1 180px}

/* —— 超窄屏（Watch） —— */
html.compat-watch :root{--radius:8px}
html.compat-watch body{font-size:14px;background:#f7fafc}
html.compat-watch .page-content{padding-inline:10px;padding-block:12px;border-radius:8px;box-shadow:none;background:transparent}
html.compat-watch .header{margin-bottom:8px}
html.compat-watch .brand .logo{display:none}
html.compat-watch .small{font-size:12px}
html.compat-watch .card{padding:10px;border-radius:8px;box-shadow:none}
html.compat-watch .tile-grid{grid-template-columns:1fr;gap:8px}
html.compat-watch .tile{padding:10px;border-radius:10px}
html.compat-watch .tile-icon{width:32px;height:32px;font-size:16px;border-radius:10px;box-shadow:none}
html.compat-watch .user-chip{font-size:12px;padding:4px 8px}

/* 减动效偏好 */
@media (prefers-reduced-motion: reduce){
  *{animation:none !important; transition:none !important}
}