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

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.access-status {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    display: inline-block;
}

.no-access {
    text-align: center;
    padding: 60px 20px;
}

.no-access h2 {
    font-size: 2em;
    margin-bottom: 30px;
    color: #ffcccb;
}

.countdown-display {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.countdown-timer {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px;
    border-radius: 15px;
    margin: 20px 0;
}

#countdown-time {
    font-size: 4em;
    font-weight: bold;
    color: #ff5722;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

.user-interface {
    display: grid;
    gap: 40px;
    grid-template-columns: 1fr;
}

.main-content-wrapper {
    display: grid;
    grid-template-columns: 1fr;
}

.led-circle {
    width: 400px;
    max-width: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    margin: 0 auto 30px;
    position: relative;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 70%
    );
    aspect-ratio: 1;
}

@media (min-width: 768px) {
    .main-content-wrapper {
        grid-template-columns: 1fr;
        gap: 35px;
    }
}

@media (min-width: 1200px) {
    .user-interface {
        gap: 50px;
    }

    .main-content-wrapper {
        grid-template-columns: 1fr 1fr;
        align-items: start;
        gap: 20px;
    }

    .formula-section {
        max-width: none;
    }

    .simulation-section {
        position: sticky;
        top: 20px;
        min-height: 600px;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
}

.explanation-section,
.formula-section,
.simulation-section,
.history-section {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 15px;
}

.explanation-section h2,
.formula-section h3,
.simulation-section h3,
.history-section h3 {
    margin-bottom: 20px;
    color: #f0f0f0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 10px;
}

.help-content {
    color: #e0e0e0;
    line-height: 1.6;
}

.help-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

@media (min-width: 768px) {
    .help-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.help-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
}

.help-item h4 {
    margin-bottom: 10px;
    color: #8cff80;
}

.help-item ul {
    list-style: none;
    padding-left: 0;
}

.help-item li {
    margin: 5px 0;
    padding-left: 15px;
    position: relative;
}

.help-item li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #8cff80;
    font-weight: bold;
}

code {
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
    color: #8faf90;
    font-family: "Courier New", monospace;
}

.example {
    background: rgba(76, 175, 80, 0.2);
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    border-left: 4px solid #4caf50;
}

.color-inputs {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.input-group {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid;
}

.input-group.red {
    border-left-color: #f44336;
}

.input-group.green {
    border-left-color: #4caf50;
}

.input-group.blue {
    border-left-color: #2196f3;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #f0f0f0;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 16px;
    font-family: "Courier New", monospace;
}

.input-group input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.formula-preview {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-family: "Courier New", monospace;
    font-size: 14px;
    color: #4caf50;
    min-height: 20px;
}

.control-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#submit-btn {
    background: linear-gradient(45deg, #4caf50, #45a049);
    color: white;
    flex: 1;
}

#submit-btn:hover {
    background: linear-gradient(45deg, #45a049, #3d8b40);
    transform: translateY(-2px);
}

#clear-btn {
    background: linear-gradient(45deg, #f44336, #d32f2f);
    color: white;
}

#clear-btn:hover {
    background: linear-gradient(45deg, #d32f2f, #c62828);
    transform: translateY(-2px);
}

#example-btn {
    background: linear-gradient(45deg, #ff9800, #f57c00);
    color: white;
}

.dropdown-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.dropdown-container select {
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-width: 150px;
}

.dropdown-container select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.dropdown-container select option {
    background: #fff;
    color: #333;
    padding: 8px;
}

#example-btn {
    background: linear-gradient(45deg, #ff9800, #f57c00);
    color: white;
}

#example-btn:hover {
    background: linear-gradient(45deg, #f57c00, #e65100);
    transform: translateY(-2px);
}

#example-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
}

.status-message {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    display: none;
}

.status-message.success {
    background: rgba(76, 175, 80, 0.2);
    color: #aaffaa;
    border: 1px solid #4caf50;
}

.status-message.error {
    background: rgba(244, 67, 54, 0.2);
    color: #ffaaaa;
    border: 1px solid #f44336;
}

.simulation-container {
    text-align: center;
}

@media (min-width: 1200px) {
    .led-circle {
        width: 50vh;
    }
}

.led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.1s ease;
    transform: translate(-75%, -75%);
}

.simulation-controls {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #f0f0f0;
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 10px;
}

#play-btn {
    background: linear-gradient(45deg, #4caf50, #45a049);
    color: white;
    margin-right: 10px;
}

#play-btn:hover {
    background: linear-gradient(45deg, #45a049, #3d8b40);
}

#reset-time-btn {
    background: linear-gradient(45deg, #2196f3, #1976d2);
    color: white;
}

#reset-time-btn:hover {
    background: linear-gradient(45deg, #1976d2, #1565c0);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.history-item .timestamp {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 5px;
}

.history-item .formulas {
    font-family: "Courier New", monospace;
    font-size: 14px;
}

.formula-line {
    margin: 2px 0;
}

.formula-line.red {
    color: #880000;
}
.formula-line.green {
    color: #008800;
}
.formula-line.blue {
    color: #000088;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 2em;
    }

    #countdown-time {
        font-size: 3em;
    }

    .help-grid {
        grid-template-columns: 1fr;
    }

    .control-buttons {
        flex-direction: column;
    }

    .dropdown-container {
        width: 100%;
    }

    .dropdown-container select {
        flex: 1;
        min-width: auto;
    }

    .led {
        width: 6px;
        height: 6px;
    }
}
