:root {
    --bg-color: #09090b;
    --surface-color: #18181b;
    --surface-hover: #27272a;
    --primary-color: #ef4444;
    /* Red accent */
    --primary-hover: #dc2626;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --border-color: #3f3f46;
    --success-color: #ef4444;

    /* Provider colors */
    --claude-color: #d97757;
    --gemini-color: #1b73e8;
    --grok-color: #cbd5e1;
    --chatgpt-color: #10a37f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1.5rem;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1::after {
    content: '.';
    color: var(--primary-color);
}

p.subtitle {
    color: var(--text-secondary);
    font-size: 1.15rem;
}


.input-section {
    background-color: var(--surface-color);
    border-radius: 8px;
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    margin-bottom: 2.5rem;
    transition: border-color 0.2s ease;
}

.input-section:focus-within {
    border-color: var(--primary-color);
}

textarea {
    width: 100%;
    height: 140px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.15rem;
    resize: vertical;
    outline: none;
    margin-bottom: 1.5rem;
}

textarea::placeholder {
    color: #52525b;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kbd {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-route {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.875rem 2.5rem;
    font-size: 1.05rem;
}

.btn-route:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-route:active {
    background: rgba(239, 68, 68, 0.2);
}

/* Results Section */
.result-section {
    display: none;
    animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recommendation-card {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 2.5rem 2rem;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    border-top: 3px solid var(--primary-color);
}

.confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
}

.confidence-high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.confidence-medium {
    background: rgba(239, 68, 68, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.confidence-low {
    background: var(--bg-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.winner-name {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.winner-reason {
    color: var(--text-secondary);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto;
}

.secondary-recommendation {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.providers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

@media (min-width: 640px) {
    .providers-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.provider-btn {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border-radius: 8px;
    position: relative;
}

.provider-btn:hover {
    background-color: var(--surface-hover);
    border-color: #52525b;
}

.provider-btn.recommended {
    border-color: var(--primary-color);
    background: rgba(239, 68, 68, 0.05);
}

.provider-btn.recommended::after {
    content: 'Recommended';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-top: none;
    font-size: 0.65rem;
    padding: 2px 10px;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.provider-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 1.5rem;
}

.icon-claude {
    background-color: var(--claude-color);
}

.icon-gemini {
    background-color: var(--gemini-color);
}

.icon-grok {
    background-color: #000;
    border: 1px solid var(--border-color);
}

.icon-chatgpt {
    background-color: var(--chatgpt-color);
}

/* Copy Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--primary-color);
    padding: 0.875rem 1.75rem;
    border-radius: 6px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* History Section */
.history-section {
    width: 100%;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.history-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background-color: var(--surface-color);
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background-color: var(--surface-hover);
    border-color: #52525b;
}

.history-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 75%;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.history-provider {
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Top Right Actions */
.top-right-actions {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    z-index: 100;
}

.info-container {
    position: relative;
    outline: none;
}

.action-btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.info-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
}

.info-container:hover .info-tooltip,
.info-container:focus-within .info-tooltip {
    visibility: visible;
    opacity: 1;
}

.tooltip-title {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.info-tooltip ul {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
}

.info-tooltip li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.4;
}

.info-tooltip strong {
    color: var(--text-primary);
}

.tooltip-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    text-align: right;
}

.tooltip-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.tooltip-footer a:hover {
    text-decoration: underline;
}

/* Settings Modal */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

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

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    color: var(--primary-color);
}

.provider-setting {
    margin-bottom: 1.5rem;
}

.provider-setting label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.provider-badge-indicator {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    display: inline-block;
}

.provider-setting textarea {
    width: 100%;
    height: 80px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: monospace;
    resize: vertical;
    margin-bottom: 0.25rem;
}

.provider-setting textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

.setting-help {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-cancel {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
}

.btn-cancel:hover {
    border-color: #52525b;
}

.btn-save {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
}

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

.btn-reset {
    background: none;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    margin-right: auto;
    text-decoration: underline;
}

.btn-reset:hover {
    color: var(--primary-color);
}