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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
}

.header {
    text-align: center;
    margin-bottom: 60px;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #22c55e);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.header p {
    font-size: 1.2rem;
    color: #9ca3af;
    font-weight: 300;
}

.main-interface {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

.card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.model-selector {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: end;
    margin-bottom: 32px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cost-comparison {
    margin-top: 32px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.cost-comparison-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 12px;
}

.cost-comparison-result {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.cost-comparison-result.openai-cheaper {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.cost-comparison-result.deepl-cheaper {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.cost-comparison-result.equal {
    background: rgba(156, 163, 175, 0.1);
    border: 1px solid rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.cost-comparison-details {
    font-size: 0.9rem;
    color: #9ca3af;
}

.language-selector {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 24px;
    align-items: end;
    margin-bottom: 32px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.select-container {
    position: relative;
}

select {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: #ffffff;
    font-size: 1rem;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

select option {
    background: #1a1a2e;
    color: #ffffff;
}

.swap-button {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.2);
}

.swap-button:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.3);
}

.input-container {
    margin-bottom: 32px;
}

.demo-button {
    width: 100%;
    padding: 12px 20px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    color: #3b82f6;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
}

.demo-button:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.prompt-toggle {
    width: 100%;
    padding: 12px 20px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    color: #8b5cf6;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.prompt-toggle:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}

.prompt-container {
    display: none;
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 16px;
}

.prompt-container.visible {
    display: block;
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.prompt-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #8b5cf6;
}

.reset-prompt-btn {
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    color: #ef4444;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-prompt-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.textarea-container {
    position: relative;
}

textarea {
    width: 100%;
    min-height: 140px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: #ffffff;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea::placeholder {
    color: #6b7280;
}

.html-toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.html-toggle-container label {
    font-size: 0.9rem;
    color: #9ca3af;
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #3b82f6;
}

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

.html-preview {
    width: 100%;
    min-height: 140px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    color: #1a1a1a;
    font-size: 1.1rem;
    font-family: inherit;
    line-height: 1.6;
    overflow: auto;
    transition: all 0.3s ease;
}

.html-preview:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.html-preview:empty::before {
    content: "Enter text to translate...";
    color: #9ca3af;
}

textarea.textarea-html {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.15);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.95rem;
}

.translate-button {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 32px;
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.2);
}

.translate-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(34, 197, 94, 0.3);
}

.translate-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 24px;
}

.results-grid.two-columns {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
}

.result-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.result-card.openai {
    border-left: 3px solid #10a37f;
}

.result-card.deepl {
    border-left: 3px solid #0d86f0;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 1.1rem;
}

.result-header-left {
    display: flex;
    align-items: center;
}

.result-header.openai {
    color: #10a37f;
}

.result-header.deepl {
    color: #0d86f0;
}

.tts-button {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    color: #3b82f6;
    padding: 6px 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tts-button:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

.tts-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tts-button.playing {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.provider-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    border-radius: 6px;
}

.provider-icon.openai {
    background: linear-gradient(135deg, #10a37f, #1a7f64);
}

.provider-icon.deepl {
    background: linear-gradient(135deg, #0d86f0, #0369a1);
}

.result-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    min-height: 120px;
    font-size: 1rem;
    line-height: 1.6;
    color: #1a1a1a;
    white-space: pre-wrap;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.cost-info {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cost-info.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.cost-icon {
    font-size: 0.9rem;
}

.cost-text {
    font-weight: 500;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-style: italic;
}

.loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(156, 163, 175, 0.3);
    border-top: 2px solid #9ca3af;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 16px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.empty-state {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* --- Developer Method Section --- */
.dev-method-section {
    margin-top: 48px;
}

.dev-method-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 16px;
}

.dev-method-section p {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-bottom: 16px;
    line-height: 1.5;
}

.code-block-wrapper {
    position: relative;
}

.copy-code-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 8px 16px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 8px;
    color: #3b82f6;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1;
}

.copy-code-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.6);
}

.copy-code-btn.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

.dev-method-code {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    padding-top: 56px;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #e5e7eb;
    white-space: pre;
    tab-size: 4;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2.5rem;
    }

    .model-selector {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .language-selector {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .swap-button {
        order: -1;
        justify-self: center;
    }

    .results-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .card {
        padding: 24px;
    }

    .container {
        padding: 20px 16px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }
}
