:root {
    --shell-gold: #d8bb7b;
    --reef-cyan: #4fd6d8;
    --deep-water: #070f1f;
    --mid-water: #11223f;
    --foam: #e4fbff;
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    background:
        url("Background.jpg") no-repeat center center fixed,
        radial-gradient(circle at 12% 18%, rgba(79, 214, 216, 0.24), transparent 34%),
        radial-gradient(circle at 80% 12%, rgba(216, 187, 123, 0.2), transparent 30%),
        radial-gradient(circle at 70% 78%, rgba(30, 76, 132, 0.45), transparent 45%),
        linear-gradient(160deg, #02060f 0%, #081326 40%, #0f2140 100%);
    background-size: cover, auto, auto, auto, auto;
    background-blend-mode: screen, screen, overlay, multiply;
    color: #d9efff;
    font-family: "Space Mono", monospace;
}

.window-top-bar{font-family:'Lexend Giga',sans-serif;background-color:#1e1e1e;display:flex;align-items:center;padding:6px 16px;color:#d6cb72;border-bottom:2px solid #d6cb72;width:100%;position:fixed;top:0;left:0;z-index:9999;height:42px;box-sizing:border-box}
.window-title{font-size:16px;margin-right:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.window-controls{display:flex;gap:8px;align-items:center}
.window-controls button{background-color:#1e1e1e;color:#d6cb72;border:1px solid #d6cb72;font-size:16px;padding:0;height:30px;width:30px;display:flex;justify-content:center;align-items:center;border-radius:3px;cursor:pointer;transition:background-color .2s ease,color .2s ease}
.window-controls button:hover{background-color:#c67cf4;color:#fff}
.window-controls button.mute{background:transparent;color:#04ef04;border:none}
.window-controls button.mute:hover{color:#ff4500}
.window-controls .volume-slider{-webkit-appearance:none;appearance:none;width:120px;height:6px;border-radius:10px;background:linear-gradient(90deg,#dfcc6c,#c67cf4);box-shadow:inset 0 1px 4px rgba(255,255,255,0.2),0 0 5px rgba(198,124,244,0.4);outline:none;transition:background .3s ease,box-shadow .3s ease}
.window-controls .volume-slider::-webkit-slider-thumb{-webkit-appearance:none;height:16px;width:16px;border-radius:50%;background:#fff;border:2px solid #d6cb72;box-shadow:0 0 5px #d6cb72,0 0 2px #fff;cursor:pointer;transition:transform .2s ease,box-shadow .2s ease}
.window-controls .volume-slider::-webkit-slider-thumb:hover{transform:scale(1.2);box-shadow:0 0 8px #d6cb72,0 0 4px #fff}
.window-controls .volume-slider::-moz-range-thumb{height:16px;width:16px;border-radius:50%;background:#fff;border:2px solid #d6cb72;box-shadow:0 0 5px #d6cb72,0 0 2px #fff;cursor:pointer;transition:transform .2s ease,box-shadow .2s ease}
.window-controls .volume-slider::-moz-range-thumb:hover{transform:scale(1.2);box-shadow:0 0 8px #d6cb72,0 0 4px #fff}

@media (max-width:600px){
    .window-top-bar{padding:6px 10px;height:auto;min-height:42px;flex-wrap:wrap;gap:8px}
    .window-title{font-size:14px;width:100%}
    .window-controls{width:100%;justify-content:flex-end;flex-wrap:wrap}
    .window-controls button{height:28px;width:28px;font-size:14px}
    .window-controls .volume-slider{width:90px}
}

#game-wrapper {
    min-height: calc(100vh - 42px);
    padding: 58px 14px 16px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#game-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, transparent 24%, rgba(79, 214, 216, 0.08) 35%, transparent 46%),
        linear-gradient(220deg, transparent 42%, rgba(216, 187, 123, 0.1) 54%, transparent 64%);
    animation: tideSweep 8s linear infinite;
}

@keyframes tideSweep {
    from { transform: translateX(0); }
    to { transform: translateX(-160px); }
}

#console-frame {
    width: min(96vw, 1130px);
    padding: 16px 18px 14px;
    border-radius: 14px;
    background: linear-gradient(155deg, rgba(9, 20, 38, 0.8), rgba(15, 36, 67, 0.84));
    border: 1px solid rgba(79, 214, 216, 0.5);
    box-shadow: inset 0 0 0 1px rgba(216, 187, 123, 0.34), 0 16px 28px rgba(0, 0, 0, 0.48);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

#console-frame h1 {
    margin: 0 0 12px;
    font-family: "Marcellus", serif;
    font-size: clamp(32px, 4.8vw, 58px);
    color: var(--foam);
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(79, 214, 216, 0.65), 0 0 20px rgba(216, 187, 123, 0.3);
}

#emulator-screen {
    width: min(100%, calc((100vh - 250px) * 1.75));
    aspect-ratio: 1344 / 768;
    max-height: calc(100vh - 250px);
    border: 2px solid rgba(79, 214, 216, 0.56);
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(216, 187, 123, 0.4), 0 0 26px rgba(79, 214, 216, 0.24);
    background: radial-gradient(circle at 50% 0%, rgba(66, 111, 180, 0.18), rgba(8, 17, 31, 0.85));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    image-rendering: optimizeSpeed;
    -webkit-interpolation-mode: nearest-neighbor;
    -ms-touch-action: none;
    touch-action: none;
}

.gm4html5_div_class {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
}

div.gm4html5_login {
    padding: 20px;
    position: absolute;
    border: solid 2px #0f1f35;
    background-color: #143154;
    color: #dff8ff;
    border-radius: 10px;
    box-shadow: #050c17 14px 14px 32px;
}

div.gm4html5_cancel_button {
    float: right;
}

div.gm4html5_login_button {
    float: left;
}

div.gm4html5_login_header {
    text-align: center;
}

.credits-button-container {
    position: fixed;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    margin: 0;
    padding: 0;
    z-index: 10;
}

.credits-button {
    border: 1px solid rgba(216, 187, 123, 0.6);
    background: linear-gradient(145deg, rgba(7, 20, 40, 0.95), rgba(16, 44, 79, 0.9));
    color: #e9f7ff;
    font-family: "Space Mono", monospace;
    font-size: 15px;
    letter-spacing: 1.1px;
    padding: 11px 20px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(79, 214, 216, 0.28);
}

.credits-overlay {
    background:
        radial-gradient(circle at 8% 16%, rgba(79, 214, 216, 0.22), transparent 35%),
        radial-gradient(circle at 84% 14%, rgba(216, 187, 123, 0.22), transparent 34%),
        linear-gradient(170deg, rgba(5, 11, 22, 0.99), rgba(8, 20, 37, 0.98));
    position: fixed;
    inset: 0;
    z-index: 9999;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.credits-overlay::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.credits-overlay::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-radial-gradient(circle at 20% 30%, rgba(95, 235, 236, 0.1) 0 1px, transparent 1px 28px);
    opacity: 0.22;
    animation: bubbleDrift 16s linear infinite;
}

@keyframes bubbleDrift {
    from { transform: translateY(0); }
    to { transform: translateY(-120px); }
}

.credits-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.credits-title {
    margin-bottom: 34px;
    font-size: clamp(38px, 7vw, 58px);
    letter-spacing: 3px;
    color: #f0fdff;
    font-family: "Marcellus", serif;
    text-shadow: 0 0 14px rgba(79, 214, 216, 0.55), 0 0 24px rgba(216, 187, 123, 0.38);
}

.credits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    max-width: 980px;
    width: 100%;
}

.credits-section {
    background: linear-gradient(160deg, rgba(9, 23, 43, 0.84), rgba(14, 35, 65, 0.86));
    border: 1px solid rgba(79, 214, 216, 0.44);
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(216, 187, 123, 0.3);
    padding: 22px;
}

.credits-section h3 {
    margin: 0 0 12px;
    color: #7fe9ea;
    font-family: "Marcellus", serif;
    font-size: 28px;
    letter-spacing: 1px;
}

.credits-section ul {
    margin: 0;
    padding-left: 18px;
}

.credits-section li,
.credits-footer {
    color: #e8f4ff;
    font-family: "Space Mono", monospace;
    font-size: 24px;
    line-height: 1.32;
}

.credits-close {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: 1px solid rgba(216, 187, 123, 0.45);
    background: rgba(8, 19, 36, 0.95);
    color: #eafcff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.credits-close:hover {
    background: rgba(26, 48, 75, 0.95);
    color: #ffffff;
}

.credits-footer {
    margin-top: 42px;
    text-align: center;
    color: rgba(232, 244, 255, 0.9);
}

@media (max-width: 900px) {
    #game-wrapper {
        padding: 96px 12px 96px;
    }

    #console-frame {
        width: 100%;
    }

    #emulator-screen {
        width: 100%;
        max-height: calc(100vh - 320px);
    }
}
