@import url("https://cdn.jsdelivr.net/gh/sunn-us/SUIT/fonts/static/woff2/SUIT.css");
@import url("https://cdn.jsdelivr.net/gh/sunn-us/SUITE/fonts/static/woff2/SUITE.css");

:root {
    /* Brand Colors */
    --primary: #C2F707;
    --primary-hover: #aadd05;
    --background: #121212;
    --surface: #1E1E1E;
    --surface-hover: #2C2C2C;
    --text-main: #FFFFFF;
    --text-muted: #A0A0A0;
    --border: #333333;

    /* Functional */
    --success: #00C851;
    --error: #FF4444;
    --warning: #FFBB33;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'SUIT', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
}

* {
    box-sizing: border-box;
    box-sizing: border-box;
}

button,
input,
select,
textarea {
    font-family: 'SUIT', sans-serif;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 var(--spacing-md) 0;
    font-weight: 700;
    font-family: 'SUITE', sans-serif;
}

p {
    margin: 0 0 var(--spacing-md) 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* Components */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    /* Explicit 16px for consistency */
    padding-bottom: 100px;
    /* Space for Bottom Nav */
    min-height: 100vh;
}

.card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 16px;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    color: #000000;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--surface-hover);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #3d3d3d;
}

.input-field {
    width: 100%;
    padding: 14px;
    background-color: #000000;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 16px;
    margin-bottom: var(--spacing-sm);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
}

.hidden {
    display: none;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mt-4 {
    margin-top: var(--spacing-xl);
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 14px;
}

/* Dashboard Specifics */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.stat-item {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* Ranking Page Specifics */
.sp-container {
    padding-bottom: 80px;
    margin: 0 auto;
    max-width: 600px;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

.sp-section-header {
    text-align: center;
    margin-bottom: 30px;
}

.sp-label {
    display: inline-block;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sp-h1 {
    font-size: 32px;
    margin: 0;
    color: white;
}

.sp-gradient-text {
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* -- FIXED DARK RANKING CARD -- */
.ranking-card-dark {
    background-color: #121212;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 20px;
    color: #FFFFFF;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Fallback if html still requests white, force dark */
.ranking-card-white {
    background-color: #121212;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 20px;
    color: #FFFFFF;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Grid Layout for Ranking Table */
.ranking-header,
.ranking-item {
    display: grid;
    grid-template-columns: 40px 140px 220px 1fr 60px;
    /* Rank | Info | Scores | Graph | Total */
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #333;
}

.ranking-header {
    font-size: 13px;
    font-weight: 700;
    color: #888;
    border-bottom: 2px solid #444;
}

.ranking-header>div:nth-child(2) {
    text-align: left;
}

.ranking-header>div:last-child {
    text-align: right;
}

.ranking-item {
    font-size: 14px;
}

.ranking-item:last-child {
    border-bottom: none;
}

.score-header-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    text-align: center;
    font-size: 12px;
}

.score-nums {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    text-align: center;
    font-family: 'Roboto Mono', monospace;
    color: #ccc;
    font-size: 13px;
    background: transparent;
    padding: 0;
}

.score-nums span,
.score-header-group span {
    display: block;
}

/* Specific Cell Adjustments */
.rank-circle {
    width: 28px;
    height: 28px;
    background: #333;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    margin: 0 auto;
}

.ranking-item:nth-child(1) .rank-circle {
    background: #C2F707;
    color: #000;
    box-shadow: 0 0 10px rgba(194, 247, 7, 0.4);
}

.ranking-item:nth-child(2) .rank-circle {
    background: #fff;
    color: #000;
}

.ranking-item:nth-child(3) .rank-circle {
    background: #fff;
    color: #000;
}

.info-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.name-text {
    font-size: 15px;
    color: #fff;
    white-space: nowrap;
}

.name-text strong {
    font-weight: 700;
}

.name-text span {
    font-size: 11px;
    color: #666;
    font-weight: 400;
    margin-left: 2px;
}

.id-text-gradient {
    font-size: 12px;
    background: linear-gradient(90deg, #666, #999);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
}

.gender-chip-small {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
}

.gender-chip-small.m {
    background: rgba(100, 181, 246, 0.15);
    color: #64B5F6;
}

.gender-chip-small.f {
    background: rgba(255, 138, 128, 0.15);
    color: #FF8A80;
}

.graph-area {
    padding-right: 10px;
}

.score-bar-bg {
    background: #333;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    width: 100%;
}

.score-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #C2F707, #93D900);
    border-radius: 3px;
    transition: width 1s ease-out;
}

.total-score span:first-child {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}

.btn-capture {
    width: 100%;
    background: #000;
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-weight: 700;
    margin-top: 20px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-capture:hover {
    transform: scale(1.02);
}

/* Bottom Navigation */
/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    /* Removed max-width and transform to allow full width background */
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    /* Center the items */
    padding: 10px 0;
    z-index: 9999;
}

.bottom-nav-inner {
    display: flex !important;
    flex-direction: row !important;
    /* FORCE ROW */
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    /* Center it */
    padding: 10px 0;
}


.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    flex: 1;
    /* Distribute space evenly */
    max-width: 150px;
    /* 600px / 4 items */
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

/* Shared Header Component */
.shared-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 10px;
}

.shared-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.shared-header-back {
    color: var(--text-main);
    text-decoration: none;
    font-size: 20px;
    padding: 4px 8px;
    /* Touch target */
    margin-left: -8px;
    /* Optical alignment */
}

.shared-header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.shared-day-badge {
    background: rgba(194, 247, 7, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

/* Cohort Selection Card */
.cohort-card {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
    height: 120px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cohort-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cohort-image-container {
    width: 90px;
    flex-shrink: 0;
    position: relative;
    background: #333;
}

.cohort-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cohort-details {
    flex: 1;
    padding: 10px 14px;
    /* Reduced padding */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
    gap: 4px;
    /* Reduced gap between rows */
}

.cohort-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Center align items */
    margin-bottom: 2px;
    /* Tighten */
}

.cohort-title {
    font-size: 15px;
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1.2;
}

.cohort-title span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 13px;
    margin-left: 4px;
}

.neon-chip {
    background: rgba(194, 247, 7, 0.15);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 1px 6px;
    /* Smaller padding */
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    margin-left: 8px;
    box-shadow: 0 0 5px rgba(194, 247, 7, 0.2);
}

.cohort-info-row {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    /* Tighten */
}

.cohort-stats {
    display: flex;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #ddd;
    margin-top: 2px;
    /* Tighten */
}

.stat-highlight {
    color: var(--primary);
    font-weight: 700;
}

/* --- Global Depth 2 Design System --- */

/* 1. Full Page Overlay (e.g. History, Detailed Review) */
.page-overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background);
    /* #121212 */
    z-index: 2000;
    overflow-y: auto;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.depth2-header {
    position: sticky;
    top: 0;
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2001;
}

.depth2-back-btn {
    font-size: 24px;
    color: var(--text-main);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.depth2-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    flex: 1;
}

.depth2-content {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* 2. Centered Modal (e.g. Settings, Info) */
.modal-centered-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Darker dim */
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-centered-card {
    background: var(--surface);
    /* #1E1E1E */
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    /* Consistent limits */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-centered-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-centered-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.modal-centered-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* --- Global Unified Button System --- */
.vertical-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 0;
    /* Use gap instead */
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-main);
}

.action-btn:hover {
    transform: translateY(-2px);
    border-color: #C2F707 !important;
    /* Lime on Hover */
    box-shadow: 0 4px 12px rgba(194, 247, 7, 0.1);
}

.action-btn:active,
.action-btn.active {
    border-color: #C2F707 !important;
    /* Lime */
    background-color: rgba(194, 247, 7, 0.05);
    /* Subtle Tint */
}

.action-btn-icon {
    font-size: 20px;
    margin-right: 12px;
}

.action-btn-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
}

.action-btn-arrow {
    color: var(--text-muted);
    font-size: 18px;
}

/* --- Full Page History Overlay --- */
#pageHistory {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background);
    z-index: 2000;
    overflow-y: auto;
}

/* Missing Modal Overlay Fix */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 12px;
    border-radius: 12px;
    width: 100%;
    margin-top: 20px;
    cursor: pointer;
}

/* Stat Item Hover Effects */
.stat-item {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    border-color: #C2F707 !important;
    box-shadow: 0 4px 12px rgba(194, 247, 7, 0.1);
}

.stat-item:active {
    background-color: rgba(194, 247, 7, 0.05);
    border-color: #C2F707 !important;
}

.page-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-main);
    margin: 0;
}

.back-btn {
    font-size: 24px;
    color: var(--text-main);
    cursor: pointer;
    padding: 5px;
}

/* Hide scrollbar globally */
::-webkit-scrollbar {
    display: none;
}

body {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* --- Dashboard Progress & Mission States --- */

.progress-container {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    height: 8px;
    width: 200px;
    margin: 10px auto;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background-color: #C2F707;
    /* Neon Lime */
    height: 100%;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 0 10px rgba(194, 247, 7, 0.5);
}

.mission-card.done {
    background: rgba(194, 247, 7, 0.05);
    /* Very subtle green tint */
    border-color: rgba(194, 247, 7, 0.3);
    opacity: 0.8;
}

.mission-card.done .status-icon {
    color: #C2F707;
    text-shadow: 0 0 8px rgba(194, 247, 7, 0.4);
}

.mission-card.todo {
    border-color: var(--border);
}

.mission-card.todo:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Pulsating effect for the active "Next Up" task */
.mission-card.active-next {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
    animation: pulseBorder 2s infinite;
}

@keyframes pulseBorder {
    0% {
        border-color: rgba(255, 255, 255, 0.2);
    }

    50% {
        border-color: rgba(255, 255, 255, 0.6);
    }

    100% {
        border-color: rgba(255, 255, 255, 0.2);
    }
}

.clickable-stat {
    cursor: pointer;
    transition: transform 0.2s;
}

.clickable-stat:hover {
    transform: scale(1.05);
}

.clickable-stat:active {
    transform: scale(0.95);
}