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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    color: white;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #1e293b;
    border-radius: 12px;
    padding: 30px;
}

h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #94a3b8;
    margin-bottom: 30px;
}

.sequence-display {
    background: #334155;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    border: 2px solid #475569;
}

.sequence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sequence-header h2 {
    font-size: 1.2rem;
}

.sequence-length {
    color: #94a3b8;
    font-size: 0.9rem;
}

.sequence-output {
    background: #0f172a;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #4ade80;
    height: 100px;
    overflow-y: auto;
    word-break: break-all;
}

.nwords-display {
    background: #334155;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    border: 2px solid #475569;
}

.nwords-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.nwords-header h2 {
    font-size: 1.2rem;
}

.nwords-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nwords-controls label {
    color: #cbd5e1;
    font-size: 0.9rem;
}

.nwords-select {
    padding: 4px 8px;
    background: #475569;
    color: white;
    border: 1px solid #64748b;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
}

.nwords-select:focus {
    outline: none;
    border-color: #2563eb;
}

.nwords-count {
    color: #94a3b8;
    font-size: 0.9rem;
}

.nwords-output {
    background: #0f172a;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #60a5fa;
    height: 120px;
    overflow-y: auto;
    word-wrap: break-word;
    line-height: 1.4;
}

.nword-item {
    display: inline-block;
    background: #1e40af;
    color: white;
    padding: 2px 6px;
    margin: 2px;
    border-radius: 3px;
    font-size: 0.8rem;
}

.canvases-wrapper {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.canvas-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-section h3 {
    color: white;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.canvas-container {
    background: #334155;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
}

canvas {
    border: 2px solid #475569;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    cursor: grab;
    user-select: none;
}

canvas:active {
    cursor: grabbing;
}

.control-panel {
    background: #334155;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.control-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
}

.mode-toggle {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-button {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.mode-button.active {
    background: #2563eb;
    color: white;
}

.mode-button:not(.active) {
    background: #475569;
    color: #cbd5e1;
}

.mode-button:not(.active):hover:not(:disabled) {
    background: #64748b;
}

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

.slider-container {
    margin-bottom: 20px;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.slider {
    flex: 1;
    height: 8px;
    background: #475569;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #2563eb;
    border-radius: 50%;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #2563eb;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.number-input {
    width: 120px;
    padding: 8px 12px;
    background: #475569;
    color: white;
    border: 1px solid #64748b;
    border-radius: 6px;
    font-size: 1rem;
}

.number-input:focus {
    outline: none;
    border-color: #2563eb;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preset-button {
    padding: 6px 12px;
    background: #475569;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.preset-button:hover:not(:disabled) {
    background: #64748b;
}

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

.ratio-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    color: #cbd5e1;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.action-button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.action-button.start {
    background: #16a34a;
    color: white;
}

.action-button.start:hover {
    background: #15803d;
}

.action-button.stop {
    background: #ea580c;
    color: white;
}

.action-button.stop:hover {
    background: #c2410c;
}

.action-button.reset {
    background: #475569;
    color: white;
}

.action-button.reset:hover {
    background: #64748b;
}

.info-panel {
    background: #334155;
    padding: 20px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.6;
}

.info-panel h3 {
    color: white;
    margin-bottom: 10px;
}

.info-panel strong {
    color: white;
}

.speed-labels {
    display: flex;
    justify-content: space-between;
    color: #94a3b8;
    font-size: 0.8rem;
    margin-top: 5px;
}