body {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #00ff41;
    font-family: 'Share Tech Mono', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    /* RESPONSIVE CONTAINER (見切れ修正完了版) */
}

#game-container {
    position: relative;
    width: 95vw;
    height: 125vw;
    max-width: 480px;
    max-height: 750px;
    /* ハッキング画面分を考慮して高さを確保 */
    background: #000;
    border: 2px solid #00ff41;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
    overflow: hidden;
    /* Canvas外は隠すが、内部要素は収める */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* UI OVERLAYS */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    z-index: 150;
    text-align: center;
    padding: 20px;
}

#title-logo {
    font-size: clamp(1.5rem, 8vw, 2.5rem);
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 0 10px #00ff41;
    letter-spacing: -1px;
    color: #00ff41;
}

#title-logo span {
    display: block;
    font-size: 0.8rem;
    color: #008f11;
    letter-spacing: 2px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 80%;
}

button {
    background: rgba(0, 40, 0, 0.5);
    color: #00ff41;
    border: 1px solid #00ff41;
    padding: 12px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    text-transform: uppercase;
}

button:hover {
    background: rgba(0, 255, 65, 0.2);
    box-shadow: 0 0 10px #00ff41;
}

/* HUD */
#side-hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 100;
    font-size: 0.7rem;
}

.stats-panel {
    background: rgba(0, 20, 0, 0.8);
    padding: 5px 10px;
    border-left: 3px solid #00ff41;
}

#hp-container {
    width: 80px;
    height: 6px;
    background: #002200;
    margin-top: 4px;
}

#hp-bar {
    height: 100%;
    background: #00ff41;
    width: 100%;
    transition: 0.3s;
}

/* LOGS */
#log-container {
    position: absolute;
    bottom: 200px;
    left: 10px;
    width: 180px;
    pointer-events: none;
    z-index: 50;
}

.log-message {
    font-size: 0.6rem;
    color: #00ff41;
    background: rgba(0, 0, 0, 0.5);
    margin-bottom: 2px;
    padding: 2px 4px;
}

.log-message.hack {
    color: #0ff;
    border-left: 2px solid #0ff;
}

/* HACKING CONSOLE*/
#hacking-console {
    position: absolute;
    bottom: -250px;
    left: 0;
    width: 100%;
    height: 240px;
    background: #000c00;
    border-top: 3px solid #00ff41;
    z-index: 500;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 15px;
    box-sizing: border-box;
}

#hacking-console.active {
    bottom: 0;
}

.console-header {
    font-size: 0.8rem;
    color: #0ff;
    margin-bottom: 12px;
    border-bottom: 1px solid #003300;
}

#block-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.hack-block {
    display: flex;
    align-items: center;
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    min-width: 180px;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2);
}

.hack-block::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 24px;
    height: 10px;
    border-radius: 0 0 6px 6px;
    z-index: 10;
}

.hack-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    width: 24px;
    height: 6px;
    background: rgba(0, 0, 0, 0.2);
    clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}

.hack-block.motion {
    background: #4c97ff;
}

.hack-block.motion::after {
    background: #4c97ff;
}

.hack-block.control {
    background: #ffab19;
}

.hack-block.control::after {
    background: #ffab19;
}

.hack-block.looks {
    background: #9966ff;
}

.hack-block.looks::after {
    background: #9966ff;
}

.block-value-box {
    background: white;
    color: #333;
    padding: 2px 10px;
    border-radius: 12px;
    margin: 0 8px;
    font-size: 0.75rem;
}

/* MOBILE CONTROLS */
#mobile-controls {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 400;
}

#joystick-zone {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid #003300;
    border-radius: 50%;
    pointer-events: auto;
}

#shoot-btn,
#hack-btn {
    position: absolute;
    pointer-events: auto;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

#shoot-btn {
    bottom: 100px;
    right: 20px;
    background: rgba(0, 255, 65, 0.1);
    border: 2px solid #00ff41;
    color: #00ff41;
}

#hack-btn {
    bottom: 20px;
    right: 90px;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #0ff;
    color: #0ff;
}

.hidden {
    display: none !important;
}