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

:root {
    --bg: #08111f;
    --card: rgba(30, 41, 59, 0.92);
    --line: rgba(51, 65, 85, 0.9);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #3b82f6;
}

html,
body {
    min-height: 100%;
    overflow-x: hidden;
    touch-action: pan-y;
}

body {
    color: var(--text);
    font-family: Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 28%),
        radial-gradient(circle at bottom right, rgba(74, 222, 128, 0.10), transparent 30%),
        linear-gradient(180deg, #08111f 0%, #0f172a 100%);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
}

.sidebar {
    padding: 24px;
    border-right: 1px solid rgba(51, 65, 85, 0.7);
    background: rgba(2, 8, 23, 0.58);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    touch-action: auto;
}

html {
    scrollbar-color: rgba(71, 85, 105, 0.95) rgba(8, 17, 31, 0.9);
}

body,
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(71, 85, 105, 0.95) rgba(8, 17, 31, 0.9);
}

body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 10px;
}

body::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: rgba(8, 17, 31, 0.92);
    border-radius: 999px;
}

body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(71, 85, 105, 0.95), rgba(51, 65, 85, 0.95));
    border-radius: 999px;
    border: 2px solid rgba(8, 17, 31, 0.92);
}

body::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(100, 116, 139, 0.98), rgba(71, 85, 105, 0.98));
}

body::-webkit-scrollbar-corner,
.sidebar::-webkit-scrollbar-corner {
    background: rgba(8, 17, 31, 0.92);
}

.brand {
    margin-bottom: 22px;
}

.brand-top {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.university-logo {
    width: 100%;
    max-width: 170px;
    height: auto;
    opacity: 0.95;
}

.brand h1 {
    font-size: 30px;
    margin-bottom: 8px;
}

.brand p {
    color: var(--muted);
    line-height: 1.5;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    touch-action: auto;
}

.card h2 {
    font-size: 17px;
    margin-bottom: 14px;
}

.control-group {
    margin-bottom: 18px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text);
}

.control-group label span {
    min-width: 38px;
    text-align: right;
    color: #bfdbfe;
    font-weight: 700;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.9), rgba(34, 197, 94, 0.9));
    border-radius: 999px;
    outline: none;
    border: 1px solid rgba(51, 65, 85, 0.9);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(15, 23, 42, 0.35);
    transition: box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.control-group input[type="range"]:hover {
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(59, 130, 246, 0.28),
        0 0 14px rgba(59, 130, 246, 0.14);
}

.control-group input[type="range"]:focus {
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.45),
        0 0 0 2px rgba(59, 130, 246, 0.3),
        0 0 18px rgba(34, 197, 94, 0.16);
}

.control-group input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.95), rgba(34, 197, 94, 0.95));
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -7px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #cbd5e1 35%, #60a5fa 100%);
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.35),
        0 0 14px rgba(59, 130, 246, 0.25);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.control-group input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.06);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.38),
        0 0 18px rgba(34, 197, 94, 0.28);
}

.control-group input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.95), rgba(34, 197, 94, 0.95));
    border: 1px solid rgba(51, 65, 85, 0.9);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #cbd5e1 35%, #60a5fa 100%);
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.35),
        0 0 14px rgba(59, 130, 246, 0.25);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.control-group input[type="range"]:hover::-moz-range-thumb {
    transform: scale(1.06);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.38),
        0 0 18px rgba(34, 197, 94, 0.28);
}

.checkbox-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    color: #dbe4f0;
}

.checkbox-row:last-child {
    margin-bottom: 0;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

button,
input,
label {
    touch-action: manipulation;
}

button {
    border: 0;
    border-radius: 12px;
    padding: 11px 12px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
    opacity: 0.97;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-list p {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

.status-list span {
    color: var(--text);
    font-weight: bold;
}

.main-panel {
    padding: 28px 32px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
    touch-action: auto;
}

.canvas-card {
    width: 100%;
    max-width: 1280px;
    padding: 22px;
    border-radius: 24px;
    border: 1px solid rgba(51, 65, 85, 0.8);
    background: rgba(15, 23, 42, 0.62);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(6px);
    touch-action: auto;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.canvas-header h2 {
    font-size: 20px;
    margin-bottom: 6px;
}

.canvas-header p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

#canvas-stage {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: auto;
}

#canvas-container {
    width: min(100%, 1040px);
    aspect-ratio: 3 / 2;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(51, 65, 85, 0.9);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.28);
    background: rgb(8, 15, 28);
    touch-action: pan-y pinch-zoom;
}

#canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    touch-action: pan-y pinch-zoom;
}

@media (min-width: 921px) {
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
    }
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 330px minmax(0, 1fr);
    }

    .main-panel {
        padding: 20px;
    }

    #canvas-container {
        width: 100%;
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(51, 65, 85, 0.7);
        position: static;
        height: auto;
    }

    .main-panel {
        padding: 16px;
    }

    .canvas-card {
        padding: 14px;
        border-radius: 18px;
    }

    .canvas-header {
        margin-bottom: 14px;
    }
}

@media (max-width: 640px) {
    .sidebar {
        padding: 16px;
    }

    .brand h1 {
        font-size: 24px;
    }

    .university-logo {
        max-width: 140px;
    }

    .button-grid {
        grid-template-columns: 1fr;
    }

    .status-list p {
        font-size: 13px;
    }

    .canvas-header h2 {
        font-size: 18px;
    }

    .canvas-header p {
        font-size: 13px;
    }
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    transform: none;
    box-shadow: none;
}

button:disabled:hover {
    transform: none;
    opacity: 0.48;
    box-shadow: none;
}

.button-active {
    box-shadow:
        0 0 0 1px rgba(147, 197, 253, 0.45),
        0 0 20px rgba(59, 130, 246, 0.22);
}