/* style.css */

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

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background: #1a1a1a;
    color: rgb(212, 196, 183);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch; 
    height: 100vh;
    min-height: 100vh;
}

/* ===== SIDEBAR & HAMBURGER ===== */

#menu-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 2000;
    background: #3b0202;
    border: 2px solid #d6d6d6;
    border-radius: 4px;
    width: 40px;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

#menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #d6d6d6;
}

#sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 180px;
    height: 100%;
    background: #f4f4f4;
    border-left: 3px solid #320503;
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    z-index: 2001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

#sidebar.open {
    right: 0;
}

.sidebar-header {
    background: #e8e8e8;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 0.8rem;
    color: #000000;
}

#close-sidebar {
    background: transparent;
    border: none;
    color: #000000;
    font-size: 1rem;
    cursor: pointer;
}

.sidebar-content {
    padding: 12px;
    overflow-y: auto;
}

.menu-item {
    display: block;
    width: 100%;
    background: #fcfcfc;
    color: #000000;
    border: 2px solid #cccccc;
    padding: 8px;
    margin-bottom: 8px;
    text-align: left;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: normal;
}

.menu-item:hover {
    background: #e0e0e0;
    color: #000000;
}

.ig-link {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #000000; 
    text-decoration: none;
    font-size: 0.75rem;
    margin-top: 20px;
    transition: opacity 0.2s ease;
    line-height: 1;
}

.ig-link svg {
    height: 1.1em; 
    width: 1.1em;
    fill: currentColor; 
    display: block;
    flex-shrink: 0;
    padding-right: 1px;
    box-sizing: content-box;
}

.ig-link:hover {
    opacity: 0.6;
}

.yt-link {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #000000; 
    text-decoration: none;
    font-size: 0.75rem;
    margin-top: 12px; 
    transition: opacity 0.2s ease;
    line-height: 1;
}

.yt-link svg {
    height: 1.1em;
    width: 1.1em;
    fill: currentColor; 
    display: block;
    flex-shrink: 0;
    padding-right: 1px;
    box-sizing: content-box;
}

.yt-link:hover {
    opacity: 0.6;
}

.sidebar-footer {
    margin-top: auto;
    padding: 10px;
    border-top: 1px solid #ddd;
    background: #e8e8e8;
}

.sidebar-footer p {
    margin: 0 0 6px 0;
    font-size: 0.5rem;
    color: #666;
    line-height: 1.4;
}

.sidebar-footer .copyright {
    font-size: 0.5rem;
    color: #000;
    font-weight: bold;
}

/* ===== MODALS ===== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-window {
    background: #f9f9f9;
    border: 5px solid #b4b4b4;
    padding: 20px;
    max-width: 300px;
    width: 90%;
    position: relative;
    color: #000000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.modal-window h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #000000;
    text-transform: lowercase;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #000000;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    opacity: 0.6;
}

.modal-body {
    line-height: 1.4;
    font-size: 0.8rem;
}

.modal-body p {
    margin: 0 0 10px 0;
}

.modal-body p:last-child {
    margin-bottom: 0;
}


/* 2. TOP CONTROL BAR */
#controls {
    padding: 10px;
    background: #581d00;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    border-bottom: 0px solid #333333;
    flex-wrap: wrap;
    align-content: center;
    box-sizing: border-box;
    z-index: 20;
    flex-shrink: 0;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-grow: 0; /* Forces it to stay as small as its contents */
}

.input-group label {
    font-size: 0.65rem; 
    font-weight: normal;  
    letter-spacing: 0.05em;
    text-transform: none;
}

input, select {
    background: #000000;
    color: #d4c4b7;
    border: 1px solid #444444;
    padding: 5px;
    font-weight: bold;
    border-radius: 1px;
    font-size: 0.8rem;
}

button {
    background: #000000;
    color: #d4c4b7;
    border: 1px solid #d4c4b7;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 1px;
    transition: background 0.2s, color 0.2s;
    font-weight: bold;
    font-size: 0.7rem;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;

    width: auto;      /* Tells the button: only be as wide as your text */
    flex-grow: 0;     /* Do not expand to fill space */
    flex-shrink: 0;   /* Do not squish if the bar gets crowded */
}

button:hover { 
    background: #444; 
    color: #fff;
}

/* 3. GAME VIEWPORT */
#canvas-container {
    flex: 1; 
    width: 100%;
    overflow: auto; /* Allows scrolling the zoomed grid */
    background: #cdcdcd; /* #1a1a1a; Darker background makes the red scroll pop */
    /* position: relative;*/
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0; 
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch; 
}

/* ZOOM STATE: Reset flex to allow full-direction scrolling */
/* Add extra padding ONLY when zoomed in to give the 45° corners room */
#canvas-container.full-view {
    display: block; /* Flexbox "clips" scaled items; Block allows them to expand */
    text-align: center; /* Keep the diamond centered horizontally */
    padding: 0;
    overflow: auto; /* Ensure both axes are scrollable */
}

/* 4. CANVAS WRAPPER - ROTATED 45 DEGREES */
#canvas-wrapper {
    display: block;
    position: relative; 
    transform: rotate(45deg); 
    transform-origin: center center;
    margin: auto; 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* THE EFFECTIVE ZOOM: Combines rotation and scale in one property */
#canvas-container.full-view #canvas-wrapper {
    display: inline-block; /* Required for the margins to push the scroll area */
    transform: rotate(45deg) scale(2.2);

    /* Use fixed margins on all sides so the scrollable area expands in every
       direction, including left/right. 600px handles the rotated corners vertically;
       a matching horizontal margin ensures side-scrolling works too.
    */
    margin: 600px 600px;
}

/* 5. CANVAS - Keep it sharp */
#canvas-container canvas {
    display: block; 
    image-rendering: auto; /* Required for smooth text */
    background: transparent !important;
    
    /* These three lines force the GPU to keep edges clean during the zoom */
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    perspective: 1000px;
    
    shape-rendering: geometricPrecision; /* This helps keep the lines crisp on high-res screens */
}

/* 6. CONSOLIDATED FOOTER */
.site-footer {
    width: 100%;
    background: #1a1a1a;
    padding: 12px 0;
    border-top: 1px solid #333;
    text-align: center;
    box-sizing: border-box;
    flex-shrink: 0; /* Prevents the footer from being squished or moving up */
    position: relative;
    z-index: 50; /* Keeps it above the zoomed canvas */
}

.site-footer p {
    margin: 0 0 6px 0;
    font-size: 0.6rem;
    color: #555;
    letter-spacing: 0.02em;
    line-height: 1.4;
    padding: 0 15px;
}

.site-footer .copyright {
    display: block;
    font-size: 0.65rem;
    color: #888;
    letter-spacing: 0.05em;
}

/* 7. MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
    #controls { 
        padding: 8px 5px; 
        gap: 8px; 
    }
    
    .input-group label { 
        display: none; 
    }
    
    button { 
        padding: 8px 10px; 
        flex-grow: 0; 
        width: auto; 
        max-width: none; 
    }

    .input-group {
        justify-content: center;
    }
    
    #canvas-container {
        padding: 30px 10px;
    }
}
