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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.app {
    width: min(1200px, 100%);
}

.back-home-link {
    display: inline-block;
    margin-bottom: 15px;
    color: #4a9eff;
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(74, 158, 255, 0.1);
    border-radius: 10px;
    font-size: 0.9em;
    transition: background 0.3s ease, transform 0.2s ease;
}

.back-home-link:hover {
    background: rgba(74, 158, 255, 0.2);
    transform: translateX(-3px);
}

.game-notice {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(103, 232, 249, 0.15) 100%);
    border: 2px solid rgba(20, 184, 166, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.1);
}

.notice-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notice-icon {
    font-size: 1.5rem;
}

.notice-text {
    flex: 1;
    color: #ffffff;
    font-size: 0.9rem;
    line-height: 1.4;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 212, 255, 0.35);
    box-shadow: 0 0 30px rgba(0, 150, 255, 0.18);
    margin-bottom: 14px;
}

.brand-title {
    font-size: 1.6em;
    font-weight: 800;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.45);
}

.brand-subtitle {
    margin-top: 2px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.75);
}

.topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn {
    appearance: none;
    border: 1px solid rgba(0, 212, 255, 0.5);
    background: rgba(0, 212, 255, 0.12);
    color: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.btn:hover {
    transform: translateY(-1px);
    background: rgba(0, 212, 255, 0.18);
    border-color: rgba(0, 212, 255, 0.75);
}

.btn:active {
    transform: translateY(0px);
}

.btnSecondary {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
}

.layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 14px;
    align-items: start;
}

@media (max-width: 980px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

.hud {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 0 22px rgba(0, 150, 255, 0.14);
}

.panel-title {
    font-weight: 900;
    color: rgba(0, 212, 255, 0.95);
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.statsGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}

.stat {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.statLabel {
    font-size: 0.78em;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 4px;
}

.statValue {
    font-size: 1.15em;
    font-weight: 900;
}

.muted {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    margin-left: 6px;
    font-size: 0.9em;
}

.legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 10px;
    font-size: 0.95em;
}

.legendRow {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.85);
}

.legendIcon {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.06);
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
}

/* Start: green dot */
.iconStart::before {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 999px;
    background: rgba(0, 255, 0, 0.95);
}

/* Goal: magenta diamond */
.iconGoal::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 10px;
    background: rgba(255, 0, 255, 0.95);
    transform: translate(-50%, -50%) rotate(45deg);
}

/* Hyperdot: yellow ring + dot */
.iconHyper::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 11px;
    height: 11px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 0, 0.95);
    transform: translate(-50%, -50%);
}
.iconHyper::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 0, 0.95);
    transform: translate(-50%, -50%);
}

/* Spike: X */
.iconSpike::before,
.iconSpike::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 2px;
    background: rgba(255, 255, 255, 0.95);
    transform-origin: center;
}
.iconSpike::before { transform: translate(-50%, -50%) rotate(45deg); }
.iconSpike::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* Switch: cyan square */
.iconSwitch::before {
    content: "";
    position: absolute;
    inset: 4px;
    background: rgba(0, 255, 255, 0.95);
    border-radius: 4px;
}

/* Door: red bar */
.iconDoor::before {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    top: 50%;
    height: 4px;
    background: rgba(255, 0, 0, 0.9);
    transform: translateY(-50%);
    border-radius: 6px;
}

/* Moving door: dashed orange bar */
.iconDoorMoving::before {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    top: 50%;
    height: 4px;
    transform: translateY(-50%);
    border-radius: 6px;
    background: repeating-linear-gradient(
        90deg,
        rgba(255, 140, 0, 0.95) 0px,
        rgba(255, 140, 0, 0.95) 5px,
        rgba(255, 140, 0, 0.0) 5px,
        rgba(255, 140, 0, 0.0) 8px
    );
}

/* Oil glob: purple blob */
.iconOil::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 9px 9px 10px 10px;
    background: rgba(136, 68, 255, 0.95);
    transform: translate(-50%, -55%);
}
.iconOil::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 68%;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(136, 68, 255, 0.95);
    transform: translateX(-50%);
}

/* Bomb: yellow circle + fuse */
.iconBomb::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 55%;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 204, 0, 0.95);
    transform: translate(-50%, -50%);
}
.iconBomb::after {
    content: "";
    position: absolute;
    left: 60%;
    top: 30%;
    width: 9px;
    height: 2px;
    background: rgba(255, 255, 255, 0.95);
    transform: rotate(-35deg);
    border-radius: 2px;
}

.control-info {
    text-align: left;
    font-size: 0.95em;
}

.control-info p {
    margin: 6px 0;
}

.stage {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
}

#gameCanvas {
    border: 3px solid #00d4ff;
    border-radius: 5px;
    background: #0a0a1a;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    display: block;
    margin: 0 auto;
    max-width: 100%;
}

.statusWrap {
    width: 100%;
    max-width: 800px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 212, 255, 0.25);
}

.status {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    min-height: 40px;
}

.status.win {
    color: #00ff00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.status.lose {
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.status.paused {
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

/* Splash Screen Styles */
.splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
}

.splash-overlay.hidden {
    display: none;
}

.splash-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid #00d4ff;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 212, 255, 0.4);
}

.splash-title h1 {
    font-size: 2.8rem;
    color: #00d4ff;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
    margin-bottom: 10px;
}

.splash-subtitle {
    font-size: 1.2rem;
    color: #67e8f9;
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.splash-character {
    font-size: 5rem;
    margin: 20px 0;
    animation: spin 4s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.splash-description {
    color: #b9f2ff;
    font-size: 1rem;
    line-height: 1.7;
    margin: 20px 0;
}

.splash-description p {
    margin: 10px 0;
}

.splash-features {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 25px 0;
}

.splash-feature {
    background: rgba(0, 212, 255, 0.15);
    border: 2px solid rgba(0, 212, 255, 0.4);
    border-radius: 25px;
    padding: 10px 18px;
    color: #00d4ff;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.splash-feature:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

.splash-btn {
    margin-top: 25px;
    padding: 16px 45px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #00d4ff 0%, #0ea5e9 100%);
    color: #0a0a1a;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.5);
}

.splash-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.7);
}

/* Touch Controls */
.touch-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    flex-direction: column;
    gap: 10px;
}

.touch-row {
    display: flex;
    gap: 10px;
}

.touch-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.85);
    border: 3px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
    transition: transform 0.1s ease;
}

.touch-btn:active, .touch-btn.active {
    transform: scale(0.9);
    background: rgba(0, 212, 255, 1);
}

@media (max-width: 768px) {
    .touch-controls {
        display: flex;
    }
    
    .splash-content {
        padding: 25px;
        margin: 20px;
        max-width: 90%;
    }

    .splash-title h1 {
        font-size: 2rem;
    }

    .splash-character {
        font-size: 3.5rem;
    }

    .splash-feature {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .splash-btn {
        padding: 14px 35px;
        font-size: 1rem;
    }
}
