* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    background: #1d150f;
    color: #f0e6d6;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

#stage { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; }
#fx { position: absolute; pointer-events: none; }

/* ---------- HUD ---------- */
#hud {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; justify-content: space-between; align-items: center;
    padding: 42px 14px 10px;
    pointer-events: none;
}
#hud > * { pointer-events: auto; }
#title {
    font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
    color: rgba(240,220,190,.5);
}
#hud button {
    background: rgba(30,20,12,.4);
    border: 1px solid rgba(255,220,160,.14);
    color: rgba(245,230,205,.85);
    border-radius: 8px;
    width: 34px; height: 34px;
    cursor: pointer;
    margin-left: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .2s;
    backdrop-filter: blur(3px);
}
#hud button:hover { background: rgba(60,42,24,.6); }

/* ---------- status + hint ---------- */
#status {
    position: absolute; left: 0; right: 0; bottom: 18px;
    text-align: center;
    font-size: 12.5px; letter-spacing: .05em;
    color: rgba(240,220,190,.55);
    pointer-events: none;
}
#hint {
    position: absolute; left: 0; right: 0; bottom: 44px;
    text-align: center; font-size: 13px;
    color: rgba(255,230,190,.9);
    opacity: 0; transition: opacity .35s;
    pointer-events: none;
    text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
#hint.show { opacity: 1; }

/* ---------- overlays ---------- */
.overlay {
    position: absolute; inset: 0;
    display: none;
    align-items: center; justify-content: center;
    background: rgba(10,6,4,.72);
    backdrop-filter: blur(4px);
    z-index: 10;
}
.overlay.open { display: flex; }
.card {
    width: min(330px, 88vw);
    max-height: 86vh;
    overflow-y: auto;
    background: #2a2018;
    border: 1px solid rgba(230,190,120,.18);
    border-radius: 16px;
    padding: 22px 22px 18px;
    box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.card h2 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.card .sub { font-size: 12.5px; color: rgba(230,205,170,.6); margin-bottom: 10px; }
.card .lbl { display: block; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: rgba(225,195,150,.5); margin: 14px 0 6px; }
.card .row { display: flex; gap: 10px; margin-top: 16px; }
.card .row button { flex: 1; }
.card .note { font-size: 11px; color: rgba(225,195,150,.45); margin-top: 6px; }

button.primary, button.ghost {
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
}
button.primary { background: #a04a2a; color: #fff0dd; }
button.primary:hover { background: #b4582f; }
button.primary.sm { padding: 8px 14px; font-size: 13px; }
button.ghost { background: transparent; color: rgba(235,215,185,.75); border-color: rgba(225,190,140,.25); }
button.ghost:hover { background: rgba(255,255,255,.06); }

.optRow { display: flex; gap: 6px; flex-wrap: wrap; }
.opt {
    background: rgba(255,255,255,.05);
    border: 1.5px solid rgba(225,190,140,.2);
    border-radius: 9px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 12px;
    color: rgba(240,225,200,.88);
    font-family: inherit;
    transition: border-color .15s, background .15s;
}
.opt:hover { background: rgba(255,255,255,.10); }
.opt.sel { border-color: #e8a04e; background: rgba(220,140,60,.2); }

.customRow { display: flex; gap: 8px; align-items: center; }
#emojiIn {
    flex: 1;
    padding: 8px 10px;
    font-size: 15px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(225,190,140,.25);
    border-radius: 10px;
    color: inherit;
}
#emojiIn:focus { outline: none; border-color: rgba(255,200,120,.5); }

/* ---------- SVG ---------- */
#danglers .dang { cursor: pointer; transform-box: fill-box; transform-origin: top center; }
