:root {
    --bg-dark: #09090b;
    --card-bg: rgba(22, 27, 34, 0.85);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent-blue: #38bdf8;
    --accent-purple: #c084fc;
    --accent-green: #4ade80;
    --accent-red: #f87171;
    --accent-yellow: #facc15;
    --glass-shine: rgba(255, 255, 255, 0.03);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    margin-bottom:50vh;
}

.ambient-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none;
    background: #09090b;
}

.grid-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.5;
}

.orb {
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    opacity: 0.2;
    pointer-events: none;
    will-change: transform;
    transform: translate3d(0,0,0);
}

.orb-1 {
    top: -200px; left: -200px;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
}

.orb-2 {
    bottom: -200px; right: -200px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
}

header.hero-section {
    text-align: center; margin: 30px auto 50px; max-width: 600px;
    will-change: transform;
    transform: translate3d(0,0,0);
}

.logo-container {
    position: relative; width: 80px; height: 80px; margin: 0 auto 15px;
}

.logo { width: 100%; height: 100%; object-fit: contain; position: relative; z-index: 2; }

.logo-glow {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 100px; height: 100px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.3) 0%, transparent 70%);
    z-index: 1;
}

h1 {
    font-size: 2.5rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 8px;
}

.gradient-text {
    background: linear-gradient(135deg, #fff 30%, var(--accent-blue));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

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

main { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 25px; }

.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px; padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    transform: translate3d(0,0,0);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px) translate3d(0,0,0);
}

.card-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 15px;
    border-bottom: 1px solid var(--card-border); padding-bottom: 12px;
}

.icon-box {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.03);
}

.icon-box svg { width: 20px; height: 20px; }

.blue-glow { color: var(--accent-blue); }
.purple-glow { color: var(--accent-purple); }
.green-glow { color: var(--accent-green); }
.red-glow { color: var(--accent-red); }
.yellow-glow { color: var(--accent-yellow); }
.cyan-glow { color: #22d3ee; }

h2 { font-size: 1.1rem; font-weight: 600; color: #fff; }
.hint-text { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 15px; display: block; }

.btn-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
}

.btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 14px; border-radius: 6px; border: 1px solid transparent;
    font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 500;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02); color: var(--text-secondary);
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn-icon { width: 14px; height: 14px; stroke-width: 2.5; }
.btn-block { width: 100%; }

.btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-blue { border-color: rgba(56, 189, 248, 0.2); color: var(--accent-blue); }
.btn-green { border-color: rgba(74, 222, 128, 0.2); color: var(--accent-green); }
.btn-red { border-color: rgba(248, 113, 113, 0.2); color: var(--accent-red); }
.btn-yellow { border-color: rgba(250, 204, 21, 0.2); color: var(--accent-yellow); }
.btn-purple { border-color: rgba(192, 132, 252, 0.2); color: var(--accent-purple); }
.btn-cyan { border-color: rgba(34, 211, 238, 0.2); color: #22d3ee; }
.btn-outline { border-color: rgba(255, 255, 255, 0.1); color: #fff; }

.divider { height: 1px; background: var(--card-border); margin: 15px 0; }

.code-box {
    background: #0d1117; border: 1px solid #30363d; border-left: 2px solid var(--accent-purple);
    border-radius: 6px; padding: 12px; font-family: 'Fira Code', monospace;
    font-size: 0.8rem; color: #a5d6ff; line-height: 1.4;
    height: 200px; overflow-y: auto; white-space: pre; margin-bottom: 15px;
}

.sw-control-panel { background: rgba(0,0,0,0.2); border-radius: 8px; padding: 12px; margin-bottom: 15px; border: 1px dashed var(--card-border); }
.status-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 0.85rem; }
.status-badge { padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.status-active { background: rgba(74, 222, 128, 0.1); color: var(--accent-green); border: 1px solid rgba(74, 222, 128, 0.2); }
.status-inactive { background: rgba(248, 113, 113, 0.1); color: var(--accent-red); border: 1px solid rgba(248, 113, 113, 0.2); }
.sw-instruction { font-size: 0.75rem; color: var(--text-secondary); margin-top: 8px; font-style: italic; text-align: center; }

.event-stack { display: flex; flex-direction: column; gap: 8px; }
.event-row { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.015); padding: 8px; border-radius: 6px; border: 1px solid var(--card-border); }

.custom-checkbox { position: relative; display: flex; align-items: center; cursor: pointer; min-width: 130px; }
.custom-checkbox input { opacity: 0; width: 0; }
.checkmark { position: absolute; left: 0; height: 16px; width: 16px; background: rgba(255,255,255,0.05); border-radius: 3px; border: 1px solid var(--card-border); }
.custom-checkbox input:checked ~ .checkmark { background: var(--accent-red); border-color: var(--accent-red); }
.label-text { margin-left: 24px; font-size: 0.85rem; color: var(--text-secondary); }

.storage-display { background: #000; padding: 10px; border-radius: 6px; font-family: monospace; color: var(--accent-green); border: 1px solid #222; margin-bottom: 15px; font-size: 0.75rem; word-break: break-all; }
.demo-box { background: rgba(0,0,0,0.2); padding: 12px; border-radius: 6px; margin-top: 12px; border: 1px solid var(--card-border); }
.demo-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; }
.grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid-item { background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.2); color: var(--accent-blue); display: flex; align-items: center; justify-content: center; height: 35px; border-radius: 3px; font-size: 0.75rem; }

.reveal { opacity: 1; transform: none; }

@media (max-width: 600px) {
    h1 { font-size: 1.8rem; }
    .btn-grid { grid-template-columns: 1fr 1fr; }
    .event-row { flex-direction: column; align-items: stretch; }
}