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

body {
    background: #0f1b2d;
    color: #e8ebf0;
    font-family: 'Segoe UI', Arial, sans-serif;
    min-height: 100vh;
    padding: 14px;
    overscroll-behavior-y: contain;
}

.app {
    max-width: 520px;
    margin: 0 auto;
    min-height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* Header */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #1a2a45;
    border-radius: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-name {
    display: inline-block;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 8px;
    background: rgba(15, 27, 45, .55);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 4px 18px rgba(0, 0, 0, .35);
    color: #e8ebf0;
}

.brand-accent { color: #c8202c; margin-left: 2px; }

.brand-dot {
    width: 12px;
    height: 12px;
    background: #2979ff;
    border-radius: 50%;
    display: inline-block;
    animation: blink 2s infinite;
    box-shadow: 0 0 8px #2979ff;
}

@keyframes blink {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px #2979ff; }
    50% { opacity: 0; box-shadow: none; }
}

.icon-btn {
    background: #22345a;
    border: 1px solid #3a4a70;
    color: #e8ebf0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}

.icon-btn:hover { background: #2f4264; }

.logout { margin: 0; }

.header-actions { display: flex; gap: 6px; }

/* Nav tabs (CHIPFORGE style) */
.nav-tabs {
    display: flex;
    gap: 0;
    margin-bottom: -14px;
    padding: 0;
}

.nav-tab {
    flex: 1;
    min-width: 0;
    padding: 12px 8px;
    background: #0f1b2d;
    border: 1px solid #2a3a55;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 400;
    color: #8899b5;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 480px) {
    .nav-tab {
        padding: 12px 16px;
        font-size: 0.8rem;
        letter-spacing: 1.5px;
    }
}

.nav-tab:hover { color: #e8ebf0; background: #1e2f4e; }
.nav-tab.active {
    background: #1a2a45;
    color: #e8ebf0;
    border-bottom: 1px solid #1a2a45;
    position: relative;
    z-index: 1;
}

/* Content */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.footer {
    text-align: center;
    color: #56668a;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 8px 0 4px;
}

/* Cards */
.card {
    background: #1a2a45;
    border: 1px solid #2a3a55;
    border-radius: 10px;
    padding: 20px;
}

.card-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: #8899b5;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

/* Counter */
.counter-card { text-align: center; }

.counter-remaining {
    font-size: clamp(42px, 11vw, 58px);
    font-weight: 300;
    letter-spacing: 2px;
    line-height: 1;
    color: #e8ebf0;
    font-variant-numeric: tabular-nums;
}

.counter-sub {
    margin-top: 8px;
    color: #8899b5;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.progress {
    margin-top: 16px;
    height: 10px;
    background: #0f1b2d;
    border: 1px solid #2a3a55;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #2979ff;
    border-radius: 5px;
    transition: width .6s ease;
    box-shadow: 0 0 8px rgba(41, 121, 255, .5);
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.8rem;
    color: #8899b5;
    font-family: 'Consolas', 'SF Mono', monospace;
}

/* User card */
.user-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.user-name {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #e8ebf0;
}

.user-head-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.user-head-line .card-label { margin-bottom: 0; }

.user-rank-block {
    margin-top: 14px;
    margin-bottom: 16px;
}

.user-rank-block .card-label { margin-bottom: 6px; }

.user-rank-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2979ff;
    letter-spacing: 1px;
}

.custom-rank-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #2a3a55;
}

.custom-rank-hint {
    margin-top: 6px;
    font-size: 0.72rem;
    color: #8899b5;
    letter-spacing: .3px;
}

.user-rank-wrap {
    display: inline-block;
    position: relative;
    padding: 2px 4px;
    border-radius: 6px;
}

.custom-fx-block {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #2a3a55;
}

.fx-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

@media (min-width: 420px) {
    .fx-picker { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 600px) {
    .fx-picker { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

.fx-picker form { margin: 0; min-width: 0; }

.fx-option {
    width: 100%;
    max-width: 100%;
    background: #0f1b2d;
    border: 1px solid #2a3a55;
    border-radius: 10px;
    padding: 10px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
    font-family: 'Segoe UI', Arial, sans-serif;
    transition: all .15s ease;
    overflow: hidden;
}

.fx-option:hover {
    border-color: #3a4a70;
    background: #131f36;
}

.fx-option.is-selected {
    border-color: #2979ff;
    background: rgba(41, 121, 255, .08);
    box-shadow: 0 0 14px rgba(41, 121, 255, .25);
}

.fx-preview {
    display: block;
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #e8ebf0;
    position: relative;
    overflow: hidden;
    background: rgba(15, 27, 45, .6);
    border: 1px solid rgba(255, 255, 255, .08);
    min-height: 30px;
}

.fx-preview .rank-name { display: inline-block; }

.fx-label {
    font-size: 0.65rem;
    color: #8899b5;
    letter-spacing: .5px;
    text-transform: uppercase;
    font-family: 'Consolas', 'SF Mono', monospace;
}

/* Elite-Tab: goldenes Glow-Akzent */
.nav-tab-elite {
    color: #ffd700 !important;
    border-color: rgba(255, 215, 0, .4) !important;
}
.nav-tab-elite.active {
    background: rgba(255, 215, 0, .08) !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, .18);
}

.customize-intro {
    color: #b0bacf;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.customize-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 12px;
    background: #0a1322;
    border: 1px solid #2a3a55;
    border-radius: 10px;
}

.customize-preview-sub {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #56668a;
}

.customize-preview .user-rank-wrap {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2979ff;
    letter-spacing: 1px;
    padding: 8px 18px;
    border-radius: 10px;
}

.customize-form .add-row { margin-top: 4px; }

.rank-badge {
    background: #0d2140;
    color: #2979ff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, .3);
}

.user-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}

.stat {
    background: #0f1b2d;
    border: 1px solid #2a3a55;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 400;
    color: #e8ebf0;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8899b5;
    margin-top: 4px;
}

/* Forms */
.add-form {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #2a3a55;
    padding-top: 16px;
    margin-top: 4px;
}

.add-label {
    font-size: 0.75rem;
    color: #8899b5;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.add-row {
    display: flex;
    gap: 8px;
}

input[type="text"],
input[type="number"] {
    background: #22345a;
    border: 1px solid #3a4a70;
    color: #e8ebf0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Segoe UI', Arial, sans-serif;
    outline: none;
    transition: border-color .15s;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder { color: #5a6a8a; }

input[type="text"]:focus,
input[type="number"]:focus { border-color: #2979ff; }

.add-row input { flex: 1; }

.btn-primary {
    background: #2979ff;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s ease;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.btn-primary:hover { background: #1565c0; }
.btn-primary:active { background: #0d47a1; }
.btn-primary.block { display: block; width: 100%; padding: 12px; }
.btn-primary.btn-compact {
    padding: 10px 14px;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    flex-shrink: 0;
}

.quick-row {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.chip {
    flex: 1 1 auto;
    min-width: 54px;
    background: #22345a;
    border: 1px solid #3a4a70;
    color: #e8ebf0;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: .5px;
    cursor: pointer;
    font-family: 'Segoe UI', Arial, sans-serif;
    transition: all .15s;
}

.chip:hover { background: #2f4264; border-color: #2979ff; color: #2979ff; }
.chip:active { background: #0d2140; }

/* Login */
.login-text {
    color: #8899b5;
    font-size: 0.9rem;
    margin: 0 0 14px;
}

.login-divider {
    text-align: center;
    color: #56668a;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 20px 0 12px;
    position: relative;
}

.login-divider::before,
.login-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: calc(50% - 40px);
    height: 1px;
    background: #22345a;
}

.login-divider::before { left: 0; }
.login-divider::after { right: 0; }

.user-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.picker-btn {
    background: #22345a;
    border: 1px solid #3a4a70;
    color: #e8ebf0;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.picker-btn:hover { background: #2f4264; border-color: #2979ff; color: #2979ff; }

/* Leaderboard (table-like) */
.board {
    list-style: none;
    padding: 0;
    margin: 0;
}

.board-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #253558;
    font-size: 0.9rem;
}

.board-row:last-child { border-bottom: none; }
.board-row:hover { background: #22345a; }

.board-row.is-top .board-pos { color: #ffab00; }
.board-row.is-top { background: rgba(255, 171, 0, .06); }
.board-row.is-second .board-pos { color: #bbb; }
.board-row.is-third .board-pos { color: #cd7f32; }

/* Hall of Fame header */
.hof-header { text-align: center; }
.hof-title {
    font-size: 1.6rem;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #e8ebf0;
    margin-top: 4px;
}
.hof-sub {
    margin-top: 8px;
    color: #8899b5;
    font-size: 0.8rem;
    letter-spacing: .5px;
}

.board-pos {
    font-weight: 600;
    color: #56668a;
    text-align: center;
    font-family: 'Consolas', 'SF Mono', monospace;
}

.board-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-weight: 500;
}

.board-rank {
    font-size: 0.7rem;
    font-weight: 400;
    color: #8899b5;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 3px;
}

.board-total {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #e8ebf0;
    font-family: 'Consolas', 'SF Mono', monospace;
}

.empty {
    color: #56668a;
    text-align: center;
    padding: 24px 0;
    font-size: 0.85rem;
}

/* Tiers + Ranks grid */
.tier { margin-bottom: 16px; }
.tier:last-child { margin-bottom: 0; }

.tier-head {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #8899b5;
    font-weight: 600;
    padding: 8px 0 8px;
    border-bottom: 1px solid #2a3a55;
    margin-bottom: 10px;
}

.ranks {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.ranks li {
    background: #0f1b2d;
    border: 1px solid #2a3a55;
    border-radius: 8px;
    padding: 9px 12px;
    display: flex;
    flex-direction: column;
    transition: all .2s ease;
}

.ranks li.is-achieved {
    border-color: rgba(41, 121, 255, .35);
    background: #12213a;
}

.ranks li.is-achieved .rank-threshold { color: #2979ff; }
.ranks li.is-achieved .rank-name { color: #e8ebf0; }

.ranks li.is-current {
    border-color: #2979ff;
    background: #0d2140;
    box-shadow: 0 0 10px rgba(41, 121, 255, .25);
}

.ranks li.is-current .rank-threshold { color: #2979ff; }
.ranks li.is-current .rank-name { color: #2979ff; font-weight: 600; }

.rank-threshold {
    font-size: 0.7rem;
    color: #56668a;
    font-weight: 700;
    letter-spacing: 1px;
    font-family: 'Consolas', 'SF Mono', monospace;
}

.rank-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #b0bacf;
    margin-top: 2px;
}

.back-link {
    display: inline-block;
    margin-top: 14px;
    color: #8899b5;
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: .5px;
}

.back-link:hover { color: #2979ff; }

/* Toast */
.toast-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 27, 45, .7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .25s;
    z-index: 999;
    pointer-events: none;
}

.toast-backdrop.show { opacity: 1; }

.toast {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(.92);
    background: #1a2a45;
    border: 1px solid rgba(255, 255, 255, .55);
    color: #e8ebf0;
    padding: 24px 32px;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 30px rgba(41, 121, 255, .25);
    opacity: 0;
    transition: opacity .25s, transform .25s cubic-bezier(.2, .8, .2, 1);
    z-index: 1000;
    text-align: center;
    min-width: 260px;
    max-width: calc(100vw - 48px);
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.toast-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #2979ff;
    font-weight: 600;
}

.toast-msg {
    font-size: 1.3rem;
    font-weight: 500;
    margin-top: 8px;
    letter-spacing: .5px;
    color: #fff;
}

/* Rank-Up Celebration Modal */
.rankup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 20, .82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity .3s ease;
    z-index: 1999;
}
.rankup-backdrop.show { opacity: 1; }

.rankup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(.85);
    background:
        radial-gradient(ellipse at center top, rgba(41, 121, 255, .35), transparent 65%),
        radial-gradient(ellipse at center bottom, rgba(138, 43, 226, .28), transparent 65%),
        #0a0f1e;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 20px;
    padding: 36px 32px 28px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, .7),
        0 0 80px rgba(41, 121, 255, .25);
    opacity: 0;
    transition: opacity .35s ease, transform .45s cubic-bezier(.2, 1.2, .25, 1);
    z-index: 2000;
    text-align: center;
    min-width: 300px;
    max-width: calc(100vw - 40px);
    overflow: hidden;
}
.rankup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.rankup::before {
    content: "";
    position: absolute;
    inset: -20%;
    background-image:
        radial-gradient(2px 2px at 10% 20%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 30% 70%, #ffd580, transparent),
        radial-gradient(2px 2px at 60% 40%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 85% 25%, #2979ff, transparent),
        radial-gradient(2px 2px at 75% 80%, #e0a0ff, transparent),
        radial-gradient(1px 1px at 45% 15%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 20% 55%, #80ccff, transparent);
    animation: rankup-spin 18s linear infinite;
    pointer-events: none;
    opacity: .9;
}
.rankup::after {
    content: "";
    position: absolute;
    top: -50%;
    left: 50%;
    width: 200%;
    height: 200%;
    margin-left: -100%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(255, 215, 0, .12) 30deg, transparent 60deg, transparent 210deg, rgba(41, 121, 255, .12) 240deg, transparent 270deg);
    animation: rankup-rays 10s linear infinite;
    pointer-events: none;
}
@keyframes rankup-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes rankup-rays {
    to { transform: rotate(360deg); }
}

.rankup > * { position: relative; z-index: 1; }

.rankup-intro {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #b0bacf;
    font-weight: 600;
}

.rankup-threshold {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #8899b5;
    letter-spacing: 1px;
    font-family: 'Consolas', 'SF Mono', monospace;
}

.rankup-rank {
    margin: 18px 0 10px;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .15);
    text-shadow: 0 0 20px rgba(41, 121, 255, .55);
    animation: rankup-pop .6s cubic-bezier(.2, 1.4, .25, 1) .15s backwards;
}
@keyframes rankup-pop {
    from { transform: scale(.6); opacity: 0; }
    to   { transform: scale(1);  opacity: 1; }
}

.rankup-sub {
    font-size: 0.85rem;
    color: #8899b5;
    letter-spacing: .5px;
    margin-bottom: 22px;
}

.rankup-close {
    background: #2979ff;
    color: #fff;
    border: none;
    padding: 12px 40px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    font-family: 'Segoe UI', Arial, sans-serif;
    box-shadow: 0 6px 20px rgba(41, 121, 255, .45);
    transition: transform .1s ease, background .2s ease;
}
.rankup-close:hover { background: #3d88ff; }
.rankup-close:active { transform: scale(.96); }

/* Gate / Login */
.gate-body {
    padding: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    background-color: #0f1b2d;
    background-image: var(--gate-bg);
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

.gate-body::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(15, 27, 45, .05) 0%,
        rgba(15, 27, 45, .25) 25%,
        rgba(15, 27, 45, .75) 55%,
        rgba(15, 27, 45, .95) 100%);
    pointer-events: none;
    z-index: 0;
}

.gate-wrap {
    padding-top: 28vh;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
}

@media (min-width: 640px) {
    .gate-body {
        align-items: center;
        background-size: contain;
        background-position: center center;
    }
    .gate-wrap { padding-top: 24px; padding-bottom: 24px; }
}

.gate-wrap { position: relative; z-index: 1; }

.gate-card {
    background: rgba(26, 42, 69, .92);
    border-color: rgba(255, 255, 255, .45);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}

.gate-brand {
    text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}

.gate-card .btn-primary {
    background: #2979ff;
    box-shadow: 0 8px 24px rgba(41, 121, 255, .35);
}

.gate-card .btn-primary:hover { background: #3d88ff; }
.gate-card .btn-primary:active { background: #1565c0; }

.gate-wrap {
    width: 100%;
    max-width: 420px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gate-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 1.1rem;
    color: #e8ebf0;
}

.gate-card { text-align: left; }

.gate-title {
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #e8ebf0;
    margin-bottom: 6px;
}

.gate-sub {
    color: #8899b5;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.gate-card input[type="password"] {
    width: 100%;
    background: #22345a;
    border: 1px solid rgba(255, 255, 255, .55);
    color: #e8ebf0;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Segoe UI', Arial, sans-serif;
    outline: none;
    letter-spacing: 3px;
}

.gate-card input[type="password"]:focus { border-color: #fff; }

/* Admin gate - no background image, solid dark */
.admin-gate-body {
    background-image: none !important;
    background-color: #0f1b2d !important;
}

.admin-gate-body .gate-wrap {
    padding-top: 20vh;
}

/* Admin dashboard */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.admin-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-row {
    background: #0f1b2d;
    border: 1px solid #2a3a55;
    border-radius: 10px;
    padding: 14px;
}

.admin-row-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e8ebf0;
}

.admin-meta {
    font-size: 0.75rem;
    color: #8899b5;
    margin-top: 3px;
    letter-spacing: .3px;
    font-family: 'Consolas', 'SF Mono', monospace;
}

.admin-edit {
    display: flex;
    gap: 8px;
}

.admin-edit input[type="number"] {
    flex: 1;
    background: #22345a;
    border: 1px solid #3a4a70;
    color: #e8ebf0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Consolas', 'SF Mono', monospace;
    outline: none;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.admin-edit input[type="number"]:focus { border-color: #2979ff; }

.admin-edit .btn-primary {
    background: #2979ff;
    padding: 10px 18px;
}

.admin-edit .btn-primary:hover { background: #3d88ff; }

.btn-danger {
    background: transparent;
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, .4);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 700;
    transition: all .15s;
}

.btn-danger:hover {
    background: rgba(244, 67, 54, .15);
    border-color: #f44336;
}

.admin-note {
    color: #8899b5;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

/* Matrix Pill Choice */
.matrix-card {
    background: radial-gradient(ellipse at center top, rgba(0, 0, 0, .6) 0%, #0a1322 70%);
    border-color: #1f2d4a;
    text-align: center;
    padding: 28px 20px;
}

.matrix-quote {
    font-style: italic;
    font-size: 0.85rem;
    color: #b0bacf;
    line-height: 1.5;
    letter-spacing: .3px;
    margin: 4px 0 20px;
}

.matrix-quote-sub {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.7rem;
    font-style: normal;
    letter-spacing: 2px;
    color: #56668a;
    text-transform: uppercase;
}

.pills {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 6px 0 16px;
}

.pill-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
}

.pill-or {
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: #56668a;
    font-weight: 600;
    padding: 0 2px;
    flex: 0 0 auto;
}

.pill {
    position: relative;
    width: 72px;
    height: 36px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.08) inset;
    transition: transform .15s ease, box-shadow .2s ease;
}

.pill-half {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    display: block;
}

.pill-half-top { left: 0; }
.pill-half-bottom { right: 0; }

/* Red pill */
.pill-red .pill-half-top {
    background: linear-gradient(135deg, #ff5b5b 0%, #c8202c 100%);
    box-shadow: 0 0 18px rgba(200, 32, 44, .6) inset;
}
.pill-red .pill-half-bottom {
    background: linear-gradient(135deg, #c8202c 0%, #6a0d15 100%);
}
.pill-red::after {
    content: "";
    position: absolute;
    top: 10%;
    left: 12%;
    width: 32%;
    height: 26%;
    background: rgba(255, 255, 255, .35);
    border-radius: 50%;
    filter: blur(3px);
}

/* Blue pill */
.pill-blue .pill-half-top {
    background: linear-gradient(135deg, #5aa5ff 0%, #2979ff 100%);
    box-shadow: 0 0 18px rgba(41, 121, 255, .6) inset;
}
.pill-blue .pill-half-bottom {
    background: linear-gradient(135deg, #2979ff 0%, #0d3a8a 100%);
}
.pill-blue::after {
    content: "";
    position: absolute;
    top: 10%;
    left: 12%;
    width: 32%;
    height: 26%;
    background: rgba(255, 255, 255, .35);
    border-radius: 50%;
    filter: blur(3px);
}

.pill-wrap-red .pill:hover { transform: translateY(-3px) rotate(-4deg); box-shadow: 0 14px 36px rgba(200, 32, 44, .45); }
.pill-wrap-blue .pill:hover { transform: translateY(-3px) rotate(4deg); box-shadow: 0 14px 36px rgba(41, 121, 255, .45); }
.pill:active { transform: scale(.96); }

.pill-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #e8ebf0;
}

.pill-wrap-red .pill-label { color: #ff7a7a; }
.pill-wrap-blue .pill-label { color: #5aa5ff; }

.pill-desc {
    font-size: 0.68rem;
    color: #b0bacf;
    line-height: 1.35;
    letter-spacing: .2px;
}

.matrix-warn {
    font-size: 0.65rem;
    color: #56668a;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
    line-height: 1.4;
}

.matrix-result {
    font-size: 1rem;
    color: #e8ebf0;
    margin: 0;
    line-height: 1.5;
}

.matrix-note {
    margin-top: 8px;
    color: #8899b5;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== Endgame-Tier Effekte ===== */

/* fx-shimmer: goldener Shine-Sweep (Mythos) */
.fx-shimmer {
    background: linear-gradient(90deg,
        rgba(255, 200, 80, .05) 0%,
        rgba(255, 200, 80, .25) 50%,
        rgba(255, 200, 80, .05) 100%);
    background-size: 200% 100%;
    animation: fx-shimmer-anim 3s linear infinite;
    border-color: rgba(255, 200, 80, .35) !important;
}
.fx-shimmer .rank-name,
.fx-shimmer .rank-threshold { color: #ffd580 !important; }
@keyframes fx-shimmer-anim {
    from { background-position: -100% 0; }
    to   { background-position: 100% 0; }
}

/* fx-power: Power-Glow (Übermensch) */
.fx-power {
    box-shadow: 0 0 18px rgba(255, 100, 50, .3);
    animation: fx-power-anim 2.2s ease-in-out infinite;
    border-color: rgba(255, 100, 50, .45) !important;
}
.fx-power .rank-name { color: #ffb88a !important; font-weight: 700; }
.fx-power .rank-threshold { color: #ff9955 !important; }
@keyframes fx-power-anim {
    0%, 100% { box-shadow: 0 0 18px rgba(255, 100, 50, .3);  transform: scale(1); }
    50%      { box-shadow: 0 0 28px rgba(255, 100, 50, .65); transform: scale(1.015); }
}

/* fx-rift: subtiler Reality-Glitch (Realität gebrochen) */
.fx-rift .rank-name {
    position: relative;
    color: #e8ebf0;
    animation: fx-rift-jitter 4s steps(10) infinite;
}
.fx-rift .rank-name::before {
    content: attr(data-name);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    color: rgba(41, 121, 255, .6);
    animation: fx-rift-split 4s steps(10) infinite;
    clip-path: inset(0 0 50% 0);
}
.fx-rift { border-color: rgba(41, 121, 255, .3) !important; }
@keyframes fx-rift-jitter {
    0%, 90%, 100% { transform: translate(0); }
    93%           { transform: translate(-1.5px, 0); }
    96%           { transform: translate(1.5px, 0); }
}
@keyframes fx-rift-split {
    0%, 90%, 100% { transform: translate(0); opacity: 0; }
    93%           { transform: translate(2px, -1px); opacity: .7; }
    96%           { transform: translate(-2px, 1px); opacity: .7; }
}

/* fx-chroma: Chromatic Color Shift (Unendlich) */
.fx-chroma .rank-name {
    background: linear-gradient(90deg, #ff5bcb 0%, #8b5cff 25%, #2979ff 50%, #00e0c2 75%, #ff5bcb 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    animation: fx-chroma-anim 4s linear infinite;
}
.fx-chroma { border-color: rgba(139, 92, 255, .4) !important; }
@keyframes fx-chroma-anim {
    from { background-position: 0% 0; }
    to   { background-position: 300% 0; }
}

/* fx-divine: göttliche Aura (Gottmodus) */
.fx-divine {
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 215, 0, .2) 0%, transparent 70%),
        rgba(15, 27, 45, .6) !important;
    border-color: rgba(255, 215, 0, .55) !important;
    box-shadow: 0 0 22px rgba(255, 215, 0, .35);
    animation: fx-divine-breathe 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}
.fx-divine::before {
    content: "";
    position: absolute;
    inset: 0;
    background: conic-gradient(from 0deg,
        transparent 0deg,
        rgba(255, 215, 0, .3) 60deg,
        transparent 120deg,
        transparent 240deg,
        rgba(255, 215, 0, .3) 300deg,
        transparent 360deg);
    animation: fx-divine-rays 8s linear infinite;
    pointer-events: none;
}
.fx-divine .rank-name {
    color: #ffd700 !important;
    text-shadow: 0 0 12px rgba(255, 215, 0, .7);
    position: relative;
    z-index: 1;
    font-weight: 700;
}
.fx-divine .rank-threshold {
    color: #ffd700 !important;
    position: relative;
    z-index: 1;
}
@keyframes fx-divine-breathe {
    0%, 100% { box-shadow: 0 0 22px rgba(255, 215, 0, .35); }
    50%      { box-shadow: 0 0 40px rgba(255, 215, 0, .7); }
}
@keyframes fx-divine-rays {
    to { transform: rotate(360deg); }
}

/* ===== Schwarz-Tier: kosmische / glitchy Effekte ===== */
.tier-schwarz {
    padding: 14px 12px;
    margin: 18px -8px -4px;
    border-radius: 14px;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(138, 43, 226, .18), transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(41, 121, 255, .15), transparent 55%),
        #050810;
    border: 1px solid #1a1f3a;
    position: relative;
    overflow: hidden;
}

.tier-schwarz::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, #fff, transparent),
        radial-gradient(1px 1px at 70% 60%, #fff, transparent),
        radial-gradient(1px 1px at 40% 80%, #ccd, transparent),
        radial-gradient(1px 1px at 90% 20%, #fff, transparent),
        radial-gradient(1px 1px at 15% 70%, #99f, transparent);
    background-size: 250px 250px;
    opacity: .5;
    pointer-events: none;
    animation: star-drift 40s linear infinite;
}

@keyframes star-drift {
    from { transform: translate(0, 0); }
    to   { transform: translate(-250px, -250px); }
}

.tier-schwarz .tier-head {
    color: #b3b8ff;
    letter-spacing: 4px;
    border-bottom-color: #2a2f5a;
    text-shadow: 0 0 12px rgba(138, 43, 226, .6);
    position: relative;
    z-index: 1;
}

.tier-schwarz .ranks li {
    background: rgba(5, 8, 16, .6);
    border-color: #2a2f5a;
    position: relative;
    z-index: 1;
}

.tier-schwarz .rank-threshold { color: #b3b8ff; }
.tier-schwarz .rank-name { color: #e8ebf0; }

/* fx-pulsar: sanftes Pulsieren */
.fx-pulsar {
    animation: fx-pulsar-anim 2.4s ease-in-out infinite;
    box-shadow: 0 0 18px rgba(138, 43, 226, .35);
}
@keyframes fx-pulsar-anim {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 18px rgba(138, 43, 226, .35); }
    50%      { transform: scale(1.03); box-shadow: 0 0 32px rgba(138, 43, 226, .65); }
}

/* fx-ghost: Phasen-Fade */
.fx-ghost .rank-name {
    animation: fx-ghost-anim 3.5s ease-in-out infinite;
}
@keyframes fx-ghost-anim {
    0%, 100% { opacity: 1;   filter: blur(0); }
    40%      { opacity: .2;  filter: blur(2px); }
    60%      { opacity: .2;  filter: blur(2px); }
}

/* fx-rotate: Ring-Rotation als Overlay */
.fx-rotate {
    overflow: hidden;
}
.fx-rotate::before {
    content: "";
    position: absolute;
    top: -60%;
    left: 50%;
    width: 200%;
    height: 220%;
    margin-left: -100%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(41, 121, 255, .25) 60deg, transparent 120deg);
    animation: fx-rotate-anim 6s linear infinite;
    pointer-events: none;
}
@keyframes fx-rotate-anim {
    to { transform: rotate(360deg); }
}
.fx-rotate .rank-threshold,
.fx-rotate .rank-name { position: relative; z-index: 1; }

/* fx-glitch: [REDACTED]-style Text-Stoerung */
.fx-glitch .rank-name {
    position: relative;
    color: #fff;
    font-family: 'Consolas', 'SF Mono', monospace;
    letter-spacing: 2px;
    animation: fx-glitch-jitter 1.8s steps(2) infinite;
}
.fx-glitch .rank-name::before,
.fx-glitch .rank-name::after {
    content: attr(data-name);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
}
.fx-glitch .rank-name::before {
    color: #ff2d5f;
    animation: fx-glitch-slice-1 2s steps(6) infinite;
    clip-path: inset(0 0 70% 0);
}
.fx-glitch .rank-name::after {
    color: #2dd4ff;
    animation: fx-glitch-slice-2 2s steps(6) infinite;
    clip-path: inset(70% 0 0 0);
}
@keyframes fx-glitch-jitter {
    0%, 100% { transform: translate(0); }
    20%      { transform: translate(-1px, 0.5px); }
    40%      { transform: translate(1px, -0.5px); }
    60%      { transform: translate(-0.5px, 1px); }
    80%      { transform: translate(0.5px, -1px); }
}
@keyframes fx-glitch-slice-1 {
    0%, 100% { transform: translate(0); }
    25%      { transform: translate(-2px, 0); }
    50%      { transform: translate(2px, 0); }
    75%      { transform: translate(-1px, 0); }
}
@keyframes fx-glitch-slice-2 {
    0%, 100% { transform: translate(0); }
    25%      { transform: translate(2px, 0); }
    50%      { transform: translate(-2px, 0); }
    75%      { transform: translate(1px, 0); }
}

/* fx-aura: Partikel + Glow (Singularity Core) */
.fx-aura {
    background:
        radial-gradient(circle at 50% 50%, rgba(138, 43, 226, .25) 0%, transparent 70%),
        rgba(5, 8, 16, .7) !important;
    border-color: rgba(138, 43, 226, .5) !important;
    animation: fx-aura-breathe 3s ease-in-out infinite;
    overflow: hidden;
}
.fx-aura::after {
    content: "";
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(2px 2px at 10% 20%, #fff 0%, transparent 50%),
        radial-gradient(2px 2px at 50% 70%, #e0a0ff 0%, transparent 50%),
        radial-gradient(1px 1px at 80% 30%, #80ccff 0%, transparent 50%),
        radial-gradient(1.5px 1.5px at 30% 60%, #fff 0%, transparent 50%),
        radial-gradient(1px 1px at 90% 80%, #ffccff 0%, transparent 50%),
        radial-gradient(2px 2px at 70% 10%, #80ccff 0%, transparent 50%);
    animation: fx-aura-particles 8s linear infinite;
    pointer-events: none;
    opacity: .8;
}
.fx-aura .rank-threshold,
.fx-aura .rank-name {
    position: relative;
    z-index: 1;
    text-shadow: 0 0 10px rgba(224, 160, 255, .8);
}
.fx-aura .rank-name {
    background: linear-gradient(90deg, #fff 0%, #e0a0ff 50%, #80ccff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}
@keyframes fx-aura-breathe {
    0%, 100% { box-shadow: 0 0 20px rgba(138, 43, 226, .4); }
    50%      { box-shadow: 0 0 40px rgba(138, 43, 226, .8), 0 0 60px rgba(41, 121, 255, .4); }
}
@keyframes fx-aura-particles {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Inline-Varianten der Effekte im Leaderboard */
.board-row-fx .board-rank {
    display: inline-block;
    position: relative;
    padding: 3px 10px;
    margin-top: 4px;
    border-radius: 6px;
    color: #e8ebf0;
    font-weight: 600;
    letter-spacing: 1px;
    line-height: 1.4;
    vertical-align: baseline;
    max-width: 100%;
}

.board-row-fx .board-rank .rank-name {
    display: inline-block;
    position: relative;
    white-space: nowrap;
}

.board-rank.fx-pulsar {
    background: rgba(138, 43, 226, .15);
    color: #b3b8ff;
}

.board-rank.fx-ghost {
    color: #b3b8ff;
}

.board-rank.fx-rotate {
    background: rgba(41, 121, 255, .12);
    overflow: hidden;
    color: #b3b8ff;
}
.board-rank.fx-rotate::before {
    top: -50%;
    height: 200%;
}

.board-rank.fx-glitch {
    font-family: 'Consolas', 'SF Mono', monospace;
    color: #fff;
    background: rgba(5, 8, 16, .6);
}

.board-rank.fx-aura {
    background: rgba(5, 8, 16, .6);
    border: 1px solid rgba(138, 43, 226, .4);
}
.board-rank.fx-aura::after {
    inset: -10%;
}

/* Endgame inline */
.board-rank.fx-shimmer {
    background: rgba(255, 200, 80, .1);
    border: 1px solid rgba(255, 200, 80, .35);
}
.board-rank.fx-power {
    background: rgba(255, 100, 50, .1);
    border: 1px solid rgba(255, 100, 50, .4);
}
.board-rank.fx-rift {
    background: rgba(41, 121, 255, .08);
    border: 1px solid rgba(41, 121, 255, .3);
}
.board-rank.fx-chroma {
    background: rgba(139, 92, 255, .1);
    border: 1px solid rgba(139, 92, 255, .35);
}
.board-rank.fx-divine {
    background: rgba(255, 215, 0, .08);
    border: 1px solid rgba(255, 215, 0, .5);
}

.admin-notice {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    letter-spacing: .3px;
    border: 1px solid;
}

.admin-notice-success {
    background: rgba(41, 121, 255, .12);
    border-color: rgba(41, 121, 255, .5);
    color: #e8ebf0;
}

.admin-notice-error {
    background: rgba(244, 67, 54, .12);
    border-color: rgba(244, 67, 54, .5);
    color: #ff8a7a;
}

.admin-dbops {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-import {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid #2a3a55;
}

.admin-import input[type="file"] {
    background: #22345a;
    border: 1px solid #3a4a70;
    color: #e8ebf0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.admin-import input[type="file"]::file-selector-button {
    background: #2f4264;
    border: 1px solid #3a4a70;
    color: #e8ebf0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-right: 10px;
    cursor: pointer;
}
.gate-card input[type="password"]::placeholder { color: #5a6a8a; letter-spacing: 6px; }

.gate-error {
    margin-top: 10px;
    padding: 10px 12px;
    background: #12213a;
    border: 1px solid #2979ff;
    border-radius: 8px;
    color: #2979ff;
    font-size: 0.85rem;
    letter-spacing: .5px;
}

.gate-footer {
    text-align: center;
    color: #56668a;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}
