body { margin: 0; background: #111; color: white; font-family: 'Hiragino Kaku Gothic ProN', sans-serif; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
        
        #game-container {
            position: relative;
            width: 1000px;
            height: 600px;
            margin: 0 auto;
            border-left: 10px solid #555; 
            box-shadow: 0 0 20px black;
            background-color: #000;
            overflow: hidden;
        }

        canvas { display: block; position: absolute; top: 0; left: 0; z-index: 2; }
        
        #bg-layer {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background-size: cover; background-position: center;
            opacity: 0.6; 
            z-index: 0;
        }
        #bg-filter {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.6); 
            z-index: 1;
        }

        #ui { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 800px; pointer-events: none; text-shadow: 2px 2px 0 #000; z-index: 10; }
        .hp-bar-wrapper { width: 100%; height: 25px; position: relative; }
.hp-bar-bg { width: 100%; height: 25px; background: #333; border: 2px solid #fff; border-radius: 12px; overflow: hidden; position: relative; }
        #hp-bar { width: 100%; height: 100%; background: linear-gradient(to right, #ff4500, #32cd32); transition: width 0.2s; }
        #barrier-bar { position: absolute; top:0; left:0; width: 0%; height: 100%; background: rgba(0, 191, 255, 0.7); z-index: 2; transition: width 0.2s; }
        #hp-text { position: absolute; top: 0; width: 100%; text-align: center; line-height: 25px; font-weight: bold; font-size: 14px; z-index: 5; }
        #wall-bomb-info { position: absolute; top: 0; left: calc(100% + 8px); height: 25px; line-height: 25px; font-weight: bold; font-size: 18px; color: #fff; background: rgba(0,0,0,0.35); padding: 0 8px; border-radius: 8px; display: flex; align-items: center; gap: 6px; }
        #wall-bomb-info .bomb-icon{ font-size:18px; }
        #wall-bomb-count{ font-size:16px; }
        #status-info { display: flex; justify-content: space-between; margin-top: 5px; font-size: 18px; font-weight: bold; }
        
        #skill-panel {
           position: absolute; top: 10px; left: 10px;
           display: flex; 
           flex-direction: column;
           gap: 5px;
           z-index: 20;
           pointer-events: none;
       }
        .skill-slot {
           position: relative; 
           width: 40px; height: 40px;
           border-radius: 8px; border: 2px solid #fff;
           background: #000; overflow: hidden;
           box-shadow: 0 0 5px #000;
       }
        .skill-lv{ position:absolute; right:2px; bottom:0px; font-size:12px; font-weight:bold; color:#ffb6c1; text-shadow:1px 1px 0 #000; z-index:30; }

        /* Sprite Sheet: 4 cols x 3 rows */
        .icon-base {
            width: 100%; height: 100%;
            background-image: url('../assets/img/icons.png');
            background-size: 400% 300%; 
            background-repeat: no-repeat;
        }
        
        /* Row 1 */
        .icon-0 { background-position: 0% 0%; }     /* Anoko */
        .icon-1 { background-position: 33.33% 0%; } /* Kanimoge */
        .icon-2 { background-position: 66.66% 0%; } /* Dokumoge */
        .icon-3 { background-position: 100% 0%; }   /* Seimoge */
        
        /* Row 2 */
        .icon-4 { background-position: 0% 50%; }     /* Burumoge */
        .icon-5 { background-position: 33.33% 50%; } /* Pikasan */
        .icon-6 { background-position: 66.66% 50%; } /* Yamimoge */
        .icon-7 { background-position: 100% 50%; }   /* Ebinaifu */
        
        /* Row 3 */
        .icon-8 { background-position: 0% 100%; }     /* Aimoge (Player) */
        .icon-9 { background-position: 33.33% 100%; } /* Shiran */
        .icon-10 { background-position: 66.66% 100%; }/* Burukani */
        .icon-11 { background-position: 100% 100%; }  /* Buff/Wall */

        .cooldown-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: conic-gradient(rgba(0,0,0,0.8) 0% 100%);
        }

        #loading { position: fixed; top:0; left:0; width:100%; height:100%; background:#000; display:flex; align-items:center; justify-content:center; z-index: 200; font-size:24px;}

        .overlay-screen {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.85);
            display: none; flex-direction: column;
            align-items: center; justify-content: center;
            z-index: 150; pointer-events: all;
            text-align: center;
        }
        .overlay-title { font-size: 40px; color: #ffb6c1; margin-bottom: 20px; font-weight: bold; }
        .overlay-desc { font-size: 18px; color: white; line-height: 1.8; margin-bottom: 20px; white-space: normal; }
        .btn-start {
            padding: 15px 40px; font-size: 24px; font-weight: bold;
            background: #ff4500; color: white; border: 2px solid white;
            border-radius: 30px; cursor: pointer; transition: transform 0.1s;
        }
        .btn-start:hover { transform: scale(1.1); background: #ff6347; }

        #upgrade-screen { 
            position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
            background: rgba(0,0,0,0.95); display: none; flex-direction: column; 
            align-items: center; justify-content: center; z-index: 100; pointer-events: all;
        }
        .card-container { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; max-width: 900px; }
        .upgrade-card { 
            background: #222; border: 2px solid #555; padding: 8px; 
            width: 140px; cursor: pointer; text-align: center; border-radius: 10px;
            transition: transform 0.2s, background 0.2s;
            display: flex; flex-direction: column; align-items: center;
            position: relative; overflow: hidden;
            box-shadow: 0 4px 8px rgba(0,0,0,0.5);
        }
        .upgrade-card:hover { background: #444; transform: scale(1.05); border-color: #ffb6c1; }
        .upgrade-card.selected { background: #444; transform: scale(1.05); border-color: #ffb6c1; box-shadow: 0 0 0 4px rgba(255,182,193,0.35); }
        .upgrade-card.evo { border-color: #ffd700; background: #332b00; }

        #message-overlay {
            position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
            padding: 30px 50px;
            background: rgba(0, 0, 0, 0.95);
            border: 4px solid #fff;
            border-radius: 20px;
            box-shadow: 0 0 20px #ff00de;
            text-align: center; font-size: 28px; font-weight: bold;
            color: #fff;
            pointer-events: none; z-index: 160;
            display: none;
            opacity: 0; transition: opacity 0.3s;
        }

        .card-icon {
            width: 60px; height: 60px;
            margin-bottom: 5px;
            border-radius: 50%;
            border: 2px solid #888;
            background-color: #000;
        }

        .card-title { font-size: 14px; font-weight: bold; margin-bottom: 4px; min-height: 32px; display:flex; align-items:center; justify-content:center; }
        .card-desc { font-size: 11px; color: #ccc; margin-bottom: 5px; height: 50px; overflow: hidden; line-height: 1.2; }
        .card-lv { font-size: 14px; font-weight: bold; color: #ffb6c1; }
        .evo-text { color: #ffd700; text-shadow: 0 0 5px #ff4500; }
        
        .global-card { border-color: #87ceeb; }
        .upgrade-actions { display:flex; gap:12px; margin-top: 14px; }
        .upgrade-btn { padding: 10px 18px; font-size: 18px; font-weight: bold; border-radius: 12px; border: 2px solid #fff; background: #333; color: #fff; cursor: pointer; }
        .upgrade-btn:hover { background: #555; }
        .upgrade-btn:disabled { opacity: 0.35; cursor: default; }

        
    
        /* Bonus sheet overlay (every 10 waves) */
        #bonus-overlay{
            position:absolute; top:0; left:0; width:100%; height:100%;
            background: rgba(0,0,0,0.88);
            display:none; flex-direction:column;
            align-items:center; justify-content:center;
            z-index: 170; pointer-events: all;
            text-align:center;
        }
        #bonus-title{ font-size:28px; font-weight:bold; margin-bottom:10px; color:#ffb6c1; }
        #bonus-img{
            width: 645px; height: 360px;
            border: 4px solid #fff;
            border-radius: 18px;
            box-shadow: 0 0 18px rgba(255,182,193,0.35);
            background-image: url('../assets/img/icons.png');
            background-size: 200% 400%;
            background-repeat:no-repeat;
            background-position: 0% 0%;
            margin: 8px 0 14px;
        }
        #bonus-msg{ font-size:18px; margin-bottom:14px; white-space:pre-wrap; }


/* Game Over: upgrade list layout */
.go-summary{
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 18px;
  row-gap: 4px;
  margin-bottom: 12px;
}
.go-upgrades-title{
  margin: 6px 0 10px;
  font-weight: bold;
}
.upgrade-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 14px;
  max-height: 40vh;
  overflow: auto;
  padding-right: 6px;
}
.upgrade-item{
  font-size: 16px;
  line-height: 1.35;
  word-break: break-word;
  opacity: 0.95;
}
@media (max-width: 700px){
  .go-summary{ grid-template-columns: 1fr; }
  .upgrade-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
