/* ===== 喵工具箱 · 共享主题 ===== */
/* 所有工具页面统一引入此CSS */

:root {
    --primary: #FF6B9D;
    --secondary: #C084FC;
    --accent: #FBBF24;
    --green: #34D399;
    --red: #F87171;
    --blue: #60A5FA;
    --orange: #FB923C;
    --bg-deep: #0A0614;
    --bg-page: #0F0A1A;
    --bg-card: rgba(255,255,255,0.06);
    --bg-hover: rgba(255,107,157,0.08);
    --bg-selected: rgba(255,107,157,0.15);
    --text: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border: rgba(255,255,255,0.08);
    --border-accent: rgba(255,107,157,0.3);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --gradient-brand: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-gold: linear-gradient(135deg, #FBBF24, #F59E0B);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; width: 100%; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-page); color: var(--text); min-height: 100dvh;
}

.bg-glow {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
    background: radial-gradient(ellipse at 20% 20%, rgba(255,107,157,0.12) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 80%, rgba(192,132,252,0.10) 0%, transparent 50%);
}

.app {
    position: relative; z-index: 1; width: 100%; max-width: 900px; margin: 0 auto;
    padding: 16px; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); min-height: 100dvh;
}

/* 顶部品牌栏 */
.top-bar {
    display: flex; align-items: center; justify-content: space-between;
    height: 44px; margin-bottom: 12px; padding: 0 4px;
}
.top-bar .logo {
    display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700;
    background: var(--gradient-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    cursor: pointer;
}
.top-bar .logo .icon { font-size: 24px; -webkit-text-fill-color: initial; }

/* 搜索框 */
.search-box { width: 100%; height: 44px; margin-bottom: 16px; }
.search-box input {
    width: 100%; height: 100%; padding: 0 16px 0 40px;
    border: 1px solid var(--border); border-radius: 22px;
    background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") 12px center no-repeat;
    color: var(--text); font-size: 14px; outline: none; transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--primary); }
.search-box input::placeholder { color: var(--text-muted); }

/* 产品大卡片 */
.hero-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.hero-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100px; border-radius: var(--radius-md); cursor: pointer;
    text-decoration: none; color: white; transition: transform 0.2s;
    position: relative; overflow: hidden;
}
.hero-card:active { transform: scale(0.98); }
.hero-card.cat { background: linear-gradient(135deg, rgba(255,107,157,0.4), rgba(192,132,252,0.3)); border: 1px solid rgba(255,107,157,0.3); }
.hero-card.img { background: linear-gradient(135deg, rgba(96,165,250,0.3), rgba(192,132,252,0.3)); border: 1px solid rgba(96,165,250,0.3); }
.hero-card .hc-icon { font-size: 36px; margin-bottom: 6px; }
.hero-card .hc-title { font-size: 16px; font-weight: 700; }
.hero-card .hc-desc { font-size: 11px; opacity: 0.75; margin-top: 2px; }

/* 分区标题 */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; padding: 4px 0;
}
.section-header .s-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); }
.section-header .s-more { font-size: 12px; color: var(--primary); cursor: pointer; text-decoration: none; }

/* 工具网格 */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.tool-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 75px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    position: relative; overflow: hidden;
}
.tool-card:active { transform: scale(0.97); }
.tool-card.cat-tool { border-left: 3px solid var(--primary); }
.tool-card.util-tool { border-left: 3px solid var(--blue); }
.tool-card:hover, .tool-card:active { border-color: var(--border-accent); background: var(--bg-selected); }
.tool-card .t-icon { font-size: 22px; margin-bottom: 4px; }
.tool-card .t-name { font-size: 12px; color: var(--text); }
.tool-card .t-desc { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

/* 底部Tab */
.bottom-tabs {
    position: fixed; bottom: 0; left: 0; right: 0; display: flex;
    background: rgba(15,10,26,0.95); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 8px 0; cursor: pointer; color: var(--text-muted); font-size: 10px;
    gap: 3px; transition: color 0.2s; text-decoration: none;
}
.tab-item.active { color: var(--primary); }
.tab-item .tab-icon { font-size: 20px; }

/* 工具页通用 */
.tool-page { max-width: 600px; margin: 0 auto; }

.back-bar {
    display: flex; align-items: center; gap: 8px; height: 44px; margin-bottom: 16px;
    cursor: pointer; color: var(--text-secondary); font-size: 14px; text-decoration: none;
}

.tool-page .tool-title {
    font-size: 22px; font-weight: 700; margin-bottom: 20px; text-align: center;
    background: var(--gradient-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.input-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 20px; margin-bottom: 16px;
}
.input-card .input-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }

.input-field {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: rgba(255,255,255,0.04);
    color: var(--text); font-size: 16px; outline: none; transition: border-color 0.2s; font-family: inherit;
}
.input-field:focus { border-color: var(--primary); }
.input-field::placeholder { color: var(--text-muted); }

.input-row { display: flex; gap: 10px; align-items: center; }
.input-row .input-field { flex: 1; }
.input-row .input-unit { color: var(--text-secondary); font-size: 14px; white-space: nowrap; }

.btn {
    padding: 12px 20px; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; cursor: pointer; transition: transform 0.15s; font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-brand { background: var(--gradient-brand); color: white; }
.btn-gold { background: var(--gradient-gold); color: #000; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px; font-size: 16px; }

.result-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 24px; text-align: center;
    display: none; margin-bottom: 16px;
}
.result-card.show { display: block; animation: fadeIn 0.4s ease; }
.result-card .r-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.result-card .r-value { font-size: 36px; font-weight: 800; margin-bottom: 4px; background: var(--gradient-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.result-card .r-desc { font-size: 13px; color: var(--text-secondary); }

.ref-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.ref-table th, .ref-table td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--border); }
.ref-table th { color: var(--text-muted); font-weight: 500; }
.ref-table td { color: var(--text-secondary); }
.ref-table tr.current td { background: var(--bg-selected); color: var(--primary); font-weight: 600; }

.ad-slot {
    background: var(--bg-card); border: 2px dashed var(--border);
    border-radius: var(--radius-sm); padding: 16px; text-align: center;
    color: var(--text-muted); font-size: 12px; margin: 16px 0;
}

.cross-ref { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cross-ref a {
    padding: 6px 12px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 20px; color: var(--text-secondary); font-size: 12px;
    text-decoration: none; transition: border-color 0.2s;
}
.cross-ref a:hover { border-color: var(--primary); }

.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(30,20,50,0.95); border-radius: 10px; padding: 12px 20px;
    font-size: 14px; z-index: 1000; opacity: 0; transition: opacity 0.3s;
    pointer-events: none; max-width: 300px; text-align: center;
}
.toast.show { opacity: 1; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 移动端响应式 ===== */
@media (max-width: 480px) {
    .app { padding: 10px; padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
    
    /* 顶部栏 */
    .top-bar { height: 38px; margin-bottom: 8px; }
    .top-bar .logo { font-size: 16px; }
    .top-bar .logo .icon { font-size: 20px; }
    
    /* 搜索框 */
    .search-box { height: 40px; margin-bottom: 12px; }
    
    /* 产品卡片 */
    .hero-cards { gap: 8px; }
    .hero-card { height: 78px; border-radius: 12px; }
    .hero-card .hc-icon { font-size: 28px; }
    .hero-card .hc-title { font-size: 14px; }
    .hero-card .hc-desc { font-size: 10px; }
    
    /* 工具网格 */
    .tool-grid { gap: 6px; }
    .tool-card { height: 62px; }
    .tool-card .t-icon { font-size: 18px; }
    .tool-card .t-name { font-size: 11px; }
    .tool-card .t-desc { font-size: 9px; }
    
    /* 工具页 */
    .tool-page .tool-title { font-size: 18px; margin-bottom: 14px; }
    .input-card { padding: 14px; border-radius: 12px; }
    .input-field { font-size: 16px; padding: 10px 14px; }
    .input-row { flex-direction: column; gap: 8px; }
    .input-row .input-unit { font-size: 13px; }
    
    /* 按钮 */
    .btn { padding: 10px 16px; font-size: 13px; }
    .btn-lg { padding: 14px; font-size: 15px; }
    
    /* 结果卡片 */
    .result-card { padding: 16px; border-radius: 12px; }
    .result-card .r-value { font-size: 28px; }
    .result-card .r-label { font-size: 11px; }
    .result-card .r-desc { font-size: 12px; }
    
    /* 表格 */
    .ref-table { font-size: 11px; }
    .ref-table th, .ref-table td { padding: 8px 4px; }
    
    /* 底部Tab */
    .tab-item { font-size: 9px; padding: 5px 0; }
    .tab-item .tab-icon { font-size: 18px; }
    
    /* Toast */
    .toast { max-width: 260px; font-size: 12px; padding: 10px 16px; }
    
    /* 跨引用 */
    .cross-ref { gap: 6px; }
    .cross-ref a { padding: 5px 10px; font-size: 11px; }
}

/* 极小屏(<360px)：工具网格2列、产品卡片单列 */
@media (max-width: 360px) {
    .tool-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-cards { grid-template-columns: 1fr; }
    .hero-card { height: 68px; }
}
