:root {
    color-scheme: light;
    font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
    color: #201b2d;
    background: #f6f4ef;
    --ink: #201b2d;
    --muted: #645e6e;
    --paper: #fffdfa;
    --line: #e4dfe4;
    --accent: #d8c7ff;
    --mono: "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, blockquote:focus-visible {
    outline: 2px solid #7a52bc;
    outline-offset: 3px;
}
.stage button:focus-visible, .stage blockquote:focus-visible { outline-color: #dbc8ff; }
[hidden] { display: none !important; }
.symbol-bank { position: absolute; width: 0; height: 0; pointer-events: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }

.shell { width: min(100% - 80px, 1032px); margin: 0 auto; padding: 28px 0 18px; }
.masthead { display: flex; justify-content: space-between; align-items: center; padding: 0 0 24px; border-bottom: 1px solid #e3dee1; margin-bottom: 27px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 23px; font-weight: 750; line-height: .95; letter-spacing: -1.05px; }
.brand-mark { display: grid; width: 43px; height: 43px; place-items: center; color: #e6d9ff; background: #241d36; border-radius: 13px; box-shadow: 0 2px 3px #211a2b19; }
.brand-mark svg { width: 24px; height: 24px; }
.brand-period { color: #7953b0; }
.brand small { display: block; margin-top: 7px; font: 600 9px/1 var(--mono); color: var(--muted); letter-spacing: .14em; }

.outline, .solid, .quiet, .text-button, .stage-link, .profile, .copy {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-radius: 10px; white-space: nowrap; font-weight: 640;
    transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.outline { border: 1px solid #ddd6df; background: #ffffff42; color: #332b3e; }
.outline:hover:not(:disabled) { border-color: #c5b4da; background: #fff; }
.small { padding: 9px 12px; min-height: 37px; font-size: 12px; }
.outline .external { width: 13px; height: 13px; color: #716782; }
.outline:disabled { opacity: .46; }

.source {
    padding: 23px 25px 18px; border-radius: 20px; border: 1px solid #e6dfe4;
    background: var(--paper); box-shadow: 0 2px 4px #301b3610;
}
.source-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0; font: 600 10px/1.2 var(--mono); letter-spacing: .15em; color: #696076; }
.eyebrow span { color: #7957ad; }
.eyebrow i { width: 11px; height: 1px; background: currentColor; opacity: .55; }
h1 { margin: 6px 0 14px; font-size: clamp(25px, 3vw, 32px); font-weight: 720; letter-spacing: -.046em; line-height: 1.15; }
.source-actions { display: flex; gap: 5px; margin: 0 -5px 11px 0; }
.quiet { background: transparent; color: #5d536a; padding: 7px 9px; font-size: 12px; }
.quiet:hover:not(:disabled) { background: #f1eaf9; color: #4d2d80; }
.quiet:disabled { opacity: .48; }
.quiet .icon { width: 15px; height: 15px; }
.quiet .star { width: 12px; height: 12px; stroke: none; color: #7552aa; }

form { display: flex; gap: 10px; }
.input-wrap { display: flex; align-items: center; gap: 9px; flex: 1 1 auto; min-width: 0; border: 1px solid #e2dce6; border-radius: 11px; padding: 0 13px; background: #f9f7fa; color: #746686; transition: border-color .18s ease, box-shadow .18s ease; }
.input-wrap:focus-within { border-color: #9674c7; box-shadow: 0 0 0 3px #e9dcfa; }
.input-wrap input { width: 100%; min-width: 0; padding: 12px 0; outline: none; border: none; background: transparent; color: var(--ink); font-size: 14px; line-height: 20px; }
.input-wrap input::placeholder { color: #776f81; }
.input-wrap input:disabled { opacity: .75; }
.solid { padding: 0 15px; min-height: 45px; background: #2c2240; color: #fff; font-size: 13px; }
.solid:hover:not(:disabled) { background: #4b3569; box-shadow: 0 2px 7px #4b356944; }
.solid:disabled { opacity: .64; }
.status-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 1px 11px; margin-top: 9px; min-height: 17px; font-size: 12px; color: var(--muted); }
.status-line[data-kind="error"], .status-line[data-kind="limited"] { color: #a43453; }
.status-line[data-kind="login"] { color: #63418e; }
.status-line[data-kind="success"] { color: #426b53; }
.text-button { padding: 0; border-radius: 3px; background: none; color: #613d90; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }
.text-button:hover { color: #352146; }

.stage {
    position: relative; isolation: isolate; display: grid; grid-template-rows: auto 1fr auto;
    min-height: 435px; margin-top: 20px; overflow: hidden;
    border-radius: 23px; border: 1px solid #302843;
    background: radial-gradient(ellipse 63% 88% at 50% 49%, #35264d 0%, #211a33 49%, #191525 94%);
    color: #f5efff; box-shadow: 0 12px 25px -15px #21142c75;
}
.stage-art { position: absolute; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.stage-art::before {
    content: ""; position: absolute; inset: 0; opacity: .47;
    background-image: radial-gradient(circle, #cbb8f164 0 .7px, transparent .85px);
    background-size: 24px 24px; background-position: center;
    mask-image: linear-gradient(90deg, #000, #000 20%, #0000 48%, #0000 52%, #000 80%, #000);
}
.orbit { position: absolute; top: 49%; left: 50%; border: 1px solid #d8c3ff19; border-radius: 50%; translate: -50% -50%; width: var(--size); height: var(--size); }
.o1 { --size: 275px; }
.o2 { --size: 365px; }
.o3 { --size: 464px; }
.stage-star { position: absolute; color: #ac87e1; opacity: .72; width: 15px; height: 15px; }
.s1 { top: 25%; left: 19%; width: 13px; height: 13px; }
.s2 { top: 22%; right: 19%; }
.s3 { bottom: 23%; right: 23%; width: 9px; height: 9px; opacity: .49; }
.s4 { bottom: 24%; left: 23%; width: 7px; height: 7px; opacity: .49; }
.stage-top, .stage-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 19px 24px; }
.stage-top .eyebrow { color: #c5b8d7; }
.stage-top .eyebrow span { color: #d4adff; }
.state {
    display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px;
    border: 1px solid #c9b0ed34; border-radius: 99px; font-size: 11px; line-height: 1.15;
    color: #d6c9e9; background: #1a1527b0; white-space: nowrap;
}
.dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: #a493b7; }
.stage[data-mode="ready"] .dot { background: #bfe1bf; box-shadow: 0 0 9px #bfe1bf60; }
.stage[data-mode="result"] .dot { background: #d8b6ff; box-shadow: 0 0 9px #d8b6ff80; }
.stage[data-mode="loading"] .dot, .stage[data-mode="drawing"] .dot { background: #d8b6ff; animation: pulse 1.1s ease-in-out infinite alternate; }
.stage[data-mode="blocked"] .dot { background: #edb4bd; }

.stage-middle { display: grid; place-content: center; justify-items: center; text-align: center; padding: 5px 20px 14px; min-width: 0; }
.intro { display: grid; justify-items: center; }
.hero-star { display: block; width: 39px; height: 39px; color: #dfc5ff; filter: drop-shadow(0 0 19px #d3a1ff81); margin-bottom: 12px; }
.hero-title { margin: 0; font-size: clamp(34px, 5.2vw, 57px); font-weight: 720; line-height: 1.06; letter-spacing: -.058em; }
.hero-title span { color: #d9b4ff; }
.stage-caption { margin: 12px 0 22px; color: #d2c4e2; font-size: 14px; }
.stage-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.draw {
    display: inline-flex; align-items: center; justify-content: center; gap: 11px; padding: 0 27px;
    min-height: 59px; min-width: 227px; border: 1px solid #f6eeff; border-radius: 13px;
    background: linear-gradient(180deg, #e3d5ff, #d1bbf9); color: #2b2040;
    box-shadow: 0 4px 0 #a284ce, 0 13px 29px #ad83e634;
    font-size: 16px; font-weight: 730; letter-spacing: -.012em;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease, opacity .16s ease;
}
.draw svg { width: 17px; height: 17px; }
.draw:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 #a284ce, 0 17px 33px #b282ec57; filter: brightness(1.05); }
.draw:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #a284ce, 0 3px 8px #b282ec45; }
.draw:disabled { opacity: .55; box-shadow: 0 2px 0 #a284ce; }
.stage[data-mode="drawing"] .hero-star { animation: spin 1.05s cubic-bezier(.2,.7,.4,1) both; }
.stage[data-mode="drawing"] .draw:disabled { opacity: .9; }
.stage[data-mode="result"] .draw { min-width: 138px; min-height: 39px; font-size: 13px; border-radius: 9px; box-shadow: 0 2px 0 #a284ce; padding: 0 14px; }
.stage[data-mode="result"] .draw svg { width: 12px; height: 12px; }
.copy { min-height: 39px; padding: 0 13px; border: 1px solid #d8c4fb4f; background: #2118318c; color: #eee5fb; font-size: 13px; }
.copy:hover { background: #5c457d; border-color: #d8c4fb8f; }

.result {
    display: grid; justify-items: center; width: min(535px, calc(100vw - 138px));
    margin: 0 0 13px; padding: 13px 22px 15px;
    border-radius: 17px; border: 1px solid #cfb6f345;
    background: linear-gradient(150deg, #4a3767ec, #2b203eef);
    box-shadow: 0 12px 32px #10091c5f; animation: reveal .5s cubic-bezier(.2,.75,.26,1) both;
}
.winner-label { display: flex; align-items: center; gap: 7px; font: 600 10px/1 var(--mono); letter-spacing: .15em; color: #e1caff; }
.winner-label svg { width: 13px; height: 13px; }
.winner-main { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 10px; }
.avatar { position: relative; overflow: hidden; display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; border: 2px solid #dfc6fb; color: #40295c; background: #d7bff6; font-size: 19px; font-weight: 740; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #d7bff6; }
.profile { min-width: 0; padding: 2px 4px; background: none; color: #fff; font-size: clamp(19px, 3.15vw, 29px); line-height: 1.2; letter-spacing: -.035em; }
.profile:hover:not(:disabled) { color: #e3c3ff; }
.profile:disabled svg { display: none; }
.profile span { overflow: hidden; text-overflow: ellipsis; }
.profile .icon { width: 16px; height: 16px; color: #dbc1f8; }
blockquote { width: 100%; margin: 10px 0 0; max-height: 102px; overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere; white-space: pre-wrap; color: #f0e5fa; font-size: 15px; line-height: 1.5; scrollbar-color: #ab8bcc #35274b; }

.confetti { pointer-events: none; position: absolute; inset: 0; overflow: hidden; }
.confetti i { position: absolute; top: 49%; left: 50%; width: 6px; height: 10px; background: var(--color); border-radius: 2px; opacity: 0; animation: confetti 1.2s cubic-bezier(.13,.66,.4,1) var(--delay) both; }
.stage-bottom { border-top: 1px solid #d7c2fa21; padding-top: 13px; padding-bottom: 13px; min-height: 56px; }
.entry-count { display: flex; align-items: baseline; gap: 7px; color: #cec1dd; font-size: 12px; font-variant-numeric: tabular-nums; }
.entry-count strong { color: #f3e8ff; font-size: 17px; font-weight: 700; }
.stage-link { color: #e2cbff; background: #d3affb14; padding: 5px 8px; border-radius: 7px; font-size: 12px; }
.stage-link:hover { background: #d3affb30; }
.stage-link .icon { width: 15px; height: 15px; }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 1px 0; color: var(--muted); font-size: 12px; }
.footer > span:first-child { display: flex; align-items: center; gap: 6px; }
.footer .icon { width: 14px; height: 14px; }
.footer-mark { font: 500 9px/1 var(--mono); letter-spacing: .13em; white-space: nowrap; }
.footer-mark b { color: #7c56a8; margin: 0 2px; }

dialog { width: min(600px, calc(100% - 36px)); max-height: min(660px, 90vh); padding: 0; border: 1px solid #e0d6e7; border-radius: 19px; color: var(--ink); background: var(--paper); box-shadow: 0 18px 80px #130a325c; }
dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
dialog::backdrop { background: #1b142b88; backdrop-filter: blur(3px); }
.dialog-head, .dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; }
.dialog-head h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.035em; }
.dialog-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.dialog-foot > div { display: flex; gap: 6px; }
.icon-button { width: 35px; height: 35px; padding: 0; }
.comment-list { min-height: 120px; margin: 0; padding: 0 18px; list-style: none; overflow: auto; }
.comment-list li { padding: 10px 0; border-top: 1px solid #ebe4ee; overflow-wrap: anywhere; }
.comment-list strong { display: block; color: #583c7d; font-size: 13px; }
.comment-list p { margin: 3px 0 0; font-size: 14px; white-space: pre-wrap; }
.settings-body { padding: 0 18px 17px; color: var(--muted); font-size: 14px; }
.settings-body p { margin: 0 0 14px; }
.settings-body .settings-note { margin: 13px 0 0; font-size: 12px; }
#instagram-settings { margin-bottom: 14px; }
#provider-choice { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }

@keyframes pulse { to { opacity: .32; } }
@keyframes spin { from { rotate: 0deg; scale: 1; } 45% { scale: 1.25; } to { rotate: 360deg; scale: 1; } }
@keyframes reveal { from { opacity: 0; transform: translateY(9px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes confetti {
    0% { opacity: 0; transform: scale(.4); }
    14% { opacity: .95; }
    78% { opacity: .76; }
    100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--turn)) scale(.7); }
}

@media (max-width: 720px) {
    .shell { width: calc(100% - 40px); padding-top: 20px; }
    .masthead { padding-bottom: 16px; margin-bottom: 18px; }
    .source { padding: 17px 16px 14px; }
    .stage { margin-top: 14px; min-height: 392px; }
    .stage-top, .stage-bottom { padding-left: 15px; padding-right: 15px; }
}
@media (max-width: 490px) {
    .shell { width: calc(100% - 24px); }
    .source-head { display: block; }
    .source-actions { margin: -4px 0 7px -6px; }
    .solid { padding: 0 9px; }
    .solid .icon { display: none; }
    .result { width: calc(100vw - 70px); }
    .footer-mark { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
