:root {
    --color-primary: #8B7355;
    --color-secondary: #A0826D;
    --color-background: #F5F1E8;
    --color-surface: #E8DCC8;
    --color-text: #3E2723;
    --color-text-light: #5D4037;
    --color-border: #D7CCC8;
    --color-link: #bbc6d1;
    --color-link-hover: #357ABD;
    --color-canvas-bg: #FFFFFF;
    --color-cell: #3E2723;
    --color-grid-line: #E0E0E0;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--color-background) 0%, var(--color-surface) 100%);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

header {
    background: linear-gradient(to bottom, var(--color-primary), var(--color-secondary));
    color: var(--color-background);
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header h4 {
    font-size: 1rem;
    font-weight: 400;
    margin-top: 0.5rem;
}

header a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.3s ease, text-decoration 0.3s ease;
    font-weight: 500;
}

header a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

main {
    flex: 1;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.main-content {
    display: flex;
	justify-content: center;
    gap: 2rem;
    max-width: 1400px;
    width: 100%;
    align-items: flex-start;
}

#canvas {
    background: var(--color-canvas-bg);
    border: 3px solid var(--color-primary);
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    cursor: crosshair;
    transition: box-shadow 0.3s ease;
}

#canvas:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.settings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 300px;
    max-width: 350px;
}

.settings section,
.settings .buttons,
.settings .info {
    background: rgba(232, 220, 200, 0.3);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.settings h3 {
    color: var(--color-primary);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.settings h4 {
    color: var(--color-text-light);
    font-size: 0.75rem;
    margin-top: 0.5rem;
    font-weight: 500;
    font-style: italic;
}

label {
    display: block;
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    margin-top: 0.8rem;
    font-weight: 500;
}

input[type="number"],
select {
    width: 100%;
    padding: 0.6rem;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-background);
    color: var(--color-text);
    font-size: 0.95rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

button {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#apply {
    background: var(--color-secondary);
    color: var(--color-background);
}

#apply:hover:not(:disabled) {
    background: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

#start {
    background: #4CAF50;
    color: white;
}

#start:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#stop {
    background: #FF9800;
    color: white;
}

#stop:hover:not(:disabled) {
    background: #F57C00;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#clear {
    background: #F44336;
    color: white;
}

#clear:hover:not(:disabled) {
    background: #D32F2F;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info p {
    color: var(--color-text);
    font-size: 0.95rem;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    align-items: center;
}

.info span {
    font-weight: 600;
    color: var(--color-primary);
    text-align: right;
}

footer {
    background: var(--color-primary);
    color: var(--color-background);
    padding: 1.5rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
}

footer a {
    display: inline-flex;
    align-items: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
    order: -1;
}

footer a:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

footer p {
    margin: 0;
}

footer svg path {
    fill: var(--color-background);
}

@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }
    
    .settings {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 900px) {
    #canvas {
        max-width: 100%;
        height: auto;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    header h4 {
        font-size: 0.9rem;
    }
    
    main {
        padding: 1rem 0.5rem;
    }
    
    .settings {
        padding: 1rem;
    }
}