@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   1. GLOBAL & RESET
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark: #0a0a1a;
    --bg-panel: #0f0f2e;
    --accent-cyan: #00e5ff;
    --accent-magenta: #ff006e;
    --text-primary: #e0e0e0;
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-cyan: rgba(0, 229, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --transition-speed: 0.2s;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

::selection {
    background: var(--accent-cyan);
    color: #000;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.2);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.4);
}

/* ==========================================================================
   2. TOOLBAR (HEADER)
   ========================================================================== */
.header-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(15, 15, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-cyan);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}

.toolbar-center {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: auto;
}

.toolbar-center button,
.toolbar-left button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.toolbar-center button:hover,
.toolbar-left button:hover {
    background: rgba(0, 229, 255, 0.15);
    color: var(--accent-cyan);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 4px 8px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   3. MAIN CONTENT
   ========================================================================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.main-content {
    display: flex;
    height: calc(100vh - 52px);
    margin-top: 52px;
}

/* ==========================================================================
   4. CANVAS WRAPPER
   ========================================================================== */
.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at center, var(--bg-panel) 0%, var(--bg-dark) 100%);
    overflow: hidden;
    position: relative;
}

.canvas-container {
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.1s ease-out;
}

#mainCanvas {
    display: block;
    cursor: default;
}

#dropZone {
    position: absolute;
    inset: 0;
    background: rgba(0, 229, 255, 0.1);
    border: 3px dashed var(--accent-cyan);
    display: none; /* hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all var(--transition-speed);
}

#dropZone.active {
    display: flex;
    animation: pulseBorder 1.5s infinite;
}

#dropZone span {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent-cyan);
    pointer-events: none;
}

/* ==========================================================================
   5. RIGHT PANEL
   ========================================================================== */
.right-panel {
    width: 340px;
    min-width: 340px;
    background: rgba(15, 15, 46, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(0, 229, 255, 0.08);
    overflow-y: auto;
    padding: 8px;
}

/* ==========================================================================
   6. PANEL SECTIONS
   ========================================================================== */
.panel-section {
    margin-bottom: 6px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease forwards;
}

.section-header {
    padding: 12px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
    transition: background 0.2s;
}

.section-header:hover {
    background: rgba(0, 229, 255, 0.05);
}

.section-icon {
    font-size: 16px;
    color: var(--accent-cyan);
}

.section-toggle {
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 10px;
    opacity: 0.5;
}

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

.section-body {
    padding: 0 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-section.collapsed .section-body {
    display: none;
}

/* ==========================================================================
   7. FORM ELEMENTS
   ========================================================================== */
.control-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

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

.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    transition: all 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: rgba(0, 229, 255, 0.4);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.1);
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.5)' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

textarea {
    min-height: 100px;
    resize: vertical;
    font-family: monospace;
}

/* Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 229, 255, 0.5);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover,
input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

.range-value {
    font-size: 11px;
    color: rgba(0, 229, 255, 0.8);
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Color Input */
input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    padding: 2px;
    background: transparent;
    overflow: hidden;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    user-select: none;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

input[type="checkbox"]:checked {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

input[type="checkbox"]:checked::before {
    content: '';
    width: 4px;
    height: 8px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* ==========================================================================
   8. BUTTONS
   ========================================================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), #7c4dff);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.3);
    transition: all var(--transition-speed);
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

.action-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-btn:hover {
    background: rgba(0, 229, 255, 0.1);
    border-color: rgba(0, 229, 255, 0.3);
    color: var(--accent-cyan);
}

.danger-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.danger-btn:hover {
    background: rgba(255, 0, 110, 0.15);
    border-color: rgba(255, 0, 110, 0.4);
    color: var(--accent-magenta);
}

.add-btn {
    width: 100%;
    border: 2px dashed rgba(0, 229, 255, 0.2);
    background: transparent;
    border-radius: 8px;
    padding: 10px;
    color: rgba(0, 229, 255, 0.6);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.add-btn:hover {
    border-color: rgba(0, 229, 255, 0.5);
    color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.05);
}

.preset-btn {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.preset-btn:hover {
    border-color: rgba(0, 229, 255, 0.3);
    color: var(--accent-cyan);
}

.preset-btn.active {
    border-color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent-cyan);
}

.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

/* ==========================================================================
   9. SPLIT MODE SELECTOR
   ========================================================================== */
.split-mode-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.split-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s;
}

.split-btn:hover {
    border-color: rgba(0, 229, 255, 0.3);
}

.split-btn.active {
    border-color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.1);
}

.split-icon {
    width: 28px;
    height: 20px;
    display: flex;
    gap: 1px;
    justify-content: center;
}

.split-icon div {
    background: rgba(0, 229, 255, 0.4);
    border-radius: 1px;
    flex: 1;
}

.split-btn.active .split-icon div {
    background: var(--accent-cyan);
}

.split-btn span {
    font-size: 9px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.6;
}

.split-btn.active span {
    opacity: 1;
    color: var(--accent-cyan);
}

/* ==========================================================================
   10. CHAT BLOCK ITEMS
   ========================================================================== */
.chat-block-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-block-item {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    transition: all 0.2s;
}

.chat-block-item.active {
    border-color: rgba(0, 229, 255, 0.4);
    background: rgba(0, 229, 255, 0.05);
}

.block-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
    cursor: pointer;
}

.block-title {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.block-visibility-btn,
.block-delete-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.block-visibility-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.block-delete-btn:hover {
    color: var(--accent-magenta);
    background: rgba(255, 0, 110, 0.15);
}

/* ==========================================================================
   11. CHARACTER ITEMS
   ========================================================================== */
.character-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.character-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.character-color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.character-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.character-item input[type="color"] {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

/* ==========================================================================
   12. UPLOAD AREA
   ========================================================================== */
.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: rgba(0, 229, 255, 0.4);
    color: rgba(0, 229, 255, 0.6);
    background: rgba(0, 229, 255, 0.03);
}

.upload-area.has-image {
    border-style: solid;
    border-color: rgba(0, 229, 255, 0.2);
    padding: 0;
}

.upload-area img.thumbnail {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}

.upload-area input[type="file"] {
    display: none;
}

/* ==========================================================================
   13. EMPTY HINT
   ========================================================================== */
.empty-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    padding: 16px;
    font-style: italic;
}

/* ==========================================================================
   14. TOGGLE BUTTONS
   ========================================================================== */
.toggle-group {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 2px;
}

.toggle-btn {
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.toggle-btn.active {
    background: rgba(0, 229, 255, 0.15);
    color: var(--accent-cyan);
}

/* ==========================================================================
   15. TEMPLATE LIST
   ========================================================================== */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.template-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    transition: background 0.2s;
}

.template-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.template-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
}

.template-load-btn,
.template-delete-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-muted);
}

.template-load-btn:hover {
    color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.1);
}

.template-delete-btn:hover {
    color: var(--accent-magenta);
    background: rgba(255, 0, 110, 0.15);
}

/* ==========================================================================
   16. FULLSCREEN PREVIEW
   ========================================================================== */
.fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    display: none; /* hidden by default */
    align-items: center;
    justify-content: center;
}

.fullscreen-overlay.active {
    display: flex;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.fullscreen-close:hover {
    background: rgba(255, 0, 110, 0.6);
    transform: scale(1.1);
}

/* ==========================================================================
   17. NOTIFICATIONS / TOAST
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(15, 15, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 10px;
    padding: 12px 20px;
    color: #fff;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease forwards;
}

.toast.success {
    border-color: #00e676;
}

.toast.error {
    border-color: #ff006e;
}

/* ==========================================================================
   18. ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseBorder {
    0%, 100% {
        border-color: rgba(0, 229, 255, 0.3);
    }
    50% {
        border-color: rgba(0, 229, 255, 0.7);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 229, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Staggered fadeIn for panel sections */
.panel-section:nth-child(1) { animation-delay: 0.05s; }
.panel-section:nth-child(2) { animation-delay: 0.1s; }
.panel-section:nth-child(3) { animation-delay: 0.15s; }
.panel-section:nth-child(4) { animation-delay: 0.2s; }
.panel-section:nth-child(5) { animation-delay: 0.25s; }
.panel-section:nth-child(6) { animation-delay: 0.3s; }
.panel-section:nth-child(7) { animation-delay: 0.35s; }
.panel-section:nth-child(8) { animation-delay: 0.4s; }
.panel-section:nth-child(9) { animation-delay: 0.45s; }
.panel-section:nth-child(10) { animation-delay: 0.5s; }

/* ==========================================================================
   MISSING STYLES - Setting Rows, Tool Buttons, Format Controls
   ========================================================================== */

/* Setting Row - main layout for label + input pairs */
.setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.setting-row label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    min-width: 95px;
    flex-shrink: 0;
}

.setting-row input[type="range"],
.setting-row input[type="number"],
.setting-row input[type="text"],
.setting-row select {
    flex: 1;
    width: auto;
    min-width: 50px;
}

.setting-row input[type="range"] {
    margin: 0 4px;
}

.setting-row span {
    font-size: 11px;
    color: var(--accent-cyan);
    min-width: 44px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.setting-row.dual-input {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.setting-row.dual-input .input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.setting-row.dual-input .input-group label {
    min-width: auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-cyan);
}

.setting-row.dual-input input[type="number"] {
    width: 100%;
}

/* Sub-section styling */
.sub-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Tool buttons (toolbar) */
.tool-btn {
    height: 34px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

.tool-btn:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.3);
    color: var(--accent-cyan);
}

.tool-btn.primary {
    height: 34px;
    background: linear-gradient(135deg, var(--accent-cyan), #7c4dff);
    color: #fff;
    border: 1px solid transparent;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.25);
}

.tool-btn.primary:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.4);
    color: #fff;
}

.tool-btn.discord-btn {
    height: 34px;
    background: #5865F2;
    color: #fff;
    border: 1px solid #4752c4;
    font-weight: 600;
}

.tool-btn.discord-btn:hover {
    background: #4752c4;
    border-color: #3b45a6;
    box-shadow: 0 0 12px rgba(88, 101, 242, 0.5);
    color: #fff;
}

/* Format buttons (B, I, alignment) */
.text-format-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.format-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-speed);
}

.format-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.3);
}

.format-btn.active {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Alignment group */
.align-group {
    display: flex;
    gap: 2px;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 2px;
}

/* Template header */
.template-header {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
    margin-bottom: 4px;
}

/* Toast positioning fix */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.info {
    border-color: rgba(0, 229, 255, 0.4);
}

/* Header-toolbar fix for layout */
.header-toolbar {
    display: flex;
    height: 52px;
}

/* Range value displays inline */
.setting-row span[id$="Val"] {
    font-size: 11px;
    color: rgba(0, 229, 255, 0.8);
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Logo h1 */
.logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
}

.logo-img {
    height: 26px;
    width: 26px;
    object-fit: contain;
    border-radius: 4px;
    margin-right: 4px;
}

.logo-icon {
    font-size: 20px;
}

/* Grid 2x2 for split four icon */
.split-icon.grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
}

.split-icon.free-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.split-rect {
    background: rgba(0, 229, 255, 0.3);
    border-radius: 2px;
    min-height: 6px;
}

.split-btn.active .split-rect {
    background: var(--accent-cyan);
}

.dev-credit {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    letter-spacing: 1px;
    text-transform: uppercase;
    z-index: 1;
}

/* Custom layout to prevent text/slider overlap in Efektler section */
#effectsSection .setting-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 12px;
    width: 100%;
}
#effectsSection .setting-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 2px;
    width: 100%;
}
#effectsSection .setting-row select,
#effectsSection .setting-row input[type="range"] {
    width: 100%;
}

/* ==========================================================================
   CROP MODAL
   ========================================================================== */
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.crop-modal-content {
    background: rgba(15, 15, 46, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.crop-modal-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.crop-info {
    font-size: 12px;
    color: var(--accent-cyan);
    font-weight: 400;
}

.crop-modal-body {
    padding: 16px;
    overflow: auto;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-preview-container {
    position: relative;
    display: inline-block;
    cursor: crosshair;
    user-select: none;
}

.crop-preview-container canvas {
    display: block;
    max-width: 80vw;
    max-height: 70vh;
    border-radius: 4px;
}

.crop-box {
    position: absolute;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    cursor: move;
    z-index: 2;
    pointer-events: auto;
}

.crop-box::after {
    content: '';
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 12px;
    height: 12px;
    background: var(--accent-cyan);
    border-radius: 2px;
    cursor: nwse-resize;
}

.crop-modal-footer {
    padding: 12px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
