/* BEAM - Main Stylesheet */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #050510;
    color: #fff;
    font-family: 'Courier New', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;

    /* Mobile: no text selection on drag, no tap flash */
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;

    /* Respect notches / rounded corners (viewport-fit=cover) */
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Header */
#header {
    text-align: center;
    margin-bottom: 15px;
}

#header h1 {
    font-size: 2.8em;
    letter-spacing: 0.4em;
    color: #ff2222;
    text-shadow: 0 0 30px rgba(255, 30, 30, 0.6), 0 0 60px rgba(255, 30, 30, 0.3);
}

#subtitle {
    color: #555;
    margin-top: 5px;
    font-size: 0.85em;
}

/* Game canvas */
#game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

canvas {
    cursor: pointer;
    border-radius: 12px;
    box-shadow: 0 0 80px rgba(255, 30, 30, 0.08), 0 0 30px rgba(0, 0, 50, 0.5);

    /* Touch: we handle gestures ourselves (no scroll, zoom or pull-to-refresh) */
    touch-action: none;

    /* Responsive: stay square, fit within viewport width and available height */
    aspect-ratio: 1 / 1;
    width: auto;
    height: auto;
    max-width: min(calc(100vw - 16px), 640px);
    max-height: min(calc(100vh - 250px), 640px);
}

/* Controls */
#controls {
    margin-top: 20px;
    text-align: center;
    color: #555;
    font-size: 0.85em;
}

#controls span { color: #ff4444; }

/* Debug button bar */
#debug-bar {
    margin-top: 10px;
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

#debug-bar .dbg {
    min-width: 40px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #7788aa;
    border: 1px solid #334;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    transition: background 0.12s, color 0.12s;
}

#debug-bar .dbg:active {
    background: rgba(255, 68, 68, 0.25);
    color: #fff;
    border-color: #ff4444;
}

/* Info bar */
#info {
    margin-top: 12px;
    display: flex;
    gap: 30px;
    font-size: 1em;
}

#info .label { color: #444; }
#info .value { color: #ddd; font-weight: bold; }

/* Widget info */
#widget-info {
    margin-top: 8px;
    font-size: 0.8em;
    color: #446;
    height: 20px;
}

/* Message */
#message {
    margin-top: 15px;
    font-size: 1.3em;
    height: 35px;
    color: #44ff44;
    text-shadow: 0 0 15px rgba(68, 255, 68, 0.6);
}

/* Next button */
#next-btn {
    margin-top: 12px;
    padding: 10px 30px;
    background: transparent;
    color: #ff4444;
    border: 1px solid #ff4444;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    cursor: pointer;
    letter-spacing: 0.15em;
    transition: all 0.2s;
    visibility: hidden;
    opacity: 0;
}

#next-btn.visible {
    visibility: visible;
    opacity: 1;
}

#next-btn:hover {
    background: #ff4444;
    color: #000;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
}

/* ---- Small screens (phones): compact UI to give the canvas more room ---- */
@media (max-width: 700px), (max-height: 800px) {
    #header { margin-bottom: 6px; }
    #header h1 { font-size: 1.6em; letter-spacing: 0.3em; }
    #subtitle { font-size: 0.7em; margin-top: 2px; }

    #controls { margin-top: 8px; font-size: 0.7em; }
    #info { margin-top: 8px; gap: 18px; font-size: 0.9em; }
    #widget-info { margin-top: 4px; font-size: 0.7em; height: 16px; }
    #message { margin-top: 8px; font-size: 1.05em; height: 26px; }
    #next-btn { margin-top: 8px; padding: 8px 22px; font-size: 0.9em; }

    canvas {
        max-height: min(calc(100vh - 190px), 640px);
    }
}
