:root {
    --sidebar-width: 280px;
    --sidebar-bg: #1a1d27;
    --sidebar-bg-hover: #242836;
    --sidebar-text: #b0b8c8;
    --sidebar-text-active: #ffffff;
    --accent: #5b8def;
    --accent-light: #e8f0fe;
    --accent-glow: rgba(91, 141, 239, 0.25);
    --danger: #e85d75;
    --danger-light: #fde8ec;
    --success: #4caf84;
    --success-light: #e8f7ef;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-focus: #5b8def;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', 'Monaco', 'Menlo', 'Courier New', monospace;
    --grid-color: rgba(0, 0, 0, 0.04);
    --grid-size: 22px;
}

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    background-color: #f8f9fb;
    background-image: linear-gradient(var(--grid-color) 1px, transparent 1px), linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { text-decoration: none; }

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

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar-top { padding: 28px 24px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); text-align: center; }

.logo-wrapper { display: flex; align-items: center; justify-content: center; gap: 2px; flex-wrap: wrap; margin-bottom: 8px; }

.logo-char {
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 1.65rem; font-weight: 700;
    width: 34px; height: 34px; border-radius: 8px;
}

.logo-l { background: #e8f0fe; color: #3b7de0; }
.logo-i { background: #fde8ec; color: #d94862; }
.logo-pipe { background: #e5e7eb; color: #6b7280; font-size: 1.4rem; }

.logo-text { font-size: 1.05rem; font-weight: 700; color: #ffffff; margin-left: 6px; }

.logo-subtitle { font-size: 0.78rem; color: #6b7280; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 14px; display: flex; flex-direction: column; gap: 6px; }

.nav-btn {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 14px 16px;
    border: 1px solid transparent; border-radius: var(--radius);
    background: transparent; color: var(--sidebar-text);
    cursor: pointer; transition: all var(--transition);
    font-family: inherit; font-size: 0.95rem;
}

.nav-btn:hover { background: var(--sidebar-bg-hover); color: #d1d5db; }
.nav-btn.active { background: rgba(91, 141, 239, 0.18); color: #a8c8ff; border-color: rgba(91, 141, 239, 0.3); }

.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }

.nav-label { font-size: 0.9rem; }

.sidebar-footer { padding: 16px 14px 20px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; flex-direction: column; gap: 8px; }

.footer-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); color: #8b92a3; font-size: 0.72rem; transition: all var(--transition); }

.footer-link:hover { background: rgba(255, 255, 255, 0.04); color: #c0c7d4; }

.footer-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }

.mobile-menu-toggle {
    display: none;
    position: fixed; top: 16px; left: 16px; z-index: 200;
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--card-bg); border: 1px solid var(--border);
    box-shadow: var(--shadow-md); cursor: pointer;
    flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}

.mobile-menu-toggle span { display: block; width: 20px; height: 2px; background: var(--text-primary); border-radius: 2px; }

.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 32px 36px; display: flex; flex-direction: column; align-items: center; min-height: 100vh; }

.panel {
    width: 100%; max-width: 780px;
    background: var(--card-bg); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); border: 1px solid var(--border);
    animation: fadeSlideIn 0.35s ease-out;
}

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

.panel-header { padding: 24px 28px 18px; border-bottom: 1px solid var(--border); background: #fafbfc; }

.panel-title { font-size: 1.3rem; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }

.title-icon { font-size: 1.4rem; }

.panel-subtitle { font-size: 0.85rem; color: var(--text-secondary); }

.panel-body { padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 18px; }

.input-group { display: flex; flex-direction: column; gap: 6px; }

.input-label { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; font-weight: 600; }

.char-count { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; background: #f3f4f6; padding: 2px 10px; border-radius: 20px; }

.input-textarea {
    width: 100%; padding: 14px 16px;
    border: 2px solid var(--border); border-radius: var(--radius);
    font-family: inherit; font-size: 0.95rem; line-height: 1.7;
    resize: vertical; transition: all var(--transition);
    background: #fafbfc; min-height: 120px;
}

.input-textarea:focus { outline: none; border-color: var(--border-focus); background: #ffffff; box-shadow: 0 0 0 4px rgba(91, 141, 239, 0.08); }

.tab-buttons { display: flex; gap: 0; background: #f3f4f6; border-radius: var(--radius); padding: 4px; margin: 8px 0; }

.tab-btn {
    flex: 1; padding: 10px 16px;
    border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary);
    font-family: inherit; font-size: 0.88rem; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
}

.tab-btn.active { background: var(--card-bg); color: var(--accent); box-shadow: var(--shadow-sm); font-weight: 600; }

.action-row { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 24px; border-radius: 10px;
    font-family: inherit; font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: all var(--transition);
    border: none; white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px var(--accent-glow); }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-outline { background: #ffffff; color: var(--text-secondary); border: 2px solid var(--border); }
.btn-outline:hover { background: #f9fafb; border-color: #c0c7d0; color: var(--text-primary); }

.btn-secondary { background: var(--accent-light); color: var(--accent); }
.btn-secondary:hover { filter: brightness(0.95); }

.btn-icon { width: 18px; height: 18px; flex-shrink: 0; }

.output-group { display: flex; flex-direction: column; gap: 10px; }

.output-box {
    width: 100%; padding: 14px 16px;
    border: 2px solid var(--border); border-radius: var(--radius);
    background: #fafbfc; font-family: var(--font-mono); font-size: 0.9rem;
    line-height: 1.7; min-height: 80px; word-break: break-all;
}

.code-area {
    width: 100%; padding: 14px 16px;
    border: 2px solid var(--border); border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.7;
    resize: vertical; transition: all var(--transition);
    background: #fafbfc; min-height: 120px;
}

.code-area:focus { outline: none; border-color: var(--border-focus); background: #ffffff; box-shadow: 0 0 0 4px rgba(91, 141, 239, 0.08); }

.code-area.output-area { background: #fafbfc; }

.output-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.toast {
    position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #1f2937; color: #ffffff; padding: 12px 24px;
    border-radius: 30px; font-size: 0.88rem; font-weight: 500;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    opacity: 0; pointer-events: none; transition: all 0.35s ease;
    z-index: 9999;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 99; }

.sidebar-overlay.visible { display: block; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 20px 16px; }
    .mobile-menu-toggle { display: flex; }
    .panel { max-width: 100%; }
    .panel-body { padding: 18px 16px; }
    .panel-header { padding: 18px 16px; }
}
select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px 14px !important;
    padding: 10px 40px 10px 16px !important;
    border: 2px solid var(--border) !important;
    border-radius: 10px !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    cursor: pointer !important;
    transition: all var(--transition) !important;
    line-height: 1.5 !important;
}
select:hover {
    background-color: #f9fafb !important;
    border-color: #c0c7d0 !important;
}
select:focus {
    outline: none !important;
    border-color: var(--border-focus) !important;
    box-shadow: 0 0 0 4px rgba(91,141,239,0.08) !important;
    background-color: #ffffff !important;
}
