* {
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent horizontal scrolling globally */
}

html body {
    background: #0a0a0a;
    color: #e8e8e8;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    line-height: 1.6;
    display: grid;
    grid-template-areas: 
        "left middle right";
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    gap: 1rem;
    padding: 1rem;
    margin: 0;
    box-sizing: border-box;
}

.left {
    grid-area: left;
    height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    overflow-x: hidden;
    word-wrap: break-word;
}

.middle {
    grid-area: middle;
    height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    overflow-x: hidden;
    word-wrap: break-word;
}

.right {
    grid-area: right;
    height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    overflow-x: hidden;
    word-wrap: break-word;
}

h1, h2, h3, .font-bold {
    font-family: 'Orbitron', 'Courier New', monospace;
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    font-weight: 700;
    color: #f5f5f5;
}

/* Apply card styling to wrapper divs instead of nested .card */
.name,
.activity,
.cache,
.skills,
.levels,
.buttons,
.exp,
.quests,
.loginstatus {
    border: 1px solid #333;
    background: linear-gradient(135deg, #111 0%, #0d0d0d 100%);
    border-radius: 4px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    color: #e8e8e8;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

/* Small sections with calculated height (accounting for gaps) */
.name,
.exp,
.cache,
.levels,
.buttons,
.loginstatus {
    height: calc((100vh - 2rem - 8rem) * 0.1); /* 10% of available height minus gaps */
    min-height: 60px;
    max-height: 80px;
    flex-shrink: 0;
    overflow: hidden;
}

/* Activity section should fill remaining space in left column */
.activity {
    flex: 1;
    max-height: none;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Other large sections that can expand */
.skills,
.exp,
.quests {
    flex: 1;
    max-height: none;
    min-height: 0;
    overflow: hidden;
}

/* Hover effects for wrapper divs */
.name:hover,
.activity:hover,
.cache:hover,
.skills:hover,
.levels:hover,
.buttons:hover,
.exp:hover,
.quests:hover,
.loginstatus:hover {
    border-color: #444;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.7);
}

/* Decorative line effect */
.name::before,
.activity::before,
.cache::before,
.skills::before,
.levels::before,
.buttons::before,
.exp::before,
.quests::before,
.loginstatus::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #333, transparent);
}

.sidebar {
    background: linear-gradient(135deg, #111 0%, #0d0d0d 100%);
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    position: relative;
    border: 1px solid #333;
    color: #e8e8e8;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #444, transparent);
}

.sidebar h1 {
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-auto-rows: min-content;
    gap: 1.5rem;
    align-items: start;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    overflow-y: auto;
    flex: 1;
    max-height: none;
}

/* Content areas that need scrolling */
.activity .space-y-2 {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-right: 0.5rem; /* Space for scrollbar */
    word-wrap: break-word;
    word-break: break-word;
}

.skills .skills-grid,
.exp > div,
.quests #quests-list {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    word-wrap: break-word;
    word-break: break-word;
}

.activity-item {
    background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #333;
    color: #e8e8e8;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
    overflow-x: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

.activity-item:hover {
    border-color: #444;
    transform: translateX(2px);
}

.skill-item {
    background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
    padding: 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 60px;
    border: 1px solid #333;
    color: #e8e8e8;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
}

.skill-item:hover {
    border-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.skill-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #444, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skill-item:hover::after {
    opacity: 1;
}

.skill-item img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    filter: brightness(1.1) contrast(1.1);
}

.skill-item div {
    flex: 1;
    min-width: 0;
}

.skill-item .font-bold {
    font-size: 1.4rem;
    color: #f5f5f5;
    font-family: 'Orbitron', monospace;
}

.skill-item .text-sm {
    font-size: 0.85rem;
    line-height: 1.2;
    color: #ccc;
}

.skill-item .text-xs {
    font-size: 0.75rem;
    line-height: 1.1;
    color: #aaa;
}

.nav-button {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    margin: 0.5rem 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
    border: 1px solid #333;
    border-radius: 4px;
    color: #e8e8e8;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: left;
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
}

.nav-button:hover {
    background: linear-gradient(135deg, #222 0%, #1a1a1a 100%);
    border-color: #555;
    color: #f5f5f5;
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.nav-button::before {
    content: '▶';
    position: absolute;
    left: 0.5rem;
    opacity: 0;
    transition: all 0.3s ease;
    color: #666;
}

.nav-button:hover::before {
    opacity: 1;
    transform: translateX(4px);
}

.status-online {
    color: #4ade80;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

.status-offline {
    color: #6b7280;
    font-weight: 600;
    opacity: 0.8;
}

.text-responsive {
    font-size: 1rem;
    color: #e8e8e8;
}

.space-y-2 > * + * {
    margin-top: 0.75rem;
}

#quests-list {
    flex: 1;
    overflow-y: auto;
    max-height: none;
}

.quest-filter-btn {
    background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #333;
    color: #e8e8e8;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    position: relative;
}

.quest-filter-btn:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #222 0%, #1a1a1a 100%);
    color: #f5f5f5;
    transform: translateY(-2px);
}

.quest-filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #444, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quest-filter-btn:hover::before {
    opacity: 1;
}

.quest-filter-points {
    background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #333;
    color: #e8e8e8;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.quest-item {
    background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
    color: #e8e8e8;
    border: 1px solid #333;
    transition: all 0.3s ease;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    overflow-x: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

.quest-item:hover {
    border-color: #444;
    transform: translateX(4px);
}

/* Enhanced scrollbar styling */
.activity::-webkit-scrollbar,
.skills::-webkit-scrollbar,
.exp::-webkit-scrollbar,
.quests::-webkit-scrollbar,
.activity .space-y-2::-webkit-scrollbar,
.skills .skills-grid::-webkit-scrollbar,
.exp > div::-webkit-scrollbar,
.quests #quests-list::-webkit-scrollbar {
    width: 6px;
    height: 0; /* No horizontal scrollbar */
}

.activity::-webkit-scrollbar-track,
.skills::-webkit-scrollbar-track,
.exp::-webkit-scrollbar-track,
.quests::-webkit-scrollbar-track,
.activity .space-y-2::-webkit-scrollbar-track,
.skills .skills-grid::-webkit-scrollbar-track,
.exp > div::-webkit-scrollbar-track,
.quests #quests-list::-webkit-scrollbar-track {
    background: rgba(17, 17, 17, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(51, 51, 51, 0.3);
}

.activity::-webkit-scrollbar-thumb,
.skills::-webkit-scrollbar-thumb,
.exp::-webkit-scrollbar-thumb,
.quests::-webkit-scrollbar-thumb,
.activity .space-y-2::-webkit-scrollbar-thumb,
.skills .skills-grid::-webkit-scrollbar-thumb,
.exp > div::-webkit-scrollbar-thumb,
.quests #quests-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #444 0%, #333 50%, #222 100%);
    border-radius: 8px;
    border: 1px solid rgba(85, 85, 85, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.activity::-webkit-scrollbar-thumb:hover,
.skills::-webkit-scrollbar-thumb:hover,
.exp::-webkit-scrollbar-thumb:hover,
.quests::-webkit-scrollbar-thumb:hover,
.activity .space-y-2::-webkit-scrollbar-thumb:hover,
.skills .skills-grid::-webkit-scrollbar-thumb:hover,
.exp > div::-webkit-scrollbar-thumb:hover,
.quests #quests-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #666 0%, #555 50%, #444 100%);
    border-color: rgba(102, 102, 102, 0.7);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.activity::-webkit-scrollbar-thumb:active,
.skills::-webkit-scrollbar-thumb:active,
.exp::-webkit-scrollbar-thumb:active,
.quests::-webkit-scrollbar-thumb:active,
.activity .space-y-2::-webkit-scrollbar-thumb:active,
.skills .skills-grid::-webkit-scrollbar-thumb:active,
.exp > div::-webkit-scrollbar-thumb:active,
.quests #quests-list::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #777 0%, #666 50%, #555 100%);
}

/* Gothic accent borders for special items */
.border-green-500 {
    border-color: #22c55e !important;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.border-yellow-500 {
    border-color: #eab308 !important;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.2);
}

.border-red-500 {
    border-color: #ef4444 !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.border-purple-500 {
    border-color: #a855f7 !important;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

/* Enhanced focus states */
.nav-button:focus {
    outline: 2px solid #555;
    outline-offset: 2px;
    background: linear-gradient(135deg, #222 0%, #1a1a1a 100%);
}

    .skill-item:focus-within {
        outline: 1px solid #555;
        outline-offset: 1px;
        transform: translateY(-2px);
    }

@media (min-width: 768px) {
    .sidebar {
        padding: 1.25rem;
    }
    .masonry-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 1.5rem;
    }
    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        flex: 1;
        max-height: none;
    }
    .skill-item {
        padding: 1rem;
        min-height: 70px;
    }
    .skill-item img {
        width: 32px;
        height: 32px;
    }
    .skill-item .font-bold {
        font-size: 1.5rem;
    }
    .skill-item .text-sm {
        font-size: 0.95rem;
    }
    .skill-item .text-xs {
        font-size: 0.8rem;
    }
    /* Keep small sections proportional */
    .name,
    .cache,
    .levels,
    .buttons,
    .loginstatus {
        height: calc((100vh - 2rem - 8rem) * 0.1);
        min-height: 60px;
        max-height: 80px;
    }
    /* Activity section fills remaining space */
    .activity {
        flex: 1;
        max-height: none;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    /* Other large sections can expand */
    .skills,
    .exp,
    .quests {
        flex: 1;
        max-height: none;
        min-height: 0;
    }
}

@media (min-width: 1024px) {
    .sidebar {
        top: 2rem;
        height: fit-content;
        margin-bottom: 0;
        padding: 1.5rem;
        height: calc((100vh - 2rem - 8rem) * 0.1);
        min-height: 60px;
        max-height: 80px;
    }
    .masonry-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    }
    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
        flex: 1;
        max-height: none;
    }
    .skill-item {
        min-height: 80px;
    }
    /* Keep small sections proportional */
    .name,
    .cache,
    .levels,
    .buttons,
    .loginstatus {
        height: calc((100vh - 2rem - 8rem) * 0.1);
        min-height: 60px;
        max-height: 80px;
    }
    /* Activity section fills remaining space */
    .activity {
        flex: 1;
        max-height: none;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    /* Other large sections can expand */
    .skills,
    .exp,
    .quests {
        flex: 1;
        max-height: none;
        min-height: 0;
    }
}

@media (min-width: 1280px) {
    .masonry-grid {
        grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    }
    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
        flex: 1;
        max-height: none;
    }
    /* Keep small sections proportional */
    .name,
    .cache,
    .levels,
    .buttons,
    .loginstatus {
        height: calc((100vh - 2rem - 8rem) * 0.1);
        min-height: 60px;
        max-height: 80px;
    }

    .exp {
        height: calc((100vh - 2rem - 8rem) * 0.3);
        min-height: 120px;
        max-height: 160px;
    }

    /* Activity section fills remaining space */
    .activity {
        flex: 1;
        max-height: none;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    /* Other large sections can expand */
    .skills,
    .quests {
        flex: 1;
        max-height: none;
        min-height: 0;
    }
}

@media (max-width: 480px) {
    html body {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    .left, .middle, .right {
        height: calc(100vh - 1rem);
        overflow: hidden;
    }
    .sidebar {
        padding: 0.75rem;
        height: calc((100vh - 1rem - 4rem) * 0.1);
        min-height: 50px;
        max-height: 60px;
    }
    .card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    .masonry-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        flex: 1;
        max-height: none;
        overflow-y: auto;
    }
    .skill-item {
        padding: 0.5rem;
        min-height: 50px;
        flex-direction: column;
        text-align: center;
        gap: 0.25rem;
    }
    .skill-item img {
        width: 24px;
        height: 24px;
    }
    .skill-item .font-bold {
        font-size: 1.2rem;
    }
    #quests-list {
        flex: 1;
        overflow-y: auto;
        max-height: none;
    }
    /* Keep small sections proportional on mobile */
    .name,
    .cache,
    .levels,
    .exp,
    .buttons,
    .loginstatus {
        height: calc((100vh - 1rem - 4rem) * 0.1);
        min-height: 50px;
        max-height: 60px;
        padding: 0.5rem;
        overflow: hidden;
    }
    /* Activity section fills remaining space */
    .activity {
        flex: 1;
        max-height: none;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    /* Other large sections can expand */
    .skills,
    .quests {
        flex: 1;
        max-height: none;
        min-height: 0;
        overflow: hidden;
    }
    /* Content areas that need scrolling on mobile */
    .activity .space-y-2 {
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
        padding-right: 0.5rem;
        word-wrap: break-word;
        word-break: break-word;
    }
    .skills .skills-grid,
    .exp > div,
    .quests #quests-list {
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
        word-wrap: break-word;
        word-break: break-word;
    }
}

@media (hover: none) and (pointer: coarse) {
    .nav-button {
        padding: 1rem;
        margin: 0.5rem 0;
    }
    .skill-item {
        min-height: 60px;
    }
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .skill-item img {
        image-rendering: auto;
    }
}

@media print {
    .sidebar {
        position: static;
    }
    .nav-button {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Global overflow prevention and scrollbar styling */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
}

* {
    max-width: 100%;
}

/* Global scrollbar styling for any scrollable element */
*::-webkit-scrollbar {
    width: 6px;
    height: 0; /* No horizontal scrollbar */
}

*::-webkit-scrollbar-track {
    background: rgba(17, 17, 17, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(51, 51, 51, 0.3);
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #444 0%, #333 50%, #222 100%);
    border-radius: 8px;
    border: 1px solid rgba(85, 85, 85, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #666 0%, #555 50%, #444 100%);
    border-color: rgba(102, 102, 102, 0.7);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

*::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #777 0%, #666 50%, #555 100%);
}

/* Firefox scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: #333 rgba(17, 17, 17, 0.8);
}