:root {
  --bg: #eef2f6;
  --screen: #fbfcfd;
  --panel: #ffffff;
  --panel-soft: #f7f9fb;
  --paper: #fffdf7;
  --ink: #07163f;
  --muted: #667089;
  --line: #dfe7ee;
  --line-strong: #cbd6e2;
  --teal: #0b9b96;
  --teal-dark: #06716d;
  --blue: #2563eb;
  --red: #e53935;
  --green: #16984a;
  --orange: #f07612;
  --purple: #8059e8;
  --yellow: rgba(255, 226, 83, 0.5);
  --shadow: 0 18px 42px rgba(7, 22, 63, 0.12);
  --hand: "Segoe Print", "Comic Sans MS", "Bradley Hand ITC", cursive;
  --sidebar-width: 84px;
  --notes-width: 212px;
  --topbar-height: 64px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #ffffff 0, var(--bg) 62%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(11, 155, 150, 0.4);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.is-hidden {
  display: none !important;
}

.device-frame {
  min-height: 100vh;
  padding: 8px;
  background: #101116;
}

.app-root {
  display: grid;
  height: calc(100vh - 16px);
  min-height: 720px;
  overflow: hidden;
  grid-template-columns: var(--sidebar-width) var(--notes-width) minmax(760px, 1fr);
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 30px;
  background: var(--screen);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14), 0 22px 60px rgba(0, 0, 0, 0.32);
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  grid-row: 1 / span 2;
  gap: 18px;
  overflow: visible;
  z-index: 18;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 18px 10px 14px;
}

.brand img {
  width: 44px;
  height: auto;
  margin: 0 auto;
}

.main-nav,
.subject-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.subject-item,
.note-card {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 54px;
  align-items: center;
  justify-items: center;
  gap: 3px;
  border-radius: 14px;
  color: #142047;
  font-size: 0.66rem;
  font-weight: 760;
  padding: 6px 3px;
  text-align: center;
}

.nav-item span:not(.nav-icon),
.subject-item span:nth-child(2),
.section-head span,
.section-head .text-icon-button {
  display: none;
}

.nav-item.is-active,
.nav-item:hover,
.subject-item.is-selected,
.subject-item:hover {
  background: linear-gradient(90deg, rgba(9, 160, 154, 0.14), rgba(9, 160, 154, 0.06));
  color: var(--teal-dark);
}

.nav-icon {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  color: currentColor;
}

.nav-icon::before,
.nav-icon::after {
  position: absolute;
  content: "";
}

.notes-icon::before {
  inset: 2px 4px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.notes-icon::after {
  top: 7px;
  left: 8px;
  width: 7px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
}

.hub-icon::before {
  inset: 3px;
  border: 2px solid currentColor;
  transform: rotate(-24deg) skewX(18deg);
}

.calendar-icon::before {
  inset: 4px 3px 3px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.calendar-icon::after {
  top: 9px;
  left: 5px;
  width: 12px;
  height: 2px;
  background: currentColor;
}

.reflection-icon::before {
  top: 6px;
  left: 3px;
  width: 16px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.profile-icon::before {
  top: 3px;
  left: 8px;
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.profile-icon::after {
  left: 4px;
  bottom: 3px;
  width: 14px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}

.section-head {
  display: grid;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #69738b;
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-icon-button,
.icon-button,
.pill-button,
.avatar-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.text-icon-button {
  min-width: 28px;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.subject-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 48px;
  align-items: center;
  justify-items: center;
  gap: 2px;
  border-left: 4px solid transparent;
  border-radius: 8px;
  color: #1c294b;
  font-weight: 780;
  padding: 6px 2px;
  text-align: center;
}

.nav-item[data-tooltip]::after,
.subject-item[data-tooltip]::after,
.tool-button[data-tooltip]::after,
.toolbar-grip[data-tooltip]::after,
.icon-button[data-tooltip]::after,
.pill-button[data-tooltip]::after,
.avatar-button[data-tooltip]::after {
  position: absolute;
  z-index: 60;
  width: max-content;
  max-width: 220px;
  border: 1px solid rgba(203, 214, 226, 0.9);
  border-radius: 9px;
  background: rgba(7, 22, 63, 0.94);
  color: #ffffff;
  content: attr(data-tooltip);
  font-size: 0.72rem;
  font-weight: 820;
  line-height: 1.25;
  opacity: 0;
  padding: 7px 9px;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  white-space: normal;
}

.nav-item[data-tooltip]::after,
.subject-item[data-tooltip]::after {
  top: 50%;
  left: calc(100% + 10px);
  transform: translate(-4px, -50%);
}

.tool-button[data-tooltip]::after,
.toolbar-grip[data-tooltip]::after,
.icon-button[data-tooltip]::after,
.pill-button[data-tooltip]::after,
.avatar-button[data-tooltip]::after {
  right: 50%;
  bottom: calc(100% + 9px);
  transform: translate(50%, 4px);
}

.nav-item[data-tooltip]:hover::after,
.nav-item[data-tooltip]:focus-visible::after,
.subject-item[data-tooltip]:hover::after,
.subject-item[data-tooltip]:focus-visible::after,
.tool-button[data-tooltip]:hover::after,
.tool-button[data-tooltip]:focus-visible::after,
.tool-button[data-tooltip].is-tooltip-peeking::after,
.toolbar-grip[data-tooltip]:hover::after,
.toolbar-grip[data-tooltip]:focus-visible::after,
.icon-button[data-tooltip]:hover::after,
.icon-button[data-tooltip]:focus-visible::after,
.pill-button[data-tooltip]:hover::after,
.pill-button[data-tooltip]:focus-visible::after,
.avatar-button[data-tooltip]:hover::after,
.avatar-button[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(50%, 0);
}

.nav-item[data-tooltip]:hover::after,
.nav-item[data-tooltip]:focus-visible::after,
.subject-item[data-tooltip]:hover::after,
.subject-item[data-tooltip]:focus-visible::after {
  transform: translate(0, -50%);
}

.subject-item.is-selected {
  border-left-color: transparent;
  box-shadow: inset 0 -3px 0 var(--teal);
}

.subject-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: currentColor;
  font-weight: 900;
}

.subject-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}

.tags-section {
  display: none;
  gap: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-list span {
  border-radius: 7px;
  background: #eef2f6;
  color: #5d6679;
  font-size: 0.73rem;
  font-weight: 760;
  padding: 6px 10px;
}

.demo-card {
  display: none;
  justify-items: center;
  gap: 5px;
  margin-top: auto;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(11, 155, 150, 0.12), rgba(255, 255, 255, 0.92));
  color: #20304d;
  padding: 10px 6px;
  text-align: center;
}

.demo-card strong {
  color: var(--teal-dark);
  font-size: 0.7rem;
}

.demo-card p {
  display: none;
  margin: 0;
  color: #3f4c66;
  font-size: 0.84rem;
  line-height: 1.45;
}

.reset-link {
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 0.68rem;
  font-weight: 850;
  padding: 0;
}

.workspace-topbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  grid-column: 2 / span 2;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 0 18px 0 18px;
}

.note-title-menu,
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.note-title-menu strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  flex: 0 0 auto;
  gap: 18px;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #172544;
  font-size: 0.84rem;
  white-space: nowrap;
}

.status-dot {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid var(--teal);
  border-radius: 50%;
}

.status-dot::after {
  position: absolute;
  top: 3px;
  left: 5px;
  width: 5px;
  height: 8px;
  border: solid var(--teal);
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg);
}

.pill-button,
.avatar-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 0 14px;
}

.avatar-button span:first-child {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #d7eef0, #ffc8b8);
  color: #102044;
  font-size: 0.76rem;
}

.globe-icon,
.sun-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
}

.globe-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.globe-icon::before,
.globe-icon::after {
  position: absolute;
  content: "";
}

.globe-icon::before {
  top: 7px;
  left: 1px;
  width: 12px;
  height: 2px;
  background: currentColor;
}

.globe-icon::after {
  top: 1px;
  left: 6px;
  width: 2px;
  height: 12px;
  background: currentColor;
}

.sun-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 -10px 0 -7px currentColor, 0 10px 0 -7px currentColor, 10px 0 0 -7px currentColor, -10px 0 0 -7px currentColor;
}

.notes-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  grid-column: 2;
  grid-row: 2;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  padding: 14px 10px 14px;
}

.notes-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.notes-actions .icon-button {
  display: none;
}

.new-note-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, #09a39a, #057b75);
  color: #ffffff;
  font-weight: 850;
  padding: 0 16px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--ink);
  outline: none;
  padding: 0 14px 0 40px;
}

.search-box input::placeholder,
.keyboard-bar input::placeholder {
  color: #97a1b2;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid #7a8498;
  border-radius: 50%;
}

.search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  background: #7a8498;
  content: "";
  transform: rotate(45deg);
}

.note-list {
  display: grid;
  gap: 9px;
  overflow: auto;
  padding: 2px 0 12px;
}

.note-group {
  display: grid;
  gap: 8px;
}

.note-group-title {
  color: #737d92;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  margin: 10px 8px 0;
  text-transform: uppercase;
}

.note-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px 40px 12px 12px;
}

.note-card.is-selected {
  border-color: #77d6d1;
  box-shadow: 0 0 0 1px rgba(11, 155, 150, 0.26);
}

.note-card strong,
.note-card time,
.note-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-card strong {
  font-size: 0.82rem;
}

.note-card time,
.note-card span {
  color: #53617b;
  font-size: 0.76rem;
}

.note-card .star {
  position: absolute;
  right: 12px;
  bottom: 12px;
  color: #667189;
}

.archive-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #24314f;
  font-weight: 750;
  padding: 6px 8px;
}

.canvas-workspace {
  position: relative;
  min-width: 0;
  min-height: 0;
  grid-column: 3;
  grid-row: 2;
  overflow: hidden;
  background: #f2f5f8;
}

.paper-stage {
  position: relative;
  display: grid;
  height: 100%;
  min-height: 0;
  place-items: center;
  padding: 10px 10px 54px 104px;
}

.philosophy-message {
  position: absolute;
  top: 12px;
  left: 18px;
  z-index: 9;
  max-width: min(520px, calc(100% - 190px));
  margin: 0;
  border: 1px solid rgba(11, 155, 150, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #1d2b4c;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
  padding: 8px 13px;
  backdrop-filter: blur(12px);
}

.demo-hint {
  position: absolute;
  top: 52px;
  left: 18px;
  z-index: 13;
  display: flex;
  max-width: min(430px, calc(100% - 190px));
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(203, 214, 226, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(17, 31, 58, 0.12);
  color: #20304d;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.4;
  padding: 10px 10px 10px 14px;
  backdrop-filter: blur(14px);
}

.hint-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: #eef3f7;
  color: #31405f;
  font-size: 1.05rem;
  font-weight: 900;
}

.notes-column .philosophy-message {
  position: static;
  max-width: none;
  border-radius: 12px;
  background: rgba(11, 155, 150, 0.08);
  color: #153456;
  padding: 10px 12px;
}

.notes-column .demo-hint {
  position: static;
  max-width: none;
  align-items: flex-start;
  box-shadow: none;
  padding: 10px 10px 10px 12px;
}

.paper-page {
  position: relative;
  width: min(100%, 1240px);
  height: min(100%, 790px);
  min-height: 600px;
  overflow: hidden;
  border: 1px solid #e0d9c9;
  border-radius: 18px;
  background-color: var(--paper);
  box-shadow: 0 16px 34px rgba(17, 31, 58, 0.12);
  transform: translate(var(--pan-x, 0px), var(--pan-y, 0px)) scale(var(--zoom, 1));
  transform-origin: center;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
}

.paper-page::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(to right, transparent 0 76px, rgba(219, 68, 68, 0.55) 76px 78px, transparent 78px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 34px, rgba(50, 71, 106, 0.12) 35px);
  content: "";
  pointer-events: none;
}

.paper-page[data-paper="grid"]::before {
  background-image:
    linear-gradient(to right, transparent 0 76px, rgba(219, 68, 68, 0.55) 76px 78px, transparent 78px),
    linear-gradient(rgba(50, 71, 106, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(50, 71, 106, 0.10) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
}

.paper-page[data-paper="dotted"]::before {
  background-image:
    linear-gradient(to right, transparent 0 76px, rgba(219, 68, 68, 0.55) 76px 78px, transparent 78px),
    radial-gradient(rgba(50, 71, 106, 0.22) 1px, transparent 1px);
  background-size: auto, 24px 24px;
}

.paper-page[data-paper="plain"]::before {
  background-image: linear-gradient(to right, transparent 0 76px, rgba(219, 68, 68, 0.55) 76px 78px, transparent 78px);
}

.paper-page[data-paper="cornell"]::before {
  background-image:
    linear-gradient(to right, transparent 0 76px, rgba(219, 68, 68, 0.55) 76px 78px, transparent 78px),
    linear-gradient(to right, transparent 0, transparent 70%, rgba(50, 71, 106, 0.28) 70%, rgba(50, 71, 106, 0.28) calc(70% + 2px), transparent calc(70% + 2px)),
    repeating-linear-gradient(to bottom, transparent 0, transparent 34px, rgba(50, 71, 106, 0.12) 35px);
}

.paper-static,
#drawing-canvas,
.marker-layer {
  position: absolute;
  inset: 0;
}

.paper-static {
  z-index: 1;
  pointer-events: none;
}

#drawing-canvas {
  z-index: 2;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#drawing-canvas[data-tool="pan"] {
  cursor: grab;
}

body.is-panning #drawing-canvas {
  cursor: grabbing;
}

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

.hand-note {
  position: relative;
  height: 100%;
  color: var(--ink);
  font-family: var(--hand);
  letter-spacing: 0.01em;
}

.hand-title {
  position: absolute;
  top: 38px;
  left: 158px;
  color: #07164a;
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  line-height: 1;
  transform: rotate(-1deg);
}

.hand-title::after {
  position: absolute;
  right: 0;
  bottom: -14px;
  left: 0;
  height: 8px;
  border-top: 4px solid #09245d;
  border-bottom: 3px solid #09245d;
  border-radius: 50%;
  content: "";
  transform: rotate(1deg);
}

.hand-date {
  position: absolute;
  top: 40px;
  right: 58px;
  color: #07164a;
  font-size: 1.35rem;
  transform: rotate(-3deg);
}

.hand-date::after {
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 3px;
  border-radius: 99px;
  background: #09245d;
  content: "";
}

.star-sketch {
  position: absolute;
  top: 44px;
  left: 42%;
  color: #12215f;
  font-size: 2.3rem;
}

.highlight-sentence {
  position: absolute;
  top: 132px;
  left: 150px;
  font-size: 1.35rem;
  transform: rotate(-1deg);
}

.highlight-sentence mark,
.formula-label mark,
.question-line mark,
.derivation mark {
  border-radius: 8px;
  background: var(--yellow);
  color: inherit;
  padding: 0 7px;
}

.formula-label {
  position: absolute;
  top: 204px;
  left: 128px;
  font-size: 1.28rem;
}

.curve-arrow {
  position: absolute;
  top: 248px;
  left: 88px;
  width: 86px;
  height: 70px;
  border-left: 3px solid #07164a;
  border-bottom: 3px solid #07164a;
  border-radius: 0 0 0 56px;
  transform: rotate(-14deg);
}

.curve-arrow::after {
  position: absolute;
  right: -9px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-right: 3px solid #07164a;
  border-bottom: 3px solid #07164a;
  content: "";
  transform: rotate(-32deg);
}

.formula-box {
  position: absolute;
  top: 248px;
  left: 180px;
  display: grid;
  width: 288px;
  height: 96px;
  place-items: center;
  border: 3px solid var(--teal-dark);
  color: #0b315f;
  font-size: 2.3rem;
  white-space: nowrap;
  transform: rotate(-1deg);
}

.frac {
  display: inline-grid;
  margin: 0 4px;
  transform: translateY(-4px);
}

.frac span {
  display: block;
  min-width: 20px;
  border-bottom: 2px solid currentColor;
  font-size: 0.62em;
  line-height: 0.95;
  text-align: center;
}

.frac span + span {
  border-bottom: 0;
  padding-top: 2px;
}

.definition-list {
  position: absolute;
  top: 264px;
  left: 540px;
  color: #07164a;
  font-size: 1.15rem;
  line-height: 1.55;
  transform: rotate(-1deg);
}

.mistake-row {
  position: absolute;
  top: 392px;
  left: 128px;
  color: var(--red);
  font-size: 1.3rem;
}

.wrong-formula {
  display: inline-block;
  margin-left: 34px;
  color: #07164a;
  font-size: 1.9rem;
  transform: rotate(5deg);
}

.wrong-formula::before,
.wrong-formula::after {
  position: absolute;
  top: 18px;
  left: -8px;
  width: 170px;
  height: 3px;
  background: var(--red);
  content: "";
}

.wrong-formula::before {
  transform: rotate(13deg);
}

.wrong-formula::after {
  transform: rotate(-17deg);
}

.red-note {
  position: absolute;
  top: 386px;
  left: 552px;
  width: 232px;
  border-radius: 12px;
  background: rgba(229, 57, 53, 0.12);
  color: #c92323;
  font-size: 1.14rem;
  line-height: 1.35;
  padding: 13px 18px;
  transform: rotate(1deg);
}

.correction-row {
  position: absolute;
  top: 500px;
  left: 130px;
  color: var(--green);
  font-size: 1.45rem;
  transform: rotate(-1deg);
}

.correction-row strong {
  font-size: 1.7rem;
  font-weight: 500;
}

.question-line {
  position: absolute;
  top: 548px;
  left: 122px;
  font-size: 1.22rem;
}

.question-bubble {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid #12aeb0;
  border-radius: 50%;
  color: var(--teal-dark);
  font-family: Inter, sans-serif;
  font-weight: 900;
  margin-right: 10px;
}

.explanation {
  position: absolute;
  top: 594px;
  left: 150px;
  width: 580px;
  color: #0a1a56;
  font-size: 1.25rem;
  line-height: 1.6;
}

.derivation {
  position: absolute;
  top: 686px;
  left: 172px;
  width: 540px;
  color: #0a1a56;
  font-size: 1.25rem;
}

.derivation-box {
  display: block;
  margin-top: 14px;
  border: 3px solid #0a1a56;
  padding: 12px 22px;
  text-align: center;
}

.right-margin-line {
  position: absolute;
  top: 222px;
  right: 218px;
  bottom: 64px;
  width: 2px;
  background: rgba(30, 45, 82, 0.32);
}

.side-question {
  position: absolute;
  top: 250px;
  right: 42px;
  width: 168px;
  color: #07164a;
  font-size: 1.12rem;
  line-height: 1.48;
}

.side-question span {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid #12aeb0;
  border-radius: 50%;
  color: var(--teal-dark);
  font-family: Inter, sans-serif;
  font-weight: 900;
}

.side-marker {
  position: absolute;
  right: 48px;
  width: 160px;
  color: var(--orange);
  font-size: 1.2rem;
  line-height: 1.45;
}

.side-marker.hw {
  top: 470px;
}

.side-marker.test {
  top: 596px;
  color: var(--purple);
}

.reflection-note {
  position: absolute;
  top: 566px;
  left: 755px;
  width: 150px;
  border-radius: 14px;
  background: rgba(11, 155, 150, 0.1);
  color: var(--teal-dark);
  font-size: 0.86rem;
  line-height: 1.36;
  padding: 12px 14px;
  transform: rotate(-1deg);
}

.reflection-note span {
  color: #0a1a56;
  font-family: Inter, sans-serif;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.reasoning-note .hand-title {
  left: 148px;
  font-size: clamp(2.1rem, 3.5vw, 3rem);
}

.reasoning-prompt {
  position: absolute;
  top: 130px;
  left: 138px;
  color: #07164a;
  font-size: 1.28rem;
  transform: rotate(-1deg);
}

.reasoning-prompt mark {
  border-radius: 8px;
  background: var(--yellow);
  color: inherit;
  padding: 0 8px;
}

.wrong-thought {
  position: absolute;
  top: 202px;
  left: 128px;
  width: 520px;
  color: #07164a;
  font-size: 1.2rem;
  line-height: 1.55;
  transform: rotate(0.6deg);
}

.wrong-thought strong {
  display: block;
  margin-top: 10px;
  color: var(--red);
  font-size: 1.5rem;
  font-weight: 500;
}

.mistake-label {
  color: var(--red);
  font-family: Inter, sans-serif;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wrong-thought-cross {
  position: absolute;
  top: 254px;
  left: 270px;
  width: 310px;
  height: 72px;
}

.wrong-thought-cross::before,
.wrong-thought-cross::after {
  position: absolute;
  top: 32px;
  left: 0;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(229, 57, 53, 0.9);
  content: "";
}

.wrong-thought-cross::before {
  transform: rotate(12deg);
}

.wrong-thought-cross::after {
  transform: rotate(-14deg);
}

.teacher-nudge {
  position: absolute;
  top: 230px;
  right: 122px;
  width: 265px;
  border-radius: 14px;
  background: rgba(229, 57, 53, 0.1);
  color: #c92323;
  font-size: 1.05rem;
  line-height: 1.38;
  padding: 13px 16px;
  transform: rotate(-1deg);
}

.rewrite-block {
  position: absolute;
  top: 372px;
  left: 130px;
  width: 670px;
  color: var(--green);
  font-size: 1.5rem;
  line-height: 1.55;
  transform: rotate(-1deg);
}

.rewrite-block span {
  display: inline-block;
  margin-right: 16px;
  border-bottom: 4px solid rgba(22, 152, 74, 0.35);
  font-family: Inter, sans-serif;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.recall-card {
  position: absolute;
  top: 486px;
  left: 134px;
  width: 530px;
  border-left: 5px solid var(--blue);
  border-radius: 14px;
  background: rgba(37, 99, 235, 0.08);
  color: #174ed1;
  font-size: 1.1rem;
  line-height: 1.5;
  padding: 14px 18px;
}

.recall-card span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
  color: var(--blue);
  font-family: Inter, sans-serif;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.reasoning-side {
  position: absolute;
  top: 360px;
  right: 50px;
  width: 210px;
  color: var(--purple);
  font-size: 1.12rem;
  line-height: 1.45;
}

.test-box {
  color: var(--purple);
}

.reasoning-homework {
  position: absolute;
  top: 520px;
  right: 58px;
  width: 200px;
  color: var(--orange);
  font-size: 1.1rem;
  line-height: 1.45;
}

.reasoning-reflection {
  top: 618px;
  left: 134px;
  width: 690px;
  color: var(--teal-dark);
  font-size: 1rem;
}

.label-box {
  display: inline-block;
  margin-bottom: 8px;
  border: 2px solid currentColor;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 1.3rem;
}

.trace-cross-overlay,
.trace-dim-overlay,
.trace-correction-overlay {
  position: absolute;
  pointer-events: none;
}

.trace-cross-overlay {
  top: 388px;
  left: 288px;
  width: 186px;
  height: 54px;
}

.trace-cross-overlay::before,
.trace-cross-overlay::after {
  position: absolute;
  top: 24px;
  left: 0;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(229, 57, 53, 0.9);
  content: "";
}

.trace-cross-overlay::before {
  transform: rotate(14deg);
}

.trace-cross-overlay::after {
  transform: rotate(-16deg);
}

.trace-dim-overlay {
  top: 122px;
  left: 142px;
  width: 520px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.64);
}

.trace-correction-overlay {
  top: 514px;
  left: 678px;
  color: var(--green);
  font-family: var(--hand);
  font-size: 1.15rem;
}

.canvas-marker {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  max-width: 220px;
  align-items: center;
  gap: 8px;
  border: 1px solid currentColor;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--teal-dark);
  font-family: Inter, sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.28;
  padding: 7px 10px;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.canvas-marker span {
  display: inline-grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 7px;
  background: currentColor;
  color: #ffffff;
}

.canvas-marker[data-marker="homework"] {
  color: var(--orange);
}

.canvas-marker[data-marker="test"] {
  color: var(--purple);
}

.canvas-marker[data-marker="mistake"] {
  color: var(--red);
}

.canvas-marker[data-marker="recall"] {
  color: var(--blue);
}

.canvas-marker[data-marker="understood"],
.canvas-marker[data-marker="correction"] {
  color: var(--green);
}

.marker-strip {
  position: absolute;
  top: 92px;
  right: 16px;
  bottom: auto;
  left: auto;
  z-index: 11;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
}

.marker-strip button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 44px;
  min-height: 42px;
  border: 1px solid rgba(203, 214, 226, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #102044;
  font-size: 0.76rem;
  font-weight: 820;
  pointer-events: auto;
  padding: 0;
  touch-action: manipulation;
}

.marker-strip strong {
  position: absolute;
  top: 50%;
  right: calc(100% + 9px);
  display: block;
  width: max-content;
  max-width: 170px;
  border: 1px solid rgba(203, 214, 226, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 22px rgba(17, 31, 58, 0.12);
  color: #102044;
  font-size: 0.78rem;
  line-height: 1.2;
  opacity: 0;
  padding: 8px 10px;
  pointer-events: none;
  transform: translate(8px, -50%);
  transition: opacity 140ms ease, transform 140ms ease;
  white-space: nowrap;
}

.marker-strip button:hover strong,
.marker-strip button:focus-visible strong,
.marker-strip button.is-peeking strong {
  opacity: 1;
  transform: translate(0, -50%);
}

.marker-strip span {
  display: inline-grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 6px;
  background: var(--teal);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 950;
}

.marker-strip button[data-marker="homework"] span {
  border: 1px solid var(--orange);
  background: #fff7ee;
  color: var(--orange);
}

.marker-strip button[data-marker="test"] span {
  border: 1px solid var(--purple);
  background: #f6f0ff;
  color: var(--purple);
}

.marker-strip button[data-marker="mistake"] span {
  background: var(--red);
}

.marker-strip button[data-marker="recall"] span {
  background: #eef4ff;
  color: var(--blue);
}

.marker-strip button[data-marker="understood"] span {
  background: var(--green);
}

.floating-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(820px, calc(100% - 54px));
  overflow-x: auto;
  border: 1px solid rgba(210, 219, 229, 0.9);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 26px rgba(17, 31, 58, 0.18);
  padding: 9px 11px;
  transform: translateX(-50%);
  scrollbar-width: none;
  touch-action: none;
  transition: opacity 150ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.floating-toolbar::-webkit-scrollbar {
  display: none;
}

.floating-toolbar.is-docked-left {
  top: 108px;
  bottom: auto;
  left: 16px;
  max-width: 86px;
  max-height: calc(100% - 168px);
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 18px;
  padding: 8px;
  transform: none;
}

.floating-toolbar.is-floating-positioned {
  bottom: auto;
  max-width: min(820px, calc(100% - 28px));
  transform: none;
}

.floating-toolbar.is-dragging {
  box-shadow: 0 18px 36px rgba(17, 31, 58, 0.24);
}

.floating-toolbar.is-snap-preview {
  border-color: rgba(11, 155, 150, 0.62);
  background: rgba(240, 253, 251, 0.96);
  box-shadow: 0 18px 34px rgba(11, 155, 150, 0.18), 0 0 0 3px rgba(11, 155, 150, 0.12);
}

.floating-toolbar.is-writing {
  opacity: 0.12;
  pointer-events: none;
}

.floating-toolbar:not(.is-docked-left):not(.is-floating-positioned).is-writing {
  transform: translateX(-50%) translateY(34px);
}

.floating-toolbar.is-docked-left.is-writing,
.floating-toolbar.is-floating-positioned.is-writing {
  transform: translateY(18px);
}

.floating-toolbar.is-docked-left .tool-button {
  width: 52px;
  min-width: 52px;
  height: 48px;
  padding: 7px;
}

.floating-toolbar.is-docked-left .tool-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.floating-toolbar.is-docked-left .tool-icon {
  width: 20px;
  height: 20px;
}

.toolbar-grip {
  position: relative;
  display: inline-grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: #eef3f7;
  color: #536078;
  font-size: 1.1rem;
  font-weight: 950;
  letter-spacing: -0.14em;
  touch-action: none;
}

.tool-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.tool-button {
  position: relative;
  display: flex;
  width: 64px;
  min-width: 64px;
  height: 54px;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: #102044;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  padding: 5px 6px 6px;
  white-space: nowrap;
  touch-action: manipulation;
}

.floating-toolbar .tool-button svg,
.floating-toolbar .tool-icon {
  display: block;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  overflow: visible;
  vector-effect: non-scaling-stroke;
}

.floating-toolbar .tool-button svg *,
.floating-toolbar .tool-icon * {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-label {
  display: block;
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-button.is-active,
.tool-button:hover,
.tool-button:focus-visible,
.tool-button.is-tooltip-peeking {
  border-color: rgba(11, 155, 150, 0.26);
  background: #eef8f7;
}

.tool-button.is-active {
  color: var(--teal-dark);
  box-shadow: inset 0 -3px 0 var(--teal), 0 0 0 2px rgba(11, 155, 150, 0.08);
}

.tool-button.is-active .tool-icon {
  stroke-width: 2.25;
}

.tool-divider {
  width: 1px;
  height: 32px;
  background: var(--line);
}

.floating-toolbar.is-docked-left .tool-divider {
  width: 34px;
  height: 1px;
}

.color-palette {
  display: flex;
  gap: 9px;
  align-items: center;
}

.floating-toolbar.is-docked-left .color-palette {
  flex-direction: column;
  gap: 8px;
}

.color-palette button {
  width: 22px;
  height: 22px;
  border: 2px solid transparent;
  border-radius: 50%;
  padding: 0;
}

.color-palette button.is-active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--teal);
}

.stroke-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
}

.floating-toolbar.is-docked-left .stroke-selector {
  flex-direction: column;
  padding: 8px 5px;
}

.stroke-selector button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.stroke-selector button::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  content: "";
}

.stroke-selector button[data-width="6"]::before {
  width: 10px;
  height: 10px;
}

.stroke-selector button[data-width="10"]::before {
  width: 14px;
  height: 14px;
}

.stroke-selector button.is-active {
  outline: 2px solid rgba(11, 155, 150, 0.24);
}

.curve-controls,
.circle-controls {
  position: absolute;
  top: 16px;
  right: 74px;
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(203, 214, 226, 0.94);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(17, 31, 58, 0.14);
  padding: 8px;
  backdrop-filter: blur(14px);
}

.circle-controls {
  right: 72px;
}

.circle-measure {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border-radius: 11px;
  background: rgba(11, 155, 150, 0.1);
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 950;
  padding: 0 12px;
  white-space: nowrap;
}

.curve-controls button,
.circle-controls button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  background: #eef3f7;
  color: #102044;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0 12px;
  touch-action: manipulation;
}

.curve-controls button:hover,
.curve-controls button:focus-visible,
.circle-controls button:hover,
.circle-controls button:focus-visible {
  background: rgba(11, 155, 150, 0.12);
  color: var(--teal-dark);
}

.curve-controls button:disabled,
.circle-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.curve-controls-divider {
  width: 1px;
  height: 30px;
  background: var(--line);
}

.keyboard-bar {
  display: none;
  position: absolute;
  bottom: 14px;
  left: 34px;
  z-index: 10;
  width: min(380px, calc(100% - 300px));
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 14px;
}

.keyboard-bar input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.page-nav {
  position: absolute;
  right: 28px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-nav strong {
  min-width: 64px;
  text-align: center;
}

.page-nav .icon-button.is-active {
  border-color: rgba(11, 155, 150, 0.28);
  background: rgba(11, 155, 150, 0.12);
  color: var(--teal-dark);
}

body.is-focus-mode {
  overflow: hidden;
}

body.is-focus-mode .device-frame {
  position: fixed;
  inset: 0;
  z-index: 1000;
  min-height: 100vh;
  padding: 0;
  background: #f2f5f8;
}

body.is-focus-mode .app-root {
  height: 100vh;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.is-focus-mode .sidebar,
body.is-focus-mode .notes-column,
body.is-focus-mode .workspace-topbar,
body.is-focus-mode .trace-panel {
  display: none;
}

body.is-focus-mode .canvas-workspace {
  grid-column: 1;
  grid-row: 1;
}

body.is-focus-mode .paper-stage {
  padding: 10px 60px 58px 92px;
}

body.is-focus-mode .paper-page {
  width: min(100%, 1540px);
  height: 100%;
  min-height: 0;
  border-radius: 14px;
}

body.is-focus-mode .marker-strip {
  right: 12px;
  gap: 7px;
}

body.is-focus-mode .page-nav {
  right: 18px;
  bottom: 14px;
}

.trace-panel {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 40;
  display: none;
  width: min(390px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.trace-panel.is-open {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.panel-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
}

.panel-tabs button {
  position: relative;
  border: 0;
  background: transparent;
  color: #2b3550;
  font-weight: 850;
  padding: 10px;
}

.panel-tabs button.is-active {
  color: var(--teal-dark);
}

.panel-tabs button.is-active::after {
  position: absolute;
  right: 24px;
  bottom: 0;
  left: 24px;
  height: 2px;
  border-radius: 99px;
  background: var(--teal);
  content: "";
}

.panel-pane {
  display: none;
  overflow: auto;
  padding: 16px;
}

.panel-pane.is-active {
  display: grid;
  gap: 14px;
}

.timeline-list,
.saved-reflections,
.reflection-form {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  border-left: 3px solid var(--teal);
  border-radius: 0 10px 10px 0;
  background: var(--panel-soft);
  padding: 10px 12px;
}

.timeline-item time {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.timeline-item strong {
  display: block;
  font-size: 0.84rem;
}

.timeline-item span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.reflection-form label,
.settings-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 820;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
}

.reflection-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 12px;
}

.reflection-card strong {
  display: block;
  margin-bottom: 6px;
}

.reflection-card p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(12, 18, 32, 0.36);
}

.settings-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 50;
  display: grid;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  gap: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
  transform: translate(-50%, -50%);
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.settings-head p,
.settings-head h2 {
  margin: 0;
}

.settings-head p {
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-grid {
  display: grid;
  gap: 14px;
}

.demo-notice {
  border: 1px solid rgba(11, 155, 150, 0.25);
  border-radius: 12px;
  background: rgba(11, 155, 150, 0.08);
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 760;
  line-height: 1.45;
  padding: 12px 14px;
}

.danger-button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: #ffffff;
  font-weight: 850;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  display: none;
  max-width: min(520px, calc(100vw - 32px));
  border-radius: 999px;
  background: #101a33;
  color: #ffffff;
  font-weight: 850;
  padding: 10px 16px;
  transform: translateX(-50%);
}

.toast.is-visible {
  display: block;
}

body.theme-light {
  --screen: #ffffff;
  --paper: #fffdf7;
}

body.theme-dark {
  --bg: #101722;
  --screen: #111827;
  --panel: #172033;
  --panel-soft: #202b40;
  --paper: #f6f0df;
  --ink: #eef4ff;
  --muted: #aab5c8;
  --line: #334155;
  color-scheme: dark;
}

body.theme-dark .sidebar,
body.theme-dark .workspace-topbar,
body.theme-dark .notes-column,
body.theme-dark .trace-panel,
body.theme-dark .settings-modal,
body.theme-dark .icon-button,
body.theme-dark .pill-button,
body.theme-dark .avatar-button,
body.theme-dark .search-box input,
body.theme-dark textarea,
body.theme-dark select {
  background: var(--panel);
  color: var(--ink);
}

body.theme-dark .paper-stage {
  background: #0f172a;
}

body.trace-soft .wrong-formula,
body.trace-soft .mistake-row,
body.trace-soft .red-note,
body.trace-soft .trace-cross-overlay {
  opacity: 0.48;
}

body.trace-minimal .wrong-formula,
body.trace-minimal .mistake-row,
body.trace-minimal .red-note,
body.trace-minimal .trace-cross-overlay,
body.trace-minimal .question-line {
  opacity: 0.18;
}

@media (max-width: 1280px) {
  .app-root {
    grid-template-columns: 78px 196px minmax(620px, 1fr);
  }

  .sidebar {
    padding: 16px 8px 12px;
  }

  .marker-strip strong {
    display: block;
  }
}

@media (max-width: 980px) {
  .device-frame {
    padding: 0;
  }

  .app-root {
    height: 100vh;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto minmax(680px, 1fr);
    border: 0;
    border-radius: 0;
  }

  .sidebar {
    grid-row: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-topbar,
  .notes-column,
  .canvas-workspace {
    grid-column: 1;
    grid-row: auto;
  }

  .workspace-topbar {
    flex-wrap: wrap;
    min-height: var(--topbar-height);
    padding: 14px;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .notes-column {
    max-height: 420px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .paper-stage {
    overflow: auto;
    place-items: start center;
  }

  .paper-page {
    width: 960px;
    height: 700px;
  }

  .floating-toolbar {
    position: absolute;
  }
}

@media (max-width: 680px) {
  .sidebar {
    gap: 16px;
  }

  .brand img {
    width: 150px;
  }

  .main-nav {
    grid-template-columns: 1fr;
  }

  .top-actions {
    gap: 8px;
  }

  .save-status {
    width: 100%;
  }

  .marker-strip {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .floating-toolbar {
    max-width: calc(100vw - 24px);
  }

  .keyboard-bar {
    display: none;
  }
}
