html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f6fbff;
}

#layout,
#stage,
.v3d-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.v3d-container canvas {
  touch-action: none;
}

#lesson-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(237, 247, 255, 0.98)),
    radial-gradient(circle at 22% 16%, rgba(255, 232, 191, 0.42), transparent 32%),
    radial-gradient(circle at 82% 10%, rgba(152, 217, 255, 0.28), transparent 30%);
}

.ui-hidden #lesson-overlay {
  display: none;
}

#lesson-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#lesson-toolbar {
  position: absolute;
  top: 14px;
  bottom: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  pointer-events: none;
}

.title-block {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 2px;
  width: min(520px, calc(100% - 220px));
  text-align: center;
  color: #17304d;
}

.title-block strong {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0;
}

.title-block span {
  font-size: 15px;
  line-height: 1.35;
  color: #52637a;
}

.toolbar-actions {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

button {
  appearance: none;
  min-height: 44px;
  border: 1px solid rgba(30, 80, 130, 0.18);
  border-radius: 8px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.9);
  color: #17304d;
  box-shadow: 0 8px 20px rgba(35, 86, 130, 0.09);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

button:hover {
  background: #ffffff;
}

button:active {
  transform: translateY(1px);
}

.mode-select-wrap {
  display: inline-flex;
}

.mode-select-wrap select {
  appearance: auto;
  min-width: 92px;
  min-height: 44px;
  border: 1px solid rgba(30, 80, 130, 0.18);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.94);
  color: #17304d;
  box-shadow: 0 8px 20px rgba(35, 86, 130, 0.09);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#btn-play {
  background: #1f7ad4;
  color: #ffffff;
  border-color: rgba(31, 122, 212, 0.35);
}

.ruler-label,
.table-text,
.svg-label,
.formula-text {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

@media (max-width: 640px) {
  #lesson-toolbar {
    top: 10px;
    bottom: 10px;
    left: 10px;
    right: 10px;
    align-items: start;
    gap: 8px;
  }

  .title-block strong {
    font-size: 20px;
  }

  .title-block span {
    font-size: 13px;
  }

  .title-block {
    width: calc(100% - 20px);
  }

  .toolbar-actions {
    display: flex;
    gap: 7px;
  }

  button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 14px;
  }

  .mode-select-wrap select {
    min-width: 78px;
    min-height: 38px;
    padding: 0 8px;
    font-size: 14px;
  }
}
