html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center; 
    background-image: url("https://deadjackdaw.com/assets/images/background_tiles/180px-Kitchen_Flooring_PG_Texture.png");
    background-repeat: repeat;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("https://deadjackdaw.com/assets/images/background_tiles/118.GIF");
    background-repeat: repeat;
    opacity: 0; 
    transition: opacity .2s ease-in-out;
    z-index: -1;
    will-change: opacity;
}

body.alt-background::before {
    opacity: 1;
}

.container {
    position: relative;
    z-index: 1; 
    max-width: 800px;
    max-height: 100%;
    padding: 20px;
    background-color: #FFFFFF;
    color: #1a0000;
    border: 2px solid #1a0000;
    border-radius: 3px;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.2);
    animation: fade-in-bottom 0.8s ease-out;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Typography */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
}

main a {
    text-decoration: none;
    color: inherit;
}

h1 { 
    display: inline-block;
    background-color: #FFFFFF;
    color: #1a0000;
    border: 2px solid #1a0000;
    padding: 12px 24px;
    margin: 0;
    font-size: 24px;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 4px 4px 0px #1a0000;
    transition: transform 0.1s, box-shadow 0.1s;
}

main a:hover h1 {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #1a0000;
}

h2 { 
    margin: 10px;
    font-size: 16px;
    font-weight: bold; 
    font-style: italic; 
    color: #1a0000;
    opacity: 0.8;
}

.h1-subtext {
    display: block;
    font-size: 12px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 5px;
    opacity: 0.8;
}

/* header image */
header img {
    width: 100%;
    max-height: auto;
    object-fit: contain;
    margin: 0px;
    padding: 0px;
}

/* divider */
.divider {
    display: block;
    margin: 10px auto;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(4px 4px 0px rgba(0, 0, 0, 0.1));
}

/* Pagedoll */
.pagedoll {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pagedoll img {
    max-width: 150px;
    transition: transform 0.3s ease;
    filter: drop-shadow(8px 8px 0px rgba(0, 0, 0, 0.2));
}

.tooltip {
    background-color: #FFFFFF;
    color: #1a0000;
    border: 2px solid #1a0000;
    filter: drop-shadow(8px 8px 0px rgba(0, 0, 0, 0.2));
    padding: 8px 12px;
    margin-bottom: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    position: relative;
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* Speech bubble arrow */
.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #1a0000 transparent transparent transparent;
}

/* Hover logic */
.pagedoll:hover .tooltip {
    opacity: 0;
    pointer-events: none;
}

.pagedoll img:hover {
    animation: glitch 0.3s infinite;
}

/* =========================================
   ANIMATIONS
   ========================================= */

@keyframes glitch {
    0% { transform: translate(1px, 1px); }
    20% { transform: translate(-2px, -1px); }
    40% { transform: translate(-1px, 2px); }
    60% { transform: translate(2px, 1px); }
    80% { transform: translate(-1px, -2px); }
    100% { transform: translate(1px, 1px); }
}

@keyframes fade-in-bottom {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* =========================================
   WEBRING
   ========================================= */
#ALAC_ring {
    position: fixed;
    bottom: 40px;
    left: 40px;
    z-index: 100;
    
    background-color: #FFFFFF;
    color: #1a0000;
    border: 2px solid #1a0000;
    border-radius: 3px;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.2);
    
    padding: 12px;
    width: 200px;
    box-sizing: border-box;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: fade-in-bottom 0.8s ease-out;
}

#ALAC_ring h6 {
    margin: 0;
    padding: 0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

#ALAC_ring a {
    color: #1a0000;
    text-decoration: none;
    font-weight: bold;
    font-size: 12px;
}

#ALAC_ring a:hover {
    text-decoration: underline;
}

/* =========================================
   MOBILE
   ========================================= */
@media screen and (max-width: 768px) {
    html, body {
        overflow: auto;
        height: auto;
    }

    body {
        align-items: flex-start;
        padding: 20px 10px;
    }

    .container {
        max-height: none;
        width: 100%;
        padding: 15px;
    }

    h1 {
        font-size: 18px;
        padding: 10px 15px;
    }

    .h1-subtext {
        font-size: 10px;
    }

    .pagedoll, #ALAC_ring {
        position: static;
        width: 100%;
        max-width: none;
        margin-top: 20px;
        box-shadow: none;
        border: none;
        padding: 0;
        animation: none;
    }
    
    .pagedoll img {
        max-width: 100px;
    }
    
    .tooltip {
        display: none;
    }

    #ALAC_ring {
        border-top: 2px dashed #1a0000;
        padding-top: 20px;
        border-radius: 0;
    }
}