/* Maze builder section */
.maze-section {
    overflow: hidden;
    max-height: 1800px;
    opacity: 1;
    transition: max-height 0.55s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.maze-section.collapsed {
    max-height: 0;
    opacity: 0;
}

.maze-section.peek {
    max-height: 1800px;
    opacity: 1;
}

.canvas-wrapper {
    min-height: 640px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 56px 10px 72px;
    overflow: visible;
}

.diamond-container {
    position: relative;
    transform: rotate(-45deg);
    transform-origin: center center;
    line-height: 0;
    filter: drop-shadow(0 0 24px rgba(0, 217, 245, 0.12));
}

.diamond-container canvas {
    display: block;
    background: #11162c;
    border: 2px solid rgba(124, 144, 255, 0.22);
}

.diamond-label {
    position: absolute;
    transform: rotate(45deg);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.55);
    white-space: nowrap;
}

.start-label {
    color: #5dffb0;
}

.end-label {
    color: #ff6a6a;
}

.peek-hint {
    display: none;
    text-align: center;
    padding: 10px 12px 0;
    color: #b6a8ff;
    font-size: 0.84rem;
}

.peek-hint.active {
    display: block;
}

.peek-hint kbd,
.scan-help kbd {
    background: #1f2545;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom-width: 2px;
    border-radius: 6px;
    padding: 2px 7px;
    color: #f4f7ff;
    font-family: inherit;
    font-weight: 700;
}

/* 1D scanner section */
.scan-section {
    display: none;
    padding: 18px 14px 28px;
    text-align: center;
}

.scan-section.active {
    display: block;
}

.scan-section h2 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    color: #7afcff;
}

.scan-section p {
    margin: 0 0 14px;
    color: #9db1d8;
    font-size: 0.82rem;
}

.scan-shell {
    max-width: 940px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.scan-canvas-wrap {
    display: flex;
    justify-content: center;
}

.scan-canvas-wrap canvas {
    width: min(100%, 900px);
    height: auto;
    display: block;
    background: linear-gradient(180deg, rgba(7, 12, 25, 1), rgba(6, 8, 18, 1));
    border: 2px solid rgba(124, 144, 255, 0.18);
    border-radius: 16px;
    box-shadow: 0 0 28px rgba(0, 217, 245, 0.08), inset 0 0 24px rgba(255, 255, 255, 0.03);
}

.scan-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 14px;
}

.scan-readout {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 12px;
    color: #dce5ff;
    font-size: 0.84rem;
}

.scan-help {
    margin-top: 12px;
    color: #9db1d8;
    font-size: 0.8rem;
    line-height: 1.6;
}

#scanCanvas {
    cursor: crosshair;
}

/* Responsive */
@media (max-width: 700px) {
    .canvas-wrapper {
        min-height: 520px;
        padding: 42px 8px 56px;
    }

    .controls {
        gap: 10px;
    }

    .control-group {
        padding: 8px 10px;
    }
}

@media (max-width: 768px) {
    button {
        min-height: 44px;
        padding: 12px 20px;
    }

    .scan-readout {
        width: 100%;
        justify-content: space-around;
    }
}

@media (max-width: 768px) {
    #scanCanvas {
        border: 2px solid rgba(0, 217, 245, 0.4);
        box-shadow: 0 0 15px rgba(0, 217, 245, 0.2);
    }

    .scan-help kbd {
        display: none;
    }

    .diamond-label {
        font-size: 0.6rem;
    }
}
