/* =========================================================
   Synchrotron – complete stylesheet
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Full-screen game stage */
.game-stage,
.canvas-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* All canvases fill the viewport */
#myCanvas,
#twinkleOverlay,
#gameOverlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0;
    padding: 0;
    border: none;
    display: block;
}

/* =========================================================
   Control buttons (Home, Help, Backspace, Hint)
   ========================================================= */

#homeBtn,
#helpBtn,
#backspaceBtn,
#hintBtn {
    position: fixed;
    z-index: 2000;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #fff;
    color: #222;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    text-decoration: none;
}

/* Individual positions */
#homeBtn {
    left: 10px;
    top: 10px;
}

#helpBtn {
    right: 10px;
    top: 10px;
    width: 36px;
    padding: 0;
    font-size: 18px;
}

#backspaceBtn {
    left: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: 48px;
    padding: 0;
    font-size: 20px;
}

#hintBtn {
    left: 10px;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px));
    min-width: 96px;
}

/* =========================================================
   Help modal
   ========================================================= */

#helpModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#helpModal.visible {
    display: flex;
}

#helpModal .modal-content {
    background: #fff;
    color: #222;
    max-width: 480px;
    width: 100%;
    border-radius: 10px;
    padding: 24px 28px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    position: relative;
    line-height: 1.5;
}

#helpModal .close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
    line-height: 1;
}

#helpModal .close-btn:hover {
    color: #000;
}