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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: #fff;
}

h1 {
    margin-bottom: 20px;
    font-size: 1.8rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.editor-panel {
    background: rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.canvas-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#pixelCanvas {
    border: 2px solid #4a5568;
    border-radius: 4px;
    cursor: crosshair;
    image-rendering: pixelated;
    background: #000;
}

.tools {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 200px;
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-group label {
    font-size: 0.9rem;
    color: #a0aec0;
}

.color-btn {
    flex: 1;
    padding: 15px;
    border: 2px solid #4a5568;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.color-btn.active {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.color-btn-white {
    background: #fff;
    color: #000;
}

.color-btn-black {
    background: #000;
    color: #fff;
}

.tool-active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-color: #667eea !important;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid #4a5568;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.2);
}

.btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.4);
}

.output-panel {
    max-width: 600px;
}

.output-panel h3 {
    margin-bottom: 10px;
}

#cppOutput {
    width: 100%;
    min-width: 400px;
    height: 300px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #c9d1d9;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    padding: 15px;
    resize: vertical;
}

.format-options {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.format-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #a0aec0;
}

.tool-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.grid-info {
    font-size: 0.85rem;
    color: #718096;
    text-align: center;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-group .btn {
    flex: 1;
}

.info-panel {
    background: rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    margin-top: 20px;
    color: #fff;
}

.info-toggle {
    margin: 0;
    padding: 10px;
    font-size: 1.2rem;
    color: #fff;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.2s ease;
}

.info-toggle:hover {
    color: #667eea;
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.info-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    padding: 10px;
}

.info-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0 10px;
}

.info-panel p {
    line-height: 1.6;
    color: #e2e8f0;
    margin-bottom: 20px;
}

.info-section {
    margin-top: 25px;
}

.info-section h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #a0aec0;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section ul li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    line-height: 1.5;
}

.info-section ul li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.info-section pre {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    margin-top: 10px;
}

.info-section code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #c9d1d9;
    line-height: 1.6;
}

.info-section p code,
.info-section li code {
    background: rgba(102, 126, 234, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
