:root {
    --text-color: #33ff33;
    --bg-color: #000;
    --accent-color: #006600;
    --font-family: 'DejaVu Sans Mono', monospace;
}

/* Ensure padding is included in the width calculations so sections don't
   overflow on small screens */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    color: var(--text-color);
    font-family: var(--font-family);
    background:
        repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0px, rgba(255,255,255,0.05) 2px, rgba(0,0,0,0.05) 2px, rgba(0,0,0,0.05) 4px),
        linear-gradient(-45deg, var(--bg-color), var(--accent-color), var(--bg-color));
    background-size: 400% 400%;
    animation: gradient 20s ease infinite;
    text-shadow: 0 0 5px var(--text-color);
}

#toggle-effects {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    z-index: 20;
}

#language-select {
    position: fixed;
    top: 1rem;
    right: 6.5rem;
    background-color: var(--bg-color);
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 0.25rem 0.5rem;
    font-family: inherit;
    cursor: pointer;
    z-index: 20;
}

#language-select option {
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.no-effects {
    background: var(--bg-color);
    animation: none;
    text-shadow: none;
}

body.no-effects section {
    background: none;
    box-shadow: none;
}
@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

a {
    color: var(--text-color);
}
#menu {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    z-index: 10;
}
#menu .burger {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    margin-right: 1rem;
    cursor: pointer;
}
#menu img {
    height: 40px;
    margin-right: 1rem;
}
#menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}
#menu li {
    position: relative;
    margin-right: 1rem;
}
#menu li a {
    color: var(--text-color);
    text-decoration: none;
}
#menu li a:hover {
    text-decoration: underline;
}
#menu li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    flex-direction: column;
    background: rgba(0,0,0,0.8);
    padding: 0.5rem;
    box-shadow: 0 0 10px var(--text-color);
}
#menu li:hover ul {
    display: flex;
}
#menu li ul li {
    margin-right: 0;
    padding: 0.25rem 0;
}

#menu li ul li + li {
    border-top: 1px solid var(--text-color);
}

    @media (max-width: 600px) {
        #menu {
            justify-content: flex-start;
        }
        #menu .burger {
            display: block;
        }
        #menu ul {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            flex-direction: column;
            background: rgba(0,0,0,0.9);
            padding: 1rem;
        }
        #menu.open > ul {
            display: flex;
        }
        #menu li {
            margin: 0 0 0.5rem 0;
            width: 100%;
        }
        #menu li ul {
            position: static;
            width: 100%;
            margin-top: 0.5rem;
        }
    }
section {
    max-width: 800px;
    width: 100%;
    margin-bottom: 2rem;
    padding: 2rem;
    box-shadow: 0 0 10px var(--text-color);
    position: relative;
    line-height: 1.4;
    background: rgba(0,0,0,0.6);
    display: grid;
    gap: 1rem;
}

@media (max-width: 600px) {
    section {
        padding: 1rem;
    }
}
.cursor {
    display: inline-block;
    width: 0.6ch;
    height: 1em;
    background: var(--text-color);
    margin-left: 2px;
    animation: blink 1s step-start infinite;
}
@keyframes blink {
    50% { opacity: 0; }
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    border: 1px solid var(--text-color);
    padding: 0.5rem;
    text-align: left;
    color: var(--text-color);
    /* Prevent long URLs or words from overflowing their cells */
    word-break: break-word;
}

th {
    background: rgba(0,0,0,0.8);
}

#subnetcalc input[type="text"],
#subnetcalc input[type="number"] {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    border: 1px solid var(--text-color);
    padding: 0.25rem;
}

#subnetcalc input[type="text"] {
    width: 15ch;
}

#subnetcalc input[type="number"] {
    width: 6ch;
}

#subnetcalc button {
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    font-family: inherit;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

#snake-canvas {
    background: var(--bg-color);
    border: 1px solid var(--text-color);
    width: 100%;
    max-width: 400px;
    height: auto;
}

#snake-game {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#guess-game input[type="number"] {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    border: 1px solid var(--text-color);
    padding: 0.25rem;
    width: 6ch;
}

#guess-game button {
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    font-family: inherit;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

#guess-game p {
    margin: 0.5rem 0;
}

#game-2048 {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-2048 .board {
    display: grid;
    grid-template-columns: repeat(4, 80px);
    grid-template-rows: repeat(4, 80px);
    gap: 5px;
    background: var(--bg-color);
    padding: 5px;
    border: 1px solid var(--text-color);
}

#game-2048 .tile {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(0,0,0,0.8);
    box-shadow: inset 0 0 5px var(--accent-color);
    color: var(--text-color);
}

#game-2048 button {
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    font-family: inherit;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    margin-top: 0.5rem;
}


#b64hex textarea {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    border: 1px solid var(--text-color);
    width: 100%;
    padding: 0.25rem;
}

#b64hex button {
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    font-family: inherit;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    margin-top: 0.5rem;
}
