body {
    background-color: #2c3e50;
    color: #ecf0f1;
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-wrapper {
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    border: 4px solid #34495e;
    border-radius: 8px;
    overflow: hidden;
    width: 800px;
    height: 400px;
    background-color: #222;
}

canvas {
    display: block;
}

.controls-hint {
    margin-top: 15px;
    font-size: 14px;
    color: #bdc3c7;
    text-align: center;
    line-height: 1.5;
}

/* =========================================
   ゲーム画面のUI（以前のコンパクトなデザイン・床密着）
   ========================================= */
#weapon-ui, #status-ui {
    position: absolute;
    bottom: 8px;
    background-color: rgba(0, 0, 0, 0.75);
    border: 1px solid #555;
    border-radius: 6px;
    pointer-events: none;
    box-sizing: border-box;
    z-index: 10;
}

/* 左下の武器UI */
#weapon-ui {
    left: 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 6px 12px;
    gap: 10px;
}

#weapon-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.weapon-text {
    text-align: left;
    display: flex;
    flex-direction: column;
}

#weapon-title {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

#weapon-name {
    font-size: 13px;
    font-weight: bold;
    color: #f1c40f;
}

#weapon-level {
    font-size: 11px;
    color: #ff9800;
    font-weight: bold;
}

#weapon-hint {
    font-size: 9px;
    color: #aaa;
    margin-top: 2px;
}

/* 右下のステータスUI */
#status-ui {
    right: 15px;
    padding: 5px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px; 
}

.status-row, .level-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.status-label {
    font-size: 10px;
    font-weight: bold;
    width: 30px;
    text-align: left;
    color: #ddd;
}

/* ゲージのデザイン */
.bar-bg {
    width: 80px;
    height: 5px;
    background-color: #333;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #111;
}

.bar-fill {
    height: 100%;
    transition: width 0.1s;
}

.hp-color { background-color: #2ecc71; }
.sp-color { background-color: #3498db; }
.ex-color { background-color: #f1c40f; }

/* ドットのデザイン */
.dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 50%;
    border: 1px solid #111;
}

.dot.on {
    background-color: #f1c40f;
    box-shadow: 0 0 4px #f1c40f;
}

#retry-btn {
    display: none; 
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 12px 30px;
    font-size: 22px;
    font-weight: bold;
    color: white;
    background-color: #34495e;
    border: 3px solid #fff;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
    z-index: 15;
}

#retry-btn:hover {
    background-color: #2c3e50;
    transform: translate(-50%, -50%) scale(1.05);
}

/* =========================================
   ホーム画面（カードUI）
   ========================================= */
#home-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(20, 25, 30, 0.95);
    color: white;
    z-index: 20; 
    overflow-y: auto;
    box-sizing: border-box;
}

#home-screen::-webkit-scrollbar { width: 8px; }
#home-screen::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
#home-screen::-webkit-scrollbar-thumb { background: #f1c40f; border-radius: 4px; }

.home-content {
    max-width: 650px;
    margin: 20px auto; 
    text-align: center;
}

#home-screen h1 {
    font-size: 32px;
    color: #f1c40f;
    margin-bottom: 15px;
    margin-top: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 2px;
}

.menu-section {
    background-color: rgba(44, 62, 80, 0.8);
    padding: 15px 25px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #7f8c8d;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

.menu-section h3 {
    margin-top: 0;
    border-bottom: 1px solid #7f8c8d;
    padding-bottom: 8px;
    color: #ecf0f1;
    font-size: 18px;
    letter-spacing: 1px;
}

.equip-category {
    margin-bottom: 15px;
    text-align: left;
}

.equip-category h4 {
    margin: 0 0 8px 0;
    color: #f39c12;
    font-size: 14px;
}

.equip-options {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.equip-label input[type="radio"] {
    display: none; 
}

.equip-card {
    background: #34495e;
    border: 2px solid #576574;
    border-radius: 6px;
    padding: 8px;
    width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.equip-card:hover {
    background: #465c71;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.equip-label input[type="radio"]:checked + .equip-card {
    border-color: #f1c40f;
    background: #233140;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
    transform: translateY(-2px);
}

.equip-card img {
    height: 35px;
    object-fit: contain;
    margin-bottom: 6px;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.6));
}

.equip-desc {
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    line-height: 1.3;
    color: #ecf0f1;
}

.equip-desc span {
    display: block;
    font-size: 10px;
    color: #bdc3c7;
    font-weight: normal;
    margin-top: 2px;
}

.stage-btn {
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background-color: #e74c3c;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
    margin-top: 5px;
    letter-spacing: 1px;
}

.stage-btn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.5);
}

.stage-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* --- ホーム画面 新レイアウト --- */
.home-container {
    display: flex;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
}

.home-sidebar {
    width: 220px;
    background: rgba(30, 40, 50, 0.95);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    border-right: 2px solid #555;
}

.home-title {
    text-align: center;
    font-size: 24px;
    margin-bottom: 30px;
    color: #f1c40f;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
}

.tab-btn {
    background: transparent;
    border: none;
    color: #ccc;
    padding: 15px 20px;
    text-align: left;
    font-size: 16px;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: 0.2s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: #f1c40f;
    border-left: 4px solid #f1c40f;
    font-weight: bold;
}

.home-main {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.stage-list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.system-btn {
    background: #34495e;
    color: white;
    border: 1px solid #555;
    padding: 15px 30px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 5px;
    margin-top: 20px;
}

.system-btn:hover {
    background: #2c3e50;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   モード切替タブ
   ========================================== */
.mode-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}
.mode-btn {
    padding: 8px 16px;
    background-color: #34495e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.mode-btn.active {
    background-color: #e74c3c;
}
.mode-btn:disabled {
    background-color: #555;
    color: #999;
    cursor: not-allowed;
}

/* ==========================================
   ステージ選択カード（画像風リッチUI）
   ========================================== */
.stage-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.stage-card {
    display: flex;
    width: 100%;
    max-width: 500px;
    height: 60px;
    background-color: #111;
    border-radius: 8px; /* 全体の角丸 */
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s, border-color 0.1s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.stage-card:hover:not(.locked) {
    transform: scale(1.02);
    border-color: #f1c40f; /* ホバー時に黄色い枠 */
}

.stage-card.locked {
    filter: grayscale(100%);
    opacity: 0.6;
    cursor: not-allowed;
}

.stage-card-main {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 15px;
    background-size: cover;
    background-position: center;
}

/* 背景画像を少し暗くして白い文字を読みやすくする */
.stage-card-main::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5); 
}

.stage-title {
    position: relative;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

.stage-rank {
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    border-left: 2px solid #222;
}

/* 各ランクの色設定（添付画像の通り） */
.rank-極忍 { background-color: #000000; color: #f1c40f; } /* 黒背景・黄文字 */
.rank-上忍 { background-color: #8b0000; color: #f1c40f; } /* 赤背景・黄文字 */
.rank-中忍 { background-color: #008000; color: #ffffff; } /* 緑背景・白文字 */
.rank-下忍 { background-color: #00008b; color: #ffffff; } /* 青背景・白文字 */
.rank-none { background-color: #333333; color: #777777; font-size: 14px; }

/* 未解放ステージの文字色を暗くする */
.stage-card.locked .stage-title {
    color: #888; 
}