/* QuantyGPT workspace (Beta), /workspace: the signed-in skin of app.css, light and dark. Phone first (390 px): "Chat"
   and "Canvas" tabs; laptop (64rem and up): chat left, canvas right. Every box 2px corners; nothing rounder.
   The shell first, then one section per mode. */
.ws-page { --ws-code-bg: #14130f; --ws-code-ink: #ede7dd; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .ws-page { --ws-code-bg: #f1ece3; --ws-code-ink: #1f1d1a; }
}
:root[data-theme="light"] .ws-page { --ws-code-bg: #f1ece3; --ws-code-ink: #1f1d1a; }
:root[data-theme="dark"] .ws-page { --ws-code-bg: #14130f; --ws-code-ink: #ede7dd; }

.ws-main { width: 100%; max-width: 80rem; align-self: center; padding: 1rem 1rem 2rem; }
.ws-head h1 { margin: 0; font-size: 1.5rem; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; }
.ws-head h1 .beta { font-size: .7rem; vertical-align: middle; }
.ws-tag { margin-top: .3rem; color: var(--mint); font-size: 1.05rem; }
.ws-line { margin-top: .35rem; color: var(--muted); font-size: .95rem; }
.ws-gate { margin-top: .9rem; }
.ws-gate .qg-button { display: inline-flex; width: auto; padding: 0 1rem; }

/* Phone: two tabs */
.ws-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-top: 1rem; border: 1px solid var(--line); border-radius: 2px; }
.ws-tabs button {
  min-height: 44px; border: 0; border-radius: 2px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600;
}
.ws-tabs button[aria-selected="true"] { background: var(--surface-raised); color: var(--text); box-shadow: inset 0 -2px 0 var(--mint); }
.ws-work { margin-top: .9rem; }
.ws-work[data-view="chat"] .ws-canvas, .ws-work[data-view="canvas"] .ws-chat { display: none; }
.ws-pane { min-width: 0; }

/* Chat */
.ws-starters { display: flex; flex-wrap: wrap; gap: .5rem; }
.ws-chip {
  min-height: 44px; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: 2px;
  background: var(--surface); color: var(--text); cursor: pointer; text-align: left; font-size: .9rem;
}
.ws-chip:hover { border-color: var(--mint); }
.ws-log { display: grid; gap: .7rem; margin-top: 1rem; }
.ws-msg { padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); }
.ws-msg strong { display: block; font-size: .8rem; color: var(--muted); }
.ws-msg p { margin: .35rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ws-you { background: var(--surface-raised); }
.code-open {
  display: block; width: 100%; min-height: 44px; margin-top: .5rem; padding: .4rem .7rem; text-align: left;
  border: 1px solid var(--line); border-left: 2px solid var(--mint); border-radius: 2px;
  background: transparent; color: var(--text); cursor: pointer; font-size: .9rem;
}
.code-open span { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ws-note { margin: 0; padding: .6rem .8rem; border: 1px solid var(--line); border-left: 2px solid var(--mint); border-radius: 2px; }
.ws-waiting { display: flex; gap: .3rem; padding: .7rem; }
.ws-waiting i { width: .45rem; height: .45rem; border-radius: 1px; background: var(--muted); animation: ws-dot 1s infinite alternate; }
.ws-waiting i:nth-child(3) { animation-delay: .2s; }
.ws-waiting i:nth-child(4) { animation-delay: .4s; }
@keyframes ws-dot { to { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .ws-waiting i { animation: none; } }
.ws-compose { display: grid; gap: .5rem; margin-top: 1rem; padding: .6rem; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); }
.ws-compose textarea {
  width: 100%; min-height: 4.5rem; resize: vertical; padding: .5rem; border: 0; border-radius: 2px;
  background: transparent; color: var(--text);
}
.ws-compose .ask-button { min-height: 44px; border: 1px solid var(--mint); border-radius: 2px; font-weight: 600; cursor: pointer; }
.ws-compose .ask-button:disabled { opacity: .55; cursor: not-allowed; }
.ws-caption { margin-top: .5rem; color: var(--muted); font-size: .85rem; }
/* Voice in the chat, the same as QuantPower's Quanty (voice.js): mic, language, spoken answers on or off, voice
   call; the 5-second countdown (Edit, Send now) and Stop while she speaks. Phone first: the row wraps at 390 px. */
.ws-compose-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.ws-compose-row .ask-button { flex: 1 1 9rem; }
.ws-voice { display: flex; flex: 1 1 auto; align-items: center; gap: .4rem; min-width: 0; }
.ws-voice[hidden], .ws-icon[hidden], .ws-bar[hidden], .ws-voice-line[hidden], .ws-voice-line span[hidden] { display: none; }
.ws-icon {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 2px; background: transparent; color: var(--text); cursor: pointer;
}
.ws-icon:hover { border-color: var(--mint); }
.ws-icon span { display: inline-grid; place-items: center; }
.ws-icon span[hidden] { display: none; }
.ws-mic.on { border-color: #b3261e; background: #b3261e; color: #ffffff; }
.ws-mic:disabled { opacity: .55; cursor: not-allowed; }
.ws-icon[aria-pressed="true"] { color: var(--muted); }
.ws-lang { flex: 0 1 8.5rem; min-width: 0; }
.ws-lang select {
  width: 100%; min-height: 44px; padding: 0 .4rem; border: 1px solid var(--line); border-radius: 2px;
  background: var(--surface); color: var(--text); font: inherit; font-size: .9rem;
}
.ws-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .45rem .6rem;
  border: 1px solid var(--mint); border-radius: 2px; background: var(--surface-raised); font-size: .9rem;
}
.ws-bar span { flex: 1 1 9rem; }
.ws-bar-button {
  min-height: 40px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: 2px;
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.ws-bar-button.primary { border-color: var(--mint); }
.ws-voice-line { margin: 0; color: var(--muted); font-size: .85rem; }

/* Canvas */
.code-canvas-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.code-canvas-head h2 { font-size: 1.1rem; }
.code-tool {
  min-height: 40px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: 2px;
  background: var(--surface); color: var(--text); cursor: pointer; font-size: .85rem;
}
.code-tool:hover { border-color: var(--mint); }
.ws-empty { margin-top: .6rem; padding: 1rem; border: 1px dashed var(--line); border-radius: 2px; color: var(--muted); }
.code-files { display: flex; gap: .3rem; margin-top: .7rem; overflow-x: auto; scrollbar-width: thin; }
.code-files button {
  flex: none; min-height: 40px; padding: 0 .75rem; border: 1px solid var(--line); border-radius: 2px;
  background: transparent; color: var(--muted); cursor: pointer;
  font: .85rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-files button[aria-selected="true"] { background: var(--surface-raised); color: var(--text); border-color: var(--mint); }
.code-files button[data-preview] { font-family: var(--sans); font-weight: 600; }
.code-view { margin-top: .5rem; border: 1px solid var(--line); border-radius: 2px; background: var(--ws-code-bg); }
.code-view-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem .5rem .35rem .75rem; border-bottom: 1px solid var(--line); }
.code-lang { color: var(--muted); font: .8rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.code-text { margin: 0; padding: .75rem; max-height: 60vh; overflow: auto; color: var(--ws-code-ink); font: .82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.code-preview { margin-top: .5rem; border: 1px solid var(--line); border-radius: 2px; background: #ffffff; }
.code-frame { display: block; width: 100%; height: 60vh; min-height: 22rem; border: 0; border-radius: 2px; }
.code-status { min-height: 1.2rem; margin-top: .4rem; color: var(--muted); font-size: .85rem; }
.code-cut, .code-safe { margin-top: .4rem; color: var(--muted); font-size: .85rem; }
.code-cut { padding: .5rem .7rem; border-left: 2px solid var(--mint); border-radius: 2px; color: var(--text); }
.code-more { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: 1rem; }
.code-tile { border: 1px solid var(--line); border-radius: 2px; background: var(--surface); }
.code-tile summary { min-height: 44px; padding: .65rem .75rem; cursor: pointer; font-weight: 600; }
.code-tile p { padding: 0 .75rem .75rem; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.code-themes { margin-top: 1.1rem; }
.code-themes h3 { margin: 0; font-size: 1rem; }
.code-themes p { margin-top: .2rem; color: var(--muted); font-size: .85rem; }
.code-theme-strip { display: flex; gap: .5rem; margin: .6rem 0 0; padding: 0 0 .4rem; list-style: none; overflow-x: auto; scroll-snap-type: x proximity; }
.code-theme-strip li { flex: none; scroll-snap-align: start; }
.code-theme { display: grid; gap: .15rem; width: 12rem; height: 100%; }
.code-theme span { color: var(--muted); font-size: .8rem; }
.ws-page .app-notes { margin-top: 1.5rem; }

/* Small phones: the header fits 390 px (as on the other signed-in pages) */
@media (max-width: 25rem) { .ws-page .nav-about { display: none; } }

/* Laptop: chat left, canvas right */
@media (min-width: 64rem) {
  .ws-main { padding: 1.5rem 1.5rem 2rem; }
  .ws-tabs { display: none; }
  .ws-work { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.25rem; align-items: start; }
  .ws-work[data-view] .ws-chat, .ws-work[data-view] .ws-canvas { display: block; }
  .ws-chat { position: sticky; top: 1rem; }
  .ws-log { max-height: 52vh; overflow-y: auto; }
  .code-frame { height: 64vh; }
}

/* Shell: mode menu, the "goes with" line, side panel, plain answers */
.ws-menu { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.ws-menu a {
  min-height: 40px; display: inline-flex; align-items: center; padding: 0 .8rem; border: 1px solid var(--line);
  border-radius: 2px; color: var(--muted); text-decoration: none; font-size: .9rem;
}
.ws-menu a[aria-current="page"] { color: var(--text); border-color: var(--mint); background: var(--surface-raised); }
.ws-about { margin-top: .7rem; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.ws-side { margin-bottom: .8rem; }
.ws-msg pre { margin: .5rem 0 0; padding: .6rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 2px; background: var(--ws-code-bg); }
.ws-msg pre code { font: .82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }
.ws-canvas-body h2 { font-size: 1.1rem; }
.ws-safe { margin-top: .8rem; color: var(--muted); font-size: .85rem; }

/* Modes: course and exam (lesson and practice styles come from courses.css) */
.ws-pick h2 { font-size: 1.1rem; }
.ws-pick h3 { margin: 1rem 0 .3rem; font-size: .95rem; }
.ws-lesson-title { margin: .2rem 0 0; font-size: 1.3rem; line-height: 1.3; }
.ws-lesson .lesson-body { max-height: none; }
.ws-link { padding: 0; border: 0; background: none; color: var(--mint); cursor: pointer; font: inherit; text-decoration: underline; min-height: 32px; }
.ws-next, .ws-back { margin-top: .8rem; font-size: .9rem; }
.ws-practice .pq-explain { margin-top: .75rem; }

/* Mode: watch (the player's own styles come from app.css) */
.ws-canvas [data-ws-demo] .player video { width: 100%; }

/* One signed-in screen (QG_ONE_SCREEN): the tab strip on top, a horizontal scroller on the phone. */
.ws-one [hidden] { display: none !important; }
.ws-strip {
  display: flex; gap: .4rem; margin: 0 -1rem .9rem; padding: .1rem 1rem .5rem; overflow-x: auto;
  scroll-snap-type: x proximity; scroll-padding-inline: 1rem; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.ws-strip [role="tab"] {
  flex: none; scroll-snap-align: start; min-height: 44px; padding: 0 .8rem; border: 1px solid var(--line);
  border-radius: 2px; background: transparent; color: var(--muted); font: inherit; font-size: .92rem; font-weight: 600;
  white-space: nowrap; cursor: pointer;
}
.ws-strip [role="tab"]:hover { border-color: var(--mint); }
.ws-strip [role="tab"][aria-selected="true"] {
  color: var(--text); border-color: var(--mint); background: var(--surface-raised); box-shadow: inset 0 -2px 0 var(--mint);
}
.ws-strip .beta { margin-left: .3rem; font-size: .68rem; vertical-align: middle; }
.ws-frame { margin-top: .4rem; }
.ws-frame-page {
  display: block; width: 100%; height: calc(100vh - 11rem); min-height: 34rem; border: 1px solid var(--line);
  border-radius: 2px; background: var(--surface);
}
.ws-one .ws-mode-canvas > h2:first-child { margin-top: 0; }
.ws-one .ws-canvas .demo-entry, .ws-one [data-course-page], .ws-one [data-exam-page] { display: none; }
.chat-topics { display: flex; flex-wrap: wrap; gap: .4rem; }
.chat-topics .ws-chip[aria-pressed="true"] { border-color: var(--mint); background: var(--surface-raised); color: var(--text); }
.chat-topic { margin-top: .9rem; padding: .8rem; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); }
.chat-topic h3 { margin: 0; font-size: 1.05rem; }
.chat-topic p { margin: .35rem 0 0; color: var(--muted); }
.ws-asks { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.chat-out { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.chat-out .qg-button { border-radius: 2px; }
@media (min-width: 64rem) {
  .ws-strip { margin: 0 0 1rem; padding: 0 0 .4rem; flex-wrap: wrap; overflow: visible; }
  .ws-frame-page { height: calc(100vh - 12rem); }
}
