/* ============================================================
   NewCode 公共页面样式（tool.html / share.html / install.html / admin.html）
   遵循 DESIGN.md：黑白极简、延续原版设计令牌
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Styrene B', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 'PingFang SC', 'Noto Sans SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-body, #fafafa);
    color: var(--text-primary, #1a1a1a);
    min-height: 100vh;
    min-height: 100dvh;
    transition: background .28s cubic-bezier(.32,.72,0,1);
}

::selection { background: rgba(0, 0, 0, .12); }
html.dark ::selection { background: rgba(255, 255, 255, .22); }

a { color: inherit; }

/* ---------- 简易顶栏 ---------- */
.page-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color, #e6e6e6);
    background: var(--bg-sidebar, #f5f5f5);
    position: sticky;
    top: 0;
    z-index: 10;
}
.page-topbar .topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.2px;
}
.page-topbar .topbar-brand .brand-icon { width: 26px; height: 26px; border-radius: 8px; }
.page-topbar .topbar-brand .brand-icon svg { width: 26px; height: 26px; border-radius: 8px; }
.page-topbar .topbar-actions { display: flex; align-items: center; gap: 8px; }
.page-topbar .topbar-btn {
    width: 34px; height: 34px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all .28s cubic-bezier(.32,.72,0,1);
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.page-topbar .topbar-btn:hover {
    background: var(--bg-card, #fff);
    border-color: var(--border-color, #e6e6e6);
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
}
.page-topbar .topbar-btn svg { width: 18px; height: 18px; stroke: currentColor; }

/* ---------- 居中内容容器 ---------- */
.page-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 24px 64px;
    animation: pageRise .6s cubic-bezier(.16,1,.3,1) both;
}
.page-container.wide { max-width: 960px; }
@keyframes pageRise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 页头（工具徽章 / 分享标题） ---------- */
.page-hero { text-align: center; margin-bottom: 32px; }
.page-hero .hero-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e6e6e6);
    box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.page-hero .hero-icon svg { width: 26px; height: 26px; stroke: currentColor; }
.page-hero .hero-title {
    font-family: 'Tiempos Text', 'Source Serif 4', 'Source Serif Pro', Georgia,
                 'Times New Roman', 'Songti SC', 'Noto Serif SC', STSong, SimSun, serif;
    font-size: clamp(24px, 3.4vw, 30px);
    font-weight: 500;
    letter-spacing: -0.2px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.page-hero .hero-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.7;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}
.hero-badge {
    font-size: 9px;
    font-weight: 600;
    border: 1px solid var(--border-strong, #d6d6d6);
    color: var(--text-secondary);
    padding: 2px 7px;
    border-radius: 10px;
    vertical-align: middle;
}

/* ---------- 内容卡片（Markdown 渲染区） ---------- */
.page-card {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e6e6e6);
    border-radius: 20px;
    padding: 26px 28px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
}
.page-card .card-content {
    font-family: 'Tiempos Text', 'Source Serif 4', Georgia, 'Songti SC', 'Noto Serif SC', serif;
    font-size: 14.5px;
    line-height: 1.8;
    color: var(--text-primary);
    word-break: break-word;
}

/* ---------- 通用按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: transform .28s cubic-bezier(.32,.72,0,1), background .28s, box-shadow .28s, border-color .28s;
    letter-spacing: .2px;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; }
.btn-primary {
    background: var(--text-primary, #1a1a1a);
    color: var(--bg-body, #fafafa);
    box-shadow: 0 1px 3px rgba(0,0,0,.16), 0 4px 12px rgba(0,0,0,.08);
}
.btn-primary:hover { background: #000; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(.98); }
html.dark .btn-primary { background: #1a1a1a; border: 1px solid var(--border-strong); }
html.dark .btn-primary:hover { background: #242424; }
.btn-secondary {
    background: var(--bg-card, #fff);
    color: var(--text-primary);
    border: 1px solid var(--border-strong, #d6d6d6);
}
.btn-secondary:hover { background: rgba(0,0,0,.05); transform: translateY(-1px); }
html.dark .btn-secondary:hover { background: rgba(255,255,255,.06); }

.btn-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
    flex-wrap: wrap;
}

/* ---------- 空状态 / 错误 ---------- */
.page-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
}
.page-state svg { width: 28px; height: 28px; stroke: currentColor; margin-bottom: 14px; opacity: .7; }
.page-state .state-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.page-state .state-desc { font-size: 12.5px; line-height: 1.7; }

/* ---------- 加载骨架 ---------- */
.loading-dots { display: inline-flex; align-items: center; gap: 5px; padding: 8px 2px; }
.loading-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-muted);
    animation: dotBounce2 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dotBounce2 {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Toast（与原版一致） ---------- */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-16px);
    background: var(--text-primary, #1a1a1a);
    color: var(--bg-body, #fafafa);
    font-size: 13px;
    font-weight: 500;
    padding: 9px 18px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.10), 0 24px 60px rgba(0,0,0,.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s cubic-bezier(.16,1,.3,1), transform .3s cubic-bezier(.16,1,.3,1);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 15px; height: 15px; stroke: currentColor; }

/* ---------- 表单（安装页用） ---------- */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: .3px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border-color, #e6e6e6);
    border-radius: 10px;
    background: var(--bg-card, #fff);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
    transition: border-color .28s cubic-bezier(.32,.72,0,1), box-shadow .28s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--text-primary, #1a1a1a);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; line-height: 1.6; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

/* ---------- 响应式 & 无障碍 ---------- */
@media (max-width: 640px) {
    .page-container { padding: 28px 16px 48px; }
    .page-card { padding: 20px 18px; border-radius: 16px; }
    .form-row { flex-direction: column; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
