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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #0a0a14;
    color: #ffffff;
    min-height: 100vh;
    padding: 40px 20px;
}

.settings-container {
    max-width: 1200px;
    margin: 0 auto;
}

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

.settings-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #00e5ff, #ff0080, #ffcc00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.settings-header p {
    color: #808080;
    font-size: 16px;
}

.user-id-display {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 12px;
    background: #12121e;
    border: 1px solid #1a1a2e;
    border-radius: 6px;
    font-size: 12px;
    color: #00e5ff;
    font-family: 'Courier New', monospace;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.settings-card {
    background: #12121e;
    border: 1px solid #1a1a2e;
    border-radius: 12px;
    padding: 24px;
}

.settings-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #ffffff;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a4a;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #a0a0a0;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #00e5ff;
}

.form-group input::placeholder {
    color: #4a4a6a;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.help-link {
    font-size: 12px;
    color: #ff0080;
    text-decoration: none;
}

.help-link:hover {
    text-decoration: underline;
}

.spotify-status {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 999px;
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    color: #808080;
}

.spotify-status::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 6px;
}

.spotify-status.connected {
    background: rgba(29, 185, 84, 0.12);
    border-color: rgba(29, 185, 84, 0.5);
    color: #1ed760;
}

.server-status {
    display: inline-block;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    background: #2a2a4a;
    color: #808080;
    margin-bottom: 16px;
}

.server-status.connected {
    background: rgba(0, 229, 255, 0.2);
    color: #00e5ff;
}

.setup-guide {
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(0, 229, 255, 0.04);
    border: 1px solid #2a2a4a;
    border-left: 3px solid #00e5ff;
    border-radius: 8px;
}

.setup-guide h3 {
    margin-bottom: 10px;
    color: #00e5ff;
    font-size: 14px;
    font-weight: 600;
}

.spotify-guide {
    background: rgba(29, 185, 84, 0.05);
    border-left-color: #1db954;
}

.spotify-guide h3 {
    color: #1db954;
}

.youtube-guide {
    background: rgba(255, 0, 0, 0.05);
    border-left-color: #ff0000;
}

.youtube-guide h3 {
    color: #ff4d4d;
}

.youtube-connection {
    padding: 14px;
    background: rgba(255, 0, 0, 0.04);
    border: 1px solid rgba(255, 0, 0, 0.25);
    border-radius: 8px;
}

.youtube-desktop-status {
    margin-bottom: 12px;
    color: #ff8080;
    font-size: 13px;
    font-weight: 600;
}

.youtube-desktop-status.connected {
    color: #1db954;
}

.youtube-auth-code {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    padding: 12px;
    background: #12121e;
    border-radius: 6px;
    color: #c0c0c0;
    font-size: 12px;
    text-align: center;
}

.youtube-auth-code strong {
    color: #ff0000;
    font-size: 28px;
    letter-spacing: 6px;
}

.youtube-auth-code p {
    margin: 0;
    color: #808080;
    line-height: 1.4;
}

.youtube-connection-actions {
    display: flex;
    gap: 10px;
}

.youtube-connection-actions .btn {
    flex: 1;
}

.setup-guide ol {
    margin: 0;
    padding-left: 20px;
    color: #c0c0c0;
    font-size: 13px;
    line-height: 1.5;
}

.setup-guide li {
    margin-bottom: 7px;
}

.setup-guide li:last-child {
    margin-bottom: 0;
}

.setup-note,
.button-hint,
.field-hint {
    color: #808080;
    font-size: 12px;
    line-height: 1.5;
}

.setup-note {
    margin-top: 12px;
}

.required-badge,
.copy-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    vertical-align: middle;
}

.required-badge {
    background: rgba(255, 0, 128, 0.15);
    color: #ff80b8;
}

.copy-badge {
    background: rgba(0, 229, 255, 0.12);
    color: #00e5ff;
}

.field-hint {
    margin-top: 8px;
}

.button-hint {
    margin-top: -12px;
    margin-bottom: 20px;
}

.source-selector {
    margin: 20px 0;
    padding: 14px;
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
}

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

.source-selector-header h3 {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

#active-source-status {
    color: #00e5ff;
    font-size: 12px;
    font-weight: 600;
}

.source-toggle {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.source-btn {
    padding: 9px 12px;
    background: #12121e;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #808080;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.source-btn:hover {
    color: #ffffff;
}

.source-btn-spotify.active {
    background: rgba(29, 185, 84, 0.12);
    border-color: #1db954;
    color: #1db954;
}

.source-btn-youtube.active {
    background: rgba(255, 0, 0, 0.12);
    border-color: #ff0000;
    color: #ff4d4d;
}

.api-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 20px 0;
    padding: 4px;
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
}

.api-tab {
    padding: 10px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #808080;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.api-tab:hover {
    color: #ffffff;
}

.api-tab[data-api-tab="spotify"] {
    --api-tab-color: #1db954;
    --api-tab-background: rgba(29, 185, 84, 0.12);
}

.api-tab[data-api-tab="youtube"] {
    --api-tab-color: #ff0000;
    --api-tab-background: rgba(255, 0, 0, 0.12);
}

.api-tab.active {
    background: var(--api-tab-background, rgba(0, 229, 255, 0.1));
    border-color: var(--api-tab-color, #00e5ff);
    color: var(--api-tab-color, #00e5ff);
}

.api-panel[hidden] {
    display: none;
}

.api-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.api-save-note {
    color: #808080;
    font-size: 12px;
}

.divider {
    border: none;
    border-top: 1px solid #2a2a4a;
    margin: 20px 0;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.style-picker {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.style-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 8px;
    background: #0f0f1a;
    border: 2px solid #2a2a4a;
    border-radius: 8px;
    color: #a0a0a0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.style-btn:hover {
    border-color: #4a4a6a;
    color: #ffffff;
}

.style-btn.active {
    border-color: #00e5ff;
    color: #00e5ff;
    background: rgba(0, 229, 255, 0.1);
}

.theme-btn {
    padding: 10px 8px;
    background: #0f0f1a;
    background: color-mix(in srgb, var(--theme-color, #2a2a4a) 12%, #0f0f1a);
    border: 2px solid var(--theme-color, #2a2a4a);
    border-radius: 8px;
    color: #a0a0a0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn:hover {
    border-color: #4a4a6a;
    color: #ffffff;
}

.theme-btn.active {
    border-color: var(--theme-color, #00e5ff);
    color: var(--theme-color, #00e5ff);
    background: rgba(0, 229, 255, 0.1);
    background: color-mix(in srgb, var(--theme-color, #00e5ff) 22%, #0f0f1a);
    box-shadow: 0 0 12px color-mix(in srgb, var(--theme-color, #00e5ff) 45%, transparent);
}

.theme-btn[data-theme="dark"] { --theme-color: #00e5ff; }
.theme-btn[data-theme="light"] { --theme-color: #6366f1; }
.theme-btn[data-theme="neon"] { --theme-color: #00ff88; }
.theme-btn[data-theme="nord"] { --theme-color: #88c0d0; }
.theme-btn[data-theme="bumblebee"] { --theme-color: #faf807; }
.theme-btn[data-theme="sunset"] { --theme-color: #ff7b3d; }
.theme-btn[data-theme="dynamic"] { --theme-color: #ff4d9d; }
.theme-btn[data-theme="dynamic-advanced"] { --theme-color: #a06bff; }

.theme-btn:hover,
.theme-btn.active {
    border-color: var(--theme-color, #00e5ff);
    color: var(--theme-color, #00e5ff);
}

.theme-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.theme-status {
    color: #808080;
    font-size: 12px;
}

.theme-status.pending {
    color: #ffcc00;
}

.theme-status.applied {
    color: #00e5ff;
}

.obs-dimensions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    margin-bottom: 20px;
    background: rgba(0, 229, 255, 0.06);
    border: 2px solid rgba(0, 229, 255, 0.25);
    border-radius: 8px;
    color: #00e5ff;
    font-size: 13px;
}

.obs-dimensions.pulse {
    animation: obsPulse 1.6s ease-in-out infinite;
}

@keyframes obsPulse {
    0%, 100% {
        border-color: rgba(255, 77, 157, 0.35);
        box-shadow: 0 0 0 0 rgba(255, 77, 157, 0.25);
    }
    50% {
        border-color: rgba(255, 77, 157, 0.95);
        box-shadow: 0 0 18px 4px rgba(255, 77, 157, 0.5);
    }
}

.obs-dimensions span {
    color: #808080;
    font-size: 12px;
}

.source-checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    font-size: 13px;
    color: #ffffff;
}

.source-checklist ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #b0b0b0;
    font-size: 12px;
}

.check-note {
    color: #808080;
    font-size: 12px;
}

.check {
    display: inline-block;
    width: 18px;
    font-weight: 700;
}

.check.on {
    color: #00ff88;
}

.check.off {
    color: #ff4d4d;
}

.url-display {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.url-display input {
    flex: 1;
    padding: 12px 16px;
    background: #0a0a14;
    border: 1px solid #1a1a2e;
    border-radius: 8px;
    color: #00e5ff;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.hint {
    font-size: 13px;
    color: #808080;
    line-height: 1.5;
}

.hint code {
    background: #12121e;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #ffcc00;
}

.preview-heading {
    margin-bottom: 12px;
}

.theme-heading {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #2a2a4a;
}

.connections-card {
    grid-column: 1 / -1;
}

.connections-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
}

.connections-title {
    font-size: 18px;
    font-weight: 700;
}

.connections-toggle-label {
    margin-left: auto;
    color: #808080;
    font-size: 13px;
    font-weight: 500;
}

.connections-chevron {
    color: #808080;
    font-size: 14px;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.connections-card.collapsed .connections-chevron {
    transform: rotate(-90deg);
}

.connections-card.collapsed .connections-body {
    display: none;
}

.preview-section {
    grid-column: 1 / -1;
}

.preview-section .preview-actions {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.preview-container {
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 360px;
    margin-bottom: 0;
    margin-top: 8px;
    overflow: hidden;
    position: relative;
}

.preview-container iframe {
    width: 1400px;
    height: 550px;
    border: none;
    border-radius: 16px;
    background: transparent;
    overflow: hidden;
    transform: scale(0.62);
    transform-origin: center center;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -700px;
    margin-top: -275px;
}

.preview-container.story-preview {
    height: 680px;
}

.preview-container.story-preview iframe {
    width: 1080px;
    height: 1920px;
    transform: scale(0.34);
    margin-left: -540px;
    margin-top: -960px;
}

.obs-section {
    margin-top: 24px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #00e5ff, #00b8d4);
    color: #0a0a14;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #00b8d4, #0097a7);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #2a2a4a;
    color: #ffffff;
}

.btn-secondary:hover {
    background: #3a3a5a;
}

.btn-spotify {
    background: #1db954;
    color: #ffffff;
}

.btn-spotify:hover {
    background: #1ed760;
}

.btn-youtube {
    background: #ff0000;
    color: #ffffff;
}

.btn-youtube:hover {
    background: #cc0000;
}

.btn-danger {
    background: #ff4444;
    color: #ffffff;
}

.btn-danger:hover {
    background: #ff6666;
}

.btn-large {
    padding: 16px 48px;
    font-size: 16px;
}

.button-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.spotify-actions {
    align-items: center;
}

.button-row .btn {
    flex: 1;
}

.readonly-input {
    background: #0a0a14 !important;
    border-color: #00e5ff !important;
    color: #00e5ff !important;
    font-family: 'Courier New', monospace;
    cursor: default;
}

.readonly-input:focus {
    outline: none;
    border-color: #00e5ff !important;
}

.settings-footer {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #00e5ff, #00b8d4);
    color: #0a0a14;
    padding: 16px 24px;
    border-radius: 8px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background: #ff4444;
    color: #ffffff;
}
