* { box-sizing: border-box; }

:root {
    --bg: #f5f7fb;
    --sidebar: #fff;
    --card: #fff;
    --text: #202124;
    --muted: #7b8190;
    --border: #e8eaf0;
    --primary: #5b5ce2;
    --primary-light: #f0f0ff;
    --hover: #f6f6ff;
    --shadow: 0 10px 30px rgba(30,35,60,.06);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;
}

button, input, textarea { font: inherit; }

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

.sidebar {
    width: 240px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 28px;
    font-size: 20px;
    font-weight: 700;
}
.logo span { color: var(--primary); }

.logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg,#6566f1,#8a62ed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-title {
    font-size: 12px;
    color: #a0a4ae;
    margin: 20px 10px 8px;
}

.menu { display: flex; flex-direction: column; gap: 3px; }

.menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 9px;
    color: #555b68;
    text-decoration: none;
    font-size: 14px;
    transition: .2s;
}
.menu a:hover { background: var(--hover); color: var(--primary); }
.menu a span { width: 22px; text-align: center; }

.sidebar-footer {
    margin-top: 30px;
    padding: 12px;
    font-size: 12px;
    color: #aaa;
}

.main {
    margin-left: 240px;
    width: calc(100% - 240px);
    min-height: 100vh;
}

.header {
    height: 72px;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 34px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-title { font-size: 18px; font-weight: 600; }
.search {
    width: 260px;
    margin-left: auto;
    border: 1px solid var(--border);
    background: #f8f9fc;
    border-radius: 9px;
    padding: 9px 13px;
    outline: none;
}
.search:focus { border-color: var(--primary); background: white; }

.content { padding: 34px; max-width: 1500px; }
.welcome { margin-bottom: 30px; }
.welcome h1 { margin: 0 0 8px; font-size: 28px; }
.welcome p { margin: 0; color: var(--muted); }

.category { margin-bottom: 32px; }
.category-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }

.tools {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(210px,1fr));
    gap: 16px;
}

.tool {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    cursor: pointer;
    transition: transform .2s,box-shadow .2s,border .2s;
}
.tool:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: #dcdcff;
}
.tool-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    margin-bottom: 15px;
}
.tool-name { font-weight: 600; margin-bottom: 7px; }
.tool-desc { font-size: 13px; line-height: 1.6; color: var(--muted); }

.tool-window {
    display: none;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 32px;
    padding: 24px;
    box-shadow: var(--shadow);
}
.tool-window.active { display: block; }

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.tool-header h2 { margin: 0; font-size: 19px; }

.close-btn {
    border: 0;
    background: #f3f4f7;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
}

textarea,input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 12px;
    outline: none;
    background: #fafbfc;
}
textarea:focus,input:focus { border-color: var(--primary); background: white; }
textarea { min-height: 240px; resize: vertical; font-family: Consolas,monospace; }

button.primary {
    border: 0;
    background: var(--primary);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 12px;
}
button.primary:hover { opacity: .9; }

.result {
    margin-top: 15px;
    padding: 15px;
    border-radius: 9px;
    background: #f7f8fb;
    min-height: 50px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: Consolas,monospace;
}

.tool-row { display: flex; gap: 12px; align-items: center; }
.tool-row > * { flex: 1; }

.mobile-menu { display: none; border: 0; background: transparent; font-size: 22px; cursor: pointer; }

@media (max-width:800px) {
    .sidebar {
        transform: translateX(-100%);
        transition: .25s;
        z-index: 100;
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; width: 100%; }
    .mobile-menu { display: block; }
    .header { padding: 0 18px; }
    .search { width: 180px; }
    .content { padding: 22px 16px; }
}

@media (max-width:480px) {
    .tools { grid-template-columns: 1fr; }
    .header-title { display: none; }
}
