/* style.css */
body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: auto;
    padding: 0;
    color: #ecf0f1;
    font-family: 'Arial', sans-serif;
    background-color: #2c3e50;
    width: 1000px;
}

h1 {
margin: 0;
}

#mainContainer {
    width: 90%;
    max-width: 1200px;
    margin-top: 20px;
    background-color: #333;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.dice-btn {
    font-size: 2rem;       /* ボタンを大きく */
    padding: 15px 30px;    /* 余白を広げる */
    border-radius: 12px;
    background-color: #088af5;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    color: white; 
}
.dice-btn:hover {
    background-color: #8faff3;
}

.dice-display {
    font-size: 4rem;      /* サイコロアイコンと数字を大きく */
    margin-top: 15px;
    font-weight: bold;
}

.cell .character { display:inline-block; margin:0 2px; font-size:18px; }
#startArea .character, #goalArea .character { margin-right:4px; }


/* --- タブ切り替え --- */
.tabs button {
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    background-color: #ff7e15;
    transition: background-color 0.2s;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
}

.tabs button.active {
    background-color: #1e6dff;
    border: 1px solid #ccc;
    border-bottom: none;
}

.tab-content {
    padding-top: 20px;
    border-top: 1px solid #ccc;
    /* タブ切り替え制御のための基本設定 */
    display: none; 
}

.tab-content.active {
    display: flex;
}

/* --- 盤面エリア --- */
#gamePlayArea {
    gap: 20px;
    background: transparent;
}

#boardArea {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#board {
    display: grid;
    /* 10x10のグリッド */
    grid-template-columns: repeat(10, 1fr); 
    grid-template-rows: repeat(10, 1fr);
    width: 600px; /* 例: 幅を設定 */
    height: 600px; /* 例: 高さを設定 */
    border: 3px solid #333;
    background-color: #34495e; /* 暗めの青灰色で、ボード全体を囲む */
    border: 5px solid #f39c12; /* 宝箱のようなゴールドの枠線 */
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.5); /* ゴールドの薄いグロー */
}
.cell {
    border: 1px solid #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    font-size: 12px;
    background-color: #5d6d7e; /* やや明るい青灰色で道を示す */
    color: #ecf0f1;
    border: 1px solid #7f8c8d; /* マス目の境界線 */
    
    /* 💡 マス番号のフォントも目立つように調整 */
    font-weight: bold;
}

.cell span {
    z-index: 1; 
    color: #ecf0f1;
}

#startArea {
    width: 600px;
    height: 50px;
    margin: 5px 0;
    font-weight: bold;
    background-color: #27ae60; /* スタート: 緑 */
    color: white;
    border: 3px solid #f1c40f;
}

#goalArea {
    width: 600px;
    height: 50px;
    margin: 5px 0;
    font-weight: bold;
    background-color: #27ae60; /* スタート: 緑 */
    color: white;
    background-color: #e67e22; /* ゴール: オレンジ */
}

/* トラップマスのスタイル */
.cell span:first-child {
    font-weight: bold;
    color: #333;
}
.cell.trap {
    background-color: #c0392b; /* 危険を示す赤 */
    color: white;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

/* キャラクターの表示 */
.character {
  font-size: 18px; /* キャラクターを小さく表示 */
  line-height: 1;
  margin: 0 1px;
  cursor: pointer;
  display: inline-block; /* 複数並べて表示 */
  position: absolute;
}
.character.current-turn {
  border: 2px solid rgb(40, 133, 255);
  border-radius: 1%;
  padding: 0px;
}
/* --- Blocklyエリア --- */
#ruleSettingArea {
    flex-direction: column;
}

#blocklyDiv {
    height: 70vh; /* Blocklyの表示高さを確保 */
    width: 100%; 
    min-height: 500px;
    border: 1px solid #ccc;
}

#toolbox {
    /* ツールボックスは非表示 */
    display: none;
}

#score {
  border: 1px solid #ccc;
  padding: 10px;
  margin-top: 10px;
  color: #f1c40f;
}

#score h4 {
    color: #ecf0f1; /* タイトルは白 */
    border-bottom: 1px solid #f1c40f;
}

#score div {
    color: #ecf0f1; /* 各スコアの項目も明るい色に */
}

#questionArea {
  position: fixed;
  font-size: 1.5em;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #008cff;
  border-radius: 8px;
  color: #ecf0f1;
  border: 2px solid #333;
  padding: 20px;
  z-index: 1000;
  display: none; /* 初期非表示 */
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.answer-btn {
  margin: 5px;
  padding: 10px;
  cursor: pointer;
}
#trapImage {
    max-width: 100%;
    max-height: 100%;
    display: none; /* 初期非表示 */
}

.tab-button {
    background-color: #3498db; /* ブルーのボタン */
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    transition: background-color 0.2s;
}

.tab-button:hover {
    background-color: #5cb5f0;
}

/* 選択中のボタン */
.tab-button.active {
    background-color: #007bff;/* アクティブなタブをゴールドに */
}

/* サイコロボタンや移動ボタン */
#rollDice {
    background-color: #ff5dc1; /* エメラルドグリーンのボタン */
    color: white;
    border: 2px solid #16a085;
    border-radius: 8px;
    font-size: 1.1em;
    padding: 10px 20px;
}

.selected {
    margin: 5px;
}

/* サイコロボタンや移動ボタン */
#moveForwardBtn, #moveBackBtn {
    background-color: #16a085;/* エメラルドグリーンのボタン */
    color: white;
    border: 2px solid #16a085;
    border-radius: 8px;
    font-size: 1.1em;
    padding: 10px 20px;
    margin: 10px 0 0 0 ;
}

.blocklyTreeRow {
    /* 背景色を濃い色にする（例：薄い青やグレーなど） */
    background-color: #e6f7ff; /* 薄い水色 */
    /* 文字色が白になっている場合は、濃い色に変更 */
    color: #000;
    padding: 2px 0;
}

#resetButton {
    padding: 10px 20px;
    background-color: #dc3545; /* 赤色 */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin: 10px 0 0 0 ;
}

#resetButton:hover {
    background-color: #c82333;
}

/* モーダル全体のスタイル（背景のオーバーレイ） */
.custom-modal {
    display: none; /* 初期状態では非表示 */
    position: fixed;
    z-index: 1000; /* 他の要素より手前に表示 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7); /* 半透明の黒背景 */
    /* 画面中央に配置するために flex を使用 */
    display: flex; 
    align-items: center; /* 垂直方向中央 */
    justify-content: center; /* 水平方向中央 */
}

/* モーダルの中身（メッセージボックス）のスタイル */
.custom-modal-content {
    /* 濃い赤の背景色 */
    background-color: #b00020; 
    color: white; 
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    text-align: center;
}

/* メッセージのテキスト部分 */
#trapMessageText {
    /* 文字の大型化 */
    font-size: 1.8em; 
    font-weight: bold;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* OKボタンのスタイル */
#closeTrapMessage {
    background-color: #ffd700; /* 黄色っぽいOKボタン */
    color: black;
    border: none;
    padding: 10px 25px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin-top: 15px;
    cursor: pointer;
    border-radius: 5px;
}

#closeTrapMessage:hover {
    background-color: #e5c100;
}

#trapMessageModal {
    /* ... その他のスタイル ... */
    display: none; /* 💡 初期状態では非表示にする */
    position: fixed; /* 画面全体を覆うために必要 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明の背景 */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* ゴール専用の大きな表示スタイル */
.is-goal .modal-content { /* .modal-content はメッセージウィンドウの本体 */
    background-color: gold !important; /* 背景色を目立たせる */
    border: 5px solid orange !important;
    padding: 50px;
    animation: goal-bounce 0.8s infinite alternate; /* アニメーションを追加 */
}

.is-goal #trapMessageText {
    font-size: 48px; /* 文字サイズを非常に大きく */
    font-weight: bold;
    color: rgb(255, 255, 255);
    text-align: center;
}

/* アニメーションの定義 (オプション) */
@keyframes goal-bounce {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.05);
    }
}