html, body {
    margin: 0;
    height: 100%;
    background: #0c0a0d;
    overflow: hidden;
    font-family: Georgia, 'Times New Roman', serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

#stage {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scene {
    width: 100%;
    height: 100%;
    max-width: 560px;
    display: block;
}

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

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    pointer-events: none;
}

#title {
    color: #d8b878;
    font-size: 13px;
    letter-spacing: .22em;
    text-transform: uppercase;
    opacity: .75;
    text-shadow: 0 1px 3px #000;
}

#mute {
    pointer-events: auto;
    background: rgba(255, 200, 120, .08);
    border: 1px solid rgba(255, 200, 120, .25);
    color: #d8b878;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
}
#mute:hover { background: rgba(255, 200, 120, .18); }

#hint {
    position: absolute;
    bottom: 76px;
    left: 0;
    right: 0;
    text-align: center;
    color: #b89a6c;
    font-size: 13px;
    font-style: italic;
    opacity: 0;
    text-shadow: 0 1px 3px #000;
    transition: opacity .8s;
    pointer-events: none;
    padding: 0 24px;
}
#hint.show { opacity: .85; }

/* ---------- thread ---------- */
#knotG { transition: opacity .6s; }
#stage.sealed #knotG, #stage.ready #knotG { opacity: 1; }
#endTassel { transition: opacity .6s; }
#stage.sealed #endTassel, #stage.ready #endTassel { opacity: 0; }

#readyHalo { transition: opacity .8s; }
#stage.ready #readyHalo { opacity: .8; animation: haloPulse 2.6s ease-in-out infinite; }
@keyframes haloPulse {
    0%, 100% { transform: scale(1); opacity: .5; }
    50%      { transform: scale(1.25); opacity: .9; }
}
#readyHalo { transform-box: fill-box; transform-origin: center; }

.wrap { transition: opacity .12s; opacity: 0; }

/* ---------- buttons ---------- */
.primary, .ghost {
    font-family: inherit;
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 14.5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform .15s, box-shadow .15s;
}
.primary {
    background: linear-gradient(180deg, #d94f3d, #a82c20);
    color: #ffe9c9;
    border-color: #7a1d12;
    box-shadow: 0 2px 10px rgba(180, 50, 30, .35);
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(180, 50, 30, .45); }
.ghost {
    background: transparent;
    color: #b89a6c;
    border-color: rgba(216, 184, 120, .35);
}
.ghost:hover { background: rgba(216, 184, 120, .08); }

#cta {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}
#stage.bare #cta { display: block; }

/* ---------- overlays ---------- */
.overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(8, 6, 8, .72);
    backdrop-filter: blur(3px);
    z-index: 5;
    padding: 20px;
}
.overlay.open { display: flex; }

.card {
    width: 100%;
    max-width: 330px;
    background: linear-gradient(180deg, #241c1a, #181114);
    border: 1px solid rgba(216, 184, 120, .25);
    border-radius: 14px;
    padding: 22px 20px 16px;
    color: #e8dcc2;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
    animation: cardIn .45s cubic-bezier(.3, 1.3, .5, 1);
}
@keyframes cardIn {
    from { transform: translateY(14px) scale(.96); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.card h2 {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: normal;
    color: #f0d9a8;
}
.card .sub {
    margin: 0 0 14px;
    font-size: 12.5px;
    color: #a8895c;
    font-style: italic;
    line-height: 1.45;
}
.card textarea, .card input[type="date"] {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 235, 200, .06);
    border: 1px solid rgba(216, 184, 120, .3);
    border-radius: 8px;
    color: #f0e3c2;
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    margin-bottom: 12px;
    resize: none;
    outline: none;
    color-scheme: dark;
}
.card textarea:focus, .card input[type="date"]:focus {
    border-color: rgba(216, 184, 120, .6);
    background: rgba(255, 235, 200, .09);
}
.card .lbl {
    display: block;
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #a8895c;
    margin-bottom: 6px;
}
.card .row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
}
.card .priv {
    margin: 14px 0 0;
    text-align: center;
    font-size: 11px;
    color: #77644a;
    font-style: italic;
}

/* reveal card */
.card.paper {
    background: linear-gradient(170deg, #efe3c5, #d9c69c);
    color: #4a3319;
    border-color: #b89a6c;
    text-align: center;
    position: relative;
}
.card.paper h2 { color: #6b4420; }
.card.paper .sub { color: #8a6a44; }
.card.paper .seal {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    line-height: 30px;
    border-radius: 50%;
    background: #b0332a;
    color: #ffd98a;
    font-size: 14px;
    box-shadow: 0 3px 8px rgba(0,0,0,.3);
}
#revealText {
    font-size: 17px;
    line-height: 1.6;
    color: #3d2a12;
    font-style: italic;
    margin: 16px 6px 20px;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.card.paper .ghost { color: #7a5a34; border-color: rgba(122, 90, 52, .4); }
.card.paper .ghost:hover { background: rgba(122, 90, 52, .1); }
.card.paper .row { justify-content: center; }

/* stars */
.star { fill: #e8ddc0; }
