:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2c2c2c;
    --bg-tertiary: #3a3a3a;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --accent-primary: #007bff;
    --accent-hover: #0056b3;
    --accent-blue: #0d6efd;
    --accent-red: #dc3545;
    --accent-green: #198754;
    --border-color: #444;
    --font-family: 'Inter', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-family); background-color: var(--bg-primary); color: var(--text-primary); display: flex; justify-content: center; align-items: center; height: 100vh; overflow: hidden; }
.app-container { display: flex; width: 100%; height: 100%; background-color: var(--bg-primary); }
.sidebar { width: 320px; background-color: var(--bg-secondary); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; padding: 24px; overflow-y: auto; flex-shrink: 0; }
.sidebar-header { margin-bottom: 24px; }
h2, h3 { margin-bottom: 12px; }
h3 { color: var(--text-secondary); font-size: 1rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; margin-top: 20px; }
.templates .template-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.template-preview { aspect-ratio: 1 / 1; border: 2px solid var(--border-color); border-radius: 4px; cursor: pointer; background-color: var(--bg-tertiary); transition: border-color 0.2s, transform 0.2s; display: grid; gap: 2px; padding: 4px; }
.template-preview:hover { border-color: var(--accent-primary); transform: scale(1.05); }
.template-preview.selected { border-color: var(--accent-primary); box-shadow: 0 0 10px var(--accent-primary); }
.template-preview .mini-cell { background-color: var(--text-secondary); border-radius: 1px; }
.option-item, .option-item-toggle { margin-bottom: 16px; display: flex; flex-direction: column; }
.option-item-toggle { flex-direction: row; justify-content: space-between; align-items: center; }
.option-item-toggle.disabled { opacity: 0.5; pointer-events: none; }
label { margin-bottom: 8px; font-size: 0.9rem; color: var(--text-secondary); }
input[type="range"], input[type="text"], input[type="color"] { width: 100%; }
input[type="text"], input[type="color"] { padding: 8px; background-color: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 4px; color: var(--text-primary); }
input[type="color"] { height: 40px; padding: 4px; }
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 26px; appearance: none; -webkit-appearance: none; background-color: var(--bg-tertiary); border-radius: 34px; cursor: pointer; transition: background-color 0.3s; }
.toggle-switch::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; border-radius: 50%; transition: transform 0.3s; }
.toggle-switch:checked { background-color: var(--accent-primary); }
.toggle-switch:checked::before { transform: translateX(24px); }
.sidebar-footer { margin-top: auto; }
.action-btn { width: 100%; padding: 12px; border: none; border-radius: 4px; font-size: 1rem; font-weight: 500; cursor: pointer; transition: background-color 0.2s; }
.action-btn.primary { background-color: var(--accent-primary); color: white; }
.action-btn.primary:hover { background-color: var(--accent-hover); }
.main-content { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; overflow: hidden; position: relative; }
.workspace-actions { width: 600px; margin-bottom: 16px; }
#workspace-upload-btn { background-color: var(--bg-tertiary); color: var(--text-primary); }
#workspace-upload-btn:hover { background-color: #4a4a4a; }
#grid-workspace { width: 600px; height: 600px; display: grid; background-color: var(--bg-primary); gap: var(--gap-size, 10px); flex-shrink: 0; }
.placeholder-message { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--text-secondary); text-align: center; border: 2px dashed var(--border-color); border-radius: 8px; }
.grid-cell { position: relative; background-color: var(--bg-secondary); overflow: hidden; display: flex; justify-content: center; align-items: center; border-radius: var(--radius-size, 0px); background-size: cover; background-position: center center; background-repeat: no-repeat; transition: box-shadow 0.3s; }
.cell-placeholder { font-size: 2rem; color: var(--text-secondary); user-select: none; }
.cell-controls { position: absolute; top: 8px; right: 8px; z-index: 20; display: flex; gap: 6px; }
.cell-control-btn { width: 28px; height: 28px; background-color: rgba(0, 0, 0, 0.6); color: white; border: none; border-radius: 50%; font-size: 20px; line-height: 28px; font-weight: bold; cursor: pointer; display: flex; justify-content: center; align-items: center; transition: background-color 0.2s, transform 0.2s; }
.cell-control-btn:hover { transform: scale(1.1); }
.more-btn:hover { background-color: var(--accent-primary); }
.confirm-btn { background-color: var(--accent-green); }
.cancel-btn { background-color: var(--accent-red); }
.cell-context-menu { position: absolute; background-color: #3f3f3f; border-radius: 6px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); z-index: 1002; overflow: hidden; min-width: 180px; }
.context-menu-btn { display: block; width: 100%; padding: 12px 16px; background: none; border: none; color: var(--text-primary); text-align: left; cursor: pointer; border-bottom: 1px solid var(--border-color); }
.context-menu-btn:hover { background-color: var(--accent-primary); }
.context-menu-btn:last-child { border-bottom: none; }
.context-menu-btn.disabled { opacity: 0.5; cursor: not-allowed; background-color: transparent !important; }
.cell-play-button { position: absolute; width: clamp(30px, 20%, 100px); aspect-ratio: 1; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="48" fill="rgba(0,0,0,0.5)" stroke="white" stroke-width="4"/><polygon points="35,25 75,50 35,75" fill="white"/></svg>'); background-size: contain; background-repeat: no-repeat; background-position: center; z-index: 10; pointer-events: none; }
.cell-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; pointer-events: none; z-index: 5; }
.cell-overlay span { color: white; font-size: clamp(1rem, 15%, 4rem); font-weight: bold; text-align: center; }
#workspace-loader { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.7); display: flex; justify-content: center; align-items: center; z-index: 1001; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 50px; height: 50px; border: 5px solid var(--border-color); border-top-color: var(--accent-primary); border-radius: 50%; animation: spin 1s linear infinite; }
.grid-cell.is-focusing { box-shadow: 0 0 0 4px var(--accent-primary) inset; cursor: grab; }
.grid-cell.is-focusing:active { cursor: grabbing; }
.grid-cell.switch-target { cursor: pointer; box-shadow: 0 0 0 4px var(--accent-blue) inset; }
.grid-cell.switch-target::after { content: 'Pilih Ini'; position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background-color: var(--accent-blue); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; z-index: 15; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.grid-cell.switch-target:hover::after { opacity: 1; }
.hidden { display: none !important; }