:root {
    --brat-green: #8ACE00;
    --brat-green-hover: #7bb800;
    --brat-green-light: #f3fbe6;
    --black: #121212;
    --gray-900: #1a1a1a;
    --gray-800: #2a2a2a;
    --gray-700: #404040;
    --gray-600: #666666;
    --gray-400: #a0a0a0;
    --gray-200: #e5e5e5;
    --gray-100: #f5f5f5;
    --gray-50: #fafafa;
    --white: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-brat: 0 6px 24px rgba(138, 206, 0, 0.35);
    --radius-lg: 16px;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f8f9fa;
    height: 100vh;
    overflow: hidden;
    color: var(--black);
}

/* ── 2-COLUMN GRID LAYOUT ── */
.page-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ── LEFT PANEL (CONTROLS) ── */
.panel-left {
    background: var(--white);
    border-right: 1.5px solid var(--gray-200);
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.03);
    z-index: 10;
}

/* ── BRAND HEADER ── */
.brand {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--brat-green);
}

.title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1;
    text-transform: lowercase;
    color: var(--black);
}

.dot {
    color: var(--brat-green);
}

.badge {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: lowercase;
    background: var(--brat-green);
    color: var(--black);
    padding: 2px 8px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(138, 206, 0, 0.4);
}

/* ── LABELS & ROWS ── */
.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.input-group label,
.option-group label {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-700);
}

.char-count {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--gray-400);
}

.val-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--black);
    background: var(--brat-green-light);
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid rgba(138, 206, 0, 0.4);
}

/* ── TEXTAREA ── */
#inputText {
    width: 100%;
    padding: 8px 10px;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--black);
    outline: none;
    resize: vertical;
    min-height: 60px;
    transition: all 0.2s ease;
    line-height: 1.4;
}

#inputText::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

#inputText:focus {
    border-color: var(--brat-green);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(138, 206, 0, 0.25);
}

/* ── PRESET CHIPS ── */
.preset-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chip {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--gray-800);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: lowercase;
}

.chip:hover {
    background: var(--brat-green);
    border-color: var(--brat-green);
    color: var(--black);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(138, 206, 0, 0.3);
}

/* ── COLOR PRESETS ── */
.color-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-btn {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    padding: 0;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.color-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-btn.active {
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(138, 206, 0, 0.5);
}

.color-btn.active::after {
    content: '✓';
    position: absolute;
    font-size: 0.7rem;
    font-weight: 900;
    color: var(--black);
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
}

.color-btn[data-color="#000000"].active::after {
    color: var(--white);
    text-shadow: none;
}

.custom-color-btn {
    background: linear-gradient(135deg, #ff90e8, #ffd000, #8ACE00, #70d6ff) !important;
    overflow: hidden;
}

.custom-color-btn::after {
    display: none !important;
}

.custom-color-btn input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border: none;
}

/* ── SEGMENTED CONTROL ── */
.segmented-control {
    display: flex;
    background: var(--gray-100);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    gap: 4px;
}

.segment {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: lowercase;
}

.segment:hover {
    color: var(--black);
}

.segment.active {
    background: var(--white);
    color: var(--black);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ── RANGE SLIDER ── */
input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--gray-200);
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brat-green);
    cursor: pointer;
    border: 2px solid var(--white);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--brat-green-hover);
}

/* ── GENERATE BUTTON ── */
#generateBtn {
    width: 100%;
    padding: 14px;
    background: var(--brat-green);
    color: var(--black);
    border: none;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: lowercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    box-shadow: var(--shadow-brat);
}

#generateBtn:hover {
    background: var(--brat-green-hover);
    box-shadow: 0 8px 28px rgba(138, 206, 0, 0.5);
    transform: translateY(-1px);
}

#generateBtn:active {
    transform: translateY(0);
}

.btn-icon {
    animation: spin 6s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── NOTE & FOOTER ── */
.note {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-600);
}

.note code {
    color: #4a7500;
    background: var(--brat-green-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 700;
}

.footer {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: lowercase;
    color: var(--gray-400);
}

/* ── RIGHT PANEL (CANVAS PREVIEW) ── */
.panel-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    gap: 10px;
    background: #f4f5f7;
    overflow-y: auto;
}

/* ── CANVAS WRAPPER ── */
.canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 380px;
    height: calc(100vh - 100px);
    max-height: 380px;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    background: var(--white);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.canvas-wrapper:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

.canvas-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0.4;
    background: var(--brat-green);
}

.canvas-placeholder span {
    font-size: 2.5rem;
    animation: spin 8s linear infinite;
    display: inline-block;
    color: var(--black);
}

.canvas-placeholder p {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: lowercase;
    color: var(--black);
}

.canvas-placeholder.hidden {
    opacity: 0;
    pointer-events: none;
}

#bratCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 14px;
    object-fit: contain;
}

/* ── ACTION BUTTONS ── */
.action-btns {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 650px;
    justify-content: center;
}

.btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--white);
    color: var(--black);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: lowercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-action:hover {
    border-color: var(--brat-green);
    background: var(--brat-green-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(138, 206, 0, 0.25);
}

.btn-action.primary {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

.btn-action.primary:hover {
    background: var(--gray-800);
    color: var(--brat-green);
    border-color: var(--gray-800);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.btn-action:active {
    transform: translateY(0);
}

/* ── TOAST NOTIFICATION ── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(70px);
    background: var(--black);
    color: var(--brat-green);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(.34, 1.56, .64, 1);
    z-index: 999;
    white-space: nowrap;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(138, 206, 0, 0.3);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── SCROLLBAR ── */
.panel-left::-webkit-scrollbar {
    width: 5px;
}

.panel-left::-webkit-scrollbar-track {
    background: transparent;
}

.panel-left::-webkit-scrollbar-thumb {
    background: var(--gray-200);
    border-radius: 4px;
}

.panel-left::-webkit-scrollbar-thumb:hover {
    background: var(--brat-green);
}

/* ── RESPONSIVE MOBILE ── */
@media (max-width: 820px) {
    body {
        overflow: auto;
        height: auto;
    }

    .page-wrapper {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
    }

    .panel-left {
        border-right: none;
        border-bottom: 1.5px solid var(--gray-200);
        padding: 20px;
    }

    .canvas-wrapper {
        height: auto;
        width: 100%;
        max-width: 90vw;
        aspect-ratio: 1 / 1;
    }

    .action-btns {
        max-width: 90vw;
        flex-direction: column;
    }

    .panel-right {
        padding: 24px 16px;
    }
}
