@import url('https://fonts.googleapis.com/css2?family=Onest:wght@100..900&display=swap');

:root {
    --gifts-bg: #f6f7f8;
    --gifts-surface: #ffffff;
    --gifts-surface-soft: #f7f8fa;
    --gifts-text: #27292d;
    --gifts-muted: #707884;
    --gifts-line: #e5e8ec;
    --gifts-shadow: 0 12px 34px rgba(31, 41, 55, 0.07);
    --gifts-blue: #3b82f6;
    --gifts-orange: #fc5518;
    --gifts-green: #7cb261;
}

* {
    box-sizing: border-box;
    font-family: 'Onest', Arial, sans-serif;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--gifts-bg);
    color: var(--gifts-text);
    overflow-x: hidden;
}

.gifts-page {
    width: 100%;
    min-height: 100svh;
    padding: clamp(4.55rem, 8vh, 5.5rem) clamp(1.2rem, 3vw, 2rem) clamp(1rem, 2.4vh, 1.6rem);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gifts-bg);
}

.gifts-shell {
    width: min(100%, 73rem);
    height: min(43.5rem, calc(100svh - 7.2rem));
    min-height: 37rem;
    display: grid;
    grid-template-columns: minmax(0, 1.23fr) minmax(19rem, .77fr);
    gap: 1.2rem;
}

.gifts-left-stack {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1.2rem;
}

.gifts-secondary-grid {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
    align-items: stretch;
}

.gifts-offer-card,
.gifts-secondary-grid > .gifts-card {
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.gifts-card {
    min-width: 0;
    height: 100%;
}

.gifts-card {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--gifts-line);
    border-radius: 1.5rem;
    background: var(--gifts-surface);
    box-shadow: var(--gifts-shadow);
}

.gifts-redeem-card {
    padding: 1.35rem;
}

/* The gift card itself is the left-top block; there is no extra white shell around it. */
.gifts-showcase-card {
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    align-self: start;
    justify-self: stretch;
}

.gifts-offer-card {
    min-width: 0;
    padding: 1.35rem clamp(1.65rem, 3.2vh, 2.35rem);
    display: flex;
    flex-direction: column;
}

.gifts-offer-copy {
    margin-top: .5rem;
}

.gifts-offer-eyebrow {
    font-size: .76rem;
}

.gifts-offer-eyebrow img {
    width: 1.14rem;
    height: 1.14rem;
}


.gifts-offer-copy h1 {
    margin: 0;
    max-width: 25rem;
    color: var(--gifts-text);
    font-size: clamp(2.15rem, 3.5vw, 3.35rem);
    font-weight: 650;
    line-height: 1.02;
    letter-spacing: -.045em;
}

.gifts-offer-copy p {
    margin: 1rem 0 0;
    max-width: 27rem;
    color: var(--gifts-muted);
    font-size: clamp(.94rem, 1.15vw, 1.03rem);
    font-weight: 430;
    line-height: 1.58;
}

.gifts-benefits {
    margin: 1.05rem 0 0;
    padding: 0;
    display: grid;
    gap: .5rem;
    list-style: none;
}

.gifts-benefits li {
    position: relative;
    min-width: 0;
    padding-left: 1.45rem;
    color: var(--gifts-muted);
    font-size: clamp(.9rem, 1.05vw, 1rem);
    font-weight: 470;
    line-height: 1.46;
}

.gifts-benefits li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: .02em;
    color: var(--gifts-blue);
    font-size: .96em;
    font-weight: 760;
    line-height: 1.46;
}

.gifts-offer-price-card {
    margin-top: auto;
    padding-top: 1.08rem;
    border-top: 1px solid #e8ebef;
}

.gifts-plan-grid {
    margin-top: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
}

.gifts-plan-option {
    position: relative;
    min-width: 0;
    cursor: pointer;
}

.gifts-plan-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.gifts-plan-card {
    min-height: 7.15rem;
    padding: .82rem .86rem .78rem;
    display: flex;
    flex-direction: column;
    border: 1px solid #e1e5e9;
    border-radius: .92rem;
    background: #ffffff;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.gifts-plan-option:hover .gifts-plan-card {
    border-color: #cfd5dc;
    transform: translateY(-1px);
}

.gifts-plan-option input:checked + .gifts-plan-card {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6, 0 8px 22px rgba(31, 41, 55, .07);
}

.gifts-plan-option input:focus-visible + .gifts-plan-card {
    outline: 2px solid rgba(59, 130, 246, .38);
    outline-offset: 2px;
}


.gifts-plan-card-head {
    min-height: 1.45rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .42rem;
}

.gifts-plan-card-head b {
    color: #555c65;
    font-size: .79rem;
    font-weight: 650;
    line-height: 1.15;
}

.gifts-plan-card-head em {
    padding: .22rem .4rem;
    border-radius: 999px;
    background: #e8f2ff;
    color: #3975b8;
    font-size: .6rem;
    font-style: normal;
    font-weight: 720;
    line-height: 1;
    white-space: nowrap;
}

.gifts-plan-price {
    margin-top: .62rem;
    color: #202327;
    font-size: clamp(1.55rem, 2.65vw, 2rem);
    font-weight: 720;
    line-height: 1;
    letter-spacing: -.04em;
}

.gifts-plan-detail {
    margin-top: .5rem;
    color: #8a919a;
    font-size: .78rem;
    line-height: 1.4;
}

.gifts-offer-button {
    width: 100%;
    margin: .82rem 0 0;
}

.gifts-card__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: #8a929d;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.gifts-card__eyebrow img {
    width: 1.08rem;
    height: 1.08rem;
    object-fit: contain;
}


.gifts-info-copy {
    position: relative;
    z-index: 1;
}

.gifts-card .gifts-info-kicker {
    display: block;
    margin-bottom: .5rem;
    color: #8a929d;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.gifts-card .gifts-info-title {
    margin: 0;
    color: #2d3035;
    font-size: clamp(1.12rem, 1.7vw, 1.38rem);
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -.025em;
}

.gifts-card .gifts-info-text {
    margin: .52rem 0 0;
    color: #747b84;
    font-size: .84rem;
    line-height: 1.5;
}

.gifts-card h2 {
    margin: .5rem 0 0;
    color: var(--gifts-text);
    font-size: clamp(1.3rem, 2.2vw, 1.65rem);
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -.025em;
}

.gifts-card__lead {
    margin: .6rem 0 0;
    color: var(--gifts-muted);
    font-size: .9rem;
    line-height: 1.55;
}

.gift-card {
    position: relative;
    width: 100%;
    aspect-ratio: 1684 / 1190;
    container-type: inline-size;
    overflow: hidden;
    border: 1px solid #e1e5e9;
    border-radius: .9rem;
    isolation: isolate;
}

.gift-card--light {
    background: #ffffff;
    color: #171a20;
}

.gift-card--dark {
    border-color: #3a4655;
    background: #111827;
    color: #f3f4f6;
}

.gift-card__logo {
    position: absolute;
    z-index: 3;
    top: 6.05%;
    left: 6.24%;
    width: 15.62%;
    height: auto;
    object-fit: contain;
}

/* Gift certificate copy mirrors the current certificate layout on the same 1684×1190 grid. */
.gift-card__certificate-copy {
    position: absolute;
    z-index: 3;
    inset: 0;
    pointer-events: none;
}

.gift-card__certificate-hero,
.gift-card__meta,
.gift-card__team {
    position: absolute;
    left: 6.65%;
    width: 43.05%;
}

.gift-card__certificate-hero {
    top: 40.25%;
    width: 50.5%;
}

.gift-card__certificate-name {
    display: block;
    color: #171a20;
    font-size: 4.95cqw;
    font-weight: 760;
    line-height: 1;
    letter-spacing: -.035em;
    white-space: nowrap;
}

.gift-card__certificate-duration {
    max-width: 100%;
    margin: 2.0cqw 0 0;
    color: #6b7178;
    font-size: 2.30cqw;
    font-weight: 450;
    line-height: 1.22;
}

.gift-card__meta {
    top: 68.75%;
}

.gift-card__meta-label,
.gift-card__meta-value {
    display: block;
}

.gift-card__meta-label {
    color: #9aa1a9;
    font-size: 1.38cqw;
    font-weight: 650;
    line-height: 1;
    letter-spacing: .129em;
    text-transform: uppercase;
}

.gift-card__meta-value {
    margin-top: 1.25cqw;
    color: #171a20;
    font-size: 2.16cqw;
    font-weight: 540;
    line-height: 1;
    letter-spacing: 0;
}

.gift-card__team {
    bottom: 5.75%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.gift-card__team::before {
    content: '';
    width: 5.35cqw;
    height: .12cqw;
    min-height: 1px;
    margin-bottom: 1.0cqw;
    background: #fc5518;
}

.gift-card__team strong {
    color: #171a20;
    font-size: 1.50cqw;
    font-weight: 650;
    line-height: 1;
}

.gift-card__team span {
    margin-top: .42cqw;
    color: #9aa1a9;
    font-size: 1.20cqw;
    font-weight: 450;
    line-height: 1;
    white-space: nowrap;
}

.gift-card--dark .gift-card__certificate-name,
.gift-card--dark .gift-card__meta-value,
.gift-card--dark .gift-card__team strong {
    color: #f3f4f6;
}

.gift-card--dark .gift-card__certificate-duration {
    color: #9ca3af;
}

.gift-card--dark .gift-card__meta-label,
.gift-card--dark .gift-card__team span {
    color: #7f8a99;
}

.gift-card__verify {
    position: absolute;
    z-index: 4;
    right: 0;
    bottom: 2.7%;
    width: 15%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.gift-card__verify span {
    color: #9aa1a9;
    font-size: clamp(.34rem, .95cqw, .48rem);
    font-weight: 650;
    line-height: 1;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.gift-card__verify small {
    display: none;
}

.gift-card__verify + .gift-card__verify {
    display: none;
}

.gift-card--dark .gift-card__verify span {
    color: #7f8a99;
}

.gift-card--dark .gift-card__verify small {
    color: #7f8a99;
}

.gift-card__qr {
    position: absolute;
    z-index: 4;
    right: 3.03%;
    bottom: 6.30%;
    width: 8.91%;
    aspect-ratio: 1;
    display: block;
    padding: .535%;
    border-radius: .60cqw;
    background: #ffffff;
}

.gift-card__premium-word {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    user-select: none;
}

.gift-card--example {
    width: 100%;
    max-width: none;
    margin: 0;
}

.gifts-buy-row {
    width: min(100%, 31.25rem);
    margin: 1rem auto 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gifts-price {
    min-width: 6.8rem;
    display: flex;
    flex-direction: column;
    gap: .16rem;
}

.gifts-price strong {
    color: var(--gifts-text);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}

.gifts-price span {
    color: #89919b;
    font-size: .67rem;
}

.gifts-primary-button {
    min-height: 2.8rem;
    margin-left: auto;
    padding: .72rem 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: .82rem;
    background: #3b82f6;
    color: #ffffff !important;
    text-decoration: none;
    cursor: pointer;
    font-size: .87rem;
    font-weight: 650;
    transition: transform .18s ease, background-color .18s ease;
}

.gifts-primary-button:hover {
    transform: translateY(-1px);
    background: #2563eb;
}

.gifts-history-card {
    padding: 1.35rem;
}

.gifts-history-card--guest {
    min-height: 18.25rem;
}

.gifts-secondary-grid .gifts-history-card--guest {
    min-height: 0;
}

.gifts-secondary-grid .gifts-redeem-form {
    padding-top: 1rem;
}

.gifts-secondary-grid .gifts-empty {
    min-height: 6rem;
    margin-top: .65rem;
}

.gifts-secondary-grid .gifts-history-empty {
    min-height: 3.5rem;
    margin-top: auto;
    margin-bottom: 0;
    flex: 0 0 auto;
}


.gifts-secondary-grid .gifts-history-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gifts-history-content {
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gifts-secondary-grid .gifts-strip {
    min-height: 0;
    margin-top: auto;
    padding-top: .65rem;
}

.gifts-secondary-grid .gift-history-item {
    width: min(13.5rem, 86%);
    flex-basis: min(13.5rem, 86%);
}

.gifts-history-auth {
    margin-top: .65rem;
    display: block;
    color: #59616b;
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.4;
}

.gifts-history-auth a {
    flex: 0 0 auto;
    color: #3b82f6;
    font-weight: 650;
    text-decoration: none;
    text-transform: none;
}

.gifts-history-auth a:hover {
    text-decoration: underline;
    text-underline-offset: .16em;
}

.gifts-empty {
    min-height: 10.5rem;
    margin-top: 1rem;
    padding: 1rem;
    display: grid;
    place-items: center;
    border: 1px dashed #dfe3e8;
    border-radius: 1rem;
    background: #fafbfc;
    color: #8b939d;
    text-align: center;
    font-size: .84rem;
    line-height: 1.48;
}

.gifts-strip {
    margin-top: 1rem;
    padding-bottom: .3rem;
    display: flex;
    gap: .8rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: #cfd5dc transparent;
}

.gifts-strip::-webkit-scrollbar {
    height: .38rem;
}

.gifts-strip::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cfd5dc;
}

.gift-history-item {
    width: min(19.5rem, 86%);
    flex: 0 0 min(19.5rem, 86%);
    scroll-snap-align: start;
}

.gift-card--history {
    width: 100%;
    border-radius: .78rem;
}

.gift-history-item__meta {
    min-height: 2rem;
    padding: .5rem .1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
}

.gift-status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #727a84;
    font-size: .68rem;
    font-weight: 600;
}

.gift-status::before {
    content: '';
    width: .42rem;
    height: .42rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #a7afb9;
}

.gift-status--ready::before {
    background: var(--gifts-green);
}

.gift-status--used::before {
    background: #9ca3af;
}

.gift-copy-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #5d80ad;
    cursor: pointer;
    font-size: .68rem;
    font-weight: 600;
}

.gift-copy-button:hover {
    color: #3b6da6;
}

.gifts-redeem-card {
    display: flex;
    flex-direction: column;
}


.gifts-redeem-form {
    margin-top: auto;
    padding-top: 2rem;
}

.gifts-redeem-form label {
    display: block;
    margin-bottom: .5rem;
    color: #59616b;
    font-size: .72rem;
    font-weight: 650;
    text-transform: uppercase;
}

.gifts-redeem-control {
    display: flex;
    gap: .6rem;
}

.gifts-redeem-control input {
    min-width: 0;
    height: 3rem;
    flex: 1 1 auto;
    padding: 0 .9rem;
    border: 1px solid #dfe3e7;
    border-radius: .82rem;
    outline: none;
    background: #ffffff;
    color: var(--gifts-text);
    font-size: .88rem;
    font-weight: 560;
    letter-spacing: .055em;
    caret-color: auto;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.gifts-redeem-control input:focus {
    border-color: #9dc0f7;
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

.gifts-redeem-control input::placeholder {
    color: #a2a9b2;
    letter-spacing: .04em;
}

.gifts-redeem-control button {
    min-width: 7.2rem;
    height: 3rem;
    padding: 0 .9rem;
    border: 0;
    border-radius: .82rem;
    background: #eef0f2;
    color: #333333;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 650;
    transition: transform .2s ease, opacity .2s ease, background-color .18s ease, color .18s ease;
}

.gifts-redeem-control button:hover {
    transform: translateY(-1px);
}

.gifts-redeem-control button.is-ready {
    background: #3b82f6;
    color: #ffffff;
}

.gifts-redeem-control button.is-ready:hover {
    background: #2563eb;
}

.gifts-redeem-control button:disabled {
    cursor: default;
    opacity: .68;
}

.gifts-redeem-control button:disabled:hover {
    transform: none;
}

.gifts-redeem-message {
    min-height: 1.2rem;
    margin: .5rem 0 0;
    color: #d14f4f;
    font-size: .7rem;
    line-height: 1.35;
}

.gifts-redeem-message.is-success {
    color: #65984e;
}


body.dark-theme {
    background: #111827;
    color: #f3f4f6;
}

body.dark-theme .gifts-page {
    --gifts-bg: #111827;
    --gifts-surface: #1f2937;
    --gifts-surface-soft: #182230;
    --gifts-text: #f3f4f6;
    --gifts-muted: #9ca3af;
    --gifts-line: #374151;
    --gifts-shadow: 0 14px 34px rgba(0,0,0,.24);
}

body.dark-theme .gifts-card {
    border-color: var(--gifts-line);
    background: var(--gifts-surface);
    box-shadow: var(--gifts-shadow);
}

body.dark-theme .gifts-offer-copy h1,
body.dark-theme .gifts-plan-price {
    color: #f3f4f6;
}

body.dark-theme .gifts-offer-copy p {
    color: #9ca3af;
}

body.dark-theme .gifts-offer-price-card {
    border-top-color: #2c3644;
}

body.dark-theme .gifts-benefits li,
body.dark-theme .gifts-plan-detail {
    color: #9ca3af;
}

body.dark-theme .gifts-plan-card {
    border-color: #374151;
    background: #1b2634;
}


body.dark-theme .gifts-plan-option:hover .gifts-plan-card {
    border-color: #4b5563;
}

body.dark-theme .gifts-plan-option input:checked + .gifts-plan-card {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6, 0 10px 26px rgba(0, 0, 0, .22);
}

body.dark-theme .gifts-plan-card-head b {
    color: #c7cdd5;
}

body.dark-theme .gifts-plan-card-head em {
    background: #233c5b;
    color: #a9ccef;
}

body.dark-theme .gifts-heading h1,
body.dark-theme .gifts-card h2,
body.dark-theme .gifts-price strong {
    color: #f3f4f6;
}

body.dark-theme .gifts-heading p,
body.dark-theme .gifts-card__lead,
body.dark-theme .gifts-card .gifts-info-text {
    color: #9ca3af;
}

body.dark-theme .gifts-card .gifts-info-title {
    color: #f3f4f6;
}

body.dark-theme .gifts-redeem-form label,
body.dark-theme .gifts-history-auth {
    color: #d1d5db;
}

body.dark-theme .gifts-history-auth a {
    color: #3b82f6 !important;
}




body.dark-theme .gifts-empty {
    border-color: #3a4655;
    background: #182230;
    color: #8f99a6;
}

body.dark-theme .gifts-redeem-control input {
    border-color: #3b4655;
    background: #182230;
    color: #f3f4f6;
}

body.dark-theme .gifts-redeem-control input:focus {
    border-color: #5f95e8;
    box-shadow: 0 0 0 3px rgba(59,130,246,.14);
}

body.dark-theme .gifts-redeem-control button {
    background: #374151;
    color: #f3f4f6;
}

body.dark-theme .gifts-redeem-control button:hover {
    transform: translateY(-1px);
}

body.dark-theme .gifts-redeem-control button.is-ready {
    background: #3b82f6;
    color: #ffffff;
}

body.dark-theme .gifts-redeem-control button.is-ready:hover {
    background: #2563eb;
}

body.dark-theme .gifts-primary-button {
    background: #3b82f6;
}

body.dark-theme .gifts-primary-button:hover {
    background: #2563eb;
}


body.dark-theme .gift-copy-button {
    color: #8ab7ef;
}

body.dark-theme .gifts-strip {
    scrollbar-color: #4b5563 transparent;
}

body.dark-theme .gifts-strip::-webkit-scrollbar-thumb {
    background: #4b5563;
}


@media (min-width: 981px) and (min-height: 700px) {
    .gifts-secondary-grid > .gifts-card {
        padding: 1rem 1.1rem;
    }

    .gifts-secondary-grid .gifts-card__lead {
        margin-top: .4rem;
        font-size: .82rem;
        line-height: 1.4;
    }

    .gifts-secondary-grid .gifts-redeem-form {
        padding-top: .55rem;
    }

    .gifts-secondary-grid .gifts-redeem-form label {
        margin-bottom: .35rem;
        font-size: .66rem;
    }

    .gifts-secondary-grid .gifts-redeem-control input,
    .gifts-secondary-grid .gifts-redeem-control button {
        height: 2.65rem;
    }

    .gifts-secondary-grid .gifts-empty:not(.gifts-history-empty) {
        min-height: 3.5rem;
        margin-top: .4rem;
    }

    .gifts-history-empty {
        min-height: 3.5rem;
        margin-top: auto;
        margin-bottom: 1.7rem;
    }
}

@media (max-width: 980px), (max-height: 699px) {
    .gifts-page {
        min-height: 100svh;
        height: auto;
        align-items: flex-start;
        padding-top: 5.8rem;
        padding-bottom: 2rem;
    }

    .gifts-shell {
        height: auto;
        min-height: 0;
        grid-template-columns: 1fr;
    }

    .gifts-left-stack {
        grid-template-rows: auto auto;
    }

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

    .gifts-offer-card,
    .gifts-secondary-grid > .gifts-card {
        height: auto;
    }

    .gifts-showcase-card {
        width: 100%;
        height: auto;
        max-width: none;
        max-height: none;
        margin: 0;
    }

    .gifts-redeem-card,
    .gifts-history-card--guest {
        min-height: 0;
    }

    .gifts-offer-card {
        min-height: 28rem;
    }

    .gifts-secondary-grid .gifts-history-card {
        overflow: visible;
    }

    .gifts-history-content {
        overflow: visible;
    }

    .gifts-secondary-grid .gift-history-item {
        width: min(19.5rem, 86%);
        flex-basis: min(19.5rem, 86%);
    }
}

@media (max-width: 620px) {
    .gifts-page {
        padding: 5.8rem 1rem 2rem;
    }

    .gifts-secondary-grid {
        grid-template-columns: 1fr;
    }

    .gifts-offer-card,
    .gifts-redeem-card,
    .gifts-history-card {
        padding: 1.15rem;
        border-radius: 1.2rem;
    }


    .gifts-plan-grid {
        grid-template-columns: 1fr;
    }

    .gifts-plan-card {
        min-height: 6.45rem;
    }

    .gifts-buy-row {
        align-items: stretch;
        flex-direction: column;
    }

    .gifts-primary-button {
        width: 100%;
        margin-left: 0;
    }

    .gifts-redeem-control {
        flex-direction: column;
    }

    .gifts-redeem-control input,
    .gifts-redeem-control button {
        width: 100%;
    }

    .gift-history-item {
        width: 91%;
        flex-basis: 91%;
    }

    .gifts-history-auth {
        display: block;
    }

}

/* Compact gift history: thumbnail row + click-to-open preview modal. */
.gifts-secondary-grid .gifts-history-card {
    position: relative;
    z-index: 2;
    overflow: visible;
}

.gifts-history-content {
    min-height: 2.65rem;
    height: 2.65rem;
    flex: 0 0 2.65rem;
    margin-top: auto;
    padding: 0 .62rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #dfe3e7;
    border-radius: .82rem;
    background: #ffffff;
}

.gifts-history-auth {
    margin: 0;
    align-self: center;
    text-align: center;
}

.gifts-secondary-grid .gifts-history-empty,
.gifts-history-empty {
    width: 100%;
    min-height: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    display: grid;
    place-items: center;
    flex: 1 1 auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #8b939d;
}

.gifts-secondary-grid .gifts-history-strip,
.gifts-history-strip {
    width: 100%;
    min-height: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: none;
    scrollbar-width: none;
}

.gifts-history-strip::-webkit-scrollbar {
    display: none;
}

.gifts-secondary-grid .gift-history-item,
.gift-history-item {
    position: relative;
    width: 3.25rem;
    min-width: 3.25rem;
    max-width: 3.25rem;
    height: 2.3rem;
    flex: 0 0 3.25rem;
    scroll-snap-align: none;
}

.gift-history-preview {
    width: 100%;
    display: block;
    border: 1px solid transparent;
    border-radius: .42rem;
    cursor: pointer;
    outline: none;
    transition: border-color .18s ease, transform .18s ease;
}

.gift-history-preview:hover {
    border-color: #cfd5dc;
    transform: translateY(-1px);
}

.gift-history-preview:focus-visible {
    border-color: #cfd5dc;
    outline: 2px solid rgba(59, 130, 246, .42);
    outline-offset: 2px;
}

body.dark-theme .gift-history-preview:hover,
body.dark-theme .gift-history-preview:focus-visible {
    border-color: #4b5563;
}

.gift-card--history {
    width: 100%;
    border: 0 !important;
    outline: 0 !important;
    border-radius: .38rem;
    box-shadow: none !important;
    cursor: pointer;
}

/* Metadata is shown in the modal, not under the tiny thumbnail. */
.gift-history-preview > .gift-history-item__meta {
    display: none;
}

/* The current UI theme always wins over the theme saved with the gift. */
body:not(.dark-theme) .gift-card--history {
    background: #ffffff !important;
    color: #171a20 !important;
}

body.dark-theme .gifts-history-content {
    border-color: #3b4655;
    background: #182230;
}

body.dark-theme .gifts-secondary-grid .gifts-history-empty,
body.dark-theme .gifts-history-empty {
    border: 0;
    background: transparent;
    color: #8f99a6;
}

body.dark-theme .gift-card--history {
    background: #111827 !important;
    color: #f3f4f6 !important;
    border: 0 !important;
    box-shadow: none !important;
}

body.dark-theme .gift-card--history .gift-card__certificate-name,
body.dark-theme .gift-card--history .gift-card__meta-value,
body.dark-theme .gift-card--history .gift-card__team strong {
    color: #f3f4f6 !important;
}

body.dark-theme .gift-card--history .gift-card__certificate-duration {
    color: #9ca3af !important;
}

body.dark-theme .gift-card--history .gift-card__meta-label,
body.dark-theme .gift-card--history .gift-card__team span {
    color: #7f8a99 !important;
}

/* Full-size gift preview, visually aligned with the payment modal. */
body.gift-history-modal-open {
    overflow: hidden;
}

.gift-history-modal[hidden] {
    display: none !important;
}

.gift-history-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}

.gift-history-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.gift-history-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.gift-history-dialog {
    position: relative;
    z-index: 1;
    width: min(37rem, calc(100vw - 3rem));
    max-height: calc(100svh - 3rem);
    display: flex;
    flex-direction: column;
    gap: .72rem;
    transform: translateY(10px) scale(.985);
    transition: transform .2s cubic-bezier(.22, 1, .36, 1);
}

.gift-history-modal.is-open .gift-history-dialog {
    transform: translateY(0) scale(1);
}

.gift-history-modal-card {
    position: relative;
    z-index: 1;
    width: 100%;
    flex: 0 0 auto;
    border-radius: .9rem;
    box-shadow: 0 26px 70px rgba(15, 23, 42, .22) !important;
    cursor: default;
}

.gift-history-modal-close {
    position: absolute;
    top: .7rem;
    right: .7rem;
    z-index: 6;
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(226, 229, 233, .96);
    border-radius: .68rem;
    background: rgba(255, 255, 255, .94);
    color: #747b85;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.gift-history-modal-close:hover {
    color: #2f3135;
    background: #ffffff;
}

.gift-history-modal-controls {
    position: relative;
    z-index: 2;
    min-height: 3.15rem;
    padding: .72rem .86rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid #e1e5e9;
    border-radius: .9rem;
    background: #ffffff !important;
    box-shadow: none;
    opacity: 1;
    filter: none;
    mix-blend-mode: normal;
}

body:not(.dark-theme) .gift-history-modal .gift-history-modal-controls {
    border-color: #e1e5e9 !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

body.dark-theme .gift-history-modal .gift-history-modal-controls {
    border-color: #3a4655 !important;
    background: #111827 !important;
    box-shadow: none !important;
}

.gift-history-modal-controls .gift-status {
    font-size: .8rem;
    font-weight: 650;
}

.gift-history-modal-controls .gift-status::before {
    width: .48rem;
    height: .48rem;
}

.gift-history-modal-controls .gift-copy-button {
    min-height: 2.1rem;
    padding: .48rem .78rem;
    border: 0;
    border-radius: .68rem;
    background: #3b82f6;
    color: #ffffff !important;
    cursor: pointer;
    font-size: .76rem;
    font-weight: 650;
    white-space: nowrap;
    transition: transform .18s ease, background-color .18s ease;
}

.gift-history-modal-controls .gift-copy-button:hover {
    transform: translateY(-1px);
    background: #2563eb;
    color: #ffffff !important;
}

body.dark-theme .gift-history-modal-backdrop {
    background: rgba(3, 7, 18, .58);
}

body.dark-theme .gift-history-modal-card {
    box-shadow: 0 28px 76px rgba(0, 0, 0, .42) !important;
}

body.dark-theme .gift-history-modal-close {
    border-color: #3c4858;
    background: rgba(38, 50, 65, .94);
    color: #9ca3af;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .24);
}

body.dark-theme .gift-history-modal-close:hover {
    background: #2d3a4a;
    color: #f3f4f6;
}

body.dark-theme .gift-history-modal-controls .gift-status {
    color: #cbd5e1;
}

body.dark-theme .gift-history-modal-controls .gift-copy-button {
    background: #3b82f6;
    color: #ffffff !important;
}

body.dark-theme .gift-history-modal-controls .gift-copy-button:hover {
    background: #2563eb;
    color: #ffffff !important;
}

@media (max-width: 620px) {
    .gifts-history-content {
        min-height: 4.1rem;
        height: auto;
        flex-basis: auto;
    }

    .gifts-secondary-grid .gift-history-item,
    .gift-history-item {
        width: 4.1rem;
        min-width: 4.1rem;
        max-width: 4.1rem;
        height: 2.9rem;
        flex-basis: 4.1rem;
    }

    .gift-history-modal {
        padding: 1rem;
    }

    .gift-history-dialog {
        width: min(37rem, calc(100vw - 2rem));
        max-height: calc(100svh - 2rem);
    }

    .gift-history-modal-controls {
        min-height: 0;
        align-items: stretch;
        flex-direction: column;
        gap: .6rem;
    }

    .gift-history-modal-controls .gift-copy-button {
        width: 100%;
    }
}
