:root {
    --primary-blue: #2563eb;
    --secondary-blue: #e0f2fe;
    --accent-green: #22c55e;
    --text-main: #1e293b;
    --bg-light: #f8fafc;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    /* スマホで変なズームを防ぐ */
    touch-action: manipulation;
}

#app-container {
    /* 横幅の決定ロジックを変更 */
    width: 92%;
    /* PCでは最大600pxまで広がるようにし、スマホでは450px以下に収める */
    max-width: 600px; 
    margin: 20px auto 100px auto;
    padding: clamp(15px, 3vw, 30px); /* 画面幅に合わせて余白も動的に変化 */
    background: white;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

/* ヘッダーの調整 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ルーレットを画面幅にフィットさせる */
#wheel-wrapper {
    position: relative;
    width: 100%;
    /* 画面の高さ（vh）も考慮して、縦長になりすぎないように制限 */
    max-width: min(100%, 500px); 
    aspect-ratio: 1 / 1;
    margin: 0 auto 30px auto;
}

#wheel {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ボタンの共通デザイン：ここを丸く！ */
button {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 18px;
    /* 小さい画面では16px、大きい画面では18pxくらいになるように調整 */
    font-size: clamp(16px, 2vw, 18px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    background-color: #e2e8f0 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
}

.primary {
    background-color: var(--primary-blue);
    color: white;
}

.accent {
    background-color: var(--primary-blue);
    color: white;
}

/* 完了ボタン用の緑 */
#release-btn {
    background-color: var(--accent-green) !important;
    color: white !important;
}

/* 入力欄も丸く */
input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px; /* スマホでズームされないサイズ */
    box-sizing: border-box;
}

/* 項目編集エリアのグリッド最適化（PCなら2列にするのもアリですが、シンプルに1列を維持） */
.input-row {
    margin-bottom: 12px;
}

/* 右下の浮いているボタン (FAB) */
#chat-fab-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.fab {
    width: auto !important;
    padding: 12px 24px !important;
    border-radius: 30px !important;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    background-color: var(--primary-blue);
    color: white;
}

/* モーダル（ポップアップ）の背景 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none; /* 初期は非表示 */
    justify-content: center;
    align-items: center;
    z-index: 10002;
    backdrop-filter: blur(4px);
}

/* モーダルの箱 */
.modal-content {
    background: white;
    padding: 24px;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    text-align: center;
}

.modal-content h3 { margin-top: 0; margin-bottom: 15px; }

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.secondary {
    background-color: #f1f5f9;
    color: #475569;
}

#chat-input {
    border-radius: 20px; /* チャット欄も丸く */
}

/* 弾幕コンテナ */
.danmaku {
    position: fixed;
    white-space: nowrap;
    color: rgb(223, 223, 223);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-weight: 900;
    font-size: 1.2rem;
    z-index: 9999;
    pointer-events: none;
    /* アニメーションを確実に適用 */
    left: 100%; 
    animation: move-left 5s linear forwards;
}

@keyframes move-left {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-200vw); }
}

.status-msg {
    background: var(--secondary-blue);
    color: var(--primary-blue);
    padding: 16px;
    border-radius: 14px;
    font-weight: bold;
    text-align: center;
}

/* 結果表示のポップアップ */
#result-overlay {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: white;
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 0 100px rgba(0,0,0,0.5);
    z-index: 10000;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#result-overlay.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.result-title { font-size: 1rem; color: #64748b; margin-bottom: 10px; }
.result-value { font-size: 3rem; font-weight: 900; color: var(--primary-blue); }

/* 不要になった保存ボタンを消す用 */
#save-items-btn { display: none; }