body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

.grid-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 90px);
    display: flex;
}

.grid-wrapper {
    flex: 1;
    overflow: auto;
    background: white;
}

#gridCanvas {
    display: block;
    background: white;
}

/* Top left playback controls */
.controls-playback {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 100;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 480px;
}

.controls-playback button {
    padding: 8px 12px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: 0.2s;
}

.controls-playback button:hover:not(:disabled) {
    background: #f0f0f0;
}

.controls-playback button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.controls-playback button.playing {
    background: #333;
    color: white;
    border-color: #333;
}

/* Top left controls */
.controls-top-left {
    position: absolute;
    top: 56px;
    left: 16px;
    z-index: 100;
    display: flex;
    gap: 8px;
}

.controls-top-left button {
    padding: 8px 16px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s;
}

.controls-top-left button:hover {
    background: #f0f0f0;
}

.controls-top-left button.active {
    background: #333;
    color: white;
    border-color: #333;
}

/* Top right controls */
.controls-top-right {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
}

.pattern-info {
    background: rgba(255,255,255,0.95);
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 320px;
    overflow: hidden;
}

.toggle-btn {
    width: 100%;
    padding: 8px 12px;
    background: white;
    border: none;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.toggle-btn:hover {
    background: #f8f8f8;
}

.pattern-panel {
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
}

.pattern-panel.collapsed {
    display: none;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.info-item label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.info-item input,
.info-item textarea,
.info-item span {
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fafafa;
}

.info-item input,
.info-item textarea {
    font-family: inherit;
    resize: none;
}

.info-item span {
    background: none;
    border: none;
    padding: 4px 0;
}

.info-item button {
    padding: 8px 12px;
    background: rgba(51, 51, 51, 0.1);
    border: 1px solid #999;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: 0.2s;
}

.info-item button:hover {
    background: rgba(51, 51, 51, 0.2);
}

.counters {
    background: rgba(255,255,255,0.95);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    min-width: 100px;
}

/* Bottom right controls */
.controls-bottom-right {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 480px;
}

.controls-bottom-right button {
    padding: 10px 12px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    width: 70px;
    transition: 0.2s;
}

.controls-bottom-right button:hover:not(:disabled) {
    background: #f0f0f0;
}

.controls-bottom-right button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.controls-bottom-right button.playing {
    background: #333;
    color: white;
    border-color: #333;
}