/* ── GL1TCH WIDGET ── */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
    --gw-green:  #00ff41;
    --gw-cyan:   #00e5ff;
    --gw-dim:    #00aa29;
    --gw-mag:    #ff00ff;
    --gw-bg:     #000;
    --gw-border: #1a3a1a;
}

#g-widget {
    position: fixed;
    bottom: 0;
    right: 68px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    user-select: none;
}

/* ── terminal ── */
#g-terminal {
    width: 360px;
    height: 460px;
    background: var(--gw-bg);
    border: 1px solid var(--gw-green);
    box-shadow: 0 0 0 1px #002200,
                0 0 25px rgba(0,255,65,.12),
                0 0 60px rgba(0,255,65,.04);
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scaleY(0) scaleX(.95);
    opacity: 0;
    transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .22s ease;
    position: relative;
}
#g-terminal.open { transform: scaleY(1) scaleX(1); opacity: 1; }

/* scanlines */
#g-terminal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg, transparent 0, transparent 2px,
        rgba(0,0,0,.18) 2px, rgba(0,0,0,.18) 4px
    );
    pointer-events: none;
    z-index: 50;
}
/* CRT vignette */
#g-terminal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,.65) 100%);
    pointer-events: none;
    z-index: 51;
}

.gw-header {
    background: #050505;
    border-bottom: 1px solid #0e2a0e;
    padding: 7px 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: .67rem;
    color: var(--gw-green);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 52;
}
.gw-close {
    cursor: pointer;
    color: #333;
    transition: color .2s;
    padding: 0 3px;
}
.gw-close:hover { color: var(--gw-mag); text-shadow: 0 0 8px var(--gw-mag); }

.gw-status {
    background: #030303;
    border-bottom: 1px solid #0a1e0a;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Share Tech Mono', monospace;
    font-size: .62rem;
    color: #2a4a2a;
    flex-shrink: 0;
    position: relative;
    z-index: 52;
}
.gw-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--gw-green);
    box-shadow: 0 0 5px var(--gw-green);
    animation: gw-blink 1.1s step-end infinite;
    flex-shrink: 0;
}
@keyframes gw-blink { 50% { opacity: 0; } }

.gw-limit { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.gw-blocks { letter-spacing: 3px; color: var(--gw-dim); }
.gw-blocks .used { color: #181818; }

/* messages */
#g-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    scroll-behavior: smooth;
    position: relative;
    z-index: 52;
}
#g-messages::-webkit-scrollbar { width: 3px; }
#g-messages::-webkit-scrollbar-thumb { background: #0e2a0e; }

.gw-m {
    font-family: 'Share Tech Mono', monospace;
    font-size: .74rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}
.gw-bot { align-self: flex-start; color: var(--gw-green); max-width: 92%; }
.gw-bot .gw-pfx { color: var(--gw-cyan); }
.gw-user { align-self: flex-end; color: #00cc33; max-width: 80%; text-align: right; }
.gw-user::before { content: '// '; color: #2a2a2a; }
.gw-sys { align-self: center; color: #1e3a1e; font-size: .62rem; }

.gw-cur::after {
    content: '█';
    animation: gw-cur-blink .65s step-end infinite;
}
@keyframes gw-cur-blink { 50% { opacity: 0; } }

/* input row */
.gw-input-row {
    border-top: 1px solid #0a1e0a;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #020202;
    flex-shrink: 0;
    position: relative;
    z-index: 52;
}
.gw-prompt { font-family: 'Share Tech Mono', monospace; color: var(--gw-green); font-size: .82rem; flex-shrink: 0; }
#g-input {
    flex: 1;
    background: transparent !important;
    border: none;
    outline: none;
    color: #00ff41 !important;
    -webkit-text-fill-color: #00ff41 !important;
    font-family: 'Share Tech Mono', monospace;
    font-size: .74rem;
    caret-color: #00ff41;
}
#g-input::placeholder { color: #1a3a1a !important; opacity: 1; }
#g-input:disabled, .gw-send:disabled { opacity: .3; cursor: not-allowed; }

.gw-send {
    background: transparent;
    border: 1px solid #152515;
    color: #1e4a1e;
    font-family: 'Share Tech Mono', monospace;
    font-size: .62rem;
    padding: 4px 9px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .18s;
}
.gw-send:not(:disabled):hover {
    border-color: var(--gw-green);
    color: var(--gw-green);
    box-shadow: 0 0 8px rgba(0,255,65,.18);
}

/* sleep overlay */
#g-sleep {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-family: 'Share Tech Mono', monospace;
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity .5s;
}
#g-sleep.on { opacity: 1; pointer-events: all; }
.gw-sl-title { color: var(--gw-mag); font-size: 1rem; letter-spacing: .25em; text-shadow: 0 0 12px var(--gw-mag); }
.gw-sl-body  { color: #3a3a3a; font-size: .7rem; text-align: center; line-height: 1.9; }
.gw-sl-hint  { text-align: center; font-size: .7rem; color: #333; margin-top: 4px; line-height: 2; }
.gw-sl-link  {
    color: var(--gw-cyan);
    text-decoration: none;
    font-family: 'Share Tech Mono', monospace;
    transition: text-shadow .2s;
    display: block;
    margin-top: 4px;
}
.gw-sl-link:hover { text-shadow: 0 0 10px var(--gw-cyan); color: var(--gw-cyan); }
.gw-sl-note { font-size: .58rem; color: #252525; display: block; margin-top: 4px; }

/* ── bubble ── */
#g-bubble {
    position: relative;
    background: #000;
    border: 1px solid var(--gw-green);
    padding: 9px 13px;
    font-family: 'Share Tech Mono', monospace;
    font-size: .75rem;
    color: var(--gw-green);
    max-width: 230px;
    margin-bottom: 8px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .35s, transform .35s;
    box-shadow: 0 0 12px rgba(0,255,65,.12);
    line-height: 1.5;
}
#g-bubble.on { opacity: 1; transform: translateY(0); }
#g-bubble::before {
    content: '';
    position: absolute;
    bottom: -8px; right: 28px;
    border: 8px solid transparent;
    border-top-color: var(--gw-green);
    border-bottom: none;
}
#g-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px; right: 29px;
    border: 7px solid transparent;
    border-top-color: #000;
    border-bottom: none;
}

/* ── character ── */
#g-char {
    width: 82px;
    height: 90px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}
#g-char svg {
    width: 100%; height: 100%;
    overflow: visible;
    filter: drop-shadow(0 0 7px rgba(0,255,65,.45));
}
@keyframes gw-bob {
    0%,100% { transform: translateY(0) rotate(0deg); }
    30%      { transform: translateY(-4px) rotate(-1.2deg); }
    70%      { transform: translateY(-2px) rotate(1deg); }
}
#g-char { animation: gw-bob 3.4s ease-in-out infinite; }

@keyframes gw-eye { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.gw-eye   { animation: gw-eye 2.1s ease-in-out infinite; }
.gw-eye-r { animation-delay: .35s; }

@keyframes gw-fl { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }
.gw-hl { animation: gw-fl .42s ease-in-out infinite alternate; }
.gw-hr { animation: gw-fl .42s ease-in-out .22s infinite alternate; }

@keyframes gw-glitch {
    0%  { transform: translateX(0) skewX(0); }
    15% { transform: translateX(-4px) skewX(-3deg); }
    30% { transform: translateX(4px) skewX(3deg); }
    45% { transform: translateX(-2px); }
    60% { transform: translateX(3px) skewX(-2deg); }
    100%{ transform: translateX(0) skewX(0); }
}
#g-char.glitch { animation: gw-glitch .08s infinite; }

.gw-zzz {
    position: fixed;
    font-family: 'Share Tech Mono', monospace;
    color: var(--gw-cyan);
    pointer-events: none;
    font-size: .7rem;
    animation: gw-floatz 1.4s ease-out forwards;
}
@keyframes gw-floatz {
    0%   { opacity: 1; transform: translate(0,0) scale(1); }
    100% { opacity: 0; transform: translate(16px,-40px) scale(1.6); }
}