:root{--bg:#cfa978;--surface:#fffdf6;--ink:#3b2a1a;--muted:#7a6650;--line:#eadfc8;--soft:#f6efe0;--rail:#dccdae;--seam:#fffdf6;--accent:#e2704b;--gold:#fffdf6;--tape:#f6d77fcc;--radius:4px;--serif:"Yeon Sung","Pretendard Variable",sans-serif}
*{box-sizing:border-box}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.6 "Pretendard Variable",Pretendard,-apple-system,"Apple SD Gothic Neo","Malgun Gothic",sans-serif;letter-spacing:-.01em;-webkit-font-smoothing:antialiased}
button,input,textarea,select{font:inherit;color:inherit;letter-spacing:inherit}
button{cursor:pointer;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:8px 14px;transition:background .2s,border-color .2s,transform .1s}
button:hover{border-color:#cfcac0}
button:active{transform:translateY(1px)}
button:disabled{opacity:.35;cursor:default;transform:none}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
a{color:inherit;text-decoration:none}
h1,h2,h3,p{margin:0}
[hidden]{display:none!important}

header{max-width:1080px;margin:auto;height:76px;display:flex;align-items:center;justify-content:space-between;padding:0 24px}
.brand{display:flex;align-items:center;gap:10px;font-size:25px;font-weight:800;letter-spacing:-.045em}
.brand img{width:34px;height:34px;border-radius:9px}
.header-link{font-size:14px;color:var(--muted)}
.header-link:hover{color:var(--ink)}
main{max-width:1080px;margin:auto;padding:8px 24px 0}

.page-heading{display:flex;align-items:baseline;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:12px 0 18px}
.page-heading h1{font-size:30px;font-weight:800;letter-spacing:-.045em;line-height:1.2}
.tool-nav{display:inline-flex;background:var(--soft);border-radius:12px;padding:4px;gap:2px}
.tool-nav a{padding:7px 14px;border-radius:9px;font-size:14px;color:var(--muted);font-weight:500;transition:background .2s,color .2s}
.tool-nav a:hover{color:var(--ink)}
.tool-nav a[aria-current=page]{background:var(--surface);color:var(--ink);font-weight:700;box-shadow:0 1px 3px #3a322614}

.workspace{display:grid;grid-template-columns:320px minmax(0,1fr);background:var(--surface);border-radius:var(--radius);box-shadow:0 1px 2px #3a32260d,0 12px 40px -12px #3a32261a;overflow:hidden;scroll-margin-top:16px}
.editor{padding:24px;border-right:1px solid var(--line);display:flex;flex-direction:column;gap:14px}
.section-title{display:flex;justify-content:space-between;align-items:center}
.section-title label,.section-title h2{font-size:14px;font-weight:700}
.badge{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
textarea{width:100%;border:1px solid var(--line);border-radius:12px;padding:12px 14px;resize:vertical;background:#fffdf7;transition:border-color .2s,background .2s}
textarea:focus{background:#fff;border-color:#bdb7ab;outline:none}
#names{height:220px;line-height:1.75}
.presets{display:flex;gap:6px;flex-wrap:wrap}
.chip{font-size:13px;padding:5px 11px;border-radius:999px;color:var(--muted)}
.chip.active{background:var(--ink);border-color:var(--ink);color:#fff}
.list-tools{margin-left:auto;display:flex;gap:2px}#clear,#reset{border-color:transparent}
.options{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding-top:14px;border-top:1px solid var(--line);font-size:14px}
.options:empty{display:none}
.check{display:flex;gap:8px;align-items:center;cursor:pointer}
input[type=checkbox]{accent-color:var(--ink);width:17px;height:17px;margin:0}
.micro{font-size:13px;color:var(--muted)}
.stepper{display:flex;align-items:center;margin-left:auto;border:1px solid var(--line);border-radius:10px;overflow:hidden}
.stepper button{border:0;border-radius:0;padding:6px 12px;font-size:16px}
.stepper input{width:44px;border:0;text-align:center;font-weight:700;font-variant-numeric:tabular-nums;-moz-appearance:textfield;appearance:textfield}
.stepper input::-webkit-inner-spin-button{-webkit-appearance:none}
.saved-row{display:flex;gap:6px;padding-top:14px;border-top:1px solid var(--line)}
.saved-row select{flex:1;min-width:0;border:1px solid var(--line);border-radius:10px;padding:7px 10px;background:var(--surface);font-size:14px}
.icon-button{font-size:13px;padding:6px 12px}
.text-button{border:0;background:none;padding:0;font-size:13px;color:var(--muted);text-decoration:underline;text-underline-offset:3px}
#error{font-size:13px;color:#c0392b}
#error:empty{display:none}

.stage{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:36px 28px;min-width:0;min-height:520px}
.stage-head{display:none}
.wheel-area{position:relative;width:min(380px,100%);aspect-ratio:1;flex-shrink:0}
#wheel{width:100%;height:100%;border-radius:50%;box-shadow:0 0 0 6px var(--surface),0 0 0 7px var(--line),0 18px 40px -16px #3a322640;transition:transform 3s cubic-bezier(.12,.7,.1,1)}
.pointer{position:absolute;top:-14px;left:calc(50% - 13px);width:26px;height:32px;background:var(--ink);clip-path:polygon(0 0,100% 0,50% 100%);z-index:2;filter:drop-shadow(0 2px 2px #0003)}
.wheel-hub{position:absolute;left:50%;top:50%;width:44px;height:44px;margin:-22px 0 0 -22px;border-radius:50%;background:var(--surface);box-shadow:0 2px 8px #3a322633}
.result{width:100%;text-align:center;min-height:56px;margin:22px 0 14px;overflow-wrap:anywhere;display:flex;flex-direction:column;align-items:center;justify-content:center}
.winner{font-size:34px;font-weight:800;letter-spacing:-.04em;line-height:1.2;animation:pop .35s cubic-bezier(.2,1.4,.4,1)}
.winner small{display:none}
@keyframes pop{from{transform:scale(.85);opacity:0}}
.primary{background:var(--ink);color:#fff;border-color:var(--ink);font-weight:700}
.primary:hover{background:#34322e;border-color:#34322e}
#run{width:min(320px,100%);height:54px;border-radius:14px;font-size:17px}
.result-actions{display:flex;gap:4px;margin-top:12px}
.result-actions button{border:0;background:none;padding:6px 10px;font-size:13px;color:var(--muted);border-radius:8px}
.result-actions button:hover:not(:disabled){background:var(--soft);color:var(--ink)}
#alternative-stage{flex:1;display:flex;align-items:center}
#alternative-stage{flex-direction:column;justify-content:center;text-align:center;gap:6px}
#alternative-stage h3{font-size:26px;font-weight:800;letter-spacing:-.04em;color:var(--ink)}
#alternative-stage p{font-size:14px;color:var(--muted)}
.team-results{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(170px,calc(50% - 6px)),1fr));gap:12px;width:100%;max-height:440px;overflow:auto;text-align:left;padding:2px}
.team-card{background:color-mix(in srgb,var(--c) 32%,#fff);border-radius:16px;padding:16px;animation:rise .35s cubic-bezier(.2,.9,.3,1) both}
.team-head{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid color-mix(in srgb,var(--c) 70%,#3a3226 8%)}
.team-head strong{font-size:18px;font-weight:800;letter-spacing:-.04em}
.team-head span{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.team-card ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:9px}
.team-card li{display:flex;align-items:center;gap:10px;line-height:1.4;font-size:15px;font-weight:500;overflow-wrap:anywhere}
.team-card li i{flex:none;width:8px;height:8px;border-radius:50%;background:color-mix(in srgb,var(--c) 70%,#3a3226 25%)}
@keyframes rise{from{opacity:0;transform:translateY(8px)}}
.team-slots{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:22px;max-width:520px}
.team-slots:empty{display:none}
.slot{width:84px;padding:12px 6px;border:1.5px dashed color-mix(in srgb,var(--c) 80%,#3a3226 15%);background:color-mix(in srgb,var(--c) 18%,#fff);border-radius:14px;display:flex;flex-direction:column;align-items:center;gap:2px}
.slot b{font-size:14px}
.slot span{font-size:12px;color:var(--muted)}
.order-results{display:flex;flex-direction:column;gap:6px;width:min(360px,100%);max-height:420px;overflow:auto;text-align:left}
.order-item{display:flex;align-items:center;gap:12px;background:var(--bg);border-radius:12px;padding:9px 14px;font-size:15px;animation:pop .3s ease-out both}
.order-item b{width:26px;height:26px;border-radius:8px;background:var(--surface);display:grid;place-items:center;font-size:13px;font-variant-numeric:tabular-nums}
.order-item:first-child b{background:var(--ink);color:#fff}

.below{margin-top:16px;background:var(--surface);border-radius:16px;padding:16px 20px}
#history{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px;max-height:96px;overflow:auto}
.history-item{font-size:13px;background:var(--bg);border-radius:8px;padding:4px 10px}
.history-item small{color:var(--muted);margin-right:6px;font-variant-numeric:tabular-nums}

.guide,.tool-guide{padding:64px 0 72px}
.guide-label{font-size:15px;font-weight:600;color:var(--accent);margin-bottom:14px}
.qa{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;padding:26px 0;border-top:1px solid var(--line)}
.qa:last-child{border-bottom:1px solid var(--line)}
.qa h2{font-size:20px;font-weight:700;letter-spacing:-.03em;line-height:1.5}
.qa p{font-size:17px;line-height:1.8;color:#4a4740;text-wrap:pretty}
.tool-guide a,.faq a{text-decoration:underline;text-underline-offset:3px}
.tool-guide table{border-collapse:collapse;width:100%;max-width:420px;margin:12px 0 0;font-size:16px;font-variant-numeric:tabular-nums}
.tool-guide th,.tool-guide td{border-bottom:1px solid var(--line);padding:9px 4px;text-align:left}
.tool-guide th{color:var(--muted);font-weight:600}
.faq{max-width:680px}
.faq h2{font-size:18px;margin:32px 0 8px}
.faq p{color:#4a4740;line-height:1.85}
main.guide>h1{font-size:30px;letter-spacing:-.045em;margin:12px 0 8px}
.noscript{padding:12px 16px;background:var(--surface);border-radius:12px;margin-bottom:12px}

footer{max-width:1032px;margin:0 auto;border-top:1px solid var(--line);padding:22px 0 32px;display:flex;justify-content:space-between;gap:16px;color:var(--muted);font-size:13px}
footer div,footer:not(:has(div)){display:flex;gap:18px}
footer a:hover{color:var(--ink)}

dialog{border:0;border-radius:18px;padding:24px;width:calc(100% - 32px);max-width:400px;color:var(--ink);box-shadow:0 24px 60px -20px #3a322666}
dialog::backdrop{background:#3a322666;backdrop-filter:blur(2px)}
dialog h2{font-size:18px;margin-bottom:14px}
dialog label{display:block;font-size:13px;color:var(--muted);margin-bottom:6px}
dialog input{width:100%;border:1px solid var(--line);border-radius:10px;padding:10px 12px}
#share-url{font-size:12px;min-height:90px;margin-top:10px}
.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}
#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:var(--ink);color:#fff;padding:10px 18px;border-radius:12px;font-size:14px;max-width:90%;display:none;z-index:10}
.skip{position:absolute;left:-9999px}
.skip:focus{left:12px;top:12px;padding:10px;background:#fff;z-index:10}

@media(max-width:760px){
header{height:64px;padding:0 16px}
.brand{font-size:22px}
.brand img{width:30px;height:30px}
main{padding:0 16px}
.page-heading{margin:4px 0 14px;gap:12px}
.page-heading h1{font-size:24px}
.tool-nav{display:flex;width:100%}
.tool-nav a{flex:1;text-align:center;padding:8px 4px;font-size:13px}
.workspace{grid-template-columns:1fr;border-radius:18px}
.stage{order:-1;min-height:0;padding:28px 18px 20px}
.wheel-area{width:min(300px,100%)}
.result{margin:16px 0 10px;min-height:44px}
.winner{font-size:28px}
.editor{border-right:0;border-top:1px solid var(--line);padding:20px 18px}
#names{height:150px}
.guide,.tool-guide{padding:44px 0 52px}
.qa{grid-template-columns:1fr;gap:8px;padding:20px 0}.qa h2{font-size:18px}.qa p{font-size:16px}
footer{margin:0 16px;flex-direction:column}
}
@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}html{scroll-behavior:auto}}
@media(max-width:760px){.team-card{padding:14px}.team-head{margin-bottom:10px;padding-bottom:8px}.team-head strong{font-size:16px}.team-card li{font-size:14px}.team-results{max-height:none}}
footer nav{display:flex;gap:18px;flex-wrap:wrap}
footer>div{flex-wrap:wrap}
.ladder-options{display:flex;flex-direction:column;gap:8px}
.ladder-options textarea{min-height:96px}
.ladder-area{width:min(520px,100%)}
.ladder-area canvas{display:block;width:100%;height:auto}
.ladder-results{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:6px;width:min(520px,100%);text-align:left}
.ladder-item{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--bg);border-radius:12px;padding:9px 14px;font-size:15px;animation:pop .3s ease-out both}
.ladder-item b{display:flex;align-items:center;gap:8px;font-weight:600}
.ladder-item b::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--c)}
.ladder-item span{color:var(--muted,#8a857b)}
.ladder-item.hit span{color:var(--accent);font-weight:700}
.team-slots.slips{max-width:560px;gap:6px}
.slip{min-width:64px;max-width:120px;height:44px;padding:0 10px;border-radius:10px;display:grid;place-items:center;font-size:13px;font-weight:600;color:var(--muted);background:linear-gradient(135deg,var(--soft) 50%,#e6e3dc 50%);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background .2s,color .2s,opacity .3s,transform .25s}
.slip.open{background:#fff;color:var(--ink);box-shadow:inset 0 0 0 1px var(--line);animation:flip .35s ease-out}
.slip.lose{opacity:.4}
.slip.win{background:var(--accent);color:#fff;box-shadow:0 6px 16px rgba(208,96,58,.3);transform:translateY(-3px);font-weight:800}
@keyframes flip{0%{transform:rotateX(0)}50%{transform:rotateX(90deg)}100%{transform:rotateX(0)}}
.draw-results{margin-top:6px}
.ladder-area canvas{cursor:pointer}
.ladder-hint{text-align:center;min-height:18px;margin-top:4px}
.ladder-item{border:0;font:inherit;color:inherit;cursor:pointer;text-align:left;width:100%}
.ladder-item.on{box-shadow:inset 0 0 0 2px var(--c);background:#fff}
.fireflies{display:none}
.themes{display:flex;align-items:center;gap:6px;margin:0 16px 0 auto}
.themes span{font-size:13px;color:inherit;opacity:.8;margin-right:2px}
header .themes button{all:unset;box-sizing:border-box;width:24px;height:24px;border-radius:50%;cursor:pointer;border:2px solid #fff;box-shadow:0 0 0 1px #0004,0 2px 3px #0003;transition:transform .15s}
header .themes button:hover{transform:scale(1.12)}
header .themes button:focus-visible{outline:2px solid currentColor;outline-offset:2px}
header .themes button[aria-pressed=true]{box-shadow:0 0 0 2px currentColor,0 2px 3px #0003;transform:scale(1.12)}
header .themes [data-theme=paper]{background:linear-gradient(135deg,#cfa978 0 50%,#e2704b 50%)}
header .themes [data-theme=field]{background:linear-gradient(135deg,#bfe0ef 0 50%,#9cc58a 50%)}
header .themes [data-theme=night]{background:linear-gradient(135deg,#1b2148 0 50%,#f1c46b 50%)}
header .themes [data-theme=manga]{background:linear-gradient(135deg,#fff 0 50%,#ff3b30 50%)}
header .themes [data-theme=summer]{background:linear-gradient(135deg,#4aa6f0 0 50%,#ffd43b 50%)}
@media(max-width:760px){.themes span{display:none}.themes{gap:5px;margin-right:10px}header .themes button{width:22px;height:22px}}
