/* The lesson studio occupies the available viewport. Its controls float over the paper. */
.academy-language-dialog .academy-language-options { display: grid; gap: 8px; }
.academy-language-options button { justify-content: flex-start; border-radius: 7px; min-height: 44px; padding: 10px 14px; }
.academy-language-options button[aria-pressed=true] { color: #fffbf0; background: #501219; border-color: #501219; }
.academy-language-options button[aria-pressed=true]::after { content: "✓"; margin-left: auto; }
.stage-board:has(.lesson-studio) { padding: 0; background: #f5f0e6; }
.stage-board:has(.lesson-studio)::before { display: none; }
.stage-board:has(.lesson-studio) .sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  min-height: 280px;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.stage-board:has(.lesson-studio) #mast { flex: none; }
.stage-board:has(.lesson-studio) .participant-mast { min-height: 52px; padding-inline: clamp(12px, 2.4vw, 34px); }
.stage-board:has(.lesson-studio) .participant-nav { padding-block: 3px; }
.stage-board:has(.lesson-studio) #shell, .stage-board:has(.lesson-studio) #content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
}
.stage-board .role-view-workspace:has(.lesson-studio) {
  display: flex; flex-direction: column; align-self: stretch;
  flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0; padding: 0;
}
.stage-board:has(.lesson-studio) #academy-footer { display: none; }
.lesson-studio {
  --studio-wine: #501219;
  --studio-ink: #302822;
  --studio-rule: #d0c0a9;
  --studio-paper: #fffaf0;
  --studio-edge: clamp(12px, 1.55vw, 24px);
  --studio-float: 0 5px 18px #4c312016, 0 1px 3px #37271a16;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.studio-head {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  min-height: 62px;
  padding: 7px clamp(14px, 2.4vw, 34px);
  border-bottom: 1px solid var(--studio-rule);
  background: var(--cabinet-background);
  color: var(--studio-ink);
}
.studio-heading, .studio-actions, .studio-peer { display: flex; align-items: center; }
.studio-heading { min-width: 0; gap: clamp(12px, 2vw, 28px); }
.studio-heading h1 {
  flex: none;
  font: 600 clamp(25px, 2.05vw, 33px)/1 var(--serif);
  letter-spacing: -.035em;
  color: #461114;
}
.studio-peer { flex-wrap: wrap; gap: 3px 7px; min-width: 0; padding-left: 16px; border-left: 1px solid var(--studio-rule); font: 600 13px/1.25 var(--sans); }
.studio-peer-role { font-weight: 400; color: #655647; }
.studio-peer select, .studio-stage-picker select {
  min-width: 0; max-width: 100%; border: 1px solid #c8b69c; border-radius: 7px; color: #472621; background: #fffaf1;
  font: 600 13px/1.25 var(--sans); cursor: pointer;
}
.studio-peer select { min-height: 34px; padding: 4px 5px; }
.studio-actions { flex: none; gap: 8px; }
.studio-actions summary, .lesson-studio .studio-tasks, .lesson-studio .studio-square {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px;
  border: 1px solid var(--studio-rule); border-radius: 8px; padding: 6px 12px;
  font: 600 12px/1.25 var(--sans); color: #4e352b; background: #fffcf6; cursor: pointer;
}
.studio-actions summary { list-style: none; }
.studio-actions summary::-webkit-details-marker { display: none; }
.lesson-studio .studio-tasks { border-color: var(--studio-wine); background: var(--studio-wine); color: #fffaf0; }
.studio-actions svg, .studio-square svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.studio-actions summary:hover, .studio-square:hover { background: #f6ecdc; }
.lesson-studio .studio-tasks:hover { background: #6b2429; }
.studio-connection-panel { position: absolute; z-index: 5; inset: calc(100% - 1px) clamp(8px, 2vw, 32px) auto auto; width: min(385px, calc(100vw - 16px)); }
.studio-connection-panel .bs-panel { max-height: 65dvh; overflow: auto; margin: 0; padding: 17px; border: 1px solid #b7a185; border-radius: 12px; box-shadow: var(--studio-float); }
.studio-connection:has([data-phase="offline"], [data-phase="denied"]) summary { color: #852b2e; border-color: #a86759; background: #faece5; }
.studio-archive { margin: 0; padding: 4px 18px; background: #f0dfbc; font: 600 12px/1.4 var(--sans); }
.stage-board .studio-field {
  position: relative; isolation: isolate; display: block; flex: 1; min-height: 0; min-width: 0; margin: 0; overflow: hidden;
}
.studio-field .wb-panel, .studio-field .wb-window {
  position: absolute; width: 100%; height: 100%; max-height: none; inset: 0; border: 0; border-radius: 0;
}
.studio-field .wb-panel { background: var(--cabinet-background); }
.studio-field .wb-window {
  background: var(--cabinet-background);
  scrollbar-width: thin;
}
.studio-field .wb-window:focus-visible { outline: 2px solid #86693a; outline-offset: -3px; }
.studio-field .wb-head, .studio-field .wb-controls, .studio-field .wb-tools {
  position: absolute; z-index: 3; margin: 0; border: 1px solid #beac90; border-radius: 12px;
  color: #51382b; background: #fffaf1; box-shadow: var(--studio-float);
}
.studio-field .wb-head { bottom: var(--studio-edge); left: var(--studio-edge); padding: 3px; }
.studio-field .wb-head h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.studio-field .wb-controls { bottom: var(--studio-edge); right: var(--studio-edge); padding: 3px; flex-wrap: nowrap; gap: 2px; }
.studio-field .wb-zoom { gap: 0; }
.studio-field .wb-zoom-value { min-width: 34px; font-variant-numeric: tabular-nums; }
.studio-field .wb-controls button, .studio-field .wb-head button { min-height: 36px; padding: 5px 9px; border: 0; background: transparent; border-radius: 7px; color: #492a27; }
.studio-field .wb-controls [data-board-cmd=plus], .studio-field .wb-controls [data-board-cmd=minus] { width: 33px; font-size: 20px; font-weight: 400; }
.studio-field .wb-controls [data-board-cmd=undo] { border-left: 1px solid #d4c5b0; border-radius: 0 7px 7px 0; }
.studio-field .wb-controls button:hover:not(:disabled), .studio-field .wb-head button:hover { background: #f1e6d5; }
.studio-field .wb-tools {
  bottom: max(var(--studio-edge), env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 3px;
  width: max-content; max-width: calc(100% - 20px); padding: 6px; border-radius: 15px;
  box-shadow: 0 8px 25px #4b332123, 0 1px 4px #4b33211a;
}
.studio-field .wb-tools button {
  position: relative; display: inline-grid; place-items: center; flex: none;
  min-width: 41px; min-height: 41px; padding: 5px 9px; border: 1px solid transparent; border-radius: 9px;
  color: #51352c; background: transparent;
}
.studio-field .wb-tools button:hover { background: #f1e5d2; border-color: #d2bda0; }
.studio-field .wb-tools button[aria-pressed=true] { color: #fffaf2; background: var(--studio-wine); border-color: var(--studio-wine); }
.studio-field .wb-tools [data-board-cmd=add-note]:not([aria-pressed=true]) { background: #f7e7b6; color: #725120; }
.studio-field [data-board-cmd="select"] { --studio-tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='m5 3 14 10-7 1-3 7z'/%3E%3C/svg%3E"); }
.studio-field [data-board-cmd="pan"] { --studio-tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.65' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M7.5 12V6.5a1.5 1.5 0 0 1 3 0V11 4.5a1.5 1.5 0 0 1 3 0V11 6a1.5 1.5 0 0 1 3 0v5-3.2a1.5 1.5 0 0 1 3 0v6.8c0 4-2.5 6.4-6.2 6.4-2.5 0-4.1-1.1-5.8-3.4L4 13a1.6 1.6 0 0 1 2.4-2z'/%3E%3C/svg%3E"); }
.studio-field [data-board-cmd="draw"] { --studio-tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='m5 15 10.4-10.4a2 2 0 0 1 2.8 0l1.2 1.2a2 2 0 0 1 0 2.8L9 19l-5 1zM14.3 5.7l4 4M5 15l4 4'/%3E%3C/svg%3E"); }
.studio-field [data-board-cmd="add-note"] { --studio-tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M4 4h16v11l-5 5H4zM15 20v-5h5M8 9h7M8 12h5'/%3E%3C/svg%3E"); }
.studio-field [data-action="role-flow-stage-new"] { --studio-tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M4 4h12v7H4zM7 11v6h5M17 14v7M13.5 17.5h7'/%3E%3C/svg%3E"); }
.studio-field .wb-tools :is([data-board-cmd="select"], [data-board-cmd="pan"], [data-board-cmd="draw"], [data-board-cmd="add-note"], [data-action="role-flow-stage-new"]):not(:has(svg)) {
  font-size: 0; gap: 0;
}
.studio-field .wb-tools :is([data-board-cmd="select"], [data-board-cmd="pan"], [data-board-cmd="draw"], [data-board-cmd="add-note"], [data-action="role-flow-stage-new"]):not(:has(svg))::before {
  content: ""; display: block; width: 21px; height: 21px; background: currentColor; mask: var(--studio-tool) center / contain no-repeat;
}
.studio-field .wb-status:not(:empty) {
  position: absolute; z-index: 2; left: 50%; bottom: 88px; transform: translateX(-50%);
  padding: 6px 12px; border: 1px solid #bdac92; border-radius: 8px; background: #fffaf0; color: #3f4735;
  max-width: calc(100% - 24px); width: max-content; line-height: 1.4; pointer-events: none;
}
.studio-field .wb-list:not([hidden]) {
  position: absolute; inset: 70px auto 84px var(--studio-edge); width: min(600px, calc(100% - 2 * var(--studio-edge)));
  display: flex; flex-direction: column; gap: 7px; padding: 13px; max-height: none; overflow: auto;
  border: 1px solid var(--studio-rule); background: #fffaf1; border-radius: 12px;
}
.studio-field .wb-list-stage, .studio-field .wb-list-note { flex: none; }
.studio-drawer {
  position: absolute; z-index: 5; inset: var(--studio-edge) var(--studio-edge) var(--studio-edge) auto; width: min(400px, calc(100% - 2 * var(--studio-edge)));
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid #bba689; border-radius: 14px; background: #fffbf3; box-shadow: 0 12px 38px #3825192b;
}
.studio-drawer[hidden] { display: none; }
.studio-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 5px 12px 5px 18px; border-bottom: 1px solid var(--studio-rule); }
.studio-drawer-head h2 { font: 600 25px/1.15 var(--serif); color: var(--studio-wine); }
.lesson-studio .studio-square { width: 36px; min-height: 36px; padding: 0; border-color: transparent; }
.studio-drawer-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.studio-homework-list { padding: 14px 18px 16px; border-bottom: 1px solid #d8cbb5; }
.studio-homework-list h3 { font: 600 22px/1.15 var(--serif); margin: 0 0 9px; }
.studio-homework-list [data-studio-homework] { display: grid; gap: 7px; }
.studio-homework-list p { color: #655647; font-size: 13px; }
.studio-homework-list .studio-hw-row {
  width: 100%; display: grid; gap: 4px; padding: 9px 11px; border: 1px solid #cbb8a0;
  border-left: 3px solid var(--studio-wine); border-radius: 4px 7px 7px 4px; background: #fbf2e4; box-shadow: none;
}
.studio-homework-list .studio-hw-row:hover { background: #f4e7d5; }
.studio-homework-list .hw-card-label { display: none; }
.studio-homework-list .studio-hw-row strong { font: 600 16px/1.2 var(--serif); }
.studio-homework-list .studio-hw-row small { font: 500 11px/1.35 var(--sans); color: #6a4d3a; }
.studio-stage-picker { display: grid; gap: 6px; padding: 13px 18px 14px; border-bottom: 1px solid #d8cbb5; }
.studio-stage-picker label { font: 600 12px/1.4 var(--sans); color: #685643; }
.studio-stage-picker select { width: 100%; min-height: 38px; padding: 7px; }
.studio-course-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: #6b5949; font: 500 11px/1.3 var(--sans); }
.studio-course-progress progress { width: 65px; height: 5px; border: 0; accent-color: #796942; }
.studio-stage-picker .flow-link { justify-self: start; }
.studio-drawer .flow-details { border: 0; border-radius: 0; overflow: visible; }
.studio-drawer .flow-details-head { background: #f5ede0; }
.studio-drawer .flow-details-head, .studio-drawer .flow-details-body { padding: 15px 18px; }
.studio-drawer .flow-details-head h2 { font-size: 32px; }
.studio-drawer .flow-task h3, .studio-drawer .flow-edit h3 { font-size: 28px; }
.lesson-studio :is(button,select,summary):focus-visible { outline: 3px solid #8a552a; outline-offset: 2px; }
@media (min-width: 601px) and (max-width: 1120px) {
  .studio-field .wb-controls { top: var(--studio-edge); bottom: auto; }
  .studio-field .wb-head { top: var(--studio-edge); bottom: auto; left: auto; right: calc(var(--studio-edge) + 280px); }
}
@media (max-width: 720px) {
  .stage-board:has(.lesson-studio) .participant-mast { min-height: 48px; padding-inline: 9px; }
  .studio-head { gap: 6px; min-height: 53px; padding: 5px 9px; }
  .studio-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .studio-heading h1 { font-size: 24px; }
  .studio-peer { gap: 4px; padding: 0; border: 0; font-size: 11px; line-height: 1.2; }
  .studio-peer select { max-width: 48vw; min-height: 24px; padding: 0 3px; font-size: 12px; }
  .studio-actions { gap: 5px; }
  .studio-actions summary { width: 40px; min-height: 40px; padding: 6px; }
  .studio-actions summary span { display: none; }
  .lesson-studio .studio-tasks { min-height: 40px; padding: 6px 9px; gap: 4px; }
  .studio-tasks .studio-plan-label { display: none; }
  .studio-tasks > span { text-transform: capitalize; }
  .studio-drawer { inset: 5px 5px max(5px, env(safe-area-inset-bottom)); width: auto; }
  .studio-drawer textarea { font-size: 16px; }
}
@media (max-width: 600px) {
  .studio-field .wb-tools { display: grid; grid-template-columns: repeat(4, 44px) minmax(63px, auto); max-width: calc(100% - 14px); gap: 2px; width: max-content; padding: 4px; border-radius: 12px; bottom: max(7px, env(safe-area-inset-bottom)); }
  .studio-field .wb-tools:has(> :last-child:nth-child(-n+5)) { display: flex; }
  .studio-field .wb-tools button { min-width: 42px; min-height: 42px; padding: 5px 7px; }
  .studio-field .wb-status:not(:empty) { bottom: 163px; }
  .studio-field .wb-head { top: auto; left: 8px; bottom: max(110px, calc(103px + env(safe-area-inset-bottom))); }
  .studio-field .wb-controls { top: auto; right: 8px; bottom: max(110px, calc(103px + env(safe-area-inset-bottom))); }
  .studio-field .wb-controls button, .studio-field .wb-head button { min-height: 38px; padding-inline: 7px; }
  .studio-field .wb-controls :is([data-board-cmd="undo"], [data-board-cmd="fit"]) { display: grid; place-items: center; width: 37px; font-size: 0; }
  .studio-field .wb-controls [data-board-cmd="undo"] { --studio-tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5 3 10l5 5M4 10h9a6 6 0 0 1 0 12' transform='translate(1 -1)'/%3E%3C/svg%3E"); }
  .studio-field .wb-controls [data-board-cmd="fit"] { --studio-tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5m6 0h5v5M20 15v5h-5m-6 0H4v-5'/%3E%3C/svg%3E"); }
  .studio-field .wb-controls :is([data-board-cmd="undo"], [data-board-cmd="fit"]):not(:has(svg))::before { content: ""; width: 18px; height: 18px; background: currentColor; mask: var(--studio-tool) center / contain no-repeat; }
  .studio-field .wb-list:not([hidden]) { inset-block: 10px 165px; }
}
@media (max-height: 430px) {
  .stage-board:has(.lesson-studio) .participant-mast { min-height: 38px; }
  .stage-board:has(.lesson-studio) .participant-link, .stage-board:has(.lesson-studio) .participant-exit { height: 34px; }
  .studio-head { min-height: 41px; padding-block: 2px; }
}
