/* workspace/shell — the look of a workspace page without a terminal (web/workspace/shell.js; TutorMe).
   Friendly and colourful but clean: one indigo accent, three helper colours (sun, mint, coral), big rounded touch
   targets (44 px or more), readable type (16 px base, never below 13 px), light by default and dark with the
   workspace theme (web/sf-theme.js: <html data-theme>). Contrast on the page background: text 13:1, dim text 6:1,
   accent 6:1 (light) / 7:1 (dark). The chat panel's own variables (--ai-*) are re-coloured here so the panel, its
   cards and the voice controls follow the site's palette without a change to web/aichat.css. */

html[data-ws-shell] {
  --ws-bg: #f6f7ff; --ws-surface: #ffffff; --ws-soft: #eceefe; --ws-line: #dcdff5; --ws-fg: #1b2140; --ws-dim: #515a7c;
  --ws-acc: #4f46e5; --ws-acc-ink: #ffffff; --ws-acc-soft: rgba(79, 70, 229, .12);
  --ws-sun: #ffb627; --ws-mint: #0f9f73; --ws-coral: #e5484d; --ws-sky: #2563eb;
  --ws-shadow: 0 1px 2px rgba(27, 33, 64, .06), 0 8px 24px rgba(27, 33, 64, .08);
  --ws-sans: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ws-top: 48px; --ws-kb: 0px; --ws-vh: 100dvh;
  /* the chat panel in this site's colours */
  --ai-bg: var(--ws-surface); --ai-bg2: var(--ws-soft); --ai-surface: #ffffff; --ai-hover: #e4e7fb; --ai-sel: #dfe2fa;
  --ai-line: var(--ws-line); --ai-line2: #c5caea; --ai-fg: var(--ws-fg); --ai-dim: var(--ws-dim);
  --ai-acc: var(--ws-acc); --ai-acc-hover: #4338ca; --ai-acc-ink: #ffffff; --ai-acc-soft: var(--ws-acc-soft); --ai-me: #e8eaff;
  --ai-focus: var(--ws-acc); --ai-green: var(--ws-acc); --ai-blue: var(--ws-sky); --ai-serif: var(--ws-sans);
}
html[data-ws-shell][data-theme="dark"] {
  --ws-bg: #12142a; --ws-surface: #1b1e3b; --ws-soft: #24284d; --ws-line: #33386a; --ws-fg: #eef0ff; --ws-dim: #b0b7de;
  --ws-acc: #9aa2ff; --ws-acc-ink: #10122a; --ws-acc-soft: rgba(154, 162, 255, .16);
  --ws-sun: #ffc857; --ws-mint: #4fd1a5; --ws-coral: #ff8589; --ws-sky: #8db8ff;
  --ws-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 28px rgba(0, 0, 0, .35);
  --ai-surface: #262a52; --ai-hover: #2d3160; --ai-sel: #343970; --ai-line2: #454b86; --ai-acc-hover: #b3b9ff; --ai-acc-ink: #10122a; --ai-me: #2d3160;
}
html[data-ws-shell], html[data-ws-shell] body { margin: 0; height: 100%; background: var(--ws-bg); color: var(--ws-fg); font: 16px/1.5 var(--ws-sans); -webkit-text-size-adjust: 100%; }
html[data-ws-shell] body { display: flex; overflow: hidden; height: var(--ws-vh); overscroll-behavior: none; }
html[data-ws-shell] *, html[data-ws-shell] *::before, html[data-ws-shell] *::after { box-sizing: border-box; }
html[data-ws-shell] button { font-family: var(--ws-sans); }
html[data-ws-shell] :focus-visible { outline: 3px solid var(--ws-acc); outline-offset: 2px; border-radius: 6px; }
.ws-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ws-skip { position: absolute; left: 8px; top: -60px; z-index: 90; background: var(--ws-acc); color: var(--ws-acc-ink); padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.ws-skip:focus { top: 8px; }

/* ---- the column: top bar + workspace ---- */
#sf-left.ws { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; height: 100%; position: relative; }
#ws-top { flex: 0 0 var(--ws-top); display: flex; align-items: center; gap: 10px; padding: 0 12px 0 6px; padding-top: env(safe-area-inset-top); background: var(--ws-surface); border-bottom: 1px solid var(--ws-line); z-index: 5; }
#ws-menu { flex: 0 0 44px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--ws-fg); font-size: 20px; border-radius: 12px; cursor: pointer; }
#ws-menu:hover { background: var(--ws-soft); }
#ws-brand { display: flex; flex-direction: column; line-height: 1.1; flex: 0 0 auto; }
#ws-brand b { font-size: 17px; font-weight: 800; letter-spacing: -.01em; background: linear-gradient(90deg, var(--ws-acc), var(--ws-sky)); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-theme="dark"] #ws-brand b { color: var(--ws-acc); background: none; }
#ws-brand small { font-size: 11px; color: var(--ws-dim); }
#ws-title { flex: 1 1 auto; min-width: 0; text-align: right; font-size: 14px; font-weight: 600; color: var(--ws-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ws-work { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; outline: none; }
#ws-board, #ws-card { flex: 1 1 auto; min-height: 0; }
#ws-card { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#ws-board[hidden], #ws-card[hidden] { display: none; }

/* progress ring (top bar, course cards) */
.cd-ring { --pct: 0; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; background: conic-gradient(var(--ws-mint) calc(var(--pct) * 1%), var(--ws-soft) 0); position: relative; }
.cd-ring::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--ws-surface); }
.cd-ring b { position: relative; z-index: 1; font-size: 11px; font-weight: 700; color: var(--ws-fg); }
#ws-prog[hidden] { display: none; }

/* "Tutor is writing" */
#ws-driving { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 6; display: none; background: var(--ws-sun); color: #2b1d00; font-size: 13px; font-weight: 700; padding: 5px 14px; border-radius: 999px; box-shadow: var(--ws-shadow); pointer-events: none; }
html.aichat-driving #ws-driving, html.ws-playing #ws-driving { display: block; }

/* captions over the bottom of the workspace (shown with the sound off too) */
html[data-ws-shell] #aichat-caption { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: max-content; max-width: min(94%, 640px); z-index: 7; background: rgba(15, 17, 40, .9); color: #fff; font: 600 17px/1.35 var(--ws-sans); padding: 9px 16px; border-radius: 14px; border: 0; text-align: center; pointer-events: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
html[data-ws-shell] #aichat-caption[style*="none"] { display: none !important; }

#ws-toast { position: absolute; left: 50%; top: 52px; transform: translateX(-50%); z-index: 8; background: var(--ws-fg); color: var(--ws-bg); font-size: 14px; font-weight: 600; padding: 8px 16px; border-radius: 999px; max-width: 90%; box-shadow: var(--ws-shadow); }
#ws-toast[hidden] { display: none; }

/* the tutor's click-to-answer question, over the board */
#ws-choice { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 9; background: var(--ws-surface); border: 2px solid var(--ws-acc); border-radius: 20px; padding: 14px; box-shadow: var(--ws-shadow); max-height: 70%; overflow-y: auto; }
#ws-choice[hidden] { display: none; }
#ws-choice .ch-q { margin: 0 0 10px; font-size: 17px; font-weight: 700; }
#ws-choice .ch-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 8px; }
#ws-choice .ch-opt { min-height: 52px; padding: 10px 14px; border-radius: 16px; border: 2px solid var(--ws-line); background: var(--ws-soft); color: var(--ws-fg); font-size: 16px; font-weight: 600; cursor: pointer; text-align: center; }
#ws-choice .ch-opt:hover, #ws-choice .ch-opt.on { border-color: var(--ws-acc); background: var(--ws-acc-soft); }

/* chips */
#ws-chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; flex: 0 0 auto; }
#ws-chips[hidden] { display: none; }
#ws-chips::-webkit-scrollbar { display: none; }
.ws-chip { flex: 0 0 auto; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--ws-line); background: var(--ws-surface); color: var(--ws-fg); font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.ws-chip.primary { background: var(--ws-acc); border-color: var(--ws-acc); color: var(--ws-acc-ink); }
.ws-chip:active { transform: scale(.97); }

/* menu (a drawer on a phone, a rail that slides over on a desktop) */
#ws-rail { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(86vw, 320px); background: var(--ws-surface); border-right: 1px solid var(--ws-line); transform: translateX(-102%); transition: transform .22s ease; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); visibility: hidden; }
html.ws-menu #ws-rail { transform: none; visibility: visible; }
#ws-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(10, 12, 30, .45); display: none; }
html.ws-menu #ws-scrim, html.ws-sheet #ws-scrim { display: block; }
.ws-railhead, .ws-sheethead { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 18px; font-size: 18px; }
.ws-x { width: 44px; height: 44px; border: 0; background: transparent; color: var(--ws-dim); font-size: 18px; border-radius: 12px; cursor: pointer; }
#ws-rail ul { list-style: none; margin: 0; padding: 4px 8px; flex: 1 1 auto; overflow-y: auto; }
.ws-mi { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 12px; border: 0; background: transparent; color: var(--ws-fg); font: 600 16px var(--ws-sans); border-radius: 14px; cursor: pointer; text-align: left; text-decoration: none; }
.ws-mi:hover { background: var(--ws-soft); }
.ws-mi[aria-pressed="true"] { background: var(--ws-acc-soft); color: var(--ws-acc); }
.ws-mico { width: 26px; text-align: center; font-size: 19px; }
.ws-railfoot { margin: 0; padding: 12px 18px; font-size: 12.5px; color: var(--ws-dim); }
.ws-railfoot a { color: inherit; }

/* bottom sheets */
#ws-sheet { position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: var(--ws-surface); border-radius: 22px 22px 0 0; padding: 4px 6px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(10, 12, 30, .3); }
#ws-sheet[hidden] { display: none; }
.ws-sheetbody { padding: 0 12px 6px; display: grid; gap: 10px; }
.ws-bigopt { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 16px; border-radius: 18px; border: 2px solid var(--ws-line); background: var(--ws-soft); color: var(--ws-fg); font-size: 17px; cursor: pointer; text-align: left; }
.ws-bigopt:hover { border-color: var(--ws-acc); }
.ws-form { display: grid; gap: 12px; }
.ws-form label { display: grid; gap: 4px; font-weight: 700; font-size: 14px; }
.ws-form input { height: 48px; border-radius: 12px; border: 2px solid var(--ws-line); background: var(--ws-bg); color: var(--ws-fg); font: 16px var(--ws-sans); padding: 0 12px; }
.ws-form small { font-weight: 400; color: var(--ws-dim); font-size: 13px; }
.ws-err { margin: 0; min-height: 1.2em; color: var(--ws-coral); font-weight: 700; font-size: 14px; }
.ws-btn { min-height: 48px; padding: 0 20px; border-radius: 14px; border: 2px solid var(--ws-line); background: var(--ws-surface); color: var(--ws-fg); font-size: 16px; font-weight: 700; cursor: pointer; }
.ws-btn.primary { background: var(--ws-acc); border-color: var(--ws-acc); color: var(--ws-acc-ink); }
.ws-cred { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.ws-cred dt { color: var(--ws-dim); font-size: 14px; } .ws-cred dd { margin: 0; font-weight: 700; }
.ws-pw { font: 700 20px ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; user-select: all; }
@media (min-width: 700px) { #ws-sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(480px, 92vw); border-radius: 22px; } }

/* ?demo=1: the board alone (no chat, no sign-in) */
html.ws-demo #aichat-panel, html.ws-demo #aichat-toggle { display: none !important; }
html.ws-demo #sf-left.ws { padding-bottom: 0 !important; }
#ws-onboard { display: none; }
html.ws-onboard #ws-onboard { display: block; position: fixed; z-index: 30; left: 50%; bottom: calc(var(--ws-dockpx, 150px) + 6px); transform: translateX(-50%); background: var(--ws-acc); color: var(--ws-acc-ink); font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; pointer-events: none; }

@media (prefers-reduced-motion: reduce) { #ws-rail { transition: none; } .ws-chip:active { transform: none; } }
@media print {
  html[data-ws-shell] body { display: block; overflow: visible; height: auto; background: #fff; }
  #ws-top, #ws-chips, #aichat-panel, #aichat-toggle, #ws-rail, #ws-scrim, #ws-sheet, #ws-choice, #ws-toast, #ws-driving, #aichat-caption, .bd-pages, .bd-jump { display: none !important; }
  #sf-left.ws, #ws-work, #ws-board { display: block; height: auto; overflow: visible; }
}
