@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;700&display=swap');

* {
    box-sizing: border-box;
}

body {
    background: #121212;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Use dvh to fix mobile address bar cutting off bottom UI */
    height: 100dvh; 
    margin: 0;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tui-window {
    width: 95%;
    max-width: 500px;
    border: 1px solid #444;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    height: 90dvh;
    max-height: 750px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.tui-header {
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: #181818;
    color: #888;
    font-size: 0.9rem;
    font-weight: 300;
}

.tui-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #444 #0a0a0a;
}

.tui-content::-webkit-scrollbar {
    width: 6px;
}
.tui-content::-webkit-scrollbar-thumb {
    background-color: #444;
}

.hidden {
    display: none !important;
}

.tui-title-box {
    border: 1px solid #444;
    padding: 20px;
    margin: 10px auto 25px auto;
    text-align: center;
    width: fit-content;
}

.tui-title-box h1 {
    font-size: clamp(14px, 4vw, 18px);
    font-weight: 400;
    margin: 0 0 10px 0;
    letter-spacing: 4px;
    color: #fff;
}

.tui-title-box h2 {
    font-size: clamp(10px, 3vw, 12px);
    font-weight: 300;
    margin: 0;
    letter-spacing: 6px;
    color: #888;
}

.tui-box {
    border: 1px solid #333;
    padding: 15px;
    margin-bottom: 20px;
    line-height: 1.8;
    font-weight: 300;
    color: #bbb;
    user-select: text;
}

.tui-box p {
    margin: 5px 0;
}

.highlight {
    background: #e0e0e0;
    color: #0a0a0a;
    padding: 2px 8px;
    font-weight: 400;
}

.tui-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.tui-btn {
    background: transparent;
    color: #e0e0e0;
    border: 1px solid #444;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 12px 20px;
    outline: none;
    width: 100%;
    max-width: 250px;
    text-align: center;
    letter-spacing: 2px;
}

.tui-btn:hover, .tui-btn:active {
    background: #e0e0e0;
    color: #0a0a0a;
    border-color: #e0e0e0;
}

#contact-info p {
    word-break: break-all;
    text-align: center;
}

/* GAME UI */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #888;
}

.game-header .tui-btn {
    width: auto;
    padding: 6px 15px;
    letter-spacing: 1px;
}

.game-board-container {
    flex-grow: 1;
    border: 1px solid #444;
    background: #111;
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 20vh; /* flexible for small screens */
    touch-action: none; /* VERY IMPORTANT: prevents browser zooming/scrolling on swipe */
}

canvas {
    image-rendering: pixelated;
    display: block;
}

#game-over-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 10, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.game-over-text {
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.final-score {
    color: #888;
    margin-bottom: 25px;
}

.btn-restart {
    width: auto;
    padding: 10px 25px;
}

.game-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.control-row {
    display: flex;
    gap: 6px;
}

.ctrl-btn {
    font-size: 1.2rem; /* slightly larger for thumbs */
    padding: 15px;
    border: 1px solid #333;
    min-width: 65px;
    background: #151515;
    color: #888;
    width: auto;
    letter-spacing: 0;
}

.ctrl-btn:active {
    background: #e0e0e0;
    color: #0a0a0a;
    border-color: #e0e0e0;
}

/* Specific Mobile Overrides to ensure it never gets squished */
@media (max-width: 500px) {
    .tui-window {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border: none;
        border-radius: 0;
    }
    .tui-content {
        padding: 15px 10px;
    }
    .ctrl-btn {
        padding: 12px;
        min-width: 60px;
    }
}
