/* 基本設定とモノクロテーマ */
body {
    background-color: #0a0a0a;
    /* より深い黒に近い背景 */
    color: #cccccc;
    /* 少し抑えた明るさのテキスト */
    font-family: 'Arial', 'Helvetica Neue', 'Hiragino Sans', 'メイリオ', Meiryo, sans-serif;
    /* フォント候補 */
    margin: 0;
    padding: 0;
    line-height: 1.7;
    overflow-x: hidden;
    /* 横スクロールバーが出ないように */
}

.main-content {
    padding: 40px;
    /* 上下の余白を多めに */
    padding-left: 100px;
    /* 左下ナビのスペースを多めに確保 (ナビの実際の幅に合わせて調整) */
    min-height: 100vh;
    /* 少なくとも画面の高さいっぱいに広がるように */
    box-sizing: border-box;
    /* paddingを含めて高さを計算 */
}

/* 左下固定ナビゲーション */
.global-nav {
    position: fixed;
    left: 15px;
    /* 画面左からの距離 */
    bottom: 15px;
    /* 画面下からの距離 */
    background-color: rgba(20, 20, 20, 0.6);
    /* 背景を少し透明に */
    padding: 8px 5px;
    /* 少しゆとりを持たせる */
    border-radius: 0px;
    z-index: 1000;
    backdrop-filter: blur(3px);
    /* 背景をぼかす効果 (対応ブラウザのみ) */
}

.global-nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.global-nav li a {
    display: block;
    color: #bbbbbb;
    text-decoration: none;
    font-size: 11px;
    /* さらに小さく */
    padding: 4px 10px;
    letter-spacing: 0.5px;
    /* 文字間隔を少し空ける */
    transition: color 0.3s ease, background-color 0.3s ease;
    border-radius: 0px;
}

.global-nav li a:hover,
.global-nav li a.active {
    /* 現在のページを示すactiveクラス（後でJSで付与）*/
    color: #ffffff;
    background-color: rgba(200, 200, 200, 0.15);
}

/* 見出しなどの基本スタイル (仮) */
h1,
h2,
h3 {
    color: #e0e0e0;
    font-weight: normal;
    /* 少し軽めに */
    letter-spacing: 1px;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 0.8em;
}

h2 {
    font-size: 1.8em;
    margin-bottom: 0.6em;
}

p {
    margin-bottom: 1.2em;
}

a {
    color: #8ab4f8;
    /* リンク色を少し明るく */
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ARCHIVES Page Styles */
.archive-grid {
    display: grid;
    /* 画面幅に応じて列数を変更 (レスポンシブ対応の第一歩) */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    /* 最小280px幅で、入るだけ列を作る */
    gap: 35px;
    /* アイテム間の溝 */
    padding-top: 20px;
}

.archive-item {
    background-color: #161616;
    /* カードの背景色を少し調整 */
    border: 1px solid #282828;
    /* 枠線を少しつける */
    border-radius: 0px;
    overflow: hidden;
    text-decoration: none;
    color: #cccccc;
    display: flex;
    /* Flexboxを使って中の要素を縦に並べる */
    flex-direction: column;
    /* 縦方向に要素を配置 */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.archive-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    border-color: #444;
}

.archive-item img {
    width: 100%;
    height: 200px;
    /* サムネイルの高さを固定 (要調整) */
    object-fit: cover;
    /* アスペクト比を保ちつつ、はみ出す部分はトリミング */
    display: block;
}

.archive-item h3 {
    font-size: 1.1em;
    margin: 0;
    padding: 18px 20px;
    /* タイトルの上下左右の余白 */
    text-align: left;
    /* タイトルを左寄せに */
    color: #e0e0e0;
    flex-grow: 1;
    /* 画像以外の残りの高さをタイトル部分が埋めるように */
    display: flex;
    align-items: center;
    /* タイトルを垂直方向中央に (複数行の場合) */
}

/* ページ全体のフェードインアニメーション */
.fade-in {
    animation: fadeInPage 0.7s ease-out forwards;
}

@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: translateY(15px);
        /* 少し下から現れる */
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ARCHIVE DETAIL Page Styles */
/* ARCHIVE DETAIL Page Styles */
.detail-container {
    max-width: 580px;
    /* 横幅を狭くして縦長な印象に (例: 760px -> 580px) */
    margin: 30px auto 50px auto;
    /* 上下のマージンも調整 */
    background-color: #101010;
    padding: 30px 30px 40px 30px;
    /* 横パディングも少し調整 */
    border-radius: 0px;
    border: 1px solid #2a2a2a;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    /* 影を少し調整 */
}

.detail-thumbnail-img {
    width: 100%;
    /* 親要素(.detail-container)の幅いっぱいに */
    height: auto;
    border-radius: 0px;
    margin-bottom: 35px;
    /* サムネイルとタイトルの間隔を広げる */
    display: block;
    border: 1px solid #444;
    /* 枠線の色を少し濃く */
}

.detail-container h2 {
    /* 作品タイトル (#detail-title) */
    font-size: 2.8em;
    /* さらに少し大きく */
    font-weight: 900;
    /* 最も太いウェイト */
    /* 抽象的なフォントについて: 
       ひとまず既存フォントの極太ウェイトで表現します。
       より特定の「抽象的なフォント」をご希望の場合は、
       Google Fontsなどから選んで導入することも可能です。
       例: font-family: 'Orbitron', sans-serif; (別途Google Fontsの読み込みが必要)
    */
    font-family: 'Arial Black', 'Impact', sans-serif;
    /* 太字でインパクトのあるシステムフォント候補 */
    text-align: center;
    color: #f0f0f0;
    /* タイトルの色を少し明るく */
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #444;
    /* 区切り線の色を少し濃く */
    line-height: 1.3;
}

.detail-meta {
    /* 制作時期など */
    font-size: 0.9em;
    /* 少し小さく */
    color: #a0a0a0;
    /* 少し暗く */
    text-align: center;
    margin-bottom: 35px;
}

.detail-description {
    margin-bottom: 40px;
    /* 説明文とボタンの間隔を広げる */
    text-align: center;
    /* 中のp要素を中央揃えにするための親要素の設定 */
}

.detail-description p {
    /* 説明文 (#detail-description-text) */
    font-size: 1.0em;
    line-height: 1.8;
    color: #b5b5b5;
    /* 説明文の文字色を少し調整 */
    white-space: pre-wrap;
    text-align: center;
    /* テキスト自体を中央揃え */
    /* display: inline-block; だとテキストが短い場合に幅が縮みすぎるので削除 */
}

.detail-action-link {
    /* ワールドを開くボタン */
    display: block;
    /* 中央寄せのためにブロック要素に */
    width: fit-content;
    /* 中身に合わせた幅 */
    margin-left: auto;
    /* 左マージンを自動 */
    margin-right: auto;
    /* 右マージンを自動 */
    min-width: 0px;
    /* 最低幅を確保 */
    margin: 0 auto;
    /* ブロック要素を中央に配置 */
    background-color: #ffffff;
    /* 背景色を白 */
    color: #0a0a0a;
    /* 文字色を黒 (サイト背景色と同じ) */
    padding: 14px 30px;
    /* パディングを調整してボタンを少し大きく */
    border-radius: 0px;
    /* 角丸を少し調整 */
    text-align: center;
    font-weight: bold;
    font-size: 1.05em;
    /* フォントサイズを少し大きく */
    transition: background-color 0.2s ease-out, transform 0.2s ease-out, box-shadow 0.2s ease-out;
    border: 1px solid #1a1a1a;
    /* 白ボタンに濃い色の枠線 */
    box-shadow: 0 2px 5px rgba(255, 255, 255, 0.1);
    /* 白ボタンにうっすら影 */
}

.detail-action-link:hover {
    background-color: #e0e0e0;
    /* ホバー時は少しグレーに */
    color: #000000;
    transform: translateY(-2px) scale(1.02);
    /* 少し浮き上がる感じ */
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.15);
    text-decoration: none;
}

.back-to-archives {
    text-align: center;
    margin-top: 50px;
    /* 一覧へ戻るリンクの上の余白を調整 */
    font-size: 0.9em;
}

/* PUZZLES Page Styles */
.puzzle-grid-container {
    display: flex;
    justify-content: center;
    /* グリッド全体をページの中央に配置 */
    margin-top: 20px;
    margin-bottom: 50px;
}

.puzzle-grid {
    display: grid;
    /* 各マスのサイズと列数を指定 */
    grid-template-columns: repeat(3, 110px);
    /* 横に3マス */
    grid-template-rows: repeat(3, 110px);
    /* 縦に3マス */
    gap: 25px;
    /* マスとマスの間の隙間 */
    /* このグリッド全体の幅は (110px * 3) + (25px * 2) = 330px + 50px = 380px 程度になります。 */
    /* 「画面中央の30%程度のエリア」というご要望については、
       画面サイズによってこの30%が変わるため、レスポンシブ対応の際に
       メディアクエリなどを使って調整するのが良いでしょう。
       まずはこの固定サイズで基本的なレイアウトと動きを作ります。 */
}

.puzzle-square {
    background-color: #1f1f1f;
    border: 2px solid #383838;
    /* border-radius: 8px; */
    /* ← 角丸削除 (コメントアウトまたは行削除) */
    border-radius: 0;
    /* またはこのように0を指定 */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease-out, transform 0.2s ease-out, border-color 0.2s ease-out;

    /* ↓↓↓↓ マス番号用のスタイルを追加 ↓↓↓↓ */
    font-size: 3em;
    /* 番号のフォントサイズ (お好みで調整) */
    font-weight: 900;
    /* 太字 */
    /* 「カクカクしたフォント」の例：
       多くの環境で利用可能な太く角ばったフォントを指定します。
       より特定のピクセルフォントなどをご希望の場合は、Google Fontsなどの外部フォント導入も検討できます。
       例：font-family: 'Press Start 2P', cursive; (Google FontsでPress Start 2Pを読み込んだ場合)
    */
    font-family: 'Impact', 'Arial Black', 'Helvetica Neue', sans-serif;
    /* 太く角ばったフォント候補 */
    color: #4a4a4a;
    /* 番号の色を少し調整 */
    /* ↑↑↑↑ マス番号用のスタイルを追加 ↑↑↑↑ */
}

.puzzle-square:hover {
    background-color: #3a3a3a;
    border-color: #666;
    transform: scale(1.03);
    color: #777;
    /* ホバー時の番号の色 */
}

/* モーダルウィンドウのスタイル */
.modal {
    display: none;
    /* JavaScriptで表示を切り替えるため、初期は非表示 */
    position: fixed;
    /* 画面に固定表示 */
    z-index: 2000;
    /* ナビゲーションより手前に表示 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    /* 背景を少し濃いめの半透明黒に */
    /* フェードインアニメーション */
    animation: fadeInModalBackground 0.3s ease-out forwards;
}

.modal-content {
    background-color: #1c1c1c;
    /* モーダル内の背景色 */
    margin: 8% auto;
    /* 上部からの距離と左右中央寄せ */
    padding: 35px 45px;
    border: 1px solid #444;
    width: 90%;
    max-width: 550px;
    /* モーダルの最大幅を少し調整 */
    border-radius: 0px;
    position: relative;
    /* 閉じるボタンの位置基準用 */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    /* スライドアニメーション */
    animation: slideInModalContent 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.modal-close-button {
    color: #999;
    position: absolute;
    /* 右上に絶対配置 */
    top: 15px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close-button:hover,
.modal-close-button:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

#modal-puzzle-title {
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8em;
    color: #e0e0e0;
}

#modal-puzzle-image-container {
    text-align: center;
    margin-bottom: 30px;
    min-height: 150px;
    /* 画像がない場合もあるので最低限の高さを確保 */
    background-color: #111;
    /* 画像背景を暗く */
    padding: 10px;
    border-radius: 0px;
}

#modal-puzzle-image {
    max-width: 100%;
    max-height: 320px;
    /* モーダル内画像の最大高さを調整 */
    border: 1px solid #282828;
    border-radius: 0px;
    display: inline-block;
    /* 中央寄せのため */
}

#modal-puzzle-answer-area {
    text-align: center;
    margin-top: 25px;
}

#modal-answer-input {
    padding: 12px 15px;
    width: calc(70% - 100px);
    /* ボタンの幅を考慮して調整 */
    min-width: 150px;
    margin-right: 12px;
    border-radius: 0px;
    border: 1px solid #555;
    background-color: #282828;
    color: #ddd;
    font-size: 1em;
}

#modal-submit-button {
    padding: 12px 22px;
    background-color: #789bf0;
    color: #0a0a0a;
    border: none;
    border-radius: 0px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

#modal-submit-button:hover {
    background-color: #8fb0ff;
}

/* モーダル表示時のアニメーション定義 */
@keyframes fadeInModalBackground {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInModalContent {
    from {
        transform: translateY(-60px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* PUZZLE DETAIL Page Styles */
.puzzle-detail-container {
    max-width: 680px;
    /* コンテンツの最大幅 */
    margin: 30px auto 40px auto;
    /* 中央寄せ、上下に余白 */
    background-color: #121212;
    /* 背景を少し調整 */
    padding: 30px 40px 45px 40px;
    /* パディング */
    border: 1px solid #333;
    /* 枠線 */
    /* border-radius: 0; */
    /* 角丸なし (全体で対応する場合は不要) */
}

.puzzle-detail-container h2 {
    /* #puzzle-title-detail */
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #383838;
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-weight: 900;
    color: #e8e8e8;
    line-height: 1.3;
}

#puzzle-image-container-detail {
    text-align: center;
    margin-bottom: 35px;
    background-color: #080808;
    padding: 15px;
    min-height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #2f2f2f;
}

#puzzle-image-detail {
    max-width: 100%;
    max-height: 420px;
    display: block;
}

#puzzle-answer-area-detail {
    text-align: center;
    margin-top: 35px;
}

#answer-input-detail {
    padding: 14px 18px;
    /* 少し大きめに */
    width: calc(70% - 120px);
    /* ボタン幅を考慮 */
    min-width: 200px;
    margin-right: 15px;
    border: 1px solid #484848;
    background-color: #222222;
    color: #e0e0e0;
    font-size: 1.05em;
    /* border-radius: 0; */
}

#submit-button-detail {
    padding: 14px 25px;
    /* 少し大きめに */
    background-color: #88aaff;
    /* ボタン色を調整 */
    color: #050505;
    border: none;
    /* border-radius: 0; */
    cursor: pointer;
    font-weight: bold;
    font-size: 1.05em;
    transition: background-color 0.2s ease;
}

#submit-button-detail:hover {
    background-color: #99bbff;
}

.back-to-puzzles {
    text-align: center;
    margin-top: 45px;
    font-size: 0.9em;
}

/* Feedback Messages Styles */
#feedback-message {
    /* transition: color 0.3s ease-out; */ /* animationで制御するのでこれは不要かも */
    opacity: 0; /* 初期状態は透明にしてアニメーションで表示 */
    transform: translateY(10px); /* 初期状態は少し下にずらす */
    animation-duration: 0.6s; /* アニメーションの時間を少し長く */
    animation-timing-function: ease-out;
    animation-fill-mode: forwards; /* アニメーションが終わった後の状態を維持 */
    /* font-size: 1.2em; font-weight: bold; はHTMLのstyle属性で指定済みなのでここでは不要 */
}

.feedback-correct {
    color: #66bb6a;
    animation-name: fadeInFeedback; /* 正解時用のアニメーション名を指定 */
}

.feedback-incorrect {
    color: #ef5350;
    animation-name: fadeInFeedbackShake; /* 不正解時用のアニメーション名を指定 (揺れる) */
}

.feedback-warning {
    color: #ffca28;
    animation-name: fadeInFeedback; /* 警告時用のアニメーション名を指定 */
}

/* メッセージがフェードインするアニメーション */
@keyframes fadeInFeedback {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* メッセージがフェードインしつつ少し揺れるアニメーション (不正解時など) */
@keyframes fadeInFeedbackShake {
    0% { opacity: 0; transform: translateY(10px); }
    50% { opacity: 1; transform: translateY(0); } /* まず表示 */
    60% { transform: translateX(-4px); } /* 少し左に揺れる */
    70% { transform: translateX(4px); } /* 少し右に揺れる */
    80% { transform: translateX(-2px); }
    90% { transform: translateX(2px); }
    100% { opacity: 1; transform: translateX(0); } /* 元の位置に戻る */
}

/* PUZZLES Page Styles */
/* ... (.puzzle-square, .puzzle-square:hover などの既存スタイルはそのまま) ... */

.puzzle-square.solved {
    background-color: #f0f0f0;
    /* 背景色をほぼ白に */
    color: #1a1a1a;
    /* 文字色を濃いグレーまたは黒に */
    border-color: #d0d0d0;
    /* 枠線の色も明るめに */
    cursor: default;
    /* 正解済みなのでカーソルを通常（矢印）に */
    font-weight: bold;
    /* 番号を少し強調しても良いかも */
}

.puzzle-square.solved:hover {
    background-color: #e0e0e0;
    /* ホバー時も白系のまま少し色を変える */
    transform: none;
    /* ホバー時の拡大アニメーションをなくす (お好みで) */
    border-color: #c0c0c0;
}

/* Screen Flash Animation Styles */
#flash-overlay {
    display: none; /* 初期状態では非表示 */
    position: fixed; /* 画面全体に固定 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0); /* 初期は完全に透明な白 */
    z-index: 9999; /* サイト内の他のどの要素よりも手前に表示 */
    pointer-events: none; /* このオーバーレイがクリックなどのマウスイベントを邪魔しないようにする */
}

/* JavaScriptによってこのクラスが付与されるとフラッシュアニメーションが開始 */
#flash-overlay.flash-active {
    display: block; /* 表示状態にする */
    animation: screenFlashAnimation 0.4s ease-out forwards; /* アニメーションを実行 */
}

@keyframes screenFlashAnimation {
    0% {
        background-color: rgba(255, 255, 255, 0); /* 開始時：透明 */
    }
    50% {
        background-color: rgba(255, 255, 255, 0.75); /* 中間：半透明の白（これがフラッシュの明るさ） */
    }
    100% {
        background-color: rgba(255, 255, 255, 0); /* 終了時：再び透明に */
    }
}