@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap');

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

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

body {
    background: radial-gradient(circle at 50% 0%, #14233f 0%, #070b14 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Fredoka One', 'Courier New', monospace;
    touch-action: none;
}

#game-container {
    position: relative;
    border: 4px solid #2f6fb0;
    border-radius: 8px;
    box-shadow: 0 0 24px rgba(90, 160, 255, 0.35);
}

#gameCanvas {
    display: block;
    background: #1f5e9e;
    cursor: default;
    touch-action: none;
}

/* Help Button */
#help-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: rgba(47, 111, 176, 0.85);
    color: white;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Fredoka One', monospace;
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, background 0.2s;
}

#help-btn:hover { transform: scale(1.1); background: rgba(72, 150, 220, 0.95); }
#help-btn:active { transform: scale(0.95); }

/* Modal Styles */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.modal.hidden { display: none; }

.modal-content {
    background: linear-gradient(135deg, #16263f 0%, #284d7a 100%);
    border: 3px solid #2f6fb0;
    border-radius: 12px;
    padding: 24px;
    max-width: 420px;
    width: 100%;
    max-height: 84vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 30px rgba(72, 160, 220, 0.4);
    font-family: 'Fredoka One', monospace;
}

.modal-content h2 {
    color: #FECA57;
    font-size: 20px;
    text-align: center;
    margin-bottom: 16px;
    text-shadow: 2px 2px 0 #000;
}

.modal-content h3 {
    color: #7ec8ff;
    font-size: 13px;
    margin: 14px 0 6px 0;
    text-shadow: 1px 1px 0 #000;
}

.modal-content p {
    color: #fff;
    font-size: 10px;
    line-height: 1.7;
    margin: 3px 0;
}

.modal-content p.green { color: #90EE90; }
.modal-content p.gold { color: #FFD700; }
.modal-content p.red { color: #FF8a7a; }
.modal-content p.blue { color: #9fd2ff; }

.close-btn {
    position: absolute;
    top: 10px; right: 10px;
    width: 30px; height: 30px;
    border: none;
    background: rgba(255, 0, 0, 0.6);
    color: white;
    font-size: 20px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
}
.close-btn:hover { background: rgba(255, 0, 0, 0.8); }

.got-it-btn {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 12px;
    background: linear-gradient(180deg, #48DBFB 0%, #0ABDE3 100%);
    border: 2px solid #0984C4;
    border-radius: 8px;
    color: white;
    font-family: 'Fredoka One', monospace;
    font-size: 13px;
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
}
.got-it-btn:hover { background: linear-gradient(180deg, #74E8FF 0%, #38CDEB 100%); }
.got-it-btn:active { transform: scale(0.98); }

/* Mobile Portrait */
@media (max-width: 850px), (pointer: coarse) {
    body { flex-direction: column; justify-content: flex-start; padding-top: 5px; }
    #game-container { border-width: 2px; border-radius: 4px; max-width: calc(100vw - 10px); }
    #gameCanvas { width: calc(100vw - 10px); max-width: 800px; height: auto; }
}

/* Mobile Landscape */
@media (max-height: 500px) and (orientation: landscape) {
    body { flex-direction: row; justify-content: center; align-items: center; padding: 5px; }
    #game-container { max-height: calc(100vh - 10px); max-height: calc(100dvh - 10px); }
    #gameCanvas { width: auto; height: calc(100vh - 20px); height: calc(100dvh - 20px); max-height: 600px; }
}

canvas, button {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

@media (max-width: 850px) {
    .modal-content { padding: 16px; max-height: 76vh; }
    .modal-content h2 { font-size: 16px; }
    .modal-content h3 { font-size: 11px; }
    .modal-content p { font-size: 9px; }
    #help-btn { width: 32px; height: 32px; font-size: 16px; }
}
