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

/* CSS Variables for theming */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #333;
    --border-color: #3a3a3a;
    --border-hover: #4a4a4a;
    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --text-muted: #888;
    --text-disabled: #666;
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --button-bg: #444;
    --button-hover: #555;
    --preview-bg: #1a1a1a;
}

body.light-theme {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --border-color: #dee2e6;
    --border-hover: #adb5bd;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --text-disabled: #adb5bd;
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --button-bg: #e9ecef;
    --button-hover: #dee2e6;
    --preview-bg: #ffffff;
}

/* About page styles */
body.about-page {
    overflow-y: auto;
    min-height: 100vh;
}

body.about-page ul {
    padding-left: 20px;
}

body.about-page code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    font-family: monospace;
    font-size: 12px;
    border-radius: 6px;
    color: var(--accent-primary);
}

/* Multi-Font roles UI */
.roles-panel {
    margin: 10px auto;
    padding: 12px;
    max-width: 1100px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.roles-panel.hidden { display: none; }

.roles-panel-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

/* rolesInfoToggle removed per design */

.roles-panel label {
    color: var(--text-secondary);
    font-size: 14px;
}

.roles-panel select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 8px;
}

.roles-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px 16px;
}

.roles-summary .role-item {
    color: var(--text-secondary);
    font-size: 13px;
}

.roles-summary .role-item button {
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 12px;
    background: var(--button-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.roles-summary .role-item button:hover {
    background: var(--button-hover);
}

.role-compare-bar {
    margin: 8px auto;
    padding: 6px 10px;
    max-width: 1100px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: none;
    /* Compact horizontal layout */
    display: none;
}

.role-compare-bar.active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#roleCompareTitle,
#roleComparePair { margin: 0; }

#roleComparePair {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-compare-actions {
    margin-top: 0;
    display: flex;
    gap: 6px;
}

.role-compare-actions button {
    padding: 6px 8px;
    font-size: 12px;
    background: var(--button-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

.role-compare-actions button:hover { background: var(--button-hover); }

.multifont-toggle { margin: 0 12px; }

.about-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    overflow-y: auto;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

.about-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.about-header img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.about-subtitle {
    margin: 0;
    color: var(--text-secondary);
}

.about-section {
    margin-bottom: 40px;
}

.about-section h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.about-section h3 {
    color: var(--text-primary);
    margin: 20px 0 10px 0;
    font-size: 18px;
}

.about-section p, .about-section li {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}

.privacy-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.privacy-box h3 {
    color: #4CAF50;
    margin-top: 0;
}

.font-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

.font-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.font-table td {
    padding: 10px 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

/* Inline code scheme samples inside about tables */
.scheme-sample {
    font-size: 12px;
    line-height: 1.4;
    border-radius: 6px;
    padding: 12px 14px;
    overflow: auto;
    max-width: 420px;
}

/* Ensure inner code has no extra padding/offset */
body.about-page .scheme-sample code {
    padding: 0;
    display: block;
    font-family: inherit;
}

/* Toned-down, readable links in font table */
.about-page .font-table a {
    color: var(--text-secondary);
    text-decoration: underline;
}

.about-page .font-table a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.font-table tr:last-child td {
    border-bottom: none;
}

.font-table tr:hover {
    background: var(--bg-tertiary);
}

/* Ensure start-screen highlighted code inherits preview font */
.font-family-preview code.hljs {
    font-family: inherit !important;
}

.font-source {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Font Showcase Page Styles */
.font-showcase-container {
    margin-top: 30px;
}

.loading-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 40px;
}

.font-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.font-showcase-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.font-showcase-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.font-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 15px 0;
}

.font-sample {
    font-size: 16px;
    line-height: 1.5;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin: 0;
    white-space: pre-wrap;
    overflow-x: auto;
    color: var(--text-primary);
}

/* Light theme adjustments for font showcase */
body.light-theme .font-showcase-item {
    background: #ffffff;
    border-color: #e1e5e9;
}

body.light-theme .font-showcase-item:hover {
    border-color: #c6cbd1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.light-theme .font-sample {
    background: #f8f9fa;
    border-color: #e9ecef;
}

.font-source.embedded {
    background: #4CAF50;
    color: white;
}

.font-source.google {
    background: #4285F4;
    color: white;
}

.font-source.system {
    background: #757575;
    color: white;
}

.color-scheme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.color-scheme-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.color-scheme-card h4 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.color-preview {
    display: flex;
    gap: 5px;
    margin: 10px 0;
    height: 30px;
}

.color-swatch {
    flex: 1;
    border-radius: 4px;
    position: relative;
}

.color-swatch:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 10;
}

.scheme-credit {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.scheme-credit a {
    color: var(--accent-primary);
    text-decoration: none;
}

.scheme-credit a:hover {
    text-decoration: underline;
}

/* Loading and error states for code display */
.loading, .error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    font-style: italic;
    opacity: 0.7;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    margin: 20px;
}

.loading {
    color: var(--accent-primary);
}

.loading::before {
    content: "⟳";
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    font-size: 1.2em;
}

.error {
    color: #ff6b6b;
    border-color: #ff6b6b;
}

.error::before {
    content: "⚠";
    margin-right: 8px;
    font-size: 1.2em;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Loading screen styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    max-width: 400px;
    padding: 20px;
}

.loading-logo {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
    opacity: 0.9;
}

.loading-content h2 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 10px 0 30px 0;
}

.loading-progress {
    width: 100%;
}

.loading-progress .progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-progress .progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    width: 0%;
}

.progress-text {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.hidden {
    display: none;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    padding: 5px 20px;
    text-align: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Logo and title layout */
.title-with-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 0;
}

.logo {
    width: 80px;
    height: auto;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

body.light-theme .logo {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Disabled states for front page */
select:disabled, button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.title-text {
    flex: 1;
}

h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    display: none;
}

.description-section {
    padding: 10px 20px;
    margin: 5px auto;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    max-width: 1200px;
}

.description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    text-align: left;
}

.progress-bar {
    width: 200px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    margin: 0;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

.status {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    transition: color 0.3s ease;
}

.comparison-container {
    flex: 1;
    display: flex;
    align-items: stretch;
    padding: 8px;
    gap: 12px;
    min-height: 0;
    position: relative; /* for centering neutral button */
    transition: all 0.3s ease;
}

/* Slider Compare Mode */
.comparison-container.slider-compare-mode {
    gap: 0;
}

.comparison-container.slider-compare-mode .code-panel {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 50%;
    width: calc(50% - 10px);
    transform: translateX(-50%);
}

.comparison-container.slider-compare-mode #panelA {
    z-index: 1;
}

.comparison-container.slider-compare-mode #panelB {
    z-index: 2;
    clip-path: inset(0 0 0 50%);
}

.slider-divider {
    position: absolute;
    top: 8px;
    bottom: 8px;
    width: 2px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    cursor: ew-resize;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.slider-compare-mode .slider-divider {
    opacity: 1;
}

.divider-handle {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.divider-handle:hover {
    background: linear-gradient(to bottom, #7c8ef0, #8b5ca8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.divider-grip {
    width: 2px;
    height: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 1px;
    position: relative;
}

.divider-grip::before,
.divider-grip::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 1px;
    top: 0;
}

.divider-grip::before {
    left: -4px;
}

.divider-grip::after {
    left: 4px;
}

.slider-divider.dragging .divider-handle {
    background: linear-gradient(to bottom, #7c8ef0, #8b5ca8);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
}

.slider-divider.dragging .divider-grip,
.slider-divider.dragging .divider-grip::before,
.slider-divider.dragging .divider-grip::after {
    background: rgba(255, 255, 255, 1);
}

.code-panel {
    flex: 1;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    min-width: 0;
    width: 0;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
    border-radius: 6px; /* Match panel border radius minus border */
    opacity: 0.3;
}

.grid-lines {
    position: absolute;
    top: 30px; /* Match pre padding-top */
    left: 20px; /* Match pre padding-left */
    right: 20px;
    bottom: 20px;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    white-space: pre;
    color: var(--border-color);
    overflow: hidden;
}

.code-panel:hover {
    border-color: var(--border-hover);
}

.panel-label {
    position: absolute;
    top: 10px;
    left: 15px;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

#panelB .panel-label {
    background: #764ba2;
    left: auto;
    right: 15px;
}

.panel-summary {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: #ccc;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    z-index: 10;
    max-width: 200px;
    text-align: right;
    line-height: 1.3;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.show-summaries .panel-summary {
    opacity: 1;
    visibility: visible;
}

.code-panel pre {
    flex: 1;
    padding: 30px 20px 20px;
    overflow: auto;
    margin: 0;
    min-width: 0;
    position: relative;
    z-index: 2; /* Above grid overlay */
}

.code-panel code {
    display: block;
    white-space: pre;
    tab-size: 4;
    overflow-x: auto;
    width: 100%;
    background: transparent;
}



/* divider removed to simplify A/B comparison */

.controls {
    padding: 12px;
    display: flex;
    gap: 12px;
    justify-content: center;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.choice-btn {
    padding: 10px 24px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.choice-btn:active {
    transform: translateY(0);
}

.choice-btn.neutral {
    background: var(--button-bg);
    transition: all 0.3s ease;
}

.choice-btn.neutral:hover {
    background: var(--button-hover);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.1);
}

.key-hint {
    opacity: 0.8;
    font-size: 12px;
}

/* Floating choice buttons */
.floating-choice-btn {
    position: relative;
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.floating-choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.floating-choice-btn:active {
    transform: translateY(0);
}

.floating-choice-btn.neutral {
    background: var(--button-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.floating-choice-btn.neutral:hover {
    background: var(--button-hover);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.1);
}

/* Unified button container */
.button-container {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
    transition: width 0.3s ease;
}

/* In slider compare mode, make container narrower */
.slider-compare-mode .button-container {
    width: 50%;
}

.center-buttons {
    display: flex;
    gap: 10px;
}


.floating-choice-btn.skip-stage {
    background: var(--accent-secondary);
    color: white;
    border: 1px solid var(--accent-secondary);
}

.floating-choice-btn.skip-stage:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Ghost suggestion styling */
.ghost-text {
    opacity: 0.65;
    font-style: italic;
    font-weight: 300;
    pointer-events: none;
    user-select: none;
}

.ghost-caret {
    display: inline-block;
    width: 0;
    border-left: 2px solid currentColor;
    margin-left: -1px;
    animation: ghost-blink 1s steps(1, end) infinite;
    opacity: 0.85;
}

@keyframes ghost-blink {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* Inline neutral button behavior (no transforms) */
/* Keep neutral button centered and stable on hover/active */
/* neutral button previously in divider has been removed; use [S] key */

/* no divider-specific neutral button styles */

.footer {
    padding: 8px 15px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.about-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.about-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

#languageSelect {
    padding: 5px 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.reset-btn {
    padding: 5px 12px;
    background: var(--button-bg);
    color: var(--text-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 13px;
}

.reset-btn:hover {
    background: var(--button-hover);
}

.skip-role-btn {
    padding: 4px 10px;
    background: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    margin-left: 8px;
}

.skip-role-btn:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.skip-role-btn.hidden {
    display: none;
}

.comparison-count {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
    transition: color 0.3s ease;
}

/* Theme toggle switch */
.theme-toggle,
.slider-compare-toggle {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 20px;
    background: var(--button-bg);
    border-radius: 20px;
    position: relative;
    transition: background 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    color: var(--text-secondary);
    font-size: 13px;
    user-select: none;
    transition: color 0.3s ease;
}

/* Font family selector */
.font-family-selector {
    flex: 1;
    padding: 15px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: auto;
}

.font-family-selector.hidden {
    display: none;
}

.font-family-selector h2 {
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 24px;
}

.selector-subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
    text-align: center;
    transition: color 0.3s ease;
}

.font-families-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1200px;
}

.font-family-option {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.font-family-option:hover {
    border-color: var(--border-hover);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.font-family-option.selected {
    border-color: #667eea;
    background: #2d2d3a;
}

.font-family-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

.font-family-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.font-family-preview {
    background: var(--preview-bg);
    padding: 10px;
    border-radius: 4px;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: var(--text-primary);
    overflow: hidden;
    white-space: pre;
    margin: 0;
    display: block;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.results {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 100;
    padding: 40px;
    overflow: auto;
    transition: background-color 0.3s ease;
}

.results.hidden {
    display: none;
}

/* Simple modal for icons prompt */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.hidden { display: none; }
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    max-width: 560px;
    width: 92%;
    color: var(--text-primary);
}
.modal-text { color: var(--text-secondary); margin: 8px 0 12px; }
.modal-options { margin: 8px 0 12px; color: var(--text-secondary); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-actions .primary { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border: none; }

.results h2 {
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-details {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.result-details p {
    margin: 10px 0;
    font-size: 14px;
}

.family-description {
    font-style: italic;
    color: #888 !important;
    font-size: 13px !important;
    margin: 5px 0 15px 0 !important;
}

.result-details strong {
    color: #667eea;
    display: inline-block;
    width: 150px;
}

.result-preview {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.result-preview h3 {
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 16px;
    transition: color 0.3s ease;
}

.result-preview pre {
    overflow: auto;
    max-height: 300px;
}

.result-actions {
    text-align: center;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.result-actions button {
    padding: 12px 30px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.result-actions button:first-child {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.result-actions button:last-child {
    background: #444;
    color: white;
}

.result-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--button-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--button-hover);
}

/* Results page styling */
.results-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.re-compare-btn {
    padding: 4px 12px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s ease;
}

.re-compare-btn:hover {
    background: var(--accent-secondary);
}

.export-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.export-section h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.compact-export {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.compact-export label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.compact-export input {
    width: 70%;
    padding: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

.compact-export button {
    padding: 8px 16px;
    margin-left: 10px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.compact-export button:hover {
    background: var(--accent-secondary);
}

.export-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.export-buttons button {
    padding: 12px 16px;
    background: var(--button-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.export-buttons button:hover {
    background: var(--button-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* Import field styling */
.import-section {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.import-section-inline {
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.import-section h4,
.import-section-inline h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.import-field {
    display: flex;
    gap: 10px;
    align-items: center;
}

.import-field input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

.import-field button {
    padding: 8px 16px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.import-field button:hover {
    background: var(--accent-secondary);
}

/* Instruction Modal Styles */
.instruction-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.instruction-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.instruction-header {
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.instruction-header h3 {
    margin: 0;
    color: var(--accent-primary);
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.instruction-body {
    padding: 20px;
}

.instruction-body ol {
    margin: 0;
    padding-left: 20px;
}

.instruction-body li {
    margin: 12px 0;
    line-height: 1.6;
    color: var(--text-primary);
}

.instruction-body li code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Fira Code', 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    color: var(--accent-primary);
}

.instruction-body li strong {
    color: var(--accent-primary);
    font-weight: 600;
}

.instruction-footer {
    padding: 15px 20px 20px 20px;
    text-align: center;
}

.instruction-footer button {
    padding: 10px 24px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.instruction-footer button:hover {
    background: var(--accent-secondary);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Role highlighting animations */
@keyframes roleHighlight {
    0% { 
        box-shadow: 0 0 0 0 var(--accent-primary);
        background-color: rgba(102, 126, 234, 0.2);
    }
    25% {
        box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.4);
        background-color: rgba(102, 126, 234, 0.15);
    }
    100% {
        box-shadow: 0 0 0 0 var(--accent-primary);
        background-color: transparent;
    }
}

/* Role focus states */
.role-focus-active {
    position: relative;
}

.role-focus-active .hljs-comment,
.role-focus-active .hljs-string,
.role-focus-active .hljs-keyword,
.role-focus-active .hljs-operator,
.role-focus-active .hljs-function,
.role-focus-active .hljs-title,
.role-focus-active .ghost-text,
.role-focus-active .copilot {
    transition: all 0.3s ease;
}

/* Dim non-focused elements */
.role-focus-active *:not(.role-highlight-target) {
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

/* Highlight target elements */
.role-focus-active .role-highlight-target {
    animation: roleHighlight 1.5s ease-out forwards;
    opacity: 1 !important;
    position: relative;
    z-index: 1;
}

/* Ghost text styling - override all syntax highlighting */
.ghost-text {
    font-style: italic !important;
    opacity: 0.6 !important;
    color: inherit !important;
    font-weight: 300 !important;
}

.ghost-text * {
    color: inherit !important;
    font-weight: inherit !important;
    font-style: inherit !important;
    background: none !important;
    text-decoration: none !important;
}

/* Ghost caret */
.ghost-caret::after {
    content: '|';
    opacity: 0.7;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 0.7; }
    51%, 100% { opacity: 0.2; }
}
