/* Fortune Cookie — styles */
:root {
    --gold: #e8b96a;
    --ink: #f0e8dc;
    --card: #1e1626;
    --card2: #291e33;
}
* { 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: #0e0a14;
    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; }
#fx { position: fixed; pointer-events: none; z-index: 5; }

#swing { transform-origin: 180px 0; animation: sway 6.5s ease-in-out infinite; }
@keyframes sway {
    0%, 100% { transform: rotate(-1.6deg); }
    50% { transform: rotate(1.6deg); }
}
#cookieL, #cookieR { transition: transform .55s cubic-bezier(.34,1.4,.5,1); }
#swing.open #cookieL { transform: rotate(-26deg) translate(-10px, 4px); }
#swing.open #cookieR { transform: rotate(26deg) translate(10px, 4px); }
#cookieL, #cookieR { transform-origin: 180px 322px; }
#slip { transition: transform .8s cubic-bezier(.3,1.3,.4,1) .25s, opacity .3s .25s; }
#swing.open #slip { opacity: 1; transform: translate(168px 356px) rotate(-9deg); }
#swing { cursor: pointer; }

.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(18,12,26,.6); color: #e0d0e8;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; backdrop-filter: blur(6px);
    transition: background .2s, transform .15s;
}
.icon-btn:hover { background: rgba(52,36,66,.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(230,215,190,.7);
    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(28,18,38,.78); padding: 7px 14px; border-radius: 20px;
    border: 1px solid rgba(255,220,140,.25); opacity: 0; pointer-events: none;
    transition: opacity .4s, transform .4s; max-width: 88vw; text-align: center;
}
#hint.show { opacity: 1; transform: translate(-50%, 0); }

/* fortune card */
.fcard {
    position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%) translateY(14px);
    z-index: 12; width: min(320px, 88vw);
    background: #f6f1e2; color: #3a2e1a;
    border-radius: 6px 14px 6px 14px; padding: 16px 18px 14px;
    box-shadow: 0 14px 40px rgba(0,0,0,.55), 0 2px 0 #c8bfa0;
    opacity: 0; transition: opacity .5s .5s, transform .5s .5s;
    text-align: center;
}
.fcard.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.fcat {
    display: inline-block; font-size: 10px; font-weight: 700;
    letter-spacing: .18em; text-transform: uppercase;
    color: #fff; border-radius: 20px; padding: 3px 12px; margin-bottom: 10px;
}
.ftext { font-size: 14.5px; line-height: 1.55; font-family: Georgia, 'Times New Roman', serif; }
.fdate { margin-top: 9px; font-size: 10.5px; color: #9a8a68; letter-spacing: .08em; }

/* panel */
#panel {
    position: fixed; inset: 0; z-index: 20;
    background: rgba(6,4,10,.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: 420px; max-height: 74vh; overflow-y: auto;
    background: var(--card); border-radius: 18px 18px 0 0;
    border: 1px solid rgba(232,185,106,.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;
}
.hist .hrow { padding: 9px 2px; border-bottom: 1px solid rgba(255,220,150,.08); }
.hist .hcat {
    display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: #fff; border-radius: 10px;
    padding: 1px 8px; margin-bottom: 4px;
}
.hist .htext { font-size: 12.5px; color: rgba(235,220,200,.9); line-height: 1.45; }
.hist .hdate { font-size: 10px; color: rgba(220,195,160,.5); margin-top: 3px; }
.hist .empty { color: rgba(230,210,190,.5); font-style: italic; padding: 10px 0; font-size: 12.5px; }
