.teacher-html5-tool {
  box-sizing: border-box;
  width: min(677px, 96vw);
  margin: 0 auto 18px;
  border: 1px solid #9bbbd8;
  background: #f7fbff;
  color: #24384a;
  font-family: Arial, Helvetica, sans-serif;
  text-align: left;
}

.teacher-html5-tool * {
  box-sizing: border-box;
}

.teacher-tool-shell {
  min-height: 438px;
  padding: 14px;
  background: linear-gradient(#ffffff, #f1f7fc);
}

.teacher-tool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #c7d9e8;
  padding-bottom: 10px;
}

.teacher-tool-title {
  margin: 0;
  color: #1a6ea5;
  font-size: 23px;
  line-height: 1.2;
}

.teacher-tool-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.teacher-button {
  border: 1px solid #1d6f9f;
  border-radius: 4px;
  background: #2585bb;
  color: #ffffff;
  cursor: pointer;
  font-weight: bold;
  padding: 7px 10px;
}

.teacher-button:hover,
.teacher-button:focus {
  background: #176b99;
}

.teacher-button.secondary {
  border-color: #8aa4b8;
  background: #ffffff;
  color: #26455c;
}

.teacher-button.secondary:hover,
.teacher-button.secondary:focus {
  background: #edf5fb;
}

.teacher-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.teacher-field {
  display: grid;
  gap: 4px;
}

.teacher-field label {
  color: #36536a;
  font-weight: bold;
}

.teacher-field input,
.teacher-event-row input {
  width: 100%;
  border: 1px solid #adc6da;
  border-radius: 4px;
  font-size: 14px;
  padding: 6px 7px;
}

.teacher-event-editor {
  border: 1px solid #c7d9e8;
  border-radius: 4px;
  background: #ffffff;
  margin-bottom: 12px;
  padding: 10px;
}

.teacher-event-row {
  display: grid;
  grid-template-columns: 90px 1fr 1.4fr 34px;
  gap: 6px;
  margin-bottom: 7px;
}

.teacher-icon-button {
  border: 1px solid #b9c9d5;
  border-radius: 4px;
  background: #ffffff;
  color: #7c2d2d;
  cursor: pointer;
  font-weight: bold;
}

.teacher-icon-button:hover,
.teacher-icon-button:focus {
  background: #fff0f0;
}

.teacher-preview {
  border: 1px solid #c7d9e8;
  border-radius: 4px;
  background: #ffffff;
  padding: 12px;
}

.timeline-print-title {
  margin: 0;
  color: #1f3c52;
  font-size: 22px;
  text-align: center;
}

.timeline-print-subtitle {
  margin: 4px 0 18px;
  color: #536b7d;
  text-align: center;
}

.timeline-axis {
  position: relative;
  min-height: 250px;
  padding: 20px 0;
}

.timeline-axis:before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 50%;
  border-top: 4px solid #3c88b8;
}

.timeline-item {
  position: relative;
  display: inline-block;
  width: 24%;
  min-height: 96px;
  margin: 0 0.3%;
  vertical-align: top;
}

.timeline-item:before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(50% - 7px);
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #e8942c;
  box-shadow: 0 0 0 1px #b56711;
}

.timeline-card {
  position: absolute;
  left: 0;
  right: 0;
  border: 1px solid #b9ccd9;
  border-radius: 4px;
  background: #f9fdff;
  padding: 7px;
  text-align: center;
}

.timeline-item:nth-child(odd) .timeline-card {
  bottom: calc(50% + 22px);
}

.timeline-item:nth-child(even) .timeline-card {
  top: calc(50% + 22px);
}

.timeline-date {
  color: #1b6f9f;
  font-weight: bold;
}

.timeline-label {
  margin-top: 3px;
  color: #20384b;
  font-weight: bold;
}

.timeline-desc {
  margin-top: 3px;
  color: #4b6172;
  font-size: 12px;
  line-height: 1.28;
}

.teacher-note {
  color: #526a7d;
  font-size: 12px;
  line-height: 1.35;
  margin: 8px 0 0;
}

.concept-map-preview {
  position: relative;
  min-height: 360px;
  border: 1px solid #c7d9e8;
  border-radius: 4px;
  background: #ffffff;
  overflow: hidden;
  padding: 12px;
}

.concept-map-preview svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.concept-node {
  position: absolute;
  display: grid;
  place-items: center;
  width: 132px;
  min-height: 62px;
  border: 2px solid #9bbbd8;
  border-radius: 6px;
  background: #f9fdff;
  color: #20384b;
  padding: 8px;
  text-align: center;
}

.concept-node strong {
  display: block;
  color: #1b6f9f;
  font-size: 14px;
}

.concept-node span {
  display: block;
  color: #4b6172;
  font-size: 12px;
  line-height: 1.2;
  margin-top: 3px;
}

.concept-center {
  left: 50%;
  top: 50%;
  width: 156px;
  min-height: 76px;
  margin-left: -78px;
  margin-top: -38px;
  border-color: #e8942c;
  background: #fff8ea;
}

.concept-editor-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 34px;
  gap: 6px;
  margin-bottom: 7px;
}

.concept-editor-row input {
  width: 100%;
  border: 1px solid #adc6da;
  border-radius: 4px;
  font-size: 14px;
  padding: 6px 7px;
}

.flow-preview {
  border: 1px solid #c7d9e8;
  border-radius: 4px;
  background: #ffffff;
  min-height: 360px;
  padding: 14px;
}

.flow-title {
  margin: 0 0 12px;
  color: #1f3c52;
  font-size: 22px;
  text-align: center;
}

.flow-step {
  position: relative;
  width: min(360px, 92%);
  margin: 0 auto 34px;
  border: 2px solid #87aeca;
  background: #f9fdff;
  color: #20384b;
  padding: 11px 14px;
  text-align: center;
}

.flow-step:after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -28px;
  width: 0;
  height: 0;
  margin-left: -8px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 16px solid #3c88b8;
}

.flow-step:last-child {
  margin-bottom: 0;
}

.flow-step:last-child:after {
  display: none;
}

.flow-step strong {
  display: block;
  color: #1b6f9f;
}

.flow-step span {
  display: block;
  color: #4b6172;
  font-size: 12px;
  line-height: 1.3;
  margin-top: 4px;
}

.flow-step.process {
  border-radius: 4px;
}

.flow-step.start,
.flow-step.end {
  border-radius: 999px;
  background: #eef8ef;
  border-color: #80b987;
}

.flow-step.decision {
  width: 250px;
  min-height: 92px;
  margin-top: 8px;
  margin-bottom: 42px;
  transform: rotate(45deg);
}

.flow-step.decision > div {
  transform: rotate(-45deg);
}

.flow-editor-row {
  display: grid;
  grid-template-columns: 88px 1fr 1.2fr 66px 34px;
  gap: 6px;
  margin-bottom: 7px;
}

.flow-editor-row input,
.flow-editor-row select {
  width: 100%;
  border: 1px solid #adc6da;
  border-radius: 4px;
  font-size: 14px;
  padding: 6px 7px;
}

.cause-editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr 34px;
  gap: 6px;
  margin-bottom: 7px;
}

.cause-editor-row input {
  width: 100%;
  border: 1px solid #adc6da;
  border-radius: 4px;
  font-size: 14px;
  padding: 6px 7px;
}

.cause-preview {
  border: 1px solid #c7d9e8;
  border-radius: 4px;
  background: #ffffff;
  min-height: 360px;
  padding: 14px;
}

.cause-title {
  margin: 0;
  color: #1f3c52;
  font-size: 22px;
  text-align: center;
}

.cause-subtitle {
  margin: 4px 0 14px;
  color: #536b7d;
  text-align: center;
}

.cause-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.cause-table th {
  border: 2px solid #6fa2c4;
  background: #eaf5fc;
  color: #1b5f88;
  font-size: 18px;
  padding: 9px;
}

.cause-table td {
  height: 70px;
  border: 1px solid #aecadf;
  color: #20384b;
  font-size: 15px;
  line-height: 1.35;
  padding: 10px;
  vertical-align: top;
}

.cause-arrow-cell {
  position: relative;
}

.cause-arrow-cell:after {
  content: "";
  position: absolute;
  right: -13px;
  top: 50%;
  width: 26px;
  height: 2px;
  background: #e8942c;
}

.bio-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bio-editor-grid .teacher-field.wide {
  grid-column: 1 / -1;
}

.teacher-field textarea {
  width: 100%;
  min-height: 64px;
  border: 1px solid #adc6da;
  border-radius: 4px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  padding: 6px 7px;
  resize: vertical;
}

.bio-preview {
  border: 1px solid #c7d9e8;
  border-radius: 4px;
  background: #ffffff;
  min-height: 360px;
  padding: 14px;
}

.bio-title {
  margin: 0;
  color: #1f3c52;
  font-size: 22px;
  text-align: center;
}

.bio-subtitle {
  margin: 4px 0 14px;
  color: #536b7d;
  text-align: center;
}

.bio-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bio-card {
  min-height: 94px;
  border: 1px solid #b8ccdc;
  border-radius: 4px;
  background: #f9fdff;
  padding: 10px;
}

.bio-card.wide {
  grid-column: 1 / -1;
}

.bio-card h3 {
  margin: 0 0 6px;
  color: #1b6f9f;
  font-size: 15px;
}

.bio-card p {
  margin: 0;
  color: #20384b;
  line-height: 1.35;
  white-space: pre-wrap;
}

@media (max-width: 680px) {
  .teacher-tool-top,
  .teacher-form-grid,
  .teacher-event-row,
  .concept-editor-row,
  .flow-editor-row,
  .cause-editor-row,
  .bio-editor-grid,
  .bio-card-grid {
    grid-template-columns: 1fr;
  }

  .teacher-tool-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .teacher-tool-actions {
    justify-content: flex-start;
  }

  .teacher-icon-button {
    min-height: 34px;
  }

  .concept-map-preview {
    min-height: 620px;
  }

  .concept-node,
  .concept-center {
    left: 50% !important;
    top: auto !important;
    margin-left: -66px;
  }

  .concept-center {
    margin-left: -78px;
    top: 18px !important;
  }

  .timeline-item {
    display: block;
    width: 100%;
    min-height: 92px;
    margin: 0;
  }

  .timeline-axis:before {
    left: 18px;
    right: auto;
    top: 0;
    bottom: 0;
    border-top: 0;
    border-left: 4px solid #3c88b8;
  }

  .timeline-item:before {
    left: 20px;
    top: 38px;
  }

  .timeline-card,
  .timeline-item:nth-child(odd) .timeline-card,
  .timeline-item:nth-child(even) .timeline-card {
    position: relative;
    top: auto;
    bottom: auto;
    margin-left: 48px;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  .teacher-preview,
  .teacher-preview *,
  .concept-map-preview,
  .concept-map-preview *,
  .flow-preview,
  .flow-preview *,
  .cause-preview,
  .cause-preview *,
  .bio-preview,
  .bio-preview * {
    visibility: visible;
  }

  .teacher-preview,
  .concept-map-preview,
  .flow-preview,
  .cause-preview,
  .bio-preview {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: 0;
  }
}
