html {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

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

body {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: black;
}

#repo-link {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    color: white;
    font-family: Arial, sans-serif;
    font-size: 14px;
    text-align: center;
}

#repo-link a {
    color: inherit;
}

#game-hud {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: stretch;
    gap: 10px;
    z-index: 10;
}

.game-board {
    height: 82px;
    border: 2px solid red;
    padding: 10px;
    background-color: black;
    color: red;
    font-family: Arial, sans-serif;
    font-size: 16px;
}

#game-data {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#game-instructions {
    width: 290px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
}

#game-instructions[hidden] {
    display: none;
}

.game-info {
    margin: 5px 0;
}

#gameCanvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

#touch-controls { display: none; }
@media (pointer: coarse) {
    html, body { overscroll-behavior: none; touch-action: none; }
    #repo-link { top: 8px; font-size: 11px; }
    #game-hud { top: 8px; right: 8px; gap: 6px; }
    .game-board { height: auto; min-height: 56px; padding: 6px; font-size: 12px; }
    #game-instructions { width: min(48vw, 220px); }
    #touch-controls { position: fixed; z-index: 20; left: 0; right: 0; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; align-items: end; padding: 8px 16px; pointer-events: none; }
    #touch-controls button { min-height: 56px; border: 3px solid red; border-radius: 14px; background: rgba(0,0,0,.82); color: white; font: bold 15px Arial,sans-serif; touch-action: none; pointer-events: auto; user-select: none; -webkit-user-select: none; }
    #touch-attacks { display: flex; align-items: end; gap: 10px; pointer-events: none; }
    #touch-attacks button { width: min(28vw, 130px); min-height: 64px; pointer-events: auto; }
    #touch-dpad { display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 54px); gap: 5px; pointer-events: none; }
    #touch-dpad button { width: 54px; min-height: 54px; }
    #touch-dpad [data-direction="ArrowUp"] { grid-column: 2; grid-row: 1; }
    #touch-dpad [data-direction="ArrowLeft"] { grid-column: 1; grid-row: 2; }
    #touch-dpad [data-direction="ArrowDown"] { grid-column: 2; grid-row: 2; }
    #touch-dpad [data-direction="ArrowRight"] { grid-column: 3; grid-row: 2; }
    #touch-controls button:active { background: rgba(100,0,0,.9); transform: scale(.96); }
}
