/* -------------------------------------------
 * 基本のスタイル（既存のコードをベースに調整）
 * ------------------------------------------- */
body {
    font-family: 'ヒラギノ角ゴ ProN W3', 'Hiragino Kaku Gothic ProN', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #faffea; /* 明るい水色を背景に */
    color: #333;
}

h1, h3, h4 {
    color: #ff69b4; /* ポップなピンク */
    margin-top: 20px;
    margin-bottom: 10px;
}

h4 {
    margin: 0px; /* 既存のスタイルを維持 */
}

canvas {

}

/* -------------------------------------------
 * ヘッダー
 * ------------------------------------------- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    border-bottom: none; /* 既存のborderを削除 */
}

.header-right {
    text-align: right;
    line-height: 1.2;
}

h1 {
    font-weight: bold;
    font-size: 2.2rem; /* タイトルを大きく */
    margin: 0;
    color: #4682b4; /* 落ち着いた青色 */
    text-shadow: 1px 1px 0 #fff;
}

.header-right .sub-title {
    font-size: 1.1rem; /* 少し大きく */
    opacity: 0.8;
}

.header-right .copyright {
    font-size: 0.9rem; /* 少し大きく */
    opacity: 0.6;
}

#characterLayer {
    background-color: #e7e7e7;
}
/* -------------------------------------------
 * タブとコンテンツ
 * ------------------------------------------- */
#tabContainer {
    max-width: 1300px; /* 全体の幅を少し広げて調整 */
    margin: 0 auto;
}

.tabContent {
    display: none;
    padding: 20px;
    background-color: #a4cbff;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tabContent.active {
    display: block;
}

.tabButton {
    font-size: 1.2rem;
    padding: 10px 25px;
    margin: 0 5px;
    background-color: #ffe066; /* 明るい黄色 */
    color: #333;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 0 #ffc107;
    transition: transform 0.1s, box-shadow 0.1s;
}

.tabButton:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #ffc107;
}

.tabButton.active {
    font-weight: bold;
    background-color: #4682b4; /* アクティブなタブの色 */
    color: #fff;
    box-shadow: 0 0 0 #336699;
    transform: translateY(4px);
}

/* -------------------------------------------
 * ボタン・入力欄の共通デザイン
 * ------------------------------------------- */
button, select, input[type="text"], input[type="number"] {
    font-size: 1.1rem; /* 文字を大きく */
    padding: 10px 20px;
    margin: 8px; /* 間隔を少し広げる */
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    font-weight: bold;
    transition: transform 0.1s, box-shadow 0.1s;
}

button:active, .delete-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.2);
}

button {
    background-color: #98fb98; /* ボタンの基本色 */
    color: #333;
}

/* 各種ボタンのカラフルな色 */
#toolsArea button { background-color: #ffb6c1; box-shadow: 0 4px 0 #f08080; }
#stageControls button { background-color: #ffa07a; box-shadow: 0 4px 0 #ff6347; }
#addLayerActionBtn { background-color: #add8e6; box-shadow: 0 4px 0 #87ceeb; }
.delete-btn {
    background: #ff6347;
    color: white;
    box-shadow: 0 4px 0 rgba(255, 99, 71, 0.5);
    margin-left: 10px;
}

label {
    font-size: 1.1rem;
    font-weight: bold;
    color: #265d8a;
    margin-right: 5px;
}

input[type="text"], select, input[type="number"] {
    border: 2px solid #ddd;
    box-shadow: none;
    padding: 8px 12px;
}

/* -------------------------------------------
 * キャンバスとステージエリア
 * ------------------------------------------- */
#canvasContainer {
    position: relative;
    width: 1000px;
    height: 563px;
    margin: 0 auto 20px;
    background-color: white;
    transition: background-color 0.3s;
    border: 5px dashed #4682b4; /* 太い点線の枠 */
    border-radius: 15px;
}

#stageWrapper {
  width: 100%; /* ここを明示する */
  max-width: 100%;
  box-sizing: border-box;
  display: block; /* flexの場合も、幅制限されやすい */
}


#stageArea {
    position: relative;
    width: 1000px;
    height: 563px;
    transform-origin: 0 0;
}

/* -------------------------------------------
 * ブラシスライダー
 * ------------------------------------------- */
#brushSize {
    width: 250px; /* スライダーを長く表示 */
    height: 10px;
    -webkit-appearance: none;
    background: #add8e6;
    border-radius: 5px;
    margin: 0 10px;
}

#brushSize::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    background: #ff69b4;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* -------------------------------------------
 * タイムライン
 * ------------------------------------------- */
#timelineList {
    list-style: none;
    padding: 0;
    margin-top: 10px;
}

.timeline-entry {
    display: flex;
    align-items: center;
    background-color: #fffaf0;
    border: 2px solid #ffcc66;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
}

.timeline-entry button {
    font-size: 1rem;
    padding: 8px 16px;
    background: #ff6347;
    box-shadow: 0 4px 0 rgba(255, 99, 71, 0.5);
    margin-left: 10px;
}

/* -------------------------------------------
 * レイヤーリスト
 * ------------------------------------------- */
#layerWrapper {
    width: 250px; /* 開閉のために、幅を動的に変更する元のコードを尊重 */
    transition: width 0.3s ease;
    overflow: hidden; /* リストがはみ出さないように */
    background-color: #fff; /* ★修正★ リストの背景を白色に */
    border-radius: 15px; /* ★追加★ 角丸も追加 */
}

/* レイヤーリストが閉じたときのスタイル */
#layerWrapper.closed {
    width: 0;
    padding: 0; /* 閉じたときに余白も無くす */
}

#layerList {
    width: 100%;
    border-left: none; /* ★修正★ border-leftを削除 */
    padding: 15px;
    box-sizing: border-box;
}

#layerItems {
    list-style: none;
    padding: 0;
    margin: 0;
}

#layerItems li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px; /* ボタン内のpaddingを小さく */
    background-color: #f7f7d9; /* ★修正★ 背景色を薄い黄色に変更 */
    border: 2px solid #b0e0e6;
    border-radius: 10px;
    margin-bottom: 8px; /* 間隔を少し詰める */
    transition: background-color 0.2s;
    cursor: pointer;
    font-size: 0.95rem; /* フォントサイズを少し小さく */
}

#layerItems li:hover {
    background-color: #e0f2f7;
}

.layer-thumb {
    width: 45px; /* サムネイルを少し小さく */
    height: 45px;
    border: 2px solid #999;
    border-radius: 5px;
    object-fit: contain;
}

#layerItems button {
    font-size: 0.9rem; /* リスト内のボタンを小さく */
    padding: 3px 6px; /* ボタンの余白をさらに小さく */
    margin-left: 3px; /* ボタンの間隔をさらに詰める */
}

/* -------------------------------------------
 * 開閉ボタン
 * ------------------------------------------- */
#toggleLayerBtn {
    /* HTMLに記述されているスタイルをこちらに移動し、確実に適用 */
    width: 35px;
    background: #eee;
    border: none;
    cursor: pointer;
    font-weight: bold;
    user-select: none;
    align-self: stretch;
    margin: 0 5px;
    font-size: 1.5rem;
    color: #4682b4; /* ポップな色に */
    background-color: #ffe066;
    border-radius: 10px;
    box-shadow: 0 4px 0 #ffc107;
    transition: transform 0.1s, box-shadow 0.1s;
}

#toggleLayerBtn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #ffc107;
}

/* -------------------------------------------
 * その他の要素（既存のコードを維持）
 * ------------------------------------------- */
.character {
    position: absolute;
    width: auto;
    height: auto;
    cursor: move;
    transform-origin: center center;
    object-fit: contain;
    touch-action: none;
}
.fullscreen-mode #stageArea {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: black;
}
#playCanvas {
    max-width: 1280px;
    max-height: 720px;
    object-fit: contain;
    display: none;
}
.timeline-time-input {
    width: 80px; /* 幅を広げる */
    margin: 0 5px;
    font-size: 1.1rem;
    padding: 8px 10px;
    border-radius: 8px;
}
#imageUploader {
    position: relative !important;
    z-index: 9999 !important;
    width: auto !important;
    height: auto !important;
    opacity: 1 !important;
    display: inline-block !important;
}
#drawCanvasWrapper {
    position: relative;
    display: inline-block;
}
#drawCanvas {
    position: relative;
    touch-action: none;
    z-index: 2;
}
#drawBgOverlay {
    position: absolute;
    top: 0;
    left: 0;
    background-color: black;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: none;
}
#canvasContainer.blackBackground {
    background-color: black !important;
}
#cameraFrameBlue {
    touch-action: none;
}
#stopPlaybackBtn {
    padding: 10px 20px;
    background: #fd0000;
    color: white;
    border: none;
    border-radius: 20px;
    display: none;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 4px 0 #d9534f;
}

.stage-character {
  cursor: move;
}

#stageArea, .stage-character {
  touch-action: none; /* ← 指の動作によるスクロールを無効に */
}

#drawTab {
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

overflow-y: scroll;
