/* Pisces: Space Journey — © 2024 An Nguyen. Licensed under the MIT License. */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #000;
    color: #fff;
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    position: relative;
}

canvas {
    display: block;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiMwMDAwMDUiLz48Y2lyY2xlIGN4PSIwJSIgY3k9IjAlIiByPSIwLjUiIGZpbGw9IiNmZmYiIG9wYWNpdHk9IjAuMSIvPjxjaXJjbGUgY3g9IjEwJSIgY3k9IjIwJSIgciI9IjAuMyIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC4xIi8+PGNpcmNsZSBjeD0iOTAlIiBjeT0iODAlIiByPSIwLjQiIGZpbGw9IiNmZmYiIG9wYWNpdHk9IjAuMSIvPjxjaXJjbGUgY3g9IjQwJSIgY3k9IjYwJSIgciI9IjAuMiIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC4xIi8+PGNpcmNsZSBjeD0iNzAlIiBjeT0iMzAlIiByPSIwLjYiIGZpbGw9IiNmZmYiIG9wYWNpdHk9IjAuMSIvPjxjaXJjbGUgY3g9IjI1JSIgY3k9Ijc1JSIgciI9IjAuMyIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC4xIi8+PGNpcmNsZSBjeD0iODAlIiBjeT0iNTAlIiByPSIwLjQiIGZpbGw9IiNmZmYiIG9wYWNpdHk9IjAuMSIvPjwvc3ZnPg==');
}

#startBtn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
    background: linear-gradient(145deg, #23a6d5, #23d5ab);
    color: white;
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(35, 197, 184, 0.4);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#startBtn:hover {
    transform: translate(-50%, -52%);
    box-shadow: 0 8px 25px rgba(35, 197, 184, 0.6);
}

/* Dark Souls game-over button style */
#startBtn.ds-mode {
    background: rgba(8, 3, 3, 0.93) !important;
    border: 1px solid rgba(178, 122, 26, 0.68) !important;
    color: rgba(218, 188, 112, 0.96) !important;
    font-family: 'Cinzel', serif !important;
    font-size: 17px !important;
    letter-spacing: 4px !important;
    border-radius: 2px !important;
    padding: 14px 46px !important;
    box-shadow: 0 0 22px rgba(100, 36, 8, 0.42), inset 0 0 14px rgba(0,0,0,0.58) !important;
    text-shadow: 0 0 10px rgba(195,142,36,0.32) !important;
    min-width: 230px !important;
}

#startBtn.ds-mode:hover {
    transform: translateX(-50%) !important;
    background: rgba(22, 8, 5, 0.97) !important;
    border-color: rgba(210, 155, 38, 0.88) !important;
    box-shadow: 0 0 32px rgba(155, 58, 8, 0.55), inset 0 0 14px rgba(0,0,0,0.40) !important;
    color: rgba(235, 205, 130, 1) !important;
}

#mainMenuBtn {
    position: fixed;
    /* min() clamps this to a safe distance from the bottom edge on short
       viewports (e.g. mobile landscape) instead of running off-screen below
       50% + 208px - keeps the same position everywhere else. */
    top: min(calc(50% + 208px), calc(100% - 58px));
    left: 50%;
    transform: translateX(-50%);
    padding: 11px 46px;
    font-size: 15px;
    letter-spacing: 4px;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    z-index: 400;
    background: rgba(5, 2, 2, 0.80);
    color: rgba(172, 144, 82, 0.80);
    border: 1px solid rgba(140, 92, 18, 0.44);
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(75, 28, 5, 0.28), inset 0 0 10px rgba(0,0,0,0.52);
    transition: all 0.3s ease;
    pointer-events: all;
    touch-action: manipulation;
    min-width: 230px;
}

#mainMenuBtn:hover {
    background: rgba(16, 5, 4, 0.93);
    border-color: rgba(175, 118, 26, 0.68);
    box-shadow: 0 0 22px rgba(118, 46, 8, 0.42), inset 0 0 10px rgba(0,0,0,0.36);
    color: rgba(208, 176, 105, 0.95);
}

/* --- GIAO DIỆN PAUSE & RESUME --- */
#pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 5, 15, 0.85);
    /* Nền tối mờ ám xanh */
    backdrop-filter: blur(5px);
    display: none;
    /* Mặc định ẩn */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Sits above sigil-pick-overlay (9999999) so tab-away auto-pause during
       sigil pick still shows a clickable resume screen. Mute button is bumped
       higher (see index.html) so it stays accessible while paused. */
    z-index: 99999998;
}

#pause-title {
    color: #00ffff;
    font-size: 50px;
    letter-spacing: 5px;
    text-shadow: 0 0 20px #00ffff;
    margin-bottom: 10px;
}

#pause-subtitle {
    color: #cbd5e1;
    font-size: 20px;
    margin-bottom: 40px;
    font-family: 'Courier New', Courier, monospace;
}

#resume-btn {
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    background: transparent;
    color: #fff;
    border: 2px solid #00ffff;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3), inset 0 0 15px rgba(0, 255, 255, 0.2);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#resume-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.4);
    transform: scale(1.05);
}

#pause-main-btns {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

/* View Current Position: top-right corner of the pause screen. Hides
   #pause-overlay (not shown here, see js/input.js) so the frozen game scene
   underneath becomes visible while gamePaused stays true - Esc (desktop)
   toggles the same thing this button does. */
#view-position-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 8px 16px;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #00e5ff;
    background: rgba(0, 20, 40, 0.7);
    border: 1.5px solid rgba(0, 229, 255, 0.4);
    border-radius: 20px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
    transition: all 0.25s;
    z-index: 1;
}

#view-position-btn:hover {
    background: rgba(0, 229, 255, 0.15);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.3);
}

/* Position-peek: covers the screen (so a click/tap anywhere returns to the
   pause screen) but paints nothing itself, letting the frozen game scene
   show through untouched. Same z-index tier as #pause-overlay - only one
   of the two is ever displayed at a time. */
#position-peek-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    cursor: pointer;
    z-index: 99999998;
}

#position-peek-hint {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    letter-spacing: 1px;
    color: #cbd5e1;
    background: rgba(0, 5, 15, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 20px;
    backdrop-filter: blur(6px);
    pointer-events: none;
    white-space: nowrap;
}

/* Yog-Sothoth domain: small floating reminder that arrows teleport while
   the domain is open. Same pill language as #position-peek-hint, kept
   smaller/quieter since it has to hover over live gameplay (enemies,
   bullets, the painted backdrop) rather than a paused, frozen screen. */
#yog-teleport-hint {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: rgba(203, 213, 225, 0.85);
    background: rgba(0, 5, 15, 0.45);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 16px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    white-space: nowrap;
    display: none;
    z-index: 50;
    transition: opacity 0.3s;
}

#main-menu-btn {
    padding: 15px 32px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    background: transparent;
    color: rgba(0, 255, 255, 0.6);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.08);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#main-menu-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.55);
    box-shadow: 0 0 18px rgba(0, 255, 255, 0.25);
    color: #00ffff;
    transform: scale(1.03);
}

/* Misclick guard shown in front of both Main Menu buttons, see
   js/input.js's _showConfirmMainMenu. One tier above #pause-overlay so it
   still shows on top of the pause screen. */
#confirmMenuOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 5, 15, 0.75);
    backdrop-filter: blur(3px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999999;
}

#confirmMenuBox {
    background: rgba(3, 10, 20, 0.92);
    border: 1.5px solid rgba(0, 229, 255, 0.4);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 150, 200, 0.25);
    padding: 28px 32px;
    max-width: min(360px, calc(100% - 32px));
    text-align: center;
}

#confirmMenuText {
    color: #cbd5e1;
    font-family: 'Courier New', Courier, monospace;
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 22px;
}

#confirmMenuBtns {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

#confirmMenuYes, #confirmMenuNo {
    padding: 10px 28px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    background: transparent;
    border-radius: 5px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#confirmMenuYes {
    color: #fff;
    border: 2px solid #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3), inset 0 0 15px rgba(0, 255, 255, 0.2);
}

#confirmMenuYes:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.4);
    transform: scale(1.05);
}

#confirmMenuNo {
    color: rgba(203, 213, 225, 0.75);
    border: 2px solid rgba(203, 213, 225, 0.3);
}

#confirmMenuNo:hover {
    background: rgba(203, 213, 225, 0.1);
    border-color: rgba(203, 213, 225, 0.55);
    color: #e2e8f0;
    transform: scale(1.05);
}

/* Thanh Loading */
#resume-progress-container {
    width: 400px;
    height: 10px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 5px;
    margin-top: 30px;
    display: none;
    /* Mặc định ẩn */
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#resume-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9, #00ffff);
    box-shadow: 0 0 10px #00ffff;
}