/* Playground */
.pg{display:flex;gap:16px;height:calc(100dvh - var(--top-h) - 48px);min-height:560px;margin-bottom:-16px}
.pg-set{flex:0 0 300px;width:300px;display:flex;flex-direction:column;gap:18px;padding:20px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.pg-set-h{display:none}
.pg-f{display:flex;flex-direction:column;gap:7px;min-width:0}
.pg-l{font-size:13px;font-weight:500;color:var(--text);line-height:18px}
.pg-note{font-size:12px;color:var(--text-3);line-height:16px}
.pg-note:empty{display:none}

/* Pickers */
.pg-pick{position:relative;min-width:0}
.pg-sel{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;background:var(--surface);border:1px solid var(--line-control);border-radius:8px;text-align:left;color:var(--text);transition:border-color var(--dur-1) var(--ease-std),background-color var(--dur-1) var(--ease-std),box-shadow var(--dur-1) var(--ease-std)}
.pg-sel:hover{background:var(--surface-hover)}
.pg-sel[aria-expanded=true]{border-color:var(--accent);box-shadow:var(--ring)}
.pg-sel:disabled{cursor:default}
.pg-sel > .i{width:15px;height:15px;color:var(--text-3);flex:0 0 15px}
.pg-sel > .chev{width:14px;height:14px;flex-basis:14px;margin-left:auto;color:var(--text-3);transition:transform var(--dur-2) var(--ease-std)}
.pg-sel[aria-expanded=true] > .chev{transform:rotate(180deg);color:var(--accent)}
.pg-sel .plogo.sm img{width:16px;height:16px}
.pg-st{display:flex;flex-direction:column;gap:2px;flex:1 1 auto;min-width:0}
.pg-st b{font-weight:400;font-size:12px;line-height:16px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pg-st span{font-size:11px;line-height:14px;color:var(--text-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pg-st .sk{margin:2px 0}
.pg-menu{left:0;right:0;min-width:0;max-height:none;padding:0;overflow:hidden}
.pg-menu .pg-list{max-height:300px;overflow-y:auto;padding:5px;display:flex;flex-direction:column;gap:1px}
.pg-menu .pg-list button{align-items:center;gap:10px;padding:8px 10px;white-space:normal}
.pg-menu .pg-list button .i{width:14px;height:14px;flex:0 0 14px}
.pg-menu .pg-list button.on::after{flex:0 0 14px}
.pg-srch{display:flex;align-items:center;gap:8px;padding:9px 12px;border-bottom:1px solid var(--line)}
.pg-srch .i{width:14px;height:14px;color:var(--text-3)}
.pg-srch input{flex:1;min-width:0;border:0;outline:0;background:transparent;font:inherit;font-size:13px;color:var(--text)}
.pg-srch input::placeholder{color:var(--text-3)}
.pg-srch input:focus-visible{outline:none}
.pg-srch:focus-within .i{color:var(--accent)}
.pg-none{padding:12px 10px;font-size:13px;color:var(--text-3)}

/* Sliders */
.pg-sl{display:flex;flex-direction:column;gap:9px}
.pg-sl-h{display:flex;justify-content:space-between;align-items:center}
.pg-sl-h label{font-size:13px;font-weight:500;color:var(--text);line-height:18px}
/* The value is typed in place: it reads as plain text until hovered or focused. */
.pg-sl-v{width:8ch;field-sizing:content;min-width:5ch;max-width:9ch;box-sizing:content-box;font-family:var(--font-code);font-variant-numeric:tabular-nums;font-size:11px;color:var(--text);text-align:right;padding:1px 4px;margin:-2px -5px;border:1px solid transparent;border-radius:4px;background:transparent;outline:none;box-shadow:none}
@supports (field-sizing:content){.pg-sl-v{width:auto}}
.pg-sl-v:hover{background:var(--surface-hover)}
.pg-sl-v:focus,.pg-sl-v:focus-visible{background:var(--surface);border-color:var(--accent);color:var(--text);box-shadow:none;outline:none}
.pg-sl-v::placeholder{color:var(--text-3);opacity:1}
.pg-sl input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:16px;margin:0;background:transparent;cursor:pointer;--p:50%}
.pg-sl input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:linear-gradient(90deg,var(--accent) var(--p),var(--tint-3) var(--p))}
.pg-sl input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:linear-gradient(90deg,var(--accent) var(--p),var(--tint-3) var(--p))}
.pg-sl input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;margin-top:-5px;border-radius:50%;background:var(--accent);border:2px solid var(--accent);box-shadow:0 0 0 2px var(--surface);transition:transform var(--dur-1) var(--ease-std)}
.pg-sl input[type=range]::-moz-range-thumb{width:10px;height:10px;border-radius:50%;background:var(--accent);border:2px solid var(--accent);box-shadow:0 0 0 2px var(--surface)}
.pg-sl input[type=range]:active::-webkit-slider-thumb{transform:scale(1.15)}
.pg-sl input[type=range]:focus-visible{outline:none}
.pg-sl input[type=range]:focus-visible::-webkit-slider-thumb{outline:2px solid var(--accent);outline-offset:2px}

/* Reasoning effort segment: off for a model without reasoning control */
.pg-set .seg.dis .seg-ind{opacity:.45!important}

.pg-sys{width:100%;min-height:110px;resize:vertical;padding:12px;background:var(--surface);border:1px solid var(--line-control);border-radius:8px;font:inherit;font-size:13px;line-height:20px;color:var(--text-2);outline:0;transition:border-color var(--dur-1) var(--ease-std),box-shadow var(--dur-1) var(--ease-std)}
.pg-sys:hover{border-color:var(--text-3)}
.pg-sys:focus{border-color:var(--accent);box-shadow:var(--ring);color:var(--text)}
.pg-sys::placeholder{color:var(--text-3)}
.pg-row{display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:13px;color:var(--text-2);cursor:pointer}
.pg-in{height:34px}
.pg-in input{font-size:13px}

.pg-adv{display:flex;flex-direction:column;gap:0}
.pg-adv-h{display:flex;justify-content:space-between;align-items:center;gap:12px;text-align:left;width:100%;border-radius:6px}
.pg-adv-h > span{display:flex;flex-direction:column;gap:3px}
.pg-adv-h b{font-size:13px;font-weight:400;color:var(--text-2)}
.pg-adv-h span span{font-size:12px;color:var(--text-3)}
.pg-adv-h .i{color:var(--text-3);transition:transform var(--dur-2) var(--ease-std)}
.pg-adv.open .pg-adv-h .i{transform:rotate(180deg)}
.pg-adv-b{display:none;flex-direction:column;gap:16px;padding-top:16px}
.pg-adv.open .pg-adv-b{display:flex}

.pg-sess{display:flex;flex-direction:column;gap:8px;padding-top:14px;border-top:1px solid var(--line)}
.pg-kv{display:flex;justify-content:space-between;align-items:baseline;gap:12px;font-size:13px;color:var(--text-2)}
.pg-kv b{font-weight:400;font-size:12px;color:var(--text);text-align:right}

/* Chat */
.pg-chat{flex:1 1 auto;display:flex;flex-direction:column;min-width:0;overflow:hidden}
.pg-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid var(--line);min-height:61px}
.pg-head-l{display:flex;align-items:center;gap:9px;min-width:0;font-size:13px}
.pg-head-l .plogo.sm img{width:16px;height:16px}
.pg-head-r{display:flex;gap:8px;flex:0 0 auto}
.pg-sheet-btn{display:none}
.pg-mbar{display:none}

.pg-thread{flex:1 1 auto;overflow-y:auto;overscroll-behavior:contain;padding:24px 28px;display:flex;flex-direction:column;gap:22px;min-height:0}
.pg-thread.is-empty{justify-content:center}
.pg-thread .err-box{align-self:stretch}
.pg-wait{display:flex;flex-direction:column;gap:10px;padding:0 40px}
.pg-u{display:flex;justify-content:flex-end}
.pg-bub{max-width:min(78%,640px);padding:11px 14px;border-radius:12px;background:var(--tint-2);font-size:14px;line-height:20px;white-space:pre-wrap;overflow-wrap:anywhere}
.pg-a{display:flex;flex-direction:column;gap:12px;min-width:0}
.pg-a-row{display:flex;gap:12px;min-width:0}
.pg-tk{display:flex;flex-direction:column;gap:12px}
.pg-tk:empty{display:none}
.pg-av{width:28px;height:28px;flex:0 0 28px;border-radius:8px;background:var(--surface-2);display:grid;place-items:center}
.pg-av .plogo{width:28px;height:28px;flex-basis:28px;background:none}
.pg-av .plogo img{width:15px;height:15px}
.pg-av .plogo .i{width:14px;height:14px}
.pg-av.err{background:var(--err-soft);color:var(--err)}
.pg-av.err .i{width:15px;height:15px}
.pg-a-b{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:10px;padding-top:4px}

.pg-think{display:inline-flex;align-items:center;gap:7px;align-self:flex-start;margin-left:40px;font-size:11px;color:var(--text-3);border-radius:6px;padding:2px 4px 2px 0}
button.pg-think:hover{color:var(--text)}
.pg-think .i{width:13px;height:13px}
.pg-think-t{margin-left:40px;padding:10px 14px;border-left:2px solid var(--line-strong);font-size:13px;line-height:20px;color:var(--text-3);white-space:pre-wrap;overflow-wrap:anywhere;max-height:280px;overflow-y:auto}

.pg-md{font-size:14px;line-height:22px;color:var(--text);display:flex;flex-direction:column;gap:10px;overflow-wrap:anywhere;min-width:0}
.pg-md p{margin:0}
.pg-md .pg-h{font-weight:600}
.pg-md ul,.pg-md ol{margin:0;padding-left:22px;display:flex;flex-direction:column;gap:4px}
.pg-md ul{list-style:disc}
.pg-md ol{list-style:decimal}
.pg-md strong{font-weight:600}
.pg-md code{font-family:var(--font-code);font-size:12px;padding:1px 5px;border-radius:5px;background:var(--tint-2)}
.pg-code{position:relative;background:var(--code-bg);border:1px solid var(--code-line-strong);border-radius:10px;min-width:0}
.pg-code pre{margin:0;padding:12px 44px 12px 14px;overflow-x:auto;font-family:var(--font-code);font-size:12px;line-height:20px;color:var(--code-text);white-space:pre}
.pg-md .pg-code code{padding:0;background:none;font-size:inherit;border-radius:0}
.pg-code .copy{position:absolute;top:8px;right:8px;background:var(--code-bg);border:1px solid var(--code-line-strong);color:var(--text-3)}
.pg-code .copy:hover{color:var(--code-text)}

.pg-img{align-self:flex-start;width:min(100%,512px);border:1px solid var(--line-control);border-radius:10px;overflow:hidden;background:var(--surface-2)}
.pg-img img{display:block;width:100%;height:auto}
.pg-img-wait{aspect-ratio:3/2;display:grid;place-items:center;color:var(--text-3)}
.pg-img-wait .i{width:28px;height:28px;opacity:.6}

.pg-meta{font-size:11px;line-height:15px;color:var(--text-3)}
.pg-live i{display:inline-block;width:12px;text-align:left}
.pg-live i::after{content:"…";animation:pg-dots 1.2s steps(4,end) infinite;display:inline-block;overflow:hidden;vertical-align:bottom;width:0}
@keyframes pg-dots{to{width:12px}}
.pg-acts{display:flex;align-items:center;gap:4px;margin-top:-4px;flex-wrap:wrap}
.pg-act{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 8px;border-radius:6px;font-size:12px;font-weight:500;color:var(--text-2);transition:background-color var(--dur-1) var(--ease-std),color var(--dur-1) var(--ease-std)}
.pg-act:first-child{margin-left:-8px}
.pg-act:hover{background:var(--surface-hover);color:var(--text)}
.pg-act .i{width:14px;height:14px}
.pg-ls{display:none}

.pg-a.pg-e{flex-direction:row}
.pg-eb{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:12px;padding:16px;border-radius:10px;background:var(--err-soft);border:1px solid color-mix(in srgb,var(--err-fill) 35%,transparent)}
.pg-eh{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.pg-eh b{font-size:14px;font-weight:500}
.pg-eh .mono{font-size:12px;color:var(--err)}
.pg-eb p{font-size:13px;line-height:20px;color:var(--text)}
.pg-eacts{display:flex;gap:10px;flex-wrap:wrap}

/* Composer */
.pg-comp{display:flex;flex-direction:column;gap:8px;padding:14px 20px 16px}
.pg-box{display:flex;align-items:flex-end;gap:10px;padding:12px 12px 12px 16px;background:var(--bg-alt);border:1px solid var(--line-control);border-radius:12px;transition:border-color var(--dur-1) var(--ease-std),box-shadow var(--dur-1) var(--ease-std)}
.pg-box:focus-within{border-color:var(--accent);box-shadow:var(--ring)}
.pg-box.dis{border-color:var(--line)}
.pg-box textarea{flex:1;min-width:0;border:0;outline:0;background:transparent;resize:none;font:inherit;font-size:14px;line-height:20px;color:var(--text);padding:7px 0;max-height:200px;overflow-y:auto}
.pg-box textarea::placeholder{color:var(--text-3)}
.pg-box textarea:disabled{cursor:not-allowed}
.pg-send{width:34px;height:34px;flex:0 0 34px;border-radius:8px;background:var(--accent);color:var(--on-accent);display:grid;place-items:center;transition:background-color var(--dur-1) var(--ease-std)}
.pg-send:hover{background:var(--accent-hover)}
.pg-send .i{width:16px;height:16px}
.pg-send.stop .i{width:13px;height:13px;fill:currentColor}
.pg-send:disabled{background:var(--tint-3);color:var(--text-3);cursor:not-allowed}
.pg-hint{font-size:11px;color:var(--text-3);line-height:15px}

.pg-scrim{display:none}

/* Tablet: settings move into a side sheet (fades in, never moves, like every sheet) */
@media (max-width:1024px){
  .pg-set{display:none}
  .pg-sheet-btn{display:inline-flex}
  .pg.sheet-open .pg-set{display:flex;position:fixed;z-index:85;top:0;right:0;bottom:0;width:min(360px,100%);border-radius:0;border-left:1px solid var(--line-strong);box-shadow:var(--sh-sheet);animation:cx-pop var(--dur-2) var(--ease-out)}
  .pg.sheet-open .pg-set-h{display:flex;justify-content:space-between;align-items:center}
  .pg-set-h b{font-size:16px;font-weight:500}
  .pg.sheet-open + .pg-scrim{display:block;position:fixed;inset:0;z-index:84;background:var(--scrim);animation:cx-pop var(--dur-2) var(--ease-out)}
  .pg-thread{padding:20px}
}

/* Phone: no card chrome, model bar on top, settings as a bottom sheet */
@media (max-width:720px){
  .pg{height:calc(100dvh - 64px - 100px - env(safe-area-inset-bottom));min-height:420px;margin-bottom:0}
  .pg-chat{background:none;box-shadow:none;border-radius:0;overflow:visible;gap:14px}
  .pg-head{display:none}
  .pg-mbar{display:flex;gap:10px;align-items:center}
  .pg-mbar .pg-pick{flex:1}
  .pg-mbar .pg-sel{padding:9px 12px}
  .pg-mbar .pg-st b{font-size:13px}
  .pg-mbar .pg-st span{font-size:12px;color:var(--text-2);font-family:inherit}
  .pg-thread{padding:0;gap:14px;overflow-x:hidden}
  .pg-bub{max-width:270px;padding:10px 12px;background:var(--surface-2);font-size:13px;line-height:20px}
  .pg-a{gap:10px}
  .pg-a-row .pg-av{display:none}
  .pg-a-b{padding-top:0}
  .pg-think,.pg-think-t{margin-left:0}
  .pg-think{font-size:12px;color:var(--text-2)}
  .pg-think .mono{font-family:inherit}
  .pg-md{font-size:13px;line-height:20px}
  .pg-code pre{font-size:11px;line-height:19px;padding:10px 40px 10px 12px}
  .pg-meta{color:var(--text-2)}
  .pg-act{height:32px;border-radius:8px}
  .pg-lg{display:none}
  .pg-ls{display:inline}
  .pg-e .pg-av{display:none}
  .pg-comp{padding:0;border-top:0}
  .pg-box{padding:6px 6px 6px 12px;background:var(--surface);align-items:center}
  .pg-box textarea{font-size:13px;padding:8px 0}
  .pg-send{width:36px;height:36px;flex-basis:36px}
  .pg-hint{display:none}
  .pg.sheet-open .pg-set{top:auto;left:0;right:0;bottom:0;width:auto;max-height:92dvh;border-radius:16px 16px 0 0;border-left:0;border-top:1px solid var(--line-strong);box-shadow:var(--sh-modal);padding-bottom:calc(20px + env(safe-area-inset-bottom))}
}
@media (prefers-reduced-motion:reduce){
  .pg-live i::after{animation:none;width:12px}
}
