/* Code Syntax Highlighter – mobile-first, sleek */

:root {
    --csh-accent: #6366f1;
    --csh-accent-hover: #4f46e5;
    --csh-accent-light: rgba(99, 102, 241, 0.12);
    --csh-border: #e5e7eb;
    --csh-bg: #f9fafb;
    --csh-surface: #ffffff;
    --csh-text: #111827;
    --csh-muted: #6b7280;
    --csh-radius: 12px;
    --csh-radius-sm: 8px;
    --csh-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    --csh-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --csh-editor-min: 220px;
}

/* Wrapper */
.csh-wrap {
    margin-bottom: 2rem;
}

/* Top bar: language + theme + action */
.csh-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 20px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: var(--csh-surface);
    border: 1px solid var(--csh-border);
    border-radius: var(--csh-radius);
    box-shadow: var(--csh-shadow);
}

.csh-bar__group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.csh-bar__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--csh-muted);
}

.csh-bar__select {
    padding: 8px 12px;
    font-size: 0.9375rem;
    border: 1px solid var(--csh-border);
    border-radius: var(--csh-radius-sm);
    background: var(--csh-surface);
    color: var(--csh-text);
    min-width: 140px;
}

.csh-bar__select:focus {
    outline: none;
    border-color: var(--csh-accent);
    box-shadow: 0 0 0 3px var(--csh-accent-light);
}

.csh-bar__actions {
    margin-left: auto;
}

/* Buttons */
.csh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--csh-radius-sm);
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.csh-btn--primary {
    background: var(--csh-accent);
    color: #fff;
}

.csh-btn--primary:hover {
    background: var(--csh-accent-hover);
}

.csh-btn--primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--csh-accent-light);
}

.csh-btn__icon {
    width: 18px;
    height: 18px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M7 8h10M7 12h4m10 0h-2m-4 0h-4'/%3E%3C/svg%3E") no-repeat center;
    mask-size: 18px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M7 8h10M7 12h4m10 0h-2m-4 0h-4'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: 18px;
}

.csh-btn--secondary {
    background: var(--csh-bg);
    color: var(--csh-text);
    border: 1px solid var(--csh-border);
}

.csh-btn--secondary:hover {
    background: var(--csh-border);
}

.csh-btn--ghost {
    background: transparent;
    color: var(--csh-muted);
}

.csh-btn--ghost:hover {
    color: var(--csh-text);
    background: var(--csh-bg);
}

.csh-btn__icon--copy {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1'/%3E%3C/svg%3E");
}

/* Panels: stacked on mobile, side-by-side on desktop */
.csh-panels {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 768px) {
    .csh-panels {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .csh-panels {
        gap: 24px;
    }
}

.csh-panel {
    background: var(--csh-surface);
    border: 1px solid var(--csh-border);
    border-radius: var(--csh-radius);
    box-shadow: var(--csh-shadow-md);
    overflow: hidden;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: var(--csh-editor-min);
}

.csh-panel__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--csh-border);
    background: var(--csh-bg);
}

.csh-panel__badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--csh-accent-light);
    color: var(--csh-accent);
}

.csh-panel__badge--out {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.csh-panel__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--csh-text);
}

.csh-panel__body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Ace editor container */
.csh-editor {
    flex: 1;
    min-height: 356px;
    width: 100%;
}

@media (min-width: 768px) {
    .csh-editor {
        min-height: 450px;
    }
}

/* Output area */
.csh-output {
    flex: 1;
    min-height: 356px;
    padding: 16px;
    overflow: auto;
    background: var(--csh-bg);
    position: relative;
}

@media (min-width: 768px) {
    .csh-output {
        min-height: 450px;
    }
}

.csh-output__empty {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--csh-muted);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.csh-output__pre {
    margin: 0;
    padding: 16px;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow: auto;
    border-radius: var(--csh-radius-sm);
    background: var(--csh-surface);
    border: 1px solid var(--csh-border);
}

.csh-output__code {
    
}

/* Prism overrides so our panel bg doesn’t clash */
.csh-output .token.comment,
.csh-output .token.prolog,
.csh-output .token.doctype,
.csh-output .token.cdata { color: #6a737d; }
.csh-output .token.punctuation { color: #6a737d; }
.csh-output .token.property,
.csh-output .token.tag { color: #22863a; }
.csh-output .token.boolean,
.csh-output .token.number { color: #005cc5; }
.csh-output .token.selector,
.csh-output .token.attr-name { color: #6f42c1; }
.csh-output .token.string { color: #032f62; }
.csh-output .token.keyword { color: #d73a49; }
.csh-output .token.function { color: #6f42c1; }

/* Footer: bottom row */
.csh-footer {
    margin-top: 20px;
    border-radius: var(--csh-radius);
    border: 1px solid var(--csh-border);
    background: var(--csh-bg);
    box-shadow: var(--csh-shadow);
}

.csh-footer__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 14px 18px;
}

.csh-footer__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.csh-footer__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--csh-radius-sm);
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.csh-footer__btn-icon {
    width: 18px;
    height: 18px;
    background: currentColor;
    flex-shrink: 0;
}

.csh-footer__btn--copy {
    background: var(--csh-accent);
    color: #fff;
}

.csh-footer__btn--copy:hover {
    background: var(--csh-accent-hover);
}

.csh-footer__btn--copy:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--csh-accent-light);
}

.csh-footer__btn-icon--copy {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1'/%3E%3C/svg%3E") no-repeat center;
    mask-size: 18px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: 18px;
}

.csh-footer__btn--clear {
    background: var(--csh-surface);
    color: var(--csh-muted);
    border: 1px solid var(--csh-border);
}

.csh-footer__btn--clear:hover {
    color: var(--csh-text);
    background: var(--csh-border);
}

.csh-footer__btn--clear:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--csh-accent);
}

.csh-footer__btn-icon--clear {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2'/%3E%3Cline x1='10' y1='11' x2='10' y2='17'/%3E%3Cline x1='14' y1='11' x2='14' y2='17'/%3E%3C/svg%3E") no-repeat center;
    mask-size: 18px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2'/%3E%3Cline x1='10' y1='11' x2='10' y2='17'/%3E%3Cline x1='14' y1='11' x2='14' y2='17'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: 18px;
}

.csh-footer__feedback {
    font-size: 0.875rem;
    color: var(--csh-muted);
}

.csh-footer__feedback:not([hidden]) {
    color: #15803d;
    font-weight: 500;
}

/* Focus visible for keyboard users */
.csh-btn:focus-visible,
.csh-bar__select:focus-visible {
    outline: none;
}

.csh-bar__select:focus-visible {
    border-color: var(--csh-accent);
    box-shadow: 0 0 0 3px var(--csh-accent-light);
}

.csh-btn--secondary:focus-visible,
.csh-btn--ghost:focus-visible {
    box-shadow: 0 0 0 2px var(--csh-accent);
}
