:root {
    --primary: #00d2ff;
    --success: #00ff87;
    --danger: #ff0055;
    --bg-glass: rgba(10, 25, 50, 0.65);
    --border-glow: 2px solid rgba(0, 210, 255, 0.5);
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    user-select: none;
    background-color: #051020;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* 画面共通スタイル */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(2, 10, 20, 0.75);
    backdrop-filter: blur(8px);
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

.panel {
    background: var(--bg-glass);
    border: var(--border-glow);
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.2);
    border-radius: 20px;
    padding: 40px;
    color: white;
    text-align: center;
    max-width: 800px;
    width: 90%;
}

/* タイトル画面 */
.game-title {
    font-size: 4rem;
    margin: 0;
    background: linear-gradient(45deg, #00d2ff, #00ff87);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0,210,255,0.3);
}

.game-subtitle {
    font-size: 1.2rem;
    color: #a0c0d0;
    margin-bottom: 40px;
}

/* グリッドレイアウト（オプション＆ショップ） */
.grid-panel {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    text-align: left;
}

.settings-col, .shop-col {
    display: flex;
    flex-direction: column;
}

h2 {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    margin-top: 0;
    color: var(--primary);
}

.control-group {
    margin: 20px 0;
}

.control-group label {
    display: block;
    margin-bottom: 10px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

/* ショップアイテム */
.shop-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    max-height: 350px;
    padding-right: 10px;
}

.shop-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
}

.shop-item.active {
    border-color: var(--success);
    background: rgba(0, 255, 135, 0.05);
}

.shop-item h3 { margin: 0; font-size: 1.1rem; }
.shop-item p { margin: 0; font-size: 0.85rem; color: #aaa; }

/* ボタン */
.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 5px 0;
}

.btn-primary { background: linear-gradient(45deg, var(--primary), #00a2ff); color: white; font-size: 1.3rem; padding: 15px 40px;}
.btn-success { background: var(--success); color: #051020; }
.btn-danger { background: var(--danger); color: white; }
.btn-shop { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); padding: 8px 15px; font-size: 0.85rem; }
.btn-shop:disabled { background: #445566; color: #8899aa; cursor: default;}

.btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

/* HUD */
#hud {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    box-sizing: border-box;
    transition: opacity 0.3s ease;
}

.hud-top {
    display: flex;
    align-items: center;
    gap: 30px;
    background: var(--bg-glass);
    border: 1px solid rgba(0,210,255,0.2);
    padding: 15px 30px;
    border-radius: 50px;
    width: fit-content;
    pointer-events: auto;
}

.stat-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-group .label { font-size: 0.75rem; color: var(--primary); font-weight: bold; }
.stat-group .value { font-size: 1.8rem; font-weight: bold; color: white; }
.stat-group.poops .label { color: #ffaa00; }
.stat-group.poops .value { color: #ffcc00; }

.bar-container {
    display: flex;
    flex-direction: column;
    width: 150px;
}

.bar-label { font-size: 0.75rem; margin-bottom: 4px; color: #a0c0d0;}

.bar {
    width: 100%;
    height: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    overflow: hidden;
}

.fill {
    height: 100%;
    width: 0%;
    transition: width 0.2s ease;
}

.fill.exp { background: linear-gradient(90deg, var(--primary), #0072ff); }
.fill.satiety { background: linear-gradient(90deg, var(--success), #00b050); }

.hud-bottom {
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    display: flex;
    justify-content: space-between;
    background: rgba(0,0,0,0.4);
    padding: 5px 20px;
    border-radius: 10px;
}
#time-display { font-weight: bold; color: var(--primary); }

.hud-info {
    position: absolute;
    top: 100px;
    left: 20px;
    background: rgba(0, 20, 40, 0.6);
    border-left: 3px solid var(--primary);
    padding: 10px 15px;
    border-radius: 4px;
    color: #00d2ff;
    font-family: monospace;
    font-size: 1.1rem;
    pointer-events: none;
    text-shadow: 0 0 5px rgba(0, 210, 255, 0.5);
}

.death-panel {
    border: 2px solid var(--danger);
    box-shadow: 0 0 50px rgba(255, 0, 85, 0.5);
    background: rgba(40, 0, 10, 0.8);
}

.text-danger {
    color: var(--danger);
    font-size: 3rem;
    margin: 0 0 10px 0;
    text-shadow: 0 0 10px rgba(255,0,85,0.8);
}

/* 餓死寸前の警告アニメーション */
@keyframes flash-danger {
    0% { background: linear-gradient(90deg, #ff0055, #ff5500); width: 100%; }
    50% { background: transparent; width: 100%; }
    100% { background: linear-gradient(90deg, #ff0055, #ff5500); width: 100%; }
}
.fill.satiety-danger {
    animation: flash-danger 0.5s infinite;
}
.label-danger { color: #ff0055 !important; font-weight: bold; }

.audio-settings {
    background: rgba(0,0,0,0.5);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: left;
}
.audio-settings label {
    display: block;
    margin-bottom: 10px;
    color: #fff;
    font-size: 1.1rem;
}
.audio-settings input[type="range"] {
    width: 100%;
    margin-top: 5px;
}

.shop-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    height: 110px; /* 高さを固定 */
}
.btn-shop {
    width: 130px; /* 幅を固定してズレを防ぐ */
    font-weight: bold;
    transition: all 0.2s;
}
.btn-shop:disabled {
    background: #555;
    color: #aaa;
    border-color: #444;
}