:root {
    --league-purple: #f3e8ff;
    --league-blue: #e0f2fe;
    --league-ink: #0f172a;
    --league-muted: #475569;
}

[x-cloak] {
    display: none !important;
}

body {
    font-family: "Space Grotesk", sans-serif;
    color: var(--league-ink);
    min-height: 100vh;
}

.league-bg {
    background:
        radial-gradient(circle at 8% 10%, rgba(224, 242, 254, 0.9), transparent 35%),
        radial-gradient(circle at 84% 12%, rgba(243, 232, 255, 0.94), transparent 38%),
        radial-gradient(circle at 72% 85%, rgba(224, 242, 254, 0.72), transparent 30%),
        linear-gradient(140deg, #fbfdff 0%, #f1f8ff 42%, #f8f0ff 100%);
}

.mono-data {
    font-family: "JetBrains Mono", monospace;
}

.glass {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.67), rgba(255, 255, 255, 0.45));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
}

.card-glow {
    position: relative;
    animation: dashboard-card-pulse 2.4s ease-in-out infinite;
}

.menu-bar {
    position: relative;
    z-index: 40;
    overflow: visible;
}

.menu-anchor {
    position: relative;
    z-index: 60;
}

.card-glow::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.85), transparent);
    border-radius: 50%;
    opacity: 0;
    animation: dashboard-edge-glow 0.5s 0.2s ease forwards;
}

@keyframes dashboard-card-pulse {
    0%, 100% {
        border-color: rgba(255, 255, 255, 0.72);
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.65),
            0 0 14px rgba(147, 197, 253, 0.12),
            0 16px 40px rgba(15, 23, 42, 0.1);
    }
    50% {
        border-color: rgba(196, 181, 253, 0.9);
        box-shadow:
            0 0 0 1px rgba(196, 181, 253, 0.55),
            0 0 24px rgba(147, 197, 253, 0.24),
            0 0 50px rgba(139, 92, 246, 0.14),
            0 16px 40px rgba(15, 23, 42, 0.1);
    }
}

@keyframes dashboard-edge-glow {
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fade-in 500ms ease-out;
}

.stagger-item {
    animation: rise-in 420ms ease-out;
}

.stagger-item:nth-child(2) {
    animation-delay: 40ms;
}

.stagger-item:nth-child(3) {
    animation-delay: 80ms;
}

.stagger-item:nth-child(4) {
    animation-delay: 120ms;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    .glass {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .card-glow {
        animation-duration: 2.8s;
    }
}

.settings-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.settings-card {
    width: 100%;
    max-width: 680px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.5rem;
}

.settings-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.3rem;
}

.settings-title {
    margin: 0;
    font-size: 1.45rem;
    color: #0f172a;
}

.settings-sub {
    margin: 0 0 1.2rem;
    color: #475569;
}

.settings-menu {
    position: relative;
}

.menu-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.5rem;
    padding: 0 1rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 6px -1px rgba(186, 230, 253, 0.6);
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 160ms ease;
}

.menu-trigger:hover {
    background: rgba(255, 255, 255, 1);
}

.menu-panel {
    position: absolute;
    right: 0;
    z-index: 120;
    width: 12rem;
    margin-top: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.menu-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: background 160ms ease;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.5);
}

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    margin-bottom: 0.4rem;
    color: #334155;
    font-weight: 600;
}

.input {
    width: 100%;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
}

.button-row {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 0.6rem 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(90deg, #c4b5fd, #93c5fd);
    color: #0f172a;
}

.btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
}

.preview {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(243, 232, 255, 0.55);
    border: 1px solid #dbeafe;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.preview-avatar {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    object-fit: cover;
    background: #f8fafc;
}

.preview-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-weight: 700;
}

.preview-name {
    margin: 0;
    color: #0f172a;
    font-weight: 700;
}

.preview-role {
    margin: 0.2rem 0 0;
    color: #64748b;
}

.notice {
    margin-bottom: 1rem;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    font-size: 0.92rem;
}

.notice-ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.notice-err {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@media (max-width: 640px) {
    .settings-header {
        align-items: stretch;
    }
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE STYLES
   ═══════════════════════════════════════════════════════════════ */

.login-page {
    --bg:        #f7fbff;
    --surface:   rgba(255, 255, 255, 0.66);
    --border:    rgba(255, 255, 255, 0.72);
    --text:      #0f172a;
    --muted:     #64748b;
    --discord:   #93c5fd;
    --discord-h: #7bb4f7;
    --node:      #7c3aed;
    --branch:    #8b5cf6;
}

.login-page *, .login-page *::before, .login-page *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 10%, rgba(224, 242, 254, 0.9), transparent 35%),
        radial-gradient(circle at 72% 85%, rgba(224, 242, 254, 0.72), transparent 30%),
        linear-gradient(140deg, #fbfdff 0%, #f1f8ff 42%, #ffffff 100%);
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Subtle noise grain */
.login-page::after {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.015;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}

/* ── Commit Tile Mosaic ── */
.mosaic-container {
    position: fixed;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    display: grid;
    gap: 4px;
    z-index: 0;
    pointer-events: none;
}

.mosaic-tile {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    background-color: transparent;
    will-change: background-color, transform;
}

/* ── Branch SVG ── */
.login-page .branch-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

.login-page .trunk-line {
    stroke: var(--branch);
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: login-draw-trunk 1.2s 0.2s cubic-bezier(.4,0,.2,1) forwards;
}

@keyframes login-draw-trunk {
    to { stroke-dashoffset: 0; }
}

/* ── Card ── */
.login-page .card {
    position: relative;
    z-index: 10;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 48px 44px 40px;
    width: 100%;
    max-width: 420px;
    animation:
        login-card-in     0.7s  0.1s  cubic-bezier(.16,1,.3,1) both,
        login-card-pulse  2.4s  1.55s ease-in-out infinite;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

@keyframes login-card-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

@keyframes login-card-pulse {
    0%, 100% {
        border-color: rgba(255,255,255,0.72);
        box-shadow:
            0 0 0 1px rgba(255,255,255,0.65),
            0 0 14px rgba(147,197,253,0.12),
            0 16px 40px rgba(15, 23, 42, 0.1);
    }
    50% {
        border-color: rgba(196,181,253,0.9);
        box-shadow:
            0 0 0 1px rgba(196,181,253,0.55),
            0 0 24px rgba(147,197,253,0.24),
            0 0 50px rgba(139,92,246,0.14),
            0 16px 40px rgba(15, 23, 42, 0.1);
    }
}

/* Top edge glow */
.login-page .card::before {
    content: '';
    position: absolute;
    top: -1px; left: 15%; right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--branch), transparent);
    border-radius: 50%;
    opacity: 0;
    animation: login-edge-glow 0.5s 1.7s ease forwards;
}

@keyframes login-edge-glow {
    to { opacity: 1; }
}

.login-page .card-icon {
    width: 48px; height: 48px;
    background: rgba(243, 232, 255, 0.78);
    border: 1px solid rgba(196, 181, 253, 0.55);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.login-page .card-icon svg {
    width: 24px;
    height: 24px;
    color: var(--node);
}

.login-page h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 8px;
}

.login-page .subtitle {
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 32px;
    font-family: 'JetBrains Mono', monospace;
}

.login-page .divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.35);
    margin-bottom: 28px;
}

.login-page .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
    text-decoration: none;
    margin-bottom: 12px;
    letter-spacing: 0.01em;
}

.login-page .btn-discord {
    background: linear-gradient(90deg, #c4b5fd, #93c5fd);
    color: #0f172a;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.16);
}

.login-page .btn-discord:hover {
    background: linear-gradient(90deg, #b79efc, #7ab6fb);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(99, 102, 241, 0.2);
}

.login-page .btn-discord:active {
    transform: translateY(0);
}

.login-page .btn-github {
    background: linear-gradient(90deg, #8dc7a3, #7eb5f4);
    color: #0f172a;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.18);
}

.login-page .btn-github:hover {
    background: linear-gradient(90deg, #409f63, #549ef1);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(34, 197, 94, 0.25);
}

.login-page .btn-github:active {
    transform: translateY(0);
}

.login-page .step-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: auto;
}

.login-page .badge-active {
    background: rgba(255,255,255,0.55);
    color: #334155;
    border: 1px solid rgba(203,213,225,0.8);
}

/* ═══════════════════════════════════════════════════════════════
   INDEX PAGE STYLES
   ═══════════════════════════════════════════════════════════════ */

.index-page {
    --bg:        #f7fbff;
    --surface:   rgba(255, 255, 255, 0.66);
    --border:    rgba(255, 255, 255, 0.72);
    --text:      #0f172a;
    --muted:     #64748b;
    --accent:    #8b5cf6;
    --accent-h:  #7c3aed;
}

.index-page *, .index-page *::before, .index-page *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.index-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 10%, rgba(224, 242, 254, 0.9), transparent 35%),
        radial-gradient(circle at 84% 12%, rgba(243, 232, 255, 0.94), transparent 38%),
        radial-gradient(circle at 72% 85%, rgba(224, 242, 254, 0.72), transparent 30%),
        linear-gradient(140deg, #fbfdff 0%, #f1f8ff 42%, #f8f0ff 100%);
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: 24px;
}

.index-page::after {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.015;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}

.index-page .card {
    position: relative;
    z-index: 10;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 48px 44px 40px;
    width: 100%;
    max-width: 460px;
    animation: index-card-in 0.7s 0.1s cubic-bezier(.16,1,.3,1) both;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

@keyframes index-card-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.index-page .card::before {
    content: '';
    position: absolute;
    top: -1px; left: 15%; right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 50%;
    opacity: 0;
    animation: index-edge-glow 0.5s 0.8s ease forwards;
}

@keyframes index-edge-glow {
    to { opacity: 1; }
}

.index-page .card-icon {
    width: 48px; height: 48px;
    background: rgba(243, 232, 255, 0.78);
    border: 1px solid rgba(196, 181, 253, 0.55);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.index-page .card-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.index-page h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 8px;
}

.index-page .subtitle {
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 24px;
    font-family: 'JetBrains Mono', monospace;
}

.index-page .divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.35);
    margin: 24px 0;
}

.index-page .section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 12px;
    font-family: 'JetBrains Mono', monospace;
}

.index-page .server-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.index-page .server-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(203, 213, 225, 0.5);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.15s, border-color 0.15s;
}

.index-page .server-list li:hover {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(196, 181, 253, 0.5);
}

.index-page .server-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.index-page .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
    text-decoration: none;
}

.index-page .btn-select {
    background: linear-gradient(90deg, #c4b5fd, #93c5fd);
    color: #0f172a;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12);
}

.index-page .btn-select:hover {
    background: linear-gradient(90deg, #b79efc, #7ab6fb);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.18);
}

.index-page .dropdown {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(203, 213, 225, 0.6);
    background: rgba(255, 255, 255, 0.6);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.index-page .dropdown:hover {
    border-color: rgba(196, 181, 253, 0.6);
}

.index-page .dropdown:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.index-page .card-footer {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.index-page .link {
    font-size: 0.875rem;
    color: var(--muted);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.15s;
}

.index-page .link:hover {
    color: var(--accent);
}