/* 书写模板页面样式 */

.writing-preview {
  display: grid;
  gap: 12px;
}

.writing-preview__summary {
  padding: 14px 4px 2px;
}

.writing-sheet {
  background: #fff;
  border-radius: 12px;
}

.writing-sheet__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.writing-sheet__eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--kids-text-muted);
  margin-bottom: 6px;
}

.writing-sheet__title {
  font-family: var(--kids-font-display);
  font-size: 24px;
  line-height: 1.2;
}

.writing-sheet__meta {
  display: grid;
  gap: 6px;
  text-align: right;
  font-size: 12px;
  color: var(--kids-text-secondary);
}

.writing-sheet__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.writing-grid {
  display: grid;
  gap: 0;
  justify-content: center;
}

.writing-cell {
  border: 1px solid #77b56b;
  background: #fff;
}

.writing-cell__body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--writing-cell-size);
  height: var(--writing-cell-size);
  overflow: hidden;
}

.writing-cell__body::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, transparent calc(50% - 0.5px), rgba(119, 181, 107, 0.78) calc(50% - 0.5px), rgba(119, 181, 107, 0.78) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), rgba(119, 181, 107, 0.78) calc(50% - 0.5px), rgba(119, 181, 107, 0.78) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  pointer-events: none;
}

.writing-cell--mi .writing-cell__body::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(45deg, transparent calc(50% - 0.5px), rgba(119, 181, 107, 0.55) calc(50% - 0.5px), rgba(119, 181, 107, 0.55) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(-45deg, transparent calc(50% - 0.5px), rgba(119, 181, 107, 0.55) calc(50% - 0.5px), rgba(119, 181, 107, 0.55) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  pointer-events: none;
}

.writing-cell--pinyin {
  display: grid;
  grid-template-rows: calc(var(--writing-cell-size) * 0.42) var(--writing-cell-size);
}

.writing-cell__pinyin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--writing-cell-size);
  min-height: calc(var(--writing-cell-size) * 0.42);
  font-size: 11px;
  color: rgba(33, 48, 71, 0.48);
  border-bottom: 1px solid rgba(119, 181, 107, 0.92);
  background:
    linear-gradient(to bottom, rgba(119, 181, 107, 0.9), rgba(119, 181, 107, 0.9)) top/100% 1px no-repeat,
    linear-gradient(to bottom, transparent 33.33%, rgba(119, 181, 107, 0.55) 33.33%, rgba(119, 181, 107, 0.55) 34.33%, transparent 34.33%, transparent 66.66%, rgba(119, 181, 107, 0.55) 66.66%, rgba(119, 181, 107, 0.55) 67.66%, transparent 67.66%);
}

.writing-cell__char {
  position: relative;
  z-index: 1;
  font-family: 'KaiTi', 'STKaiti', 'Kaiti SC', serif;
  font-size: calc(var(--writing-cell-size) * 0.58);
  color: rgba(73, 85, 102, 0.28);
  line-height: 1;
}

@media (max-width: 767px) {
  .writing-sheet__header {
    flex-direction: column;
  }

  .writing-sheet__meta {
    text-align: left;
  }
}

@media print {
  .writing-preview__summary {
    display: none !important;
  }

  .writing-sheet {
    border-radius: 0 !important;
  }

  .writing-sheet__title {
    font-size: 20pt;
  }

  .writing-cell,
  .writing-cell__pinyin {
    border-color: #66a65d !important;
  }
}
