@font-face {
    font-family: 'OffBit';
    src: url('../../assets/fonts/OffBit-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'OffBit-Dot';
    src: url('../../assets/fonts/OffBit-DotBold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

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

.screen-too-small {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-text);
    color: var(--color-bg);
    z-index: 9999;
    /* shown only under 900px via media query */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.6;
}

.screen-too-small p {
    margin: 8px 0;
}

@media (max-width: 900px) {
    .screen-too-small {
        display: flex;
    }
    
    .navbar, .layout {
        display: none;
    }
}
html, body { height: 100%; }
body {
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-bg);
    overflow: hidden;
    opacity: 0;
    transition: opacity var(--transition-duration) ease-in-out, 
                background-color var(--transition-duration) ease-in-out,
                color var(--transition-duration) ease-in-out;
}

.navbar {
    position: fixed; top: 0; left: 0; right: 0; height: 32px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; margin: 0; border-bottom: 2px solid var(--color-text);
    background: transparent;
    z-index: 1000;
    transition: border-bottom-color var(--transition-duration) ease-in-out;
}

.navbar-left {
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
}

.branch-counter {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: inherit;
    font-weight: normal;
    color: inherit;
}

.navbar-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    height: 100%;
}

.navbar-right button {
    border-left: 2px solid var(--color-text);
    border-right: 2px solid var(--color-text);
    padding: 8px 16px;
    margin: 0;
    background: transparent;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle {
    background: transparent;
    border: none;
    font-family: inherit;
    font-weight: normal;
    font-size: inherit;
    color: inherit;
    cursor: pointer;
    padding: 8px 16px;
    margin: 0;
    transition: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    color: inherit;
    transform: none;
    background: var(--color-bg-secondary);
}

.codebase-link {
    font-family: inherit;
    font-size: inherit;
    font-weight: normal;
    color: inherit;
    text-decoration: none;
    padding: 0 16px;
    margin: 0;
    transition: none;
    height: 100%;
    display: flex;
    align-items: center;
    cursor: not-allowed;
}

.codebase-link:hover {
    color: inherit;
    transform: none;
    background: var(--color-bg-secondary);
}

.tour-btn {
    background: transparent;
    border: none !important;
    border-left: solid 2px var(--color-text) !important;
    border-radius: 0;
    color: var(--color-text);
}

.tour-btn:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.layout {
    display: flex;
    height: 100vh;
    padding-top: 32px;
    box-sizing: border-box;
    flex-wrap: nowrap;           /* keep columns in one row */
}



.panel { 
    display: flex; 
    border: none; 
    overflow: hidden;
    height: 100%;
}
.panel:not(.expanded) { 
    flex: 0 0 var(--panel-tab-width); 
    border: none;
}
.panel.expanded{ 
    flex: 1 1 auto; 
    min-width: 0; /* allow panel to shrink */
}

.panel.expanded .panel-tab {
    border-left: 1px dashed var(--color-text);
}

.panel-tab {
    flex: 0 0 var(--panel-tab-width);
    writing-mode: vertical-rl; transform: rotate(180deg);
    display: flex; align-items: center; justify-content: flex-start;
    padding-top: 70vh; font-weight: 800; letter-spacing: 1px;
    user-select: none;
    font-family: var(--font-family-nav);
    position: relative;
    font-size: var(--font-size-panel-tab);
    cursor: pointer;
    transition: border-left-color var(--transition-duration) ease-in-out;
}

.panel-tab:first-child {
    border-right: 2px solid var(--color-text);
}

.panel-tab:not(:first-child) {
    border-right: none;
}

.panel-tab::before {
    content: "○";
    position: absolute;
    top: calc(70vh - 45px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    color: var(--color-text);
    font-family: 'OffBit-Dot', monospace;
}

.panel.expanded .panel-tab::before { content: "●"; }

.panel-content {
    flex: 1;
    display: none;
    min-width: 0;               /* allow flex child to shrink properly */
    min-height: 0;              /* allow child to define its own scroll */
    display: flex;
    flex-direction: column;
    overflow: hidden;           /* confine inner scroll areas */
}
.panel.expanded .panel-content { display: flex; }

/* Panel info styling for archive and ranking panels */
.panel-info {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    text-align: center;
}

.panel-info p {
    font-size: 16px;
    color: var(--color-text-muted, #6b7280);
    font-weight: 500;
    line-height: 1.5;
    max-width: 400px;
    margin: 0;
    padding: 24px;
    background: var(--color-bg);
    border: 1px dashed var(--color-text);
    border-radius: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px dashed var(--color-text);
    flex-shrink: 0; /* prevent header from shrinking */
    transition: border-bottom-color var(--transition-duration) ease-in-out;
}

/* Button styling moved to branches.css to avoid conflicts */

.panel-controls {
    display: flex;
    gap: clamp(8px, 1vw, 16px);
    align-items: center;
    flex-shrink: 1;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--color-text-secondary);
    pointer-events: none;
}

.search-input {
    padding: 12px 12px 12px 32px;
    border: 1px solid var(--color-text);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    min-width: 120px;
    max-width: 180px;
    width: clamp(120px, 15vw, 180px);
    flex-shrink: 1; /* allow search to shrink if needed */
}

.search-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.sort-wrapper {
    position: relative;
}

.sort-btn {
    display: flex;
    color: var(--color-text);
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 1px solid var(--color-text);
    background: var(--color-bg);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none; /* Remove default outline */
    -webkit-tap-highlight-color: transparent; /* Remove mobile tap highlight */
}

.sort-btn:hover {
    background: var(--color-bg-secondary);
}

.sort-btn:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 var(--focus-outline-offset) var(--color-accent);
}

/* Only show focus outline when using keyboard navigation */
.sort-btn:focus:not(:focus-visible) {
    outline: none;
    border-color: var(--color-text);
    box-shadow: none;
}

.sort-btn:hover .chevron-icon {
    transform: translateY(1px);
}


/* ===== Button Styles ===== */
.login-btn {
    font-family: inherit;
    font-size: inherit;
    font-weight: normal;
    color: inherit;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    transition: none;
}

/* Fade in effect */
body.fade-in {
    opacity: 1;
}

.login-btn:hover {
    background: var(--color-bg-secondary);
    color: inherit;
}

.login-btn:active {
    transform: none;
}





/* ===== Guided Tour (square-cornered, minimal) ===== */
.tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    pointer-events: auto;
}

.tour-tooltip {
    position: fixed;
    z-index: 2001;
    background: var(--color-bg);
    color: var(--color-text);
    border: 2px solid var(--color-text);
    border-radius: 0;
    min-width: 260px;
    max-width: 360px;
    box-shadow: none;
}

.tour-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px dashed var(--color-text);
}

.tour-title {
    font-weight: 700;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.tour-close {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
}

.tour-content {
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.tour-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 12px 12px;
    border-top: 1px dashed var(--color-text);
}

.tour-progress {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.tour-buttons {
    display: flex;
    gap: 8px;
}

.tour-prev, .tour-next {
    background: transparent;
    color: inherit;
    border: 1px solid var(--color-text);
    border-radius: 0;
    padding: 6px 10px;
    cursor: pointer;
}

.tour-prev:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tour-highlight {
    outline: 2px solid var(--color-accent) !important;
    outline-offset: 2px !important;
}

/* Ensure tour highlight works on specific elements */
#leaderboardTab.tour-highlight {
    outline: 2px solid var(--color-accent) !important;
    outline-offset: 2px !important;
}

.tour-flicker {
    animation: tour-flicker 1.5s ease-in-out infinite;
}

@keyframes tour-flicker {
    0%, 100% { 
        outline-color: var(--color-accent);
        outline-width: 2px;
    }
    50% { 
        outline-color: var(--color-accent);
        outline-width: 4px;
        box-shadow: 0 0 0 2px var(--color-accent);
    }
}

/* Notification dot animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Username links */
.username-link {
    color: var(--color-text);
    text-decoration: none;
    transition: text-decoration 0.2s ease;
}

.username-link:hover {
    text-decoration: underline;
}

