/* common.css - ミラクル先生のテトリス教室 共通スタイル */

/* --- 基本スタイル --- */
body {
    font-family: 'Arial', 'Helvetica Neue', Helvetica, 'Hiragino Sans', 'ヒラギノ角ゴシック ProN', 'Hiragino Kaku Gothic ProN', Meiryo, 'メイリオ', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #e9f5ff; /* 明るくて優しい水色 */
    color: #333a40; /* 少し濃いめの読みやすい文字色 */
    line-height: 1.7; /* 行間を少し広めに */
    font-size: 16px; /* 基本の文字サイズ */
}

main {
    padding: 25px;
    max-width: 850px; /* 少し広めに */
    margin: 25px auto;
    background-color: #ffffff; /* 白い背景でコンテンツを際立たせる */
    border-radius: 10px; /* 角を丸く */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* よりソフトな影 */
}

h1, h2, h3 {
    color: #2c506e; /* 落ち着いた青系の見出し色 */
    margin-top: 1.8em;
    margin-bottom: 0.8em;
}

h1 {
    text-align: center;
    border-bottom: 3px solid #6ab7ff; /* アクセントカラーの青 */
    padding-bottom: 15px;
    font-size: 2em; /* 大きめに */
}

h2 {
    border-left: 6px solid #6ab7ff;
    padding-left: 12px;
    font-size: 1.6em;
}

h3 {
    font-size: 1.3em;
    color: #36709e;
}

p {
    margin-bottom: 1em;
}

a {
    color: #007bff; /* 標準的なリンク色 */
    text-decoration: none;
}

a:hover, a:focus {
    color: #0056b3;
    text-decoration: underline;
}

/* --- ヘッダーとフッター --- */
#pageHeader, #pageFooter {
    background-color: #3485db; /* 鮮やかだけど落ち着いた青 */
    color: white;
    padding: 12px 25px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#pageHeader nav a, #pageFooter nav a {
    color: #f0f8ff; /* アリスブルーに近い明るい色 */
    margin: 0 12px;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease-in-out;
}

#pageHeader nav a:hover, #pageFooter nav a:hover,
#pageHeader nav a:focus, #pageFooter nav a:focus {
    color: #ffffff; /* ホバー時は白く */
    text-decoration: underline;
}

#pageFooter p {
    margin-top: 8px;
    font-size: 0.85em;
    opacity: 0.9;
}

/* --- 目次スタイル (index.html用) --- */
#tableOfContents ul {
    list-style-type: none;
    padding-left: 10px;
}

#tableOfContents li {
    margin-bottom: 10px;
    font-size: 1.1em;
}

#tableOfContents li a {
    color: #205072; /* 少し濃い青 */
    font-weight: bold;
}

#tableOfContents li a:hover {
    color: #3498db;
}

/* --- 折り畳みコンテンツ (details/summary) --- */
details {
    margin-top: 25px;
    padding: 15px;
    background-color: #f8f9fa; /* 薄いグレー */
    border: 1px solid #dee2e6; /* やや濃い枠線 */
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

summary {
    cursor: pointer;
    font-weight: bold;
    color: #495057; /* やや濃いグレーの文字 */
    font-size: 1.05em;
    padding: 5px 0;
}
summary:hover, summary:focus {
    color: #2c506e;
}

.summary-content {
    padding-top: 10px;
    font-size: 0.95em;
}
.summary-content p:last-child {
    margin-bottom: 0;
}

/* --- コード表示スタイル --- */
pre {
    background-color: #282c34; /* ダークテーマのコードブロック */
    color: #abb2bf; /* ダークテーマの文字色 */
    padding: 18px;
    border-radius: 6px;
    overflow-x: auto;
    border: 1px solid #212529;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.9em;
    line-height: 1.5;
    white-space: pre-wrap; /* 長い行も折り返す */
    word-wrap: break-word; /* 単語の途中でも折り返す */
}

code { /* インラインコード用 */
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    background-color: #f0f2f5; /* preとは違う明るめの背景 */
    color: #c7254e; /* ピンクっぽい色 */
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.88em;
}
pre code { /* preの中のcodeはスタイルをリセット */
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* --- Canvas関連の汎用スタイル --- */
.canvas-example { /* 01_canvas_basics.html などで使用 */
    border: 1px dashed #adb5bd; /* 点線の枠 */
    margin: 10px 0;
    background-color: #fdfdfd;
}

.code-output { /* 01_canvas_basics.html などで使用 */
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap; /* モバイルで縦並び */
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    background-color: #f8f9fa;
}
.code-output pre {
    flex: 1;
    min-width: 280px; /* コード表示の最小幅 */
    margin-top:0; /* flexアイテムなので調整 */
}
.code-output .canvas-container {
    flex-basis: 180px; /* Canvas表示エリアの基本幅 */
    text-align: center;
}
.code-output .canvas-container p {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 5px;
}

/* --- テトリミノ表示グリッド (02_tetromino_data.html) --- */
.tetromino-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* 少し大きく */
    gap: 20px;
    margin-top: 20px;
    padding: 15px;
    background-color: #f0f2f5;
    border-radius: 5px;
}
.tetromino-item {
    text-align: center;
    border: 1px solid #d1d9e0;
    padding: 12px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-radius: 4px;
}
.tetromino-item canvas {
    margin-bottom: 8px;
    border: 1px solid #ced4da; /* canvasにも枠線 */
}
.tetromino-item p { /* ミノの名前用 */
    font-weight: bold;
    color: #333a40;
    margin-bottom: 8px;
}
.tetromino-item pre { /* ミノの形状データ表示用 */
    font-size: 0.8em; /* 少し小さく */
    margin-top: 8px;
    text-align: left;
}

/* --- ゲームCanvasコンテナと情報表示 (04以降のページ) --- */
#gameCanvasContainer {
    text-align: center;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 上揃え */
    gap: 25px; /* Canvasと情報の間の隙間 */
    flex-wrap: wrap; /* 画面が狭い時は縦並び */
}
#tetrisCanvas { /* メインのゲームCanvas */
    border: 3px solid #2c3e50; /* しっかりした枠線 */
    background-color: #dbe4eb; /* 少し濃いめの背景 */
    box-shadow: inset 0 0 8px rgba(0,0,0,0.1); /* 内側に影 */
    /* width/heightはJSで設定 */
}
#gameInfo { /* スコア、NEXT、HOLD表示エリア */
    min-width: 130px; /* 少し広く */
    text-align: left;
    padding: 15px;
    background-color: #f0f2f5;
    border-radius: 8px;
    border: 1px solid #c8d0d8;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
#gameInfo p {
    margin: 8px 0;
    font-size: 0.95em;
    color: #333a40;
}
#gameInfo p span { /* スコア値など */
    font-weight: bold;
    color: #1a4a72;
}
#nextMinoCanvas, #holdMinoCanvas {
    width: 90px;  /* 少し大きく */
    height: 90px;
    border: 1px solid #b0b9c0;
    background-color: #fff;
    display: block;
    margin: 8px auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
#instructionText, #gameOverText {
    width: 100%; /* gameCanvasContainerがflexなので、その下に配置 */
    text-align: center;
    margin-top: 15px;
    font-size: 0.95em;
    color: #495057;
    min-height: 1.3em; /* メッセージがない時も高さを確保 */
}
#gameOverText {
    color: #dc3545; /* 赤色で強調 */
    font-weight: bold;
    font-size: 1.1em;
}

/* ゲーム操作ボタンのスタイル (03_game_board.html などで使うかも) */
.controls {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}
.controls label {
    margin-right: 5px;
    font-size: 0.9em;
}
.controls input[type="number"] {
    width: 60px;
    padding: 5px;
    margin-right: 15px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 0.9em;
}
.controls button {
    padding: 8px 15px;
    font-size: 0.9em;
    background-color: #4CAF50; /* 緑色のボタン */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.controls button:hover, .controls button:focus {
    background-color: #45a049; /* 少し濃い緑 */
}

/* キックテーブルのスタイル (07_srs_wallkick.html) */
table.kick-table {
    margin: 20px auto;
    border-collapse: collapse;
    font-size: 0.9em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.07);
    width: auto; /* 内容に合わせる */
    min-width: 300px; /* 最低幅 */
}
table.kick-table th, table.kick-table td {
    border: 1px solid #d1d9e0;
    padding: 8px 12px;
    text-align: center;
}
table.kick-table th {
    background-color: #e9ecef; /* ヘッダー背景色 */
    color: #2c506e;
    font-weight: bold;
}
table.kick-table td {
    background-color: #fff;
}
table.kick-table tr:nth-child(even) td {
    background-color: #f8f9fa; /* 交互に背景色 */
}


/* --- レスポンシブ対応 --- */
@media (max-width: 768px) { /* タブレットサイズでの調整 */
    main {
        margin: 15px;
        padding: 20px;
    }
    h1 { font-size: 1.8em; padding-bottom: 12px;}
    h2 { font-size: 1.4em; padding-left: 10px; border-left-width: 5px;}
    #pageHeader nav a, #pageFooter nav a { margin: 0 8px; font-size: 0.95em;}

    #gameCanvasContainer {
        gap: 15px;
    }
    #gameInfo {
        min-width: 100px; /* NEXT/HOLD表示を小さく */
        padding: 10px;
    }
    #nextMinoCanvas, #holdMinoCanvas {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 480px) { /* スマートフォンサイズでの調整 */
    body { font-size: 15px; }
    main { padding: 15px; }
    h1 { font-size: 1.6em; }
    h2 { font-size: 1.3em; }
    pre { padding: 12px; font-size: 0.85em; }
    code { font-size: 0.82em; }

    #pageHeader, #pageFooter { padding: 10px 15px; }
    #pageHeader nav a, #pageFooter nav a { font-size: 0.9em; }

    .code-output { flex-direction: column; align-items: stretch; } /* コードとCanvasを縦積みに */
    .code-output .canvas-container { flex-basis: auto; width: 100%; }
    .controls input[type="number"] { width: 50px; }

    #gameCanvasContainer {
         flex-direction: column; /* メインCanvasとゲーム情報を縦積みに */
         align-items: center;
    }
    #gameInfo {
        width: 90%; /* 横幅いっぱいに近く */
        max-width: 300px; /* あまり広がりすぎないように */
        margin-top: 15px;
        text-align: center; /* 中身も中央寄せに */
    }
     #gameInfo p { text-align: center; }

}
