/* 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;
    /* Prevent scrolling on kiosk mode */
    text-align: center;
    /* Helper for absolute centering */
}

/* 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 centering for older browsers */
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -300px;
    /* half of height */
    margin-left: -512px;
    /* half of width */
    text-align: left;
}

/* Header */
header {
    margin-bottom: 15px;
    border-bottom: 2px solid #FF0000;
    /* Toshiba Red */
    padding-bottom: 5px;
    height: 60px;
    /* Fixed height for reliable layout */
}

header h1 {
    font-size: 22px;
    color: #000;
}

header p {
    font-size: 13px;
    color: #666;
}

/* Layout */
.main-content {
    overflow: hidden;
    height: 485px;
    /* 600 - 20(pad-top) - 20(pad-bot) - 60(header) - 15(margin) */
}

/* Left Panel: Controls */
.controls {
    width: 380px;
    float: left;
    height: 100%;
    position: relative;
    /* For absolute positioning of bottom buttons */
}

.controls>* {
    margin-bottom: 15px;
}

.style-selector label,
.difficulty-selector label,
.shape-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 15px;
}

/* Buttons Container */
.buttons {
    display: block;
    width: 100%;
}

.btn {
    display: inline-block;
    padding: 10px 5px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    border-radius: 5px;
    font-weight: 500;
    background-color: #e0e0e0;
    color: #333;
    text-align: center;
    text-decoration: none;

    /* Calculate width for 3 buttons side by side with margins */
    width: 31%;
    margin-right: 2%;
    margin-bottom: 12px;
    /* ADDED MARGIN FOR VERTICAL SPACING IF BLOCKS STACK/WRAP */

    /* Force standard font and spacing for Linux kiosk */
    font-family: Arial, Helvetica, sans-serif !important;
}

.buttons .btn:last-child {
    margin-right: 0;
}

.dot-spacer {
    font-weight: bold;
    margin: 0 5px;
}

.btn-primary .dot-spacer {
    color: #FF0000;
    /* Toshiba Red */
}

.btn-secondary .dot-spacer {
    color: #333;
    /* Dark Grey */
}

.btn-home .dot-spacer {
    color: #666;
    /* Medium Grey */
}

.btn.active {
    background-color: #333;
    color: white;
    border: 2px solid #333;
    padding: 8px 3px;
    /* Adjust padding to compensate for border */
}

/* Action Buttons */
.action-buttons {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
}

.action-buttons .btn {
    display: block;
    width: 100%;
    margin-right: 0;
    margin-bottom: 15px;
    /* INCREASED FROM 10PX TO 15PX */
}

.action-buttons .btn:last-child {
    margin-bottom: 0;
}

.btn-primary {
    background-color: #FF0000;
    /* Toshiba Red */
    color: white;
    font-weight: bold;
    font-size: 18px;
    padding: 15px;
}

.btn-secondary {
    background-color: #333;
    color: white;
    font-size: 18px;
    padding: 15px;
}

.btn-home {
    background-color: #666;
    color: white;
    font-size: 18px;
    padding: 15px;
}

/* Right Panel: Preview */
.maze-container {
    width: 560px;
    /* 1024 - 40(padding) - 380(controls) - 44(safe margin) */
    height: 100%;
    float: right;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    text-align: center;
    /* Center the canvas horizontally */
}

canvas {
    max-width: 100%;
    max-height: 100%;
    /* Remove vertical margin auto since we use inline-block centering */
    display: inline-block;
    background: white;
    border: 1px solid #ccc;
}