body{
margin:0;
font-family:-apple-system,BlinkMacSystemFont;
background:#0f1115;
color:white;
}

.label{
    color: black;
}

header{
text-align:center;
padding:12px;
background:#1a1d24;
border-bottom:2px solid #333;
}

h1{
font-size:20px;
margin:0;
}

.subtitle{
font-size:12px;
color:#bbb;
}

main{
max-width:600px;
margin:auto;
padding:10px;
}

/* セクション */

.group{
margin-bottom:25px;
}

.group h2{
font-size:16px;
border-left:4px solid #3b82f6;
padding-left:8px;
}

h2{
font-size:15px;
margin:20px 0 10px;
}

/* テーブルUI */

.table{
display:flex;
flex-direction:column;
gap:6px;
}

.row{
display:grid;
grid-template-columns:80px 1fr 1fr 1fr;
gap:6px;
margin-bottom:6px;
}

.rowlabel{
display:flex;
align-items:center;
font-size:12px;
color:#bbb;
}

/* ボタン */

button{
border:none;
border-radius:8px;
padding:6px 6px;
font-size:12px;
display:flex;
justify-content:space-between;
align-items:center;
}

/* 数字 */

button span{
font-weight:bold;
font-size:14px;
}

/* ボタン色 */

.mu{
background:#ef4444;
}

.kaba{
background:#3b82f6;
}

.iko{
background:#22c55e;
}

.mix{
background:#9333ea;
}

.chance{
background:#f59e0b;
}

.super{
box-shadow:0 0 6px #f59e0b;
}

/* 特殊 */

.allstar{
    width:50%;
    margin:10px auto;

    background:linear-gradient(
        90deg,

        /* 赤 */
        #ef4444 0%,
        #ef4444 25%,

        /* 赤 → 緑（ぼかし） */
        #f97316 35%,
        #22c55e 45%,

        /* 緑 */
        #22c55e 55%,

        /* 緑 → 青（ぼかし） */
        #06b6d4 65%,
        #3b82f6 75%,

        /* 青 */
        #3b82f6 100%
    );

    color:white;
}

/* utility */

.utility-grid{
display:grid;
grid-template-columns:1fr 1fr;
gap:10px;
margin-top:10px;
}

.util{
background:#374151;
color:white;
}

.end{
background:#ef4444;
}

/* modal */

.modal{
display:none;
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:rgba(0,0,0,0.8);
justify-content:center;
align-items:center;
}

.modal-content{
background:#1a1d24;
padding:20px;
border-radius:10px;
text-align:center;
}

.modal-btn{
display:block;
width:200px;
margin:10px auto;
padding:12px;
border-radius:8px;
font-weight:bold;
color:#000;
}

.both{
background:#9333ea;
color:white;
}

/* カウンター */


.btn{
display:flex;
flex-direction:column;
align-items:center;
justify-content:center;
}

.label{
font-size:12px;
}

.count{
    background:rgba(0,0,0,0.45);
    color:white;
    padding:2px 6px;
    border-radius:6px;
    font-weight:bold;
    font-size:14px;
    margin-top:2px;
    text-shadow:0 0 4px rgba(0,0,0,0.8);
}



.mu_iko{
background:linear-gradient(
90deg,
#ef4444 40%,
#f97316 50%,
#22c55e 60%
);
}

/* 無名 + カバネ（左 赤 → 中央紫 → 右 青） */
.mu_kaba{
background:linear-gradient(
90deg,
#ef4444 40%,
#8b5cf6 50%,
#3b82f6 60%
);
}

/* カバネ + 生駒（左 緑 → 中央シアン → 右 青） */
.kaba_iko{
background:linear-gradient(
90deg,
#22c55e 40%,
#06b6d4 50%,
#3b82f6 60%
);
}

.reset{
    background:#6b7280;
    color:white;
}

/*カウントリセット関連CSS */
.undo-mode .btn{
    filter:brightness(0.85);
}

.undo-mode .btn:hover{
    transform:scale(0.97);
}

.undo-toggle{
    background:#111;
    color:white;
    border:2px solid #333;
    transition:all .2s;
}

.undo-toggle:hover{
    background:#222;
}

.undo-mode .undo-toggle{
    background:#ef4444;
    border-color:#ef4444;
}

.undo-mode{
    cursor:not-allowed;
}

#undoBanner{
position:fixed;
top:0;
left:0;
width:100%;

background:#ef4444;
color:white;

text-align:center;
font-weight:bold;
font-size:14px;

padding:8px 0;

transform:translateY(-100%);
transition:transform .25s;

z-index:9999;
}

.undo-mode #undoBanner{
transform:translateY(0);
}

#undoBanner{
    box-shadow:0 2px 8px rgba(0,0,0,.3);
}

.undo-mode .btn{
animation:undoShake 0.4s infinite alternate;
}

@keyframes undoShake{
from{transform:scale(1)}
to{transform:scale(.97)}
}

/*取り消しボタン関連 */
.modal-content{
position:relative;
background:#1a1d24;
padding:20px;
border-radius:10px;
text-align:center;
}

/* ×ボタン */
.modal-close{
position:absolute;
top:8px;
right:10px;

width:28px;
height:28px;

border-radius:50%;
border:none;

background:#2a2f3a;
color:#bbb;

font-size:18px;
font-weight:bold;

cursor:pointer;
transition:all .2s;

display:flex;
align-items:center;
justify-content:center;

padding:0;
line-height:1;

}

/* ホバー */
.modal-close:hover{
background:#ef4444;
color:white;
transform:scale(1.1);
}

.modal-content{
box-shadow:0 10px 30px rgba(0,0,0,0.6);
}


/* オールスターモーダル */
.allstar-options{
    display:none;
    margin-top:20px;
}

.toggle{
    width:70px;
    padding:6px 0;
    border-radius:20px;
    border:none;
    background:#444;
    color:white;
    font-weight:bold;
}

.toggle.active{
    background:#00c853;
}

.confirm-btn{
    width:100%;
    margin-top:15px;
    padding:10px;
    border:none;
    border-radius:10px;
    background:#ff5252;
    color:white;
    font-weight:bold;
}

.modal{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.7);
    backdrop-filter:blur(4px);
    justify-content:center;
    align-items:center;
    z-index:999;
}

.modal-content{

    width:90%;
    max-width:420px;

    background:#1e1e1e;

    border-radius:16px;

    padding:25px;

    box-shadow:
    0 10px 40px rgba(0,0,0,0.6);

    animation:modalShow .2s ease;

    position:relative;
}

@keyframes modalShow{
    from{
        transform:scale(.9);
        opacity:0;
    }
}

.modal-title{
    text-align:center;
    font-size:20px;
    margin-bottom:20px;
}

.modal-close{

    position:absolute;
    top:10px;
    right:12px;

    width:32px;
    height:32px;

    border-radius:50%;

    border:none;

    background:#333;

    color:white;

    font-size:16px;

    cursor:pointer;

}

.modal-close:hover{
    background:#ff5252;
}

.allstar-options{
    display:none;
}



.toggle{

    width:60px;
    height:30px;

    border-radius:30px;

    background:#444;

    border:none;

    position:relative;

    cursor:pointer;

    transition:.2s;
}

.toggle::after{

    content:"";

    position:absolute;

    width:24px;
    height:24px;

    background:white;

    border-radius:50%;

    top:3px;
    left:3px;

    transition:.2s;

}

.toggle.active{
    background:#00c853;
}

.toggle.active::after{
    left:33px;
}

.confirm-btn{

    width:100%;

    padding:14px;

    margin-top:18px;

    border:none;

    border-radius:10px;

    background:linear-gradient(45deg,#ff5252,#ff1744);

    color:white;

    font-size:18px;

    font-weight:bold;

    cursor:pointer;

    transition:.2s;

}

.confirm-btn:hover{
    transform:scale(1.03);
}

.second-modal{
    text-align:center;
    padding:25px;
}

.second-buttons{
    display:flex;
    justify-content:center;
    gap:20px;
    margin-top:20px;
}

.second-btn{
    min-width:120px;
    font-size:16px;
}

.toggle-header{
    display:grid;
    grid-template-columns:120px 80px 80px;
    justify-content:center;
    align-items:center;
    gap:10px;

    margin-bottom:10px;
    text-align:center;
    font-size:13px;
    color:#bbb;
}

.toggle-row{
    display:grid;
    grid-template-columns:120px 80px 80px;
    justify-content:center;
    align-items:center;
    gap:10px;

    margin:12px 0;
}


/* 状態カード */

.state-card{

background:#1a1d24;

border-radius:12px;

padding:12px;

margin-bottom:16px;

border:1px solid #2a2f3a;

box-shadow:
0 4px 10px rgba(0,0,0,0.4);

}

/* カードタイトル */

.state-title{

font-size:13px;

font-weight:bold;

margin-bottom:8px;

color:#9ca3af;

border-bottom:1px solid #333;

padding-bottom:4px;

}


/* 入力カード */
.input-card{
    background:#11141a;
    border:1px solid #2a2f3a;
    border-radius:12px;
    padding:15px;
    margin-bottom:15px;

    box-shadow:0 4px 15px rgba(0,0,0,0.4);
}

/* ラベル */
.input-label{
    display:block;
    font-size:12px;
    color:#9ca3af;
    margin-bottom:6px;
}

/* 入力ボックス */
input[type="number"]{

    width:100%;
    padding:12px;
    box-sizing:border-box; 

    border-radius:10px;
    border:1px solid #333;

    background:#0f1115;
    color:white;

    font-size:16px;

    outline:none;

    transition:.2s;
}

/* フォーカス時（超重要） */
input[type="number"]:focus{
    border-color:#3b82f6;
    box-shadow:0 0 10px rgba(59,130,246,0.6);
}

/* プレースホルダ */
input::placeholder{
    color:#555;
}

/* セレクトボックス */
.custom-select{

    width:100%;
    padding:12px;

    border-radius:10px;
    border:1px solid #333;

    background:#0f1115;
    color:white;

    font-size:16px;

    appearance:none;

    outline:none;

    cursor:pointer;

    transition:.2s;
}

/* セレクト フォーカス */
.custom-select:focus{
    border-color:#3b82f6;
    box-shadow:0 0 10px rgba(59,130,246,0.6);
}

/* セレクトの矢印風 */
.custom-select{
    background-image:
        linear-gradient(45deg, transparent 50%, #888 50%),
        linear-gradient(135deg, #888 50%, transparent 50%);

    background-position:
        calc(100% - 20px) calc(50% - 3px),
        calc(100% - 15px) calc(50% - 3px);

    background-size:5px 5px,5px 5px;
    background-repeat:no-repeat;
}

/* チェックボックス */
.checkbox-label{
    display:flex;
    align-items:center;
    gap:8px;
    font-size:14px;
    margin-bottom:10px;
}

/* ボーナスボタン */
.bonus-group{
    display:none;
    gap:10px;
    margin-top:10px;
}

.bonus-group button{
    width:100%;
}

#bonusButtons{
    display:none;
}


/* --------------------------------------------------CZ関連CSS */

/* ================================
   CZモーダル専用
================================ */
.cz-btn-row{
    display:flex;
    justify-content:center;
    gap:10px;
    margin-top:15px;
}

/* ================================
   CZボタン（既存に寄せたシンプル）
================================ */
.cz-select,
.cz-character{

    flex:1;
    max-width:120px;

    padding:12px 0;

    font-size:14px;
    font-weight:bold;

    color:#fff;

    border:none;
    border-radius:8px;

    cursor:pointer;

    transition:.15s;

    /* ベース（暗め） */
    background:#2a2f3a;

    display:flex;
    align-items:center;
    justify-content:center;
}

/* ================================
   色（指定どおり）
================================ */

/* 無名（赤） */
.cz-select[data-type="無名"],
.cz-character[data-char="無名"]{
    background:#ef4444;
}

/* 生駒（緑） */
.cz-select[data-type="生駒"],
.cz-character[data-char="生駒"]{
    background:#22c55e;
}

/* 銅藍（青） */
.cz-select[data-type="銅藍"]{
    background:#3b82f6;
}

/* ================================
   ホバー・押下（軽め）
================================ */
.cz-select:hover,
.cz-character:hover{
    opacity:0.9;
}

.cz-select:active,
.cz-character:active{
    transform:scale(0.96);
}


.bell{
width:50%;
margin:10px auto;
background:linear-gradient(145deg,#facc15,#eab308);
color:black;
margin-top:10px;
}


/* =========================
   前兆モード
========================= */

.PreMod .btn{
    filter:brightness(1.1);
}

.PreMod .btn:hover{
    transform:scale(0.97);
}

/* トグルボタン */
.togglePreMode{
    background:#111;
    color:white;
    border:2px solid #333;
    transition:all .2s;
}

.togglePreMode:hover{
    background:#222;
}

/* ON時 */
.PreMod .togglePreMode{
    background:#facc15; /* 黄色 */
    border-color:#facc15;
    color:#000;
}

/* 上部バナー（追加） */
#preBanner{
    position:fixed;
    top:0;
    left:0;
    width:100%;

    background:#facc15;
    color:#000;

    text-align:center;
    font-weight:bold;
    font-size:14px;

    padding:8px 0;

    transform:translateY(-100%);
    transition:transform .25s;

    z-index:9999;
    box-shadow:0 2px 8px rgba(0,0,0,.3);
}

/* 表示 */
.PreMod #preBanner{
    transform:translateY(0);
}

/* 揺れ（undoと少し変えると分かりやすい） */
.PreMod .btn{
    animation:preShake 0.5s infinite alternate;
}

@keyframes preShake{
    from{ transform:translateY(0px); }
    to{ transform:translateY(-2px); }
}

.PreMod .btn{
    box-shadow:0 0 8px rgba(250,204,21,0.6);
}

.util.end{
    grid-column: span 2;
}


.pre-actions{
    display:flex;
    gap:8px;
    justify-content:center;
    margin-top:6px;
}

.pre-btn{
    font-size:15px;
    font-weight:bold;

    padding:12px 16px;
    min-width:100px; /* 横幅を揃える */

    border-radius:10px;
    border:none;

    background:#222;
    color:#fff;

    box-shadow:0 3px 8px rgba(0,0,0,0.3);

    cursor:pointer;
    transition:all .15s;
}

.pre-btn:hover{
    opacity:0.8;
}

.pre-status{
    margin-top:6px;
    text-align:center;
    font-size:12px;
    font-weight:bold;
    color:#000;
}

/* 数字部分を強調 */
#preCount{
    display:inline-block;
    min-width:28px;
    padding:4px 8px;

    background:#000;
    color:#facc15;

    border-radius:999px;
    font-size:13px;

    margin-right:4px;

    box-shadow:0 2px 6px rgba(0,0,0,0.3);
}



.pre-btn:active{
    transform:scale(0.95);
}

/* =========================
   データ収集モーダル専用
========================= */

#endModal .modal-content{
    border:1px solid #2a2f3a;
    background:linear-gradient(145deg,#1a1d24,#11141a);

    box-shadow:
        0 10px 40px rgba(0,0,0,0.7),
        inset 0 0 20px rgba(255,255,255,0.02);
}

/* タイトル */
#endModal h2{
    font-size:18px;
    margin-bottom:10px;

    background:linear-gradient(90deg,#3b82f6,#06b6d4);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
}

/* 説明文 */
#endModal p{
    font-size:13px;
    color:#bbb;
    line-height:1.6;
    margin-bottom:15px;
}

/* セクション区切り */
.end-section{
    text-align:left;
    margin-top:15px;
    padding-top:10px;
    border-top:1px solid #2a2f3a;
}

.title_section{
    margin-top:15px;
    padding-top:10px;
    border-top:1px solid #2a2f3a;
}
/* ラベル */
.end-label{
    font-size:12px;
    color:#9ca3af;
    margin-bottom:6px;
    display:block;
}

/* セレクト（既存流用＋微調整） */
#endModal select{
    width:100%;
    padding:10px;

    border-radius:8px;
    border:1px solid #333;

    background:#0f1115;
    color:white;

    font-size:14px;

    outline:none;
}

#endModal select:focus{
    border-color:#3b82f6;
    box-shadow:0 0 8px rgba(59,130,246,0.5);
}

/* チェックボックス行 */
.end-check{
    display:flex;
    align-items:center;
    gap:8px;

    margin-top:12px;
    font-size:13px;
}

/* ボタンエリア */
.end-actions{
    display:flex;
    gap:10px;
    margin-top:18px;
}

/* 共通ボタン */
.end-btn{
    flex:1;
    padding:12px;

    border-radius:10px;
    border:none;

    font-size:14px;
    font-weight:bold;

    cursor:pointer;
    transition:.2s;
}

/* 同意ボタン（メインCTA） */
.end-submit{
    background:linear-gradient(45deg,#ef4444,#ff1744);
    color:white;

    box-shadow:0 4px 15px rgba(239,68,68,0.4);
}

.end-submit:hover{
    transform:scale(1.03);
}

/* 無効状態 */
.end-submit:disabled{
    background:#444;
    box-shadow:none;
    cursor:not-allowed;
    opacity:.6;
}

/* キャンセル */
.end-cancel{
    background:#2a2f3a;
    color:#bbb;
}

.end-cancel:hover{
    background:#374151;
    color:white;
}