:root {
  --ink: #15161a;
  --muted: #68717f;
  --line: #d9dee8;
  --print-line: #666c78;
  --paper: #ffffff;
  --surface: #f4f6f9;
  --accent: #0d7a75;
  --accent-soft: #dff6f3;
  --side-toolbar-width: 64px;
  --top-toolbar-height: 62px;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font-family: "Segoe UI", system-ui, sans-serif;
}

.side-toolbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--side-toolbar-width);
  display: flex;
  justify-content: center;
  padding: 8px 8px;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.side-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.side-tools-footer {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.side-toolbar .icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
}

#pdfButton,
#imageButton {
  display: none;
}

.top-toolbar {
  position: fixed;
  inset: 0 0 auto var(--side-toolbar-width);
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--top-toolbar-height);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.toolbar-page-toggle-group {
  flex: 0 0 auto;
}

.toolbar-pages {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 0 1 auto;
}

.toolbar-page {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-page.hidden {
  display: none;
}

.toolbar-spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

button,
.file-button {
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  display: grid;
  place-items: center;
  font-size: 19px;
}

.tool-with-label {
  grid-template-rows: auto auto;
  gap: 1px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.tool-mini-label {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
}

.text-button,
.file-button {
  display: grid;
  place-items: center;
  padding: 0 12px;
  font-weight: 650;
}

button:hover,
.file-button:hover {
  border-color: #aab4c2;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:disabled:hover,
input:disabled:hover {
  border-color: var(--line);
}

button.active,
.segment.active {
  color: #064f4b;
  border-color: #56b7b0;
  background: var(--accent-soft);
}

.segmented {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segment {
  border: 0;
  border-radius: 0;
  min-width: 70px;
}

.orientation-toggle .segment {
  min-width: 52px;
  width: 52px;
  padding: 0;
}

.management-group {
  position: relative;
  width: 88px;
  flex: 0 0 88px;
  min-width: 88px;
  justify-content: flex-end;
  gap: 0;
  flex-wrap: nowrap;
  align-self: stretch;
}

.admin-toolbar-controls-shell {
  position: fixed;
  inset: auto 12px 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 10px 6px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.12);
  transform: translateY(calc(100% - 14px));
  transition: transform 180ms ease;
  z-index: 24;
}

.admin-toolbar-controls-shell:hover,
.admin-toolbar-controls-shell:focus-within {
  transform: translateY(0);
}

.admin-toolbar-controls-shell::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.4);
  transform: translateX(-50%);
}

.admin-toolbar-controls-shell.locked {
  visibility: hidden;
  pointer-events: none;
}

#managementButton {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  font-size: 0;
  color: transparent;
}

#managementButton::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  background-color: currentColor;
  color: #1f1f1f;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M287-527q-47-47-47-113t47-113q47-47 113-47t113 47q47 47 47 113t-47 113q-47 47-113 47t-113-47ZM80-160v-112q0-33 17-62t47-44q51-26 115-44t141-18h14q6 0 12 2-8 18-13.5 37.5T404-360h-4q-71 0-127.5 18T180-306q-9 5-14.5 14t-5.5 20v32h252q6 21 16 41.5t22 38.5H80Zm560 40-12-60q-12-5-22.5-10.5T584-204l-58 18-40-68 46-40q-2-14-2-26t2-26l-46-40 40-68 58 18q11-8 21.5-13.5T628-460l12-60h80l12 60q12 5 22.5 11t21.5 15l58-20 40 70-46 40q2 12 2 25t-2 25l46 40-40 68-58-18q-11 8-21.5 13.5T732-180l-12 60h-80Zm96.5-143.5Q760-287 760-320t-23.5-56.5Q713-400 680-400t-56.5 23.5Q600-353 600-320t23.5 56.5Q647-240 680-240t56.5-23.5Zm-280-320Q480-607 480-640t-23.5-56.5Q433-720 400-720t-56.5 23.5Q320-673 320-640t23.5 56.5Q367-560 400-560t56.5-23.5ZM400-640Zm12 400Z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'><path d='M287-527q-47-47-47-113t47-113q47-47 113-47t113 47q47 47 47 113t-47 113q-47 47-113 47t-113-47ZM80-160v-112q0-33 17-62t47-44q51-26 115-44t141-18h14q6 0 12 2-8 18-13.5 37.5T404-360h-4q-71 0-127.5 18T180-306q-9 5-14.5 14t-5.5 20v32h252q6 21 16 41.5t22 38.5H80Zm560 40-12-60q-12-5-22.5-10.5T584-204l-58 18-40-68 46-40q-2-14-2-26t2-26l-46-40 40-68 58 18q11-8 21.5-13.5T628-460l12-60h80l12 60q12 5 22.5 11t21.5 15l58-20 40 70-46 40q2 12 2 25t-2 25l46 40-40 68-58-18q-11 8-21.5 13.5T732-180l-12 60h-80Zm96.5-143.5Q760-287 760-320t-23.5-56.5Q713-400 680-400t-56.5 23.5Q600-353 600-320t23.5 56.5Q647-240 680-240t56.5-23.5Zm-280-320Q480-607 480-640t-23.5-56.5Q433-720 400-720t-56.5 23.5Q320-673 320-640t23.5 56.5Q367-560 400-560t56.5-23.5ZM400-640Zm12 400Z'/></svg>");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.admin-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding-top: 4px;
}

.admin-toolbar-controls #urlButton {
  min-width: 78px;
  min-height: 30px;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  letter-spacing: 0;
}

.admin-toolbar-controls #booksButton {
  min-width: 88px;
  min-height: 30px;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  letter-spacing: 0;
}

.admin-toolbar-controls #answerAccessToggleButton {
  min-width: 58px;
  min-height: 30px;
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  letter-spacing: 0;
}

.admin-toolbar-controls #bookMemoButton {
  width: 30px;
  min-width: 30px;
  height: 30px;
}

.admin-toolbar-controls .segmented {
  height: 30px;
}

.admin-toolbar-controls .segment {
  min-height: 30px;
  height: 30px;
  font-size: 12px;
}

.admin-toolbar-controls .orientation-toggle .segment {
  min-width: 46px;
  width: 46px;
}

.admin-toolbar-controls .layer-toggle .segment {
  min-width: 52px;
}

.file-icon-button {
  padding: 0;
  font-weight: 700;
  font-size: 12px;
}

.hidden-file-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#colorInput {
  width: 42px;
  height: 38px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#fillColorInput {
  width: 42px;
  height: 38px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#widthInput {
  width: 100%;
  accent-color: var(--accent);
}

#fontSizeInput {
  width: 88px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.zoom {
  width: 56px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.page-indicator {
  width: 68px;
  font-weight: 700;
}

.status {
  min-width: 0;
  max-width: 320px;
  white-space: nowrap;
  color: var(--muted);
  align-self: flex-end;
  padding: 0 2px 2px;
  font-size: 11px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.problem-menu {
  position: fixed;
  top: calc(var(--top-toolbar-height) + 8px);
  left: calc(var(--side-toolbar-width) + 12px);
  z-index: 30;
}

.floating-dialog {
  position: fixed;
  top: calc(var(--top-toolbar-height) + 8px);
  left: calc(var(--side-toolbar-width) + 12px);
  z-index: 31;
}

.management-dialog {
  left: auto;
  right: 14px;
}

.floating-dialog-card {
  width: min(320px, calc(100vw - var(--side-toolbar-width) - 28px));
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 50px rgba(21, 31, 48, 0.18);
}

.management-dialog .floating-dialog-card {
  width: min(320px, calc(100vw - var(--side-toolbar-width) - 28px));
}

.shape-settings-card {
  width: min(562px, calc(100vw - var(--side-toolbar-width) - 28px));
  gap: 6px;
  padding: 10px 12px;
}

#shapeSettingsDialog .floating-dialog-header {
  min-height: 22px;
  padding: 0;
}

#shapeSettingsDialog .floating-dialog-header strong {
  display: none;
}

#shapeSettingsDialog .floating-dialog-close {
  width: 28px;
  min-width: 28px;
  height: 28px;
  margin-left: auto;
}

.help-dialog-card {
  width: min(560px, calc(100vw - var(--side-toolbar-width) - 28px));
}

.floating-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.floating-dialog-close {
  width: 32px;
  height: 32px;
  min-width: 32px;
}

.floating-dialog-body {
  display: grid;
  gap: 12px;
}

.management-dialog-actions {
  justify-content: flex-end;
}

.object-context-menu {
  position: fixed;
  z-index: 60;
  display: grid;
  gap: 2px;
  min-width: 132px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(8px);
}

.object-contextMenu.hidden,
.object-context-menu.hidden {
  display: none;
}

.object-context-menu button {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.object-context-menu button:hover:not(:disabled) {
  background: var(--accent-soft);
}

.object-context-menu button:disabled {
  opacity: 0.42;
  cursor: default;
}

.toolbar-svg-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.chat-dialog {
  left: auto;
  right: 14px;
}

.chat-dialog-card {
  width: min(380px, calc(100vw - var(--side-toolbar-width) - 28px));
}

.chat-dialog-body {
  grid-template-rows: minmax(240px, 1fr) auto auto;
}

.memo-dialog {
  left: auto;
  right: 14px;
}

.memo-dialog-card {
  width: min(380px, calc(100vw - var(--side-toolbar-width) - 28px));
}

.memo-dialog-body {
  grid-template-rows: minmax(220px, 1fr) auto auto;
}

#bookMemoInput {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

#bookMemoInput:focus {
  outline: 2px solid rgba(13, 122, 117, 0.18);
  border-color: var(--accent);
}

.chat-messages {
  min-height: 240px;
  max-height: 420px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: grid;
  gap: 8px;
  align-content: start;
}

.chat-message {
  border: 1px solid rgba(31, 111, 235, 0.14);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(31, 111, 235, 0.04);
}

.chat-message-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.chat-message-author {
  font-weight: 700;
  color: var(--ink);
}

.chat-message-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.45;
}

.chat-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 18px 10px;
}

.chat-composer {
  display: grid;
  gap: 8px;
}

.chat-composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.chat-composer textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 136, 128, 0.12);
}

.chat-composer-actions {
  justify-content: flex-end;
}

.help-dialog-body {
  gap: 14px;
}

.help-section {
  display: grid;
  gap: 8px;
}

.help-section h3 {
  margin: 0;
  font-size: 15px;
}

.help-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.help-icon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.help-icon-item {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: center;
  color: var(--muted);
}

.help-icon-item .material-symbols-outlined {
  color: var(--ink);
}

.help-actions {
  display: flex;
  justify-content: flex-end;
}

.help-manual-link {
  text-decoration: none;
}

.shape-settings-picker-section {
  display: grid;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.shape-settings-settings-section {
  display: grid;
  gap: 6px;
  padding-top: 0;
}

.shape-settings-settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.floating-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.shape-settings-field-card {
  padding: 6px 7px;
  background: #fff;
}

.shape-settings-fill-combined {
  gap: 8px;
}

.shape-settings-fill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shape-settings-fill-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.shape-settings-field-card:not(:nth-child(5n)) {
  border-right: 1px solid var(--line);
}

.shape-settings-field-card:nth-child(n + 6) {
  border-top: 1px solid var(--line);
}

.floating-checkbox-field {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.floating-range-field input[type="range"] {
  width: 100%;
}

.floating-field input[type="text"] {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  box-sizing: border-box;
}

.shape-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}

.shape-picker-button {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 48px;
  padding: 5px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  line-height: 1.1;
  text-align: center;
  align-content: center;
}

.shape-picker-button .material-symbols-outlined {
  font-size: 16px;
}

.shape-picker-text-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 16px;
  line-height: 1;
}

.shape-settings-picker-section > .floating-field > span:first-child {
  display: none;
}

.shape-settings-note {
  font-size: 10px;
  line-height: 1.25;
  color: var(--muted);
  padding-top: 4px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.table-grid-dialog-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shape-picker-svg {
  width: 16px;
  height: 16px;
  overflow: visible;
}

.shape-picker-svg-trapezoid {
  width: 20px;
  height: 20px;
}

.shape-picker-svg-parallelogram {
  width: 20px;
  height: 20px;
}

.shape-picker-svg-sector {
  width: 20px;
  height: 20px;
}

.shape-picker-svg-triangle {
  width: 20px;
  height: 20px;
}

.shape-picker-svg polygon,
.shape-picker-svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 20;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-miterlimit: 10;
}

.shape-picker-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 560px) {
  .shape-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .help-icon-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shape-settings-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shape-settings-field-card {
    border-top: 0;
    border-right: 0;
  }

  .shape-settings-field-card:nth-child(odd) {
    border-right: 0;
  }

  .shape-settings-field-card + .shape-settings-field-card {
    border-top: 1px solid var(--line);
  }
}

.page-overview-card {
  width: min(860px, calc(100vw - var(--side-toolbar-width) - 28px));
}

.page-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  max-height: min(70vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.page-thumbnail-button {
  display: grid;
  gap: 8px;
  height: auto;
  padding: 10px;
  text-align: left;
}

.page-thumbnail-button.active {
  border-color: #56b7b0;
  background: var(--accent-soft);
}

.page-thumbnail-title {
  font-size: 13px;
  font-weight: 700;
}

.page-thumbnail-canvas {
  width: 100%;
  aspect-ratio: 1.414 / 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  display: block;
}

.problem-menu-card {
  width: min(880px, calc(100vw - var(--side-toolbar-width) - 28px));
  max-height: min(70vh, 560px);
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 50px rgba(21, 31, 48, 0.18);
}

.problem-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.problem-menu-close {
  width: 32px;
  height: 32px;
  min-width: 32px;
}

.problem-menu-breadcrumb {
  color: var(--muted);
  font-size: 13px;
}

.problem-menu-columns {
  display: flex;
  gap: 10px;
  overflow: auto;
}

.problem-menu-column {
  flex: 1 1 180px;
  min-width: 0;
}

.problem-menu-column:first-child {
  flex: 0.5 1 90px;
}

.problem-menu-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.problem-menu-list {
  display: grid;
  gap: 6px;
}

.problem-menu-item {
  justify-content: flex-start;
  height: auto;
  min-height: 38px;
  padding: 8px 10px;
  text-align: left;
  line-height: 1.35;
}

.problem-object {
  touch-action: none;
  overflow: visible;
}

.answer-object,
.answer-sheet-object {
  pointer-events: none;
}

.problem-card-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.problem-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  height: 100%;
  padding: 18px 22px 22px;
  border: 1.5px solid var(--print-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 24, 30, 0.08);
}

.paper-sheet-card {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
}

.paper-sheet-body {
  width: 100%;
  height: 100%;
  background: #fff;
}

.grid-10mm-sheet {
  background:
    linear-gradient(90deg, rgba(92, 102, 120, 0.58) 1px, transparent 1px),
    linear-gradient(rgba(92, 102, 120, 0.58) 1px, transparent 1px),
    #fff;
  background-size: var(--paper-grid-step, 37.8px) var(--paper-grid-step, 37.8px);
}

.problem-card-header {
  display: grid;
  gap: 10px;
  padding-bottom: 16px;
}

.root-basic-card {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
}

.root-practice-card {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
}

.quadratic-formula-card {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
}

.quadratic-factor-card {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
}

.root-basic-grid {
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  width: 100%;
  height: 100%;
  padding: 10px 0;
  box-sizing: border-box;
}

.root-basic-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  border-top: 1px solid var(--print-line);
}

.root-basic-row:first-child {
  border-top: 0;
}

.root-basic-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  min-width: 0;
  min-height: 0;
  padding: 32px 10px 6px;
}

.root-basic-group + .root-basic-group {
  border-left: 1px solid var(--print-line);
}

.root-basic-item {
  padding: 0 10px;
  font-size: 18px;
  line-height: 1.55;
  text-align: left;
}

.root-practice-grid {
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  width: 100%;
  height: 100%;
}

.fraction-multiply-grid {
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  width: 100%;
  height: 100%;
}

.fraction-basic-grid {
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  width: 100%;
  height: 100%;
}

.root-practice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--print-line);
}

.root-practice-row:first-child {
  border-top: 0;
}

.root-practice-block {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding: 8px 12px 12px;
}

.root-practice-block + .root-practice-block {
  border-left: 1px solid var(--print-line);
}

.root-practice-title {
  min-height: 22px;
  font-size: 13px;
  line-height: 1.3;
}

.root-practice-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  padding-top: 10px;
}

.root-practice-item {
  min-width: 0;
  font-size: 19px;
  line-height: 1.45;
  text-align: left;
}

.maze-sheet-card {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
}

.dot-connect-card {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
}

.integer-calc-input-card {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
}

.integer-calc-input-card .problem-card-body-worksheet {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 10px 14px 14px;
}

.integer-calc-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  width: 100%;
  height: 100%;
  border-top: 2px solid var(--print-line);
  border-left: 2px solid var(--print-line);
  background: #fff;
}

.integer-calc-input-cell {
  min-width: 0;
  min-height: 0;
  border-right: 2px solid var(--print-line);
  border-bottom: 2px solid var(--print-line);
}

.kuku-grid-card {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
}

.kuku-grid-card .problem-card-body-worksheet {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 12px 16px 16px;
}

.kuku-grid-sheet {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  width: 100%;
  height: 100%;
  border-top: 2px solid var(--print-line);
  border-left: 2px solid var(--print-line);
  background: #fff;
}

.kuku-grid-cell {
  min-width: 0;
  min-height: 0;
  border-right: 2px solid var(--print-line);
  border-bottom: 2px solid var(--print-line);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  color: #111827;
}

.kuku-grid-cell.corner-cell {
  background: #fff;
}

.kuku-grid-cell.header-cell {
  background: rgba(17, 24, 39, 0.03);
}

.dot-connect-card .problem-card-body-worksheet {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 10px 14px 14px;
}

.dot-connect-answer-shell {
  display: block;
  overflow: hidden;
  width: 100%;
  height: 100%;
  padding: 10px 14px 14px;
  box-sizing: border-box;
}

.dot-connect-sheet {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 10px;
  height: 100%;
  min-height: 0;
}

.dot-connect-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  height: 100%;
  min-height: 0;
  border: 2px solid var(--print-line);
}

.dot-connect-cell {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.dot-connect-cell + .dot-connect-cell {
  border-left: 2px solid var(--print-line);
}

.dot-connect-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.dot-connect-note {
  color: #111827;
  font-size: 13px;
  line-height: 1.4;
  text-align: right;
}

.dot-connect-number {
  fill: #111827;
  font-size: 30px;
  font-weight: 500;
  font-family: "Times New Roman", serif;
}

.dot-connect-arrow {
  stroke: #0f7a2d;
  stroke-width: 4;
  stroke-linecap: round;
}

.dot-connect-start-point {
  fill: #d62828;
}

.dot-connect-middle-point {
  fill: #9ca3af;
}

.dot-connect-end-point {
  fill: #fff;
  stroke: #111827;
  stroke-width: 2.5;
}

.dot-connect-answer-line {
  stroke: #d62828;
  stroke-width: 10;
  stroke-linecap: round;
}

.answer-dot-connect-sheet .dot-connect-note {
  visibility: hidden;
}

.answer-dot-connect-sheet .dot-connect-grid {
  border-color: transparent;
}

.answer-dot-connect-sheet .dot-connect-cell {
  background: transparent;
}

.answer-dot-connect-sheet .dot-connect-cell + .dot-connect-cell {
  border-left-color: transparent;
}

.maze-answer-shell {
  display: block;
  overflow: hidden;
  width: 100%;
  height: 100%;
  padding: 10px 14px 14px;
  box-sizing: border-box;
}

.maze-sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.maze-sheet-card .problem-card-body-worksheet {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 10px 14px 14px;
}

.maze-sheet-meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.maze-sheet-prompt {
  font-weight: 600;
}

.maze-sheet-scale {
  font-variant-numeric: tabular-nums;
}

.maze-sheet-svg {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  display: block;
}

.maze-sheet-bg {
  fill: #fff;
}

.maze-sheet-walls line {
  stroke: var(--maze-stroke-color, var(--print-line));
  stroke-width: var(--maze-stroke-width, 0.09);
  stroke-linecap: square;
}

.maze-sheet-start {
  fill: #dff6f3;
  stroke: #0d7a75;
  stroke-width: 0.05;
}

.maze-sheet-goal {
  fill: #fde68a;
  stroke: #b45309;
  stroke-width: 0.05;
}

.maze-sheet-marker-text {
  fill: #111827;
  font-size: 0.34px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

.maze-sheet-answer-path {
  fill: none;
  stroke: #d62828;
  stroke-width: 0.18;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.answer-maze-sheet .maze-sheet-meta {
  visibility: hidden;
}

.answer-maze-sheet .maze-sheet-bg,
.answer-maze-sheet .maze-sheet-walls,
.answer-maze-sheet .maze-sheet-start,
.answer-maze-sheet .maze-sheet-goal,
.answer-maze-sheet .maze-sheet-marker-text {
  visibility: hidden;
}

.quadratic-formula-sheet {
  width: 100%;
  height: 100%;
  display: block;
}

.quadratic-formula-content {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100%;
  height: 100%;
  padding: 18px 18px 16px;
}

.quadratic-formula-box {
  width: fit-content;
  min-width: 320px;
  padding: 12px 18px;
  border: 1.5px solid var(--print-line);
  border-radius: 8px;
  background: #fff;
}

.quadratic-formula-equation,
.quadratic-formula-main {
  font-size: 22px;
  line-height: 1.4;
}

.quadratic-formula-main {
  margin-top: 8px;
}

.quadratic-formula-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, 1fr);
  margin-top: 18px;
  border-top: 1px solid var(--print-line);
  border-left: 1px solid var(--print-line);
  height: 100%;
  min-height: 0;
}

.quadratic-formula-section {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 22px 18px;
  min-width: 0;
  min-height: 120px;
  border-right: 1px solid var(--print-line);
  border-bottom: 1px solid var(--print-line);
  overflow: hidden;
  box-sizing: border-box;
}

.quadratic-formula-items {
  display: block;
  width: 100%;
  padding: 0;
}

.quadratic-formula-item {
  display: block;
  font-size: 22px;
  line-height: 1.5;
  min-width: 0;
  white-space: nowrap;
}

.quadratic-factor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  width: 100%;
  height: 100%;
  border-top: 1px solid var(--print-line);
  border-left: 1px solid var(--print-line);
}

.quadratic-factor-cell {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  padding: 26px 18px;
  border-right: 1px solid var(--print-line);
  border-bottom: 1px solid var(--print-line);
}

.quadratic-factor-item {
  font-size: 24px;
  line-height: 1.5;
  white-space: nowrap;
}

.problem-card-title-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.problem-card-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin-left: 10px;
  margin-top: 8px;
}

.problem-card-editable {
  outline: none;
  border-radius: 8px;
  cursor: text;
}

.problem-card-editable:focus {
  background: rgba(223, 246, 243, 0.62);
  box-shadow: 0 0 0 2px rgba(13, 122, 117, 0.16);
}

.problem-card-subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.problem-card-rule {
  height: 1px;
  background: var(--print-line);
}

.problem-card-body {
  min-height: 0;
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.5;
}

.problem-card-body-worksheet {
  white-space: normal;
}

.problem-card-body.problem-card-editable {
  min-height: 120px;
  padding: 8px 10px;
  margin: -8px -10px;
}

.problem-worksheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  height: 100%;
}

.problem-worksheet-column {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-width: 0;
}

.problem-worksheet-heading {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--print-line);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.problem-worksheet-list {
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.problem-worksheet-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 20px minmax(120px, 0.85fr);
  align-items: center;
  gap: 10px;
  min-height: 0;
}

.problem-worksheet-row.without-number {
  grid-template-columns: 30px minmax(0, 1fr) 20px minmax(120px, 0.85fr);
}

.problem-worksheet-number {
  font-weight: 700;
}

.problem-worksheet-lhs,
.problem-worksheet-rhs {
  padding-bottom: 6px;
  font-size: 19px;
  line-height: 1.45;
  min-width: 0;
}

.problem-worksheet-lhs {
  border-bottom: 1px dashed var(--print-line);
}

.problem-worksheet-equals {
  padding-bottom: 6px;
  font-size: 19px;
  line-height: 1.45;
  text-align: center;
}

.problem-worksheet-rhs {
  border-bottom: 1px dashed var(--print-line);
  min-height: 34px;
}

.answer-sheet-shell {
  width: 100%;
  height: 100%;
  padding: 74px 22px 22px;
}

.root-basic-answer-shell {
  box-sizing: border-box;
  padding-top: 46px;
}

.root-practice-answer-shell {
  box-sizing: border-box;
  padding-top: 46px;
}

.quadratic-formula-answer-shell {
  box-sizing: border-box;
  padding-top: 46px;
}

.quadratic-factor-answer-shell {
  box-sizing: border-box;
  padding-top: 46px;
}

.answer-root-basic-grid {
  position: relative;
  transform: translate(10%, 58px);
}

.answer-root-basic-grid .root-basic-row {
  border-top-color: transparent;
}

.answer-root-basic-grid .root-basic-group + .root-basic-group {
  border-left-color: transparent;
}

.answer-root-basic-grid .root-basic-item {
  color: #b21d1d;
  font-weight: 700;
}

.answer-root-practice-grid {
  position: relative;
  transform: translate(10%, 30px);
}

.answer-fraction-multiply-grid {
  position: relative;
  transform: translate(10%, 30px);
}

.answer-fraction-basic-grid {
  position: relative;
  transform: translate(10%, 30px);
}

.answer-root-practice-grid .root-practice-row {
  border-top-color: transparent;
}

.answer-fraction-multiply-grid .root-practice-row {
  border-top-color: transparent;
}

.answer-fraction-basic-grid .root-practice-row {
  border-top-color: transparent;
}

.answer-root-practice-grid .root-practice-block + .root-practice-block {
  border-left-color: transparent;
}

.answer-fraction-multiply-grid .root-practice-block + .root-practice-block {
  border-left-color: transparent;
}

.answer-fraction-basic-grid .root-practice-block + .root-practice-block {
  border-left-color: transparent;
}

.answer-root-practice-grid .root-practice-title {
  visibility: hidden;
}

.answer-fraction-multiply-grid .root-practice-title {
  visibility: hidden;
}

.answer-fraction-basic-grid .root-practice-title {
  visibility: hidden;
}

.answer-root-practice-grid .root-practice-item {
  color: #b21d1d;
  font-weight: 700;
  transform: translateY(22px);
}

.answer-fraction-multiply-grid .root-practice-item {
  color: #b21d1d;
  font-weight: 700;
  transform: translateY(22px);
  width: fit-content;
  margin-left: auto;
  text-align: right;
}

.answer-fraction-basic-grid .root-practice-item {
  color: #b21d1d;
  font-weight: 700;
  transform: translateY(22px);
}

.answer-fraction-multiply-grid .root-practice-items {
  justify-items: end;
}

.answer-quadratic-formula-sheet {
  position: relative;
  transform: translate(10%, 30px);
}

.answer-quadratic-formula-sheet .quadratic-formula-box {
  visibility: hidden;
}

.answer-quadratic-formula-sheet .quadratic-formula-sections {
  border-top-color: transparent;
  border-left-color: transparent;
}

.answer-quadratic-formula-sheet .quadratic-formula-section {
  border-right-color: transparent;
  border-bottom-color: transparent;
}

.answer-quadratic-formula-sheet .quadratic-formula-item {
  color: #b21d1d;
  font-weight: 700;
  transform: translateY(60px);
}

.answer-quadratic-factor-grid {
  position: relative;
  transform: translate(10%, 60px);
  border-top-color: transparent;
  border-left-color: transparent;
}

.answer-quadratic-factor-grid .quadratic-factor-cell {
  border-right-color: transparent;
  border-bottom-color: transparent;
}

.answer-quadratic-factor-grid .quadratic-factor-item {
  color: #b21d1d;
  font-weight: 700;
}

.answer-worksheet .problem-worksheet-heading {
  visibility: hidden;
}

.answer-worksheet .problem-worksheet-row.without-number {
  grid-template-columns: 30px minmax(0, 1fr) 20px minmax(120px, 0.85fr);
}

.answer-worksheet .problem-worksheet-number {
  visibility: hidden;
}

.answer-worksheet .problem-worksheet-lhs,
.answer-worksheet .problem-worksheet-equals {
  visibility: hidden;
}

.answer-worksheet .problem-worksheet-rhs {
  border-bottom: 0;
  color: #b21d1d;
  font-weight: 700;
}

.problem-card-footer {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  color: #606b78;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  z-index: 2;
}

.problem-card-path {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.5;
}

.workspace {
  height: 100vh;
  padding-top: var(--top-toolbar-height);
  padding-left: var(--side-toolbar-width);
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  background:
    linear-gradient(90deg, rgba(20, 24, 30, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(20, 24, 30, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  cursor: grab;
}

.viewport.drawing,
.viewport.texting {
  cursor: crosshair;
}

.viewport.selecting {
  cursor: default;
}

.board {
  position: absolute;
  left: 0;
  top: 0;
  width: 1123px;
  height: 794px;
  background: var(--paper);
  border: 1px solid var(--print-line);
  box-shadow: 0 20px 70px rgba(21, 31, 48, 0.16);
  transform-origin: 0 0;
  overflow: hidden;
  touch-action: none;
}

.board.expanded-board {
  background-image:
    linear-gradient(to right, transparent calc(var(--base-page-width) - 1px), rgba(90, 104, 122, 0.45) calc(var(--base-page-width) - 1px), rgba(90, 104, 122, 0.45) calc(var(--base-page-width) + 1px), transparent calc(var(--base-page-width) + 1px)),
    linear-gradient(to bottom, transparent calc(var(--base-page-height) - 1px), rgba(90, 104, 122, 0.45) calc(var(--base-page-height) - 1px), rgba(90, 104, 122, 0.45) calc(var(--base-page-height) + 1px), transparent calc(var(--base-page-height) + 1px));
  background-repeat: no-repeat;
}

.board.portrait {
  width: 794px;
  height: 1123px;
}

.object-layer,
.text-layer,
#canvas,
.selection-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.object-layer {
  z-index: 1;
}

#canvas {
  z-index: 2;
  pointer-events: none;
  display: block;
}

.text-layer {
  z-index: 3;
  pointer-events: none;
}

.selection-layer {
  z-index: 5;
  pointer-events: none;
}

.board-object {
  position: absolute;
  user-select: none;
  touch-action: none;
  overflow: visible;
}

.board-object img,
.board-object embed {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid #c7cfdb;
  background: #fdfdfd;
  pointer-events: none;
}

.board-object.selected {
  outline: 2px solid var(--accent);
}

.text-object {
  position: absolute;
  min-width: 40px;
  min-height: 24px;
  padding: 2px 4px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: 22px/1.35 "Segoe UI", system-ui, sans-serif;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: auto;
}

.speech-text-object {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 90px;
}

.speech-text-play {
  width: 26px;
  min-width: 26px;
  height: 26px;
  margin-top: 1px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.speech-text-play .material-symbols-outlined {
  font-size: 18px;
}

.speech-text-content {
  flex: 1 1 auto;
  min-width: 0;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.speech-text-object:focus-within {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.8);
}

.input-part-object {
  position: absolute;
  display: flex;
  gap: 8px;
  align-items: stretch;
  pointer-events: auto;
}

.input-part-object.answer-column {
  flex-direction: column;
}

.input-part-object.answer-row {
  flex-direction: row;
}

.input-part-object.pen-pass-through {
  pointer-events: none;
}

.input-part-slot {
  position: relative;
  width: 100%;
  height: 100%;
}

.input-part-field {
  min-width: 0;
  padding: 6px 34px 6px 10px;
  border: 2px solid rgba(16, 16, 16, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font: inherit;
  line-height: 1.2;
  outline: none;
  box-shadow: 0 1px 2px rgba(16, 16, 16, 0.06);
}

.input-part-field:read-only {
  cursor: default;
  background: rgba(255, 255, 255, 0.92);
}

.input-part-field.is-empty {
  background: transparent;
}

.input-part-object.pen-pass-through .input-part-field {
  background: transparent !important;
}

.input-part-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(13, 122, 117, 0.12);
}

.input-part-field.speech-target {
  background: rgba(174, 235, 196, 0.45);
  border-color: rgba(57, 151, 82, 0.75);
}

.input-part-field.digits {
  text-align: center;
}

.input-part-answer {
  color: #cf3a32;
}

.input-part-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(16, 16, 16, 0.08);
  color: rgba(16, 16, 16, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.input-part-clear .material-symbols-outlined {
  font-size: 15px;
}

.input-part-clear:hover {
  background: rgba(16, 16, 16, 0.14);
}

.input-part-object.is-correct .input-part-prompt {
  border-color: #2271d1;
  background: rgba(34, 113, 209, 0.08);
}

.input-part-object.is-incorrect .input-part-prompt {
  border-color: #cf3a32;
  background: rgba(207, 58, 50, 0.08);
}

.text-object:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.8);
}

.latex-input {
  min-width: 160px;
  border-color: #b8c2d0;
  background: rgba(255, 255, 255, 0.88);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.latex-object {
  position: absolute;
  min-width: 40px;
  min-height: 30px;
  padding: 2px 4px;
  border: 1px solid transparent;
  color: inherit;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.latex-object.selected {
  border-color: var(--accent);
  background: rgba(223, 246, 243, 0.52);
}

.selection-box {
  position: absolute;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.86) inset;
  pointer-events: none;
}

.selection-box.marquee {
  border-style: dashed;
  background: rgba(13, 122, 117, 0.08);
}

.selection-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
  padding: 0;
}

.selection-handle.nw,
.selection-handle.se {
  cursor: nwse-resize;
}

.selection-handle.ne,
.selection-handle.sw {
  cursor: nesw-resize;
}

.object-context-menu {
  position: fixed;
  z-index: 60;
  display: grid;
  gap: 2px;
  min-width: 112px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.object-context-menu button {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.object-context-menu button:hover:not(:disabled) {
  background: var(--accent-soft);
}

.object-context-menu button:disabled {
  color: var(--muted);
  cursor: default;
}

.penlight-marker {
  position: absolute;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 999px;
  background: rgba(255, 105, 180, 0.28);
  border: 2px solid rgba(255, 105, 180, 0.42);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18) inset;
  pointer-events: none;
}

.circle-center {
  position: absolute;
  z-index: 4;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.circle-center::before,
.circle-center::after {
  content: "";
  position: absolute;
  background: #d64545;
}

.circle-center::before {
  left: 10px;
  top: 0;
  width: 2px;
  height: 22px;
}

.circle-center::after {
  left: 0;
  top: 10px;
  width: 22px;
  height: 2px;
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .top-toolbar {
    gap: 8px;
    padding: 8px 10px;
  }

  .settings-group {
    min-width: 0;
  }

  .status {
    max-width: 120px;
  }
}

@media print {
  html,
  body {
    width: 100%;
    height: 100%;
    margin: 0;
    background: #fff;
  }

  .side-toolbar,
  .top-toolbar {
    display: none;
  }

  .workspace {
    height: auto;
    padding: 0;
    overflow: visible;
    background: #fff;
  }

  .viewport {
    width: 100%;
    height: 100%;
    overflow: visible;
    background: #fff;
  }

  .board {
    position: fixed;
    left: 0 !important;
    top: 0 !important;
    width: 297mm;
    height: 210mm;
    border: 0;
    box-shadow: none;
    transform: none !important;
    overflow: hidden;
    background-image: none !important;
  }

  .board.portrait {
    width: 210mm;
    height: 297mm;
  }

  .selection-handle,
  .circle-center {
    display: none !important;
  }

  .board-object.selected,
  .text-object:focus,
  .latex-object.selected {
    outline: none;
    border-color: transparent;
    background: transparent;
  }
}
