/* CoreWars Homepage Styles */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    /* light, Minecraft‑style gradient background */
    background: linear-gradient(to bottom, #a0d8ef, #a2d149);
    color: #333;
    min-height: 100vh;
}

header {
    background: linear-gradient(45deg, #60A917, #A2D149);
    color: white;
    text-align: center;
    padding: 2rem 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-bottom: 5px solid #FFD700;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.logo-title {
    display: flex;
    align-items: center;
}

.logo {
    width: 80px;
    height: 80px;
    margin-right: 1rem;
    border-radius: 10px;
    border: 3px solid #FFD700;
}

header h1 {
    margin: 0;
    font-size: 2.1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #FFD700;
    font-family: 'Press Start 2P', cursive;
}

header p {
    font-size: 0.8rem;
    margin: 0.5rem 0 0;
    font-family: Arial, sans-serif;
}

.discord-btn {
    background: #7289DA;
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.8rem;
    font-family: Arial, sans-serif;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.3s;
}

.discord-btn:hover {
    background: #5B6EAE;
}

.discord-btn-large {
    background: #5865F2;
    color: #FFFFFF;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 25px;
    font-size: 1rem;
    font-family: Arial, sans-serif;
    font-weight: 900;
    letter-spacing: 0.03em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-block;
    margin-top: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.discord-btn-large:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.45);
    background: #4752C4;
    filter: brightness(1.05);
}

nav {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
}

nav a {
    color: #8D6E63;
    text-decoration: none;
    margin: 0 1.5rem;
    font-size: 1.2rem;
    font-family: Arial, sans-serif;
}

nav a:hover {
    text-decoration: underline;
    color: #60A917;
}

section {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

h2 {
    color: #8D6E63;
    border-bottom: 3px solid #8D6E63;
    padding-bottom: 0.5rem;
    font-size: 1.5rem;
    font-family: 'Press Start 2P', cursive;
    margin-bottom: 1.5rem;
}

h3 {
    color: #4CAF50;
    font-size: 1rem;
    font-family: Arial, sans-serif;
}

ul {
    list-style-type: none;
    padding: 0;
}

ul li {
    background: #F5F5F5;
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-left: 5px solid #4CAF50;
    font-family: Arial, sans-serif;
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.link-card {
    background: linear-gradient(145deg, #f7f7f7, #e6f0ff);
    border: 4px solid #60A917;
    border-radius: 18px;
    padding: 1rem 1.2rem;
    min-height: 75px;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    font-family: Arial, sans-serif;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.link-card:hover {
    background: linear-gradient(145deg, #eff7ff, #dfeeff);
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.link-card h3,
.link-card p {
    margin: 0;
}

.link-card p {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    word-break: break-word;
}

.link-card h3 {
    margin-top: 0;
    color: #1A73E8;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.feature-card {
    background: #FFF;
    border: 3px solid #FF9800;
    border-radius: 25px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: Arial, sans-serif;
}

.feature-card .note {
    font-size: 0.85rem;
    color: #555;
    margin-top: 0.75rem;
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    align-items: stretch;
}

@media (max-width: 768px) {
    .class-grid {
        grid-template-columns: 1fr;
    }
}

.class-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.class-top {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    height: 260px;
    overflow: hidden;
}

.class-desc {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.class-desc p {
    margin: 0.5rem 0;
    overflow: hidden;
}

.class-image-left {
    width: 250px;
    height: 220px;
    object-fit: contain;
    margin-right: 1rem;
    border-radius: 10px;
    border: 2px solid #8D6E63;
}

.class-desc {
    flex: 1;
}

.class-desc h3 {
    margin-top: 0;
    color: #2196F3;
}

.class-desc p {
    margin: 0.5rem 0;
}

.class-skills {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    justify-content: flex-start;
}

.class-skills h4 {
    color: #4CAF50;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.class-skills table {
    flex: 1;
    width: 100%;
}

.class-skills ul {
    list-style-type: none;
    padding: 0;
}

.class-skills li {
    background: #F5F5F5;
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-left: 5px solid #4CAF50;
}

.skill-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    table-layout: fixed;
}

.skill-table th,
.skill-table td {
    border: 1px solid #8D6E63;
    padding: 0.5rem;
    text-align: left;
    font-size: clamp(0.9rem, 1vw, 1rem);
    white-space: pre-line;
    word-break: break-word;
}

.skill-table td:nth-child(1),
.skill-table th:nth-child(1) {
    width: 15%;
}

.skill-table td:nth-child(2),
.skill-table th:nth-child(2) {
    width: 18%;
    white-space: nowrap;
}

.skill-table td:nth-child(3),
.skill-table th:nth-child(3) {
    width: 67%;
}

.skill-table th {
    background: #A2D149;
    color: #1B1B1B;
}

.skill-table tbody tr:nth-child(even) {
    background: #F5F5F5;
}

/* scroll indicator shown when table is horizontally scrollable */
.scroll-hint {
    font-size: 0.85rem;
    color: #555;
    margin-top: 0.5rem;
    font-weight: normal;
}

/* ensure the hint is clearly separate from the table content */
.scroll-hint {
    padding-left: 0.5rem;
}

/* Tabs */
.class-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.class-filter {
    margin: 1rem 0;
    font-family: Arial, sans-serif;
}

.class-filter label {
    color: #000;
    margin-right: 0.5rem;
}

.class-filter select {
    padding: 0.3rem;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid #8D6E63;
}

.tab-btn {
    background: #F5F5F5;
    color: #1B1B1B;
    border: 2px solid #8D6E63;
    padding: 0.5rem 1rem;
    margin: 0.25rem 0.25rem;
    border-radius: 25px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-weight: 700;
    transition: background 0.2s, transform 0.2s, color 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.tab-btn:hover {
    background: #e8e8e8;
    color: #111;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: #1E88E5;
    color: #FFF;
    border-color: #1565C0;
}

.class-icon {
    width: 50px;
    height: 50px;
    float: left;
    margin-right: 1rem;
}

.class-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 1rem 0;
    border-radius: 10px;
    border: 2px solid #8D6E63;
}

.how-to-columns {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.column {
    background: #f0f0f0;
    border: 3px solid #8D6E63;
    border-radius: 25px;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    font-family: Arial, sans-serif;
}

.platform-section {
    background: #FFF;
    border: 3px solid #FF9800;
    border-radius: 25px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: Arial, sans-serif;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.team-member {
    background: #FFF;
    border: 3px solid #2196F3;
    border-radius: 25px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: Arial, sans-serif;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
    margin-top: 1rem;
    color: #000;
    /* table text stays dark for readability */
}

.data-table th,
.data-table td {
    border: 2px solid #8D6E63;
    padding: 0.5rem;
}

/* icon grid and detail view colors */
.icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
}

/* class selector sidebar (database) */
.class-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
    justify-content: center;
}

/* Mobile-only class list toggle button (desktop hidden) */
.class-list-toggle {
    display: none;
}

@media (max-width: 768px) {
    .class-list-toggle {
        display: inline-block;
    }
}

.class-selector.horizontal {
    flex-direction: row;
    align-items: stretch;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* When no class is selected, allow wrapping instead of scrolling */
.database-container.no-selection .class-selector.horizontal {
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: center;
}

.class-selector.vertical {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
}

.database-container {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.database-container.no-selection {
    display: block;
}

.database-container.no-selection .database-sidebar {
    width: auto;
    max-width: none;
    min-width: 0;
    margin: 0 auto;
}

.database-main {
    display: none;
    flex: 1;
}

.database-container.selection .database-main {
    display: block;
}

.database-sidebar {
    min-width: 220px;
    max-width: 240px;
    width: 240px;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid #8D6E63;
    border-radius: 20px;
    padding: 1rem;
}

.database-sidebar h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: #333;
}


.class-icon-btn {
    background: #f0f0f0;
    border: 2px solid #8D6E63;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    text-align: left;
    min-width: 140px;
    width: auto;
}

.icon-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.class-selector.horizontal .class-icon-btn {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 140px;
    height: 140px;
    max-width: 140px;
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
}

/* When no class is selected, make buttons wider for better readability */
.database-container.no-selection .class-selector.horizontal .class-icon-btn {
    width: 220px;
    max-width: 220px;
    height: auto;
    aspect-ratio: auto;
    padding: 1rem 1.25rem;
}

.class-selector.vertical .class-icon-btn {
    flex-direction: row;
    width: 100%;
    height: auto;
    min-width: 0;
    justify-content: flex-start;
}

.class-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.class-icon-btn.active {
    background: #A2D149;
    border-color: #60A917;
}

.class-icon-btn img.icon {
    width: 56px;
    height: 56px;
    display: block;
    margin: 0;
}

.class-name {
    display: block;
    white-space: pre-line;
    line-height: 1.2;
    font-weight: 700;
}

/* detail view styling */
.detail-view {
    max-width: 800px;
    margin: 1rem auto;
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 10px;
}

.class-title {
    margin: 0 0 1rem 0;
    font-size: 1.6rem;
    color: #333;
    line-height: 1.2;
}

.detail-header {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
    text-align: left;
}

.detail-info {
    flex: 1;
    min-width: 240px;
}

.detail-stats {
    width: 100%;
    max-width: 600px;
}

.detail-image {
    width: 220px;
    height: 220px;
    object-fit: contain;
    border-radius: 10px;
    border: 2px solid #8D6E63;
}

@media (max-width: 768px) {
    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .detail-info {
        min-width: auto;
    }
}

.detail-stats-table {
    border-collapse: collapse;
    width: 100%;
}

.detail-stats-table th {
    background: #8D6E63;
    color: #fff;
}

.detail-stats-table th,
.detail-stats-table td {
    border: 1px solid #8D6E63;
    padding: 0.5rem;
}

.detail-skills ul {
    list-style: none;
    padding: 0;
}

.detail-skills li {
    margin-bottom: 0.5rem;
}

.class-description {
    margin-bottom: 1rem;
    font-style: italic;
    color: #333;
}

.developer-note {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(240, 240, 240, 0.8);
    border: 2px dashed #8D6E63;
    border-radius: 12px;
}

.developer-note h4 {
    margin-top: 0;
}

.data-table th {
    background: #8D6E63;
    color: white;
}

.data-table tr:nth-child(even) {
    background: #F5F5F5;
}

.cta-btn {
    background: linear-gradient(45deg, #FF9800, #F44336);
    color: #fff;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 25px;
    font-size: 1rem;
    font-family: Arial, sans-serif;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-block;
    margin-top: 1rem;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.cta-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    transform: skewX(-25deg);
    transition: left 0.5s ease;
}

.cta-btn:hover::before {
    left: 200%;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.join-btn {
    background: linear-gradient(45deg, #00C853, #00B0FF);
    color: #FFFFFF;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 25px;
    font-size: 1rem;
    font-family: Arial, sans-serif;
    font-weight: 900;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    display: inline-block;
    margin-top: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.6);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

.join-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.25);
    transform: skewX(-25deg);
    transition: left 0.5s ease;
}

.join-btn:hover::before {
    left: 200%;
}

.join-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
    filter: brightness(1.08);
}

.discord-highlight {
    text-align: center;
    margin-top: 1rem;
}

footer {
    background: #8D6E63;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
    font-family: Arial, sans-serif;
}

footer p {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.4rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .discord-btn {
        margin-top: 1rem;
    }

    section {
        padding: 1rem;
    }

    .class-grid,
    .feature-grid,
    .how-to-columns,
    .link-grid,
    .team-grid {
        grid-template-columns: 1fr;
    }

    nav a {
        display: block;
        margin: 0.5rem 0;
    }

    /* when only one class visible, convert table to vertical list */
    .data-table.single-view {
        display: block;
        width: auto;
    }

    .data-table.single-view thead {
        display: none;
    }

    .data-table.single-view tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 2px solid #FFA07A;
        border-radius: 8px;
        padding: 0.5rem;
    }

    .data-table.single-view td {
        display: block;
        width: 100%;
        border: none;
        padding: 0.25rem 0;
    }

    .data-table.single-view td:before {
        content: attr(data-label) ": ";
        font-weight: bold;
    }

    .data-table.single-view {
        font-size: 1rem;
    }

    .data-table {
        font-size: 0.8rem;
    }
}

/* Desktop layout: permanent sidebar on right, no hamburger */
@media (min-width: 769px) {
    nav {
        display: none;
    }

    .sidebar {
        right: 0 !important;
    }

    .sidebar-toggle {
        display: none;
    }

    body {
        padding-right: 260px;
        /* make room for sidebar */
    }
}

/* Sidebar */
.sidebar {
    position: fixed;
    right: -250px;
    top: 0;
    width: 250px;
    height: 100%;
    background: #A2D149;
    transition: right 0.3s;
    z-index: 1000;
    padding-top: 60px;
}

.sidebar.active {
    right: 0;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li {
    padding: 0;
}

.sidebar ul li a {
    display: block;
    color: #333;
    text-decoration: none;
    padding: 1rem;
    border-bottom: 1px solid #8D6E63;
    font-family: Arial, sans-serif;
}

.sidebar ul li a:hover {
    background: #A0D8EF;
}

.sidebar-toggle {
    position: fixed;
    right: 10px;
    top: 10px;
    background: #60A917;
    color: #333;
    border: none;
    padding: 0.75rem;
    border-radius: 5px;
    cursor: pointer;
    z-index: 1001;
    font-size: 2rem;
}

/* Scroll to top button */
#scrollToTopBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #60A917;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 2rem;
    cursor: pointer;
    display: block !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.3s;
    z-index: 1100;
}

@media (min-width: 769px) {
    #scrollToTopBtn {
        right: 280px;
    }
}

#scrollToTopBtn:hover {
    background: #A0D8EF;
}

.sidebar-toggle:hover {
    background: #A0D8EF;
}

/* Mobile Styles */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    nav {
        display: none;
    }

    .database-container {
        flex-direction: column;
        max-width: 100%;
        overflow-x: hidden;
    }

    .database-sidebar {
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    /* Class list toggle (mobile): hide by default, show when a class is selected */
    .class-list-toggle {
        display: none;
        margin: 1.5rem auto 0;
        width: auto;
        min-width: 180px;
        max-width: 100%;
    }

    /* When a class is selected, show the toggle button */
    .database-container.selection .class-list-toggle {
        display: inline-block;
    }

    /* Reduce visual chrome when in selection mode */
    .database-container.selection .database-sidebar {
        border: none;
        background: transparent;
        padding: 0;
    }

    .database-container.selection .database-sidebar h3 {
        display: none;
    }

    .class-list-wrapper {
        display: block;
        max-width: 100%;
        overflow-x: auto;
    }

    .class-list-wrapper.closed {
        display: none;
    }

    .database-main {
        width: 100%;
    }

    .detail-view {
        width: calc(100% - 2rem);
        max-width: calc(100% - 2rem);
        box-sizing: border-box;
    }

    /* Prevent detail view image from forcing horizontal overflow */
    .detail-image {
        width: 100%;
        max-width: 220px;
        height: auto;
    }

    /* Make class selector list behave like a vertical collapsed list on mobile */
    .class-selector.horizontal {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-x: visible;
    }

    .class-selector.horizontal .class-icon-btn {
        width: 100%;
        max-width: 100%;
    }

    /* Mobile class cards: stack image/name/text/skills */
    .class-top {
        flex-direction: column;
        height: auto;
        overflow: visible;
        min-width: 0;
        max-width: 100%;
    }

    .class-image-left {
        width: 100%;
        max-width: 100%;
        height: auto;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .class-desc {
        align-items: flex-start;
        overflow: visible;
        min-width: 0;
        max-width: 100%;
    }

    /* Prevent flex item overflow in small viewports */
    .class-layout,
    .class-card,
    .class-grid {
        min-width: 0;
        max-width: 100%;
    }

    .class-desc p {
        font-size: 0.95rem;
    }

    /* Make skill tables behave on mobile without causing horizontal overflow */
    .class-skills,
    .detail-skills {
        overflow-x: auto;
        min-width: 0;
        max-width: 100%;
    }

    /* Ensure inner table can be wider than the viewport and scroll inside its container */
    .class-skills table {
        width: auto;
    }

    .class-skills .skill-table,
    .detail-skills .skill-table {
        min-width: 700px;
        width: auto;
    }

    /* Header: break line between title and subtitle on mobile, remove separator */
    .header-sep {
        display: none;
    }

    .header-sub {
        display: block;
    }

    /* Mobile class list: collapse into vertical list, no overflow */
    .class-selector.horizontal {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-x: visible;
    }

    .class-selector.horizontal .class-icon-btn {
        width: 100%;
        max-width: 100%;
    }

    header {
        padding: 1rem 0;
    }

    .header-content {
        flex-direction: column;
        padding: 0 1rem;
    }

    header h1 {
        font-size: 1.8rem;
        word-break: break-word;
    }

    .header-sub {
        display: inline;
    }

    .header-sep {
        display: inline;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    /* mobile-only header formatting */
    .header-sep {
        display: none;
    }

    .header-sub {
        display: block;
    }

    /* Ensure hamburger is always visible on mobile */
    .sidebar-toggle {
        z-index: 9999;
    }

    .discord-btn-large {
        padding: 0.8rem 1.5rem;
        font-size: 0.8rem;
    }

    /* Mobile class page: stack image/name/intro/skills vertically */
    .class-top {
        flex-direction: column;
        height: auto;
        align-items: stretch;
    }

    .class-image-left {
        width: 100%;
        max-width: 100%;
        height: auto;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .class-desc {
        align-items: flex-start;
    }

    /* Ensure skill tables wrap and allow horizontal scrolling inside their container */
    .skill-table {
        min-width: 700px;
        table-layout: fixed;
        word-break: break-word;
    }

    .skill-table td,
    .skill-table th {
        word-break: break-word;
    }

    .sidebar {
        top: 0;
        right: -250px;
        width: 250px;
        height: 100%;
        background: rgba(162, 209, 73, 0.9);
        transition: right 0.3s;
        z-index: 1000;
        padding-top: 60px;
    }

    .sidebar.active {
        right: 0;
    }

    .sidebar ul {
        list-style: none;
        padding: 0;
    }

    .sidebar li {
        margin: 20px 0;
    }

    .sidebar a {
        color: white;
        text-decoration: none;
        font-size: 1.2rem;
        display: block;
        padding: 10px 20px;
    }

    .sidebar a:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Desktop layout */
@media (min-width: 769px) {

    /* keep top nav visible on desktop while sidebar is also shown */
    .sidebar {
        right: 0 !important;
    }

    .sidebar-toggle {
        display: none;
    }

    body {
        padding-right: 260px;
        /* room for sidebar */
    }
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: #60A917;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 9999;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }
}