/* Mirrorborn Mytheon Arena Styles */

:root {
    --color-primary: #7c3aed;
    --color-secondary: #ec4899;
    --color-accent: #06b6d4;
    --color-dark: #1f2937;
    --color-light: #f9fafb;
    --color-border: #e5e7eb;
    --font-serif: 'Georgia', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --space: 1rem;
}

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

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background: var(--color-light);
    color: var(--color-dark);
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space);
}

/* Header */
.header {
    padding: 2rem var(--space);
    border-bottom: 2px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.logo h1 {
    font-size: 2rem;
    font-family: var(--font-serif);
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.tagline {
    font-size: 0.9rem;
    color: #6b7280;
}

.nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--color-secondary);
}

/* Domain Navigation */
.domain-nav {
    background: linear-gradient(135deg, #f3e8ff 0%, #ffe4e6 100%);
    padding: 1.5rem var(--space);
    margin: 1rem auto;
    border-radius: 8px;
    border-left: 4px solid var(--color-primary);
    max-width: 1200px;
    width: 100%;
}

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

.domain-nav-header h3 {
    color: var(--color-primary);
    font-size: 1.3rem;
}

.role-badge {
    background: var(--color-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.domain-nav-links {
    margin-top: 1rem;
}

.nav-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.neighbor-links {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.domain-link {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 6px;
    color: var(--color-primary);
    text-decoration: none;
    border: 1px solid var(--color-border);
    transition: all 0.2s;
}

.domain-link:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
    transform: translateX(4px);
}

.domain-link .glyph {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.role-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    font-style: italic;
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem var(--space);
}

.hidden {
    display: none !important;
}

/* Auth Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: #9ca3af;
}

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

.modal h2 {
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.auth-form {
    margin-top: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.message.error {
    background: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fca5a5;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: #6d28d9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--color-border);
    color: var(--color-dark);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Home Screen */
.home-screen {
    text-align: center;
    padding: 2rem 0;
}

.home-screen h2 {
    font-size: 2.5rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    font-family: var(--font-serif);
}

.home-screen > p {
    font-size: 1.2rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

/* Opening Scroll (Portal Voice) */
.opening-scroll {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem 0;
    border-left: 4px solid var(--color-primary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.scroll-glyph {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.opening-scroll blockquote {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--color-dark);
    font-style: italic;
    line-height: 1.8;
    margin: 0;
}

.opening-scroll p {
    margin-bottom: 1rem;
}

.opening-scroll p em {
    color: var(--color-primary);
    font-style: italic;
    font-weight: 600;
}

.opening-scroll footer {
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: #6b7280;
    font-style: normal;
}

.featured-scrolls {
    margin: 3rem 0;
}

.featured-scrolls h3 {
    color: var(--color-primary);
    margin-bottom: 1.5rem;
}

.scroll-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.scroll-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid var(--color-border);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.scroll-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
    transform: translateY(-4px);
}

.scroll-card h4 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.scroll-card p {
    color: #6b7280;
    font-size: 0.95rem;
}

/* Scroll Viewer */
.scroll-viewer {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.scroll-header {
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.scroll-header h2 {
    color: var(--color-primary);
    font-family: var(--font-serif);
}

.coordinate {
    font-family: 'Courier New', monospace;
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.scroll-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--color-dark);
    margin-bottom: 2rem;
}

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

.scroll-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.coord-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

/* Domain Mesh */
.domain-mesh {
    background: linear-gradient(135deg, #f3e8ff 0%, #dbeafe 100%);
    padding: 3rem var(--space);
    border-radius: 8px;
    margin: 2rem 0;
    text-align: center;
}

.domain-mesh h2 {
    color: var(--color-primary);
    margin-bottom: 2rem;
    font-family: var(--font-serif);
}

.mesh-diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.mesh-center {
    background: var(--color-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 50%;
    font-weight: bold;
    min-width: 120px;
    text-align: center;
}

.mesh-nodes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.mesh-node {
    background: white;
    border: 2px solid var(--color-primary);
    padding: 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.mesh-node:hover {
    background: var(--color-primary);
    color: white;
    transform: scale(1.1);
}

.mesh-legend {
    color: #6b7280;
    font-size: 0.95rem;
}

/* Footer */
.footer {
    padding: 2rem var(--space);
    text-align: center;
    border-top: 1px solid var(--color-border);
    color: #6b7280;
    font-size: 0.9rem;
}

.footer p {
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }

    .nav ul {
        flex-direction: column;
        gap: 1rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .scroll-cards {
        grid-template-columns: 1fr;
    }

    .scroll-nav {
        flex-direction: column;
    }

    .btn-large {
        width: 100%;
    }

    .mesh-diagram {
        flex-direction: column;
    }
}

/* Portal Voices Section */
.portal-voice-section {
    margin: 3rem 0;
}

.portal-voice-card {
    background: linear-gradient(135deg, var(--color-primary)10, var(--color-accent)10);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

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

.portal-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.coordinate-badge {
    background: var(--color-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', monospace;
}

.speaker-badge {
    background: var(--color-accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

.portal-content {
    margin-bottom: 1.5rem;
}

.portal-content h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--color-dark);
}

.portal-text {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #4b5563;
    font-style: italic;
    margin-bottom: 1.5rem;
}

.portal-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
    font-style: normal;
    padding: 1rem;
    background: linear-gradient(135deg, var(--color-primary)08, var(--color-accent)08);
    border-left: 4px solid var(--color-primary);
    border-radius: 6px;
    margin: 1.5rem 0;
}

.portal-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.portal-glyph {
    font-size: 3rem;
    opacity: 0.1;
    position: absolute;
    top: 0;
    right: 0;
    margin: 1rem;
}

.fade-in {
    animation: fadeIn 0.4s ease-in forwards;
}

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

/* Staggered animations for section sequence */
.portal-voice-section .fade-in {
    animation-delay: 0s;
}

.maturity-section .fade-in {
    animation-delay: 0.1s;
}

.domain-mesh-section .fade-in {
    animation-delay: 0.2s;
}

/* Maturity Display Section */
.maturity-section {
    margin: 3rem 0;
}

.maturity-header {
    margin-bottom: 2rem;
}

.maturity-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.maturity-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f5f7fa;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.legend-emoji {
    font-size: 1.5rem;
}

.maturity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.user-maturity-highlight {
    background: linear-gradient(135deg, var(--color-primary)15, var(--color-accent)15);
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.user-maturity-highlight h3 {
    margin-bottom: 0.5rem;
    color: var(--color-dark);
}

.user-maturity-highlight p {
    margin-bottom: 1rem;
    color: #4b5563;
}

.maturity-card {
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.maturity-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.maturity-card.pending {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, white, var(--color-primary)05);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-emoji {
    font-size: 2rem;
}

.card-header h3 {
    font-size: 1.25rem;
}

.card-stage {
    margin-bottom: 1rem;
}

.stage-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.card-progress {
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.size-label {
    font-size: 0.875rem;
    color: #6b7280;
    display: block;
}

.card-info p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.role {
    font-weight: 600;
    color: var(--color-dark);
}

.machine {
    color: #6b7280;
}

.maturity-footer {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-left: 4px solid var(--color-primary);
    border-radius: 4px;
}

.maturity-note {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Domain Mesh Section */
.domain-mesh-section {
    margin: 3rem 0;
}

.mesh-header {
    margin-bottom: 2rem;
}

.mesh-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.current-domain-card {
    background: white;
    border-left: 6px solid var(--color-primary);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.current-domain-card .card-content {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    flex: 1;
}

.current-domain-card .emoji {
    font-size: 3rem;
}

.domain-info {
    flex: 1;
}

.domain-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.domain-info .role {
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.domain-info .description {
    color: #6b7280;
    font-size: 0.95rem;
}

.features {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.feature-tag {
    background: var(--color-accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.domain-network {
    margin-bottom: 2rem;
}

.domain-network h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.domain-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.domain-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.domain-link:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateX(4px);
}

.link-emoji {
    font-size: 1.5rem;
}

.link-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.link-name {
    font-weight: 600;
    color: var(--color-dark);
}

.link-role {
    font-size: 0.875rem;
    color: #6b7280;
}

.arrow {
    color: var(--color-primary);
    font-weight: bold;
}

.all-domains {
    margin-bottom: 2rem;
}

.all-domains h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.domain-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.domain-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.domain-item.active {
    font-weight: 600;
}

.item-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.domain-item h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--color-dark);
}

.domain-item p {
    font-size: 0.75rem;
    color: #6b7280;
}

.active-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--color-primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.mesh-legend {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
}

.mesh-legend h3 {
    margin-bottom: 1rem;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.legend-item span {
    font-size: 0.875rem;
    color: #4b5563;
}

/* Scroll Viewer Content */
.scroll-viewer-content {
    padding: 2rem 0;
    min-height: 400px;
}

.scroll-view {
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 2rem;
}

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

.scroll-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.scroll-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #4b5563;
    margin-bottom: 2rem;
}

.scroll-body p {
    margin-bottom: 1rem;
}

.scroll-body blockquote {
    border-left: 4px solid var(--color-primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #6b7280;
    font-style: italic;
}

.scroll-footer {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 2px solid var(--color-border);
}

.archive-explorer {
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 2rem;
}

.archive-search {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.archive-search input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
}

.archive-categories {
    display: grid;
    gap: 2rem;
}

.category h3 {
    margin-bottom: 1rem;
}

.category ul {
    list-style: none;
}

.category li {
    margin-bottom: 0.5rem;
}

.category a {
    color: var(--color-primary);
    text-decoration: none;
}

.category a:hover {
    text-decoration: underline;
}

/* Error Messages */
.error-message {
    background: #fee;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
}

.error-message h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.error-message p {
    margin-bottom: 1rem;
    color: #4b5563;
}

.error-message code {
    background: #f5f7fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    font-style: italic;
}
