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

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    padding: 15px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: #2c3e50;
    color: white;
    padding: 20px;
    text-align: center;
    border-bottom: 3px solid #3498db;
}

header h1 {
    font-size: 2em;
    margin-bottom: 5px;
}

header p {
    font-size: 0.95em;
    opacity: 0.9;
}

.content {
    display: flex;
    gap: 20px;
    padding: 20px;
}

@media (max-width: 1024px) {
    .content {
        flex-direction: column;
    }
}

.controls-section {
    max-width: 700px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.mode-btn {
    flex: 1;
    padding: 10px;
    font-size: 1em;
    font-weight: bold;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background: #e8f4f8;
}

.mode-btn.active {
    background: #3498db;
    color: white;
}

.input-group,
.output-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    font-family: "Courier New", monospace;
    resize: vertical;
    transition: border-color 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: #3498db;
}

textarea[readonly] {
    background: #f8f8f8;
}

.parameters {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.param-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.param {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.param input[type="number"] {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    transition: border-color 0.2s ease;
}

.param input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
}

.checkbox-param {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: auto;
}

.checkbox-param input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3498db;
}

.checkbox-param label {
    margin: 0;
    cursor: pointer;
}

.output-group {
    position: relative;
}

.copy-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 6px 14px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.info-section {
    background: #fff8e1;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item label {
    color: #f57c00;
    font-size: 0.9em;
}

.info-display {
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-family: "Courier New", monospace;
    word-break: break-all;
}

.visualization-section {
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.visualization-section h3 {
    color: #2c3e50;
    font-size: 1.3em;
}

#canvas {
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    max-width: 100%;
    height: auto;
    user-select: none;
}

.viz-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.viz-controls button {
    padding: 8px 16px;
    background: white;
    border: 2px solid #3498db;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.viz-controls button:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
}

footer {
    background: #f8f9fa;
    padding: 15px;
    text-align: center;
    color: #666;
    font-size: 0.85em;
    border-top: 1px solid #e0e0e0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeIn 0.5s ease;
}
