@import url('https://fonts.googleapis.com/css2?family=Oxanium:wght@500;700&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
    --bg: #050607;
    --bg-soft: #0d1114;
    --surface: rgba(20, 27, 31, 0.94);
    --surface-alt: rgba(15, 19, 23, 0.9);
    --surface-deep: rgba(11, 16, 20, 0.88);
    --line: #2a383f;
    --line-strong: #35505a;
    --text: #f5f8fa;
    --text-muted: #b5c2c9;
    --teal: #1ec6b5;
    --teal-soft: #8be3db;
    --teal-strong: #109d90;
    --success: #2bd38f;
    --warning: #f2be57;
    --danger: #ff6f6f;
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
    --radius: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at 10% 0%, rgba(16, 49, 57, 0.55) 0%, transparent 25%),
        radial-gradient(circle at 92% 8%, rgba(16, 49, 57, 0.45) 0%, transparent 22%),
        linear-gradient(180deg, #050607, #080b0d 42%, #050607);
    color: var(--text);
    font-family: "Source Sans 3", "Trebuchet MS", sans-serif;
    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-family: "Oxanium", "Franklin Gothic Medium", sans-serif;
    letter-spacing: 0.02em;
}

p {
    margin: 0;
}

code {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    color: var(--teal-soft);
    padding: 0.08rem 0.32rem;
}

#matrix-canvas {
    height: 100%;
    left: 0;
    opacity: 0.06;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 0;
}

.status-banner {
    background: rgba(16, 157, 144, 0.18);
    border-bottom: 1px solid rgba(139, 227, 219, 0.2);
    color: var(--teal-soft);
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
    position: sticky;
    text-align: center;
    top: 0;
    z-index: 1200;
}

.status-banner.warning {
    background: rgba(242, 190, 87, 0.18);
    border-bottom-color: rgba(242, 190, 87, 0.25);
    color: #ffd98e;
}

.status-banner.error {
    background: rgba(255, 111, 111, 0.16);
    border-bottom-color: rgba(255, 111, 111, 0.24);
    color: #ffb3b3;
}

.status-banner.hidden {
    display: none;
}

.login-container {
    align-items: center;
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 1rem;
    position: fixed;
    z-index: 1100;
}

.login-box {
    animation: slideDown 0.5s ease;
    background: linear-gradient(160deg, rgba(20, 27, 31, 0.97), rgba(13, 17, 20, 0.9));
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    max-width: 560px;
    padding: 2.75rem;
    width: min(94vw, 560px);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-80px);
    }

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

.login-header h1 {
    color: var(--teal);
    font-size: clamp(1.85rem, 4vw, 2.35rem);
    text-align: center;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 1.02rem;
    margin: 0.75rem auto 2rem;
    max-width: 34ch;
    text-align: center;
}

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

.form-group label {
    color: var(--teal-soft);
    display: block;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.55rem;
}

.username-field {
    background: rgba(10, 15, 18, 0.85);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-size: 1.05rem;
    padding: 0.9rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.username-field:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(139, 227, 219, 0.18);
    outline: none;
}

.input-hint {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.45rem;
}

.login-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.4rem;
}

.login-btn,
.secondary-btn,
.hint-btn,
.submit-btn,
.text-btn {
    border: none;
    border-radius: 10px;
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-btn,
.submit-btn {
    background: var(--teal);
    color: #032024;
    padding: 0.9rem 1rem;
}

.login-btn:hover,
.submit-btn:hover {
    background: var(--teal-strong);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    transform: translateY(-1px);
}

.secondary-btn,
.text-btn {
    background: rgba(13, 17, 20, 0.9);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 0.9rem 1rem;
}

.secondary-btn:hover,
.text-btn:hover {
    border-color: var(--teal);
    color: var(--teal-soft);
}

.text-btn {
    padding: 0.65rem 0.9rem;
}

.hint-btn {
    background: rgba(242, 190, 87, 0.18);
    border: 1px solid rgba(242, 190, 87, 0.28);
    color: #ffd98e;
    padding: 0.7rem 1rem;
}

.hint-btn:hover {
    background: rgba(242, 190, 87, 0.24);
}

.login-btn:disabled,
.secondary-btn:disabled,
.hint-btn:disabled,
.submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.error-message {
    color: var(--danger);
    margin-top: 0.9rem;
    min-height: 1.2rem;
    text-align: center;
}

.container {
    margin: 0 auto;
    max-width: 1440px;
    padding: 1.3rem;
    position: relative;
    z-index: 1;
}

.container[hidden] {
    display: none;
}

.page-header {
    animation: headerGlow 2.4s ease-in-out infinite alternate;
    background: linear-gradient(160deg, rgba(20, 27, 31, 0.95), rgba(13, 17, 20, 0.88));
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
}

@keyframes headerGlow {
    from {
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
    }

    to {
        box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
    }
}

.page-header h1 {
    color: #ffffff;
    font-size: clamp(2rem, 3vw, 2.65rem);
    text-align: center;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-top: 0.55rem;
    text-align: center;
}

.header-grid {
    align-items: center;
    display: grid;
    gap: 1rem;
    grid-template-columns: 1.2fr 0.8fr;
    margin-top: 1.25rem;
}

.identity-stack,
.session-stack {
    background: rgba(11, 16, 20, 0.72);
    border: 1px solid rgba(53, 80, 90, 0.5);
    border-radius: 16px;
    padding: 1rem 1.1rem;
}

.identity-stack h2,
.session-stack h2 {
    color: var(--teal-soft);
    font-size: 0.98rem;
    margin-bottom: 0.7rem;
}

.meta-lines {
    display: grid;
    gap: 0.45rem;
}

.meta-line {
    align-items: center;
    color: var(--text-muted);
    display: flex;
    font-size: 0.96rem;
    gap: 0.45rem;
}

.meta-line strong {
    color: var(--text);
}

.header-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.connection-pill {
    background: rgba(13, 17, 20, 0.9);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--teal-soft);
    display: inline-flex;
    font-size: 0.92rem;
    font-weight: 700;
    gap: 0.45rem;
    padding: 0.55rem 0.9rem;
}

.connection-pill.offline {
    color: #ffd98e;
}

.connection-pill.error {
    color: #ffb3b3;
}

.stats-bar {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    color: var(--teal);
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 700;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-top: 0.3rem;
}

.evidence-panel {
    background: rgba(15, 19, 23, 0.92);
    border: 1px solid var(--line);
    border-radius: 18px;
    margin-bottom: 1.5rem;
    padding: 1.2rem;
}

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

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

.section-header p {
    color: var(--text-muted);
    max-width: 64ch;
}

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

.evidence-card {
    background: rgba(11, 16, 20, 0.84);
    border: 1px solid rgba(53, 80, 90, 0.5);
    border-radius: 14px;
    padding: 1rem;
}

.evidence-card h4 {
    color: var(--teal-soft);
    font-size: 1rem;
    margin-bottom: 0.55rem;
}

.evidence-card p,
.evidence-card li {
    color: var(--text-muted);
    line-height: 1.5;
}

.evidence-card ul {
    margin: 0.45rem 0 0;
    padding-left: 1rem;
}

.evidence-card pre {
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: #c7f0e8;
    margin: 0.65rem 0 0;
    overflow-x: auto;
    padding: 0.75rem;
    white-space: pre-wrap;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1.25rem;
}

.tab-btn {
    background: rgba(13, 17, 20, 0.9);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    padding: 0.8rem 1.1rem;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.tab-btn:hover,
.tab-btn.active {
    background: rgba(30, 198, 181, 0.12);
    border-color: var(--teal);
    color: var(--teal-soft);
}

.progress-section {
    margin-bottom: 1.4rem;
}

.progress-row {
    align-items: center;
    display: flex;
    gap: 0.9rem;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.progress-label {
    color: var(--text);
    font-size: 1rem;
}

.progress-meta {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.progress-bar {
    background: #0d1114;
    border: 1px solid #203039;
    border-radius: 999px;
    height: 28px;
    overflow: hidden;
}

.progress-fill {
    align-items: center;
    background: linear-gradient(90deg, #109d90, #1ec6b5, #77f3e7);
    color: #ffffff;
    display: flex;
    font-size: 0.92rem;
    font-weight: 700;
    height: 100%;
    justify-content: center;
    min-width: 3.5rem;
    transition: width 0.35s ease;
}

.page-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.95fr);
}

.challenge-column,
.side-panel {
    min-width: 0;
}

.challenges-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.challenge-card {
    background: linear-gradient(180deg, rgba(20, 27, 31, 0.95), rgba(14, 18, 22, 0.95));
    border: 1px solid var(--line);
    border-radius: 16px;
    cursor: pointer;
    overflow: hidden;
    padding: 1.15rem;
    position: relative;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.challenge-card::before {
    background: linear-gradient(90deg, transparent, rgba(30, 198, 181, 0.2), transparent);
    content: '';
    height: 100%;
    left: -100%;
    position: absolute;
    top: 0;
    transition: left 0.45s ease;
    width: 100%;
}

.challenge-card:hover::before {
    left: 100%;
}

.challenge-card:hover {
    border-color: var(--teal);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
    transform: translateY(-3px);
}

.challenge-card.completed {
    border-color: rgba(43, 211, 143, 0.48);
}

.challenge-card.in-progress {
    border-color: rgba(242, 190, 87, 0.48);
}

.challenge-header {
    align-items: flex-start;
    display: flex;
    gap: 0.8rem;
    justify-content: space-between;
}

.challenge-title {
    color: var(--text);
    font-size: 1.1rem;
}

.difficulty-badge,
.status-badge,
.mini-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.73rem;
    font-weight: 700;
    gap: 0.35rem;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.7rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.difficulty-easy {
    background: rgba(43, 211, 143, 0.12);
    color: #8af2bf;
}

.difficulty-medium {
    background: rgba(242, 190, 87, 0.12);
    color: #ffd98e;
}

.difficulty-hard {
    background: rgba(255, 111, 111, 0.12);
    color: #ffb3b3;
}

.status-badge.available {
    background: rgba(30, 198, 181, 0.12);
    color: var(--teal-soft);
}

.status-badge.completed {
    background: rgba(43, 211, 143, 0.12);
    color: #8af2bf;
}

.status-badge.in-progress {
    background: rgba(242, 190, 87, 0.12);
    color: #ffd98e;
}

.challenge-description {
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0.85rem 0 1rem;
    min-height: 4.3rem;
}

.challenge-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    justify-content: space-between;
}

.points {
    color: var(--teal-soft);
    font-size: 0.95rem;
    font-weight: 700;
}

.category-tag {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.78rem;
    padding: 0.28rem 0.65rem;
    text-transform: uppercase;
}

.leaderboard {
    background: rgba(15, 19, 23, 0.92);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 1.15rem;
    position: sticky;
    top: 1rem;
}

.leaderboard h3 {
    color: var(--teal);
    font-size: 1.25rem;
    margin-bottom: 0.3rem;
}

.leaderboard-copy {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.45;
    margin-bottom: 1rem;
}

.leaderboard-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.leaderboard-item {
    align-items: center;
    background: rgba(11, 16, 20, 0.72);
    border: 1px solid #25343c;
    border-radius: 12px;
    display: flex;
    gap: 0.8rem;
    justify-content: space-between;
    margin-bottom: 0.7rem;
    padding: 0.8rem;
}

.leaderboard-item.current-user {
    background: rgba(30, 198, 181, 0.16);
}

.rank {
    color: var(--teal);
    font-size: 1.18rem;
    font-weight: 700;
    min-width: 2.4rem;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.username {
    color: var(--text);
    font-size: 0.98rem;
    font-weight: 700;
}

.subline {
    color: var(--text-muted);
    font-size: 0.84rem;
    margin-top: 0.15rem;
}

.user-score {
    color: var(--teal);
    font-size: 1.05rem;
    font-weight: 700;
    text-align: right;
}

.empty-state {
    background: rgba(11, 16, 20, 0.72);
    border: 1px dashed rgba(53, 80, 90, 0.65);
    border-radius: 14px;
    color: var(--text-muted);
    padding: 1.3rem;
    text-align: center;
}

.modal {
    background: rgba(0, 0, 0, 0.72);
    display: none;
    inset: 0;
    padding: 1.5rem;
    position: fixed;
    z-index: 1300;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(180deg, rgba(15, 19, 23, 0.98), rgba(11, 16, 20, 0.97));
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    margin: auto;
    max-height: 92vh;
    max-width: 960px;
    overflow: auto;
    width: min(94vw, 960px);
}

.modal-header {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(15, 19, 23, 0.98), rgba(11, 16, 20, 0.98));
}

.modal-header h2 {
    color: var(--teal);
    font-size: 1.35rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
}

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

.modal-body {
    padding: 1.2rem;
}

.terminal {
    background: rgba(7, 11, 13, 0.9);
    border: 1px solid rgba(53, 80, 90, 0.5);
    border-radius: 14px;
    margin-bottom: 1.2rem;
    overflow: hidden;
}

.terminal-bar {
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    gap: 0.45rem;
    padding: 0.75rem 0.85rem;
}

.terminal-dot {
    border-radius: 50%;
    height: 0.7rem;
    width: 0.7rem;
}

.terminal-dot.red {
    background: #ff5f57;
}

.terminal-dot.yellow {
    background: #ffbd2f;
}

.terminal-dot.green {
    background: #28ca42;
}

.terminal-shell {
    color: #c7f0e8;
    font-family: "Courier New", monospace;
    font-size: 0.95rem;
    line-height: 1.55;
    padding: 1rem;
}

.scenario-box,
.hint-section,
.answer-section {
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(53, 80, 90, 0.45);
    border-radius: 14px;
    margin-bottom: 1rem;
    padding: 1rem;
}

.scenario-box h4,
.answer-label,
.hint-title {
    color: var(--teal-soft);
    font-size: 1rem;
    margin-bottom: 0.55rem;
}

.scenario-body {
    color: var(--text-muted);
    line-height: 1.55;
}

.answer-input {
    background: rgba(10, 15, 18, 0.85);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    padding: 0.8rem 0.9rem;
    width: 100%;
}

.answer-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(139, 227, 219, 0.18);
    outline: none;
}

.answer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 0.8rem;
}

.hint-content {
    color: var(--text-muted);
    display: none;
    line-height: 1.55;
    margin-top: 0.75rem;
    padding-left: 1rem;
}

.hint-content.visible {
    display: block;
}

.hint-content li + li {
    margin-top: 0.4rem;
}

.feedback {
    border-radius: 12px;
    font-weight: 700;
    margin-top: 1rem;
    padding: 0.9rem 1rem;
}

.feedback.success {
    background: rgba(43, 211, 143, 0.14);
    border: 1px solid rgba(43, 211, 143, 0.28);
    color: #8af2bf;
}

.feedback.error {
    background: rgba(255, 111, 111, 0.14);
    border: 1px solid rgba(255, 111, 111, 0.28);
    color: #ffb3b3;
}

.feedback.info {
    background: rgba(242, 190, 87, 0.14);
    border: 1px solid rgba(242, 190, 87, 0.28);
    color: #ffd98e;
}

.loading {
    animation: spin 1s linear infinite;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--teal);
    display: inline-block;
    height: 18px;
    width: 18px;
}

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

@media (max-width: 1024px) {
    .page-grid,
    .header-grid {
        grid-template-columns: 1fr;
    }

    .leaderboard {
        position: static;
    }
}

@media (max-width: 720px) {
    .container {
        padding: 0.9rem;
    }

    .login-box {
        padding: 1.7rem;
    }

    .page-header {
        padding: 1.1rem;
    }

    .stats-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .challenge-card {
        padding: 1rem;
    }

    .modal {
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stats-bar {
        grid-template-columns: 1fr;
    }

    .login-actions,
    .answer-actions,
    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .challenge-meta,
    .challenge-header,
    .progress-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
