/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

/* Main Container optimized for 1024x600 */
.container {
    width: 1024px;
    height: 600px;
    background: white;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);

    /* Absolute center instead of flex */
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -300px;
    margin-left: -512px;
}

/* Header */
header {
    margin-bottom: 20px;
    border-bottom: 2px solid #FF0000;
    padding-bottom: 10px;
    height: 70px;
}

header h1 {
    font-size: 24px;
    color: #000;
}

header p {
    font-size: 14px;
    color: #666;
}

/* Layout */
.main-content {
    height: 480px;
    overflow: hidden;
}

/* Left Panel: Controls */
.controls {
    float: left;
    width: 300px;
    height: 100%;
    margin-right: 30px;
    position: relative;
    padding-top: 20px;
}

.difficulty-selector {
    margin-bottom: 30px;
}

.difficulty-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 16px;
}

.buttons {
    display: block;
    overflow: hidden;
    /* Clear floats */
}

.buttons .btn {
    float: left;
    width: 31%;
    margin-right: 3.5%;
    padding: 10px 0;
    text-align: center;
}

.buttons .btn:last-child {
    margin-right: 0;
}

.btn {
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 16px;
    border-radius: 5px;
    font-weight: 500;
    background-color: #e0e0e0;
    color: #333;
    display: block;
    width: 100%;
    text-align: center;
}

.btn.active {
    background-color: #333;
    color: white;
    border: 2px solid #333;
}

.action-buttons {
    margin-bottom: 0px;
}

.action-buttons .btn {
    margin-bottom: 15px;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.btn-primary {
    background-color: #FF0000;
    color: white;
    font-weight: bold;
    font-size: 18px;
    padding: 15px;
    border: none;
}

.btn-primary:active {
    background-color: #cc0000;
}

.btn-secondary {
    background-color: #333;
    color: white;
    font-size: 18px;
    padding: 15px;
    border: none;
}

.btn-secondary:active {
    background-color: #1a1a1a;
}

.btn-home {
    background-color: #666;
    color: white;
    padding: 15px;
    position: absolute;
    bottom: 0px;
    left: 0;
    width: 100%;
    border: none;
}

/* Right Panel: Maze Preview */
.maze-container {
    float: left;
    width: 650px;
    /* 1024 - 40 total padding - 300 controls - 30 margin - 4px safety */
    height: 100%;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    position: relative;
    text-align: center;
}

.maze-container:before {
    content: '';
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

canvas {
    display: inline-block;
    vertical-align: middle;
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: white;
}