/* ==========================================================================
   Secret command effects (see js/secrets.js)
   ========================================================================== */

.fx-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 3, 8, .7);
    opacity: 0;
    transition: opacity .3s ease;
    font-family: var(--mono);
    cursor: pointer;
}

.fx-overlay.open { opacity: 1; }
.fx-overlay.closing { opacity: 0; }
.fx-overlay.ambient { background: none; pointer-events: none; cursor: default; }

.fx-hint {
    position: absolute;
    bottom: -48px;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--dim);
    font-size: 12.5px;
}

.fx-particles {
    position: fixed;
    inset: 0;
    z-index: 90;
    pointer-events: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-10px) rotate(-.6deg); }
    30% { transform: translateX(9px) rotate(.5deg); }
    45% { transform: translateX(-7px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
}

/* ---------- toast ---------- */

#toast-host {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 260px;
    max-width: min(370px, calc(100vw - 36px));
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: rgba(14, 17, 34, .97);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5), 0 0 30px rgba(138, 180, 255, .12);
    font-family: var(--mono);
    transform: translateX(125%);
    opacity: 0;
    transition: transform .5s cubic-bezier(.2, 1.1, .3, 1), opacity .4s;
}

.toast.show { transform: none; opacity: 1; }

.toast-icon {
    flex: none;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(138, 180, 255, .25), rgba(183, 156, 255, .25));
    font-size: 20px;
}

.toast-body { min-width: 0; flex: 1; }
.toast-title { font-size: 14px; font-weight: 700; }
.toast-text { margin-top: 2px; color: var(--muted); font-size: 12.5px; }

.toast-bar {
    height: 4px;
    margin-top: 8px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
}

.toast-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---------- fortune cookie ---------- */

.fortune {
    position: relative;
    width: min(420px, 90vw);
    height: 300px;
}

.fortune .cookie {
    position: absolute;
    left: 50%;
    top: 50%;
    font-size: 120px;
    line-height: 1;
    transform: translate(-50%, -50%) scale(.2);
    filter: drop-shadow(0 12px 28px rgba(255, 190, 90, .35));
    transition: transform .6s cubic-bezier(.2, 1.4, .4, 1);
}

.fx-fortune.open .cookie {
    transform: translate(-50%, -50%) scale(1);
    animation: wobble .5s ease-in-out .4s 2;
}

.fx-fortune.cracking .cookie {
    animation: cookie-crack .35s ease-in forwards;
}

.fx-fortune.cracked .cookie { opacity: 0; }

@keyframes wobble {
    0%, 100% { rotate: 0deg; }
    25% { rotate: -9deg; }
    75% { rotate: 9deg; }
}

@keyframes cookie-crack {
    to { transform: translate(-50%, -50%) scale(1.5) rotate(14deg); opacity: 0; }
}

.crumbs { position: absolute; left: 50%; top: 50%; }

.crumbs i {
    position: absolute;
    width: 7px;
    height: 7px;
    margin: -3px;
    border-radius: 50%;
    background: #e8b660;
    opacity: 0;
}

.fx-fortune.cracked .crumbs i {
    animation: crumb .8s cubic-bezier(.1, .8, .3, 1) forwards;
}

@keyframes crumb {
    0% { opacity: 1; transform: rotate(var(--a)) translateX(0); }
    100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) translateY(30px); }
}

.slip {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(380px, 88vw);
    padding: 24px 26px 20px;
    border-radius: 6px;
    background: linear-gradient(180deg, #f8efd8, #efe2c0);
    color: #3b2d17;
    text-align: center;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
    opacity: 0;
    transform: translate(-50%, -50%) scaleX(.15);
}

.fx-fortune.cracked .slip {
    opacity: 1;
    transform: translate(-50%, -50%) scaleX(1);
    transition: transform .55s cubic-bezier(.2, 1.1, .3, 1), opacity .25s;
}

.slip-text {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
    font-style: italic;
    line-height: 1.4;
}

.slip-lucky {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed rgba(59, 45, 23, .35);
    font-size: 12px;
    letter-spacing: .06em;
    opacity: .75;
}

.fx-fortune .ring > i {
    background: conic-gradient(from 0deg, transparent 0 60%, rgba(255, 255, 255, .0) 60%, rgba(255, 255, 255, .9) 85%, transparent 95%);
}

/* ---------- coffee ---------- */

.coffee-ui {
    width: min(320px, 88vw);
    padding: 26px 24px 22px;
    text-align: center;
    background: rgba(18, 14, 12, .96);
    transform: scale(.85);
    transition: transform .35s cubic-bezier(.2, 1.3, .4, 1);
}

.fx-coffee.open .coffee-ui { transform: none; }

.cup-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 130px;
}

.cup {
    position: relative;
    width: 96px;
    height: 72px;
    margin-bottom: 8px;
    border-radius: 4px 4px 44px 44px;
    background: #f1ece2;
}

.cup-level {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 0;
    height: 78%;
    border-radius: 0 0 40px 40px;
    background: linear-gradient(#5a3520, #35200f);
    transition: height 1.2s ease-in-out;
}

.fx-coffee.empty .cup-level { height: 0; }

.cup-handle {
    position: absolute;
    right: -26px;
    top: 12px;
    width: 32px;
    height: 36px;
    border: 7px solid #f1ece2;
    border-left: 0;
    border-radius: 0 24px 24px 0;
}

.saucer {
    position: absolute;
    bottom: 0;
    width: 140px;
    height: 10px;
    border-radius: 50%;
    background: #d9d3c6;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
}

.steam {
    position: absolute;
    top: 0;
    left: 50%;
    display: flex;
    gap: 14px;
    transform: translateX(-50%);
    transition: opacity .8s;
}

.fx-coffee.empty .steam { opacity: 0; }

.steam i {
    width: 5px;
    height: 34px;
    border-radius: 3px;
    background: linear-gradient(transparent, rgba(255, 255, 255, .5));
    animation: steam 1.6s ease-in-out infinite;
}

.steam i:nth-child(2) { animation-delay: .35s; height: 42px; }
.steam i:nth-child(3) { animation-delay: .7s; }

@keyframes steam {
    0% { transform: translateY(14px) scaleX(1); opacity: 0; }
    40% { opacity: .9; }
    100% { transform: translateY(-14px) scaleX(1.8); opacity: 0; }
}

.coffee-status { margin-top: 14px; color: var(--amber); font-size: 14px; }

.coffee-bar {
    height: 6px;
    margin: 10px 0 14px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
}

.coffee-bar i {
    display: block;
    height: 100%;
    width: 12%;
    background: var(--amber);
    animation: drain 1.1s ease-in forwards;
}

@keyframes drain { to { width: 0; } }

.coffee-error,
.coffee-sub { opacity: 0; transition: opacity .3s; }

.coffee-error { color: var(--red); font-weight: 700; letter-spacing: .04em; }
.coffee-sub { margin-top: 4px; color: var(--muted); font-size: 13px; }

.fx-coffee.failed .coffee-error { opacity: 1; animation: blink-err .5s steps(2) 3; }
.fx-coffee.failed .coffee-sub { opacity: 1; transition-delay: .4s; }

@keyframes blink-err { 50% { opacity: .2; } }

/* ---------- sudo ---------- */

.sudo-ui {
    --line: rgba(255, 95, 109, .4);
    width: min(400px, 88vw);
    padding: 30px 26px 26px;
    text-align: center;
    background: rgba(26, 8, 12, .96);
    transform: scale(.7);
    transition: transform .3s cubic-bezier(.2, 1.5, .4, 1);
    box-shadow: 0 0 80px rgba(255, 60, 80, .25);
}

.fx-sudo.open .sudo-ui { transform: none; }
.fx-sudo.shake .sudo-ui { animation: shake .5s; }

.lock {
    position: relative;
    width: 56px;
    height: 68px;
    margin: 0 auto 16px;
}

.lock .shackle {
    position: absolute;
    left: 10px;
    top: 0;
    width: 36px;
    height: 34px;
    border: 7px solid var(--red);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
}

.lock .body {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 56px;
    height: 40px;
    border-radius: 9px;
    background: var(--red);
}

.lock .body::after {
    content: "";
    position: absolute;
    left: 24px;
    top: 11px;
    width: 8px;
    height: 16px;
    border-radius: 4px;
    background: #2a0a10;
}

.sudo-title { color: var(--red); font-size: 20px; font-weight: 800; letter-spacing: .1em; }
.sudo-sub { margin-top: 10px; color: #c9a5ab; font-size: 13px; line-height: 1.6; }

/* ---------- rm -rf / ---------- */

.fx-rm {
    background: rgba(24, 0, 4, .9);
    cursor: default;
    overflow: hidden;
}

.fx-rm::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .28) 0 2px, transparent 2px 4px);
}

.rm-ui { position: absolute; inset: 0; }

.rm-log {
    position: absolute;
    left: 22px;
    top: 22px;
    right: 22px;
    height: 60vh;
    overflow: hidden;
    color: #ff6b78;
    font-size: 13px;
    line-height: 1.5;
    opacity: .85;
    mask-image: linear-gradient(#000 40%, transparent);
    -webkit-mask-image: linear-gradient(#000 40%, transparent);
}

.rm-panel {
    position: absolute;
    left: 50%;
    top: 62%;
    width: min(460px, 86vw);
    transform: translateX(-50%);
    text-align: center;
}

.rm-title { color: #ffd0d4; font-size: 15px; margin-bottom: 10px; }

.rm-bar {
    height: 10px;
    border: 1px solid rgba(255, 95, 109, .6);
    border-radius: 5px;
    overflow: hidden;
}

.rm-bar i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--red);
    box-shadow: 0 0 14px var(--red);
}

.rm-pct { margin-top: 8px; color: #ff9aa3; font-size: 13px; }

.rm-denied {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(24, 0, 4, .55);
}

.fx-rm.denied .rm-denied { display: flex; }
.fx-rm.denied .rm-log,
.fx-rm.denied .rm-panel { opacity: .15; }

.rm-denied span {
    padding: 10px 28px;
    border: 5px solid var(--red);
    border-radius: 10px;
    color: var(--red);
    font-size: clamp(30px, 7vw, 64px);
    font-weight: 900;
    letter-spacing: .1em;
    text-shadow: 0 0 30px rgba(255, 60, 80, .8);
    animation: stamp .45s cubic-bezier(.2, 1.2, .3, 1) both;
}

.rm-denied small { color: #ffb4bb; font-size: 16px; animation: fade-up .5s .5s both; }

@keyframes stamp {
    from { opacity: 0; transform: scale(3.2) rotate(-10deg); }
    to { opacity: 1; transform: scale(1) rotate(-6deg); }
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* the terminal glitching while "deleting" */
#terminal.glitching {
    animation: glitch-jolt .2s steps(2) infinite;
}

#terminal.glitching #terminal-body {
    text-shadow: 3px 0 rgba(255, 0, 60, .75), -3px 0 rgba(0, 220, 255, .75);
}

@keyframes glitch-jolt {
    0% { transform: translate(-50%, -50%) translate(0, 0); }
    25% { transform: translate(-50%, -50%) translate(-7px, 2px) skewX(1.5deg); }
    50% { transform: translate(-50%, -50%) translate(6px, -3px); filter: hue-rotate(60deg); }
    75% { transform: translate(-50%, -50%) translate(-3px, 4px) skewX(-1.5deg); }
    100% { transform: translate(-50%, -50%) translate(4px, 0); }
}

/* ---------- exit: CRT power cycle ---------- */

.fx-crt { background: rgba(0, 0, 0, .35); cursor: default; }

.crt-text {
    color: #7d86a8;
    font-size: 18px;
    letter-spacing: .4em;
    opacity: 0;
}

.fx-crt.nosignal .crt-text { opacity: 1; animation: blink 1.2s steps(1) infinite; }

#terminal.crt-off { animation: crt-off .56s cubic-bezier(.7, 0, .85, .5) forwards; }
#terminal.crt-gone { animation: none; visibility: hidden; }
#terminal.crt-on { animation: crt-on .7s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes crt-off {
    0% { transform: translate(-50%, -50%) scale(1, 1); filter: brightness(1); }
    60% { transform: translate(-50%, -50%) scale(1, .006); filter: brightness(3); }
    100% { transform: translate(-50%, -50%) scale(0, .006); filter: brightness(4); opacity: 0; }
}

@keyframes crt-on {
    0% { transform: translate(-50%, -50%) scale(0, .006); filter: brightness(4); opacity: 1; }
    45% { transform: translate(-50%, -50%) scale(1, .006); filter: brightness(3); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1, 1); filter: brightness(1); opacity: 1; }
}

/* ---------- hack ---------- */

.hack-ui {
    --line: rgba(92, 255, 135, .35);
    width: min(640px, 92vw);
    background: rgba(2, 12, 6, .97);
    color: #5cff87;
    transform: translateY(20px) scale(.96);
    transition: transform .3s cubic-bezier(.2, .9, .3, 1);
    cursor: default;
}

.fx-hack.open .hack-ui { transform: none; }
.fx-hack.denied .hack-ui { --line: rgba(255, 95, 109, .6); animation: shake .5s; }

.hack-ui .window-header { color: #7bd69a; background: rgba(92, 255, 135, .05); }

.hack-body { display: grid; gap: 14px; padding: 14px 16px 18px; }

.hack-log {
    height: 190px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: #37d46a;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
}

.hack-row {
    display: grid;
    grid-template-columns: minmax(0, 150px) 1fr 44px;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.hack-row b { text-align: right; font-weight: 400; }

.hack-row .bar {
    height: 8px;
    border: 1px solid rgba(92, 255, 135, .4);
    border-radius: 4px;
    overflow: hidden;
}

.hack-row .bar i {
    display: block;
    height: 100%;
    width: 0;
    background: #5cff87;
    box-shadow: 0 0 10px #5cff87;
}

.fx-hack.denied .bar i { background: var(--red); box-shadow: 0 0 10px var(--red); }
.fx-hack.denied .hack-row { color: #ff9aa3; }

.hack-stamp {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    background: rgba(30, 0, 6, .6);
    color: var(--red);
    font-size: clamp(26px, 6vw, 50px);
    font-weight: 900;
    letter-spacing: .1em;
    text-shadow: 0 0 28px rgba(255, 60, 80, .85);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

.hack-stamp span { display: block; }

.fx-hack.denied .hack-stamp { opacity: 1; }
.fx-hack.denied .hack-stamp span { animation: stamp .45s cubic-bezier(.2, 1.2, .3, 1) both; }

/* ---------- hello ---------- */

.fx-hello { align-items: flex-end; justify-content: flex-end; }

.hello-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 28px 28px 0;
    padding: 12px 20px;
    border-radius: 20px 20px 4px 20px;
    border: 1px solid var(--line-strong);
    background: rgba(20, 24, 46, .96);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
    font-size: 17px;
    opacity: 0;
    transform: translateY(30px) scale(.8);
    transition: transform .45s cubic-bezier(.2, 1.4, .4, 1), opacity .3s;
}

.fx-hello.open .hello-bubble { opacity: 1; transform: none; }

.hello-bubble .wave {
    display: inline-block;
    font-size: 36px;
    transform-origin: 70% 75%;
    animation: wave 1.1s ease-in-out .3s 3;
}

@keyframes wave {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(18deg); }
    40% { transform: rotate(-12deg); }
    60% { transform: rotate(16deg); }
    80% { transform: rotate(-6deg); }
}

/* ---------- cd: wandering footsteps ---------- */

.fx-steps i {
    position: absolute;
    width: 13px;
    height: 22px;
    color: rgba(190, 205, 255, .6);
    border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
    background: currentColor;
    opacity: 0;
    animation: footstep 2.6s var(--d) ease-out forwards;
}

.fx-steps i::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 0;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 4.5px -2px 0 currentColor, 9px -1px 0 currentColor;
}

.fx-steps i.l { bottom: 56px; }
.fx-steps i.r { bottom: 82px; }

@keyframes footstep {
    0% { opacity: 0; transform: rotate(90deg) scale(.5); }
    8% { opacity: 1; transform: rotate(90deg) scale(1); }
    65% { opacity: .55; }
    100% { opacity: 0; transform: rotate(90deg) scale(1); }
}

/* ---------- matrix ---------- */

.fx-matrix.ambient { background: rgba(0, 12, 5, .55); }

.fx-matrix canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.matrix-msg {
    position: relative;
    max-width: 90vw;
    padding: 16px 26px;
    border-radius: 10px;
    background: rgba(0, 12, 5, .7);
    border: 1px solid rgba(60, 255, 120, .25);
    color: #a4ffbd;
    font-size: clamp(18px, 4vw, 36px);
    text-shadow: 0 0 16px #2dff6a;
}

.matrix-msg:has(span:empty) { opacity: 0; }

.matrix-msg i {
    display: inline-block;
    width: .55em;
    height: 1em;
    margin-left: 4px;
    vertical-align: -.12em;
    background: #a4ffbd;
    animation: blink 1s steps(1) infinite;
}

/* ---------- 42 / deep thought ---------- */

.fx-deep {
    background: radial-gradient(circle at 50% 45%, rgba(28, 20, 66, .96), rgba(2, 2, 9, .98));
    overflow: hidden;
}

.deep-ui {
    position: relative;
    display: grid;
    width: min(620px, 90vw);
    text-align: center;
}

.deep-phase {
    grid-area: 1 / 1;
    transition: opacity .6s, transform .7s cubic-bezier(.2, 1.1, .3, 1);
}

.deep-phase.answer { opacity: 0; transform: scale(.4); }
.fx-deep.revealed .answer { opacity: 1; transform: none; }
.fx-deep.revealed .think { opacity: 0; transform: scale(1.15); }

.deep-name { color: var(--accent-2); font-size: 14px; letter-spacing: .5em; margin-bottom: 18px; }
.deep-q { color: #cfd5ee; font-size: 17px; line-height: 1.6; }

.deep-bar {
    height: 6px;
    margin: 24px 0 12px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .1);
    overflow: hidden;
}

.deep-bar i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    animation: fill-bar 4.2s linear forwards;
}

@keyframes fill-bar { to { width: 100%; } }

.deep-years { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.deep-years b { color: var(--text); font-weight: 400; }

.deep-number {
    font-size: clamp(120px, 34vmin, 320px);
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(180deg, #fff, #b79cff 60%, #8ab4ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 40px rgba(150, 130, 255, .7));
}

.deep-sub { margin-top: 6px; color: #cfd5ee; font-size: 18px; letter-spacing: .04em; }

.deep-rays {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 160vmax;
    height: 160vmax;
    margin: -80vmax 0 0 -80vmax;
    background: repeating-conic-gradient(from 0deg, rgba(160, 140, 255, 0) 0 7deg, rgba(160, 140, 255, .13) 7deg 9deg);
    -webkit-mask-image: radial-gradient(circle, #000 0, transparent 38%);
    mask-image: radial-gradient(circle, #000 0, transparent 38%);
    opacity: 0;
    transition: opacity 1s;
    animation: spin 50s linear infinite;
    pointer-events: none;
}

.fx-deep.revealed .deep-rays { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .steam i,
    .hello-bubble .wave,
    .fx-fortune.open .cookie { animation: none; }
}
