﻿/* 放入測試開始 */

.grid-container {
    display: grid;
    grid-template-columns: auto auto;
    /*  grid-template-rows: 2fr 2fr 2fr 1fr 2fr 2fr;*/
    grid-template-rows: 80px 80px 80px 80px;
    gap: 1px;
    background-color: #cecece;
    /*padding: 3px;*/
}

.grid-container > div {
    background-color: rgba(255, 255, 255, 0.8);
    border: 0px black;
    text-align: center;
    font-size: 30px;
}

.circleImg {
    border-radius: 50%;
    width: 100px;
    height: 100px;
}

/* ========== 完全無 body 樣式，僅使用元件專屬容器與局部 class ========== */
/* 確保任何外界樣式不影響此元件，同時本元件樣式不洩漏至外部 */
/* 重置所有可能會繼承的邊距僅針對此元件的包覆層，不使用 body 選擇器 */
.my-number-control-wrapper {
    /* 獨立區域，不影響外部 */
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    display: inline-block; /* 讓元件僅佔所需寬度，不影響版面佈局 */
}

.my-number-control-wrapper * {
    box-sizing: inherit;
}

/* 卡片容器 - 自定義區域背景，僅作用於元件內部，不使用全域body背景 */
.number-card {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(2px);
    border-radius: 56px;
    padding: 30px 28px;
    box-shadow: 20px 20px 40px rgba(0,0,0,0.08), -8px -8px 16px rgba(255,255,255,0.6);
    transition: all 0.2s ease;
    /* 加上輕微邊框提高獨立性 */
    border: 1px solid rgba(255,255,255,0.5);
}

/* 主控制元件 - 採用 flex 緊密結合 */
.number-control {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border-radius: 60px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: box-shadow 0.2s;
}

/* 減號按鈕 */
.btn-dec,
.btn-inc {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    cursor: pointer;
    background: #f8faff;
    transition: all 0.2s ease;
    color: #2c3e66;
    border: none;
    outline: none;
    font-family: monospace;
}

.btn-dec {
    border-radius: 60px 0 0 60px;
    border-right: 1px solid rgba(0,0,0,0.08);
}

.btn-inc {
    border-radius: 0 60px 60px 0;
    border-left: 1px solid rgba(0,0,0,0.08);
}

    /* 按鈕 hover 效果 */
    .btn-dec:hover:not(.disabled),
    .btn-inc:hover {
        background: #eef2ff;
        transform: scale(0.96);
    }

    .btn-dec:active:not(.disabled),
    .btn-inc:active {
        background: #e2e8f0;
        transform: scale(0.94);
    }

/* 禁用樣式（當數字已經是1時，減號禁用） */
.btn-dec.disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background: #f0f2f5;
    color: #9aa6b5;
    transform: none;
    pointer-events: auto;
}

/* 數字輸入框 - 乾淨無箭頭專注數字 */
.number-input {
    width: 100px;
    text-align: center;
    font-size: 26px;
    font-weight: 600;
    font-family: 'Courier New', 'SF Mono', monospace;
    color: #1f2a44;
    background: #ffffff;
    border: none;
    outline: none;
    padding: 10px 0;
    margin: 0;
    line-height: 1.2;
    letter-spacing: 1px;
}

    /* 移除 spinners (number 上下箭頭) 但保留數字鍵盤 */
    .number-input::-webkit-outer-spin-button,
    .number-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .number-input[type="number"] {
        -moz-appearance: textfield;
        appearance: textfield;
    }

    /* 聚焦效果 */
    .number-input:focus {
        background: #fffdf7;
        box-shadow: inset 0 2px 5px rgba(0,0,0,0.02);
    }

/* 輔助說明區塊 */
.info-text {
    text-align: center;
    margin-top: 30px;
    font-size: 15px;
    color: #4a5b7a;
    background: rgba(255,255,240,0.7);
    border-radius: 40px;
    padding: 8px 16px;
    backdrop-filter: blur(4px);
    font-weight: 500;
}

    .info-text span {
        font-weight: 700;
        background: #1e2b48;
        color: white;
        padding: 4px 12px;
        border-radius: 32px;
        font-size: 14px;
        margin: 0 4px;
    }

/* RWD 小螢幕 - 僅限此元件內部調整 */
@@media (max-width: 480px) {
    .btn-dec, .btn-inc {
        width: 48px;
        height: 48px;
        font-size: 28px;
    }

    .number-input {
        width: 85px;
        font-size: 24px;
    }

    .number-card {
        padding: 24px 20px;
    }
}

/* 簡潔提示訊息 (toast) - 使用 fixed 但相對於視口，不影響其他元件結構 */
.custom-toast-msg {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2a44e6;
    color: white;
    padding: 8px 18px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(8px);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    font-family: system-ui, 'Segoe UI', sans-serif;
}

/* 確保元件放置在任何位置都不會繼承奇怪的外間距 */
.my-number-control-wrapper {
    margin: 0;
    padding: 0;
}

/* 示範區：為了在頁面中方便檢視，加一個簡單的佔位背景不代表body，完全不影響其他元件 */
/* 注意：完全沒有任何 body 樣式，優雅分離 */

.subject6 {
    width: 280px;
    height: 250px;
    border-radius: 20px;
    background: #454545;
    font-size: 16px;
    font-family: 'Global Monospace';
    font-weight: bold;
    text-align: center;
    vertical-align: middle;
    line-height: 50px;
    position: fixed;
    left: calc(50% - 140px);
    top: calc(50% - 25px);
    color: #fff;
}



/* 放入測試結束 */
.grid-container {
    display: grid;
    grid-template-columns: auto auto;
    /*  grid-template-rows: 2fr 2fr 2fr 1fr 2fr 2fr;*/
    grid-template-rows: 80px 80px 80px 80px;
    gap: 1px;
    background-color: #cecece;
    /*padding: 3px;*/
}

.grid-container > div {
    background-color: rgba(255, 255, 255, 0.8);
    border: 0px black;
    text-align: center;
    font-size: 30px;
}



.circleImg {
    border-radius: 50%;
    width: 100px;
    height: 100px;
}

.subject4 {
    width: 300px;
    height: 50px;
    border-radius: 20px;
    background: #454545;
    font-size: 16px;
    font-family: 'Global Monospace';
    font-weight: bold;
    text-align: center;
    line-height: 50px;
    position: fixed;
    left: calc(50% - 110px);
    top: calc(50% - 25px);
    color: #fff;
}

.preload {
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 998;
}

.close {
    background-color: lightcoral;
    color: white;
}


