:root{
    --bg-0:#0b1220;
    --bg-1:#0e1730;
    --card: rgba(255,255,255,.07);
    --card-2: rgba(255,255,255,.05);
    --border: rgba(255,255,255,.12);
    --text: rgba(255,255,255,.92);
    --muted: rgba(255,255,255,.70);
    --muted2: rgba(255,255,255,.60);
    --shadow: 0 18px 60px rgba(0,0,0,.40);
    --shadow2: 0 10px 28px rgba(0,0,0,.28);
    --radius: 18px;
}

body{
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background:
        radial-gradient(1000px 700px at 18% 8%, rgba(59,130,246,.28), transparent 60%),
        radial-gradient(900px 620px at 82% 18%, rgba(244,63,94,.20), transparent 60%),
        radial-gradient(820px 520px at 50% 92%, rgba(16,185,129,.18), transparent 60%),
        linear-gradient(180deg, var(--bg-0), var(--bg-1));
    color: var(--text);
    min-height: 100vh;
}

.app-shell{
    width: 95%;
    margin: 0 auto;
}

.topbar{
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 12px 0;
    background: linear-gradient(180deg, rgba(11,18,32,.92), rgba(11,18,32,.55));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand{
    display:flex;
    gap:12px;
    align-items:center;
}

.brand-mark{
    width:44px;
    height:44px;
    border-radius: 16px;
    display:block;
    object-fit: cover;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    box-shadow: var(--shadow2);
}

.brand-title{
    margin:0;
    font-size: 18px;
    letter-spacing: .2px;
    line-height: 1.15;
}

.brand-sub{
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.techtahi-animated{
    font-weight: 800;
    text-shadow: 0 10px 26px rgba(0,0,0,.35);
    animation: colorChange 5s infinite alternate;
}

.subtitle{
    color: rgba(190,242,100,.95);
    font-weight: 600;
}

@keyframes colorChange {
    0%   { color: #ff7a18; }
    33%  { color: #ff4d4d; }
    66%  { color: #34d399; }
    100% { color: #ffd400; }
}

.glass{
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: linear-gradient(180deg, var(--card), var(--card-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    transition: border-color .18s ease, box-shadow .18s ease, filter .18s ease;
}

.glass::before{
    content: "";
    position: absolute;
    inset: -45%;
    background: linear-gradient(
        120deg,
        transparent 35%,
        rgba(255,255,255,.08) 45%,
        rgba(253,224,71,.18) 50%,
        rgba(147,197,253,.12) 55%,
        transparent 65%
    );
    opacity: 0;
    transform: translateX(-38%) rotate(8deg);
    transition: opacity .18s ease;
    pointer-events: none;
    z-index: 0;
}

.glass:hover{
    border-color: rgba(255,255,255,.22);
    box-shadow:
        var(--shadow),
        0 0 0 1px rgba(253,224,71,.18),
        0 0 28px rgba(147,197,253,.12);
    filter: brightness(1.03);
}

.glass:hover::before{
    opacity: 1;
    animation: glassShineSweep 1.35s ease;
}

.glass > *{
    position: relative;
    z-index: 1;
}

.glass textarea,
.glass input,
.glass select{
    cursor: text;
}

.glass button,
.glass a,
.glass [role="button"]{
    cursor: pointer;
}

@keyframes glassShineSweep{
    0%{
        transform: translateX(-45%) rotate(8deg);
    }
    100%{
        transform: translateX(45%) rotate(8deg);
    }
}

.section-title{
    font-size: 13px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 10px;
}

.helper{
    color: var(--muted2);
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 12px;
}

textarea{
    resize: none;
}

#script-prompt,
#outputText{
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.12) !important;
    background: rgba(255,255,255,.06) !important;
    color: var(--text) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

#script-prompt{
    height: 120px;
}

#outputText{
    min-height: 260px;
}

.form-control:focus{
    outline: none;
    box-shadow: 0 0 0 .25rem rgba(59,130,246,.18) !important;
    border-color: rgba(59,130,246,.55) !important;
}

#instructionsBox{
    height: 260px;
    overflow-y: auto;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.12) !important;
    background: rgba(255,255,255,.06) !important;
    color: var(--text);
}

#instructionsBox ol{
    margin: 0;
    padding-left: 18px;
}

#instructionsBox li{
    margin: 10px 0;
    line-height: 1.6;
    color: var(--muted);
}

#instructionsBox strong{
    color: var(--text);
}

.btn{
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    font-weight: 700;
    letter-spacing: .2px;
    transition: filter .12s ease, box-shadow .12s ease, border-color .12s ease;
    box-shadow: 0 10px 22px rgba(0,0,0,.20);
}

.btn::before,
.overlay-buttons button::before{
    content: "";
    position: absolute;
    inset: -60%;
    background: linear-gradient(
        120deg,
        transparent 35%,
        rgba(255,255,255,.12) 45%,
        rgba(253,224,71,.26) 50%,
        rgba(147,197,253,.18) 55%,
        transparent 65%
    );
    opacity: 0;
    transform: translateX(-42%) rotate(8deg);
    pointer-events: none;
}

.btn:hover{
    filter: brightness(1.03);
}

.btn:hover::before,
.overlay-buttons button:hover::before{
    opacity: 1;
    animation: glassShineSweep 1.1s ease;
}

.btn:active{
    filter: brightness(.98);
}

.btn-soft{
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    color: var(--text);
}

.btn-soft:hover{
    background: rgba(255,255,255,.11);
}

.top-actions,
.action-row,
.prompt-actions > .d-flex:first-child,
.llm-buttons{
    flex-wrap: nowrap !important;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.action-row{
    width: 100%;
}

.output-history-actions{
    flex: 0 0 auto;
    margin-left: auto;
}

.top-actions::-webkit-scrollbar,
.action-row::-webkit-scrollbar,
.prompt-actions > .d-flex:first-child::-webkit-scrollbar,
.llm-buttons::-webkit-scrollbar{
    display: none;
}

.top-actions .btn,
.action-row .btn,
.prompt-actions .btn,
.llm-buttons .btn{
    flex: 0 0 auto;
}

.top-actions .btn-sm,
.prompt-actions .btn-sm,
.llm-buttons .btn-sm{
    padding: 0.34rem 0.58rem;
    font-size: 0.82rem;
    line-height: 1.12;
    border-radius: 10px;
}

.prompt-actions .btn-main-query{
    padding: 0.44rem 0.78rem;
    font-size: 0.92rem;
}

.action-row .btn{
    padding: 0.36rem 0.62rem;
    font-size: 0.86rem;
    line-height: 1.2;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(0,0,0,.16);
}

.prompt-actions{
    align-items: flex-start !important;
}

.llm-status-wrap{
    flex: 0 0 auto;
}

.llm-status.guided-shine-active{
    display: inline-block;
    padding: 0.24rem 0.42rem;
    border-radius: 10px;
    color: rgba(254,243,199,.98);
    text-shadow: 0 0 12px rgba(253,224,71,.45);
}

.guided-shine{
    position: relative;
}

.guided-shine-active{
    position: relative;
    filter: brightness(1.05);
    box-shadow:
        0 12px 24px rgba(0,0,0,.24),
        0 0 0 1px rgba(253,224,71,.38),
        0 0 18px rgba(253,224,71,.24) !important;
    animation: guidedPulse 1.25s ease-in-out infinite;
    z-index: 1;
}

.guided-shine-active::after{
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    border: 1px solid rgba(255,244,180,.48);
    box-shadow: 0 0 10px rgba(253,224,71,.22);
    opacity: .85;
    pointer-events: none;
}

@keyframes guidedPulse{
    0%, 100%{
        filter: brightness(1.02);
        box-shadow:
            0 10px 20px rgba(0,0,0,.22),
            0 0 0 1px rgba(253,224,71,.24),
            0 0 10px rgba(253,224,71,.14) !important;
    }
    50%{
        filter: brightness(1.08);
        box-shadow:
            0 13px 26px rgba(0,0,0,.26),
            0 0 0 1px rgba(253,224,71,.42),
            0 0 18px rgba(253,224,71,.28) !important;
    }
}

.textarea-container{
    position: relative;
    width: 100%;
}

#outputText.drag-over{
    border-color: rgba(34,197,94,.75) !important;
    box-shadow: 0 0 0 .25rem rgba(34,197,94,.18) !important;
    background: rgba(240,253,244,.95);
}

.overlay-buttons{
    position: absolute;
    top: -50px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 3;
}

.overlay-buttons button{
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.10);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    transition: background .15s ease, opacity .12s ease, filter .12s ease, box-shadow .12s ease;
    opacity: .95;
    box-shadow: 0 10px 18px rgba(0,0,0,.22);
}

.overlay-buttons button:hover{
    background: rgba(255,255,255,.14);
    filter: brightness(1.03);
}

.overlay-buttons button:disabled{
    opacity: .45;
    cursor: not-allowed;
}

.clear-btn{
    background: rgba(244,63,94,.20) !important;
    border-color: rgba(244,63,94,.30) !important;
}

.clear-btn:hover{
    background: rgba(244,63,94,.26) !important;
}

.row.grid-gap{
    flex-direction: row !important;
}

.card-pad{
    padding: 16px;
}

.card-pad-lg{
    padding: 18px;
}

.page-footer{
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 0 10px;
}

.footer-bar{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 7px 12px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.045));
    color: var(--muted2);
    font-size: 12px;
    line-height: 1.2;
    box-shadow: 0 10px 24px rgba(0,0,0,.20), inset 0 1px 0 rgba(255,255,255,.07);
    backdrop-filter: blur(10px);
}

.footer-name{
    color: rgba(255,255,255,.78);
    font-weight: 700;
    padding: 0 8px 0 4px;
    border-right: 1px solid rgba(255,255,255,.14);
}

.footer-link{
    color: rgba(147,197,253,.95);
    text-decoration: none;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 999px;
    transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}

.footer-link:hover{
    background: rgba(147,197,253,.12);
    color: rgba(219,234,254,.98);
    box-shadow: inset 0 0 0 1px rgba(147,197,253,.16);
}

.shared-repository-link{
    color: #0b1220;
    background: linear-gradient(180deg, #fde047, #f59e0b);
    border: 1px solid rgba(255,255,255,.42);
    box-shadow: 0 8px 18px rgba(245,158,11,.26), inset 0 1px 0 rgba(255,255,255,.46);
}

.shared-repository-link:hover{
    color: #0b1220;
    background: linear-gradient(180deg, #fef08a, #fbbf24);
    box-shadow: 0 10px 22px rgba(245,158,11,.34), inset 0 0 0 1px rgba(255,255,255,.35);
}

@media (max-width: 768px){
    #techtahi-info{
        display:none;
    }

    .topbar{
        position: static;
    }
}
