* {
    box-sizing: border-box;
}

:root {
    --site-header-height: 72px;
}

html {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    width: 100%;
    margin: 0;
    padding-top: var(--site-header-height);
    overflow-x: hidden;
    background: #f4f6fa;
    color: #182230;
    font-family: Arial, "Microsoft JhengHei", sans-serif;
    line-height: 1.5;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
}

.preview-app {
    width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: #ffffff;
    border-bottom: 1px solid #dbe3ef;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 10px 14px;
}

.brand {
    min-width: 0;
}

.brand img {
    width: 176px;
    max-width: 42vw;
    height: auto;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.header-actions a,
.header-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 11px;
    color: #9f1239;
    background: #fff5f5;
    border: 1px solid #fecdd3;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.account-summary {
    order: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.account-summary span,
.account-summary strong {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 13px;
}

.site-header.is-logged-in .account-summary,
.site-header.is-logged-in .header-actions {
    display: none;
}

.site-header.is-logged-in .header-bar {
    flex-wrap: nowrap;
}

.member-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-left: auto;
}

.member-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.member-chip {
    gap: 8px;
    max-width: min(58vw, 260px);
    padding: 5px 9px;
    color: #182230;
}

.member-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    color: #ffffff;
    background: #9f1239;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
}

.member-avatar.large {
    width: 44px;
    height: 44px;
    font-size: 14px;
}

.member-chip-text {
    display: grid;
    min-width: 0;
    text-align: left;
    line-height: 1.2;
}

.member-chip-text span,
.member-chip-text strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-chip-text span {
    font-size: 12px;
    font-weight: 800;
}

.member-chip-text strong {
    color: #059669;
    font-size: 13px;
}

.member-caret {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 1px solid #d9e2ee;
    border-radius: 999px;
    background: #f6f8fb;
    position: relative;
}

.member-caret::before {
    content: "";
    position: absolute;
    top: 45%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translate(-50%, -55%) rotate(45deg);
}

.member-panel.is-hidden {
    display: none;
}

.member-panel {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 78px 12px 16px;
}

.member-panel-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    cursor: default;
}

.member-panel-card {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
    width: min(100%, 390px);
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    padding: 14px;
    color: #e5edf8;
    background: #172235;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.3);
}

.member-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.member-profile div {
    display: grid;
    min-width: 0;
}

.member-profile strong,
.member-profile span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-profile strong {
    color: #ffffff;
    font-size: 17px;
}

.member-profile span {
    color: #aab6c8;
    font-size: 13px;
}

.balance-row,
.point-grid > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.32);
}

.balance-row span,
.point-grid span {
    color: #aab6c8;
    font-size: 12px;
    font-weight: 800;
}

.balance-stack {
    display: grid;
    gap: 10px;
}

.balance-row {
    min-height: 48px;
    padding: 11px 12px;
}

.balance-row.primary {
    background: rgba(5, 150, 105, 0.18);
    border-color: rgba(20, 184, 166, 0.32);
}

.balance-row strong {
    color: #34d399;
    font-size: 18px;
}

.point-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.point-grid > div {
    display: grid;
    min-height: 66px;
    align-content: center;
    padding: 10px 12px;
}

.point-grid strong {
    color: #ffffff;
    font-size: 15px;
}

.member-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.member-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 10px;
    color: #e5edf8;
    background: rgba(37, 99, 235, 0.26);
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}

.member-actions a:first-child {
    color: #d1fae5;
    background: rgba(5, 150, 105, 0.28);
    border-color: rgba(20, 184, 166, 0.34);
}

main {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px;
}

.home-cover-carousel,
.announcement,
.bingo-panel,
.draw-panel,
.lottery-panel,
.ad-section,
.service-panel,
.auth-panel,
.video-panel,
.contact-panel,
.prize-marquee {
    width: 100%;
    min-width: 0;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
}

.home-cover-carousel {
    display: grid;
    gap: 12px;
    padding: 14px;
    overflow: hidden;
}

.section-title p {
    margin: 0 0 3px;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.section-title h2,
.bingo-panel h2,
.draw-card h3,
.video-panel h2,
.contact-panel h2,
.prize-marquee h2 {
    margin: 0;
    color: #111827;
    letter-spacing: 0;
}

.section-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    min-width: 0;
    margin-top: 16px;
}

.section-actions a,
.home-cover-carousel .section-title button,
.ad-section button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
}

.section-actions a:first-child,
.home-cover-carousel .section-title button,
.ad-section button {
    color: #ffffff;
    background: #b91c1c;
    border: 1px solid #b91c1c;
}

.section-actions a + a {
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

.home-cover-track {
    display: flex;
    gap: 10px;
    min-width: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.home-cover-track::-webkit-scrollbar {
    display: none;
}

.home-cover-slide,
.home-cover-track a {
    display: block;
    flex: 0 0 100%;
    min-width: 0;
    overflow: hidden;
    scroll-snap-align: start;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
}

.home-cover-slide img,
.home-cover-track img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #ffffff;
}

.home-cover-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
}

.home-cover-dots span {
    width: 8px;
    height: 8px;
    background: #cbd5e1;
    border-radius: 999px;
}

.home-cover-dots span.is-active {
    width: 18px;
    background: #b91c1c;
}

.announcement {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 14px;
    padding: 12px 14px;
    color: #713f12;
    background: #fffbeb;
    border-color: #fde68a;
}

.announcement strong {
    flex: 0 0 auto;
    color: #92400e;
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.shortcut-grid a {
    min-width: 0;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
}

.shortcut-grid img {
    width: 100%;
}

.shortcut-grid span {
    display: none;
}

.bingo-panel,
.draw-panel,
.lottery-panel,
.ad-section,
.service-panel,
.auth-panel,
.media-grid,
.prize-marquee {
    margin-top: 14px;
}

.bingo-panel,
.draw-panel,
.lottery-panel,
.ad-section,
.service-panel,
.auth-panel,
.video-panel,
.contact-panel,
.prize-marquee {
    padding: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    margin-bottom: 12px;
}

.section-title h2 {
    font-size: 20px;
}

.section-title a,
.section-title button {
    flex: 0 0 auto;
}

.section-title > a {
    color: #b91c1c;
    font-size: 14px;
    font-weight: 700;
}

.draw-time,
.draw-card p,
.prize-marquee p,
.site-footer p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.ball-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    margin-top: 12px;
}

.ball-list span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: #9f1239;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

.bingo-balls span {
    color: #075985;
    background: #e0f2fe;
    border-color: #bae6fd;
}

.ball-list .special {
    color: #ffffff;
    background: #0f766e;
    border-color: #0f766e;
}

.draw-grid,
.lottery-grid,
.service-grid,
.auth-grid,
.media-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    min-width: 0;
}

.draw-card,
.lottery-card,
.service-card,
.auth-card {
    min-width: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.auth-card {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.auth-card h3 {
    margin: 0;
    color: #111827;
    font-size: 18px;
}

.auth-card label {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

.auth-card input,
.auth-card select {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 8px 10px;
    color: #111827;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
}

.field-grid,
.birth-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    min-width: 0;
}

.captcha-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.captcha-row img {
    width: 112px;
    height: 42px;
    object-fit: cover;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
}

.check-row,
.radio-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    color: #475569;
    font-size: 14px;
    font-weight: 700;
}

.auth-card .check-row {
    display: flex;
    grid-template-columns: none;
    justify-content: flex-start;
    white-space: nowrap;
}

.check-row input,
.radio-row input {
    flex: 0 0 auto;
    width: auto;
    height: auto;
    margin: 0;
}

.check-row span {
    min-width: 0;
}

.radio-row span {
    flex: 0 0 auto;
}

.auth-card button {
    min-height: 44px;
    color: #ffffff;
    background: #b91c1c;
    border: 1px solid #b91c1c;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-links a {
    color: #b91c1c;
    font-size: 14px;
    font-weight: 700;
}

.form-message {
    min-height: 20px;
    color: #b91c1c;
    font-size: 14px;
    font-weight: 700;
}

.auth-panel {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
    margin: 0;
    padding: 16px;
    overflow: auto;
    background: rgba(15, 23, 42, 0.68);
    border: 0;
    border-radius: 0;
}

.auth-panel.is-hidden {
    display: none;
}

.auth-dialog {
    width: calc(100vw - 32px);
    max-width: 760px;
    max-height: calc(100vh - 32px);
    min-width: 0;
    overflow: auto;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    color: #111827;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
    margin-bottom: 12px;
}

.auth-tabs button {
    min-height: 42px;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.auth-panel[data-mode="login"] .login-tab,
.auth-panel[data-mode="register"] .register-tab {
    color: #ffffff;
    background: #b91c1c;
    border-color: #b91c1c;
}

.auth-panel .auth-grid {
    grid-template-columns: 1fr;
    min-width: 0;
}

.auth-panel .auth-card,
.auth-panel .section-title {
    min-width: 0;
}

.auth-panel[data-mode="login"] #member-register,
.auth-panel[data-mode="register"] #member-login {
    display: none;
}

.draw-card {
    padding: 14px;
}

.draw-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.draw-card h3 {
    font-size: 18px;
}

.draw-card-head span {
    flex: 0 0 auto;
    color: #64748b;
    font-size: 13px;
}

.prize {
    margin-top: 12px;
    color: #b91c1c;
    font-weight: 700;
}

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

.lottery-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 64px;
    padding: 12px;
    font-weight: 700;
}

.lottery-card img {
    width: 44px;
    height: 34px;
    padding: 3px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    object-fit: contain;
}

.lottery-card span {
    min-width: 0;
    font-size: 15px;
}

.inline-carousel,
.cover-track {
    display: flex;
    gap: 10px;
    min-width: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.inline-carousel::-webkit-scrollbar,
.cover-track::-webkit-scrollbar {
    display: none;
}

.inline-slide,
.cover-track a {
    flex: 0 0 100%;
    min-width: 0;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    scroll-snap-align: start;
}

.inline-slide img,
.cover-track img {
    width: 100%;
    height: auto;
}

.service-card {
    overflow: hidden;
}

.video-stack {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.video-stack iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 8px;
}

.contact-panel {
    display: grid;
    gap: 12px;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.contact-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 58px;
    padding: 8px;
    color: #172033;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
}

.contact-card img {
    width: 100%;
    max-width: 42px;
    height: 42px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.contact-card span {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
    font-weight: 800;
}

.contact-card strong {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: #ffffff;
    background: #991b1b;
    border-radius: 8px;
    font-size: 22px;
}

.contact-card.is-mail,
.contact-card.is-wide {
    grid-column: 1 / -1;
}

.contact-card.is-wide img {
    max-width: 92px;
    width: 92px;
}

.contact-card.is-wide {
    grid-template-columns: 92px minmax(0, 1fr);
}

.prize-marquee-window {
    position: relative;
    height: 180px;
    margin-top: 12px;
    overflow: hidden;
    color: #b91c1c;
    font-weight: 700;
}

.prize-marquee-track {
    display: grid;
    gap: 28px;
    animation: h8PrizeScroll 18s linear infinite;
}

.prize-marquee-track:hover {
    animation-play-state: paused;
}

.prize-marquee-track > div {
    min-height: 180px;
}

@keyframes h8PrizeScroll {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-50%);
    }
}

.site-footer {
    max-width: 1120px;
    margin: 0 auto;
    padding: 18px 14px 28px;
}

.site-footer a {
    color: #b91c1c;
    font-weight: 700;
}

.cover-ad {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 0;
    background: rgba(2, 6, 23, 0.96);
}

.cover-ad.is-hidden {
    display: none;
}

.cover-ad-dialog {
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-width: 0;
    padding: 54px 12px 18px;
}

.cover-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    color: #111827;
    background: #ffffff;
    border: 0;
    border-radius: 999px;
    font-size: 24px;
    line-height: 1;
}

.cover-track {
    height: 100%;
    align-items: stretch;
}

.cover-track a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.cover-track img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    touch-action: none;
    user-select: none;
    transform-origin: center center;
    transition: transform 120ms ease;
}

.cover-ad.is-zooming .cover-track {
    overflow: hidden;
    scroll-snap-type: none;
}

.cover-ad.is-zooming .cover-track img {
    transition: none;
}

.cover-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin-top: 12px;
}

.cover-dots span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.62);
    border-radius: 999px;
}

.cover-dots span.is-active {
    background: #ffffff;
}

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

    .shortcut-grid,
    .draw-grid,
    .service-grid,
    .auth-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .birth-grid {
        grid-template-columns: 1fr 0.7fr 0.7fr;
    }
}

@media (min-width: 768px) {
    :root {
        --site-header-height: 86px;
    }

    .header-bar {
        padding: 14px 24px;
    }

    .brand img {
        width: 220px;
        max-width: 38vw;
    }

    .account-summary {
        order: 0;
        flex: 1 1 auto;
        justify-content: flex-end;
        width: auto;
    }

    main {
        padding: 24px;
    }

    .home-cover-carousel {
        padding: 18px;
    }

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

    .shortcut-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px;
    }

    .shortcut-grid a {
        display: grid;
        align-content: start;
    }

    .shortcut-grid img {
        width: 100%;
        height: auto;
        aspect-ratio: 1.29 / 1;
        object-fit: contain;
        object-position: center;
        background: #ffffff;
    }

    .media-grid {
        grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    }
}

@media (min-width: 1024px) {
    .section-actions a:first-child:hover,
    .home-cover-carousel .section-title button:hover,
    .ad-section button:hover {
        background: #991b1b;
    }

    .lottery-card:hover,
    .draw-card:hover {
        border-color: #94a3b8;
    }
}

.auth-panel .auth-grid {
    grid-template-columns: 1fr;
}
