:root {
    --bg: #fff5f9;
    --panel-bg: #ffffff;
    --text: #5a3d47;
    --border: #fff;

    /*
    --border: #f3c6d8;
    --border-focus: #f48fb1;
    */
    --btn-primary: #f48fb1;
    --btn-primary-border: #ec6ea8;
    --btn-primary-hover: #ec6ea8;
    --btn-default: #ffffff;
    --btn-default-border: #f3c6d8;
    --btn-default-hover: #ffe4ef;
    --btn-danger: #e5769b;
    --btn-danger-border: #d85c85;
    --btn-danger-hover: #d0507a;
    --hint-bg: #ffe4ef;
    --hint-border: #f8c6dc;
    --hint-text: #a8497a;
    --error-bg: #ffe0e8;
    --error-border: #f5b8c8;
    --error-text: #b23a5c;
    --secret-bg: #fdeef6;
    --secret-border: #f0b8d4;
    --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --mono: Menlo, Monaco, Consolas, "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    font-size: 16px;
    line-height: 1.42857143;
}

textarea {
    box-shadow: none;
}

.editor-tabs .tab-panel {
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.editor-tabs .tab-panel .CodeMirror {
    box-sizing: border-box;
    height: 400px;
    max-width: 100%;
}

.editor-tabs .tab-panel .CodeMirror-scroll {
    box-sizing: border-box;
}

#app {
    width: 1140px;
    height: 100%;
    margin: 0 auto;
    padding: 15px;
}

#pasteRender {
    width: 100%;
    height: 550px;
    border: 0;
    display: block;
    background: #fff;
    padding-left: 15px;
}

a {
    color: #d6538f;
    text-decoration: none;
}

a:hover {
    color: #b23a70;
    text-decoration: underline;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /*
    border-bottom: 1px solid var(--border);
    */
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.wordmark {
    font-size: 18px;
    font-weight: 700;
    color: #d6538f;
    text-decoration: none;
}

.wordmark:hover {
    color: #b23a70;
    text-decoration: none;
}

.topnav {
    display: flex;
    gap: 10px;
}

.topnav a {
    color: #a8697f;
}

.topnav a:hover {
    color: #d6538f;
}

.entry-box form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

textarea {
    width: 100%;
    min-height: 350px;
    font-family: var(--sans);
    font-size: 13px;
    color: #5a3d47;
    padding: 6px 12px;
    background: var(--panel-bg);

    box-shadow: inset 0 1px 1px rgba(180, 80, 120, .08);
    transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
    resize: vertical;
    outline: none;
}

textarea:focus {
    border-color: var(--border-focus);
    box-shadow: inset 0 1px 1px rgba(180, 80, 120, .08), 0 0 8px rgba(244, 143, 177, .5);
}

.styling-box {
    min-height: 140px;
}

.field-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #a8497a;
}

.editor-tabs {
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}

.tab-bar {
    display: flex;
    background: transparent;
    border-bottom: none;
    gap: 4px;
    padding: 0;
}

.tab-btn {
    padding: 8px 18px;
    font-size: 13px;
    background: var(--hint-bg);

    border: 1px solid var(--border);
    /*
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
*/
    cursor: pointer;
    color: #a8697f;
    border-bottom: none;

    font-family: var(--sans);
}

.tab-btn:last-child {

    border-right: 1px solid var(--border);
    border-bottom: none;

}

.tab-btn.active {
    background: var(--panel-bg);
    color: #d6538f;
    font-weight: 700;

    border-bottom-color: var(--panel-bg);
    border-bottom: none;
    position: relative;
    z-index: 1;
}

.tab-btn:hover {
    border-bottom: none;
}

.tab-btn:hover:not(.active) {
    background: var(--btn-default-hover);
    border-bottom: none;
    color: #d6538f;
}

.tab-panel {
    display: none;
    border: 1px solid var(--border);
    border-bottom: none;
    /*
    border-radius: 2px;
    */
    border-top-left-radius: 0;
    background: var(--panel-bg);
}

.tab-panel.active {
    display: block;

    border-bottom: 1px solid var(--border);
}

.tab-btn:hover:not(.active) {
    color: #d6538f;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-panel textarea {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    display: block;
}

.tab-panel textarea:focus {
    box-shadow: none;
}

.tab-panel textarea.styling-box {
    min-height: 350px;
}

.preview-frame-tab {
    width: 100%;
    height: 550px;
    border: 0;
    display: block;
    background: #fff;
}

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

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

.input-group-addon {
    height: 32px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 14px;
    color: #a8497a;
    background-color: var(--hint-bg);
    border: 1px solid var(--border);
    border-radius: 4px 0 0 4px;
    white-space: nowrap;
}

.input-group input {
    height: 32px;
    box-sizing: border-box;
    padding: 0 12px;
    font-size: 14px;
    color: #5a3d47;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 0 4px 4px 0;
    margin-left: -1px;
    outline: none;
    max-width: 180px;
}

.input-group input:focus {
    border-color: var(--border-focus);
    z-index: 2;
}

.secret-field {
    border: 1px dashed var(--secret-border);
    background: var(--secret-bg);
    border-radius: 4px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.secret-field .lock {
    font-size: 13px;
    color: #a8497a;
}

.secret-field input {
    flex: 1;
    min-width: 180px;
    padding: 6px 12px;
    font-size: 14px;
    color: #5a3d47;
    background: var(--panel-bg);
    border: 1px solid var(--secret-border);
    border-radius: 4px;
    outline: none;
}

.secret-field input:focus {
    border-color: var(--border-focus);
}

.secret-hint {
    font-size: 12px;
    color: #a8697f;
    width: 100%;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-block;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 4px;
}

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

.btn-primary:hover {
    background-color: var(--btn-primary-hover);
    border-color: var(--btn-primary-border);
}

.btn-default {
    color: #5a3d47;
    background-color: var(--btn-default);
    border-color: var(--btn-default-border);
}

.btn-default:hover {
    color: #5a3d47;
    background-color: var(--btn-default-hover);
    border-color: #ec9dc0;
}

.btn-danger {
    color: #fff;
    background-color: var(--btn-danger);
    border-color: var(--btn-danger-border);
}

.btn-danger:hover {
    background-color: var(--btn-danger-hover);
    border-color: var(--btn-danger-border);
}

.btn-sm {
    padding: 3px 9px;
    font-size: 12px;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ---------- alerts & callouts ---------- */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-info {
    background-color: var(--hint-bg);
    border-color: var(--hint-border);
    color: var(--hint-text);
}

.alert-danger {
    background-color: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error-text);
    margin-top: 15px;
}

/* ---------- view render output ---------- */
.content-header {
    margin-bottom: 20px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.content-header h1 {
    font-size: 36px;
    margin: 0;
    font-weight: 500;
    color: #b23a70;
}

.prose {
    font-size: 14px;
    line-height: 1.6;
    color: #5a3d47;
    word-wrap: break-word;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    font-weight: 500;
    color: inherit;
    margin-top: 20px;
    margin-bottom: 10px;
}

.prose h1 {
    font-size: 30px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.prose h2 {
    font-size: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.prose h3 {
    font-size: 18px;
}

.prose pre {
    display: block;
    padding: 9.5px;
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.42857143;
    color: #5a3d47;
    word-break: break-all;
    word-wrap: break-word;
    background-color: #fdeef6;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--mono);
}

.prose code {
    padding: 2px 4px;
    font-size: 90%;
    color: #c9256e;
    background-color: #fdeef6;
    border-radius: 4px;
    font-family: var(--mono);
}

.prose pre code {
    padding: 0;
    font-size: inherit;
    color: inherit;
    background-color: transparent;
    border-radius: 0;
}

.prose blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid var(--border);
    color: #a8697f;
}

.prose ul,
.prose ol {
    margin-top: 0;
    margin-bottom: 10px;
    padding-left: 25px;
}

.prose table {
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.prose th,
.prose td {
    padding: 8px;
    line-height: 1.42857143;
    vertical-align: top;
    border-top: 1px solid var(--border);
    text-align: left;
}

.prose th {
    font-weight: 700;
    border-bottom: 2px solid var(--border);
}

.prose img {
    max-width: 100%;
    height: auto;
    display: block;
}

.prose hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid var(--border);
}

.raw-block {
    font-family: var(--mono);
    white-space: pre-wrap;
    font-size: 13px;
    background: #fdeef6;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: #5a3d47;

    /* added by rainight */
    overflow-wrap: anywhere;
    word-break: break-word;
}

.footer {
    margin-top: 40px;
    padding-top: 19px;
    /*
    border-top: 1px solid var(--border);
    */
    color: #a8697f;
    font-size: 13px;
    text-align: center;
}

.footer a {
    color: #a8697f;
}

.footer a:hover {
    color: #d6538f;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #d6538f;
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
}

/* ---------- modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(90, 61, 71, .35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 15px;
}

.modal-overlay.show {
    display: flex;
}

.modal-box {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    max-width: 440px;
    width: 100%;
    padding: 20px;
    box-shadow: 0 8px 30px rgba(90, 61, 71, .25);
}

.modal-box h3 {
    margin: 0 0 10px;
    color: #b23a70;
    font-size: 18px;
}

.modal-box ul {
    margin: 10px 0 16px;
    padding-left: 20px;
}

.modal-box li {
    margin-bottom: 6px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* ---------- dashboard ---------- */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.dash-table th,
.dash-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}

.dash-table th {
    color: #a8497a;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .04em;
    border-bottom: 2px solid var(--border);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.badge-yes {
    background: #ffe4ef;
    color: #b23a70;
}

.badge-no {
    background: #f2eaee;
    color: #8a7178;
}

.code-display {
    font-family: var(--mono);
    font-size: 22px;
    letter-spacing: .12em;
    color: #d6538f;
    background: var(--secret-bg);
    border: 1px dashed var(--secret-border);
    border-radius: 4px;
    padding: 10px 14px;
    display: inline-block;
    margin: 8px 0;
}
/* Mobile stuff */
@media (max-width: 900px) {

    #app {
        width: 100%;
        max-width: 100%;
        padding: 15px;
        margin: 0;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .topnav {
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
    }

    .editor-tabs .tab-panel .CodeMirror {
        height: 350px;
    }

    .preview-frame-tab {
        height: 450px;
    }

    .controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .input-group {
        width: 100%;
    }

    .input-group input {
        max-width: none;
        width: 100%;
    }

    .secret-field {
        flex-direction: column;
        align-items: flex-start;
    }

    .secret-field input {
        width: 100%;
        min-width: 0;
    }

    .content-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .content-header h1 {
        font-size: 30px;
    }

    .dash-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {

    html,
    body {
        font-size: 14px;
    }


    #app {
        padding: 10px;
        width: 100%;
    }


    .wordmark {
        font-size: 16px;
    }


    .topbar {
        margin-bottom: 15px;
    }


    .topnav {
        flex-direction: column;
        gap: 6px;
    }


    .topnav a {
        display: block;
    }


    textarea {
        min-height: 250px;
        font-size: 12px;
    }


    .editor-tabs .tab-panel .CodeMirror {
        height: 280px;
        font-size: 12px;
    }


    .tab-bar {
        flex-wrap: wrap;
    }


    .tab-btn {
        flex: 1;
        padding: 8px 10px;
        font-size: 12px;
        text-align: center;
    }


    .tab-panel textarea.styling-box {
        min-height: 250px;
    }


    .preview-frame-tab {
        height: 350px;
    }

    .controls,
    .button-group,
    .actions,
    .btn-group,
    .modal-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
 
    .btn,
    .controls .btn,
    .button-group .btn,
    .actions .btn,
    .btn-group .btn,
    .modal-actions .btn {
        width: auto;
        padding: 9px 12px;
    }


    .input-group {
        flex-direction: column;
        align-items: stretch;
    }


    .input-group-addon {
        border-radius: 4px 4px 0 0;
        width: 100%;
    }


    .input-group input {
        border-radius: 0 0 4px 4px;
        margin-left: 0;
        width: 100%;
    }


    .content-header h1 {
        font-size: 24px;
    }


    .prose {
        font-size: 13px;
    }


    .prose h1 {
        font-size: 24px;
    }


    .prose h2 {
        font-size: 20px;
    }


    .prose pre {
        font-size: 12px;
        overflow-x: auto;
    }


    .raw-block {
        font-size: 12px;
        padding: 10px;
    }


    .modal-overlay {
        padding: 10px;
    }


    .modal-box {
        padding: 15px;
    }


    .toast {
        left: 10px;
        right: 10px;
        top: 10px;
        text-align: center;
    }
 
    .footer {
        flex-direction: column;
        align-items: flex-start; /* Stacks text and buttons cleanly underneath each other */
        justify-content: flex-start;
        text-align: left;
        gap: 12px;
        margin-top: 25px;
        font-size: 12px;
    }

    /* Force any sub-elements or text blocks inside the footer to drop below the buttons */
    .footer p,
    .footer span,
    .footer div.footer-text {
        width: 100%;
        order: 99; 
    }
}