.studio-history-toggle {
    position: fixed;
    top: calc(var(--studio-header-offset, 86px) + 0.75rem);
    left: clamp(0.7rem, 2vw, 1.25rem);
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 90;
}

.studio-history-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #f0f2f6;
    box-shadow:
        0 6px 0 #f0f2f6,
        0 -6px 0 #f0f2f6;
}

.studio-history-drawer {
    position: fixed;
    top: var(--studio-header-offset, 86px);
    left: 0;
    width: min(380px, 94vw);
    height: calc(100dvh - var(--studio-header-offset, 86px));
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
    background:
        radial-gradient(circle at 78% -10%, rgba(255, 84, 26, 0.1), transparent 40%),
        radial-gradient(circle at -10% 108%, rgba(255, 110, 52, 0.06), transparent 44%),
        linear-gradient(180deg, rgba(10, 11, 16, 0.9), rgba(6, 7, 11, 0.94));
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        24px 0 48px rgba(2, 3, 8, 0.52),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    backdrop-filter: blur(10px) saturate(118%);
    -webkit-backdrop-filter: blur(10px) saturate(118%);
    transform: translateX(-104%);
    transition: transform 220ms ease;
    z-index: 95;
    display: grid;
    grid-template-rows: auto 1fr;
}

.studio-history-drawer.is-open {
    transform: translateX(0);
}

.studio-history-header {
    padding: 1.05rem 1rem 0.96rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.studio-history-title {
    margin: 0;
    font-family: "Nunito Sans", "SF Pro Display", "Segoe UI", sans-serif;
    font-size: 1.08rem;
    font-weight: 700;
    color: #f4f4f5;
}

.studio-history-close {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(20, 24, 34, 0.48);
    color: #f1f1f3;
    font: 700 0.69rem "Nunito Sans", "SF Pro Display", "Segoe UI", sans-serif;
    padding: 0.47rem 0.86rem;
    cursor: pointer;
}

.studio-history-list {
    margin: 0;
    padding: 0.88rem;
    list-style: none;
    overflow-y: auto;
    display: grid;
    gap: 0.84rem;
    align-content: start;
}

.studio-history-item {
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 22px;
    background:
        linear-gradient(150deg, rgba(14, 17, 26, 0.78), rgba(7, 9, 15, 0.84)),
        radial-gradient(circle at 0% 0%, rgba(255, 109, 56, 0.07), transparent 36%),
        radial-gradient(circle at 100% 100%, rgba(255, 132, 56, 0.06), transparent 44%);
    padding: 0.66rem;
}

.studio-history-card {
    width: 100%;
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 0.64rem;
    align-items: start;
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.studio-history-thumb {
    width: 78px;
    height: 78px;
    border-radius: 16px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: #0b0d13;
}

.studio-history-thumb--empty {
    display: grid;
    place-items: center;
    padding: 0.45rem;
    text-align: center;
    font: 800 0.68rem "Nunito Sans", "SF Pro Display", "Segoe UI", sans-serif;
    color: rgba(244, 244, 245, 0.78);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
        #0b0d13;
}

.studio-history-prompt {
    margin: 0;
    font: 650 0.95rem/1.35 "Nunito Sans", "SF Pro Display", "Segoe UI", sans-serif;
    color: #f4f4f5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.studio-history-time,
.studio-history-empty {
    margin: 0.4rem 0 0;
    font: 0.75rem "Nunito Sans", "SF Pro Display", "Segoe UI", sans-serif;
    color: rgba(214, 218, 224, 0.78);
}

.studio-history-empty {
    margin: 0.25rem 0;
    font-size: 0.82rem;
    color: #a2a8b4;
}

html[data-theme="light"] .studio-history-toggle span {
    background: #1a1d28;
    box-shadow:
        0 6px 0 #1a1d28,
        0 -6px 0 #1a1d28;
}

html[data-theme="light"] .studio-history-drawer {
    background: linear-gradient(180deg, rgba(248, 249, 252, 0.98), rgba(243, 245, 250, 0.98));
    border-right-color: rgba(62, 72, 95, 0.14);
    box-shadow:
        8px 0 22px rgba(28, 34, 52, 0.12),
        1px 0 0 rgba(255, 255, 255, 0.85) inset;
}

html[data-theme="light"] .studio-history-header {
    border-bottom-color: rgba(62, 72, 95, 0.1);
}

html[data-theme="light"] .studio-history-title,
html[data-theme="light"] .studio-history-prompt {
    color: #1a2238;
}

html[data-theme="light"] .studio-history-item {
    border-color: rgba(62, 72, 95, 0.12);
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.92), rgba(246, 247, 251, 0.96));
}

html[data-theme="light"] .studio-history-time,
html[data-theme="light"] .studio-history-empty {
    color: #697387;
}

html[data-theme="light"] .studio-history-close {
    background: rgba(39, 47, 66, 0.05);
    border-color: rgba(62, 72, 95, 0.18);
    color: #2a3348;
}

html[data-theme="light"] .studio-history-thumb--empty {
    color: #697387;
    background: linear-gradient(135deg, rgba(39, 47, 66, 0.08), rgba(39, 47, 66, 0.025));
}
