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

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.08);
    --bg: #09090b;
    --surface: #18181b;
    --surface-elevated: #27272a;
    --surface-hover: #3f3f46;
    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --border: #27272a;
    --border-light: #3f3f46;
    --success: #22c55e;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow: hidden;
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11", "ss01";
    font-variation-settings: "opsz" 32;
}

.sidebar {
    width: 280px;
    background: var(--surface);
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    right: 12px;
    top: 12px;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 64px 16px 12px 16px;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.875rem;
}

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

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

.new-chat-btn svg {
    flex-shrink: 0;
}

.sidebar.collapsed .new-chat-btn {
    margin: 64px 8px 12px 8px;
    padding: 12px;
}

.sidebar.collapsed .new-chat-btn span {
    display: none;
}

.mode-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.8125rem;
    font-weight: 500;
}

.mode-btn:hover {
    background: var(--surface-elevated);
    color: var(--text);
    border-color: var(--border-light);
    transform: translateX(2px);
}

.mode-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.mode-btn svg {
    flex-shrink: 0;
}

.sidebar.collapsed .mode-selector {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 16px;
}

.sidebar-chats {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 16px 16px 16px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

.sidebar-chats-header {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-tertiary);
    padding: 16px 8px 8px 8px;
    letter-spacing: 0.08em;
}

.sidebar.collapsed .sidebar-chats {
    display: none;
}

.sidebar-chat-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-chat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    text-align: left;
    font-size: 0.8125rem;
}

.sidebar-chat-item:hover {
    background: var(--surface-elevated);
}

.sidebar-chat-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-chat-item-content {
    flex: 1;
    min-width: 0;
}

.sidebar-chat-item-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.sidebar-chat-item-date {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
}

.sidebar-chat-item-delete {
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-chat-item:hover .sidebar-chat-item-delete {
    opacity: 1;
}

.sidebar-chat-item-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.sidebar-chat-list::-webkit-scrollbar {
    width: 3px;
}

.sidebar-chat-list::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-chat-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.sidebar-chat-list::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar.collapsed .sidebar-footer {
    padding: 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    text-align: left;
    font-size: 0.9375rem;
    font-weight: 500;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 8px;
}

.nav-item:hover {
    background: var(--surface-elevated);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-item span {
    white-space: nowrap;
}

.main-wrapper {
    flex: 1;
    overflow: hidden;
    background: var(--bg);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 40px;
    position: relative;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.header-title {
    text-align: center;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text);
    white-space: nowrap;
}

.subtitle {
    color: var(--text-tertiary);
    font-size: 0.9375rem;
    font-weight: 500;
}

.header-model-selectors {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-model-selectors.hidden,
.header-single-model-selector.hidden {
    display: none;
}

.custom-select-wrapper {
    position: relative;
}

.custom-select {
    position: relative;
    min-width: 200px;
    user-select: none;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.custom-select-trigger:hover {
    border-color: var(--border-light);
    background: var(--surface-hover);
}

.custom-select.active .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.custom-select-trigger span {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.custom-select-trigger svg {
    transition: transform 0.2s;
    color: var(--text-tertiary);
}

.custom-select.active .custom-select-trigger svg {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    display: none;
}

.custom-select.active .custom-options {
    display: block;
}

.custom-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.custom-option:hover {
    background: var(--surface-hover);
}

.custom-option.selected {
    background: var(--primary-light);
    color: var(--primary);
}

.custom-option img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
    background: white;
    border-radius: 50%;
    padding: 2px;
}

.custom-option-text {
    flex: 1;
}

.model-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
    background: white;
    border-radius: 50%;
    padding: 2px;
}

.header-login-btn {
    position: fixed;
    right: 32px;
    top: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--surface-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 1000;
}

.header-login-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.header-login-btn.hidden {
    display: none;
}

.header-user-profile {
    position: fixed;
    right: 32px;
    top: 32px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 8px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    z-index: 1000;
}

.header-user-profile.hidden {
    display: none;
}

.header-user-email {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.screen {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.screen.active {
    display: flex;
}

#start-screen {
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.secondary-btn {
    background: var(--surface-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 12px 24px;
    font-size: 0.9375rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

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

.speaker-indicator {
    text-align: center;
    padding: 16px;
    background: var(--surface-elevated);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

#current-speaker {
    font-weight: 600;
    color: var(--primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: transparent;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    padding: 12px 16px;
    border-radius: var(--radius);
    animation: fadeIn 0.2s ease;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 80%;
    font-size: 0.9375rem;
}

.message.user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.message.assistant {
    background: var(--surface);
    color: var(--text);
    align-self: flex-start;
    max-width: 100%;
    border: 1px solid var(--border);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-text {
    margin-bottom: 16px;
    width: 100%;
    line-height: 1.6;
}

.voices-container {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    width: 100%;
}

.mode-battle .voice-card .voice-label,
.mode-battle .model-name {
    filter: blur(4px);
    user-select: none;
}

.mode-battle .voice-card.revealed .voice-label,
.mode-battle .voice-card.revealed .model-name {
    filter: none;
}

.mode-side-by-side .voice-card .voice-label,
.mode-side-by-side .model-name {
    filter: none;
}

.mode-direct .voices-container {
    grid-template-columns: 1fr;
    max-width: 400px;
}

.mode-direct .vote-prompt {
    display: none !important;
}

.mode-clone .chat-messages,
.mode-clone .input-container,
.mode-clone > .vote-prompt {
    display: none !important;
}

.mode-clone #clone-vote-prompt {
    display: block;
}

.clone-interface {
    display: none;
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.mode-clone .clone-interface {
    display: block;
}

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

.clone-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.clone-header p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.clone-recording {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.clone-record-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 48px;
    background: var(--surface-elevated);
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
}

.clone-record-btn:hover {
    border-color: var(--primary);
    background: var(--surface);
}

.clone-record-btn.recording {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.clone-record-btn span {
    font-size: 0.9375rem;
    font-weight: 500;
}

.clone-timer {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.clone-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-height: 20px;
}

.clone-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.clone-voice-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.clone-voice-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clone-voice-card audio {
    width: 100%;
}

.clone-regen-container {
    margin-bottom: 24px;
}

.clone-transcribed-text {
    text-align: center;
}

.clone-transcribed-text label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clone-text-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
}

.clone-text-input-wrapper input {
    flex: 1;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9375rem;
}

.clone-text-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
}

.clone-text-input-wrapper .primary-btn {
    padding: 12px 24px;
    white-space: nowrap;
}

.model-selector {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.model-selector label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.model-selector select {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.model-selector select:hover {
    border-color: var(--border-light);
}

.model-selector select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.voice-card {
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: all 0.15s ease;
    min-height: 90px;
    display: flex;
    flex-direction: column;
}

.voice-card:hover {
    border-color: var(--border-light);
}

.voice-card-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.model-reveal-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.model-logo-small {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    padding: 4px;
    flex-shrink: 0;
}

.model-logo-small img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.model-info-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.model-name-small {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.provider-name-small {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    line-height: 1.2;
}

.voice-card.revealed {
    animation: revealPulse 0.5s ease;
}

@keyframes revealPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
        border-color: var(--primary);
    }
    100% {
        transform: scale(1);
    }
}

.voice-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 8px;
}

.play-btn {
    background: var(--surface-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.play-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

.play-btn:active {
    transform: scale(0.95);
}

.progress-container {
    flex: 1;
    cursor: pointer;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 3px;
}

.time-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    min-width: 36px;
    text-align: right;
    flex-shrink: 0;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .voices-container {
        flex-direction: column;
    }
}

.model-reveal {
    background: var(--surface-elevated);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 32px;
    margin: 24px 0;
    animation: revealFade 0.5s ease;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

@keyframes revealFade {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal-header {
    text-align: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.reveal-models {
    display: flex;
    gap: 32px;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.reveal-model {
    flex: 1;
    text-align: center;
    padding: 24px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-model:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.25);
}

.reveal-voice-label {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reveal-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 16px;
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 50%;
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border);
}

.reveal-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.reveal-logo svg {
    width: 100%;
    height: 100%;
}

.reveal-model-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.reveal-provider {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.reveal-divider {
    width: 2px;
    height: 100px;
    background: linear-gradient(to bottom, transparent, var(--border-light), transparent);
    flex-shrink: 0;
}

.reveal-footer {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .reveal-models {
        flex-direction: column;
    }
    
    .reveal-divider {
        width: 100px;
        height: 2px;
        background: linear-gradient(to right, transparent, var(--border-light), transparent);
    }
}

.vote-prompt {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.vote-prompt.hidden {
    display: none;
}

.vote-prompt p {
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.vote-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.vote-btn {
    flex: 1;
    min-width: 100px;
    max-width: 140px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.8125rem;
}

.vote-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

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

.voice-card.winner {
    border: 2px solid var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.voice-card.loser {
    border: 2px solid var(--danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.voice-card.preview-winner {
    border: 2px solid var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    transition: all 0.2s;
}

.voice-card.preview-loser {
    border: 2px solid var(--danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
    transition: all 0.2s;
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    display: flex;
    gap: 8px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 8px 12px;
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}

.input-wrapper:focus-within {
    border-color: var(--text-tertiary);
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.9375rem;
    padding: 8px;
    outline: none;
}

#message-input::placeholder {
    color: var(--text-tertiary);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.icon-btn:active {
    transform: scale(0.95);
}

.voice-btn {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
    color: var(--text);
}

.voice-btn.recording {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

.leaderboard-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.leaderboard-content {
    flex: 1;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    color: var(--text-tertiary);
    padding: 32px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.6;
}

.leaderboard-item {
    background: var(--surface-elevated);
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
}

.leaderboard-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
    transform: translateX(4px);
}

.rank {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-tertiary);
    width: 48px;
    font-variant-numeric: tabular-nums;
}

.rank.top {
    color: var(--primary);
}

.model-info {
    flex: 1;
}

.model-name-with-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.leaderboard-logo {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    padding: 6px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.leaderboard-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.model-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}

.model-provider {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.model-stats {
    text-align: right;
}

.elo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.win-rate {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.chat-messages::-webkit-scrollbar,
.leaderboard-content::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.leaderboard-content::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.leaderboard-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.leaderboard-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Login and Profile Styles */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-elevated);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.user-profile.hidden {
    display: none;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-weight: 600;
}

.user-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-email {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

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

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.login-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.login-btn.hidden {
    display: none;
}

.sidebar.collapsed .login-btn {
    display: none;
}

.sidebar.collapsed .user-email,
.sidebar.collapsed .logout-btn {
    display: none;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
    padding: 8px;
    background: transparent;
    border: none;
    width: 100%;
}

.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .user-avatar-img {
    width: 32px;
    height: 32px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.modal h2 {
    margin-bottom: 24px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-form input {
    padding: 12px 14px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.login-form input::placeholder {
    color: var(--text-tertiary);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 8px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider span {
    padding: 0 16px;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: white;
    color: #1f1f1f;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.9375rem;
}

.google-btn:hover {
    background: #f8f8f8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--surface-elevated) 25%, var(--surface-hover) 50%, var(--surface-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Streaming indicator */
.streaming-indicator {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    margin-left: 8px;
}

.streaming-indicator span {
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.streaming-indicator span:nth-child(1) { animation-delay: -0.32s; }
.streaming-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Voice card loading state */
.voice-card.loading {
    position: relative;
    overflow: hidden;
}

.voice-card.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(59, 130, 246, 0.05) 50%, transparent 100%);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.voice-card .loading-text {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-align: center;
    margin-top: auto;
    padding: 8px 0;
}

.voice-card .voice-controls {
    min-height: 32px;
}

/* Improved progress bar */
.progress-bar {
    position: relative;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar .buffered {
    position: absolute;
    height: 100%;
    background: rgba(59, 130, 246, 0.3);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-bar .played {
    position: absolute;
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.1s linear;
}

/* Tooltip hint */
.hint {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-elevated);
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.hint::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--border);
}

*:hover > .hint {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--surface-elevated);
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-badge.ready {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.status-badge.buffering {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Faster transitions globally */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
