:root {
    --bg-color: #000000;
    /* Black */
    --text-primary: #ffffff;
    /* White */
    --text-secondary: #d1d5db;
    /* Light Gray */
    --accent-primary: #f97316;
    /* Orange */
    --accent-secondary: #fb923c;
    /* Light Orange */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.15);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius-lg: 16px;
    --radius-md: 8px;
    --font-main: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(249, 115, 22, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(251, 146, 60, 0.15) 0%, transparent 40%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* ... existing styles ... */

/* --- Login Gate (First Page) --- */
#loginPage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #0f0f12;
    /* Deep dark background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    /* On top of everything */
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#loginPage.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

.app-container {
    width: 100%;
    width: 95%;
    max-width: 1400px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f97316, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Fix lint */
}

.logo i {
    font-size: 1.8rem;
    color: #f97316;
    /* Fallback */
    -webkit-text-fill-color: #f97316;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.api-config {
    display: flex;
    gap: 0.5rem;
}

.api-config input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 150px;
    transition: width 0.3s ease;
}

.api-config input:focus {
    outline: none;
    border-color: var(--accent-primary);
    width: 200px;
}

.api-config button {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--success);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.api-config button:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #ffffff, #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Fix lint */
}

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

/* Forms */
.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .form-group-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

select,
textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.2s;
}

/* File Upload */
.file-upload-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-upload-label {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.file-upload-label:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.clear-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.3);
}

textarea {
    min-height: 180px;
    resize: vertical;
    line-height: 1.5;
}

.char-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: none;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    /* Keep white for contrast on orange */
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s, opacity 0.2s;
    margin-top: 1rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.3);
}

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

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    margin: 2rem auto 0;
    display: block;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.outline-btn {
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.outline-btn:hover {
    background: rgba(249, 115, 22, 0.1);
}

.small-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

/* Results Section */
.results-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    align-items: start;
    animation: fadeIn 0.5s ease-out;
}

.score-card {
    grid-column: 1;
    order: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    height: 100%;
}

.grid-row {
    grid-column: 2;
    order: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    height: 100%;
}

.ai-tools-card {
    grid-column: 1 / -1;
    order: 3;
}

#toolOutput {
    grid-column: 1 / -1;
    order: 4;
}

#sectionAnalysis {
    grid-column: 1 / -1;
    order: 5;
}

.progress-ring__circle {
    transition: stroke-dashoffset 1s ease-in-out;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke-linecap: round;
}

.score-circle-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#atsScore {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.score-text .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.score-summary h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.score-summary p {
    color: var(--text-secondary);
    line-height: 1.5;
}

.grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-red {
    color: var(--danger);
}

.text-yellow {
    color: var(--warning);
}

.text-green {
    color: var(--success);
}

/* Lists */
.tag-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-list li {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.check-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.check-list li {
    position: relative;
    padding-left: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.check-list li::before {
    content: "•";
    /* Fallback or icon */
    position: absolute;
    left: 0;
    color: var(--warning);
    font-weight: bold;
}

/* Accordion (Section Analysis) */
.accordion-item {
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 0;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.status-good {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-bad {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.accordion-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

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

.hidden {
    display: none !important;
}

footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: auto;
    padding-bottom: 1rem;
}

/* AI Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    min-height: 160px;
    font-family: var(--font-main);
}

.tool-btn i {
    font-size: 2rem;
    color: #c084fc;
    margin-bottom: 0.5rem;
}

.tool-btn span {
    font-size: 1.1rem;
    font-weight: 600;
}

.tool-btn .tool-desc {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tool-btn:hover {
    background: rgba(192, 132, 252, 0.1);
    border-color: #c084fc;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(192, 132, 252, 0.15);
}

/* Tool Output */
.tool-output {
    background: rgba(30, 30, 30, 0.6);
    /* Darker, more opaque background */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.4s ease-out;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.tool-header h4 {
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #c084fc, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Purple Gradient */
}

#closeToolBtn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#closeToolBtn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Markdown Content Styles */
.markdown-content {
    font-size: 1rem;
    line-height: 1.7;
    color: #e5e7eb;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.markdown-content h3 {
    font-size: 1.1rem;
    color: #fb923c; /* Orange Accent */
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content ul, .markdown-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.markdown-content ul {
    list-style: none; /* Custom bullets */
}

.markdown-content li {
    position: relative;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.markdown-content ul li::before {
    content: "•";
    position: absolute;
    left: -1rem;
    color: #c084fc; /* Purple bullet */
    font-weight: bold;
}

.markdown-content strong {
    color: #fff;
    font-weight: 600;
}

.markdown-content em {
    color: #fb923c;
    font-style: italic;
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent-primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: #fb923c;
}

.text-purple {
    color: #c084fc;
}

/* --- Resume Editor & AI Writer --- */
.editor-container {
    animation: fadeIn 0.5s ease-out;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.editor-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

/* A4 Paper Look */
.paper-preview {
    background: white;
    color: #1f2937;
    /* Dark text for paper */
    padding: 40px;
    border-radius: 4px;
    /* Minimal radius for paper */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-height: 800px;
    /* A4-ish height */
    font-family: 'Times New Roman', Times, serif;
    /* Classic resume font */
    position: relative;
    overflow: hidden;
}

/* Paper Loading */
.paper-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #4b5563;
    gap: 1rem;
}

.paper-loading .spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--accent-primary);
}

/* Editable Zones */
.editable-section {
    margin-bottom: 1.5rem;
    position: relative;
    border: 1px dashed transparent;
    transition: all 0.2s;
    padding: 0.5rem;
    border-radius: 4px;
}

.editable-section:hover {
    border-color: rgba(249, 115, 22, 0.3);
    /* Orange hint */
    background: rgba(249, 115, 22, 0.02);
}

.editable-field,
[contenteditable="true"] {
    outline: none;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.01);
    padding: 2px 4px;
    border-radius: 2px;
}

.editable-field:hover,
[contenteditable="true"]:hover {
    background: rgba(0, 0, 0, 0.03);
    border-bottom-color: rgba(0, 0, 0, 0.2);
}

.editable-field:focus,
[contenteditable="true"]:focus {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-bottom: 2px solid var(--accent-primary);
    border-radius: 2px;
}

/* AI Magic Button */
.ai-magic-btn {
    position: absolute;
    right: 5px;
    top: 5px;
    background: linear-gradient(135deg, #c084fc, #a855f7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.editable-section:hover .ai-magic-btn {
    opacity: 1;
}

.ai-magic-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

/* Editor Styling Inner */
.resume-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.resume-header h1 {
    font-size: 2rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.resume-contact {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.resume-section-title {
    font-size: 1.1rem;
    text-transform: uppercase;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    margin-bottom: 0.8rem;
    padding-bottom: 0.2rem;
    color: #111;
}

.resume-entry {
    margin-bottom: 1rem;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}

.entry-sub {
    font-style: italic;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.entry-list {
    padding-left: 1.2rem;
    margin: 0;
}

.entry-list li {
    margin-bottom: 0.2rem;
    line-height: 1.4;
}

/* --- Futuristic / Cyberpunk Mode --- */
body.cyberpunk-mode {
    --accent-primary: #00f3ff;
    --accent-secondary: #bc13fe;
    --accent-gradient-start: #00f3ff;
    --accent-gradient-end: #bc13fe;
    --bg-color: #050510;
    --glass-bg: rgba(10, 10, 20, 0.7);
    --text-primary: #ffffff;
    --text-secondary: #a0a0ff;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(0, 243, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(188, 19, 254, 0.15) 0%, transparent 40%);
}

body.cyberpunk-mode .glass-panel,
body.cyberpunk-mode .tool-btn {
    border: 1px solid rgba(0, 243, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.1);
}

body.cyberpunk-mode .tool-btn:hover {
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.4), inset 0 0 10px rgba(188, 19, 254, 0.2);
    border-color: var(--accent-primary);
}

body.cyberpunk-mode .primary-btn {
    background: linear-gradient(135deg, #00f3ff, #bc13fe);
    color: #000;
    font-weight: 700;
    text-shadow: none;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

body.cyberpunk-mode h1,
body.cyberpunk-mode h2,
body.cyberpunk-mode .logo span {
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #bc13fe;
}

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

/* Tool Output Styling */
.tool-output {
    margin-top: 2rem;
    padding: 2rem;
    animation: fadeIn 0.3s ease-out;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

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

.tool-content-area {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* --- Authentication & User Profile --- */
.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-profile span {
    font-weight: 500;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #1a1a1a;
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    position: relative;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

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

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

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

/* Auth Form */
#authForm {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

#authForm input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#authForm input:focus {
    border-color: var(--accent-primary);
}

.auth-separator {
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: relative;
}

.auth-separator::before,
.auth-separator::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--glass-border);
}

.auth-separator::before {
    left: 0;
}

.auth-separator::after {
    right: 0;
}

.google-btn {
    width: 100%;
    background: white;
    color: black;
    border: none;
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.google-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.1);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* --- Orbit Login Theme --- */
:root {
    --orbit-bg: #000000;
    --orbit-panel: #111111;
    --orbit-primary: #f97316;
    /* Orange */
    --orbit-primary-hover: #ea580c;
    --orbit-input-bg: #222222;
    --orbit-text: #ffffff;
    --orbit-text-muted: #a4a4b0;
}

.orbit-theme {
    background: var(--orbit-panel) !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 2.5rem !important;
    max-width: 420px !important;
}

.orbit-theme h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--orbit-text);
}

/* Segmented Control */
.auth-toggle-container {
    position: relative;
    display: flex;
    background: var(--orbit-input-bg);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 2rem;
}

.auth-toggle-bg {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--orbit-panel);
    /* Initially panel color, changed by JS */
    border-radius: 10px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1;
    background: #3a3a45;
    /* Darker distinct bg for toggle */
}

.auth-toggle-btn {
    flex: 1;
    border: none;
    background: none;
    color: var(--orbit-text-muted);
    padding: 10px 0;
    font-weight: 600;
    z-index: 2;
    cursor: pointer;
    transition: color 0.3s;
    text-align: center;
}

.auth-toggle-btn.active {
    color: var(--orbit-text);
}

/* Input Fields */
.orbit-theme input {
    background: var(--orbit-input-bg) !important;
    border: 1px solid transparent !important;
    border-radius: 12px !important;
    padding: 1.2rem !important;
    font-size: 1rem;
    color: var(--orbit-text) !important;
    transition: all 0.2s;
}

.orbit-theme input:focus {
    background: #32323c !important;
    border-color: var(--orbit-primary) !important;
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2);
}

/* Buttons */
.orbit-primary-btn {
    background: var(--orbit-primary) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 1rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
    color: black !important;
}

.orbit-primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.4);
    background: var(--orbit-primary-hover) !important;
}

.orbit-google-btn {
    background: #ffffff !important;
    color: #1e1e24 !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    padding: 1rem !important;
}

.orbit-google-btn:hover {
    background: #f0f0f5 !important;
}

/* Hide old switch */
.auth-switch {
    display: none;
}

/* --- Login Gate (First Page) --- */
#loginPage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #0f0f12;
    /* Deep dark background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    /* On top of everything */
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#loginPage.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

#mainApp {
    transition: opacity 0.5s ease;
    opacity: 1;
}

#mainApp.hidden {
    display: none;
    opacity: 0;
}

/* OTP Inputs */
.otp-digit {
    width: 48px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    transition: all 0.2s ease;
    margin: 0 0.2rem;
    caret-color: #f37021;
    font-family: Arial, Helvetica, sans-serif !important;
    /* Force standard digits */
    padding: 0;
    line-height: normal;
    box-sizing: border-box;
}

.otp-digit:focus {
    border-color: #f37021;
    background: rgba(243, 112, 33, 0.1);
    box-shadow: 0 0 10px rgba(243, 112, 33, 0.2);
    outline: none;
}