/* UI kit */
#hud { pointer-events: none; }
#hud > * { pointer-events: auto; }
.ui-pill { position: absolute; top: 6px; height: 40px; display: flex; align-items: center; gap: 4px; padding: 0 10px 0 6px; border-radius: 999px; background: rgba(255,248,240,.9); border: 2px solid var(--gold); box-shadow: 0 2px 6px rgba(90,30,60,.25); font-weight: 900; font-size: 16px; color: var(--ink); }
.ui-pill img { width: 26px; height: 26px; object-fit: contain; }
.ui-pill.gold { left: 8px; min-width: 88px; }
.ui-pill.spr { left: 102px; min-width: 56px; }
.ui-hud-right { position: absolute; top: 6px; right: 64px; display: flex; gap: 4px; }
.ui-round { position: relative; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 35% 30%, #fffdf8, #ffe9ee); border: 3px solid var(--gold); box-shadow: 0 2px 6px rgba(90,30,60,.3), inset 0 0 0 2px rgba(255,255,255,.8); font-size: 22px; font-weight: 900; color: var(--pink-d); cursor: pointer; transition: transform .12s cubic-bezier(.3,1.6,.5,1); padding: 0; font-family: var(--font); }
.ui-round img { width: 28px; height: 28px; object-fit: contain; pointer-events: none; }
.ui-round .plus { position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; line-height: 16px; border-radius: 50%; background: var(--pink); color: #fff; font-size: 15px; text-align: center; border: 2px solid #fff; }
.ui-round.pressed, .ui-round:active { transform: scale(.9); }
.ui-round.focus { outline: 3px solid #ffe28a; outline-offset: 2px; border-radius: 50%; }
.ui-dot { position: absolute; top: 0; right: 0; width: 13px; height: 13px; border-radius: 50%; background: #ff4a6e; border: 2px solid #fff; box-shadow: 0 0 4px rgba(255,74,110,.8); display: none; }
.ui-dot.on { display: block; }

#nav { display: flex; align-items: stretch; padding: 0 2px; background: linear-gradient(180deg, rgba(255,240,246,.94), rgba(255,214,228,.96)); border-top: 3px solid var(--gold); box-shadow: 0 -3px 10px rgba(90,30,60,.2); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ui-nav-btn { position: relative; flex: 1; min-width: 44px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0; border: 0; background: none; padding: 0 0 5px; cursor: pointer; font-family: var(--font); transition: transform .2s cubic-bezier(.3,1.6,.5,1); }
.ui-nav-btn img { width: 38px; height: 38px; object-fit: contain; pointer-events: none; transition: transform .2s cubic-bezier(.3,1.6,.5,1), filter .2s; }
.ui-nav-btn span { font-size: 12px; font-weight: 900; color: #fff; text-shadow: var(--outline); pointer-events: none; white-space: nowrap; }
.ui-nav-btn.active img { transform: translateY(-8px) scale(1.2); filter: drop-shadow(0 0 6px #fff3b0) drop-shadow(0 0 10px rgba(255,200,90,.9)); }
.ui-nav-btn.active::before { content: ""; position: absolute; left: 6px; right: 6px; top: 6px; bottom: 3px; border-radius: 16px; background: radial-gradient(ellipse at 50% 30%, rgba(255,255,255,.85), rgba(255,226,138,.35) 70%, transparent); z-index: -1; }
.ui-nav-btn.active span { color: #fff6c8; }
.ui-nav-btn:active { transform: scale(.9); }
.ui-nav-btn.focus { outline: 3px solid #ffe28a; outline-offset: -3px; border-radius: 14px; }
.ui-nav-btn .ui-dot { top: 4px; right: 8px; }

/* modal */
.ui-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(70,20,50,.45); animation: ui-fade .18s ease both; }
.ui-wrap.out { animation: ui-fade-out .15s ease both; pointer-events: none; }
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-fade-out { to { opacity: 0; } }
.ui-sheet { position: relative; width: min(92%, 380px); max-height: 86%; display: flex; flex-direction: column; gap: 8px; background: transparent; animation: pop-in .28s cubic-bezier(.3,1.5,.5,1) both; }
.ui-sheet.wide { width: min(96%, 440px); }
.ui-wrap.out .ui-sheet { animation: ui-out .15s ease both; }
@keyframes ui-out { to { transform: scale(.85); opacity: 0; } }
.ui-sheet .ui-title { min-height: 44px; padding-right: 48px; display: flex; align-items: center; }
.ui-sheet .ui-x { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffdf8, #ffd9e4); font-size: 26px; line-height: 1; font-weight: 900; color: var(--pink-d); box-shadow: 0 0 0 2px var(--gold); cursor: pointer; font-family: var(--font); padding: 0; transition: transform .12s; }
.ui-sheet .ui-x:active { transform: scale(.9); }
.ui-sheet .ui-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.ui-sheet .ui-btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 2px 0 4px; }
.ui-sheet .ui-body.scroll > * { flex-shrink: 0; }

.ui-toast { display: inline-flex; align-items: center; gap: 6px; max-width: 90%; padding: 8px 16px; border-radius: 999px; background: rgba(255,248,240,.95); border: 2px solid var(--gold); color: var(--ink); font-size: 14px; font-weight: 800; box-shadow: 0 3px 8px rgba(90,30,60,.3); animation: pop-in .25s cubic-bezier(.3,1.5,.5,1) both; transition: opacity .3s, transform .3s; }
.ui-toast.out { opacity: 0; transform: translateY(-10px); }
.ui-toast img { width: 24px; height: 24px; object-fit: contain; }

.ui-input { width: 100%; height: 48px; padding: 0 14px; border-radius: 16px; border: 3px solid var(--gold); background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 18px; font-weight: 800; outline: none; text-align: center; box-shadow: inset 0 2px 4px rgba(90,30,60,.15); user-select: text; -webkit-user-select: text; }
.ui-input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255,134,179,.4); }
.ui-text { font-size: 15px; font-weight: 700; line-height: 1.5; text-align: center; color: var(--ink); padding: 4px 6px; }

/* portrait */
.ui-portrait { position: relative; display: inline-block; flex-shrink: 0; }
.ui-portrait .pb { position: absolute; inset: 0; border-radius: 18px; background-size: cover; background-position: center; border: 3px solid var(--gold-l); box-shadow: inset 0 0 12px rgba(255,255,255,.5); }
.ui-portrait .pa { position: absolute; left: 5%; right: 5%; top: 8%; bottom: 4%; border-radius: 50%; }
.ui-portrait .pw { position: absolute; left: -10%; width: 120%; top: 6%; height: 80%; object-fit: contain; opacity: .85; }
.ui-portrait .ps { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ui-portrait.sil .ps { filter: brightness(0) opacity(.55); }
.ui-portrait.bob .pi { animation: float 3.2s ease-in-out infinite; }
.ui-portrait .pi { position: absolute; inset: 0; }

/* item cell */
.ui-cell { position: relative; width: 66px; min-height: 66px; border-radius: 16px; background: rgba(255,255,255,.8); border: 2px solid var(--gold-l); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 2px; cursor: pointer; transition: transform .12s cubic-bezier(.3,1.6,.5,1); }
.ui-cell:active { transform: scale(.92); }
.ui-cell.selected { border-color: var(--pink); background: #fff0f5; box-shadow: 0 0 8px rgba(255,134,179,.7); }
.ui-cell.dim { opacity: .45; }
.ui-cell img { width: 44px; height: 44px; object-fit: contain; pointer-events: none; }
.ui-cell .cnt { position: absolute; right: -6px; top: -6px; min-width: 22px; padding: 0 5px; height: 20px; line-height: 20px; border-radius: 10px; background: var(--pink); color: #fff; font-size: 12px; font-weight: 900; text-align: center; border: 2px solid #fff; }
.ui-cell .nm { font-size: 12px; font-weight: 800; color: var(--ink); text-align: center; line-height: 1.1; margin-top: 2px; }
.ui-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 8px; justify-items: center; }
.ui-tabs { display: flex; gap: 6px; justify-content: center; }
.ui-tab { flex: 1; min-height: 44px; padding: 0 4px; border-radius: 14px; border: 2px solid var(--gold-l); background: rgba(255,255,255,.7); font-family: var(--font); font-size: 14px; font-weight: 900; color: var(--ink-2); cursor: pointer; }
.ui-tab.on { background: linear-gradient(180deg, #ffb3cf, var(--pink)); color: #fff; text-shadow: var(--outline); border-color: var(--gold); }
.ui-tab.focus { outline: 3px solid #ffe28a; outline-offset: 1px; }
.ui-brow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 14px; background: rgba(255,255,255,.75); border: 2px solid var(--gold-l); }
.ui-brow img.ic { width: 44px; height: 44px; object-fit: contain; }
.ui-brow .nm { font-weight: 900; font-size: 15px; }
.ui-detail { align-items: center; text-align: center; }
.ui-detail .big { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(90,30,60,.3)); }

/* attr bars */
.ui-bars { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.ui-bar { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; }
.ui-bar .lb { width: 36px; text-align: right; }
.ui-bar .tr { flex: 1; height: 10px; border-radius: 6px; background: rgba(93,47,72,.15); overflow: hidden; }
.ui-bar .fl { height: 100%; border-radius: 6px; transition: width .4s; }
.ui-bar .pc { width: 36px; text-align: left; }
.ui-stars { color: var(--gold); font-size: 16px; letter-spacing: 1px; text-shadow: 0 1px 0 rgba(122,46,82,.4); }

.ui-float { position: absolute; z-index: 45; pointer-events: none; font-size: 22px; font-weight: 900; color: #fff; text-shadow: var(--outline); transform: translate(-50%, -50%); white-space: nowrap; font-family: var(--font); }
.ui-flash { position: absolute; inset: 0; z-index: 44; pointer-events: none; }
.ui-scr { position: absolute; inset: 0; }
