:root {
    /* OpenAI/ChatGPT Brand Colors - Light Mode */
    --primary-color: #10a37f;
    --primary-hover: #0d8f6e;
    --primary-light: #d1fae5;
    --secondary-color: #6b7280;
    --background: #ffffff;
    --surface: #f7f7f8;
    --border: #e5e7eb;
    --text-primary: #353740;
    --text-secondary: #6b7280;
    --success: #10a37f;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --shadow-openai: rgba(16, 163, 127, 0.1);
    --body-bg: linear-gradient(to bottom, #ffffff 0%, #f7f7f8 100%);
    --optimized-bg: linear-gradient(to bottom, #f0fdf4 0%, #ffffff 100%);
    --code-bg: rgba(16, 163, 127, 0.1);
    --explanation-hover-bg: #fafafa;
}

[data-theme="dark"] {
    /* OpenAI/ChatGPT Brand Colors - Dark Mode */
    --primary-color: #10a37f;
    --primary-hover: #0d8f6e;
    --primary-light: #1a4d3a;
    --secondary-color: #8e8ea0;
    --background: #343541;
    --surface: #40414f;
    --border: #565869;
    --text-primary: #ececf1;
    --text-secondary: #c5c5d2;
    --success: #10a37f;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.4);
    --shadow-openai: rgba(16, 163, 127, 0.2);
    --body-bg: linear-gradient(to bottom, #343541 0%, #202123 100%);
    --optimized-bg: linear-gradient(to bottom, #1a4d3a 0%, #343541 100%);
    --code-bg: rgba(16, 163, 127, 0.15);
    --explanation-hover-bg: #4a4b5a;
}

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

body {
    font-family: 'Söhne', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--body-bg);
    padding: 20px;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--background);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    padding: 48px;
    border: 1px solid var(--border);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] .container {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

header {
    text-align: center;
    margin-bottom: 48px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    position: relative;
    transition: border-color 0.3s ease;
}

h1 {
    font-size: 2.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.input-section {
    margin-bottom: 30px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.9375rem;
    font-family: 'Söhne Mono', 'Monaco', 'Menlo', 'Courier New', monospace;
    resize: vertical;
    transition: all 0.2s ease;
    background: var(--background);
    color: var(--text-primary);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--shadow-openai);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    margin-top: 16px;
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.2);
}

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

.btn-secondary:hover {
    background: var(--border);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-checkmark {
    color: var(--success);
    font-weight: bold;
}

.results-section {
    margin-top: 40px;
}

.results-section.hidden {
    display: none;
}

.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 968px) {
    .comparison-container {
        grid-template-columns: 1fr;
    }
}

.prompt-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.prompt-panel:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.prompt-panel.optimized {
    border-color: var(--primary-color);
    background: var(--optimized-bg);
    box-shadow: 0 2px 8px var(--shadow-openai);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.prompt-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Söhne Mono', 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--text-primary);
    max-height: 500px;
    overflow-y: auto;
    padding: 16px;
    background: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.explanations-section {
    margin-top: 32px;
    padding: 24px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.explanations-section h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.explanations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.explanation-item {
    padding: 20px;
    background: var(--background);
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.explanation-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: var(--explanation-hover-bg);
}

[data-theme="dark"] .explanation-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.explanation-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation-title::before {
    content: "✓";
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1em;
    margin-right: 4px;
}

.explanation-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.explanation-changes {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

.explanation-changes strong {
    color: var(--text-primary);
}

.reference-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border);
}

.reference-details {
    cursor: pointer;
}

.reference-details summary {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 12px;
    background: var(--surface);
    border-radius: 6px;
    user-select: none;
    transition: background 0.2s;
}

.reference-details summary:hover {
    background: var(--border);
}

.reference-content {
    margin-top: 20px;
}

.guide-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.guide-tab {
    padding: 10px 20px;
    border: 1px solid var(--border);
    background: var(--background);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.guide-tab:hover {
    border-color: var(--primary-color);
    background: var(--surface);
    color: var(--primary-color);
}

.guide-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.2);
}

.guide-content {
    padding: 28px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    max-height: 600px;
    overflow-y: auto;
    font-size: 0.9375rem;
    line-height: 1.75;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.guide-content h2 {
    font-size: 1.5rem;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.guide-content h3 {
    font-size: 1.25rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.guide-content h4 {
    font-size: 1.1rem;
    margin-top: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.guide-content p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.guide-content ul, .guide-content ol {
    margin-left: 24px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.guide-content li {
    margin-bottom: 6px;
}

.guide-content code {
    background: var(--code-bg);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Söhne Mono', 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.875em;
    color: var(--primary-color);
    font-weight: 500;
}

.guide-content pre {
    background: var(--background);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.guide-content pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
}

footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

footer p::before {
    content: "⚡";
    font-size: 1.1em;
}

.hidden {
    display: none !important;
}

/* Scrollbar styling */
.prompt-content::-webkit-scrollbar,
.guide-content::-webkit-scrollbar {
    width: 8px;
}

.prompt-content::-webkit-scrollbar-track,
.guide-content::-webkit-scrollbar-track {
    background: var(--surface);
}

.prompt-content::-webkit-scrollbar-thumb,
.guide-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.prompt-content::-webkit-scrollbar-thumb:hover,
.guide-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

[data-theme="dark"] .prompt-content::-webkit-scrollbar-track,
[data-theme="dark"] .guide-content::-webkit-scrollbar-track {
    background: var(--background);
}

[data-theme="dark"] .prompt-content::-webkit-scrollbar-thumb,
[data-theme="dark"] .guide-content::-webkit-scrollbar-thumb {
    background: var(--border);
}

[data-theme="dark"] .prompt-content::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .guide-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* OpenAI-style accent elements */
.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.reference-details summary:hover {
    background: rgba(16, 163, 127, 0.05);
    color: var(--primary-color);
}

/* Smooth transitions for interactive elements */
button, .btn, .guide-tab, .explanation-item, .prompt-panel {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Toggle Button */
.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-weight: 500;
    font-family: inherit;
    box-shadow: none;
}

.theme-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .theme-toggle {
        position: static;
        margin: 0 auto 20px;
        width: fit-content;
    }
    
    header {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

.theme-toggle:hover {
    background: var(--border);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
}

.theme-toggle .hidden {
    display: none;
}

[data-theme="dark"] .theme-toggle {
    background: var(--surface);
}

/* Dark mode specific adjustments */
[data-theme="dark"] textarea {
    background: var(--surface);
    color: var(--text-primary);
}

[data-theme="dark"] .prompt-content {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="dark"] .guide-content pre {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .guide-content pre code {
    color: var(--text-primary);
}

[data-theme="dark"] .btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="dark"] .btn-secondary:hover {
    background: var(--border);
}

[data-theme="dark"] .reference-details summary {
    background: var(--surface);
    color: var(--text-primary);
}

[data-theme="dark"] .reference-details summary:hover {
    background: var(--border);
}

[data-theme="dark"] .guide-tab {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="dark"] .guide-tab:hover {
    background: var(--border);
}

[data-theme="dark"] .prompt-panel {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .explanations-section {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .explanation-item {
    background: var(--background);
}

[data-theme="dark"] .guide-content {
    background: var(--surface);
    border-color: var(--border);
}

