/* assets/css/style.css */
:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --accent: #008b8b;
    --accent-glow: rgba(0, 139, 139, 0.4);
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --danger: #ff4444;
}

* {
    box-sizing: border-box;
    touch-action: manipulation;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 220px;
    /* フッター分 (テキストエリア化で高くなったため増量) */
}

/* ヘッダー */
header {
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(10px);
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 100;
}

.team-id {
    font-size: 0.9rem;
    color: var(--accent);
    letter-spacing: 2px;
    font-weight: bold;
}

/* ルール説明 */
.rules-card {
    background: rgba(0, 139, 139, 0.1);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.rules-card h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: var(--accent);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.rules-card ul {
    margin: 0;
    padding-left: 20px;
    color: #eee;
}

.rules-card li {
    margin-bottom: 5px;
}

/* メインコンテンツ */
main {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

/* お題カード */
.task-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    border: 1px solid #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.task-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.task-img {
    width: 100%;
    border-radius: 8px;
    max-height: 300px;
    /* 少し高さを確保 */
    object-fit: contain;
    /* 全体を表示 */
    background: #000;
    /* 余白が出た場合の背景色 */
}

/* ... (省略) ... */

/* 下部固定エリア */
.bottom-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(30, 30, 30, 0.95);
    padding: 15px;
    border-top: 1px solid var(--accent);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
}

/* 入力フォーム (Textarea) */
textarea {
    width: 100%;
    background: #000;
    border: 1px solid #444;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.4;
    resize: none;
    height: 80px;
    /* 3行程度確保 */
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* 中央揃えから変更する場合は注意 */
}

/* ボタンの高さを調整 */
.input-area {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    /* ボタンを下揃え */
}

.timer {
    font-family: monospace;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

button.btn-generate {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0;
    width: 80px;
    /* 正方形に近い形または縦長 */
    height: 80px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

button.btn-generate:disabled {
    background: #444;
    box-shadow: none;
    color: #888;
    cursor: not-allowed;
}

button.btn-generate:active {
    transform: scale(0.95);
}

/* ローディング */
.loading-overlay {
    position: fixed;
    /* absoluteからfixedに変更 */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* 最前面へ */
    display: none;
    pointer-events: none;
    /* デフォルトではクリック透過 */
}

.loading-overlay.visible {
    display: flex;
    pointer-events: auto;
    /* 表示時のみクリックブロック */
}

/* チャットエリア */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 20px;
    width: 100%;
}

.chat-row {
    display: flex;
    width: 100%;
}

.chat-row.user {
    justify-content: flex-end;
}

.chat-row.ai {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 85%;
    padding: 15px;
    border-radius: 12px;
    position: relative;
    font-size: 1rem;
    line-height: 1.5;
    word-break: break-word;
}

/* ユーザーの発言（プロンプト） */
.user .chat-bubble {
    background: #333;
    color: #fff;
    border-bottom-right-radius: 2px;
    border: 1px solid #444;
}

/* AIの発言（画像） */
.ai .chat-bubble {
    background: transparent;
    padding: 0;
    width: 100%;
    border-radius: 12px;
}

.generated-img {
    width: 100%;
    max-width: 500px;
    /* PCなども考慮して制限 */
    border-radius: 12px;
    border: 1px solid var(--accent);
    box-shadow: 0 4px 20px rgba(0, 139, 139, 0.2);
    display: block;
}

/* スコアカード（チャット内） */
.chat-score {
    margin-top: 10px;
    background: linear-gradient(135deg, #004d4d, #002222);
    border: 1px solid var(--accent);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    animation: popIn 0.5s ease;
}

/* Place holder (Empty state) */
.empty-state {
    text-align: center;
    color: #666;
    padding: 40px;
    border: 1px dashed #444;
    border-radius: 12px;
    margin-top: 20px;
}

/* デバッグ情報 */
.debug-info {
    font-family: monospace;
    font-size: 0.75rem;
    color: #666;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    word-break: break-all;
    text-align: left;
    border: 1px solid #333;
}

.debug-row {
    margin-bottom: 2px;
}

/* ヒントボックス */
.hint-box {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 100, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(0, 100, 255, 0.3);
    text-align: left;
    font-size: 0.9rem;
    color: #ccc;
    margin-bottom: 20px;
}

.hint-title {
    color: #8ab4f8;
    font-weight: bold;
    margin-bottom: 5px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: #1e1e1e;
    border: 1px solid var(--accent);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 0 30px rgba(0, 139, 139, 0.3);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-card h2 {
    color: var(--accent);
    margin: 0 0 10px 0;
    letter-spacing: 2px;
}

.btn-start {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 20px var(--accent-glow);
    transition: transform 0.2s;
}

.btn-start:active {
    transform: scale(0.95);
}