:root {
    color-scheme: dark;
    --bg-primary: #242933;
    --bg-secondary: #2e3440;
    --bg-tertiary: #3b4252;
    --bg-dark: #1e222a;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --text-muted: #9aa5b8;
    --accent: #88c0d0;
    --accent-hover: #81a1c1;
    --danger: #bf616a;
    --success: #a3be8c;
    --warning: #ebcb8b;
    --border: #434c5e;
}

[data-theme="light"] {
    color-scheme: light;
    --bg-primary: #eceff4;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e9f0;
    --bg-dark: #d8dee9;
    --text-primary: #2e3440;
    --text-secondary: #434c5e;
    --text-muted: #4c566a;
    --accent: #5e81ac;
    --accent-hover: #48729e;
    --danger: #bf616a;
    --success: #2e7d32;
    --warning: #b26a00;
    --border: #d8dee9;
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}
.theme-toggle-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

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

body {
    font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    height: 100vh;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hide { display: none !important; }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
p { color: var(--text-secondary); font-size: 0.95rem; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: #4e5058; color: white; }
.btn-ghost:hover { background: #6d6f78; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.input, .select, .textarea {
    width: 100%;
    background: var(--bg-dark);
    border: none;
    color: var(--text-primary);
    padding: 10px;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.5;
    transition: border 0.2s;
    resize: none;
}

.textarea {
    overflow: hidden;
    min-height: 44px !important;
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
}

.view-box {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    width: 100%;
    max-width: 480px;
    margin: 15vh auto;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
[data-theme="light"] .view-box {
    box-shadow: 0 4px 16px rgba(46, 52, 64, 0.06);
}

.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.server-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    user-select: none;
}

.server-card:hover {
    background: var(--bg-tertiary);
}

.server-card:active {
    transform: translateY(1px);
}

.server-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 0.75rem;
    background: var(--bg-dark);
    object-fit: cover;
    transition: border-radius 0.2s;
}

.server-card:hover .server-avatar {
    border-radius: 16px;
}

.server-name {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.dashboard-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: var(--bg-primary);
}

.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: transform 0.3s ease;
    z-index: 1000;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0.75rem 1rem;
    height: 48px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}

.sidebar-brand {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.nav-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.1s, color 0.1s;
    font-size: 1rem;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: #88c0d0;
    color: #242933;
    font-weight: 600;
}

[data-theme="light"] .nav-item.active {
    background: #5e81ac;
    color: #ffffff;
}

.sidebar-footer {
    padding: 1rem;
    background: var(--bg-tertiary);
}

.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
}

.top-nav {
    display: none;
    height: 48px;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.2);
    align-items: center;
    padding: 0 1rem;
    justify-content: space-between;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.setting-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.setting-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.setting-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
    flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border);
    transition: .2s;
    border-radius: 14px;
    border: 1px solid transparent;
}

[data-theme="light"] .slider {
    background-color: #d8dee9;
    border-color: #c8d0dc;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 2px; bottom: 2px;
    background-color: #ffffff;
    transition: .2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider { background-color: var(--accent); border-color: var(--accent); }
input:checked + .slider:before { transform: translateX(16px); }

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 999;
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .top-nav {
        display: flex;
    }
    .main-content {
        padding: 1rem;
    }
    .sidebar.open + .mobile-overlay {
        display: block;
    }
}

.command-item {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.command-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.command-settings-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.command-settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.command-name {
    font-family: "Consolas", "Courier New", monospace;
    font-weight: 700;
    color: var(--accent);
    font-size: 1rem;
}

.command-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.save-bar {
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    background: #111214;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
}

.save-bar.visible {
    transform: translateY(0);
}

.dict-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: flex-start;
}

.dict-k {
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    .save-bar {
        left: 0;
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* Global Topbar & Wordmark */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    width: 100%;
    margin-bottom: 2rem;
}
.brand {
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.wordmark {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 750;
    letter-spacing: -1.6px;
    text-decoration: none;
    display: inline-block;
    line-height: 1;
}
.wordmark span {
    color: var(--accent);
}
.brand-sub {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

