@charset "UTF-8";

/* ==================================================
   全体設定・ベース
================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    line-height: 1.7;
    color: #2c3e50;
    background-color: #f7f9fc;
    padding-bottom: 40px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* スクリーンリーダー用非表示（アクセシビリティ用） */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ==================================================
   ヘッダー
================================================== */
.header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    padding: 30px 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-inner {
    max-width: 800px;
    margin: 0 auto;
}

.header .subtitle {
    font-size: 0.9rem;
    opacity: 0.85;
    display: block;
    margin-bottom: 4px;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: bold;
}

/* ==================================================
   見出し＆セクション
================================================== */
.content-section {
    background: #ffffff;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

h2 {
    font-size: 1.3rem;
    color: #1e3c72;
    border-left: 5px solid #2a5298;
    padding-left: 12px;
    margin-bottom: 16px;
}

/* ==================================================
   吹き出しコンポーネント
================================================== */
.speech-box {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: #ffffff;
    border: 2px solid #2a5298;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.speech-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.speech-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #2a5298;
    object-fit: cover;
    background-color: #e2e8f0;
}

.avatar-name {
    font-size: 0.8rem;
    font-weight: bold;
    color: #1e3c72;
    margin-top: 6px;
}

.speech-bubble {
    position: relative;
    background-color: #f0f4f9;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: #1e293b;
    flex-grow: 1;
}

/* ==================================================
   リスト・テーブル
================================================== */
.check-list {
    margin-left: 20px;
    margin-top: 10px;
}

.check-list li {
    margin-bottom: 8px;
}

.step-list {
    margin-left: 20px;
    line-height: 1.8;
}

.table-wrapper {
    overflow-x: auto;
    margin: 16px 0;
}

.explain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.explain-table th, 
.explain-table td {
    border: 1px solid #cbd5e1;
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}

.explain-table th {
    background-color: #2a5298;
    color: #ffffff;
    white-space: nowrap;
}

.explain-table tr:nth-child(even) {
    background-color: #f8fafc;
}

/* 1列目（タグ名・属性名）の装飾強調 */
.explain-table td:first-child {
    white-space: nowrap;
    font-family: monospace;
    font-weight: bold;
}

/* ==================================================
   メモボックス各種
================================================== */
/* 基本メモボックス */
.memo-box {
    background-color: #fffbe0;
    border: 1px solid #f2d024;
    border-left: 5px solid #eab308;
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 16px;
}

.memo-title {
    font-weight: bold;
    color: #854d0e;
    margin-bottom: 4px;
}

.memo-divider {
    margin: 16px 0;
    border: none;
    border-top: 1px dashed #cbd5e1;
}

.memo-subhead {
    margin-top: 12px;
    margin-bottom: 4px;
}

/* コラム用スタイル (.memo-box.column) */
.memo-box.column {
    border-left-color: #38bdf8;
    background-color: #f0f9ff;
    margin-bottom: 30px;
}

.memo-box.column .memo-title {
    color: #0284c7;
}

.memo-box.column p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* 注意・警告用スタイル (.memo-box.warning) */
.memo-box.warning {
    border-left-color: #f59e0b;
    background-color: #fffbeb;
}

.memo-box.warning .memo-title {
    color: #b45309;
}

.memo-box.warning ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.memo-box.warning li {
    margin-bottom: 6px;
    line-height: 1.5;
}

/* コラム専用カードデザイン (.column-card) */
.column-card {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 20px 0 30px;
}

.column-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.column-badge {
    background: #0284c7;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}

.column-title {
    font-weight: bold;
    color: #0369a1;
    font-size: 0.95rem;
}

.column-text {
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.6;
    margin: 0;
}

/* ==================================================
   コード表示エリア
================================================== */
/* 文章中のインラインコード */
code {
    background-color: #e2e8f0;
    color: #1e293b;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

/* コードカード全体 */
.code-card {
    background-color: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* コードヘッダー */
.code-header {
    background-color: #1e293b;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: bold;
    font-family: 'Consolas', 'Courier New', monospace;
}

.code-title {
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: bold;
    font-family: 'Consolas', 'Courier New', monospace;
}

/* コード本体エリア */
.code-block-container {
    position: relative;
    padding: 16px;
    padding-top: 40px; /* ボタンと重ならないように上余白確保 */
    overflow-x: auto;
    background-color: #0f172a;
}

.code-block-container pre,
.code-block-container code {
    background-color: transparent;
    color: #f8fafc;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    text-shadow: none;
}

/* コピーボタン */
.copy-btn {
    background-color: #475569;
    color: #ffffff;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.copy-btn:hover {
    background-color: #0284c7;
}

/* タイトルなし（.code-headerがない）場合のボタン位置 */
.code-block-container > .copy-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 10;
}

/* ==================================================
   ボタン・ナビゲーション
================================================== */
.next-chapter-box {
    text-align: center;
    margin: 40px 0;
}

.next-chapter-box .next-chapter-title {
    font-weight: bold;
    margin-bottom: 12px;
}

.next-game-btn {
    display: inline-block;
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: #ffffff;
    font-weight: bold;
    padding: 14px 28px;
    border-radius: 30px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.next-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(42, 82, 152, 0.4);
}

.next-game-btn.reward-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.next-game-btn.reward-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.next-game-btn.start-btn {
    font-size: 1.1rem;
    padding: 16px 36px;
}

/* ==================================================
   ポータル（トップページ）専用スタイル
================================================== */
.portal-hero {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    padding: 40px 20px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(30, 60, 114, 0.2);
}

.portal-hero h2 {
    font-size: 1.6rem;
    margin-bottom: 12px;
    border: none;
    padding: 0;
    color: #ffffff;
}

.portal-hero p {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.preview-box {
    position: relative;
    max-width: 640px;
    margin: 0 auto 30px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    border: 4px solid #ffffff;
    background: #0f172a;
}

.preview-img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.preview-box:hover .preview-img {
    transform: scale(1.02);
}

.clear-badge {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    font-weight: bold;
    font-size: 0.9rem;
    padding: 6px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.player-setup-box {
    background: #f8fafc;
    border: 2px dashed #94a3b8;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 30px;
}

.player-setup-box h3 {
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 8px;
    border: none;
    padding: 0;
}

.player-setup-box .setup-desc {
    font-size: 0.85rem;
    color: #64748b;
}

.name-input-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.name-input-group input {
    padding: 10px 16px;
    font-size: 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    width: 220px;
    text-align: center;
}

.name-input-group input:focus {
    border-color: #38bdf8;
}

.name-save-btn {
    padding: 10px 20px;
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.name-save-btn:hover {
    background: #0369a1;
}

.reward-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.reward-card.is-active {
    display: flex;
}

.reward-title {
    font-weight: bold;
    color: #b45309;
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.reward-desc {
    font-size: 0.9rem;
    color: #78350f;
    line-height: 1.5;
}

.start-game-box {
    text-align: center;
    margin: 30px 0 40px;
}

.chapter-list {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.chapter-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.chapter-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: #38bdf8;
}

.chapter-info {
    flex: 1;
}

.chapter-number {
    display: inline-block;
    background: #e0f2fe;
    color: #0284c7;
    font-weight: bold;
    font-size: 0.85rem;
    padding: 2px 10px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.chapter-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 6px;
}

.chapter-desc {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.5;
}

.chapter-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 140px;
}

.btn-game, .btn-web {
    display: inline-block;
    text-align: center;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.85rem;
    text-decoration: none;
    transition: filter 0.2s;
}

.btn-game {
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: #ffffff;
}

.btn-web {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.btn-game:hover, .btn-web:hover {
    filter: brightness(1.1);
}

.clear-box .clear-title {
    font-weight: bold;
    margin-bottom: 14px;
    color: #1e3c72;
    font-size: 1.1rem;
}

.ai-credit-box {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 50px;
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.6;
    text-align: left;
}

.ai-credit-box strong {
    color: #334155;
}

.reset-area {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.reset-btn {
    background: #ef4444;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.reset-btn:hover {
    background: #dc2626;
}

/* ==================================================
   レスポンシブ対応（スマホ用）
================================================== */
@media (max-width: 600px) {
    .speech-box {
        flex-direction: column;
        align-items: flex-start;
    }
    .speech-avatar {
        flex-direction: row;
        gap: 10px;
    }
    .header h1 {
        font-size: 1.4rem;
    }
    .chapter-card, .reward-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .chapter-links {
        width: 100%;
        flex-direction: row;
    }
    .btn-game, .btn-web {
        flex: 1;
    }
}