:root { --font: serif; --gold: #e8c77a; --cream: #fff4dc; --lac: rgba(12,16,40,0.84); --crim: linear-gradient(#c91a3a, #7a0a1f); --bar: 76px; }
#ui { font-family: var(--font); color: var(--cream); font-weight: 700; text-shadow: 0 2px 0 #2a0d1a, 0 0 6px rgba(0,0,0,.6); }
#ui button { font-family: inherit; color: inherit; font-weight: 700; text-shadow: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#ui img { pointer-events: none; -webkit-user-drag: none; }
#ui .layer { pointer-events: none; }
#ui > .layer { position: fixed; }
#ui > .layer.hit, #ui > .layer .hit { pointer-events: auto; }

/* generic lacquer panel */
.lac { background: linear-gradient(180deg, rgba(20,26,62,.9), rgba(10,13,34,.9)); border: 1.5px solid var(--gold); border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.5), inset 0 0 0 3px rgba(12,16,40,.9), inset 0 0 0 4px rgba(232,199,122,.3); position: relative; }
.lac::before, .lac::after { content: ""; position: absolute; width: 10px; height: 10px; border: 2px solid var(--gold); pointer-events: none; }
.lac::before { top: 3px; left: 3px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.lac::after { bottom: 3px; right: 3px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }
.nav.focus { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 14px 4px var(--gold) !important; z-index: 3; }
.btn { min-height: 46px; min-width: 46px; padding: 6px 14px; font-size: 16px; border-radius: 23px; border: 2px solid var(--gold); background: linear-gradient(180deg, rgba(40,48,96,.9), rgba(16,20,48,.95)); box-shadow: 0 3px 0 #05060f, 0 0 8px rgba(0,0,0,.4); transition: transform .12s, filter .12s; }
.btn.pri { background: var(--crim); box-shadow: 0 3px 0 #3a0410, 0 0 10px rgba(179,18,46,.6); }
.btn:active, .tab:active, .card:active, .thumb:active { transform: scale(.93); }
.btn.on, .card.on, .thumb.on { border-color: #fff; box-shadow: 0 0 12px 2px var(--gold); filter: brightness(1.2); }
.btn[disabled], .dis { filter: grayscale(.8) brightness(.6); }

/* title */
#title { inset: 0; background: #070a18 center / cover no-repeat; transition: opacity .35s; pointer-events: auto !important; cursor: pointer; overflow: hidden; }
#title.hide { opacity: 0; pointer-events: none !important; }
#title::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(5,6,20,.7), transparent 30%, transparent 62%, rgba(5,6,20,.85)); }
#title .logo { position: absolute; top: calc(5% + env(safe-area-inset-top)); left: 8%; width: 84%; max-height: 30vh; object-fit: contain; animation: drop .6s cubic-bezier(.3,1.5,.5,1) both, float 3.6s ease-in-out .6s infinite; filter: drop-shadow(0 4px 10px rgba(0,0,0,.6)); }
#title .shine { position: absolute; top: 0; left: 0; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); mix-blend-mode: overlay; animation: shine 4s ease-in-out 1s infinite; pointer-events: none; opacity: 0; }
#title .prompt { position: absolute; left: 0; right: 0; bottom: calc(10% + env(safe-area-inset-bottom)); text-align: center; font-size: 17px; animation: pulse 1.6s ease-in-out infinite; padding: 0 16px; }
@keyframes drop { from { transform: translateY(-120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes float { 50% { transform: translateY(6px); } }
@keyframes shine { 0% { transform: translateX(-120%); opacity: 0; } 15% { opacity: 1; } 50%,100% { transform: translateX(300%); opacity: 0; } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.96); } }

/* studio visibility */
#ui > .studio { transition: opacity .25s; }
body:not([data-screen=studio]) #ui > .studio { opacity: 0; pointer-events: none !important; visibility: hidden; }
body:not([data-screen=studio]) #ui > .studio * { pointer-events: none !important; }

/* HUD */
#hud { top: calc(10px + env(safe-area-inset-top)); left: 10px; max-width: calc(100% - 84px); padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; }
#hud .row { display: flex; align-items: center; gap: 6px; font-size: 16px; }
#hud img.ic { width: 28px; height: 28px; object-fit: contain; flex: none; }
#hud .num { min-width: 42px; transition: transform .2s; }
#hud .num.pop { animation: pop .4s cubic-bezier(.3,1.6,.5,1); }
.bar { width: 90px; height: 10px; border-radius: 5px; background: rgba(0,0,0,.6); border: 1px solid rgba(232,199,122,.6); overflow: hidden; flex: none; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .5s ease, background .3s; background: linear-gradient(90deg, #e8c77a, #d4203f); }
.bar.hi > i { background: #ff7eb6; } .bar.mid > i { background: #e8c77a; } .bar.lo > i { background: #6a7fb8; }
#hud .gold { display: flex; align-items: center; gap: 6px; }
#hud .gold img { width: 22px; height: 22px; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.4); } 100% { transform: scale(1); } }

#shopbtn { top: calc(66px + env(safe-area-inset-top)); right: 10px; width: 48px; height: 48px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
#shopbtn img { width: 32px; height: 32px; object-fit: contain; }

/* bar: 4 tabs | shutter | 3 tabs (the shutter sits in the 78px gap after the 4th tab) */
#bar { left: 0; right: 0; bottom: 0; height: calc(var(--bar) + env(safe-area-inset-bottom)); padding: 0 0 env(safe-area-inset-bottom); background: linear-gradient(180deg, rgba(16,20,50,.94), rgba(6,8,22,.96)); border-top: 2px solid var(--gold); box-shadow: 0 -4px 14px rgba(0,0,0,.5); display: flex; align-items: center; justify-content: space-around; pointer-events: auto !important; box-sizing: border-box; }
.tab { flex: 1 1 0; min-width: 44px; max-width: 56px; height: 62px; padding: 2px 0 0; border: 1.5px solid transparent; border-radius: 10px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 10px; letter-spacing: -.2px; transition: transform .12s, background .2s; overflow: hidden; }
.tab span { max-width: 100%; white-space: nowrap; overflow: hidden; line-height: 1.2; }
.tab img { width: 28px; height: 28px; object-fit: contain; }
.tab.on { background: rgba(232,199,122,.2); border-color: var(--gold); }
.gap { width: 78px; flex: none; }
#shutter { position: absolute; left: calc(57.143% - 5.6px); top: -28px; width: 72px; height: 72px; margin-left: -36px; border-radius: 50%; border: 3px solid var(--gold); background: radial-gradient(circle at 50% 35%, #e0284a, #7a0a1f); padding: 0; display: grid; place-items: center; animation: glow 2s ease-in-out infinite; transition: transform .12s; }
#shutter:active { transform: scale(.9); }
#shutter img { width: 48px; height: 48px; object-fit: contain; }
body.kbd #shutter::after { content: "Space"; position: absolute; bottom: -4px; font-size: 11px; background: #000a; border-radius: 6px; padding: 0 5px; }
@keyframes glow { 50% { box-shadow: 0 0 22px 6px rgba(255,200,110,.7); } 0%,100% { box-shadow: 0 0 8px 1px rgba(179,18,46,.7); } }

/* sheet (scrolls, scrollbar hidden; sits above the shutter's bump) */
#sheet { left: 8px; right: 8px; bottom: calc(var(--bar) + 28px + env(safe-area-inset-bottom)); max-height: 46vh; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: 10px 12px 12px; box-sizing: border-box; display: none; pointer-events: auto !important; }
#sheet::-webkit-scrollbar { display: none; width: 0; height: 0; }
#sheet.open { display: block; animation: slideup .22s cubic-bezier(.3,1.4,.5,1); }
@keyframes slideup { from { transform: translateY(40px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.head { display: flex; align-items: center; justify-content: space-between; font-size: 18px; margin: -10px -12px 6px; padding: 10px 12px 2px; background: #121839; border-radius: 12px 12px 0 0; position: sticky; top: -10px; z-index: 2; }
.x { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 20px; }
.grid { display: grid; gap: 8px; }
.g4 { grid-template-columns: repeat(4, 1fr); } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); }
.card { min-height: 78px; border-radius: 10px; border: 2px solid rgba(232,199,122,.6); background: rgba(30,36,80,.7); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 14px; padding: 6px 2px; transition: transform .12s; }
.card img { width: 56px; height: 56px; object-fit: contain; }
.card small { font-size: 12px; opacity: .85; }
.sub { font-size: 14px; margin: 10px 0 6px; color: var(--gold); }
.hint { font-size: 12px; opacity: .8; margin-top: 6px; }
.row2 { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 14px; }
.row2 span.l { width: 84px; flex: none; }
.thumb { position: relative; height: 84px; border-radius: 10px; border: 2px solid rgba(232,199,122,.6); background: #000 center / cover no-repeat; padding: 0; overflow: hidden; transition: transform .12s; }
.thumb b { position: absolute; left: 0; right: 0; bottom: 0; font-size: 12px; background: rgba(0,0,0,.6); padding: 2px 0; }
.thumb .lock { position: absolute; inset: 0 0 18px 0; background: rgba(0,0,0,.55); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 14px; }
.thumb .lock img { width: 18px; height: 18px; vertical-align: middle; }
.frame-img { background-size: contain; background-color: #101430; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 44px; background: transparent; touch-action: pan-y; margin: 0; min-width: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, #1a2150, #3a2a60); border: 1px solid var(--gold); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, #1a2150, #3a2a60); border: 1px solid var(--gold); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff2c0, #e8c77a 60%, #a8782a); border: 2px solid #5a3a10; box-shadow: 0 0 8px rgba(232,199,122,.8); }
input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff2c0, #e8c77a 60%, #a8782a); border: 2px solid #5a3a10; box-shadow: 0 0 8px rgba(232,199,122,.8); }
.zoomrow { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.zoomrow .btn { width: 56px; padding: 0; font-size: 22px; }
.gal { display: grid; grid-template-columns: 78px repeat(3, 1fr); gap: 6px; align-items: center; font-size: 13px; text-align: center; }
.gal .rl { text-align: left; font-size: 14px; }
.cell { min-height: 44px; border-radius: 8px; border: 1.5px solid rgba(232,199,122,.35); background: rgba(0,0,0,.4); font-size: 18px; padding: 0; }
.cell.hi { background: rgba(255,126,182,.4); border-color: #ff7eb6; } .cell.mid { background: rgba(232,199,122,.38); border-color: var(--gold); } .cell.lo { background: rgba(106,127,184,.45); border-color: #6a7fb8; }
.quote { margin-top: 8px; min-height: 40px; padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,.45); border-left: 3px solid #d4203f; font-size: 15px; line-height: 1.4; }
.bag { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.bag span { display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,.4); border: 1px solid rgba(232,199,122,.5); border-radius: 14px; padding: 3px 10px; min-height: 28px; }
.bag img { width: 24px; height: 24px; object-fit: contain; }
.charm { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.charm img { width: 40px; height: 40px; object-fit: contain; }

/* outfit chips, face pills, custom sliders */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.btn.pill { min-height: 44px; min-width: 44px; padding: 4px 12px; font-size: 14px; line-height: 1.15; }
.outfit { margin-top: 2px; }
.chip { position: relative; display: flex; align-items: stretch; min-height: 48px; border-radius: 24px; border: 2px solid var(--gold); background: linear-gradient(180deg, rgba(40,48,96,.9), rgba(16,20,48,.95)); box-shadow: 0 3px 0 #05060f; transition: opacity .15s, filter .15s; }
.chip .lb { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 2px 0 2px 8px; background: none; border: 0; border-radius: 22px 0 0 22px; text-align: left; font-size: 12px; letter-spacing: -.3px; line-height: 1.1; overflow: hidden; }
.chip .lb span { display: block; overflow-wrap: break-word; }
.chip .cd { flex: none; width: 44px; min-height: 44px; padding: 0; background: none; border: 0; border-radius: 0 22px 22px 0; display: grid; place-items: center; }
.chip .dot { display: block; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--cream); box-shadow: 0 0 0 1px #2a0d1a, inset 0 0 4px rgba(0,0,0,.4); }
.chip .dot.orig { border-color: var(--gold); box-shadow: 0 0 0 2px #2a0d1a, 0 0 6px rgba(232,199,122,.8); background: linear-gradient(135deg, #ff6a8a 0 25%, #ffe27a 25% 50%, #6ae0a0 50% 75%, #6ac8ff 75%); }
.chip.off { opacity: .55; filter: grayscale(.6); }
.chip.off .lb span { text-decoration: line-through; }
.chip .nav.focus { outline-offset: -3px; }
.btn.pill.wide { flex: 1; }
.xgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.xgrid .btn.pill { min-height: 52px; padding: 4px 4px; }
.autohint { margin: 10px 0 2px; color: var(--gold); opacity: 1; line-height: 1.35; }
.srow { display: flex; align-items: center; gap: 8px; margin: 2px 0; font-size: 13px; }
.srow .l { width: 96px; flex: none; line-height: 1.15; }
.srow.off { opacity: .4; filter: grayscale(.8); }
.trk { flex: 1; min-width: 0; height: 40px; display: flex; align-items: center; touch-action: none; cursor: pointer; border-radius: 20px; user-select: none; -webkit-user-select: none; }
.trk .rail { position: relative; flex: 1; height: 10px; margin: 0 14px; border-radius: 5px; background: linear-gradient(90deg, #1a2150, #2a2158); border: 1px solid var(--gold); box-shadow: inset 0 2px 3px rgba(0,0,0,.6); }
.trk .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: linear-gradient(180deg, #e8284a, #8a0e26); }
.trk .thumb { position: absolute; top: 50%; left: 0; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff2c0, #e8c77a 60%, #a8782a); border: 2px solid #5a3a10; box-shadow: 0 0 8px rgba(232,199,122,.8); pointer-events: none; }
.trk:active .thumb { transform: scale(1.15); }
.trk.off { cursor: default; }

/* say / toast / banner */
#say { left: 5%; right: 5%; bottom: calc(var(--bar) + 96px + env(safe-area-inset-bottom)); display: flex; justify-content: center; }
#say .box { max-width: 90%; padding: 14px 16px 10px; font-size: 17px; line-height: 1.45; display: none; }
#say .box.show { display: block; animation: pop2 .25s cubic-bezier(.3,1.5,.5,1); }
#say .tag { position: absolute; top: -12px; left: 12px; background: var(--crim); border: 1.5px solid var(--gold); border-radius: 10px; font-size: 12px; padding: 0 10px; line-height: 20px; }
@keyframes pop2 { from { transform: scale(.7) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
#toast { top: calc(120px + env(safe-area-inset-top)); left: 0; right: 0; display: flex; justify-content: center; }
#toast .box { padding: 8px 18px; font-size: 16px; opacity: 0; transform: translateY(-10px); transition: opacity .25s, transform .25s; max-width: 86%; text-align: center; }
#toast .box.show { opacity: 1; transform: none; }
#tip { position: absolute; left: 10px; right: 10px; bottom: calc(var(--bar) + 40px + env(safe-area-inset-bottom)); display: none; justify-content: center; pointer-events: none; }
#tip.on { display: flex; }
#tip .box { position: relative; pointer-events: auto; width: 100%; max-width: 420px; padding: 8px 52px 8px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.3; animation: pop2 .3s cubic-bezier(.3,1.5,.5,1); transition: opacity .2s, transform .2s; }
#tip .box.away { opacity: 0; transform: translateY(8px); pointer-events: none; }
#tip .ln { display: flex; align-items: center; gap: 8px; }
#tip .ln img { width: 24px; height: 24px; object-fit: contain; flex: none; }
#tip .ln img.gem { width: 22px; height: 22px; }
#tip .x { position: absolute; right: 4px; top: 50%; margin-top: -22px; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--gold); background: linear-gradient(180deg, rgba(40,48,96,.95), rgba(16,20,48,.95)); color: var(--cream); font: 700 18px var(--font); text-shadow: 0 2px 0 #2a0d1a; cursor: pointer; padding: 0; }
#tip .x:active { transform: scale(.9); }
#banner { inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5; }
#banner .box { text-align: center; opacity: 0; font-size: 20px; line-height: 1.6; padding: 0 12px; }
#banner .box h2 { margin: 0; font-size: 38px; color: #ffd98a; -webkit-text-stroke: 2px #2a0d1a; paint-order: stroke fill; text-shadow: 0 4px 0 #2a0d1a, 0 0 18px rgba(255,200,110,.8); }
#banner .box.show { animation: slam 2.6s both; }
@keyframes slam { 0% { transform: scale(1.5); opacity: 0; } 10% { transform: scale(.94); opacity: 1; } 16% { transform: scale(1); } 85% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.05); } }

#flash { inset: 0; z-index: 8; }
#flash .w { position: absolute; inset: 0; background: #fff; opacity: 0; }
#flash .w.go { animation: fl .35s ease-out; }
#flash .ring { position: absolute; left: 50%; top: 50%; width: 120vmax; height: 120vmax; margin: -60vmax; border-radius: 50%; border: 6vmax solid #000; opacity: 0; transform: scale(1); }
#flash .ring.go { animation: iris .35s ease-in; }
@keyframes fl { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes iris { 0% { opacity: .8; transform: scale(1); } 100% { opacity: 0; transform: scale(.25); } }

/* poster */
#poster { inset: 0; z-index: 10; background: rgba(4,6,18,.86); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; pointer-events: auto !important; padding: 12px; box-sizing: border-box; }
#poster.open { display: flex; }
#poster img { max-height: 72vh; max-width: 92%; border: 3px solid var(--gold); box-shadow: 0 0 0 3px #2a0d1a, 0 10px 40px rgba(0,0,0,.8), 0 0 30px rgba(232,199,122,.4); animation: zoomin .35s cubic-bezier(.3,1.5,.5,1); pointer-events: none; }
#poster .hint { font-size: 13px; margin: 0; }
#poster .btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
@keyframes zoomin { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
