/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #8B7355 0%, #A0936B 100%);
    color: #2F2F2F;
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(245, 245, 220, 0.9);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5em;
    font-weight: bold;
    letter-spacing: 2px;
    color: #2F2F2F;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    color: #DC143C;
    font-weight: bold;
}

/* Main content layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    align-items: start;
}

.calculator-container {
    background: rgba(245, 245, 220, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* Canvas styling */
canvas {
    border: 3px solid #2F2F2F;
    border-radius: 50%;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 0, 0, 0.2);
    background: #F5F5DC;
    display: block;
    margin: 0 auto 20px auto;
    cursor: default;
}

/* Controls */
.controls {
    background: rgba(176, 196, 222, 0.3);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #B0C4DE;
}

.control-section {
    margin-bottom: 25px;
}

.control-section h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #2F2F2F;
    font-weight: bold;
    border-bottom: 2px solid #DC143C;
    padding-bottom: 5px;
}

.ring-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ring-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
}

.ring-control label {
    flex: 1;
    font-weight: bold;
    font-size: 0.9em;
}

.rotate-btn, .lock-btn {
    background: #B0C4DE;
    border: 2px solid #2F2F2F;
    border-radius: 4px;
    width: 35px;
    height: 35px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rotate-btn:hover, .lock-btn:hover {
    background: #9FB3D3;
    transform: scale(1.1);
}

.rotate-btn:active, .lock-btn:active {
    transform: scale(0.95);
}

.reset-btn {
    width: 100%;
    padding: 12px;
    background: #DC143C;
    color: white;
    border: 2px solid #2F2F2F;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 15px;
}

.reset-btn:hover {
    background: #B91C3C;
    transform: translateY(-2px);
}

/* Preset buttons */
.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.preset-btn {
    padding: 10px 15px;
    background: #8FBC8F;
    border: 2px solid #2F2F2F;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #2F2F2F;
}

.preset-btn:hover {
    background: #7DAC7D;
    transform: translateY(-2px);
}

/* Results panel */
.results-panel {
    background: rgba(245, 245, 220, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.results-panel h3 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: #2F2F2F;
    text-align: center;
    border-bottom: 3px solid #DC143C;
    padding-bottom: 10px;
}

.results-content {
    margin-bottom: 25px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #CCC;
}

.result-item label {
    font-weight: bold;
    color: #2F2F2F;
}

.result-item span {
    font-weight: bold;
    color: #DC143C;
    font-family: 'Courier New', monospace;
}

.scenario-description {
    background: rgba(176, 196, 222, 0.3);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #DC143C;
    margin-bottom: 20px;
}

.scenario-description h4 {
    font-size: 1.1em;
    margin-bottom: 8px;
    color: #2F2F2F;
}

.scenario-description p {
    font-size: 0.9em;
    line-height: 1.4;
}

.educational-info {
    background: rgba(143, 188, 143, 0.3);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #8FBC8F;
}

.educational-info h4 {
    font-size: 1.1em;
    margin-bottom: 8px;
    color: #2F2F2F;
}

.educational-info p {
    font-size: 0.85em;
    line-height: 1.4;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    background: rgba(47, 47, 47, 0.9);
    color: white;
    border-radius: 10px;
    font-size: 0.9em;
}

/* Responsive design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .results-panel {
        position: relative;
        top: auto;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .calculator-container {
        padding: 20px;
    }
    
    canvas {
        width: 100%;
        height: auto;
        max-width: 500px;
    }
    
    .preset-buttons {
        grid-template-columns: 1fr;
    }
    
    .ring-control {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .ring-control label {
        width: 100%;
        margin-bottom: 5px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .header {
        background: white;
        border: 3px solid black;
    }
    
    .calculator-container,
    .results-panel {
        background: white;
        border: 3px solid black;
    }
    
    .rotate-btn,
    .lock-btn,
    .preset-btn {
        border: 3px solid black;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .controls,
    .footer {
        display: none;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
}