:root {
    --bg: #0b0f14;
    --cyan: #00c8ff;
    --green: #00ff88;
    --yellow: #ffd84d;
    --text: #eaf6ff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Courier New", monospace;
    text-align: center;
}

.arcade {
    width: min(94vw, 740px);
    margin: 25px auto;
}

.eyebrow {
    color: var(--cyan);
    letter-spacing: 3px;
    font-size: 12px;
}

h1 {
    color: var(--green);
    font-size: clamp(28px, 6vw, 48px);
    text-shadow: 0 0 18px #00ff8870;
}

h1 span { color: var(--cyan); }

header p { color: var(--yellow); }

.scoreboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.scoreboard div {
    border: 1px solid var(--cyan);
    padding: 12px 5px;
    border-radius: 8px;
    font-size: 12px;
}

.scoreboard strong {
    display: block;
    margin-top: 8px;
    font-size: 25px;
    color: var(--green);
}

.game-frame {
    position: relative;
    border: 3px solid var(--cyan);
    box-shadow: 0 0 22px #00c8ff40;
    background: #050a10;
    border-radius: 8px;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
}

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #050a10e8;
    padding: 15px;
}

.overlay[hidden] { display: none; }

.overlay h2 {
    color: var(--green);
    font-size: clamp(22px, 5vw, 42px);
}

.overlay p { line-height: 1.7; }

button {
    border: 2px solid var(--green);
    background: #082519;
    color: var(--green);
    padding: 12px 20px;
    cursor: pointer;
    border-radius: 6px;
    font-family: inherit;
    font-weight: bold;
}

button:hover, button:focus-visible {
    background: #104c32;
    box-shadow: 0 0 14px #00ff8860;
}

.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.dpad { margin: 20px 0; }

.dpad > div { margin-top: 8px; }

.dpad button {
    min-width: 65px;
    min-height: 55px;
    touch-action: manipulation;
}

footer {
    color: #8ba6b5;
    font-size: 12px;
    line-height: 2;
    margin: 24px 0;
}

footer p { color: var(--green); }

@media (max-width: 480px) {
    .scoreboard div { font-size: 10px; }
    .scoreboard strong { font-size: 20px; }
    .actions button { padding: 10px; }
}


/* iBasterisk floating arcade controls */

.ibasterisk-floating-controls {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100;
    margin: 0;
    padding: 10px;
    background: rgba(5, 15, 20, 0.88);
    border: 1px solid #00c8ff;
    border-radius: 12px;
    box-shadow: 0 0 16px rgba(0, 200, 255, 0.20);
}

.ibasterisk-floating-controls button {
    min-width: 52px;
    min-height: 48px;
    padding: 8px;
    background: #082519;
    touch-action: manipulation;
}

@media (max-width: 600px) {
    .ibasterisk-floating-controls {
        right: 8px;
        bottom: 8px;
        padding: 6px;
    }

    .ibasterisk-floating-controls button {
        min-width: 42px;
        min-height: 42px;
        padding: 6px;
    }
}


/* iBasterisk responsive arcade layout */

.arcade {
    margin: 8px auto;
}

header h1 {
    margin: 12px 0;
    line-height: 1.2;
}

header p {
    margin: 8px 0;
}

.scoreboard {
    margin: 10px 0;
}

.scoreboard div {
    padding: 8px 5px;
}

.scoreboard strong {
    margin-top: 4px;
}

.game-frame {
    width: min(100%, 600px, calc(100dvh - 390px));
    min-width: 0;
    margin-left: auto;
    margin-right: auto;
}

.actions {
    margin-top: 10px;
}

.actions button {
    padding: 8px 14px;
}

footer {
    margin: 8px 0;
    line-height: 1.5;
}

footer p {
    margin: 4px 0;
}

@media (max-height: 700px) {
    header h1 {
        font-size: 26px;
        margin: 5px 0;
    }

    .game-frame {
        width: min(100%, 600px, max(220px, calc(100dvh - 300px)));
    }

    .scoreboard {
        margin: 6px 0;
    }
}

@media (max-width: 600px) {
    .game-frame {
        width: min(100%, 600px, calc(100dvh - 300px));
    }
}


/* Help text above floating controls */
.ibasterisk-floating-controls .control-help {
    color: #00c8ff;
    font-size: 10px;
    line-height: 1.8;
    text-align: center;
    margin-bottom: 10px;
    white-space: nowrap;
}

.ibasterisk-floating-controls .control-help span {
    display: block;
}

@media (max-width: 600px) {
    .ibasterisk-floating-controls .control-help {
        font-size: 8px;
        white-space: normal;
    }
}

/* iBasterisk Snake - Player Modal */

.player-modal[hidden] {
    display: none !important;
}

.player-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.88);
}

.player-dialog {
    width: min(95vw, 520px);
    padding: 26px;
    background: #06130d;
    border: 2px solid #00ff88;
    box-shadow: 0 0 22px rgba(0,255,136,0.3);
    text-align: center;
}

.player-dialog h2 {
    color: #00ff88;
    font-size: 22px;
    line-height: 1.5;
}

#player-input {
    display: block;
    width: 100%;
    padding: 14px;
    margin: 18px 0;
    background: #000;
    border: 2px solid #00c8ff;
    color: #fff;
    text-align: center;
    font-family: inherit;
    font-size: 22px;
}

#player-error {
    color: #ff6464;
    min-height: 20px;
}

.player-dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* iBasterisk Snake - Highscore */

.leaderboard {
    margin: 24px auto;
    padding: 18px;
    border: 1px solid #00c8ff;
    border-radius: 10px;
    max-width: 600px;
}

.leaderboard h2 {
    color: #00ff88;
    font-size: 20px;
}

#highscore-list {
    padding-left: 35px;
    text-align: left;
}

#highscore-list li {
    padding: 8px;
    border-bottom: 1px solid #17333d;
}

#highscore-list span {
    float: right;
    color: #00ff88;
}


/* iBasterisk Snake - Language Switch */

.language-switch {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 8px auto;
}

.language-switch button {
    padding: 6px 14px;
    border-color: #00c8ff;
    color: #00c8ff;
    background: #06131d;
}

.language-switch button.active {
    border-color: #00ff88;
    background: #00ff88;
    color: #06130d;
}

/* iBasterisk Snake - Highscore Modal */

.highscore-dialog {
    width: min(95vw, 480px);
    max-height: 85dvh;
    overflow-y: auto;
}

.highscore-dialog h2 {
    color: #ffd84d;
}

.highscore-dialog #highscore-list {
    margin: 20px 0;
    padding-left: 34px;
    max-height: 48dvh;
    overflow-y: auto;
}

.highscore-dialog #highscore-list li {
    color: #eaf6ff;
    padding: 9px;
    overflow-wrap: anywhere;
}

.highscore-dialog #highscore-list span {
    color: #00ff88;
    font-weight: bold;
}

#highscore-close {
    border-color: #00c8ff;
    color: #00c8ff;
}

/* Actions on small screens */

.actions {
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .actions {
        gap: 6px;
    }

    .actions button {
        font-size: 10px;
        padding: 8px;
    }
}
