:root {
    --lottery-blue: #3390ec;
    --lottery-blue-dark: #1a6fc4;
    --lottery-text: #17324a;
    --lottery-muted: #687b8c;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

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

body {
    margin: 0;
    color: var(--lottery-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at 16% 8%, rgba(255, 255, 255, .52), transparent 28%),
        radial-gradient(circle at 88% 86%, rgba(26, 111, 196, .28), transparent 34%),
        linear-gradient(145deg, #c8e6fb 0%, #76bff1 52%, #3c91d2 100%);
}

button {
    font: inherit;
}

.lottery-page {
    width: min(100%, 470px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 16px 14px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.lottery-footer {
    margin-top: auto;
    color: var(--lottery-text);
    font-size: 12px;
    text-align: center;
    overflow-wrap: anywhere;
}

.lottery-card {
    padding: 24px 20px;
    border: 1px solid rgba(255, 255, 255, .52);
    border-radius: 30px;
    background: rgba(255, 255, 255, .34);
    box-shadow: 0 24px 58px rgba(7, 69, 119, .22), inset 0 1px 0 rgba(255, 255, 255, .62);
    backdrop-filter: blur(26px) saturate(1.2);
    -webkit-backdrop-filter: blur(26px) saturate(1.2);
}

.lottery-header {
    text-align: center;
}

.lottery-logo {
    width: auto;
    max-width: 150px;
    height: 44px;
    margin: 0 auto 9px;
    display: block;
    object-fit: contain;
}

.lottery-logo-fallback {
    display: block;
    font-size: 44px;
}

.lottery-header h1 {
    margin: 0;
    font-size: 27px;
}

.lottery-header h1 span {
    color: var(--lottery-blue-dark);
}

.lottery-header p {
    margin: 6px 0 0;
    color: var(--lottery-muted);
    font-size: 13px;
}

.lottery-status {
    width: fit-content;
    margin: 17px auto 14px;
    padding: 7px 15px;
    border-radius: 999px;
    color: var(--lottery-blue-dark);
    background: rgba(255, 255, 255, .46);
    font-size: 12px;
    font-weight: 800;
}

.lottery-status.success {
    color: #167548;
    background: rgba(45, 185, 110, .16);
    font-size: 14px;
}

.lottery-status.error {
    color: #b33932;
    background: rgba(235, 75, 63, .15);
}

.lottery-share,
.lottery-done {
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 19px;
    background: rgba(255, 255, 255, .25);
    text-align: center;
}

.lottery-share strong {
    font-size: 16px;
}

.lottery-share p,
.lottery-done p {
    margin: 7px 0 13px;
    color: var(--lottery-muted);
    font-size: 12px;
}

#openLotteryShare {
    width: 100%;
    padding: 13px 18px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, var(--lottery-blue), var(--lottery-blue-dark));
    box-shadow: 0 8px 22px rgba(26, 111, 196, .28);
    font-weight: 800;
}

.lottery-board {
    padding: 10px;
    border-radius: 20px;
    background: linear-gradient(160deg, #6cbcf0, #2479bd);
    box-shadow: 0 15px 30px rgba(7, 68, 118, .28), inset 0 0 0 3px rgba(255, 255, 255, .23);
}

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

.lottery-cell,
.lottery-draw-button {
    aspect-ratio: 1;
    min-width: 0;
    border: 0;
    border-radius: 13px;
}

.lottery-cell {
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: linear-gradient(180deg, #fff, #d5ecfc);
    box-shadow: inset 0 -3px 0 rgba(26, 111, 196, .13);
}

.lottery-cell.active {
    transform: translateY(-2px) scale(1.03);
    background: #fff;
    box-shadow: 0 0 0 4px #a5d9fb, 0 8px 19px rgba(7, 68, 118, .34);
}

.lottery-prize-image {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, var(--lottery-blue), var(--lottery-blue-dark));
    font-size: 22px;
    font-weight: 900;
}

.lottery-prize-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lottery-prize-title {
    width: 100%;
    min-height: 30px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--lottery-text);
    font-size: 11px;
    font-weight: 800;
    line-height: 15px;
    text-align: center;
    word-break: break-all;
}

.lottery-draw-button {
    padding: 5px;
    color: #fff;
    background: linear-gradient(180deg, #2695d7, #155b9b);
    box-shadow: inset 0 -4px 0 rgba(0, 34, 73, .2);
    font-size: 18px;
    font-weight: 900;
}

.lottery-draw-button small {
    margin-top: 5px;
    display: block;
    color: #d9f0ff;
    font-size: 10px;
}

.lottery-draw-button:disabled {
    opacity: .68;
}

.lottery-result {
    margin-top: 10px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .27);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.lottery-done-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 8px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #28a966;
    font-size: 25px;
    font-weight: 900;
}

.lottery-done h2 {
    margin: 0;
    font-size: 18px;
}

.lottery-done p {
    margin-bottom: 0;
}

.lottery-rules {
    margin-top: 15px;
    padding: 13px 14px;
    border-radius: 17px;
    background: rgba(255, 255, 255, .2);
}

.lottery-rules h2 {
    margin: 0 0 7px;
    font-size: 14px;
}

.lottery-rules p {
    margin: 6px 0;
    padding-left: 14px;
    position: relative;
    color: var(--lottery-muted);
    font-size: 12px;
    line-height: 1.5;
}

.lottery-rules p::before {
    content: "";
    width: 5px;
    height: 5px;
    position: absolute;
    top: 7px;
    left: 0;
    border-radius: 50%;
    background: var(--lottery-blue);
}

.lottery-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 18px;
    display: grid;
    place-items: center;
    background: rgba(15, 41, 63, .48);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lottery-modal-card {
    width: min(100%, 380px);
    padding: 24px 20px 19px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 25px;
    color: #fff;
    background: linear-gradient(155deg, rgba(51, 144, 236, .96), rgba(20, 84, 143, .96));
    box-shadow: 0 24px 60px rgba(4, 45, 82, .38);
    text-align: center;
}

.lottery-modal-icon {
    font-size: 38px;
}

.lottery-modal-card h2 {
    margin: 7px 0;
    font-size: 20px;
}

.lottery-modal-card > p {
    margin: 0;
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
}

.lottery-share-options {
    margin: 17px 0 12px;
    display: grid;
    gap: 9px;
}

.lottery-share-options button,
.lottery-modal-cancel {
    padding: 11px 14px;
    border: 0;
    border-radius: 13px;
    color: var(--lottery-text);
    background: #fff;
    font-weight: 800;
}

.lottery-share-progress {
    min-height: 20px;
    color: rgba(255, 255, 255, .84);
    font-size: 12px;
}

.lottery-modal-cancel {
    margin-top: 10px;
    color: #fff;
    background: rgba(255, 255, 255, .16);
}

.lottery-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 1200;
    max-width: calc(100% - 32px);
    padding: 10px 17px;
    border-radius: 999px;
    color: #fff;
    background: rgba(23, 38, 52, .93);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -70px);
    transition: opacity .22s ease, transform .22s ease;
    font-size: 13px;
    text-align: center;
}

.lottery-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 360px) {
    .lottery-card {
        padding: 20px 15px;
    }

    .lottery-prize-image {
        width: 37px;
        height: 37px;
    }
}
