:root {
    color-scheme: dark;
    --bg: #080c18;
    --panel: rgba(18, 26, 47, .88);
    --panel-2: rgba(26, 36, 62, .82);
    --line: rgba(148, 163, 184, .2);
    --muted: #9ba8c5;
    --text: #f3f6ff;
    --green: #a3ff68;
    --cyan: #67e8f9;
    --purple: #c4b5fd;
    --pink: #f9a8d4;
    --gold: #fde68a;
    --danger: #fda4af;
    --radius: 20px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono CJK JP", monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(ellipse at 10% 0%, rgba(34, 211, 238, .12), transparent 35%),
        radial-gradient(ellipse at 90% 10%, rgba(168, 85, 247, .13), transparent 35%),
        linear-gradient(145deg, #080c18, #0d1325 55%, #080c18);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .17;
    background-image: linear-gradient(rgba(148, 163, 184, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, .09) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(to bottom, black, transparent 85%);
}

button {
    font: inherit;
}

button:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 3px;
}

.wrap {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 44px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    letter-spacing: .04em;
    font-weight: 900;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(163, 255, 104, .45);
    background: rgba(163, 255, 104, .08);
    border-radius: 13px;
    font-size: 22px;
    box-shadow: 0 0 26px rgba(163, 255, 104, .07);
}

.brand span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .18em;
    margin-top: 4px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--green);
    font-size: 11px;
    padding: 8px 11px;
    border: 1px solid rgba(163, 255, 104, .25);
    background: rgba(163, 255, 104, .06);
    border-radius: 999px;
    white-space: nowrap;
}

.dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--green);
}

.hero {
    display: grid;
    grid-template-columns: 1.18fr .82fr;
    gap: 18px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .16);
    backdrop-filter: blur(12px);
}

.hero-main {
    padding: clamp(22px, 4vw, 38px);
    position: relative;
    overflow: hidden;
}

.eyebrow {
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.eyebrow::before {
    content: "";
    display: inline-block;
    width: 22px;
    height: 1px;
    background: currentColor;
}

h1 {
    margin: 18px 0 12px;
    font-size: clamp(32px, 5.1vw, 57px);
    line-height: 1.03;
    letter-spacing: -.055em;
}

h1 .accent {
    color: var(--green);
    text-shadow: 0 0 30px rgba(163, 255, 104, .17);
}

.lead {
    margin: 0;
    max-width: 540px;
    color: #c2cce1;
    font-family: system-ui, "Noto Sans JP", sans-serif;
    line-height: 1.8;
    font-size: 14px;
}

.lead strong {
    color: #fff;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.tag {
    font-size: 10px;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 7px 9px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .025);
}

.tag b {
    color: var(--text);
}

.stats {
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
}

.stats-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.label {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .12em;
}

.tiny-badge {
    border: 1px solid rgba(103, 232, 249, .23);
    background: rgba(103, 232, 249, .07);
    color: var(--cyan);
    padding: 6px 8px;
    border-radius: 7px;
    font-size: 10px;
}

.bigstat {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 11px;
}

.bigstat strong {
    font-size: clamp(38px, 5vw, 54px);
    letter-spacing: -.07em;
    line-height: 1;
}

.bigstat span {
    color: var(--muted);
    font-size: 13px;
}

.progress {
    height: 9px;
    background: #26314d;
    overflow: hidden;
    border-radius: 999px;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--green), var(--cyan));
    border-radius: inherit;
    transition: width .35s ease;
    box-shadow: 0 0 14px rgba(163, 255, 104, .35);
}

.stats-foot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.mini-stat {
    background: rgba(255, 255, 255, .035);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
}

.mini-stat strong {
    display: block;
    margin-top: 5px;
    font-size: 20px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 14px;
    margin: 32px 0 14px;
}

.section-head h2 {
    margin: 0;
    font-size: clamp(19px, 3vw, 25px);
    letter-spacing: -.035em;
}

.section-head p {
    color: var(--muted);
    font-size: 11px;
    margin: 7px 0 0;
}

.small-count {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.machine {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.machine::after {
    content: "🍪";
    position: absolute;
    right: 160px;
    top: -20px;
    font-size: 115px;
    opacity: .035;
    transform: rotate(-18deg);
    pointer-events: none;
}

.machine-copy h3 {
    margin: 0 0 8px;
    font-size: 17px;
}

.machine-copy p {
    color: var(--muted);
    font: 13px/1.75 system-ui, "Noto Sans JP", sans-serif;
    margin: 0;
}

.draw-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 205px;
    z-index: 1;
}

.primary {
    border: 0;
    border-radius: 13px;
    padding: 15px 20px;
    background: var(--green);
    color: #111b0a;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 7px 0 #4c7e2c, 0 0 25px rgba(163, 255, 104, .12);
    transition: transform .12s ease, filter .12s ease;
}

.primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.primary:active {
    transform: translateY(3px);
    box-shadow: 0 3px 0 #4c7e2c;
}

.subtle-btn {
    border: 1px solid var(--line);
    color: #d4ddf0;
    background: rgba(255, 255, 255, .035);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 11px;
}

.subtle-btn:hover {
    background: rgba(255, 255, 255, .075);
}

.result {
    display: none;
    margin-top: 14px;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(163, 255, 104, .3);
    background: linear-gradient(120deg, rgba(163, 255, 104, .08), rgba(103, 232, 249, .035));
    animation: rise .28s ease both;
}

.result.show {
    display: block;
}

.result-top {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
}

.result-title {
    margin: 5px 0 7px;
    font-size: 25px;
    letter-spacing: -.04em;
    overflow-wrap: anywhere;
}

.result-message {
    color: #c8d2e7;
    font: 13px/1.75 system-ui, "Noto Sans JP", sans-serif;
    margin: 0;
}

.result-cookie {
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    font-size: 30px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.result-code {
    margin-top: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, .24);
    border: 1px dashed rgba(148, 163, 184, .24);
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.8;
    color: var(--cyan);
    overflow-wrap: anywhere;
}

.rarity {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    padding: 5px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    border: 1px solid currentColor;
}

.rarity-n {
    color: #cbd5e1;
    background: rgba(203, 213, 225, .07);
}

.rarity-r {
    color: var(--cyan);
    background: rgba(103, 232, 249, .07);
}

.rarity-sr {
    color: var(--purple);
    background: rgba(196, 181, 253, .08);
}

.rarity-ssr {
    color: var(--pink);
    background: rgba(249, 168, 212, .08);
}

.rarity-ur {
    color: var(--gold);
    background: rgba(253, 230, 138, .08);
}

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

.card {
    position: relative;
    min-width: 0;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 16px;
    padding: 15px;
    overflow: hidden;
    transition: border-color .18s ease, transform .18s ease, background .18s ease;
}

.card.owned {
    border-color: rgba(163, 255, 104, .27);
    background: linear-gradient(145deg, rgba(25, 44, 39, .78), rgba(18, 26, 47, .88));
}

.card.owned:hover {
    transform: translateY(-2px);
    border-color: rgba(163, 255, 104, .58);
}

.card.locked {
    opacity: .68;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.card-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    font-size: 26px;
    border-radius: 13px;
    background: rgba(255, 255, 255, .045);
    border: 1px solid var(--line);
    margin: 15px 0 12px;
    filter: none;
}

.locked .card-icon {
    filter: grayscale(1);
}

.card h3 {
    margin: 0;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.card .jname {
    margin: 5px 0 10px;
    min-height: 18px;
    color: var(--muted);
    font: 11px system-ui, "Noto Sans JP", sans-serif;
}

.card .flavor {
    color: #c6d0e3;
    font: 11px/1.6 system-ui, "Noto Sans JP", sans-serif;
    min-height: 35px;
    margin: 0 0 12px;
}

.card-bottom {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    align-items: center;
    color: var(--muted);
    font-size: 10px;
}

.owned-label {
    color: var(--green);
    font-size: 10px;
    white-space: nowrap;
}

.cookie-name {
    color: var(--cyan);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 58%;
}

.locked-name {
    color: #aab3c6;
    letter-spacing: .08em;
}

.details {
    margin-top: 24px;
    overflow: hidden;
}

.details summary {
    padding: 17px 20px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.details summary::-webkit-details-marker {
    display: none;
}

.details summary strong {
    font-size: 13px;
}

.details summary span {
    color: var(--muted);
    font-size: 11px;
}

.details-body {
    padding: 0 20px 20px;
}

.cookie-table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    min-width: 470px;
}

th,
td {
    border-top: 1px solid var(--line);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 600;
}

td code {
    color: var(--cyan);
    overflow-wrap: anywhere;
    white-space: normal;
}

.empty {
    color: var(--muted);
    font: 12px/1.8 system-ui, "Noto Sans JP", sans-serif;
    padding: 15px 0 4px;
}

.details-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.danger-btn {
    color: var(--danger);
    border-color: rgba(253, 164, 175, .3);
}

button:disabled {
    opacity: .48;
    cursor: not-allowed;
    filter: grayscale(.45);
    transform: none !important;
    box-shadow: none !important;
}

.consent-notice {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 0 0 18px;
    padding: 15px 17px;
    border: 1px solid rgba(253, 164, 175, .34);
    border-radius: 14px;
    background: rgba(127, 29, 29, .2);
}

.consent-notice strong {
    display: block;
    color: var(--danger);
    font-size: 12px;
    margin-bottom: 4px;
}

.consent-notice p {
    color: #d5dcee;
    font: 12px/1.65 system-ui, "Noto Sans JP", sans-serif;
    margin: 0;
}

.consent-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(3, 6, 15, .84);
    backdrop-filter: blur(9px);
    overflow-y: auto;
}

.consent-overlay[hidden],
.consent-notice[hidden] {
    display: none !important;
}

.consent-dialog {
    width: min(680px, 100%);
    padding: clamp(22px, 4vw, 34px);
    border-color: rgba(103, 232, 249, .25);
    background: #10182b;
    box-shadow: 0 25px 90px rgba(0, 0, 0, .58);
}

.consent-dialog h2 {
    margin: 12px 0 12px;
    font-size: clamp(22px, 4vw, 30px);
    line-height: 1.25;
}

.consent-dialog p {
    color: #ccd5e8;
    font: 13px/1.8 system-ui, "Noto Sans JP", sans-serif;
}

.consent-details {
    margin: 16px 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .025);
}

.consent-details ul {
    margin: 0;
    padding-left: 1.2em;
    color: #cbd5e1;
    font: 12px/1.85 system-ui, "Noto Sans JP", sans-serif;
}

.consent-small {
    color: var(--muted) !important;
    font-size: 11px !important;
}

.consent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}

.consent-actions .primary,
.consent-actions .subtle-btn {
    min-height: 48px;
}

.consent-actions .subtle-btn {
    border-color: rgba(253, 164, 175, .35);
    color: #fecdd3;
}

.settings-btn {
    border: 0;
    padding: 0;
    margin-top: 5px;
    color: var(--cyan);
    background: transparent;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
}

.footnote {
    text-align: center;
    color: #77849f;
    font: 11px/1.9 system-ui, "Noto Sans JP", sans-serif;
    padding: 26px 8px 0;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    z-index: 120;
    padding: 11px 15px;
    border: 1px solid rgba(163, 255, 104, .28);
    background: #111b23;
    border-radius: 12px;
    color: var(--text);
    font-size: 12px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, .35);
    transition: all .2s ease;
    max-width: calc(100vw - 24px);
    text-align: center;
}

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

.flash {
    animation: flash .5s ease;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flash {

    0%,
    100% {
        box-shadow: 0 18px 60px rgba(0, 0, 0, .16);
    }

    35% {
        box-shadow: 0 0 0 2px rgba(253, 230, 138, .28), 0 0 44px rgba(253, 230, 138, .2);
    }
}

@media (max-width: 800px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .stats {
        gap: 16px;
    }

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

@media (max-width: 540px) {
    .wrap {
        width: min(100% - 22px, 1120px);
        padding-top: 15px;
    }

    .topbar {
        align-items: start;
    }

    .brand {
        font-size: 12px;
    }

    .status {
        font-size: 9px;
        padding: 7px 8px;
    }

    .hero-main {
        padding: 22px;
    }

    .machine {
        grid-template-columns: 1fr;
        padding: 17px;
    }

    .draw-actions {
        min-width: 0;
    }

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

    .card {
        padding: 12px;
    }

    .card .flavor {
        min-height: 48px;
    }

    .section-head {
        align-items: start;
    }

    .result-title {
        font-size: 21px;
    }

    .footnote {
        padding-top: 22px;
    }

    .consent-notice {
        align-items: stretch;
        flex-direction: column;
    }

    .consent-actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}