:root {
    --bg: #f6f2ea;
    --panel: #fffdfa;
    --panel-strong: #ffffff;
    --panel-muted: #f4efe7;
    --text: #1c2430;
    --muted: #61707d;
    --muted-soft: #8a949d;
    --line: rgba(24, 34, 47, 0.12);
    --line-strong: rgba(24, 34, 47, 0.22);
    --primary: #0d2340;
    --primary-dark: #09182d;
    --accent: #8f6a29;
    --accent-soft: #f2dfb6;
    --success: #2e7d5b;
    --warning: #d18e1f;
    --danger: #b94b49;
    --shadow: 0 18px 46px rgba(23, 33, 45, 0.08);
    --shadow-soft: 0 12px 28px rgba(23, 33, 45, 0.05);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --sidebar-width: 320px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Manrope", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(143, 106, 41, 0.12), transparent 24%),
        radial-gradient(circle at top right, rgba(13, 35, 64, 0.12), transparent 30%),
        linear-gradient(180deg, #faf7f0 0%, #f4efe7 48%, #ece5d9 100%);
    line-height: 1.6;
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: "Newsreader", Georgia, "Times New Roman", serif;
    line-height: 1.2;
    color: #152031;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 350, 'GRAD' 0, 'opsz' 24;
    font-size: 22px;
    line-height: 1;
}

p {
    margin: 0;
    color: var(--muted);
}

button, input, textarea, select {
    font: inherit;
}

.btn {
    border: 0;
    border-radius: 999px;
    padding: 11px 18px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
}

.btn-primary,
button[type="submit"] {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 24px rgba(29, 95, 115, 0.24);
}

.btn-primary:hover,
button[type="submit"]:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #eef2f3;
    color: #24404c;
    border: 1px solid rgba(36, 64, 76, 0.12);
}

.btn-success {
    background: #e7f4ed;
    color: var(--success);
    border: 1px solid rgba(46, 125, 91, 0.18);
}

.btn-editor-mode {
    background: linear-gradient(180deg, #fff0d8, #ffe3b2);
    color: #8d4c00;
    border: 1px solid rgba(190, 120, 12, 0.26);
    box-shadow: 0 10px 18px -16px rgba(177, 112, 15, 0.5);
    font-weight: 800;
}

.btn-editor-mode:hover {
    background: linear-gradient(180deg, #ffebcc, #ffd999);
}

.btn-warning {
    background: #fff4df;
    color: #8f5d10;
    border: 1px solid rgba(209, 142, 31, 0.22);
}

.container_index {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 253, 249, 0.86);
    backdrop-filter: blur(16px);
    border-right: 1px solid rgba(31, 42, 55, 0.08);
    padding: 22px 18px 20px;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    z-index: 30;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.8);
    transition:
        width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.28s ease;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    transition:
        opacity 0.2s ease,
        transform 0.24s ease,
        visibility 0.24s ease;
    transform-origin: left center;
}

.sidebar-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 6px 8px 18px;
}

.sidebar-brand-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.sidebar-brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #2a7f92);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.08em;
    box-shadow: 0 10px 24px rgba(29, 95, 115, 0.22);
}

.sidebar-brand-kicker {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

.sidebar-brand-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.sidebar-header {
    display: grid;
    gap: 10px;
    padding: 8px 6px 18px;
}

.new-question-btn,
.config-link-btn {
    width: 100%;
}

.new-question-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid rgba(21, 32, 43, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 241, 232, 0.96));
    box-shadow: 0 8px 18px -14px rgba(3, 22, 50, 0.45);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.new-question-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(119, 90, 25, 0.26);
    box-shadow: 0 12px 22px -16px rgba(3, 22, 50, 0.42);
}

.sidebar-section-title {
    padding: 6px 8px 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
}

.sidebar-section-subtitle {
    padding: 2px 8px 0;
    color: var(--muted-soft);
    font-size: 13px;
}

.history-summary-card {
    margin: 14px 8px 16px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(29, 95, 115, 0.08), rgba(185, 132, 51, 0.12));
    border: 1px solid rgba(29, 95, 115, 0.1);
}

.history-summary-label {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 4px;
}

.history-summary-text {
    font-size: 13px;
    color: var(--muted);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 6px 4px;
}

.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(31, 42, 55, 0.15);
    border-radius: 999px;
}

.history-item {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(31, 42, 55, 0.08);
    border-radius: 16px;
    padding: 14px 14px 12px;
    margin-bottom: 10px;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.history-item:hover {
    transform: translateY(-2px);
    border-color: rgba(29, 95, 115, 0.18);
}

.history-item.active {
    background: linear-gradient(135deg, var(--primary), #2c7b8f);
    color: #fff;
}

.history-item.active .timestamp {
    color: rgba(255, 255, 255, 0.78);
}

.student-id {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 3px;
}

.timestamp {
    font-size: 12px;
    color: var(--muted-soft);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px 40px;
    overflow-y: auto;
    transition: margin-left 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 26px;
}

.app-topbar-kicker,
.section-kicker,
.hero-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

.app-topbar-title {
    font-size: clamp(28px, 4vw, 44px);
    max-width: 860px;
}

.app-topbar-subtitle {
    max-width: 760px;
    margin-top: 12px;
    font-size: 16px;
}

.language-switcher {
    display: inline-flex;
    padding: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(31, 42, 55, 0.08);
    box-shadow: var(--shadow-soft);
}

.lang-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
}

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

.workspace-lang-toggle {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(21, 32, 43, 0.1);
    background: rgba(255, 255, 255, 0.94);
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 10px 18px -16px rgba(3, 22, 50, 0.4);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.workspace-lang-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(119, 90, 25, 0.26);
    box-shadow: 0 12px 20px -16px rgba(3, 22, 50, 0.38);
    background: #fffdf9;
}

.floating-workspace-lang-toggle {
    position: absolute;
    top: 70px;
    right: -14px;
    z-index: 3;
}

.content-area {
    display: none;
}

.content-area.active {
    display: block;
}

.hero-panel,
.workspace-card,
.result-container,
.ast-container,
.original-container,
.workflow-panel,
.overview-card,
.history-item,
#historyResult,
.config-section,
.modal-content {
    background: rgba(255, 253, 249, 0.96);
    border: 1px solid rgba(31, 42, 55, 0.08);
    box-shadow: var(--shadow);
}

.hero-panel {
    border-radius: 30px;
    padding: 34px;
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
    gap: 24px;
    margin-bottom: 24px;
}

.hero-copy h2 {
    font-size: clamp(30px, 4vw, 48px);
    margin-bottom: 14px;
}

.hero-copy p {
    font-size: 17px;
    max-width: 720px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.hero-metrics {
    display: grid;
    gap: 14px;
}

.metric-card {
    padding: 18px 18px 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 243, 236, 0.94));
    border: 1px solid rgba(31, 42, 55, 0.08);
}

.metric-value {
    display: block;
    font-family: Georgia, serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.metric-label {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.overview-card {
    border-radius: 22px;
    padding: 22px;
}

.overview-index {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(185, 132, 51, 0.14);
    color: var(--accent);
    font-weight: 800;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
}

.overview-card h3 {
    margin-bottom: 8px;
}

.workflow-panel {
    border-radius: 28px;
    padding: 28px;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading h2 {
    font-size: clamp(26px, 3vw, 36px);
    margin-bottom: 8px;
}

.workflow-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.workflow-step {
    padding: 20px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,243,236,0.94));
    border: 1px solid rgba(31,42,55,0.08);
}

.workflow-badge {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    margin-bottom: 14px;
}

.workflow-mini {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.mini-step {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,0.8);
    border: 1px dashed rgba(29,95,115,0.2);
    color: var(--primary);
    font-weight: 700;
    text-align: center;
}

.input-with-context,
#historyResult {
    background: var(--panel);
    border-radius: 24px;
}

.workspace-card {
    border-radius: 24px;
    padding: 22px;
    margin-bottom: 18px;
}

.workspace-note {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(29, 95, 115, 0.06);
    color: var(--muted);
}

.workspace-note-label {
    display: inline-block;
    margin-right: 8px;
    color: var(--primary);
    font-weight: 700;
}

.input-group {
    display: flex;
    align-items: stretch;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(31, 42, 55, 0.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.95);
    overflow: hidden;
}

input[type="text"] {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    padding: 16px 18px;
    background: transparent;
    color: var(--text);
}

button {
    border: 0;
}

.input-group button {
    border-radius: 0;
    padding-inline: 24px;
}

.context-option {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 14px;
}

.problem-language-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    min-width: 0;
}

.problem-language-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.problem-language-select {
    min-width: 136px;
    height: 40px;
    padding: 0 38px 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(31, 42, 55, 0.12);
    background: #fff;
    color: var(--text);
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.95);
}

.context-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text);
    font-weight: 600;
}

.context-checkbox input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid rgba(31,42,55,0.18);
    background: #fff;
    position: relative;
}

.context-checkbox input[type="checkbox"]:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.context-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.api-key-info {
    font-size: 13px;
    color: var(--muted);
}

.result-container,
#historyResult {
    margin-top: 20px;
    padding: 24px;
    border-radius: 24px;
}

.output-textarea {
    width: 100%;
    min-height: 320px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(31, 42, 55, 0.12);
    background: #fcfbf8;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 14px;
    resize: vertical;
    color: #243444;
}

.code-view-shell,
.history-editor-code-shell {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    min-height: 0;
    height: 100%;
    border-radius: 18px;
    overflow: hidden;
    background: #111827;
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.code-line-numbers {
    padding: 18px 8px 18px 0;
    background: #0b1220;
    color: #64748b;
    text-align: right;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.7;
    user-select: none;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    white-space: pre;
    overflow: hidden;
}

.code-view-scroller,
.code-editor-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)),
        #111827;
}

.code-view-scroller {
    overflow: auto;
}

.readonly-code-shell {
    min-height: 520px;
    max-height: 60vh;
}

.code-view-pre,
.code-editor-highlight,
.code-editor-textarea {
    margin: 0;
    padding: 18px 20px;
    min-height: 100%;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    tab-size: 4;
}

.code-view-pre,
.code-editor-highlight {
    color: #e5eefb;
    background: transparent;
}

.code-editor-stage {
    overflow: hidden;
}

.code-editor-highlight,
.code-editor-textarea {
    position: absolute;
    inset: 0;
    overflow: auto;
}

.code-editor-highlight {
    pointer-events: none;
}

.code-editor-textarea {
    resize: none;
    border: 0;
    outline: none;
    background: transparent;
    color: transparent;
    caret-color: #f8fafc;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 0 transparent;
}

.code-editor-textarea::selection {
    background: rgba(59, 130, 246, 0.35);
}

.code-token-keyword {
    color: #c084fc;
    font-weight: 700;
}

.code-token-comment {
    color: #94a3b8;
    font-style: italic;
}

.code-token-number {
    color: #f59e0b;
}

.code-token-string {
    color: #86efac;
}

.code-token-variable {
    color: #fda4af;
}

.code-token-bracket {
    color: #93c5fd;
}

.code-token-blank {
    color: #fca5a5;
}

.code-token-inline-math {
    color: #e9d5ff;
}

.code-token-symbol {
    color: #67e8f9;
}

.code-token-operator {
    color: #67e8f9;
}

.code-token-text {
    color: #dbeafe;
}

.code-token-punctuation {
    color: #94a3b8;
}

.code-token-divider {
    color: #94a3b8;
}

.file-info,
.unsaved-changes,
.loading,
.error-container {
    border-radius: 16px;
    padding: 14px 16px;
}

.file-info {
    margin-top: 16px;
    background: linear-gradient(180deg, rgba(234, 247, 237, 0.96), rgba(223, 243, 229, 0.94));
    border: 1px solid rgba(91, 153, 110, 0.22);
    color: #24543a;
    box-shadow: 0 10px 24px -20px rgba(60, 122, 82, 0.45);
}

.file-info strong {
    display: block;
    font-weight: 800;
    color: #1f5b39;
}

.unsaved-changes {
    display: none;
    margin-top: 14px;
    background: #fff3dc;
    border: 1px solid rgba(209, 142, 31, 0.28);
    color: #855817;
}

.loading {
    margin-top: 18px;
    background: rgba(29,95,115,0.08);
    color: var(--primary);
    font-weight: 700;
}

.error-container {
    margin-top: 20px;
    background: rgba(185, 75, 73, 0.08);
    border: 1px solid rgba(185, 75, 73, 0.18);
    color: #8f3031;
}

.action-buttons,
.ast-toolbar,
.render-preview-header,
.config-link {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.action-buttons {
    margin-top: 16px;
}

.primary-action-buttons {
    width: 100%;
}

.action-buttons-right {
    margin-left: auto;
}

.render-preview-container,
.original-container,
.ast-container {
    margin-top: 20px;
    border-radius: 20px;
    padding: 18px;
}

.render-preview-container {
    background: linear-gradient(180deg, rgba(255, 252, 244, 0.98), rgba(255, 248, 230, 0.96));
}

.history-preview-editor-workspace {
    margin-top: 18px;
}

.history-editor-panel {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(20, 35, 49, 0.14);
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(250, 246, 238, 0.96));
    box-shadow: var(--shadow-soft);
}

.history-editor-panel-header h4 {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
}

.history-editor-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 5px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(21, 32, 43, 0.08);
    margin-bottom: 18px;
}

.history-editor-tab {
    border: 0;
    border-radius: 14px;
    padding: 12px 14px;
    background: transparent;
    color: var(--muted);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.history-editor-tab.is-active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 18px -14px rgba(3, 22, 50, 0.45);
}

.history-editor-body {
    flex: 1 1 auto;
    min-height: 0;
    height: 720px;
    max-height: 720px;
    overflow: hidden;
    border-radius: 18px;
}

.history-editor-textarea,
.history-editor-ast {
    width: 100%;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    border-radius: 18px;
}

.history-editor-textarea {
    resize: none;
}

.history-editor-ast {
    overflow: auto;
    padding: 18px 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)),
        #111827;
    color: #dbeafe;
    font-family: "Consolas", "Courier New", monospace;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.history-editor-ast .ast-node-structure,
#astReviewContent .ast-node-structure {
    color: #f59e0b;
}

.history-editor-ast .ast-node-problem,
#astReviewContent .ast-node-problem {
    color: #67e8f9;
}

.history-editor-ast .ast-node-binding,
#astReviewContent .ast-node-binding {
    color: #c084fc;
}

.history-editor-ast .ast-node-expression,
#astReviewContent .ast-node-expression {
    color: #86efac;
}

.history-editor-ast .ast-node-default,
#astReviewContent .ast-node-default {
    color: #dbeafe;
}

.history-editor-ast .ast-node-leaf-string,
#astReviewContent .ast-node-leaf-string {
    color: #fca5a5;
}

.history-editor-ast .ast-node-leaf-value,
#astReviewContent .ast-node-leaf-value {
    color: #93c5fd;
}

.history-editor-ast .ast-node-leaf-generic,
#astReviewContent .ast-node-leaf-generic {
    color: #cbd5e1;
}

.history-editor-footer {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.history-editor-footer .btn {
    flex: 1 1 0;
    min-width: 0;
}

@media (max-width: 1200px) {
    #historyResult.editor-mode-active .history-preview-editor-workspace {
        grid-template-columns: 1fr;
    }
}

.render-preview-header {
    justify-content: space-between;
    margin-bottom: 12px;
}

.render-preview-frame {
    width: 100%;
    min-height: 480px;
    border-radius: 18px;
    border: 1px solid rgba(31, 42, 55, 0.12);
    background: #fff;
}

#historyResult.editor-mode-active > h3,
#historyResult.editor-mode-active > #historyOutput,
#historyResult.editor-mode-active > #historyUnsavedWarning,
#historyResult.editor-mode-active > #historyOriginalContentContainer,
#historyResult.editor-mode-active > #historyAstContainer {
    display: none !important;
}

#historyResult.editor-mode-active .history-preview-editor-workspace {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 5fr);
    gap: 18px;
    align-items: stretch;
}

#historyResult.editor-mode-active #historyRenderPreviewContainer {
    margin-top: 0;
    min-height: 0;
    height: 860px;
    max-height: 860px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#historyResult.editor-mode-active #historyRenderPreviewFrame {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: calc(100% - 56px);
    display: block;
}

#historyResult.editor-mode-active .history-editor-panel {
    min-height: 0;
    height: 860px;
    max-height: 860px;
}

#historyResult.editor-mode-active .history-editor-body {
    height: auto;
    max-height: none;
}

#historyActionButtons.editor-mode-active > *:not(#historyEditorModeBtn) {
    display: none !important;
}

.ast-content {
    width: 100%;
    min-height: 420px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(31, 42, 55, 0.12);
    background: #faf8f2;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12px;
    overflow: auto;
}

.ast-tree {
    white-space: normal;
}

.ast-tree-root,
.ast-tree-list {
    list-style: none;
    margin: 0;
    padding-left: 18px;
}

.ast-tree-root {
    padding-left: 0;
}

.ast-tree-item {
    margin: 4px 0;
}

.ast-tree-item summary {
    cursor: pointer;
    font-weight: 700;
}

.ast-tree-empty {
    color: var(--muted-soft);
    font-style: italic;
}

.ast-node-structure { color: #9a4c1d; }
.ast-node-problem { color: #1d5f73; }
.ast-node-binding { color: #5e468e; }
.ast-node-expression { color: #2d7b56; }
.ast-node-default { color: #24404c; }
.ast-node-leaf-string { color: #b05929; }
.ast-node-leaf-value { color: #6a7680; }
.ast-node-leaf-generic { color: #2f3f50; }

.config-link {
    justify-content: flex-end;
    margin-bottom: 16px;
}

.empty-history,
.loading-history {
    padding: 26px 12px;
    text-align: center;
    color: var(--muted-soft);
}

.sidebar-collapse-btn {
    position: absolute;
    top: 26px;
    right: -14px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 22px rgba(29, 95, 115, 0.22);
    cursor: pointer;
    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        background-color 0.22s ease;
}

.sidebar-collapse-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 14px 26px rgba(29, 95, 115, 0.26);
}

.collapse-icon {
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    display: inline-block;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar.collapsed {
    width: 58px;
}

.sidebar.collapsed .sidebar-content {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-10px) scale(0.98);
}

.sidebar.collapsed + .main-content {
    margin-left: 58px;
}

.sidebar.collapsed .collapse-icon {
    transform: rotate(180deg);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13, 24, 33, 0.45);
    backdrop-filter: blur(6px);
    z-index: 50;
    padding: 24px;
}

.modal-content {
    width: min(1080px, 100%);
    max-height: calc(100vh - 48px);
    margin: 0 auto;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(31,42,55,0.08);
    background: rgba(255,255,255,0.9);
}

.close-btn {
    font-size: 28px;
    cursor: pointer;
    color: var(--muted);
}

.modal-body {
    background: #fff;
    height: min(78vh, 860px);
    min-height: 0;
    overflow: auto;
}

#configIframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.container {
    max-width: 1080px;
    margin: 24px auto;
    padding: 28px;
    background: var(--panel);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.config-section {
    border-radius: 20px;
    padding: 22px;
    margin-bottom: 22px;
}

.config-section h3 {
    margin-bottom: 18px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: var(--text);
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select,
.form-control {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(31,42,55,0.12);
    background: #fff;
}

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

.spinner {
    border: 2px solid rgba(255,255,255,0.5);
    border-top-color: var(--primary);
    border-radius: 999px;
    animation: spin 1s linear infinite;
}

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

@media (max-width: 1180px) {
    .hero-panel,
    .overview-grid,
    .workflow-steps,
    .workflow-mini {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 290px;
    }

    .main-content {
        padding: 22px 16px 30px;
    }

    .app-topbar {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 0;
        min-width: 0;
        transform: translateX(0);
        overflow: visible;
        padding: 0;
        background: transparent;
        border-right: 0;
        box-shadow: none;
        transition: width 0.28s ease, box-shadow 0.28s ease, background-color 0.28s ease;
    }

    .sidebar:not(.collapsed) {
        width: 284px;
        padding: 22px 18px 20px;
        background: rgba(255, 253, 249, 0.96);
        border-right: 1px solid rgba(31, 42, 55, 0.08);
        box-shadow: 0 24px 48px rgba(13, 24, 33, 0.16);
    }

    .sidebar.collapsed {
        width: 0;
        transform: translateX(0);
        background: transparent;
    }

    .main-content,
    .sidebar.collapsed + .main-content {
        margin-left: 0;
    }

    .sidebar-collapse-btn {
        right: -44px;
        top: 18px;
    }

    .floating-workspace-lang-toggle {
        right: -44px;
        top: 64px;
    }

    .sidebar:not(.collapsed) .sidebar-collapse-btn,
    .sidebar:not(.collapsed) .floating-workspace-lang-toggle {
        right: 14px;
    }

    .hero-panel,
    .workflow-panel,
    .result-container,
    #historyResult,
    .workspace-card {
        padding: 20px;
        border-radius: 20px;
    }

    .input-group {
        flex-direction: column;
        border-radius: 20px;
    }

    .input-group button {
        width: 100%;
        border-radius: 0 0 20px 20px;
        min-height: 58px;
        font-size: 17px;
        font-weight: 800;
    }

    .input-group input[type="text"] {
        border-radius: 20px 20px 0 0;
        min-height: 60px;
        font-size: 17px;
        padding: 18px 20px;
    }

    .context-option {
        align-items: stretch;
    }

    .problem-language-control {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
    }

    .problem-language-select {
        min-width: 0;
        flex: 1 1 auto;
        max-width: 180px;
    }

    #editorModeBtn,
    #historyEditorModeBtn {
        display: none !important;
    }

    .render-preview-frame {
        min-height: 360px;
    }

    .modal {
        padding: 10px;
    }
}

/* Simplified product flow */
#result > h3,
#output,
#historyResult > h3,
#historyOutput,
#originalContentContainer,
#historyOriginalContentContainer,
#astContainer,
#historyAstContainer {
    display: none !important;
}

.app-topbar {
    border-bottom: 1px solid rgba(31, 42, 55, 0.08);
    padding-bottom: 16px;
}

.app-topbar-subtitle {
    max-width: 640px;
    font-size: 15px;
}

.hero-panel,
.overview-grid {
    display: none;
}

.workflow-panel {
    padding: 22px 24px;
    border-radius: 20px;
    background: #fff;
}

.workflow-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-heading h2 {
    font-size: clamp(24px, 3vw, 30px);
}

.section-heading p {
    max-width: 720px;
}

.render-preview-container {
    background: #fff;
    border: 1px solid rgba(31, 42, 55, 0.08);
}

.render-preview-frame {
    min-height: 540px;
}

.modal-actions {
    margin-top: 16px;
}

.code-modal-body,
.ast-modal-body {
    padding: 22px;
}

.ast-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.ast-modal-body .ast-toolbar {
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 1;
    background: #0f172a;
    padding: 10px 12px;
    padding-bottom: 10px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
}

#astReviewContent {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding: 18px 20px;
    padding-right: 8px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)),
        #111827;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 18px;
    color: #dbeafe;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.code-modal-body .output-textarea {
    min-height: 520px;
}

.app-footer {
    margin-left: var(--sidebar-width);
    padding: 0 32px 28px;
}

.app-footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(31, 42, 55, 0.08);
    color: var(--muted-soft);
    font-size: 13px;
}

.app-footer-links {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.github-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid rgba(21, 32, 43, 0.12);
    background: rgba(255, 255, 255, 0.92);
    color: #152031;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 10px 24px -20px rgba(13, 35, 64, 0.28);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.github-footer-link:hover {
    transform: translateY(-1px);
    border-color: rgba(119, 90, 25, 0.26);
    color: #775a19;
    background: #fffdf8;
    box-shadow: 0 14px 28px -20px rgba(13, 35, 64, 0.34);
}

.github-footer-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

@media (max-width: 900px) {
    .app-footer {
        margin-left: 0;
        padding: 0 16px 24px;
    }

    .workflow-steps {
        grid-template-columns: 1fr;
    }
}

/* Product-style simplification overrides */
:root {
    --bg: #f4f1ea;
    --panel: #fffdf9;
    --text: #18242f;
    --muted: #64727d;
    --primary: #173247;
    --primary-dark: #102535;
    --accent: #b88c44;
    --shadow: 0 24px 60px rgba(20, 29, 38, 0.08);
    --shadow-soft: 0 12px 30px rgba(20, 29, 38, 0.05);
}

body.landing-mode .sidebar,
body.landing-mode .app-footer {
    display: none;
}

body.landing-mode .main-content {
    margin-left: 0;
    padding: 0;
}

body.workspace-mode .app-topbar,
body.workspace-mode #introContent,
body.workspace-mode .landing-footer {
    display: none;
}

body.workspace-mode .main-content {
    padding-top: 28px;
}

body.landing-mode .app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 40px;
    height: 64px;
    background: #fbf9f5;
    border-bottom: 1px solid rgba(3, 22, 50, 0.06);
    backdrop-filter: none;
}

body.landing-mode .landing-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

body.landing-mode #introContent {
    padding-top: 64px;
}

body.landing-mode .app-topbar-brand {
    display: flex;
    align-items: center;
}

body.landing-mode .app-topbar-kicker {
    display: none;
}

body.landing-mode .app-topbar-title {
    font-family: "Newsreader", Georgia, serif;
    font-size: 30px;
    font-style: italic;
    font-weight: 600;
    color: #031632;
    line-height: 1;
    max-width: none;
}

body.landing-mode .app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto;
}

body.landing-mode .language-switcher {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border-radius: 999px;
    background: rgba(3, 22, 50, 0.04);
    border: 1px solid rgba(3, 22, 50, 0.08);
}

body.landing-mode .lang-btn {
    border: 0;
    background: transparent;
    color: rgba(3, 22, 50, 0.7);
    border-radius: 999px;
    padding: 8px 14px;
    font-family: "Manrope", sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

body.landing-mode .lang-btn.active {
    background: #031632;
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(3, 22, 50, 0.16);
}

body.landing-mode .landing-nav {
    gap: 28px;
}

body.landing-mode .landing-link-btn {
    border-bottom: 2px solid transparent;
    padding: 0 0 6px;
    font-size: 13px;
    letter-spacing: 0.01em;
    color: rgba(3, 22, 50, 0.7);
    transition: color 0.2s ease, border-color 0.2s ease;
}

body.landing-mode .landing-link-btn:hover {
    color: #775a19;
}

body.landing-mode .landing-link-btn.is-active {
    color: #775a19;
    border-bottom: 2px solid #775a19;
}

body.landing-mode .landing-cta-btn {
    padding: 10px 22px;
    border-radius: 12px;
    box-shadow: none;
}

body.landing-mode .landing-hero-section {
    min-height: 870px;
}

body.landing-mode .landing-hero-grid {
    position: relative;
}

body.landing-mode .landing-preview-panel {
    overflow: hidden;
}

body.landing-mode .landing-hero-preview {
    display: block;
}

body.landing-mode .landing-section-shell {
    width: 100%;
}

body.landing-mode .landing-process-grid,
body.landing-mode .landing-feature-grid,
body.landing-mode .landing-foundation-grid {
    align-items: start;
}

body.landing-mode .landing-process-item {
    align-items: flex-start;
}

body.landing-mode .landing-process-image {
    position: relative;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 40px;
    background: rgba(244, 241, 234, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(24, 36, 47, 0.08);
}

body.landing-mode {
    background:
        radial-gradient(circle at 14% 18%, rgba(216, 188, 143, 0.18), transparent 26%),
        radial-gradient(circle at 82% 16%, rgba(185, 205, 214, 0.18), transparent 24%),
        linear-gradient(180deg, #f4efe6 0%, #f7f3ec 38%, #f2ede4 100%);
}

.app-topbar-brand {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-topbar-kicker {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

.app-topbar-title {
    font-size: clamp(26px, 2.4vw, 32px);
    max-width: 520px;
    line-height: 1;
    margin: 0;
}

.landing-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.landing-link-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 4px;
    cursor: pointer;
}

.landing-link-btn:hover {
    color: var(--text);
}

body.landing-mode .landing-hero,
body.landing-mode .landing-bridge,
body.landing-mode .landing-features,
body.landing-mode .landing-process,
body.landing-mode .landing-foundation,
body.landing-mode .landing-final-cta,
body.landing-mode .landing-footer {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-left: 56px;
    padding-right: 56px;
}

.landing-hero {
    position: relative;
    min-height: 870px;
    display: flex;
    align-items: center;
    padding-top: 56px;
    padding-bottom: 56px;
    overflow: hidden;
}

.landing-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(245, 243, 239, 0.82), rgba(245, 243, 239, 0.82)),
        url("/static/images/landing-hero.jpg") center/cover;
    opacity: 0.55;
    pointer-events: none;
}

.landing-hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 480px);
    gap: 72px;
    align-items: center;
    max-width: 1280px;
    margin: 0 auto;
}

.landing-eyebrow,
.landing-section-kicker,
.landing-pillar-kicker {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

.landing-hero-copy h2 {
    margin: 18px 0 0;
    font-size: clamp(58px, 8vw, 92px);
    line-height: 0.92;
    letter-spacing: -0.06em;
    color: #031632;
    max-width: 520px;
}

.landing-hero-copy p {
    margin: 26px 0 0;
    max-width: 560px;
    font-family: "Newsreader", Georgia, serif;
    font-size: 30px;
    line-height: 1.5;
    font-style: italic;
    color: #44474d;
}

.landing-hero-actions {
    display: flex;
    gap: 16px;
    margin-top: 34px;
    flex-wrap: wrap;
}

.landing-preview-card {
    padding: 32px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(24, 36, 47, 0.08);
    box-shadow: 0 10px 30px -5px rgba(27, 28, 26, 0.05);
    backdrop-filter: blur(12px);
}

.landing-preview-label-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 22px;
}

.landing-preview-label {
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #44474d;
    font-weight: 700;
}

.landing-preview-code {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    white-space: pre-wrap;
    font-family: "IBM Plex Mono", Consolas, monospace;
    font-size: 13px;
    line-height: 1.8;
    color: #243240;
}

.landing-preview-divider {
    height: 1px;
    margin: 18px 0 14px;
    background: rgba(24, 36, 47, 0.08);
}

.landing-preview-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #44474d;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.landing-preview-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #173247, #b88c44);
}

.landing-preview-result {
    margin: 18px 0 0;
    color: #44474d;
    line-height: 1.7;
}

.landing-preview-render {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid rgba(24, 36, 47, 0.08);
}

.landing-render-shell {
    max-width: 100%;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    overflow: hidden;
}

.landing-render-problem {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    line-height: 1.7;
    color: #1b2732;
}

.landing-render-expression {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.landing-render-blank {
    display: inline-block;
    width: 92px;
    border-bottom: 2px solid rgba(23, 50, 71, 0.35);
    transform: translateY(-2px);
}

.landing-bridge {
    padding-top: 96px;
    padding-bottom: 96px;
}

.landing-bridge-inner {
    text-align: center;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    max-width: 900px;
    margin: 0 auto;
}

.landing-bridge-inner h3 {
    margin: 0;
    font-size: clamp(34px, 4.4vw, 52px);
    line-height: 1.14;
    letter-spacing: -0.03em;
    color: #101a24;
}

.landing-bridge-divider {
    width: 72px;
    height: 2px;
    margin: 28px auto 26px;
    background: rgba(184, 140, 68, 0.5);
}

.landing-bridge-inner p {
    max-width: 760px;
    margin: 0 auto;
    font-size: 18px;
    line-height: 1.95;
    color: #44474d;
}

.landing-features {
    padding-top: 96px;
    padding-bottom: 96px;
}

.landing-section-header h3,
.landing-process-copy h3,
.landing-final-cta h3 {
    margin: 8px 0 0;
    font-size: clamp(32px, 4.2vw, 46px);
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: #101a24;
}

body.landing-mode .landing-section-header,
body.landing-mode .landing-feature-grid,
body.landing-mode .landing-footer-inner {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

.landing-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
    margin-top: 32px;
}

.landing-feature-card {
    padding: 40px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(24, 36, 47, 0.06);
    box-shadow: var(--shadow-soft);
}

.landing-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 999px;
    background: rgba(184, 140, 68, 0.16);
    color: #8d6628;
}

.landing-feature-icon .material-symbols-outlined {
    font-size: 22px;
}

.landing-feature-card h4,
.landing-process-list h4,
.landing-foundation-item h4 {
    margin: 18px 0 0;
    font-size: 26px;
    line-height: 1.18;
    color: #18242f;
}

.landing-feature-card p,
.landing-process-list p,
.landing-foundation-item p,
.landing-final-cta p {
    margin: 14px 0 0;
    color: #44474d;
    line-height: 1.8;
    font-size: 15px;
}

.landing-process {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
    gap: 64px;
    align-items: center;
    padding-top: 96px;
    padding-bottom: 96px;
    max-width: 1280px;
    margin: 0 auto;
}

.landing-process-list {
    margin: 26px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 18px;
}

.landing-process-list li {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 14px;
    align-items: start;
}

.landing-process-index {
    color: rgba(184, 140, 68, 0.8);
    font-size: 28px;
    line-height: 1;
}

.landing-process-list h4 {
    margin: 0;
    font-size: 24px;
}

.landing-process-list p {
    margin-top: 8px;
}

.landing-process-image-card {
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px -5px rgba(27, 28, 26, 0.08);
}

.landing-process-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.landing-process-quote {
    position: relative;
    max-width: 280px;
    margin: -34px 0 0 -24px;
    padding: 22px 24px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(24, 36, 47, 0.08);
    box-shadow: 0 10px 30px -5px rgba(27, 28, 26, 0.05);
    backdrop-filter: blur(12px);
    font-family: "Newsreader", Georgia, serif;
    font-size: 26px;
    line-height: 1.28;
    font-style: italic;
    color: #031632;
}

.landing-foundation {
    display: grid;
    margin-top: 0;
    padding-top: 96px;
    padding-bottom: 96px;
    background: #10243d;
    max-width: none;
    color: #eef3f8;
}

.landing-foundation-grid {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 48px;
}

.landing-foundation-item {
    max-width: 420px;
}

.landing-foundation-item h4 {
    color: #ffffff;
    font-size: 24px;
}

.landing-foundation-item p {
    color: rgba(235, 242, 248, 0.78);
}

.landing-pillar-kicker {
    color: rgba(226, 188, 111, 0.8);
}

.landing-final-cta {
    text-align: center;
    padding-top: 128px;
    padding-bottom: 128px;
}

.landing-final-cta p {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
    font-size: 20px;
}

.landing-final-cta .btn {
    margin-top: 26px;
    padding: 18px 42px;
    border-radius: 14px;
}

.landing-footer {
    background: #f5f3ef;
    padding: 48px 56px;
}

.landing-footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding-top: 0;
    border-top: 0;
    color: #031632;
    font-size: 13px;
}

.sidebar {
    background: #fbfaf7;
    border-right: 1px solid rgba(21, 32, 43, 0.06);
}

.sidebar-brand-kicker {
    text-transform: none;
    letter-spacing: 0.02em;
}

.history-summary-card {
    display: none;
}

.main-content {
    background: transparent;
}

#generateContent,
#historyContent {
    max-width: 1140px;
    margin: 0 auto;
}

#historyContent.is-editor-wide {
    max-width: 1600px;
}

.workspace-hero-card,
.history-hero-card {
    padding: 28px 30px;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(248, 243, 235, 0.92));
    border: 1px solid rgba(21, 32, 43, 0.07);
    box-shadow: var(--shadow);
}

.workspace-hero-card {
    margin-bottom: 26px;
}

.history-hero-card {
    margin-bottom: 20px;
}

.section-heading + .workflow-mini {
    margin-top: 18px;
}

.workspace-meta-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0 0;
}

.workspace-meta-item {
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(21, 32, 43, 0.07);
}

.workspace-meta-label,
.workspace-panel-kicker {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.workspace-meta-text {
    display: block;
    margin-top: 8px;
    color: #51606b;
    font-size: 14px;
    line-height: 1.65;
}

.workflow-mini {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 18px 0 0;
}

.mini-step {
    background: rgba(255, 254, 251, 0.9);
    border: 1px solid rgba(23, 33, 43, 0.08);
    color: #4f5c68;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}

.input-with-context {
    padding: 24px;
    box-shadow: var(--shadow-soft);
    margin-top: 4px;
}

.workspace-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.workspace-panel-header h3 {
    margin-top: 8px;
    font-size: 30px;
    line-height: 1.08;
}

.workspace-panel-note,
.history-hero-text {
    max-width: 520px;
    font-size: 15px;
    line-height: 1.75;
    color: #586674;
}

.history-heading-stack {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.history-heading-stack h1 {
    font-size: clamp(26px, 3vw, 36px);
    margin: 8px 0 0;
    line-height: 1.08;
}

.history-inline-status {
    margin: 0;
    color: #4f5d6b;
    font-size: 15px;
}

.history-inline-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(21, 32, 43, 0.08);
}

.workspace-card,
.result-container,
#historyResult,
.render-preview-container,
.modal-content,
.config-section {
    background: rgba(255, 253, 250, 0.98);
    border: 1px solid rgba(21, 32, 43, 0.07);
    box-shadow: var(--shadow);
}

.render-preview-container {
    padding: 22px;
}

.result-container > h3,
#historyResult > h3,
.original-container > h4,
.ast-container > h4,
.render-preview-header h4 {
    font-size: 24px;
    letter-spacing: -0.02em;
}

.render-preview-header h4 {
    color: var(--text);
}

.output-textarea,
.ast-content,
.render-preview-frame {
    background: #fff;
    border: 1px solid rgba(23, 33, 43, 0.08);
}

.app-footer-inner,
.landing-footer-inner {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.btn,
button {
    border-radius: 14px;
}

.btn-primary,
button[type="submit"] {
    background: var(--primary);
    box-shadow: 0 14px 34px rgba(23, 50, 71, 0.18);
}

.btn-secondary {
    background: rgba(255,255,255,0.86);
    color: var(--text);
    border: 1px solid rgba(21,32,43,0.08);
}

.input-group,
.result-container,
#historyResult,
.render-preview-container,
.original-container,
.ast-container,
.modal-content,
.workspace-card,
.history-item {
    border-radius: 18px;
}

.input-group {
    box-shadow: none;
    border: 1px solid rgba(21, 32, 43, 0.08);
}

.render-preview-frame {
    min-height: 600px;
}

@media (max-width: 768px) {
    .app-topbar,
    .landing-hero,
    .landing-bridge,
    .landing-features,
    .landing-process,
    .landing-foundation,
    .landing-final-cta,
    .landing-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    body.landing-mode .app-topbar {
        padding-left: 18px;
        padding-right: 18px;
        height: auto;
        min-height: 0;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    body.landing-mode .landing-topbar-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
        column-gap: 12px;
        row-gap: 8px;
    }

    body.landing-mode #introContent {
        padding-top: 83px;
    }

    body.landing-mode .app-topbar-brand {
        grid-column: 1 / -1;
        grid-row: 1;
        width: 100%;
        justify-content: center;
        min-width: 0;
    }

    body.landing-mode .app-topbar-title {
        font-size: 22px;
        text-align: center;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    body.landing-mode .app-topbar-actions {
        display: contents;
    }

    body.landing-mode .language-switcher {
        grid-column: 2;
        grid-row: 2;
        margin-left: 0;
        justify-self: end;
        align-self: center;
    }

    body.landing-mode .landing-cta-btn {
        display: none;
    }

    .landing-nav {
        grid-column: 1;
        grid-row: 2;
        width: auto;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 18px;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0;
    }

    .landing-nav::-webkit-scrollbar {
        display: none;
    }

    body.landing-mode .landing-link-btn {
        flex: 0 0 auto;
        padding: 0 0 5px;
        border-radius: 0;
        border: 0;
        border-bottom: 2px solid transparent;
        background: transparent;
        text-align: left;
        line-height: 1.2;
        box-shadow: none;
    }

    body.landing-mode .landing-link-btn.is-active {
        background: transparent;
        border-color: transparent;
        border-bottom-color: #775a19;
        color: #775a19;
    }

    body.landing-mode .landing-hero-section {
        min-height: auto;
        padding-top: 0;
        padding-bottom: 40px;
    }

    body.landing-mode .landing-hero-grid,
    body.landing-mode .landing-process-grid,
    body.landing-mode .landing-feature-grid,
    body.landing-mode .landing-foundation-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    body.landing-mode .landing-mobile-hero-copy {
        gap: 24px;
    }

    body.landing-mode .landing-mobile-hero-copy h2 {
        font-size: clamp(42px, 14vw, 58px);
        line-height: 0.96;
        letter-spacing: -0.05em;
    }

    body.landing-mode .landing-mobile-hero-copy p {
        font-size: 18px;
        line-height: 1.55;
        max-width: none;
    }

    body.landing-mode .landing-hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    body.landing-mode .landing-hero-actions button,
    body.landing-mode .landing-final-cta-section button {
        width: 100%;
        justify-content: center;
    }

    body.landing-mode .landing-hero-preview {
        display: block;
        width: 100%;
    }

    body.landing-mode .landing-preview-panel {
        padding: 18px;
        border-radius: 16px;
    }

    body.landing-mode .landing-preview-code {
        font-size: 12px;
        line-height: 1.65;
    }

    body.landing-mode .landing-preview-panel .mt-5.pt-5 {
        margin-top: 16px !important;
        padding-top: 16px !important;
    }

    body.landing-mode #landingRenderPreviewFrame {
        min-height: 220px !important;
        height: 220px !important;
    }

    .workspace-meta-strip {
        grid-template-columns: 1fr;
    }

    .workflow-mini {
        grid-template-columns: 1fr;
    }

    .landing-mobile-hero-copy h2,
    .landing-mobile-section-title {
        font-size: 34px;
    }

    .landing-mobile-body-text {
        font-size: 16px;
        line-height: 1.78;
    }

    .landing-feature-card h4,
    .landing-process-list h4,
    .landing-foundation-item h4 {
        font-size: 20px;
    }

    .workspace-hero-card,
    .history-hero-card,
    .input-with-context {
        padding: 20px;
    }

    .workspace-panel-header,
    .history-heading-stack {
        flex-direction: column;
    }

    .landing-process-quote {
        position: static;
        margin: 10px 0 0;
        max-width: none;
        font-size: 18px;
        padding: 18px 18px;
        width: 100%;
        left: auto;
        right: auto;
        box-sizing: border-box;
    }

    body.landing-mode .landing-process-item {
        padding: 16px;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.52);
        border: 1px solid rgba(3, 22, 50, 0.06);
    }

    body.landing-mode .landing-process-list {
        gap: 4px;
    }

    body.landing-mode .landing-process-item > div:first-child {
        min-width: 36px;
    }

    body.landing-mode .landing-process-image {
        aspect-ratio: 4 / 3;
    }

    .landing-foundation-grid {
        gap: 20px;
    }

    body.landing-mode .landing-feature-card,
    body.landing-mode .landing-foundation-item {
        padding: 24px;
    }

    body.landing-mode .landing-process-section,
    body.landing-mode .landing-features-section,
    body.landing-mode .landing-foundation-section {
        padding-top: 72px;
        padding-bottom: 72px;
    }

    body.landing-mode .landing-bridge-section {
        padding-top: 64px;
        padding-bottom: 64px;
    }

    body.landing-mode .landing-final-cta-section {
        padding-top: 84px;
        padding-bottom: 84px;
    }

    body.landing-mode .landing-footer {
        padding-top: 32px;
        padding-bottom: 32px;
    }

    body.landing-mode .landing-footer-inner {
        padding-left: 0;
        padding-right: 0;
    }

    .landing-footer-inner,
    .app-footer-inner {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    body.landing-mode .app-topbar {
        padding-left: 14px;
        padding-right: 14px;
    }

    body.landing-mode #introContent {
        padding-top: 81px;
    }

    body.landing-mode .app-topbar-title {
        font-size: 19px;
    }

    body.landing-mode .language-switcher {
        padding: 3px;
    }

    body.landing-mode .lang-btn {
        padding: 7px 10px;
        font-size: 11px;
    }

    body.landing-mode .landing-link-btn {
        font-size: 12px;
        padding: 0 0 4px;
    }

    body.landing-mode .landing-topbar-inner {
        row-gap: 6px;
    }

    body.landing-mode .landing-nav {
        gap: 14px;
    }

    body.landing-mode .landing-hero-section,
    body.landing-mode .landing-bridge-section,
    body.landing-mode .landing-features-section,
    body.landing-mode .landing-process-section,
    body.landing-mode .landing-foundation-section,
    body.landing-mode .landing-final-cta-section,
    body.landing-mode .landing-footer {
        padding-left: 14px;
        padding-right: 14px;
    }

    body.landing-mode .landing-section-shell {
        padding-left: 0;
        padding-right: 0;
    }

    body.landing-mode .landing-mobile-hero-copy h2,
    body.landing-mode .landing-mobile-section-title {
        font-size: 30px;
    }

    body.landing-mode .landing-preview-code {
        font-size: 11px;
    }

    body.landing-mode .landing-mobile-body-text,
    body.landing-mode .landing-feature-card p,
    body.landing-mode .landing-process-list p,
    body.landing-mode .landing-foundation-item p {
        font-size: 14px;
        line-height: 1.7;
    }

    body.landing-mode .landing-feature-card,
    body.landing-mode .landing-foundation-item,
    body.landing-mode .landing-preview-panel {
        padding: 16px;
    }

    body.landing-mode .landing-process-item {
        gap: 14px;
        padding: 14px;
    }

    body.landing-mode .landing-process-list {
        gap: 3px;
    }

    body.landing-mode .landing-process-item > div:first-child {
        font-size: 30px;
    }

    body.landing-mode .landing-process-quote {
        font-size: 16px;
        padding: 16px;
        margin-top: 8px;
    }

    body.landing-mode #landingRenderPreviewFrame {
        min-height: 200px !important;
        height: 200px !important;
    }
}
