/* Shared type scale and controls, used by every page and tool. */
:root { --text-xs: .75rem; --text-sm: .875rem; --text-base: 1rem; --text-lg: 1.125rem; --text-xl: 1.5rem; --text-2xl: 2rem; }
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

:where(a, button, input, textarea, [tabindex]):focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.button { min-height: 44px; padding: 8px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--pill); font: inherit; font-size: var(--text-sm); line-height: 1.4; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color var(--transition), border-color var(--transition); }
.button-primary { color: var(--on-primary); background: var(--button-bg); border-color: var(--button-bg); }
@media (hover: hover) { .button-primary:hover { background: var(--button-hover); } }
.button-secondary { color: var(--text); background: var(--surface); border-color: var(--border); }
@media (hover: hover) { .button-secondary:hover { background: var(--bg-secondary); border-color: var(--border-strong); } }
.button-small { padding-inline: 12px; }
.button:not(:disabled):active, .icon-button:not(:disabled):active { filter: brightness(.94); }
.button:disabled { opacity: 0.6; cursor: wait; }
.field-input { min-width: 0; width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: var(--bg-secondary); font: inherit; font-size: var(--text-base); line-height: 1.5; transition: border-color var(--transition), box-shadow var(--transition); }
.field-input::placeholder { color: var(--text-muted); }
.field-input:focus { border-color: var(--primary); outline: 2px solid var(--primary-soft); outline-offset: 1px; }
.icon-button { width: 44px; height: 44px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text-secondary); background: transparent; font: inherit; text-decoration: none; cursor: pointer; transition: color var(--transition), background-color var(--transition), border-color var(--transition); }
@media (hover: hover) { .icon-button:hover { border-color: var(--border); color: var(--primary); background: var(--primary-soft); } }
.icon-button:disabled { cursor: wait; opacity: .6; }
.button svg, .icon-button svg { width: 18px; height: 18px; flex-shrink: 0; }

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

.form-field { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.form-field > label, .form-field > span, .section-label { color: var(--text-secondary); font-size: var(--text-sm); font-weight: 600; }
.section-label { margin-bottom: 8px; }
.checkbox-field { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: var(--text-sm); cursor: pointer; }
.checkbox-field input { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--primary); cursor: pointer; }
.empty-state { padding: 24px 12px; color: var(--text-muted); font-size: var(--text-sm); text-align: center; list-style: none; }
.status-message { margin-top: 8px; color: var(--text-muted); font-size: var(--text-sm); }
.status-message:empty { display: none; }
.status-message.is-error { color: var(--danger); }

:root {
    color-scheme: light;
    scroll-padding-top: 104px;
    --primary: #0066cc;
    --primary-dark: #0055b3;
    --primary-soft: rgba(0, 122, 255, 0.1);
    --button-bg: #0066cc;
    --button-hover: #0055b3;
    --on-primary: #ffffff;
    --bg: #f3f6fb;
    --bg-secondary: #f0f3f8;
    --bg-tertiary: #e6ecf4;
    --surface: #fcfdff;
    --glass: rgba(255, 255, 255, 0.74);
    --glass-edge: rgba(255, 255, 255, 0.9);
    --text: #191c20;
    --text-secondary: #515862;
    --text-muted: #626b77;
    --border: rgba(60, 80, 110, 0.12);
    --border-strong: rgba(60, 80, 110, 0.24);
    --success: #15803d;
    --danger: #c2413a;
    --shadow: 0 8px 28px rgba(35, 65, 100, 0.07);
    --radius: 20px;
    --radius-sm: 12px;
    --pill: 999px;
    --transition: 160ms ease;
}

[data-theme="dark"] {
    color-scheme: dark;
    --primary: #75a7ff;
    --primary-dark: #a1c3ff;
    --primary-soft: rgba(59, 130, 246, 0.16);
    --on-primary: #ffffff;
    --bg: #10151e;
    --bg-secondary: #202936;
    --bg-tertiary: #2b3645;
    --surface: #19212d;
    --glass: rgba(30, 40, 55, 0.8);
    --glass-edge: rgba(255, 255, 255, 0.12);
    --text: #f3f5f5;
    --text-secondary: #b8bec5;
    --text-muted: #89929c;
    --border: #30353a;
    --border-strong: #444b51;
    --success: #86efac;
    --danger: #fca5a5;
    --shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background-color var(--transition), color var(--transition);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app { display: flex; flex-direction: column; min-height: 100vh; }

.header {
    position: fixed; top: 16px; left: 20px; right: 20px; max-width: 1080px; margin: auto;
    border-radius: var(--pill); z-index: 100;
}

/* Glass is reserved for floating controls; content stays opaque. */
.header, .mobile-nav, .back-to-top {
    background: var(--glass); border: 1px solid var(--glass-edge);
    box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
    backdrop-filter: blur(24px) saturate(160%);
}

.header-inner {
    max-width: 1120px; margin: 0 auto; padding: 0 16px; height: 64px;
    display: flex; align-items: center; justify-content: space-between;
}

.logo { min-width: 0; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: var(--radius); background: var(--primary-soft); font-size: 19px; }
.logo-text { max-width: 180px; overflow: hidden; font-size: var(--text-base); font-weight: 600; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav-link {
    min-height: 44px; padding: 10px 18px; border-radius: var(--pill); color: var(--nav-color, var(--text-secondary));
    text-decoration: none; font-size: var(--text-sm); font-weight: 500; transition: color var(--transition), background-color var(--transition);
    cursor: pointer; border: none; background: var(--nav-background, transparent);
}
@media (hover: hover) { .nav-link:hover { color: var(--text); background: var(--bg-tertiary); } }
/* URL state is available before the deferred router and the first paint. */
html[data-page="home"] :is(#home, [data-page="home"]),
html[data-page="resume"] :is(#resume, [data-page="resume"]),
html[data-page="bookmarks"] :is(#bookmarks, [data-page="bookmarks"]),
html[data-page="apps"] :is(#apps, [data-page="apps"]) {
    --page-display: block; --nav-background: var(--primary-soft); --nav-color: var(--primary);
}

.header-actions { display: flex; align-items: center; gap: 6px; }

.header-icon-action { border-radius: var(--pill); text-decoration: none; }
@media (hover: hover) { .header-icon-action:hover { border-color: var(--border); background: var(--bg-secondary); color: var(--text); } }
.sun-icon, [data-theme="dark"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: block; }



.main { flex: 1; padding-top: 104px; }

.page { display: var(--page-display, none); animation: fadeIn 0.22s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.container { max-width: 1120px; margin: 0 auto; padding: 48px 24px 72px; }





.section-title { font-size: var(--text-2xl); line-height: 1.2; font-weight: 700; margin-bottom: 24px; letter-spacing: 0; }







.footer { padding: 24px; text-align: center; color: var(--text-muted); font-size: var(--text-sm); }
.footer p { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 8px; }
.footer-segment { display: inline-flex; align-items: center; padding: 0 6px; }
.footer a { color: var(--text-secondary); text-decoration: none; }
@media (hover: hover) { .footer a:hover { color: var(--primary); } }
.visitor-counter strong { margin-left: 4px; color: var(--text-secondary); font-weight: 600; font-variant-numeric: tabular-nums; }

.back-to-top {
    position: fixed; right: 24px; bottom: 24px; z-index: 90;
    width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: var(--pill); color: var(--text-secondary);
    cursor: pointer;
    animation: backToTopIn 0.2s ease; transition: color var(--transition), background-color var(--transition);
}
@media (hover: hover) { .back-to-top:hover { color: var(--primary); background: var(--bg-secondary); box-shadow: var(--shadow); } }
.back-to-top-progress { position: absolute; inset: 0; width: 44px; height: 44px; fill: none; transform: rotate(-90deg); }
.back-to-top-track { stroke: var(--border); stroke-width: 2; }
.back-to-top-value { stroke: var(--primary); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 0.12s linear; }
.back-to-top-icon { position: relative; width: 18px; height: 18px; }
@keyframes backToTopIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }


@media (max-width: 768px) {
    .header { top: 10px; left: 12px; right: 12px; }
    .header-inner { height: 56px; padding: 0 10px; }
    :root { scroll-padding-top: 88px; }
    .main { padding-top: 88px; }
    .nav { display: none; }
    
    .container { padding: 36px 16px 96px; }
    
    
    
    .back-to-top { right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); }
    .footer { padding: 20px 16px calc(88px + env(safe-area-inset-bottom)); font-size: var(--text-sm); }
}

@media (max-width: 420px) {
    
}

@media (max-width: 350px) {
    .logo-text { display: none; }
    .container { padding-right: 12px; padding-left: 12px; }
}

@media (max-width: 520px) {
    
}

.mobile-nav {
    display: none; position: fixed; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; right: 12px;
    max-width: 440px; margin: auto; padding: 5px; border-radius: var(--pill); z-index: 100;
}

@media (max-width: 768px) { .mobile-nav { display: flex; justify-content: space-around; } }
.mobile-nav-link {
    min-width: 0; min-height: 54px; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 5px 4px; color: var(--nav-color, var(--text-muted)); text-decoration: none; font-size: var(--text-xs);
    font-weight: 500; transition: color var(--transition), background-color var(--transition); cursor: pointer; border: none; border-radius: var(--pill); background: var(--nav-background, transparent);
}
.mobile-nav-link svg { width: 21px; height: 21px; }


