mithulaartigala's picture
Keep Resampler overlays fixed while streaming
ad64732 verified
Raw History Blame Contribute Delete
14.1 kB
.resampler {
box-sizing: border-box;
height: 100dvh;
overflow-y: auto;
overscroll-behavior-y: contain;
--conversation-width: min(calc(100% - 40px), 680px);
--composer-bottom: max(20px, env(safe-area-inset-bottom, 0px));
--background: #f5f5f5;
--paper: #ffffff;
--text: #161616;
--muted: #555555;
--rule: #d6d6d6;
--focus: #202020;
--button: #111111;
color: var(--text);
background: var(--background);
font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
font-size: 14px;
text-align: left;
padding-bottom: calc(var(--composer-height, 270px) + 20px + env(safe-area-inset-bottom, 0px));
}
.resampler *, .resampler *::before, .resampler *::after { box-sizing: border-box; }
.resampler [hidden] { display: none !important; }
.resampler :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.resampler button, .resampler textarea { font: inherit; }
.resampler button { cursor: pointer; }
.resampler button:disabled { cursor: default; }
.resampler .model-reference {
height: 79px;
}
.resampler .model-reference a {
position: fixed;
z-index: 12;
top: max(16px, env(safe-area-inset-top, 0px));
right: max(16px, env(safe-area-inset-right, 0px));
padding: 4px 8px;
border-radius: 8px;
background: var(--background);
color: var(--muted);
font-size: 13px;
font-weight: 530;
white-space: nowrap;
text-decoration: underline;
text-decoration-color: #a6a6a6;
text-underline-offset: 3px;
}
.resampler .model-reference a span { display: inline-block; margin-left: 2px; }
.resampler .model-reference a:hover { color: var(--focus); text-decoration-color: currentColor; }
.resampler-main {
width: var(--conversation-width);
margin: 12px auto 0;
}
.resampler-main:has(.sent-prompt:not([hidden])) {
padding-bottom: 50dvh;
}
.resampler .pane { min-width: 0; margin: 0; }
.resampler::after {
content: "";
position: fixed;
z-index: 9;
inset: auto 0 0;
height: calc(var(--composer-bottom) + var(--composer-height, 0px) + 1px);
background: var(--background);
pointer-events: none;
}
.resampler .editor {
--composer-inset: 24px;
position: fixed;
z-index: 10;
left: 50%;
bottom: var(--composer-bottom);
transform: translateX(-50%);
width: var(--conversation-width);
max-height: calc(100dvh - 40px);
overflow: auto;
padding: 0;
border: 1px solid var(--rule);
border-radius: 42px;
corner-shape: squircle;
background: var(--paper);
box-shadow: 0 8px 28px rgb(0 0 0 / 12%);
}
.resampler .result-actions { display: flex; gap: 4px; margin: 6px 0 0 -6px; }
.resampler .icon-action {
display: grid;
place-items: center;
width: 32px;
height: 32px;
border: 0;
border-radius: 7px;
background: transparent;
color: var(--muted);
}
.resampler .icon-action:hover:enabled { background: #e8e8e8; color: var(--text); }
.resampler .icon-action:disabled { opacity: .5; }
.resampler .icon-action svg {
width: 16px;
height: 16px;
fill: none;
stroke: currentColor;
stroke-width: 1.7;
stroke-linecap: round;
stroke-linejoin: round;
}
.resampler :is(.editor, textarea, #reasoning-output) {
scrollbar-width: thin;
scrollbar-color: #a8a8a8 transparent;
}
@supports selector(::-webkit-scrollbar) {
.resampler :is(.editor, textarea, #reasoning-output) {
scrollbar-width: auto;
scrollbar-color: auto;
}
.resampler :is(.editor, textarea, #reasoning-output)::-webkit-scrollbar {
width: 10px;
height: 10px;
}
.resampler :is(.editor, textarea, #reasoning-output)::-webkit-scrollbar-track {
background: transparent;
}
.resampler :is(.editor, textarea, #reasoning-output)::-webkit-scrollbar-thumb {
cursor: grab;
border: 2px solid transparent;
border-radius: 999px;
background: rgb(0 0 0 / 34%) padding-box;
}
.resampler :is(.editor, textarea, #reasoning-output)::-webkit-scrollbar-thumb:hover {
background-color: rgb(0 0 0 / 50%);
}
.resampler :is(.editor, textarea, #reasoning-output)::-webkit-scrollbar-thumb:active {
cursor: grabbing;
}
}
.resampler textarea {
display: block;
width: 100%;
--prompt-padding: 14px;
min-height: calc(1lh + 2 * var(--prompt-padding));
max-height: calc(16lh + 2 * var(--prompt-padding));
margin: 0;
padding: var(--prompt-padding) var(--composer-inset);
overflow-y: auto;
resize: none;
background: var(--paper);
color: var(--text);
border: 0;
border-radius: 0;
font-size: 16px;
line-height: 1.55;
}
.resampler textarea:focus { outline: none; box-shadow: none; }
.resampler textarea::placeholder { color: #757575; font-size: 14px; font-weight: 400; opacity: 1; }
.resampler .editor-controls {
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
flex-wrap: wrap;
padding: 1px var(--composer-inset) 2px;
padding-inline-end: calc(var(--composer-inset) - 8px);
background: #f5f5f5;
}
.resampler .reasoning-toggle { position: relative; translate: -8px 0; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-weight: 400; cursor: pointer; }
.resampler .reasoning-toggle input { position: absolute; inset: 0 auto 0 0; opacity: 0; width: 34px; height: auto; margin: 0; }
.resampler .switch-track { width: 34px; height: 20px; padding: 3px; border-radius: 10px; background: #757575; pointer-events: none; transition: background-color 180ms ease; }
.resampler .switch-track::after { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 260ms cubic-bezier(.22, .8, .31, 1.35), scale 140ms ease; }
.resampler .reasoning-toggle:active .switch-track::after { scale: 1.12 .9; }
.resampler input:checked + .switch-track { background: var(--focus); }
.resampler input:checked + .switch-track::after { transform: translateX(14px); }
.resampler input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 3px; }
.resampler .text-button {
min-height: 30px;
padding: 2px 0;
border: 0;
border-radius: 0;
background: none;
color: var(--muted);
font-size: 13px;
font-weight: 550;
white-space: nowrap;
}
.resampler #example { font-weight: 400; }
.resampler .text-button:hover { color: var(--focus); text-decoration: underline; text-underline-offset: 3px; }
.resampler .action {
min-height: 40px;
padding: 8px 17px;
border: 1px solid transparent;
border-radius: 5px;
background: var(--button);
color: #fff;
font-weight: 610;
}
.resampler #generate,
.resampler #stop {
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 88px;
translate: 6px 0;
min-height: 30px;
padding: 4px 12px;
border-radius: 999px;
corner-shape: round;
font-size: 13px;
}
.resampler .action:hover:enabled { background: #333333; }
.resampler .action:disabled { background: #e5e5e5; color: #606060; }
.resampler .secondary { border-color: transparent; background: #dedede; color: var(--text); }
.resampler .secondary:hover:enabled { background: #d3d3d3; }
.resampler .status, .resampler .error { margin: 0 0 10px; color: var(--muted); line-height: 1.55; }
.resampler .status:empty, .resampler .answer-output:empty { display: none; }
@media (prefers-reduced-motion: no-preference) {
@supports (background-clip: text) {
.resampler #thinking-label.shimmer {
/* Studio's tw-shimmer uses a tilted highlight with a sine-shaped falloff. */
--shimmer-peak: color-mix(in oklch, currentColor 20%, transparent);
background: linear-gradient(
105deg in oklch,
currentColor 27%,
color-mix(in oklch, currentColor 85%, var(--shimmer-peak)) 33%,
color-mix(in oklch, currentColor 50%, var(--shimmer-peak)) 38.5%,
color-mix(in oklch, currentColor 15%, var(--shimmer-peak)) 44%,
var(--shimmer-peak) 50%,
color-mix(in oklch, currentColor 15%, var(--shimmer-peak)) 56%,
color-mix(in oklch, currentColor 50%, var(--shimmer-peak)) 61.5%,
color-mix(in oklch, currentColor 85%, var(--shimmer-peak)) 67%,
currentColor 73%
) 100% 0 / 420% 100% no-repeat;
background-clip: text;
-webkit-text-fill-color: transparent;
animation: thinking-shimmer 2.5s linear infinite;
}
@keyframes thinking-shimmer {
60%, 100% { background-position: 0 0; }
}
}
}
.resampler .error { color: #222222; }
.resampler .answer-output, .resampler #reasoning-output { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.65; }
.resampler .answer-output { font-size: 16px; }
.resampler #thought { margin: 0 0 10px; }
.resampler #thought summary {
display: flex;
align-items: center;
gap: 7px;
width: fit-content;
min-height: 32px;
padding: 4px 0;
color: #6b6b6b;
font-weight: 400;
cursor: pointer;
}
.resampler #thought summary::-webkit-details-marker { display: none; }
.resampler .thought-icon {
flex: 0 0 16px;
width: 16px;
height: 16px;
fill: none;
stroke: currentColor;
stroke-width: 1.8;
stroke-linecap: round;
stroke-linejoin: round;
}
.resampler #thought summary:has(.shimmer) .thought-icon { visibility: hidden; }
.resampler #reasoning-output {
max-height: min(300px, 40dvh);
overflow: auto;
margin-top: 6px;
padding: 12px 16px;
border-radius: 22px;
corner-shape: squircle;
background: #e8e8e8;
color: var(--muted);
}
@media (max-width: 750px) {
.resampler {
--conversation-width: calc(100% - 24px);
--composer-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}
.resampler .model-reference { height: 41px; }
.resampler .model-reference a {
top: max(8px, env(safe-area-inset-top, 0px));
right: max(10px, env(safe-area-inset-right, 0px));
}
.resampler .editor {
--composer-inset: 18px;
border-radius: 32px;
}
}
@media (prefers-reduced-motion: reduce) {
.resampler .switch-track, .resampler .switch-track::after { transition: none; }
.resampler .reasoning-toggle:active .switch-track::after { scale: none; }
}
.resampler .prompt-history-tab {
--tab-join: 5px;
--history-collapsed-size: 39px;
--history-preview-end-padding: 8px;
--history-expanded-size: min(calc(var(--history-collapsed-size) + 6px + var(--history-text-size, 0px) + var(--history-preview-end-padding)), 88vw);
inline-size: var(--history-collapsed-size);
transition: inline-size 420ms cubic-bezier(.30, .60, .42, 1);
position: fixed;
z-index: 11;
inset-inline-start: 0;
top: 50%;
translate: 0 -50%;
border: 1px solid var(--rule);
border-inline-start: 0;
border-radius: 0 12px 12px 0;
background: var(--paper);
}
.resampler .prompt-history-tab:has(.prompt-history[hidden]) { display: none; }
.resampler .prompt-history-tab:is(:focus-visible, [data-expanded]) {
inline-size: var(--history-expanded-size);
transition-duration: 340ms;
}
.resampler .prompt-history-tab[data-nearby] {
inline-size: var(--history-expanded-size);
transition-duration: 340ms;
}
.resampler .prompt-history-tab::before,
.resampler .prompt-history-tab::after {
content: "";
position: absolute;
inset-inline-start: 0;
width: var(--tab-join);
height: calc(var(--tab-join) + 1px);
background:
radial-gradient(
circle at right top,
transparent calc(var(--tab-join) - 1px),
var(--rule) calc(var(--tab-join) - 1px),
var(--rule) var(--tab-join),
var(--paper) var(--tab-join)
) top / 100% var(--tab-join) no-repeat,
linear-gradient(var(--paper), var(--paper)) bottom / 100% 1px no-repeat;
pointer-events: none;
}
.resampler .prompt-history-tab::before { bottom: 100%; }
.resampler .prompt-history-tab::after {
top: 100%;
transform: scaleY(-1);
}
.resampler .prompt-history {
max-height: min(180px, 40dvh);
overflow-y: auto;
overflow-x: hidden;
border-radius: inherit;
scrollbar-width: none;
margin: 0;
padding: 5px 7px;
list-style: none;
font-size: 12px;
font-variant-numeric: tabular-nums;
}
.resampler .prompt-history li { overflow: hidden; }
.resampler .prompt-history-button {
border: 0;
border-radius: 8px;
padding: 0;
background: transparent;
color: inherit;
text-align: start;
width: 100%;
display: grid;
grid-template-columns: 24px minmax(0, 1fr);
align-items: center;
gap: 6px;
min-height: 25px;
}
.resampler .prompt-history-number {
position: relative;
display: grid;
place-items: center;
min-height: 25px;
}
.resampler .prompt-history-preview {
position: relative;
inline-size: max-content;
max-inline-size: calc(88vw - var(--history-collapsed-size) - 6px - var(--history-preview-end-padding));
overflow: hidden;
white-space: nowrap;
}
.resampler .prompt-history-preview[data-truncated]::after {
content: "";
position: absolute;
inset: 0 0 0 auto;
inline-size: 37px;
background: linear-gradient(to right, transparent, var(--paper));
pointer-events: none;
}
.resampler .prompt-history-button:hover .prompt-history-preview[data-truncated]::after {
opacity: 0;
}
.resampler .prompt-history [data-pending] .prompt-history-number::after {
content: "";
position: absolute;
width: 22px;
height: 22px;
border: 1px solid var(--rule);
border-top-color: var(--text);
border-radius: 50%;
animation: resampler-prompt-spin 850ms linear infinite;
}
@keyframes resampler-prompt-spin { to { transform: rotate(360deg); } }
@media (max-width: 750px) {
.resampler .prompt-history-tab { --history-collapsed-size: 31px; }
.resampler .prompt-history { padding-inline: 3px; }
}
@media (prefers-reduced-motion: reduce) {
.resampler .prompt-history-tab { transition: none; }
.resampler .prompt-history [data-pending] .prompt-history-number::after { animation: none; }
}
.resampler .prompt-history-button:hover,
.resampler .prompt-history-button:focus-visible {
background: #ededed;
outline-offset: -2px;
}
.resampler .sent-prompt {
width: fit-content;
max-width: min(80%, 560px);
margin: 8px 0 16px auto;
padding: 10px 14px;
border-radius: 22px;
corner-shape: squircle;
background: #e8e8e8;
color: var(--text);
font-size: 15px;
line-height: 1.55;
white-space: pre-wrap;
overflow-wrap: anywhere;
}