:root {
    --bg-color: #0a0a0c;
    --text-main: #c9d1d9;
    --accent-primary: #00ff41; /* Classic Terminal Green */
    --accent-secondary: #008f11;
    --terminal-header: #161b22;
    --border-color: #30363d;
}

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

body {
    font-family: 'Fira Code', monospace;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

::selection {
    background: var(--accent-primary);
    color: var(--bg-color);
}

/* --- Navigation --- */
nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background-color: rgba(10, 10, 12, 0.9);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
}

.logo span {
    color: var(--accent-primary);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    justify-content: flex-end;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-primary);
}

/* --- Hero Section --- */
.hero {
    height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0 10%;
    position: relative;
}

.ascii-art {
    color: var(--accent-secondary);
    font-size: clamp(0.6rem, 1.2vw, 1.8rem);
    white-space: pre;
    margin-bottom: 2rem;
    opacity: 0.7;
    max-width: 100%;
    overflow-x: auto;
}
.ascii-art::-webkit-scrollbar {
    display: none;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 1rem;
}

.typewriter {
    color: var(--accent-primary);
    display: inline-block;
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1em;
    background-color: var(--accent-primary);
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero p {
    max-width: 600px;
    font-size: 1.1rem;
    color: #8b949e;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    background-color: var(--accent-primary);
    color: var(--bg-color);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
}

/* --- Window Container (Content Boxes) --- */
.container {
    padding: 5rem 10%;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.section-title::before {
    content: "~/ ";
    color: var(--accent-primary);
}

/* --- Stats Grid (Team) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.stat-card {
    background-color: var(--terminal-header);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 5px;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.member-name {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    word-break: break-all;
    line-height: 1.2;
}

.stat-label {
    color: #8b949e;
    font-size: 0.9rem;
}

.member-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.member-icon {
    width: 32px;
    height: 32px;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.member-links a:hover .member-icon {
    transform: translateY(-3px);
    filter: drop-shadow(0 0 8px var(--accent-primary));
}

/* --- Room Filters --- */
.room-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.filter-btn {
    font-family: 'Fira Code', monospace;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.15);
}

.filter-btn.active {
    background: var(--accent-primary);
    color: var(--bg-color);
    border-color: var(--accent-primary);
    font-weight: 600;
    box-shadow: 0 0 12px rgba(0, 255, 65, 0.3);
}

.filter-count {
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.filter-btn.active .filter-count {
    background: rgba(0, 0, 0, 0.25);
}

/* --- Terminal Layout (Rooms) --- */
.terminal-box {
    background-color: var(--terminal-header);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 1.5rem;
}

.terminal-top {
    background-color: var(--border-color);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
}

.terminal-title {
    margin-left: auto;
    font-size: 0.75rem;
    color: #8b949e;
    letter-spacing: 0.5px;
}

.dot {
    height: 12px;
    width: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.dot-red { background-color: #ff5f56; }
.dot-yellow { background-color: #ffbd2e; }
.dot-green { background-color: #27c93f; }

.terminal-body {
    padding: 0;
}

/* Refresh button */
.refresh-btn {
    background: transparent;
    border: 1px solid #484f58;
    color: #8b949e;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.75rem;
    transition: all 0.2s ease;
    line-height: 1;
}

.refresh-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.refresh-btn.spinning {
    animation: spin 0.8s linear infinite;
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    pointer-events: none;
}

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

.refresh-status {
    font-size: 0.75rem;
    padding: 0.5rem 1.5rem;
    color: var(--accent-primary);
    font-family: 'Fira Code', monospace;
    border-bottom: 1px solid var(--border-color);
}

/* --- Room Table --- */
.room-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.room-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.room-table th {
    background: var(--border-color);
    color: var(--accent-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 2px solid var(--accent-secondary);
    user-select: none;
    vertical-align: middle;
}

.room-table th.sortable {
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.room-table th.sortable:hover {
    background: #3a4149;
    color: #fff;
}

.sort-arrow {
    font-size: 0.65rem;
    margin-left: 0.3rem;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

.room-table th.sortable.active-sort .sort-arrow {
    opacity: 1;
    color: #fff;
}

.room-table td {
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    vertical-align: middle;
}

.room-table tbody tr {
    transition: background 0.2s ease;
}

.room-table tbody tr:hover {
    background: rgba(0, 255, 65, 0.04);
}

.room-table tbody tr.hidden-row {
    display: none;
}

/* Difficulty column alignment — center both header and data */
.room-table th:nth-child(2),
.room-table td:nth-child(2) {
    text-align: center;
}

/* Room name styling */
.room-name-cell {
    font-weight: 600;
    color: var(--text-main);
}

.room-name-cell::before {
    content: "\25B8 ";
    color: var(--accent-secondary);
}

/* Difficulty badges */
.diff-badge {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.diff-easy {
    background: rgba(39, 201, 63, 0.15);
    color: #27c93f;
    border: 1px solid rgba(39, 201, 63, 0.3);
}

.diff-medium {
    background: rgba(255, 189, 46, 0.15);
    color: #ffbd2e;
    border: 1px solid rgba(255, 189, 46, 0.3);
}

.diff-hard {
    background: rgba(255, 95, 86, 0.15);
    color: #ff5f56;
    border: 1px solid rgba(255, 95, 86, 0.3);
}

.diff-info {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
    border: 1px solid rgba(88, 166, 255, 0.3);
}

/* Completed by badges */
.completed-by {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.member-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background: rgba(0, 255, 65, 0.08);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--accent-primary);
    white-space: nowrap;
}

/* Room count bar */
.room-count {
    padding: 1rem 1.5rem;
    font-size: 0.8rem;
    color: #8b949e;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.room-count span {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.page-btn {
    font-family: 'Fira Code', monospace;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    min-width: 2.2rem;
    text-align: center;
}

.page-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.page-btn.active {
    background: var(--accent-primary);
    color: var(--bg-color);
    border-color: var(--accent-primary);
    font-weight: 600;
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.page-info {
    color: #8b949e;
    font-size: 0.75rem;
    margin-left: 1rem;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    color: #8b949e;
    margin-top: 4rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .hero { padding: 0 5%; }
    .hero h1 { word-break: break-all; font-size: clamp(1.5rem, 6vw, 2.5rem); }
    .container { padding: 3rem 5%; }

    .ascii-art {
        font-size: 0.45rem;
    }

    .room-table th,
    .room-table td {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }

    .filter-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
}
