#gmpaint-app {
    max-width: 840px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Prompt row ─────────────────────────────────── */

.gmpaint-prompt-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

#gmpaint-prompt {
    flex: 1;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.5;
    border: 2px solid #d0d5dd;
    border-radius: 10px;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

#gmpaint-prompt:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66,133,244,0.15);
}

#gmpaint-go {
    align-self: flex-end;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #4285f4;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}
#gmpaint-go:hover { background: #3367d6; }
#gmpaint-go:active { transform: scale(0.97); }
#gmpaint-go:disabled { background: #98b8f0; cursor: not-allowed; transform: none; }

/* ── Status ─────────────────────────────────────── */

#gmpaint-status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#gmpaint-status.loading { background: #e8f0fe; color: #1a56db; }
#gmpaint-status.error   { background: #fce8e8; color: #c5221f; }
#gmpaint-status.success { background: #e6f4ea; color: #137333; }

.gmpaint-spinner {
    width: 16px; height: 16px;
    border: 3px solid #a4c8f7;
    border-top-color: #1a56db;
    border-radius: 50%;
    animation: gmpaint-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes gmpaint-spin { to { transform: rotate(360deg); } }

.gmpaint-hidden { display: none !important; }

/* ── Canvas ─────────────────────────────────────── */

#gmpaint-canvas-wrap {
    margin-bottom: 16px;
}

#gmpaint-canvas-container {
    border-radius: 10px;
    overflow: hidden;
    background: #f0f1f3;
    border: 1px solid #d0d5dd;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gmpaint-canvas-container canvas,
#gmpaint-canvas-container img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ── Actions ────────────────────────────────────── */

#gmpaint-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

#gmpaint-actions button {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    border: 2px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}
#gmpaint-actions button:hover {
    border-color: #4285f4;
    color: #4285f4;
}
#gmpaint-save-msg {
    font-size: 13px;
    color: #137333;
}

/* ── JSON panel ─────────────────────────────────── */

#gmpaint-json-panel {
    margin-bottom: 20px;
}

#gmpaint-json-output {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 16px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
    max-height: 400px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── History ────────────────────────────────────── */

#gmpaint-history h4 {
    font-size: 15px;
    margin-bottom: 10px;
    color: #444;
}

#gmpaint-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.gmpaint-hist-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e3e8;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.gmpaint-hist-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.gmpaint-hist-item img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}
.gmpaint-hist-item span {
    display: block;
    padding: 5px 8px;
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #fafafa;
}

/* ── Responsive ─────────────────────────────────── */

@media (max-width: 600px) {
    .gmpaint-prompt-row {
        flex-direction: column;
    }
    #gmpaint-go { width: 100%; }
}
