.mhc-box-calculator,
.mhc-box-calculator * {
    box-sizing: border-box;
}

/* 確保 HTML hidden 屬性不會被元件自身的 display 規則覆蓋 */
.mhc-box-calculator [hidden] {
    display: none !important;
}

.mhc-box-calculator {
    --mhc-border: #e5e7eb;
    --mhc-text: #1f2937;
    --mhc-muted: #6b7280;
    --mhc-surface: #ffffff;
    --mhc-soft: #f7f7f5;
    --mhc-accent: #2f4a3d;
    max-width: 1080px;
    margin: 24px auto;
    color: var(--mhc-text);
    font-family: inherit;
}

.mhc-calculator-header {
    margin-bottom: 22px;
}

.mhc-eyebrow {
    margin: 0 0 8px;
    color: var(--mhc-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
}

.mhc-calculator-header h2 {
    margin: 0 0 10px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.15;
}

.mhc-calculator-header > p:last-child {
    margin: 0;
    color: var(--mhc-muted);
}

.mhc-calculator-grid {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 20px;
}

.mhc-calculator-panel {
    padding: clamp(20px, 3vw, 32px);
    border: 1px solid var(--mhc-border);
    border-radius: 22px;
    background: var(--mhc-surface);
    box-shadow: 0 12px 35px rgba(15, 23, 42, .06);
}

.mhc-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
}

.mhc-field input,
.mhc-field select {
    width: 100%;
    min-height: 50px;
    padding: 11px 14px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    color: var(--mhc-text);
    font: inherit;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.mhc-field input:focus,
.mhc-field select:focus {
    border-color: var(--mhc-accent);
    box-shadow: 0 0 0 3px rgba(47, 74, 61, .12);
}

.mhc-dimension-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 18px;
}

.mhc-formula-note {
    display: grid;
    gap: 5px;
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--mhc-soft);
    color: var(--mhc-muted);
    font-size: 13px;
    line-height: 1.6;
}

.mhc-formula-note strong {
    color: var(--mhc-text);
}

.mhc-error {
    min-height: 22px;
    margin: 12px 0 0;
    color: #b42318;
    font-size: 14px;
}

.mhc-action-row {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.mhc-box-calculator button {
    min-height: 48px;
    padding: 11px 20px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}

.mhc-box-calculator button:hover {
    transform: translateY(-1px);
}

.mhc-calculate-button,
.mhc-copy-button {
    background: var(--mhc-accent);
    color: #fff;
}

.mhc-reset-button {
    background: #eef0ed;
    color: var(--mhc-text);
}

.mhc-result-panel {
    min-height: 430px;
    background: #fcfcfb;
}

.mhc-result-placeholder {
    display: grid;
    min-height: 360px;
    place-items: center;
    color: var(--mhc-muted);
    text-align: center;
}

.mhc-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.mhc-summary-grid > div {
    padding: 14px;
    border: 1px solid var(--mhc-border);
    border-radius: 14px;
    background: #fff;
}

.mhc-summary-grid span,
.mhc-summary-grid strong {
    display: block;
}

.mhc-summary-grid span {
    margin-bottom: 5px;
    color: var(--mhc-muted);
    font-size: 12px;
}

.mhc-summary-grid strong {
    font-size: 16px;
}

.mhc-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--mhc-border);
    border-radius: 14px;
    background: #fff;
}

.mhc-price-table {
    width: 100%;
    border-collapse: collapse;
}

.mhc-price-table th,
.mhc-price-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--mhc-border);
    text-align: right;
    white-space: nowrap;
}

.mhc-price-table th:first-child,
.mhc-price-table td:first-child {
    text-align: left;
}

.mhc-price-table th {
    background: var(--mhc-soft);
    font-size: 13px;
}

.mhc-price-table tbody tr:last-child td {
    border-bottom: 0;
}

.mhc-copy-button {
    width: 100%;
    margin-top: 16px;
}

.mhc-copy-status {
    min-height: 20px;
    margin: 8px 0 0;
    color: var(--mhc-accent);
    text-align: center;
    font-size: 13px;
}

@media (max-width: 760px) {
    .mhc-calculator-grid {
        grid-template-columns: 1fr;
    }

    .mhc-dimension-grid {
        grid-template-columns: 1fr;
    }

    .mhc-summary-grid {
        grid-template-columns: 1fr;
    }

    .mhc-contact-actions {
        flex-direction: column;
    }

    .mhc-contact-actions a {
        width: 100%;
    }
}

.mhc-calculator-notice {
    margin-top: 14px;
    padding: 16px 18px;
    border-left: 4px solid #d99a2b;
    border-radius: 12px;
    background: #fff8e8;
    color: #5f4a22;
    font-size: 13px;
    line-height: 1.7;
}

.mhc-calculator-notice strong {
    display: block;
    margin-bottom: 6px;
    color: #3f321a;
    font-size: 14px;
}

.mhc-calculator-notice ol {
    margin: 0;
    padding-left: 1.4em;
}

.mhc-calculator-notice li + li {
    margin-top: 4px;
}

.mhc-over-limit {
    padding: 28px 22px;
    border: 1px solid #f1c7c2;
    border-radius: 16px;
    background: #fff7f6;
    text-align: center;
}

.mhc-over-limit-icon {
    display: grid;
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    place-items: center;
    border-radius: 50%;
    background: #b42318;
    color: #fff;
    font-size: 26px;
    font-weight: 800;
}

.mhc-over-limit h3 {
    margin: 0 0 8px;
    color: #7a271a;
    font-size: 24px;
}

.mhc-over-limit p {
    margin: 0 auto;
    max-width: 520px;
    color: #7a4b44;
    line-height: 1.7;
}

.mhc-contact-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.mhc-contact-actions a {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    transition: transform .15s, opacity .15s;
}

.mhc-contact-actions a:hover {
    transform: translateY(-1px);
    opacity: .92;
}

.mhc-line-button {
    background: #06c755;
    color: #fff;
}

.mhc-phone-button {
    background: var(--mhc-accent);
    color: #fff;
}

/* 盒型示意圖 */
.mhc-image-trigger {
    width: 100%;
    min-height: 42px !important;
    margin-top: 10px;
    padding: 9px 14px !important;
    border: 1px solid var(--mhc-border) !important;
    background: #fff;
    color: var(--mhc-accent);
}

.mhc-image-trigger:hover,
.mhc-image-trigger:focus {
    color: var(--mhc-accent);
}

.mhc-image-modal {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
}

.mhc-image-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .72);
    backdrop-filter: blur(3px);
}

.mhc-image-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(760px, 94vw);
    max-height: 90vh;
    overflow: auto;
    padding: 22px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
}

.mhc-image-modal-title {
    margin: 0 44px 16px 0;
    font-size: 22px;
}

.mhc-image-modal-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 12px;
    background: #f8fafc;
}

.mhc-image-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    width: 38px;
    min-height: 38px !important;
    padding: 0 !important;
    place-items: center;
    border-radius: 50% !important;
    background: #eef0ed;
    color: #111827;
    font-size: 25px !important;
    line-height: 1;
}

body.mhc-modal-open {
    overflow: hidden;
}

/* LINE / 電話按鈕 hover 保持文字顏色 */
.mhc-line-button,
.mhc-line-button:hover,
.mhc-line-button:focus,
.mhc-line-button:active,
.mhc-phone-button,
.mhc-phone-button:hover,
.mhc-phone-button:focus,
.mhc-phone-button:active {
    color: #fff !important;
}

/* v1.2.1: selected box type image is shown directly */
.mhc-box-image-preview {
    margin-top: 14px;
    text-align: center;
}
.mhc-box-image-preview[hidden] {
    display: none !important;
}
.mhc-box-image {
    display: block;
    width: 100%;
    max-width: 420px;
    height: auto;
    margin: 0 auto;
    border-radius: 12px;
}
.mhc-box-image-caption {
    margin-top: 8px;
    font-size: 14px;
    opacity: .72;
}

.mhc-formula-note{display:none!important;}
