/* Keychain — styles */
:root {
    --gold: #e8c46a;
    --ink: #e8ecf6;
    --card: #151a28;
    --card2: #1e2640;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0d0f18;
    color: var(--ink);
    -webkit-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
}
#app { position: relative; width: 100vw; height: 100vh; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.topbtns { position: fixed; top: 12px; right: 12px; z-index: 10; display: flex; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(13,15,24,.6); color: #d0d8ea;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; backdrop-filter: blur(6px);
    transition: background .2s, transform .15s;
}
.icon-btn:hover { background: rgba(36,46,72,.75); transform: scale(1.06); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 17px; line-height: 1; }

#status {
    position: fixed; left: 12px; bottom: 12px; z-index: 8;
    font-size: 11.5px; letter-spacing: .04em; color: rgba(205,215,240,.6);
    text-shadow: 0 1px 3px rgba(0,0,0,.7); pointer-events: none;
}
#hint {
    position: fixed; top: 14px; left: 50%; transform: translate(-50%, -8px);
    z-index: 9; font-size: 12.5px; color: #ffe9b0;
    background: rgba(18,22,36,.85); padding: 7px 14px; border-radius: 20px;
    border: 1px solid rgba(232,196,106,.3); opacity: 0; pointer-events: none;
    transition: opacity .4s, transform .4s; max-width: 88vw; text-align: center;
}
#hint.show { opacity: 1; transform: translate(-50%, 0); }

/* charms panel */
#panel {
    position: fixed; inset: 0; z-index: 20;
    background: rgba(4,6,12,.55); backdrop-filter: blur(3px);
    display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity .25s;
}
#panel.open { opacity: 1; pointer-events: auto; }
.sheet {
    width: 100%; max-width: 440px; max-height: 78vh; overflow-y: auto;
    background: var(--card); border-radius: 18px 18px 0 0;
    border: 1px solid rgba(160,180,235,.16); border-bottom: 0;
    padding: 14px 18px 26px;
    transform: translateY(30px); transition: transform .28s;
}
#panel.open .sheet { transform: translateY(0); }
.sheet-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 15px; font-weight: 600; margin-bottom: 10px; gap: 10px;
}
.count { font-size: 11px; color: rgba(200,210,240,.6); font-weight: 400; flex: 1; text-align: right; }

.pack { margin-bottom: 14px; }
.pack h4 {
    font-size: 11px; text-transform: uppercase; letter-spacing: .14em;
    color: rgba(232,196,106,.85); margin: 8px 0 6px;
}
.cgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.charm {
    width: 52px; height: 52px; border-radius: 12px;
    border: 1px solid rgba(160,180,235,.18); background: var(--card2);
    font-size: 26px; cursor: pointer; position: relative;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.charm:hover { border-color: rgba(200,215,255,.45); transform: scale(1.06); }
.charm.sel {
    border-color: var(--gold); background: rgba(232,196,106,.16);
    box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(232,196,106,.2);
}
.charm.sel::after {
    content: ''; position: absolute; top: 4px; right: 4px;
    width: 7px; height: 7px; border-radius: 50%; background: var(--gold); z-index: 2;
}
.charm.locked {
    font-size: 18px; font-weight: 700;
    border-style: dashed; opacity: .75;
}
.charm canvas { pointer-events: none; }
