:root {
  --bg: #eeeeef;
  --panel: #ffffff;
  --text: #151515;
  --muted: #999999;
  --accent: #D54D24;
  --line: #e5e5e5;
  --button: #111111;
  --blue: #D54D24;
}

@font-face {
  font-family: "TextbookKai";
  src: url("./assets/fonts/official/硬笔-教材规范楷体.TTF") format("truetype");
  font-weight: 400;
  font-style: normal;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #d9d9dc;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.js-more-font {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: linear-gradient(90deg, #d7d7da, #f3f3f4 22%, #f3f3f4 78%, #d7d7da);
}

.phone-frame {
  width: min(100vw, 478px);
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.screen {
  display: none;
  min-height: 100vh;
  padding-bottom: 86px;
}

.screen.is-active {
  display: block;
}

.screen-home {
  padding-bottom: 18px;
}

.hero-bar {
  height: 106px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 14px 13px;
  color: #fff;
  background:
    linear-gradient(rgba(20, 20, 20, 0.36), rgba(20, 20, 20, 0.40)),
    url("./assets/top-bg@2x.png") center / cover no-repeat,
    #585858;
}

.hero-bar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.mini-program-menu {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 86px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 18px;
  background: rgba(20, 20, 20, 0.2);
}

.mini-program-more,
.mini-program-close {
  display: block;
  position: relative;
  width: 28px;
  height: 28px;
}

.mini-program-more {
  border-right: 1px solid rgba(255, 255, 255, 0.42);
}

.mini-program-more::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 7px 0 #fff, 14px 0 #fff;
}

.mini-program-close::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid #fff;
  border-radius: 50%;
}

.icon-button {
  position: absolute;
  bottom: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  place-items: center;
}

.icon-button img {
  max-width: 18px;
  max-height: 22px;
  object-fit: contain;
  display: block;
}

.icon-button:first-child img {
  width: 10px;
  height: 18px;
}

.icon-button:first-child {
  left: 7px;
}

.icon-button:last-child {
  right: 11px;
}

.search-wrap {
  padding: 12px 14px;
  background: #f4f4f5;
}

.search-box {
  height: 46px;
  border: 1px solid #b9b9b9;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 0 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.search-icon-drawn {
  position: relative;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  border: 3px solid #8d8d8d;
  border-radius: 50%;
  background: transparent;
  outline: 0;
  box-shadow: none;
  pointer-events: none;
}

.search-icon-drawn::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 3px;
  right: -8px;
  bottom: -4px;
  border-radius: 999px;
  background: #8d8d8d;
  transform: rotate(45deg);
  transform-origin: center;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 16px;
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-clear-button {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #dedede;
  cursor: pointer;
}

.search-clear-button::before,
.search-clear-button::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 8.5px;
  width: 10px;
  height: 1px;
  border-radius: 999px;
  background: #fff;
}

.search-clear-button::before {
  transform: rotate(45deg);
}

.search-clear-button::after {
  transform: rotate(-45deg);
}

.search-clear-button[hidden] {
  display: none;
}

.search-box > button:not(.search-clear-button) {
  min-width: 68px;
  height: 36px;
  border: 0;
  border-radius: 20px;
  color: #fff;
  background: #111;
  font-weight: 700;
  outline: 0;
  box-shadow: none;
}

.tabs {
  height: 53px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  position: relative;
  height: 100%;
  border: 0;
  background: transparent;
  color: #111;
  font-weight: 700;
  font-size: 15px;
}

.tabs .is-active {
  color: var(--accent);
}

.tabs .is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.template-panel {
  margin: 12px 14px 10px;
  padding: 14px 20px 18px;
  background: #fff;
  border-radius: 10px;
  min-height: 744px;
}

.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 42px;
  row-gap: 30px;
}

.template-card {
  border: 0;
  padding: 0;
  background: transparent;
  text-align: center;
  color: var(--text);
}

.template-thumb {
  width: 100%;
  aspect-ratio: 210 / 297;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 13px 22px rgba(0, 0, 0, 0.18);
}

.template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.template-thumb::before {
  content: "";
  width: 17px;
  height: 17px;
  border: 2px solid #8aa0a8;
  border-radius: 2px;
  background:
    linear-gradient(135deg, transparent 45%, #8aa0a8 46% 55%, transparent 56%),
    radial-gradient(circle at 65% 35%, #8aa0a8 0 2px, transparent 3px);
}

.template-card.selected .template-thumb {
  background: #fff;
  box-shadow: 0 13px 22px rgba(0, 0, 0, 0.18), inset 0 0 0 1px #e6e6e6;
}

.template-card.selected .template-thumb::before {
  content: none;
  width: 78%;
  height: 78%;
  border: 1px solid #abd4ff;
  border-radius: 0;
  background:
    repeating-linear-gradient(to right, transparent 0 18px, #abd4ff 18px 19px),
    repeating-linear-gradient(to bottom, transparent 0 18px, #abd4ff 18px 19px),
    #fff;
}

.template-thumb:has(img)::before {
  content: none;
}

.template-card span {
  display: block;
  margin-top: 9px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.detail-form {
  padding: 10px 11px 14px;
}

.template-preview {
  position: relative;
  display: grid;
  justify-items: center;
  margin-bottom: 24px;
}

.template-favorite {
  position: absolute;
  top: 177px;
  left: calc(50% + 72px);
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
}

.template-favorite img {
  width: 19px;
  height: 22px;
  object-fit: contain;
}

.preview-card {
  width: 140px;
  aspect-ratio: 210 / 297;
  height: auto;
  border: 0;
  padding: 0;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 9px 18px rgba(0, 0, 0, 0.16);
}

.preview-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-viewer.is-open {
  display: flex;
}

.image-viewer-mask {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.72);
}

.image-viewer img {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 520px);
  max-height: 88vh;
  background: #fff;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.38);
}

.template-preview h2 {
  margin: 8px 0 0;
  font-size: 17px;
}

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
}

.line-select-toggle {
  color: var(--accent);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}

textarea::placeholder {
  color: #9b9b9b;
  font-size: 15px;
}

.text-input-wrap {
  position: relative;
  margin-top: 4px;
}

.line-shape-picker {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 10px;
  border-radius: 11px;
  background: #fff;
}

.line-shape-picker[hidden] {
  display: none;
}

.radical-picker {
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 0;
  max-height: 360px;
  padding: 0;
  overflow: hidden;
}

.radical-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 6px;
  border-right: 1px solid #f0f0f0;
  background: #fff;
}

.radical-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #111;
  font-size: 16px;
  font-weight: 700;
}

.radical-tabs button.is-active {
  background: var(--accent);
  color: #fff;
}

.radical-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 40px;
  align-content: start;
  gap: 8px;
  height: 360px;
  max-height: 360px;
  overflow-y: auto;
  padding: 10px;
  background: #fff;
}

.radical-option {
  min-height: 40px;
  border-width: 1px;
  border-radius: 8px;
  background: #fafafa;
}

.radical-option:has(input:checked) {
  z-index: 1;
}

.radical-option img {
  width: 42px;
  height: 30px;
}

.radical-selected-panel {
  margin-top: 8px;
  padding: 10px;
  border-radius: 11px;
  background: #fff;
}

.radical-selected-panel[hidden] {
  display: none;
}

.radical-selected-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #333;
  font-size: 14px;
  font-weight: 700;
}

.radical-selected-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.radical-selected-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  max-height: 154px;
  overflow-y: auto;
}

.radical-selected-list p {
  grid-column: 1 / -1;
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.radical-selected-item {
  position: relative;
  min-height: 40px;
  border: 1px solid #ececec;
  border-radius: 8px;
  background: #fafafa;
  display: grid;
  place-items: center;
}

.radical-selected-item img {
  width: 42px;
  height: 30px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.radical-selected-item span {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  line-height: 17px;
  text-align: center;
}

.line-shape-option {
  position: relative;
  min-height: 40px;
  border: 1px solid #ececec;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fafafa;
}

.line-shape-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.line-shape-option svg {
  width: 38px;
  height: 24px;
  overflow: visible;
}

.line-shape-option img {
  display: block;
  width: 42px;
  height: 30px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.line-shape-option path,
.line-shape-option line,
.line-shape-option circle,
.line-shape-option polyline {
  fill: none;
  stroke: #111;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-shape-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

textarea {
  width: 100%;
  height: 148px;
  padding: 14px 14px 28px;
  resize: none;
  border: 0;
  border-radius: 11px;
  outline: 0;
  background: #fff;
  font-size: 18px;
  line-height: 1.6;
}

.char-count {
  position: absolute;
  right: 13px;
  bottom: 9px;
  color: #a7a7a7;
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}

.input-limit-tip {
  position: absolute;
  left: 12px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8b8b8b;
  font-size: 12px;
  line-height: 1;
}

.input-limit-tip[hidden] {
  display: none;
}

.input-limit-tip span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #D54D24;
}

.input-limit-tip p {
  margin: 0;
}

fieldset {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

legend,
.logo-field span {
  margin-bottom: 7px;
  color: var(--muted);
  font-weight: 700;
}

.option-grid {
  display: grid;
  gap: 12px 16px;
  padding: 12px 9px;
  border-radius: 11px;
  background: #fff;
  font-weight: 700;
}

.option-grid-fonts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.font-fieldset {
  position: relative;
  margin-top: 20px;
}

.font-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #111;
  border-radius: 11px 11px 0 0;
  background: #fff;
}

.font-tab {
  min-height: 38px;
  border: 0;
  border-right: 1px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  font: inherit;
  font-weight: 700;
}

.font-tab:last-child {
  border-right: 0;
}

.font-tab.is-active {
  background: #111;
  color: #fff;
}

.font-tab-panel {
  position: relative;
  min-height: 78px;
  padding: 10px 8px 9px;
  border-radius: 0 0 11px 11px;
  background: #fff;
}

.font-tab-panel .option-grid {
  padding: 0;
  border-radius: 0;
}

.font-tab-panel .option-grid:empty {
  display: none;
}

.font-tab-panel label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.more-official-fonts,
.import-font-link {
  display: block;
  margin: 0;
  color: var(--blue);
  font-weight: 700;
}

.more-official-fonts,
.personal-font-actions {
  position: absolute;
  top: -68px;
  right: 0;
  z-index: 1;
}

.personal-font-actions {
  display: flex;
  justify-content: flex-end;
  gap: 22px;
  margin: 0;
}

.personal-font-actions .import-font-link {
  margin: 0;
}

.font-list-sheet {
  min-height: 430px;
  padding: 8px 10px calc(12px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.font-list-sheet .sheet-note {
  margin: 0;
}

.font-list-grid,
.font-manage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.official-font-browser {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  min-height: 375px;
  margin: 3px -2px 0;
  overflow: hidden;
}

.official-font-categories {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px 7px 4px 0;
  overflow: auto;
}

.official-font-category {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: #f1f1f2;
  color: #222;
  font-weight: 700;
}

.official-font-category.is-active {
  background: var(--accent);
  color: #fff;
}

.official-font-list {
  align-content: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 100%;
  max-height: 375px;
  margin: 0;
  padding: 14px 12px;
  overflow: auto;
  border-radius: 6px;
  background: #f1f1f2;
}

.official-font-list label {
  min-height: 32px;
  padding: 0;
  background: transparent;
}

.font-list-grid label,
.font-manage-item {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 6px;
  background: #f2f2f3;
  font-weight: 700;
}

.font-list-grid label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-manage-item {
  gap: 7px;
  cursor: grab;
}

.font-manage-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-remove-button {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  line-height: 18px;
}

.font-empty {
  margin: 0;
  color: #9a9a9a;
  font-weight: 700;
}

.personal-font-options:not(:empty) + .import-font-link,
.personal-font-options:not(:empty) ~ .import-font-link {
  margin-top: 10px;
}

.option-grid-line,
.option-grid-color,
.option-grid-paper,
.option-grid-trace-count,
.option-grid-blank-rows {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.option-grid-size,
.option-grid-trace-color {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-grid-page-number {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.option-grid-trace-color {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

label {
  min-width: 0;
}

input[type="radio"] {
  width: 13px;
  height: 13px;
  margin: 0 5px 0 0;
  accent-color: var(--accent);
}

.visual-option {
  position: relative;
  min-height: 42px;
  display: grid;
  place-items: center;
}

.visual-option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.grid-preview {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--grid-preview-color, #7db5ff);
  background: #fff;
}

.grid-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}

.visual-option input[type="radio"]:checked + .grid-preview,
.visual-option input[type="radio"]:checked + .color-dot {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.color-option {
  min-height: 32px;
}

.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.color-dot-red {
  background: #ef6b5f;
}

.color-dot-green {
  background: #25a844;
}

.color-dot-blue {
  background: #7db5ff;
}

.color-dot-black {
  background: #222;
}

.trace-dot-red {
  background: rgba(226, 58, 47, .36);
}

.trace-dot-gray {
  background: rgba(150, 150, 150, .42);
}

.occupancy-control {
  min-height: 62px;
  padding: 10px 7px 8px;
  border-radius: 11px;
  background: #fff;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: end;
  gap: 8px;
}

.occupancy-step {
  width: 38px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #333;
  font-size: 32px;
  line-height: 1;
  font-weight: 600;
  display: grid;
  place-items: center;
  padding: 0 0 5px;
}

.occupancy-slider-wrap {
  position: relative;
  height: 42px;
  display: grid;
  align-items: end;
}

.occupancy-slider-wrap output {
  position: absolute;
  left: var(--occupancy-pos, 60%);
  top: 0;
  transform: translateX(-50%);
  color: #777;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.occupancy-slider-wrap input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  outline: 0;
}

.occupancy-slider-wrap input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: #d8d8d8;
}

.occupancy-slider-wrap input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8.5px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.occupancy-slider-wrap input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: #d8d8d8;
}

.occupancy-slider-wrap input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.logo-field {
  display: block;
  margin-top: 23px;
}

.logo-field input {
  width: 100%;
  height: 48px;
  margin-top: 9px;
  border: 0;
  border-radius: 11px;
  padding: 0 10px;
  outline: 0;
  font-size: 15px;
}

.sticky-action-bar {
  position: fixed;
  width: min(100vw, 478px);
  margin: 0 auto;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 10px 11px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #eeeeef 0 78%, rgba(238, 238, 239, 0));
}

.primary-action {
  display: grid;
  place-items: center;
  width: 100%;
  height: 40px;
  margin-top: 0;
  border: 0;
  border-radius: 5px;
  color: #fff;
  background: var(--button);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.result-body {
  padding: 20px 12px 9px;
}

.paper-preview {
  background: #eeeeef;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 14px 0 18px;
  overflow: auto;
}

.server-rendered-copybook:not(img) {
  display: block;
  width: min(calc(100vw - 24px), 454px, calc((100vh - 190px) * var(--copybook-width-ratio)));
  aspect-ratio: var(--copybook-ratio);
  flex: 0 0 auto;
  background: #fff;
}

.server-rendered-copybook:not(img) > svg {
  display: block;
  width: 100%;
  height: 100%;
}

img.server-rendered-copybook {
  display: block;
  width: calc(100vw - 24px);
  height: auto;
  max-width: 454px;
  max-height: calc(100vh - 190px);
  object-fit: contain;
  flex: 0 0 auto;
  background: #fff;
}

.download-action {
  margin-top: 0;
  height: 43px;
  font-size: 18px;
  font-weight: 600;
}

.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
}

.bottom-sheet.is-open {
  display: block;
}

.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
}

.sheet-panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(100vw, 478px);
  transform: translateX(-50%);
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius: 14px 14px 0 0;
  background: #fff;
}

.sheet-panel-large {
  width: min(100vw, 478px);
  max-width: 100vw;
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.font-import-panel {
  padding-top: 8px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.font-import-panel .sheet-handle {
  margin-bottom: 8px;
}

.font-import-panel .sheet-head {
  justify-content: flex-end;
}

.font-import-panel .sheet-note {
  margin: 6px 0 12px;
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #d8d8d8;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-head h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
}

.sheet-close {
  border: 0;
  background: transparent;
  color: #777;
  font-size: 15px;
}

.quick-select-all {
  margin-right: 14px;
  color: var(--accent);
}

.sheet-note {
  margin: 12px 0 14px;
  color: #777;
  font-size: 14px;
  line-height: 1.5;
}

.font-file-picker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 8px;
  background: #f2f2f3;
  font-weight: 700;
}

.font-file-picker span {
  color: var(--blue);
}

.font-file-picker strong {
  min-width: 0;
  margin-left: 12px;
  overflow: hidden;
  color: #777;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#officialFontsSheet .sheet-head {
  justify-content: flex-end;
}

.font-file-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.import-font-action {
  margin-top: 14px;
  height: 42px;
}

.pinyin-choice-list {
  max-height: 48vh;
  overflow: auto;
  padding: 4px 0 2px;
}

.pinyin-choice-group {
  margin-top: 12px;
}

.pinyin-choice-group legend {
  width: 32px;
  height: 32px;
  margin: 0 0 8px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f3f3f4;
  color: #111;
  font-size: 20px;
  font-weight: 700;
}

.pinyin-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pinyin-options label {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 8px;
  background: #f6f6f7;
  font-weight: 700;
}

.pinyin-confirm-action {
  margin-top: 16px;
}

.quick-input-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  flex: 1;
}

.quick-tabs,
.quick-groups {
  overflow: auto;
  min-width: 0;
  max-height: calc(82vh - 82px);
  padding-bottom: 6px;
}

.quick-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-tabs button,
.quick-item {
  border: 0;
  border-radius: 8px;
  background: #f2f2f3;
  color: #222;
}

.quick-tabs button {
  min-height: 38px;
  padding: 0 8px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  line-height: 1.45;
}

.quick-tabs .is-active {
  color: #fff;
  background: var(--accent);
}

.quick-group {
  margin-bottom: 14px;
}

.quick-volume-select {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 100%;
  height: 38px;
  margin-bottom: 10px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  outline: 0;
  background: #f2f2f3;
  color: #222;
  font-size: 15px;
  font-weight: 700;
}

.quick-item {
  width: 100%;
  max-width: 100%;
  min-height: 38px;
  margin-bottom: 8px;
  padding: 8px 10px;
  text-align: left;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}

.quick-item strong {
  display: block;
  margin-bottom: 4px;
  color: #888;
  font-size: 15px;
  font-weight: 500;
}

.quick-item em {
  display: block;
  margin-bottom: 4px;
  color: #777;
  font-size: 14px;
  font-style: normal;
}

.quick-item span {
  display: block;
  color: #111;
  font-family: "TextbookKai", KaiTi, serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.55;
  white-space: pre-line;
}

.quick-groups .quick-item span {
  font-size: 22px;
}

.quick-pinyin-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
}

.quick-pinyin-groups .quick-pinyin-item {
  min-height: 42px;
  margin: 0;
  padding: 6px 4px;
  text-align: center;
}

.quick-pinyin-groups .quick-pinyin-item span {
  font-family: "Pinyinok", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

.quick-pinyin-groups .quick-pinyin-item.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.quick-groups .quick-item.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

@media (min-width: 900px) {
  .phone-frame {
    width: 478px;
    overflow: hidden;
  }
}

@media (max-width: 390px) {
  .template-grid {
    column-gap: 28px;
  }

  .option-grid-fonts,
  .option-grid-paper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
