/* 元のHTMLの<style>タグの内容をここにすべてコピー */
body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    background-color: #f0f0f0;
    touch-action: none;
    overflow: hidden;
    height: 100vh;
}
#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 2px;
    width: 100%;
    max-width: 400px;
    max-height: calc(100vh - 10px); /* 少し調整 */
}
#game-area {
    width: 360px;
    height: 440px;
    border: 1px solid black;
    position: relative;
    background-image: url('haikei.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}
#game-canvas {
    width: 100%;
    height: 100%;
}
.path {
    fill: none;
    stroke: #B8860B; 
    stroke-width: 20;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.tower-preview {
    opacity: 0.7;
    pointer-events: none;
}
#ui-area {
    margin-top: 3px;
    padding: 3px;
    background-color: #ddd;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: calc(100% - 6px);
    box-sizing: border-box;
}
.unit-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    width: 100%;
}
.unit-button {
    width: 65px;
    height: 68px;
    border: 1px solid #888;
    background-color: #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    text-align: center;
    font-size: 9px;
    padding-top: 2px;
    box-sizing: border-box;
}
.unit-button:active {
    cursor: grabbing;
    background-color: #ccc;
}
.unit-button svg {
    width: 28px;
    height: 28px;
    margin-bottom: 1px;
}
.unit-button svg image {
    width: 100%;
    height: 100%;
}
#message-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    z-index: 100;
    display: none;
    width: 80%;
    box-sizing: border-box;
}
#message-area button {
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 8px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
}
#start-button-container {
     position: absolute;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
     z-index: 101;
}
#initial-start-button {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: #2196F3;
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.enemy {}
.tower {}
.range-indicator { fill: rgba(100,100,100,0.15); stroke: rgba(50,50,50,0.3); stroke-width:1; pointer-events: none; }

.slowed-effect { filter: hue-rotate(90deg) brightness(1.2); }
.poisoned-effect { filter: hue-rotate(-60deg) saturate(1.5) brightness(0.9); }

.tower.selected-for-action {
    filter: drop-shadow(0 0 3px yellow) drop-shadow(0 0 2px yellow);
}

#tower-action-popup {
    display: none;
    flex-direction: column;
    align-items: center;
    position: absolute;
    background-color: rgba(255,255,255,0.95);
    border: 1px solid #333;
    border-radius: 5px;
    padding: 6px;
    z-index: 150;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    gap: 5px;
}
.popup-button-group {
    display: flex;
    gap: 5px;
}
#tower-action-popup button {
    background: none;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 18px;
    cursor: pointer;
    padding: 3px 5px;
    line-height: 1;
}
#tower-action-popup button:hover:not(:disabled) { background-color: #e0e0e0; }
#tower-action-popup button:disabled { cursor: not-allowed; opacity: 0.5; }
#tower-level-display {
    font-size: 11px;
    color: #333;
    margin-bottom: 2px;
}
.mini-boss {
    filter: brightness(1.2) saturate(1.5);
}

.game-overlay-ui {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 12px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.7);
    z-index: 10;
}
#top-left-info {
    top: 5px;
    left: 5px;
}
#bottom-left-info {
    bottom: 5px;
    left: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#top-right-controls {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    z-index: 10;
}
#top-right-controls button {
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid #888;
    color: #333;
    border-radius: 3px;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
 #top-right-controls button:hover:not(:disabled) {
    background-color: rgba(224, 224, 224, 0.8);
 }

/* パス編集用スタイル */
.edit-point {
    fill: cyan;
    stroke: navy;
    stroke-width: 1.5px;
    cursor: grab;
}
.edit-point:active {
    cursor: grabbing;
}
.edit-point.selected {
    fill: magenta;
}
.edit-point.start-point {
    fill: lightgreen;
}
.edit-point.end-point {
    fill: salmon;
}