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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

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

.header {
background: linear-gradient(to right, #5de0e6, #004aad);
color: white;
padding: 12px 20px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #106ebe;
flex-shrink: 0;
}

.logo {
width: auto;
height: 30px;
}

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

.header-info {
    margin-left: auto;
}

.header-info a {
    color: white;
    text-decoration: none;
    font-size: 20px;
}

/* Desktop default styles (original) */
.ribbon {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ribbon-logo { display: none; }

#welcome-modal { display: none !important; }

@media (max-width: 768px) {
    #welcome-modal { display: flex !important; }
    .container {
        height: 100vh;
        overflow-y: auto;
        padding-bottom: 70px;
    }
    
    .ribbon {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        z-index: 9999;
        background: #fff;
        border-top: 1px solid #ddd;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .ribbon-logo { display: flex; align-items: center; justify-content: center; }
    .ribbon-logo img { height: 25px; width: 25px; }
    
    .editor-panel { padding-bottom: 60px; }
    
    .btn { padding: 10px; display: flex; align-items: center; justify-content: center; }
    .btn span { display: none; }
    .btn i { font-size: 20px !important; margin: 0 !important; color: #2c3e50 !important; }
    
    .preview-panel {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100%;
        transition: right 0.3s ease;
        z-index: 2000;
        background: white;
        display: flex;
        flex-direction: column;
    }
    
    .preview-panel.--visible { right: 0 !important; }
    .mobile-toggle { display: block !important; }
}

.ribbon-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filename-input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

.filename-input:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn:not(.btn-primary) {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn:not(.btn-primary):hover {
    background: #d5dbdb;
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.editor-panel, .preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.editor-panel {
    border-right: 1px solid #ddd;
}

.panel-header {
    background: #f8f9fa;
    padding: 12px 20px;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    color: #2c3e50;
}

#markdown-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    background: #fefefe;
}

#preview {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: white;
}

#preview h1, #preview h2, #preview h3, #preview h4, #preview h5, #preview h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #2c3e50;
}

#preview h1 { font-size: 2em; border-bottom: 2px solid #eee; padding-bottom: 10px; }
#preview h2 { font-size: 1.7em; }
#preview h3 { font-size: 1.4em; }
#preview h4 { font-size: 1.2em; }

#preview p {
    margin-bottom: 1em;
    line-height: 1.7;
}

#preview pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    overflow-x: auto;
    margin: 1em 0;
}

#preview code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

#preview pre code {
    background: none;
    padding: 0;
}

#preview blockquote {
    border-left: 4px solid #3498db;
    margin: 1em 0;
    padding-left: 15px;
    color: #666;
    font-style: italic;
}

#preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

#preview th, #preview td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

#preview th {
    background: #f8f9fa;
    font-weight: 600;
}

#preview ul, #preview ol {
    margin: 1em 0;
    padding-left: 30px;
}

#preview li {
    margin-bottom: 0.5em;
}

#preview hr {
    border: none;
    border-top: 2px solid #eee;
    margin: 2em 0;
}

.math-display {
    text-align: center;
    margin: 1em 0;
}

.math-inline {
    display: inline;
}

.status-bar {
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.status-bar a {
    color: #3498db;
    text-decoration: none;
}

.status-bar a:hover {
    text-decoration: underline;
}

.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

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

@media (max-width: 768px) {
    .ribbon {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        display: flex;
        justify-content: space-around;
        padding: 10px;
        z-index: 1000;
        background: #fff;
        border-top: 1px solid #ddd;
    }

    .editor-panel {
        padding-bottom: 60px;
    }

    .btn { padding: 10px; }
    .btn span { display: none; }
    .btn i { font-size: 18px; margin: 0; }
.preview-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: calc(100% - 60px);
    transition: right 0.3s ease;
    z-index: 2000;
    background: white;
    display: flex;
    flex-direction: column;
}

.preview-panel.--visible {
    right: 0 !important;
}
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff;
        border-top: 1px solid #ddd;
        z-index: 2001;
    }

    .mobile-toggle {
        display: block !important;
        background: transparent !important;
        color: white !important;
        font-size: 20px;
        padding: 5px;
        z-index: 3000;
        cursor: pointer;
        pointer-events: auto;
    }

    .header {
        position: relative;
        z-index: 1001;
    }
}