/* 覆蓋 Bootstrap 預設顏色變數 */
:root {
    /* 1. Blue: 主色 (Primary) */
    --bs-primary: #00529b;
    --bs-primary-rgb: 0, 82, 155; 
    /* 2. Red: 錯誤 (Bootstrap 中稱為 Danger) */
    --bs-danger: #d9531e;
    --bs-danger-rgb: 217, 83, 30;
    /* 3. Green: 成功狀態 (Success) */
    --bs-success: #006225;
    --bs-success-rgb: 0, 98, 37;
    /* 4. Yellow: 警告狀態 (Warning) */
    --bs-warning: #ffe01b;
    --bs-warning-rgb: 255, 224, 27;
    /* 5. Light Blue: 資訊提示 (Info) */
    --bs-info: #a1d1f0;
    --bs-info-rgb: 161, 209, 240;
    /* 6. Black & White: 文字與背景 */
    --bs-body-color: #2D2926;
    --bs-body-bg: #FFFFFF;
    --bs-body-color-rgb: 45, 41, 38;
    --bs-body-bg-rgb: 255, 255, 255;
    /* 7. Navy: 次要色 (Secondary) */
    --bs-secondary: #00205B;
    --bs-secondary-rgb: 0, 32, 91;
    /* 字體大小 */
    --bs-body-font-size: 1rem;
}

/* WCAG 2.2 2.4.7: Global focus visible indicator */
:focus-visible { outline: 3px solid #0052CC; outline-offset: 2px; }

/* --- result modal custom styles --- */
#iconWrapper {
    width: 6rem;
    height: 6rem;
}
#iconWrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#iconWrapper.success {
    background-color: transparent;
    border: 1px solid var(--bs-success);
}

#iconWrapper.info {
    background-color: transparent;
    border: 1px solid var(--bs-info);
}

#resultTitle {
    font-size: 1.25rem;
}
#resultDetails .small {
    font-size: 0.8rem;
}

/* header styling */
#resultModal .modal-header {
    background-color: var(--bs-primary);
    color: #fff;
}
#resultModal .modal-header .btn-close {
    filter: invert(1); /* make close button white */
}

/* WCAG 2.2 2.5.5: Ensure header buttons meet 44px minimum touch target */
header .btn {
    min-width: 44px;
    min-height: 44px;
}


.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.focus,
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled):focus,
.btn-primary:not(:disabled):not(.disabled):hover {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}
/* Disabled primary button should still appear as primary color */
.btn-primary:disabled,
.btn-primary.disabled {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    opacity: 0.65; /* match bootstrap default opacity */
}

/* --- Compact card adjustments to reduce vertical height --- */
.compact-card .card-body {
    padding: 1rem 1.25rem !important;
}
.compact-card .mb-2,
.compact-card .mb-3,
.compact-card .mb-4 {
    margin-bottom: 0.75rem !important;
}
.puzzle-container {
    margin-bottom: 0.75rem;
}
.slider-wrapper {
    padding: 12px 8px;
}

/* --- 少量的自訂輔助樣式 --- */

/* 為了讓白色的卡片浮現出來，在 main 區塊加上一個淺灰背景 */
.custom-bg-light {
    background-color: #f4f5f6;
}

/* 控制卡片最大寬度 */
.custom-card-width {
    width: 100%;
    max-width: 500px;
}

/* 讓 footer 連結 hover 時有底線效果 */
.footer-links a:hover {
    text-decoration: underline !important;
    color: #ffffff !important;
}

/* WCAG 2.2 2.5.8: Increase footer link touch target to 28px+ */
footer a {
    display: inline-flex;
    align-items: center;
    padding: 6px 8px;
    min-height: 28px;
    text-decoration: underline;
}

/* --- Loading Spinner --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
    gap: 1rem;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

/* --- WCAG Accessibility: Skip Link --- */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background-color: var(--bs-primary);
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    font-weight: 500;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

/* --- WCAG Accessibility: Focus Visible Indicators --- */
button:focus-visible,
.btn:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

a:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

.modal-dialog .btn-close:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

/* WCAG 2.2 2.5.5: Ensure form inputs and buttons meet 44px minimum touch target */
input,
button,
.btn {
    min-height: 44px !important;
}