:root {
    /* Standardize with landing.css */
    --primary-color: #1a73e8;
    --primary-dark: #1557b0;
    --text-primary: #1f1f1f;
    --text-secondary: #494949;
    --surface-light: #ffffff;
    --surface-dark: #f8f9fa;
    --surface-accent: #f1f3f4;
    --border-color: rgba(229, 231, 235, 0.5);

    /* Spacing and sizing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --toolbar-height: 64px;
    --content-max-width: 900px;

    /* Typography */
    --font-sans: 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;

    /* Standardized Transitions */
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Standardized Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-base: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Standardized Border Radius */
    --radius-sm: 0.375rem;
    --radius-base: 0.5rem;
    --radius-lg: 0.75rem;
}

/* Update transitions */
.btn,
.toolbar,
.input-area,
.preview-area,
.slider-handle {
    transition: var(--transition-base);
}

/* Standardize border-radius */
.btn {
    border-radius: var(--radius-base);
}

body {
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    background-color: var(--surface-light);
    line-height: 1.5;
    height: 100vh;
    width: 100vw;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-base);
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.toolbar {
    background-color: var(--surface-light);
    padding: 8px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--toolbar-height);
    display: flex;
    justify-content: space-between;
    box-shadow: var(--shadow-base);
    transition: box-shadow var(--transition-base);
    border-bottom: 1px solid var(--border-color);
}


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

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: 16px;
    font-size: 14px;
    font-weight: 500;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-base);
    transition: all var(--transition-base);
    min-width: 160px;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-base);
}

.btn:disabled {
    background-color: var(--surface-light);
    border: 1px solid var(--surface-accent);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-primary:disabled {
    background-color: var(--surface-light);
    border: 1px solid var(--surface-accent);
    color: var(--text-secondary);
}

.btn .icon {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
    color: var(--surface-light);
}

.btn-light {
    background-color: var(--surface-light);
    border: 1px solid var(--surface-accent);
    color: var(--text-primary);
}

.editor-container {
    flex: 1;
    padding: 16px;
    min-height: calc(100vh - var(--toolbar-height));
}

.input-area, .preview-area {
    height: calc(100vh - var(--toolbar-height) - 32px);
}

.input-area {
    border-right: 2px solid var(--surface-accent);
}

.input-area .editable-content {
    width: 100%;
    height: 100%;
    border: none;
    font-size: 16px;
    line-height: 1.6;
    padding: 24px;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-sans);
    overflow-y: auto;
    white-space: pre-wrap;
}

.editable-content[placeholder]:empty:before {
    content: attr(placeholder);
    color: #9BA1A6;
    cursor: text;
}

.preview-area {
    padding: 24px;
    overflow-y: auto;
}

.content-area {
    font-family: var(--font-sans) !important; 
    font-size: 16pt;
    line-height: 1.8;
    letter-spacing: 0.4px;
    color: var(--text-primary);
}

.content-area h1.title {
    font-size: 26px;
    font-weight: 500;
    margin-bottom: 8px;
}

.content-area h2.subtitle {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.content-area h1 { font-size: 24px; margin-top: 24pt; margin-bottom: 8pt; }
.content-area h2 { font-size: 22px; margin-top: 22pt; margin-bottom: 8pt; }
.content-area h3 { font-size: 20px; margin-top: 20pt; margin-bottom: 6pt; }
.content-area h4 { font-size: 18px; margin-top: 18pt; margin-bottom: 6pt; }
.content-area h5 { font-size: 16px; margin-top: 16pt; margin-bottom: 6pt; }
.content-area h6 { font-size: 14px; margin-top: 14pt; margin-bottom: 6pt; }

.content-area p {
    margin: 0 0 16px 0;
    padding: 0;
    min-height: 11pt;
}

.content-area ul, .content-area ol {
    margin-left: 24px;
    margin-bottom: 0;
    margin-top: 12pt;
}

.content-area li {
    margin-bottom: 0;
}

.content-area ul + p,
.content-area ol + p {
    margin-top: 12pt;
}

.formatting {
    opacity: 0.7;
}

.word-count-warning {
    color: #FF0000;
    font-weight: 500;
}

.ready-to-format {
    color: #0B8043;
}

.spinner-border {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(1px);
}

.modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface-light);
    padding: 40px;
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-lg);
    width: 400px;
    max-width: 90%;
}

.progress-indicator {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

.progress-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--surface-accent);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.progress-message {
    font-size: 20px;
    color: var(--text-primary);
    letter-spacing: 1px;
    margin: 0;
    min-height: 24px;
    transition: opacity 0.5s ease;
}

.progress-message.fade-out {
    opacity: 0;
}

.progress-message.fade-in {
    opacity: 1;
}

.progress-time {
    font-size: 28px;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 80px;
    display: inline-block;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}

.warning-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.fun-message {
    font-size: 16px;
    color: var(--primary-color);
    margin: 0;
}

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

/* Mobile Responsive Design for App - Cache Bust v2.1 */
@media screen and (max-width: 768px) {
    /* Force override all desktop button styles */
    .btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 8px !important;
        font-family: var(--font-sans) !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        padding: 12px 16px !important;
        border-radius: var(--radius-base) !important;
        transition: all var(--transition-base) !important;
        justify-content: center !important;
        border: none !important;
        cursor: pointer !important;
        /* Mobile specific overrides */
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 120px !important;
        max-width: 180px !important;
        white-space: nowrap !important;
        text-align: center !important;
    }

    /* Preserve button functionality and colors */
    .btn-primary {
        background-color: var(--primary-color) !important;
        color: var(--surface-light) !important;
    }

    .btn-light {
        background-color: var(--surface-light) !important;
        border: 1px solid var(--surface-accent) !important;
        color: var(--text-primary) !important;
    }

    .btn:hover:not(:disabled) {
        transform: translateY(-1px) !important;
        box-shadow: var(--shadow-base) !important;
    }

    .btn:disabled {
        background-color: var(--surface-light) !important;
        border: 1px solid var(--surface-accent) !important;
        color: var(--text-secondary) !important;
        cursor: not-allowed !important;
        opacity: 0.7 !important;
    }

    /* Toolbar mobile layout */
    .toolbar {
        height: auto !important;
        min-height: 80px !important;
        padding: 16px !important;
        flex-direction: column !important;
        gap: 16px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        background-color: var(--surface-light) !important;
        box-shadow: var(--shadow-base) !important;
        border-bottom: 1px solid var(--border-color) !important;
    }

    .toolbar-group {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
    }

    .toolbar-right {
        justify-content: center !important;
        margin-left: 0 !important;
    }

    /* Editor container mobile layout */
    .editor-container {
        flex: 1 !important;
        padding: 12px !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: calc(100vh - 120px) !important;
    }

    .input-area, .preview-area {
        height: calc(50vh - 60px) !important;
        width: 100% !important;
        min-height: 200px !important;
    }

    .input-area {
        border-right: none !important;
        border-bottom: 2px solid var(--surface-accent) !important;
        margin-bottom: 12px !important;
    }

    .input-area .editable-content {
        padding: 20px !important;
        font-size: 16px !important;
    }

    .preview-area {
        padding: 20px !important;
        overflow-y: auto !important;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    .btn {
        flex: 1 1 100% !important;
        min-width: 100px !important;
        max-width: none !important;
        padding: 12px 14px !important;
        font-size: 13px !important;
    }

    .toolbar {
        padding: 12px !important;
        min-height: 100px !important;
    }

    .toolbar-group {
        gap: 8px !important;
    }

    .editor-container {
        padding: 8px !important;
        min-height: calc(100vh - 140px) !important;
    }

    .input-area, .preview-area {
        height: calc(50vh - 70px) !important;
        min-height: 180px !important;
    }

    .input-area .editable-content,
    .preview-area {
        padding: 16px !important;
    }
}

/* Text Comparison Slider */
.comparison-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--surface-light);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-base);
}

.comparison-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 24px;
    overflow-y: auto;
    transition: transform var(--transition-base);
    background: var(--surface-light);
}

.comparison-before {
    z-index: 1;
    clip-path: polygon(0 0, var(--split-position) 0, var(--split-position) 100%, 0 100%);
}

.comparison-after {
    z-index: 0;
    color: var(--text-primary);
}

.slider-handle {
    position: absolute;
    top: 0;
    left: var(--split-position);
    width: 40px;
    height: 100%;
    transform: translateX(-50%);
    z-index: 2;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-handle::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 100%;
    background: var(--primary-color);
}

.slider-handle::after {
    content: '↔';
    position: absolute;
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: var(--surface-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-base);
    transition: transform var(--transition-base);
}

.slider-handle:hover::after {
    transform: scale(1.1);
}

.slider-handle:active::after {
    transform: scale(0.95);
}