/* src/public/css/counter.css … 「カウンター」の見た目
   💡 リセット（クリア）のボタン・知らせ・詳細オプションは、共通の calc-common.css・money.css を使います。ダークモードは theme-dark.css の末尾 */

.cnt-board {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.cnt-top { display: flex; justify-content: flex-end; min-height: 36px; }
.cnt-tool {
    min-width: 40px;
    height: 36px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
}
.cnt-tool[hidden] { display: none; }

/* いまの数（大きく。けたが多いときは小さくする） */
.cnt-value {
    margin: 0;
    text-align: center;
    font-weight: bold;
    color: #1e3c72;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    font-size: clamp(3.5rem, 18vw, 7rem);
    white-space: nowrap; /* 数字の途中で折らない（入らないときは、JS が文字を小さくする） */
    overflow: hidden;
}
.cnt-value[data-len="6"], .cnt-value[data-len="7"] { font-size: clamp(3rem, 14vw, 6rem); }
.cnt-value[data-len="8"] { font-size: clamp(2.6rem, 12vw, 5.5rem); }

/* +1（いちばん押すボタン。大きく） */
.cnt-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 120px;
    border: none;
    border-radius: 16px;
    background: #f39c12;
    color: #fff;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation; /* すばやく続けて押しても、画面が拡大しないように */
    -webkit-user-select: none;
    user-select: none;
}
.cnt-plus:hover:not(:disabled) { background: #e67e22; }
.cnt-plus:active:not(:disabled) { transform: scale(0.98); }
.cnt-plus:disabled { opacity: 0.5; cursor: default; }
.cnt-plus:focus-visible, .cnt-minus:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* リセットと −1 は、同じ大きさで横に並べる（スマホでも） */
.mc-form .cnt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.mc-form .cnt-actions > button { width: 100%; min-height: 52px; margin: 0; font-size: 1.05rem; }
.cnt-minus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #1e3c72;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
}
.cnt-minus:disabled { opacity: 0.45; cursor: default; }

/* 途中からの数（詳細オプション） */
.cnt-set label { display: block; margin: 0 0 6px; font-weight: bold; color: #1e293b; }
.cnt-set-row { display: flex; gap: 8px; }
.mc-form .cnt-set-row input { flex: 1 1 auto; min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 1rem; }
.cnt-set-btn {
    flex: 0 0 auto;
    padding: 0 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #1e3c72;
    font-weight: bold;
    cursor: pointer;
}
.cnt-hint { margin: 6px 0 0; font-size: 0.82rem; color: #475569; }

/* 全画面：数とボタンを画面いっぱいに。どの向きでも、全部が画面に入るように（+1 が残りの高さを使う）
   💡 :fullscreen と :-webkit-full-screen は、知らないブラウザで丸ごと無視されないよう、別々に書く */
.cnt-board:fullscreen { display: grid; grid-template-rows: auto auto minmax(56px, 1fr) auto; width: 100%; height: 100%; box-sizing: border-box; padding: 16px; border: none; border-radius: 0; }
.cnt-board:fullscreen .cnt-value { font-size: clamp(3rem, min(22vw, 26vh), 16rem); }
.cnt-board:fullscreen .cnt-plus { min-height: 0; font-size: clamp(1.6rem, 6vh, 3rem); }
.cnt-board:-webkit-full-screen { display: grid; grid-template-rows: auto auto minmax(56px, 1fr) auto; width: 100%; height: 100%; box-sizing: border-box; padding: 16px; border: none; border-radius: 0; }
.cnt-board:-webkit-full-screen .cnt-value { font-size: clamp(3rem, min(22vw, 26vh), 16rem); }
.cnt-board:-webkit-full-screen .cnt-plus { min-height: 0; font-size: clamp(1.6rem, 6vh, 3rem); }

/* 横向きのスマホ（背の低い画面）：数と +1 を横に並べて、+1 がなるべく上に来るように */
@media (max-height: 500px) and (min-width: 600px) {
    .cnt-board:not(:fullscreen) { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto; column-gap: 16px; row-gap: 10px; }
    .cnt-board:not(:fullscreen) .cnt-top { grid-column: 1 / -1; min-height: 0; }
    .cnt-board:not(:fullscreen) .cnt-value { grid-column: 1; grid-row: 2 / span 2; align-self: center; font-size: clamp(2.6rem, 10vw, 5rem); }
    .cnt-board:not(:fullscreen) .cnt-plus { grid-column: 2; min-height: 84px; }
    .cnt-board:not(:fullscreen) .cnt-actions { grid-column: 2; }
}

@media (max-width: 480px) {
    .cnt-plus { min-height: 104px; font-size: 1.5rem; }
}

/* 全画面で、もう一度押すと 0 に戻る状態のリセット */
.mc-form .cnt-actions > .btn-clear-tool.is-armed,
.mc-form .cnt-actions > .btn-clear-tool.is-armed:hover { background: #dc2626; color: #fff; }
