:root {
    --fam-green: #00a87a;
    --fam-green-dark: #007e64;
    --fam-blue: #0073bc;
    --fam-orange: #f05a24;
    --line-green: #06c755;
    --ink: #24343f;
    --muted: #60717d;
    --surface: #ffffff;
    --background: #eaf8ff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: max(14px, env(safe-area-inset-top)) 12px max(24px, env(safe-area-inset-bottom));
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 0%, rgba(255,255,255,.95), transparent 30%),
        linear-gradient(155deg, #d7f5ff 0%, #f4fff9 48%, #fff9e8 100%);
    font-family: 'Noto Sans TC', system-ui, sans-serif;
    line-height: 1.55;
}

button, select { font: inherit; }

.lang-switch {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    max-width: 620px;
    margin: 0 auto 10px;
    font-size: .82rem;
    color: var(--muted);
}

.lang-switch select {
    min-height: 44px;
    border: 1px solid #bfd4dd;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
}

.lang-switch select { padding: 7px 10px; }

main {
    max-width: 620px;
    margin: 0 auto;
    padding: 24px 16px;
    overflow: hidden;
    background: rgba(255,255,255,.96);
    border-top: 8px solid var(--fam-green);
    border-radius: 22px;
    box-shadow: 0 15px 42px rgba(0, 87, 122, .13);
}

.store-name {
    width: fit-content;
    margin: 0 auto 7px;
    padding: 5px 14px;
    color: #fff;
    background: var(--fam-green-dark);
    border-radius: 999px;
    font-size: .86rem;
    font-weight: 700;
}

.title {
    margin: 0;
    color: var(--fam-blue);
    font-size: clamp(1.75rem, 7vw, 2.55rem);
    font-weight: 900;
    line-height: 1.2;
    text-align: center;
    text-wrap: balance;
}

.subtitle {
    display: block;
    margin: 8px 0 20px;
    color: var(--fam-orange);
    font-weight: 900;
    text-align: center;
}

.poster-container {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 22px;
    padding: 0;
    border: 0;
    border-radius: 15px;
    overflow: hidden;
    background: #eef6f8;
    cursor: zoom-in;
    box-shadow: 0 7px 20px rgba(0,0,0,.13);
}

.promo-poster { display: block; width: 100%; height: auto; }

.poster-hint {
    position: absolute;
    right: 9px;
    bottom: 9px;
    padding: 5px 10px;
    color: #fff;
    background: rgba(0,0,0,.68);
    border-radius: 999px;
    font-size: .75rem;
}

.offer-card {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 13px;
    margin: 14px 0;
    padding: 17px;
    border: 1px solid #dcecef;
    border-radius: 17px;
    background: var(--surface);
    box-shadow: 0 4px 14px rgba(0,0,0,.055);
}

.offer-number,
.raffle-step {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    background: var(--fam-blue);
    font-size: 1.5rem;
    font-weight: 900;
}

.offer-card:nth-child(2) .offer-number { background: var(--fam-green); }
.offer-card h2, .raffle-card h2 { margin: 0 0 7px; font-size: 1.15rem; line-height: 1.35; }
.offer-card p { margin: 0; }

.offer-note {
    margin-top: 8px !important;
    padding: 7px 9px;
    color: #765612;
    background: #fff7cf;
    border-radius: 8px;
    font-size: .82rem;
}

.raffle-card {
    position: relative;
    margin-top: 18px;
    padding: 20px;
    border: 2px solid #ffb55d;
    border-radius: 19px;
    background: linear-gradient(155deg, #fffdf5, #fff4e5);
}

.raffle-step { position: absolute; top: 17px; left: 17px; background: var(--fam-orange); }
.raffle-card h2 { min-height: 48px; padding-left: 62px; color: #b54218; }

.join-reminder {
    margin: 14px 0 9px;
    padding: 10px 12px;
    color: #8a3d16;
    background: #fff;
    border-left: 4px solid var(--fam-orange);
    border-radius: 8px;
    font-weight: 700;
}

.product-chooser {
    margin: 20px 0 0;
    padding: 0;
    border: 0;
}

.product-label {
    display: block;
    width: 100%;
    margin: 0 0 9px;
    padding: 0;
    font-weight: 900;
}

.product-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.product-card {
    position: relative;
    display: block;
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border: 2px solid #e2d9cc;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(84, 48, 18, .08);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.product-card:active { transform: scale(.98); }

.product-card input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.product-photo {
    display: block;
    width: 100%;
    height: auto;
    background: #ffe68a;
}

.product-name {
    display: grid;
    place-items: center;
    min-height: 54px;
    padding: 8px 7px;
    color: #633018;
    font-size: .9rem;
    font-weight: 900;
    line-height: 1.35;
    text-align: center;
}

.product-check {
    position: absolute;
    top: 7px;
    right: 7px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: transparent;
    background: rgba(255,255,255,.88);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 7px rgba(0,0,0,.18);
}

.product-card:has(input:checked) {
    border-color: var(--fam-orange);
    box-shadow: 0 0 0 3px rgba(240, 90, 36, .2), 0 5px 15px rgba(84, 48, 18, .12);
}

.product-card:has(input:checked) .product-check {
    color: #fff;
    background: var(--fam-orange);
}

.product-card:has(input:focus-visible) {
    outline: 3px solid #ffbc35;
    outline-offset: 2px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    margin-top: 10px;
    padding: 12px 14px;
    border: 0;
    border-radius: 13px;
    text-align: center;
    text-decoration: none;
    font-weight: 900;
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}

.btn:active { transform: scale(.98); }
.btn:focus-visible, select:focus-visible, .poster-container:focus-visible, .close:focus-visible { outline: 3px solid #ffbc35; outline-offset: 2px; }
.btn-line { color: #fff; background: var(--line-green); }
.btn-register { color: #fff; background: linear-gradient(100deg, var(--fam-orange), #ff8a24); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.line-help { margin: 9px 2px 0; color: var(--muted); font-size: .82rem; }

.generated-message {
    margin-top: 13px;
    padding: 12px;
    overflow-wrap: anywhere;
    color: #075c2c;
    background: #e8fff0;
    border: 1px solid #a7dfba;
    border-radius: 10px;
    font-size: .88rem;
}

.expired-message {
    padding: 24px;
    text-align: center;
    background: #f4f8f9;
    border: 1px dashed #9db1b9;
    border-radius: 15px;
}

.expired-message h2 { margin-top: 0; color: var(--fam-green-dark); }
[hidden] { display: none !important; }

#footer-container { margin-top: 30px; color: #87959c; text-align: center; font-size: .78rem; }

.modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 60px 10px 16px;
    background: rgba(6, 22, 31, .92);
}

.modal-toolbar {
    position: fixed;
    z-index: 2;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 5px 14px;
    color: #fff;
    background: rgba(0,0,0,.48);
}

.modal-content { display: block; max-width: 96vw; max-height: calc(100vh - 76px); border-radius: 8px; object-fit: contain; }
.close { padding: 0 8px; color: #fff; background: transparent; border: 0; font-size: 2rem; cursor: pointer; }
.modal-open { overflow: hidden; }

@media (max-width: 420px) {
    body { padding-right: 8px; padding-left: 8px; }
    main { padding: 20px 12px; border-radius: 18px; }
    .offer-card { grid-template-columns: 43px 1fr; gap: 10px; padding: 14px 12px; }
    .offer-number, .raffle-step { width: 42px; height: 42px; font-size: 1.3rem; }
    .raffle-card { padding: 16px 12px; }
    .raffle-step { top: 14px; left: 12px; }
    .raffle-card h2 { padding-left: 51px; }
    .product-name { min-height: 58px; font-size: .84rem; }
}

@media (min-width: 560px) {
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}
