.page-physics-whiteboard #pw-compose-host {
    --pc-left: clamp(360px, 34vw, 460px);
    --pc-panel: #1a1a1a;
    --pc-control: #242424;
    --pc-border: #353535;
    --pc-muted: #aeb1ba;
    position: fixed;
    inset: var(--site-nav-height, 60px) 0 0;
    color: #ededed;
    background: var(--pc-panel);
}
.page-physics-whiteboard:not(.pw-access-granted) #pw-compose-host,
#pw-compose-host [hidden] { display: none !important; }
.pc-workspace { display: grid; grid-template-columns: var(--pc-left) minmax(0, 1fr); height: 100%; }
.pc-input, .pc-output { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pc-input { border-right: 1px solid var(--pc-border); }
.pc-chat-bar, .pc-output-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    min-height: 47px; padding: 6px 12px; box-sizing: border-box;
    background: var(--pc-control); border-bottom: 1px solid var(--pc-border);
}
.pc-chat-bar strong, .pc-output-bar strong { font-size: 14px; }
.pc-output-bar strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-chat-bar small {
    font-size: 10px; color: #f2c874; margin-left: 4px; padding: 2px 5px;
    border: 1px solid #625235; border-radius: 4px;
}
#pw-compose-host button, .pc-output-actions summary, #pc-model-trigger {
    box-sizing: border-box; padding: 6px 9px; border: 1px solid #474747;
    background: var(--pc-control); color: #ededed; border-radius: 6px;
    font: inherit; font-size: 12px; cursor: pointer;
}
#pw-compose-host button:hover:not(:disabled), #pc-model-trigger:hover, .pc-output-actions summary:hover { background: #343434; }
#pw-compose-host button:disabled { opacity: .48; cursor: default; }
#pw-compose-host button.pc-primary { background: #7765ef; border-color: #7765ef; color: white; font-weight: 600; }
#pw-compose-host button.pc-primary:hover:not(:disabled) { background: #8876ff; }
#pw-compose-host #pc-new { color: #b7d4ff; border-color: #486383; }
.pc-input textarea, #pw-compose-host select {
    min-width: 0; width: 100%; box-sizing: border-box; padding: 8px;
    border: 1px solid #454545; border-radius: 6px; background: #222; color: #eee; font: inherit; font-size: 13px;
}
.pc-library { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--pc-border); }
.pc-library select { flex: 1; }
.pc-chat { display: flex; flex: 1 1 0; flex-direction: column; gap: 14px; min-height: 0; padding: 16px; overflow: auto; }
#pc-welcome { margin: auto; padding: 12px 0; color: #d2d2d6; text-align: center; font-size: 14px; }
#pc-welcome i { display: block; color: #a5b4fc; font-size: 32px; }
#pc-welcome p { margin: 12px 0 5px; }
#pc-welcome span { color: var(--pc-muted); font-size: 12px; }
.pc-bubble { align-self: flex-start; max-width: 94%; padding: 9px 13px; border-radius: 10px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; background: #272727; }
.pc-bubble.pc-user { align-self: flex-end; background: #274466; }
.pc-bubble.pc-error { color: #ffb6ad; background: #3a2626; }
.pc-composer { display: grid; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--pc-border); background: #202020; }
.pc-model-row, .pc-row { display: flex; gap: 8px; }
.pc-model-row > *, .pc-row > * { flex: 1; min-width: 0; }
.pc-model-row #pc-mode { flex: 0 1 110px; }
#pc-model-picker, .pc-files { position: relative; }
#pc-model-picker[inert] { opacity: .55; }
#pc-model-trigger { height: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pc-model-options, .pc-file-menu {
    position: absolute; z-index: 5; padding: 6px; border: 1px solid #4a4a4a;
    border-radius: 8px; background: #242424; box-shadow: 0 5px 24px #0008;
}
#pc-model-options { bottom: calc(100% + 6px); left: 0; width: min(420px, calc(100vw - 30px)); max-height: min(330px, 38dvh); overflow: auto; }
.pc-model-columns { display: grid; grid-template-columns: minmax(0, 1fr) 65px 32px 76px; gap: 6px; align-items: center; }
#pc-model-options > .pc-model-columns { padding: 6px 8px; font-size: 11px; color: var(--pc-muted); }
#pw-compose-host #pc-model-options button { width: 100%; text-align: left; margin-top: 3px; border-color: transparent; }
#pw-compose-host #pc-model-options button[aria-pressed="true"] { background: #42386c; border-color: #7364ae; }
.pc-model-stars { color: #f4c46c; white-space: nowrap; font-size: 11px; }
.pc-composer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.pc-input textarea { height: clamp(80px, 13vh, 130px); resize: none; line-height: 1.6; }
.pc-send-actions { display: flex; flex-direction: column; gap: 7px; }
.pc-send-actions button { flex: 1; white-space: nowrap; }
.pc-status { display: flex; align-items: center; gap: 6px; }
.pc-status:has(#pc-message:empty):has(#pc-cancel[hidden]) { display: none; }
#pc-message { flex: 1; margin: 0; font-size: 12px; line-height: 1.5; color: #d4d4db; overflow-wrap: anywhere; }
.pc-photo { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.pc-photo img { width: 38px; height: 38px; object-fit: cover; border-radius: 4px; }
.pc-photo span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-output-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 5px; }
.pc-file-menu { top: calc(100% + 6px); right: 0; width: min(298px, calc(100vw - 32px)); display: grid; gap: 8px; }
.pc-file-actions { display: flex; flex-wrap: wrap; gap: 5px; }
#pc-stage { position: relative; flex: 1 1 0; min-height: 170px; background: #f4f7fb; touch-action: none; overflow: hidden; }
#pc-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#pc-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; color: #627086; z-index: 1; pointer-events: none; }
#pc-empty i { font-size: 44px; opacity: .4; }
#pc-empty p { font-size: 14px; }
.pc-controls { display: flex; align-items: center; gap: 9px; padding: 8px 12px; }
.pc-controls input { min-width: 30px; flex: 1; accent-color: #a0a8e8; }
.pc-controls output { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 52px; }
#pc-reading { font-size: 12px; color: var(--pc-muted); margin: 0; padding: 0 12px 7px; }
#pc-reading:empty { display: none; }
.pc-report { max-height: 22%; overflow: auto; padding: 7px 12px; border-top: 1px solid var(--pc-border); font-size: 12px; color: var(--pc-muted); }
.pc-report summary { cursor: pointer; }
.pc-report ul { padding-left: 18px; margin: 6px 0; }
.pc-report li { margin: 4px 0; }
@media (max-width: 1366px), (max-height: 760px) {
    .page-physics-whiteboard #pw-compose-host { --pc-left: clamp(340px, 31vw, 400px); }
}
@media (max-width: 850px) {
    .page-physics-whiteboard #pw-compose-host { overflow: auto; }
    .pc-workspace { grid-template-columns: minmax(0, 1fr); height: auto; }
    .pc-input { height: clamp(400px, 68dvh, 630px); border-right: 0; border-bottom: 1px solid var(--pc-border); }
    .pc-output { min-height: 420px; }
    .pc-output-bar { flex-wrap: wrap; }
    #pc-stage { flex: auto; height: clamp(290px, 53dvh, 480px); }
    .pc-report { max-height: 150px; }
}
