/* Sytech Buy Gift — 赠品规格弹窗 v2.3
 * 结构：固定头部 / 可滚动内容 / 固定底部确认条。尺寸全部用 px，不受主题 rem 影响。
 * 桌面居中卡片，手机底部抽屉。多个赠品分组，规格再多也只滚动内容区。 */
body.sytech-gc-lock { overflow: hidden; }

.sytech-gc-modal {
    --gc-primary: var(--primary, #1E8441);
    --gc-bg: #fff;
    --gc-text: #191919;
    --gc-sub: #6b7280;
    --gc-line: #eceef2;
    --gc-card: #fff;
    --gc-card-line: #e3e6ec;
    --gc-foot: #f8f9fb;
    --gc-icon-bg: rgba(30, 132, 65, 0.1);
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}
.sytech-gc-modal[hidden] { display: none; }
.sytech-gc-modal *,
.sytech-gc-modal *::before,
.sytech-gc-modal *::after { box-sizing: border-box; }

.sytech-gc-modal.is-theme {
    --gc-bg: #191919;
    --gc-text: #fff;
    --gc-sub: rgba(255, 255, 255, 0.66);
    --gc-line: rgba(255, 255, 255, 0.1);
    --gc-card: rgba(255, 255, 255, 0.05);
    --gc-card-line: rgba(255, 255, 255, 0.14);
    --gc-foot: #191919;
    --gc-icon-bg: rgba(255, 255, 255, 0.1);
}

.sytech-gc-mask {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 24, 0.5);
}
.sytech-gc-modal.is-open .sytech-gc-mask { animation: sytech-gc-fade 0.22s ease both; }

.sytech-gc-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 840px;
    max-height: min(860px, calc(100vh - 48px));
    background: var(--gc-bg);
    color: var(--gc-text);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
.sytech-gc-modal.is-open .sytech-gc-dialog { animation: sytech-gc-pop 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.sytech-gc-dialog-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.sytech-gift-chooser {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.sytech-gift-chooser.is-empty { display: none; }
.sytech-gc-modal.is-loading .sytech-gc-dialog { pointer-events: none; }
.sytech-gc-modal.is-loading .sytech-gc-scroll { opacity: 0.55; transition: opacity 0.15s; }
/* 提交中：按钮显示转圈并锁定，立即给出反馈 */
.sytech-gc-modal.is-loading button.sytech-gc-confirm {
    position: relative;
    cursor: progress;
    filter: none;
    transform: none;
    opacity: 0.9;
}
.sytech-gc-modal.is-loading button.sytech-gc-confirm::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin: -3px 10px 0 0;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: middle;
    animation: sytech-gc-spin 0.7s linear infinite;
}
@keyframes sytech-gc-spin { to { transform: rotate(360deg); } }

@keyframes sytech-gc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sytech-gc-pop {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
@keyframes sytech-gc-sheet {
    from { transform: translateY(100%); }
    to { transform: none; }
}

/* 关闭按钮 */
.sytech-gc-modal .sytech-gc-x {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 3;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--gc-icon-bg);
    color: var(--gc-text);
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.25s;
}
.sytech-gc-x::before,
.sytech-gc-x::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 1.5px;
    background: currentColor;
}
.sytech-gc-x::before { transform: translate(-50%, -50%) rotate(45deg); }
.sytech-gc-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.sytech-gc-modal .sytech-gc-x:hover { background: var(--gc-primary); color: #fff; transform: rotate(90deg); }

/* 头部 */
.sytech-gc-head {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
    padding: 32px 84px 24px 36px;
    border-bottom: 1px solid var(--gc-line);
}
/* 本站 header 是吸顶深色条，弹窗头部也是 header，这里把主题样式挡在弹窗外 */
.sytech-gc-modal header.sytech-gc-head {
    position: static;
    top: auto;
    z-index: auto;
    background: transparent;
    color: var(--gc-text);
}
.sytech-gc-modal header.sytech-gc-head::after {
    content: none;
    display: none;
}
.sytech-gc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--gc-icon-bg);
    color: var(--gc-primary);
}
.sytech-gc-modal.is-theme .sytech-gc-icon { color: #fff; }
.sytech-gc-head-text { min-width: 0; }
.sytech-gc-modal h2.sytech-gc-title {
    margin: 0;
    padding: 0;
    color: var(--gc-text);
    font-family: inherit;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
}
.sytech-gc-lead {
    margin: 6px 0 0;
    color: var(--gc-sub);
    font-size: 16px;
    line-height: 1.5;
}

/* 内容区（唯一滚动区） */
.sytech-gc-scroll {
    flex: 1 1 auto;
    min-height: 0;
    padding: 4px 36px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.sytech-gc-scroll::-webkit-scrollbar { width: 6px; }
.sytech-gc-scroll::-webkit-scrollbar-thumb { background: var(--gc-card-line); border-radius: 3px; }

.sytech-gc-slot { padding: 28px 0 26px; }
.sytech-gc-slot + .sytech-gc-slot { border-top: 1px solid var(--gc-line); }
.sytech-gc-slot-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}
.sytech-gc-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 22px;
    padding: 0 8px;
    border-radius: 11px;
    background: var(--gc-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}
.sytech-gc-gift-name {
    min-width: 0;
    color: var(--gc-text);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.4;
    word-break: break-word;
}
.sytech-gc-qty {
    color: var(--gc-sub);
    font-size: 15px;
    font-weight: 500;
}
.sytech-gc-picked {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    margin-left: auto;
    color: var(--gc-primary);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}
.sytech-gc-modal.is-theme .sytech-gc-picked { color: #7be0a3; }
.sytech-gc-picked[hidden] { display: none; }
.sytech-gc-picked svg { flex: 0 0 auto; }
.sytech-gc-picked-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}
.sytech-gc-note {
    margin: 12px 0 0;
    color: #D63031;
    font-size: 14px;
    line-height: 1.5;
}

/* 规格网格：数量再多自动换行，卡片等宽等高 */
.sytech-gc-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.sytech-gc-modal button.sytech-gc-option {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: auto;
    height: 100%;
    margin: 0;
    padding: 10px 10px 10px;
    border: 2px solid var(--gc-card-line);
    border-radius: 18px;
    background: var(--gc-card);
    color: var(--gc-text);
    font: inherit;
    text-align: center;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
    cursor: pointer;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s, background-color 0.18s;
    -webkit-tap-highlight-color: transparent;
}
.sytech-gc-modal button.sytech-gc-option:hover { border-color: var(--gc-primary); transform: translateY(-2px); }
.sytech-gc-modal button.sytech-gc-option:focus-visible { outline: 2px solid var(--gc-primary); outline-offset: 2px; }
.sytech-gc-modal button.sytech-gc-option.is-selected {
    border-color: var(--gc-primary);
    box-shadow: none;
    transform: none;
}
/* 主题色底下卡片用纯白实心底，避免半透明发灰 */
.sytech-gc-modal.is-theme button.sytech-gc-option { background: #fff; border-color: #fff; color: #191919; }
.sytech-gc-modal.is-theme button.sytech-gc-option:hover,
.sytech-gc-modal.is-theme button.sytech-gc-option.is-selected { border-color: var(--gc-primary); }
.sytech-gc-modal.is-theme .sytech-gc-option .sytech-gc-label { color: #191919; }
.sytech-gc-modal.is-theme .sytech-gc-img { background: #f4f5f7; }
.sytech-gc-modal.is-white .sytech-gc-img { background: #f4f5f7; }
.sytech-gc-modal.is-theme .sytech-gc-option.is-disabled { background: #e9ebef; border-color: #e9ebef; }

.sytech-gc-image { position: relative; display: block; }
.sytech-gc-img {
    position: relative;
    display: block;
    padding-bottom: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
}
.sytech-gc-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
/* 选中勾：图片右上角 */
.sytech-gc-tick {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--gc-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2.2 6.2 4.8 8.8 9.8 3.2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px 16px;
    box-shadow: none;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.18s, transform 0.22s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.sytech-gc-option.is-selected .sytech-gc-tick { opacity: 1; transform: none; }

.sytech-gc-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    gap: 2px;
    min-height: 44px;
    margin-top: 12px;
}
.sytech-gc-label {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
    color: var(--gc-text);
    font-size: 15.5px;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
    word-break: break-word;
}
.sytech-gc-option.is-selected .sytech-gc-label { font-weight: 600; }
.sytech-gc-stock {
    display: block;
    color: #D63031;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
}
.sytech-gc-modal button.sytech-gc-option.is-disabled,
.sytech-gc-modal button.sytech-gc-option[disabled] {
    cursor: not-allowed;
    transform: none;
    border-color: var(--gc-card-line);
}
.sytech-gc-option.is-disabled .sytech-gc-img,
.sytech-gc-option[disabled] .sytech-gc-img { opacity: 0.4; filter: grayscale(1); }
.sytech-gc-option.is-disabled .sytech-gc-label,
.sytech-gc-option[disabled] .sytech-gc-label { opacity: 0.55; }

/* 底部确认条（固定） */
.sytech-gc-foot {
    flex: 0 0 auto;
    padding: 20px 36px;
    border-top: 1px solid var(--gc-line);
    background: var(--gc-foot);
}
.sytech-gc-modal button.sytech-gc-confirm {
    display: block;
    width: 100%;
    height: 58px;
    margin: 0;
    padding: 0 28px;
    border: 0;
    border-radius: 14px;
    background: var(--gc-primary);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 58px;
    letter-spacing: 0.02em;
    text-align: center;
    text-transform: none;
    box-shadow: none;
    cursor: pointer;
    transition: filter 0.18s, transform 0.18s, box-shadow 0.18s;
}
.sytech-gc-modal button.sytech-gc-confirm:hover { filter: brightness(1.08); transform: translateY(-1px); }
.sytech-gc-modal button.sytech-gc-confirm:active { transform: none; box-shadow: none; }
.sytech-gc-modal button.sytech-gc-confirm:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }

@media (prefers-reduced-motion: reduce) {
    .sytech-gc-modal *, .sytech-gc-modal *::before { transition: none !important; }
    .sytech-gc-dialog, .sytech-gc-mask { animation: none !important; }
}

/* 平板及手机：底部抽屉 */
@media screen and (max-width: 640px) {
    .sytech-gc-modal { align-items: flex-end; padding: 0; }
    .sytech-gc-dialog {
        max-width: none;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 22px 22px 0 0;
    }
    .sytech-gc-modal.is-open .sytech-gc-dialog { animation: sytech-gc-sheet 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
    .sytech-gc-dialog::before {
        content: "";
        position: absolute;
        top: 8px;
        left: 50%;
        z-index: 3;
        width: 40px;
        height: 4px;
        margin-left: -20px;
        border-radius: 2px;
        background: var(--gc-card-line);
    }
    .sytech-gc-modal .sytech-gc-x { top: 14px; right: 14px; width: 32px; height: 32px; }
    .sytech-gc-head { gap: 12px; padding: 26px 56px 16px 16px; }
    .sytech-gc-icon { width: 44px; height: 44px; border-radius: 13px; }
    .sytech-gc-icon svg { width: 20px; height: 20px; }
    .sytech-gc-modal h2.sytech-gc-title { font-size: 19px; }
    .sytech-gc-lead { font-size: 13.5px; }
    .sytech-gc-scroll { padding: 0 16px 4px; }
    .sytech-gc-slot { padding: 16px 0 14px; }
    .sytech-gc-gift-name { font-size: 16px; }
    .sytech-gc-picked { font-size: 13.5px; margin-left: 0; width: 100%; }
    .sytech-gc-picked-text { max-width: none; }
    .sytech-gc-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
    .sytech-gc-modal button.sytech-gc-option { padding: 6px 6px 8px; border-radius: 12px; }
    .sytech-gc-img { border-radius: 8px; }
    .sytech-gc-tick { top: 4px; right: 4px; width: 22px; height: 22px; background-size: 12px 12px; }
    .sytech-gc-info { min-height: 36px; margin-top: 7px; }
    .sytech-gc-label { font-size: 13.5px; }
    .sytech-gc-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .sytech-gc-modal button.sytech-gc-confirm { height: 52px; line-height: 52px; font-size: 16px; }
}
@media screen and (max-width: 340px) {
    .sytech-gc-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
