/* 九宫格抽奖 luckyGrid —— 样式部分（作用域限定在 .lg-wrap 内，避免污染站点全局） */
.tool-content {
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    border-radius: .6em;
    position: relative;
    display: flex;
    padding: 1em;
}

.lg-wrap {
    --red: #d62828;
    --red-deep: #a4161a;
    --red-light: #ff5a5f;
    --gold: #f5a623;
    --gold-light: #ffd166;
    --ink: #3d211c;
    --ink-soft: #8a6a5e;
    --paper: #fffdf9;
    --line: #f0dccf;
    --shadow: 0 12px 34px rgba(150, 60, 40, .12);
}

.lg-wrap, .lg-wrap * {
    box-sizing: border-box;
}

.lg-wrap button, .lg-wrap input {
    font-family: inherit;
}

.lg-wrap button {
    cursor: pointer;
}

.lg-wrap button:disabled {
    cursor: not-allowed;
}

.lg-wrap .app {
    max-width: 1120px;
    margin: 0 auto;
    padding: 30px 22px 46px;
}

.lg-wrap .btn {
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    padding: 9px 15px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 600;
    transition: transform .15s, box-shadow .15s, background .15s;
    box-shadow: 0 3px 10px rgba(150, 60, 40, .06);
}

.lg-wrap .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 16px rgba(150, 60, 40, .14);
}

.lg-wrap .btn-primary {
    border: none;
    color: #fff;
    background: linear-gradient(135deg, #ff6b5e, var(--red));
    box-shadow: 0 8px 20px rgba(214, 40, 40, .28);
}

.lg-wrap .btn-primary:hover {
    box-shadow: 0 11px 24px rgba(214, 40, 40, .36);
}

.lg-wrap .btn-sm {
    padding: 6px 11px;
    font-size: 12px;
    border-radius: 8px;
}

.lg-wrap .layout {
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    gap: 1em;
    align-items: start;
}

.lg-wrap .board-panel {
    position: relative;
    border-radius: 22px;
    padding: 34px 30px 26px;
    background: radial-gradient(120% 90% at 50% 0%, rgba(255, 190, 120, .35), transparent 60%),
    linear-gradient(160deg, #e63946 0%, #c1121f 55%, #900b16 100%);
    box-shadow: 0 22px 50px rgba(160, 25, 30, .3), inset 0 1px 0 rgba(255, 255, 255, .25);
    overflow: hidden;
}

.lg-wrap .board-panel::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 215, 130, .22), transparent 65%);
    pointer-events: none;
}

.lg-wrap .bulb-ring {
    position: absolute;
    inset: 9px;
    pointer-events: none;
}

.lg-wrap .bulb-row {
    position: absolute;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
}

.lg-wrap .bulb-row.top {
    top: 0;
}

.lg-wrap .bulb-row.bottom {
    bottom: 0;
}

.lg-wrap .bulb-col {
    position: absolute;
    top: 14px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.lg-wrap .bulb-col.left {
    left: 0;
}

.lg-wrap .bulb-col.right {
    right: 0;
}

.lg-wrap .bulb {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ffe9a8;
    box-shadow: 0 0 9px 2px rgba(255, 220, 130, .85);
    animation: twinkle 1.1s ease-in-out infinite alternate;
}

.lg-wrap .bulb:nth-child(even) {
    animation-delay: .55s;
}

@keyframes twinkle {
    from {
        opacity: .28;
        transform: scale(.75);
    }
    to {
        opacity: 1;
        transform: scale(1.18);
    }
}


.lg-wrap .board-head {
    position: relative;
    text-align: center;
    color: #fff4dc;
    margin-bottom: 18px;
}

.lg-wrap .board-head strong {
    font-size: 21px;
    letter-spacing: 3px;
}

.lg-wrap .board-head span {
    display: block;
    font-size: 12px;
    opacity: .78;
    margin-top: 5px;
    letter-spacing: 1px;
}


.lg-wrap .grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
}

.lg-wrap .cell {
    position: relative;
    border-radius: 17px;
    background: linear-gradient(160deg, #fffdf8, #ffeede);
    border: 2px solid rgba(255, 255, 255, .75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px;
    text-align: center;
    box-shadow: inset 0 -3px 0 rgba(210, 140, 100, .16), 0 5px 12px rgba(80, 10, 10, .16);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.lg-wrap .cell .icon {
    font-size: clamp(24px, 3.4vw, 34px);
    line-height: 1.1;
    filter: drop-shadow(0 3px 3px rgba(160, 80, 40, .2));
}

.lg-wrap .cell .name {
    font-size: clamp(11px, 1.35vw, 13px);
    font-weight: 700;
    color: #8a4331;
    line-height: 1.35;
}

.lg-wrap .cell .weight {
    font-size: 10px;
    color: #b99883;
    font-weight: 600;
}

.lg-wrap .cell.active {
    background: linear-gradient(160deg, #fff6cf, #ffcf5c);
    border-color: #fff3b0;
    transform: scale(1.055);
    box-shadow: 0 0 0 4px rgba(255, 209, 102, .55), 0 0 28px 6px rgba(255, 205, 90, .65), 0 10px 22px rgba(90, 20, 10, .25);
}

.lg-wrap .cell.active .name {
    color: #7a4300;
}

.lg-wrap .cell.active .weight {
    color: #a8761c;
}

.lg-wrap .cell.center {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.lg-wrap .spin-btn {
    position: relative;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(150deg, #ff8a5b 0%, #ef3b36 45%, #b00f1d 100%);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 8px 22px rgba(90, 5, 10, .4);
    font-size: clamp(18px, 2.6vw, 25px);
    font-weight: 900;
    letter-spacing: 3px;
    line-height: 1.35;
    text-shadow: 0 2px 6px rgba(100, 10, 10, .4);
    transition: transform .15s, filter .15s;
    overflow: hidden;
}

.lg-wrap .spin-btn::before {
    content: "";
    position: absolute;
    inset: -60%;
    background: conic-gradient(transparent 0deg, rgba(255, 235, 170, .45) 40deg, transparent 90deg);
    animation: sweep 3.2s linear infinite;
}

@keyframes sweep {
    to {
        transform: rotate(360deg);
    }
}

.lg-wrap .spin-btn span {
    position: relative;
    display: block;
}

.lg-wrap .spin-btn small {
    display: block;
    font-size: 11px;
    letter-spacing: 1px;
    font-weight: 600;
    opacity: .85;
    margin-top: 4px;
}

.lg-wrap .spin-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(1.06);
}

.lg-wrap .spin-btn:active:not(:disabled) {
    transform: scale(.97);
}

.lg-wrap .spin-btn:disabled {
    filter: grayscale(.55) brightness(.85);
}

.lg-wrap .board-foot {
    position: relative;
    text-align: center;
    color: rgba(255, 244, 220, .8);
    font-size: 12px;
    margin-top: 18px;
    letter-spacing: .5px;
}


.lg-wrap .side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lg-wrap .card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.lg-wrap .card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1em;
    margin-bottom: 13px;
}

.lg-wrap .card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8em;
}

.lg-wrap .card-head h3 {
    margin: 0;
    font-size: 15px;
    letter-spacing: .5px;
}

.lg-wrap .card-head .sub {
    font-size: 11px;
    color: var(--ink-soft);
}


.lg-wrap .chances-wrap {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.lg-wrap .chances-num {
    font-size: 40px;
    font-weight: 900;
    line-height: 1;
    color: var(--red);
    font-variant-numeric: tabular-nums;
}

.lg-wrap .chances-unit {
    font-size: 13px;
    color: var(--ink-soft);
    font-weight: 600;
}

.lg-wrap .bar {
    height: 8px;
    border-radius: 99px;
    background: #f7e9df;
    overflow: hidden;
    margin-top: 14px;
}

.lg-wrap .bar > i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #ffb84d, #ef3b36);
    transition: width .35s ease;
}

.lg-wrap .chances-tip {
    font-size: 12px;
    color: var(--ink-soft);
    margin: 10px 0 0;
}


.lg-wrap .prize-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 262px;
    overflow-y: auto;
}

.lg-wrap .prize-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 4px;
    border-bottom: 1px dashed #f3e6dc;
    font-size: 13px;
}

.lg-wrap .prize-row:last-child {
    border-bottom: none;
}

.lg-wrap .prize-row .ico {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    background: #fff3e6;
    border-radius: 9px;
    font-size: 16px;
}

.lg-wrap .prize-row .nm {
    flex: 1;
    font-weight: 600;
    color: #5b382e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lg-wrap .prize-row .rate {
    font-size: 12px;
    color: var(--red);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}


.lg-wrap .records {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 190px;
    overflow-y: auto;
}

.lg-wrap .record {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
    padding: 7px 10px;
    background: #fff7ef;
    border-radius: 10px;
}

.lg-wrap .record .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
    flex: none;
}

.lg-wrap .record.win .dot {
    background: var(--red);
}

.lg-wrap .record .txt {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lg-wrap .record .time {
    color: #b39a8b;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.lg-wrap .empty {
    font-size: 12.5px;
    color: #b39a8b;
    text-align: center;
    padding: 18px 0;
}


.lg-wrap .overlay {
    position: fixed;
    inset: 0;
    background: rgba(60, 15, 15, .42);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    z-index: 40;
}

.lg-wrap .overlay.show {
    opacity: 1;
    pointer-events: auto;
}


.lg-wrap .drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(390px, 92vw);
    z-index: 50;
    background: var(--paper);
    box-shadow: -14px 0 40px rgba(70, 20, 15, .2);
    transform: translateX(105%);
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
    display: flex;
    flex-direction: column;
}

.lg-wrap .drawer.open {
    transform: translateX(0);
}

.lg-wrap .drawer-head {
    padding: 22px 22px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lg-wrap .drawer-head h3 {
    margin: 0;
    font-size: 17px;
}

.lg-wrap .drawer-head p {
    margin: 5px 0 0;
    font-size: 12px;
    color: var(--ink-soft);
}

.lg-wrap .drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 22px;
}

.lg-wrap .edit-row {
    display: grid;
    grid-template-columns: 34px 1fr 72px;
    gap: 9px;
    align-items: center;
    margin-bottom: 11px;
}

.lg-wrap .edit-row .idx {
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px dashed #e9b98c;
    border-radius: 10px;
    background: #fff1e3;
    font-size: 19px;
    cursor: pointer;
    transition: transform .15s, background .15s, border-color .15s;
}

.lg-wrap .edit-row .idx:hover {
    transform: scale(1.12) rotate(-6deg);
    background: #ffe0bb;
    border-color: var(--gold);
}

.lg-wrap .edit-row .idx::after {
    content: "✎";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 9px;
    color: #fff;
    background: var(--red);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

.lg-wrap .edit-row input {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 9px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--ink);
    outline: none;
}

.lg-wrap .edit-row input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, .15);
}

.lg-wrap .edit-row label {
    font-size: 11px;
    color: var(--ink-soft);
    display: block;
    margin-bottom: 3px;
}

.lg-wrap .drawer-foot {
    padding: 16px 22px 22px;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 10px;
}

.lg-wrap .drawer-foot .btn {
    flex: 1;
}


.lg-wrap .modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 55;
    transform: translate(-50%, -46%) scale(.86);
    opacity: 0;
    pointer-events: none;
    width: min(360px, 88vw);
    padding: 30px 26px 26px;
    text-align: center;
    background: linear-gradient(170deg, #fffdf9, #fff2e4);
    border-radius: 26px;
    border: 2px solid #fff;
    box-shadow: 0 26px 60px rgba(90, 20, 15, .32);
    transition: transform .32s cubic-bezier(.2, 1.3, .4, 1), opacity .25s;
}

.lg-wrap .modal.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.lg-wrap .modal .big {
    font-size: 62px;
    line-height: 1;
    margin-bottom: 12px;
    animation: pop .5s cubic-bezier(.2, 1.4, .4, 1);
}

@keyframes pop {
    from {
        transform: scale(.3) rotate(-18deg);
    }
    to {
        transform: scale(1) rotate(0);
    }
}

.lg-wrap .modal h3 {
    margin: 0 0 8px;
    font-size: 22px;
    color: var(--red);
    letter-spacing: 1px;
}

.lg-wrap .modal .prize-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
    margin: 0 0 8px;
}

.lg-wrap .modal .tip {
    font-size: 12.5px;
    color: var(--ink-soft);
    line-height: 1.7;
    margin: 0 0 22px;
}

.lg-wrap .modal .btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
}


.lg-wrap #confetti {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 60;
}

.lg-wrap .toast {
    position: fixed;
    left: 50%;
    bottom: 34px;
    transform: translate(-50%, 18px);
    z-index: 70;
    background: rgba(52, 22, 18, .92);
    color: #fff;
    padding: 11px 20px;
    border-radius: 99px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .2);
}

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


.lg-wrap .picker-mask {
    position: fixed;
    inset: 0;
    z-index: 62;
    background: rgba(60, 15, 15, .38);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.lg-wrap .picker-mask.show {
    opacity: 1;
    pointer-events: auto;
}

.lg-wrap .picker {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 63;
    width: min(430px, 92vw);
    transform: translate(-50%, -46%) scale(.9);
    opacity: 0;
    pointer-events: none;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(80, 20, 15, .3);
    padding: 20px;
    transition: transform .26s cubic-bezier(.2, 1.2, .4, 1), opacity .2s;
}

.lg-wrap .picker.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.lg-wrap .picker-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.lg-wrap .picker-head h3 {
    margin: 0;
    font-size: 17px;
}

.lg-wrap .picker-head p {
    margin: 5px 0 0;
    font-size: 12px;
    color: var(--ink-soft);
}

.lg-wrap .picker-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 15px 0 12px;
}

.lg-wrap .picker-tab {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-soft);
    padding: 6px 11px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}

.lg-wrap .picker-tab.active {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.lg-wrap .picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    max-height: 210px;
    overflow-y: auto;
    padding: 3px;
}

.lg-wrap .picker-grid button {
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 1px solid transparent;
    background: #fff5ea;
    border-radius: 10px;
    font-size: 22px;
    display: grid;
    place-items: center;
    transition: transform .12s, background .12s, border-color .12s;
}

.lg-wrap .picker-grid button:hover {
    transform: scale(1.15);
    background: #ffe1bb;
    border-color: var(--gold);
}

.lg-wrap .picker-grid button.current {
    border-color: var(--red);
    background: #ffe9e5;
}

.lg-wrap .picker-custom {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.lg-wrap .picker-custom input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 9px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--ink);
    outline: none;
}

.lg-wrap .picker-custom input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, .15);
}

.lg-wrap .picker-hint {
    font-size: 11.5px;
    color: var(--ink-soft);
    line-height: 1.65;
    margin: 10px 0 0;
}

@media (max-width: 480px) {

    .lg-wrap .picker-grid {
        grid-template-columns: repeat(6, 1fr);
    }


}


@media (max-width: 880px) {

    .lg-wrap .layout {
        grid-template-columns: 1fr;
    }

    .lg-wrap .board-panel {
        padding: 30px 22px 22px;
    }

    .lg-wrap .grid {
        max-width: 460px;
    }

    .lg-wrap .cell .name {
        font-size: 12px;
    }


}

@media (max-width: 480px) {

    .lg-wrap .app {
        padding: 20px 13px 34px;
    }

    .lg-wrap .grid {
        gap: 7px;
    }

    .lg-wrap .cell {
        border-radius: 13px;
        gap: 3px;
        padding: 4px;
    }

    .lg-wrap .cell .icon {
        font-size: 23px;
    }

    .lg-wrap .cell .name {
        font-size: 10px;
    }

    .lg-wrap .cell .weight {
        display: none;
    }

    .lg-wrap .spin-btn {
        font-size: 17px;
        letter-spacing: 1px;
        border-radius: 13px;
    }


}

/* 集成到 tool-content 后的布局微调：内边距由 .tool-content 统一提供 */
.lg-wrap {
    width: 100%;
}

.lg-wrap .app {
    max-width: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 480px) {
    .lg-wrap .app {
        padding: 0;
    }
}
