/* puzzle_echo.css */

/* .containerクラスはcommon_styles.cssで定義されているため、ここでは不要 */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--c-border);
}

.game-stats {
    display: flex;
    gap: 10px;
}

.stats-box {
    padding: 10px 20px;
    background-color: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 6px;
    text-align: center;
    min-width: 90px;
}

.stats-box .label {
    font-size: 0.9em;
    color: var(--c-text-secondary);
}

.stats-box .value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--c-text-primary);
}

/* ▼▼▼ 変更箇所: レスポンシブレイアウトと追従ノブのスタイルを追加 ▼▼▼ */
#game-container {
    width: 100%;
    display: flex;
    flex-direction: column; /* モバイルは縦並びがデフォルト */
    gap: 20px;
    align-items: center; /* モバイルで中央揃え */
}

#game-canvas-wrapper {
    width: 100%;
    max-width: 500px; /* モバイルでの最大幅 */
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    border: 1px solid var(--c-border);
    border-radius: 4px;
}

#controls {
    width: 100%;
    max-width: 400px; /* モバイルでのGUIの最大幅 */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    background-color: var(--c-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--c-border);
}

.control-group label {
    font-weight: 600;
    color: var(--c-text-primary);
    display: block;
    text-align: center;
    margin-bottom: 10px;
}

.knob-wrapper {
    display: flex;
    justify-content: center;
}

.knob {
    position: relative;
    width: 100px;
    height: 100px;
    background-color: var(--c-surface);
    border: 2px solid var(--c-border);
    border-radius: 50%;
    cursor: pointer;
    transition: opacity 0.3s;
}

.knob-handle {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 20px;
    background-color: var(--c-accent);
    border-radius: 5px;
    transform-origin: 50% 45px;
}

/* モバイルでノブをドラッグ中、指に追従させるためのスタイル */
.knob.dragging {
    position: fixed; /* 画面に追従 */
    opacity: 0.7;    /* 半透明に */
    z-index: 1000;
    transform: translate(-50%, -50%); /* タッチ座標を中央に */
    pointer-events: none; /* ノブ自身がイベントを奪わないように */
}

.life-bar {
    width: 100%;
    height: 15px;
    background-color: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 15px;
    overflow: hidden;
}

.life-bar-fill {
    width: 100%;
    height: 100%;
    background-color: #28a745;
    border-radius: 15px;
    transition: width 0.1s linear, background-color 0.5s;
}

.button-panel .button.button-primary {
    background-color: var(--c-accent);
    color: var(--c-button-text-on-accent);
    border-color: var(--c-accent);
}

.button-panel .button.button-primary:hover:not(:disabled) {
    background-color: var(--c-link-hover);
    border-color: var(--c-link-hover);
}

#message-area {
    font-weight: bold;
    color: var(--c-accent);
    height: 2em;
    text-align: center;
    margin-top: 10px;
}

.stage-selection-container {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--c-border);
}

.stage-selection-container h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.stage-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.stage-btn {
    padding: 10px 15px;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    background-color: var(--c-surface);
    color: var(--c-text-primary);
    min-width: 120px;
    text-align: center;
}

.stage-btn:hover {
    background-color: var(--c-bg);
    border-color: var(--c-text-secondary);
}

.stage-btn.active {
    background-color: var(--c-accent);
    color: var(--c-button-text-on-accent);
    border-color: var(--c-accent);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stage-btn .clear-mark {
    color: #ffd700; /* ゴールド */
    margin-left: 5px;
    font-weight: bold;
}

.stage-btn .record {
    display: block;
    font-size: 0.8em;
    color: var(--c-text-secondary);
    margin-top: 4px;
    font-weight: normal;
}

.stage-btn.active .record {
    color: var(--c-button-text-on-accent);
    opacity: 0.9;
}

/* --- PC向けレイアウト (横並び) --- */
@media (min-width: 992px) {
    #game-container {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 30px;
    }

    #game-canvas-wrapper {
        flex: 1 1 600px; /* 可変幅、最大600px */
        max-width: 600px;
    }

    #controls {
        flex: 0 0 280px; /* 固定幅 */
        width: 280px;
    }
}
/* ▲▲▲ 変更箇所ここまで ▲▲▲ */
