:root {
    --page-bg: #f6f3ee;
    --navy: #0d447d;
    --gold: #f0b631;
    --red: #c93d2a;
    --text: #43474b;
    --panel: rgba(239, 247, 252, 0.76);
    --rule: rgba(68, 100, 126, 0.44);
    --radius-board: 30px;
    --radius-card: 17px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-width: 320px;
    min-height: 100vh;
    background: var(--page-bg);
    color: var(--text);
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.frame_bg {
    padding: 0px 0 180px 0 !important;
}

.voucher-page {
    width: min(100% - 40px, 1280px);
    margin: 0 auto;
    padding: 22px 0 34px;
}

.voucher-heading {
    min-height: 54px;
    margin: 0 auto 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    color: #103f71;
    font-size: clamp(24px, 2.05vw, 32px);
    font-weight: 800;
    letter-spacing: 0.055em;
    line-height: 1.1;
    text-align: center;
}

.heading-copy {
    white-space: nowrap;
}

.heading-dots {
    display: inline-flex;
    gap: 8px;
    flex: 0 0 auto;
}

.dot {
    width: 0.58em;
    aspect-ratio: 1;
    border-radius: 50%;
    display: inline-block;
}

.dot-gold {
    background: var(--gold);
}

.dot-red {
    background: var(--red);
}

.heading-arrow {
    flex: 0 0 auto;
    color: var(--red);
    font-size: 1.08em;
    font-weight: 900;
    transform: translateY(-1px);
}

.heading-count {
    position: relative;
    isolation: isolate;
    width: 1.62em;
    aspect-ratio: 1;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    overflow: hidden;
    background: var(--gold);
    color: #103f71;
    font-size: 1.02em;
    font-weight: 900;
    letter-spacing: 0;
}

.heading-count::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 25% 22%, rgba(255, 255, 255, .28) 0 10%, transparent 11%),
        linear-gradient(125deg, transparent 38%, rgba(255, 255, 255, .18) 39% 44%, transparent 45%);
}

.voucher-board {
    position: relative;
    overflow: hidden;
    padding: 42px 17px 18px;
    border-radius: var(--radius-board);
    background:
        url(../img/register/bg.png);
    background-repeat: repeat-y;

}

.voucher-board::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .24;
    background:
        repeating-linear-gradient(12deg, rgba(255, 255, 255, .12) 0 2px, rgba(36, 83, 114, .035) 3px 5px),
        repeating-linear-gradient(103deg, transparent 0 30px, rgba(255, 255, 255, .10) 31px 33px);
    mix-blend-mode: soft-light;
}

.channel-card,
.voucher-notes {
    position: relative;
    z-index: 1;
}

.channel-card {
    margin: 0 0 39px;
    padding: 37px 18px 17px;
    border-radius: var(--radius-card);
    background: var(--panel);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .44);
}

.channel-card--compact {
    padding-top: 20px;
    padding-bottom: 10px;
}

.channel-card:last-of-type {
    margin-bottom: 22px;
}

.channel-title {
    position: absolute;
    top: -23px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 8px 23px 9px;
    border-radius: 999px;
    background: var(--navy);
    color: var(--gold);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.channel-grid {
    display: grid;
    align-items: stretch;
}

.channel-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.channel-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.channel-grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.channel-grid--5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.channel-item {
    min-width: 0;
    min-height: 55px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 18px;
    font-weight: bold;
    letter-spacing: .025em;
    line-height: 1.25;
    text-align: center;
    overflow-wrap: anywhere;
    border-bottom: 1px dashed var(--rule);
}

.channel-grid--2 .channel-item,
.channel-grid--3 .channel-item {
    border-bottom: none;
}

/*四排的*/
.channel-grid--4 .channel-item:nth-child(5),
.channel-grid--4 .channel-item:nth-child(6),
.channel-grid--4 .channel-item:nth-child(7),
.channel-grid--4 .channel-item:nth-child(8) {
    border-bottom: none;
}

/*五排的*/
.channel-grid--5 .channel-item:nth-child(11),
.channel-grid--5 .channel-item:nth-child(12),
.channel-grid--5 .channel-item:nth-child(13),
.channel-grid--5 .channel-item:nth-child(14) {
    border-bottom: none;
}

.life .channel-item {
    border-bottom: none;
}

.mid {
    grid-column: 1 / -1;

    width: 80%;
    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: center;
}

/* 四個項目平均分配 */
.mid .channel-item {
    width: 25%;
    flex: 0 0 25%;

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;
    border-bottom: none;
}

/* 文字保持橫向，不要自動折行 */
.mid .channel-item a {
    white-space: nowrap;
}

/*
.channel-item--left {
    justify-content: flex-start;
    text-align: left;
}
*/

.channel-item--placeholder {
    pointer-events: none;
}

/*
.channel-grid--department .channel-item:nth-child(n + 6),
.channel-grid--dining .channel-item:nth-child(n + 6) {
    border-top: 1px dashed var(--rule);
}
*/

/*
.channel-grid--dining .channel-item:nth-child(n + 11) {
    border-top: 1px dashed var(--rule);
}
*/

.channel-card--compact .channel-item {
    min-height: 49px;
}

.voucher-notes {
    padding: 0 42px 3px;
    color: #555d63;
    font-size: clamp(11px, .92vw, 14px);
    letter-spacing: .015em;
    line-height: 1;
    text-align: right;
}

.voucher-notes p {
    margin: 0;
}

@media (max-width: 992px) {
    .channel-item a {
        font-size: 15px;
    }
}

@media (max-width: 900px) {
    .voucher-page {
        width: min(100% - 28px, 860px);
        padding-top: 18px;
    }

    .voucher-heading {
        flex-wrap: wrap;
        gap: 8px 10px;
        font-size: clamp(22px, 3vw, 31px);
    }

    .voucher-board {
        padding: 48px 16px 20px;
        border-radius: 24px;
    }

    .channel-card {
        margin-bottom: 43px;
        padding-inline: 14px;
    }

    .channel-title {
        max-width: calc(100% - 24px);
        font-size: 20px;
    }

    .channel-grid--5,
    .channel-grid--4 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .channel-item--placeholder {
        display: none;
    }

    .channel-grid--department .channel-item,
    .channel-grid--dining .channel-item {
        border-top: 0;
    }

    /*
    .channel-grid--department .channel-item:nth-child(n + 4),
    .channel-grid--dining .channel-item:nth-child(n + 4) {
        border-top: 1px dashed var(--rule);
    }
*/

    .channel-item {
        min-height: 56px;
        font-size: clamp(16px, 2.2vw, 21px);
    }

    .voucher-notes {
        padding-inline: 18px;
        text-align: left;
    }

    .channel-grid--dining .mid {
        display: contents;
    }

    .mid .channel-item {
        display: contents;
        line-height: 50px;
    }

    .mid .channel-item a {
        border-bottom: 1px dashed var(--rule);
    }
}

@media (max-width: 768px) {
    .channel-title {
        font-size: 18px;
    }

    .channel-grid--4 .channel-item:nth-child(5),
    .channel-grid--4 .channel-item:nth-child(6) {
        border-bottom: 1px dashed var(--rule);
    }
}

@media (max-width: 640px) {
    .voucher-page {
        width: min(100% - 18px, 620px);
        padding: 12px 0 20px;
    }


    .heading-dots {
        gap: 5px;
    }

    .voucher-board {
        padding: 43px 10px 16px;
        border-radius: 20px;
    }

    .channel-card,
    .channel-card--compact {
        margin-bottom: 39px;
        padding: 31px 9px 13px;
        border-radius: 14px;
    }

    .channel-title {
        top: -22px;
        max-width: calc(100% - 14px);
        padding: 8px 17px 9px;
        white-space: normal;
    }

    .channel-title {
        max-width: 324px;
        width: 150px;
    }

    .channel-grid--5,
    .channel-grid--4,
    .channel-grid--3,
    .channel-grid--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .channel-grid--department .channel-item,
    .channel-grid--dining .channel-item {
        border-top: 0;
    }

    /*
    .channel-grid--department .channel-item:nth-child(n + 3),
    .channel-grid--dining .channel-item:nth-child(n + 3),
    .channel-grid--3 .channel-item:nth-child(n + 3),
    .channel-grid--4 .channel-item:nth-child(n + 3) {
        border-top: 1px dashed var(--rule);
    }
*/

    /* 補上 3 項目區塊在手機 2 欄排版時，第二列右側空白格的虛線 */
    /*
    .channel-grid--3::after {
        content: "";
        display: block;
        min-height: 52px;
        border-top: 1px dashed var(--rule);
    }
*/

    .channel-card--compact .channel-item {
        min-height: 52px;
    }

    .channel-item,
    .channel-item--left {
        min-height: 52px;
        padding: 8px 8px;
        justify-content: center;
        font-size: clamp(14px, 4vw, 18px);
        line-height: 1.28;
        text-align: center;
    }

    .voucher-notes {
        padding: 0 7px;
        font-size: 11px;
        line-height: 1.65;
    }

    .channel-grid--3 .channel-item {
        border-bottom: 1px dashed var(--rule);
    }

    .channel-grid--3 .channel-item:nth-child(3) {
        border-bottom: none;
    }

    .life .channel-item:nth-child(1),
    .life .channel-item:nth-child(2) {
        border-bottom: 1px dashed var(--rule);
    }

    .channel-grid--3 .channel-item:last-child {
        grid-column: 1 / -1;
        justify-self: center;
        width: 50%;
    }

    .channel-title {
        font-size: 16px;
    }

    .mid .channel-item:nth-child(3) a,
    .mid .channel-item:nth-child(4) a {
        border-bottom: none;
    }

    /*    標題斷行*/
    .voucher-heading {
        display: grid;
        grid-template-columns: auto auto auto;
        justify-content: center;
        align-items: center;

        column-gap: 8px;
        row-gap: 12px;

        text-align: center;
    }

    /* 第一行：左邊圓點 */
    .voucher-heading > .heading-dots:first-child {
        grid-column: 1;
        grid-row: 1;
    }

    /* 第一行：Sony 好禮即享券 */
    .voucher-heading > .heading-copy:first-of-type {
        grid-column: 2;
        grid-row: 1;
    }

    /* 第一行：> */
    .voucher-heading > .heading-arrow {
        grid-column: 3;
        grid-row: 1;
    }

    /* 第二行：36 */
    .voucher-heading > .heading-count {
        grid-column: 1;
        grid-row: 2;
        justify-self: end;
    }

    /* 第二行：項品牌隨選輕鬆換 */
    .voucher-heading > .heading-copy:last-of-type {
        grid-column: 2;
        grid-row: 2;
        justify-self: center;
    }

    /* 第二行：右邊圓點 */
    .voucher-heading > .heading-dots:last-child {
        grid-column: 3;
        grid-row: 2;
        justify-self: start;
    }


}

@media (max-width: 460px) {
    .voucher-heading {
        margin-bottom: 14px;
        font-size: clamp(19px, 3.2vw, 16px);
        letter-spacing: 0px;
    }
}

@media (max-width: 430px) {
    .voucher-heading {
        gap: 7px;
    }

    .heading-copy:first-of-type,
    .heading-copy:last-of-type {
        width: auto;
    }

    .channel-grid--5,
    .channel-grid--4,
    .channel-grid--3,
    .channel-grid--2 {
        grid-template-columns: 1fr 1fr;
    }

    .channel-item {
        font-size: 14px;
    }


}

@media (max-width: 420px) {
    .channel-item a {
        font-size: 14px;
    }

    .voucher-heading {
        font-size: clamp(16px, 3.2vw, 16px);
    }
}

@media (max-width: 400px) {
    .channel-item a {
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    .channel-item a {
        font-size: 12px;
    }
}
