:root {
    --bg-app: #1e1e1e;         
    --bg-window: #2d2d2d;      
    --bg-input: #3a3a3a;       
    --text-primary: #ffffff;
    --text-secondary: #a1a1a1;
    --accent-blue: #007AFF;    
    --accent-blue-hover: #0062cc;
    --border: #454545;
    
    --mac-red: #ff5f57;
    --mac-yellow: #febc2e;
    --mac-green: #28c840;

    --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: "Times New Roman", Times, serif; 
    --font-mono: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg-app);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 0;
    overflow: hidden;
}

.mac-window {
    width: 100%;
    height: 100%;
    background-color: var(--bg-window);
    border-radius: 0;
    box-shadow: none;
    border: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.window-titlebar {
    background: linear-gradient(to bottom, #3a3a3a, #2d2d2d);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.control.close { background-color: var(--mac-red); }
.control.minimize { background-color: var(--mac-yellow); }
.control.maximize { background-color: var(--mac-green); }

.window-title {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 52px; 
}

.window-content {
    padding: 40px;
    overflow-y: auto;
    flex: 1;
    
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}

.window-content::-webkit-scrollbar {
    display: none; 
}

.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h1 {
    font-family: var(--font-serif); 
    font-size: 3.5rem; 
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #fff 0%, #a1a1a1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

.input-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.input-wrapper {
    position: relative;
}

input[type="text"], select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-ui);
    transition: all 0.2s ease;
    appearance: none;
}

input[type="text"]:focus, select:focus {
    outline: none;
    background-color: #454545;
    border-color: var(--text-secondary);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    gap: 8px;
}

.btn.primary {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

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

.btn.secondary {
    background: #4a4a4a;
    color: white;
}

.btn.secondary:hover {
    background: #5a5a5a;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.results-container {
    margin-top: 40px;
    border-top: 1px solid var(--border);
    padding-top: 40px;
}

.tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 5px 0;
    position: relative;
}

.tab-btn.active {
    color: var(--text-primary);
    font-weight: 500;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-blue);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.preview-box {
    background-color: #1e1e1e;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 30px;
    font-family: var(--font-serif); 
}

.code-editor {
    width: 100%;
    height: 600px;
    background: #1e1e1e;
    color: #f8f8f2;
    font-family: var(--font-mono);
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    resize: vertical;
    line-height: 1.5;
    font-size: 13px;
}

.markdown-body {
    color: #c9d1d9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: #e6edf3; 
}

.markdown-body h1 {
    font-size: 2em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #30363d;
}

.markdown-body h2 {
    font-size: 1.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #30363d;
}

.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.875em; }
.markdown-body h6 { font-size: 0.85em; color: #8b949e; }

.markdown-body p {
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-body a {
    color: #58a6ff;
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body strong { font-weight: 600; }

.markdown-body hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: #30363d;
    border: 0;
}

.markdown-body blockquote {
    margin: 0 0 16px;
    padding: 0 1em;
    color: #8b949e;
    border-left: 0.25em solid #30363d;
}

.markdown-body ul, .markdown-body ol {
    margin-top: 0;
    margin-bottom: 16px;
    padding-left: 2em;
}

.markdown-body li + li {
    margin-top: 0.25em;
}

.markdown-body table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-top: 0;
    margin-bottom: 16px;
    width: 100%;
}

.markdown-body th, .markdown-body td {
    padding: 6px 13px;
    border: 1px solid #30363d;
}

.markdown-body th {
    font-weight: 600;
    background-color: #161b22;
}

.markdown-body tr {
    background-color: #0d1117; 
    border-top: 1px solid #21262d;
}

.markdown-body tr:nth-child(2n) {
    background-color: #161b22;
}

.markdown-body img {
    max-width: 100%;
    box-sizing: content-box;
    background-color: transparent;
}

.markdown-body code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 85%;
    background-color: rgba(110,118,129,0.4);
    border-radius: 6px;
}

.markdown-body pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: #161b22;
    border-radius: 6px;
    margin-bottom: 16px;
}

.markdown-body pre code {
    display: inline;
    max-width: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    line-height: inherit;
    word-wrap: normal;
    background-color: transparent;
    border: 0;
}

.markdown-body div[align="center"] {
    text-align: center;
}
.markdown-body p[align="center"] {
    text-align: center;
}

.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--accent-blue);
    animation: spin 1s linear infinite;
}

.loading-text { margin-left: 10px; color: var(--text-primary); }

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

.hidden { display: none !important; }

.select-wrapper {
    position: relative;
}
.select-wrapper::after {
    content: '▼';
    font-size: 10px;
    color: var(--text-secondary);
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.split-view {
    display: none; 
}

.mobile-tabs-view {
    display: block; 
}

@media (min-width: 1024px) {
    .split-view {
        display: grid;
        grid-template-columns: 1fr 1fr; 
        gap: 0; 
        height: 100%; 
        min-height: 600px;
        border-top: 1px solid var(--border);
    }

    .mobile-tabs-view {
        display: none;
    }
    
    .split-pane {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        height: 100%;
    }

    .code-pane {
        border-right: 1px solid var(--border);
    }

    .preview-pane {
        background-color: #0d1117; 
    }

    .pane-header {
        padding: 10px 16px;
        background-color: #2d2d2d; 
        border-bottom: 1px solid var(--border);
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 12px;
        font-weight: 600;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .pane-actions {
        display: flex;
        gap: 8px;
    }

    .btn.small {
        padding: 4px 12px;
        font-size: 11px;
        height: 24px;
    }

    .code-pane .code-editor {
        border: none;
        border-radius: 0;
        height: 100%;
        flex: 1;
        resize: none;
        background-color: #1e1e1e;
        font-size: 13px;
    }

    .preview-pane .preview-box {
        border: none;
        border-radius: 0;
        padding: 32px;
        height: 100%;
        overflow-y: auto;
        background-color: transparent; 
    }
    
    .results-container {
        margin-top: 20px;
        border-top: none;
        padding-top: 0;
        display: flex;
        flex-direction: column;
        flex: 1; 
        min-height: 0; 
    }
    
    .window-content {
        display: flex;
        flex-direction: column;
    }
}

.markdown-body {
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    margin: 0;
    color: #c9d1d9;
    background-color: #0d1117;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: #e6edf3;
}

.markdown-body h1 {
    font-size: 2em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #21262d;
}

.markdown-body h2 {
    font-size: 1.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #21262d;
}

.markdown-body h3 {
    font-size: 1.25em;
}

.markdown-body p {
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-body a {
    color: #58a6ff;
    text-decoration: none;
    background-color: transparent;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body ul, .markdown-body ol {
    margin-top: 0;
    margin-bottom: 16px;
    padding-left: 2em;
}

.markdown-body code {
    font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
    font-size: 85%;
    padding: 0.2em 0.4em;
    margin: 0;
    background-color: rgba(110,118,129,0.4);
    border-radius: 6px;
}

.markdown-body pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: #161b22;
    border-radius: 6px;
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-body pre code {
    display: inline;
    padding: 0;
    margin: 0;
    overflow: visible;
    line-height: inherit;
    word-wrap: normal;
    background-color: transparent;
    border: 0;
    font-size: 100%;
    word-break: normal;
    white-space: pre;
}

.markdown-body blockquote {
    margin: 0 0 16px;
    padding: 0 1em;
    color: #8b949e;
    border-left: 0.25em solid #30363d;
}

.markdown-body hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: #30363d;
    border: 0;
}

.markdown-body table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-top: 0;
    margin-bottom: 16px;
    width: 100%;
}

.markdown-body table th, .markdown-body table td {
    padding: 6px 13px;
    border: 1px solid #30363d;
}

.markdown-body table th {
    font-weight: 600;
    background-color: #161b22;
}

.markdown-body table tr {
    background-color: #0d1117;
    border-top: 1px solid #21262d;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #161b22;
}

.markdown-body img {
    max-width: 100%;
    box-sizing: content-box;
    background-color: #0d1117;
}

