:root { --ink: #2a1b4d; --gold: #ffd23a; --sun: #ff8a2a; --card: rgba(30, 18, 60, .88); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #ffd0ec; font-family: 'Lilita One', 'Arial Rounded MT Bold', Arial, sans-serif; color: #fff; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; }
.hidden { display: none !important; }
button { font-family: inherit; }

/* panels */
.panel { position: fixed; inset: 0; display: flex; overflow-y: auto; padding: 16px; z-index: 20; }
.panel > div { margin: auto; }
#title { background: linear-gradient(180deg, rgba(42, 27, 77, .15), rgba(42, 27, 77, .55)); }
.tbox { text-align: center; max-width: 760px; width: 100%; }
.logo { font-size: clamp(54px, 11vw, 112px); margin: 0; letter-spacing: 2px; line-height: 1; text-shadow: 0 6px 0 var(--ink), 0 10px 24px rgba(0,0,0,.35); -webkit-text-stroke: 3px var(--ink); }
.logo.small { font-size: clamp(42px, 8vw, 72px); }
.logo span { display: inline-block; animation: wob 2.4s ease-in-out infinite; }
.logo span:nth-child(2n) { animation-delay: -.6s; } .logo span:nth-child(3n) { animation-delay: -1.2s; }
@keyframes wob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
.c0 { color: #ff4d5e; } .c1 { color: #ff9a2e; } .c2 { color: #ffd93b; } .c3 { color: #6fdc3c; } .c4 { color: #22d3c5; } .c5 { color: #3d8bff; } .c6 { color: #9b5cff; } .c7 { color: #ff6fcf; }
.sub { font-size: clamp(16px, 2.6vw, 22px); margin: 10px 0 14px; text-shadow: 0 2px 0 var(--ink); }
.lbl { font-size: 15px; letter-spacing: 1px; opacity: .95; margin: 6px 0; text-shadow: 0 2px 0 var(--ink); }
.chars { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; }
.chr { width: 74px; padding: 6px 0 5px; border-radius: 16px; background: rgba(30, 18, 60, .55); border: 3px solid transparent; cursor: pointer; color: #fff; font-size: 13px; }
.chr .dot { width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 4px; position: relative; box-shadow: inset -5px -6px 0 rgba(0,0,0,.18); }
.chr .dot::before, .chr .dot::after { content: ''; position: absolute; top: 12px; width: 9px; height: 11px; background: #fff; border-radius: 50%; box-shadow: inset 2px 3px 0 0 #1b1030; }
.chr .dot::before { left: 10px; } .chr .dot::after { right: 10px; }
.chr.sel { border-color: #fff; background: rgba(30, 18, 60, .85); transform: scale(1.06); }
.chr.taken { opacity: .3; cursor: not-allowed; }
.opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 14px; }
.seg { display: inline-flex; align-items: center; gap: 4px; background: rgba(30, 18, 60, .6); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; }
.seg span { margin-right: 4px; opacity: .85; }
.seg button { border: 0; border-radius: 999px; padding: 6px 12px; background: transparent; color: #fff; font-size: 14px; cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); }
.seg.locked button { cursor: default; }
.brow { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px; }
.btn { font-size: clamp(19px, 2.6vw, 26px); color: var(--ink); background: linear-gradient(180deg, #fff6b0, var(--gold) 45%, var(--sun)); border: 0; border-radius: 999px; padding: 12px 34px; box-shadow: 0 5px 0 #a24a10, 0 10px 24px rgba(0,0,0,.3); cursor: pointer; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #a24a10; }
.btn.alt { background: linear-gradient(180deg, #c7f7ff, #4fd2ff 45%, #2a8cff); box-shadow: 0 5px 0 #17468f, 0 10px 24px rgba(0,0,0,.3); }
.btn.alt:active { box-shadow: 0 1px 0 #17468f; }
.btn.small { font-size: 18px; padding: 9px 24px; }
.btn:disabled { filter: grayscale(.8); opacity: .6; cursor: default; }
.keys { margin-top: 14px; font-size: 13px; opacity: .9; text-shadow: 0 1px 0 var(--ink); }
.game-info { margin: 16px auto 0; max-width: 560px; font: 13px/1.5 Arial, Helvetica, sans-serif; color: #f2ecff; background: rgba(30, 18, 60, .45); border-radius: 14px; padding: 10px 14px; }
.game-info h2 { font-size: 14px; margin: 0 0 4px; }
.game-info p { margin: 0; }

.pbox, .rbox { background: var(--card); border-radius: 26px; padding: 22px 26px; text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,.4); max-width: 560px; width: 100%; }
#pause, #results, #msg { background: rgba(20, 10, 40, .35); }
#msg { z-index: 40; }
#msgt { margin: 0 0 8px; font-size: 28px; }
#msgb { font: 16px/1.45 Arial, sans-serif; margin: 0 0 12px; }

/* results */
#rwin { font-size: clamp(22px, 4vw, 32px); margin: 6px 0 12px; }
.rrow { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 18px; }
.rrow .rk { width: 28px; text-align: right; opacity: .85; }
.rrow .nm { width: 110px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rrow .bar { flex: 1; height: 22px; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; }
.rrow .bar i { display: block; height: 100%; border-radius: 999px; width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.rrow .pc { width: 58px; text-align: right; }
.rrow.me .nm { text-decoration: underline; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#timer { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 38px; text-shadow: 0 3px 0 var(--ink), 0 0 12px rgba(0,0,0,.3); -webkit-text-stroke: 2px var(--ink); }
#timer.hurry { color: #ffd23a; animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: translateX(-50%) scale(1.15); } }
#scores { position: absolute; top: max(62px, calc(env(safe-area-inset-top) + 52px)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; width: min(96vw, 760px); }
.sc { display: flex; align-items: center; gap: 5px; padding: 3px 9px 3px 4px; border-radius: 999px; background: rgba(30, 18, 60, .7); font-size: 15px; transition: transform .2s; }
.sc b { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.sc.me { outline: 2px solid #fff; }
.sc.lead { transform: scale(1.1); }
#big { position: absolute; top: 38%; left: 0; right: 0; text-align: center; font-size: clamp(60px, 14vw, 140px); -webkit-text-stroke: 4px var(--ink); text-shadow: 0 8px 0 var(--ink); opacity: 0; }
#big.show { animation: pop .9s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 20% { opacity: 1; transform: scale(1.15); } 35% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }
#power { position: absolute; bottom: 20%; left: 0; right: 0; text-align: center; font-size: clamp(26px, 5vw, 40px); -webkit-text-stroke: 2px var(--ink); text-shadow: 0 4px 0 var(--ink); opacity: 0; }
#power.show { animation: pop 1.3s ease-out forwards; }
#feed { position: absolute; left: 12px; bottom: 12px; font: 14px Arial, sans-serif; text-shadow: 0 1px 2px #000; }
#feed div { animation: fade 4s forwards; }
@keyframes fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

.corner { position: fixed; top: max(10px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(30, 18, 60, .6); color: #fff; font-size: 20px; cursor: pointer; z-index: 30; }
#mutebtn { right: 10px; }
#menubtn { left: 10px; }

/* name tags */
#tags { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.tag { position: absolute; transform: translate(-50%, -100%); font-size: 14px; padding: 1px 8px; border-radius: 999px; background: rgba(30, 18, 60, .65); white-space: nowrap; }
.tag.me { background: #fff; color: var(--ink); }

/* touch controls */
#touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
#stickzone { position: absolute; left: 0; bottom: 0; width: 60%; height: 70%; pointer-events: auto; }
#stickbase { position: absolute; width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%; background: rgba(255,255,255,.18); border: 3px solid rgba(255,255,255,.45); left: 110px; top: calc(100% - 120px); }
#stickknob { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: rgba(255,255,255,.8); }
#dashbtn { position: absolute; right: max(26px, env(safe-area-inset-right)); bottom: max(34px, env(safe-area-inset-bottom)); width: 100px; height: 100px; border-radius: 50%; border: 0; pointer-events: auto; font-size: 22px; color: var(--ink); background: radial-gradient(circle at 40% 35%, #fff6b0, var(--gold) 55%, var(--sun)); box-shadow: 0 5px 0 #a24a10; }
#dashbtn.cool { filter: grayscale(.9) brightness(.8); }

/* online UI */
#netui { background: linear-gradient(180deg, rgba(42, 27, 77, .3), rgba(42, 27, 77, .7)); }
.nbox { background: var(--card); border-radius: 26px; padding: 18px 22px; text-align: center; max-width: 720px; width: 100%; box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.nbox h2 { margin: 0 0 8px; font-size: 30px; }
.nbox p { font: 15px/1.45 Arial, sans-serif; margin: 6px 0; }
.codein { font-family: inherit; font-size: 34px; width: 170px; text-align: center; letter-spacing: 6px; text-transform: uppercase; border-radius: 16px; border: 3px solid #fff; background: rgba(255,255,255,.1); color: #fff; padding: 6px; }
.nstatus { min-height: 22px; font: 15px Arial, sans-serif; margin-top: 10px; color: #c9f1ff; }
.nstatus.err { color: #ffb0b0; }
.codebig { font-size: 52px; letter-spacing: 8px; color: var(--gold); text-shadow: 0 4px 0 #000; }
.plist { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.pl { display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: 16px; }
.pl b { width: 22px; height: 22px; border-radius: 50%; }
.pl small { font: 12px Arial, sans-serif; opacity: .8; }
.pl.rdy { background: rgba(111, 220, 60, .3); }
.linkrow { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; font: 13px Arial, sans-serif; }
.linkrow input { width: min(320px, 70vw); font: 13px Arial, sans-serif; padding: 6px 8px; border-radius: 8px; border: 0; }

@media (max-height: 520px) {
  .logo { font-size: 50px; } .sub { margin: 4px 0 6px; } .chr { width: 62px; } .chr .dot { width: 32px; height: 32px; } .chr .dot::before, .chr .dot::after { top: 9px; width: 7px; height: 9px; } .chr .dot::before { left: 7px; } .chr .dot::after { right: 7px; }
  #timer { font-size: 30px; } #scores { top: 48px; } .game-info { display: none; }
}
.seg.wrap { flex-wrap: wrap; justify-content: center; border-radius: 22px; max-width: 100%; }
.seg button { white-space: nowrap; }

/* ---------------- Board Game Party */
#title { background: linear-gradient(180deg, rgba(42, 27, 77, .1), rgba(42, 27, 77, .5)); }
#title .logo { font-size: clamp(40px, 8.5vw, 92px); }
.av.kid, .chr .dot.kid { background: none; box-shadow: none; display: inline-block; }
.av.kid::before, .av.kid::after, .chr .dot.kid::before, .chr .dot.kid::after { display: none; }
.av.kid svg, .chr .dot.kid svg { width: 100%; height: 100%; display: block; }
.av { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.chr .dot.kid { width: 48px; height: 48px; }
.pl .av.kid { width: 26px; height: 26px; }
#roundinfo { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 22px; background: rgba(30, 18, 60, .75); padding: 6px 18px; border-radius: 999px; }
#pbar { position: absolute; top: max(58px, calc(env(safe-area-inset-top) + 48px)); left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; width: min(98vw, 980px); }
.pc2 { display: flex; align-items: center; gap: 6px; background: rgba(30, 18, 60, .75); border-radius: 18px; padding: 4px 12px 4px 4px; transition: transform .2s; }
.pc2.act { background: #ffd23a; color: #2a1b4d; transform: scale(1.08); }
.pc2.me { outline: 2px solid #fff; }
.pc2 .nm { font-size: 14px; line-height: 1.1; }
.pc2 .num { font-size: 15px; }
.pc2 .num span { margin-left: 6px; }
#banner { position: absolute; top: 34%; left: 0; right: 0; text-align: center; opacity: 0; pointer-events: none; }
#banner .bt { font-size: clamp(34px, 6vw, 60px); -webkit-text-stroke: 2px #2a1b4d; text-shadow: 0 5px 0 #2a1b4d; }
#banner .bs { font-size: clamp(16px, 2.4vw, 22px); text-shadow: 0 2px 0 #2a1b4d; margin-top: 4px; }
#banner.show { animation: ban 2.2s ease-out forwards; }
@keyframes ban { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.06); } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#rollbtn { position: absolute; left: 50%; bottom: max(30px, env(safe-area-inset-bottom)); transform: translateX(-50%); pointer-events: auto; font-size: 30px; padding: 16px 46px; animation: bob 1s ease-in-out infinite; }
#rollbtn[data-t]:not([data-t=""])::after { content: ' ' attr(data-t); font-size: 18px; opacity: .7; }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-6px); } }
#pops { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
.pop { position: absolute; transform: translate(-50%, -100%); font-size: 30px; white-space: nowrap; -webkit-text-stroke: 2px #2a1b4d; text-shadow: 0 3px 0 #2a1b4d; animation: popup 1.3s ease-out forwards; }
@keyframes popup { 0% { opacity: 0; transform: translate(-50%, -100%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -100%) scale(1.15); } 30% { transform: translate(-50%, -100%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; margin-top: -40px; } }
#minihud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#minitime { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 38px; -webkit-text-stroke: 2px #2a1b4d; text-shadow: 0 3px 0 #2a1b4d; }
#miniscores { position: absolute; top: max(62px, calc(env(safe-area-inset-top) + 52px)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; width: min(96vw, 760px); }
.msc { display: flex; align-items: center; gap: 4px; padding: 3px 10px 3px 3px; border-radius: 999px; background: rgba(30, 18, 60, .75); font-size: 18px; }
.msc .av { width: 28px; height: 28px; } .msc.me { outline: 2px solid #fff; } .msc.out { opacity: .4; }
#minititle { position: absolute; top: 26%; left: 50%; transform: translateX(-50%); text-align: center; background: rgba(30, 18, 60, .85); border-radius: 26px; padding: 18px 28px; width: min(92vw, 560px); }
#minititle .mt, #minires .mt { font-size: clamp(32px, 5vw, 48px); }
#minititle .mh { font: 18px/1.4 Arial, sans-serif; margin-top: 8px; }
#minicd { position: absolute; top: 55%; left: 0; right: 0; text-align: center; font-size: clamp(60px, 12vw, 120px); -webkit-text-stroke: 3px #2a1b4d; text-shadow: 0 6px 0 #2a1b4d; color: #ffd23a; }
#minires { background: rgba(20, 10, 40, .35); z-index: 25; }
.mrbox { background: rgba(30, 18, 60, .92); border-radius: 26px; padding: 18px 24px; text-align: center; width: min(94vw, 520px); }
.mr { display: flex; align-items: center; gap: 10px; font-size: 20px; margin: 6px 0; }
.mr .md { width: 36px; font-size: 26px; } .mr .nm { flex: 1; text-align: left; } .mr .sc { font: 15px Arial, sans-serif; opacity: .85; } .mr .pz { width: 70px; text-align: right; color: #ffd23a; }
.mr.me .nm { text-decoration: underline; }
.mnext { font: 15px Arial, sans-serif; opacity: .8; margin-top: 10px; }
.rrow .av { width: 32px; height: 32px; }
.rrow .pc { width: auto; flex: 1; text-align: right; }
@media (max-width: 600px) { .pc2 { padding: 3px 8px 3px 3px; } .pc2 .av { width: 26px; height: 26px; } .pc2 .nm { font-size: 12px; } .pc2 .num { font-size: 13px; } #roundinfo { font-size: 17px; } }
#rollbtn { white-space: nowrap; font-size: clamp(24px, 6vw, 30px); padding: 14px 40px; }
