.render-page {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  height: 100%;
  min-height: 0;
  padding:
    max(46px, calc(env(safe-area-inset-top) + 32px))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  color: var(--ink);
  background: var(--screen-wallpaper, var(--screen-default-wallpaper));
  background-position: center;
  background-size: cover;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  transform: none;
  transition: none;
}

.render-page.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.render-page button,
.render-page input,
.render-page textarea {
  font: inherit;
}

.render-page button:disabled,
.render-page input:disabled,
.render-import-trigger[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: .46;
}

.render-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 8px;
  border: 0;
  border-bottom: 4px solid #c8c8c6;
  border-radius: 16px;
  background: #dcdcd9;
  box-shadow: none;
}

.render-back,
.render-icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.render-back {
  background: transparent;
}

.render-back span {
  width: 12px;
  height: 12px;
  border-left: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translate(2px, -1px);
}

.render-title {
  min-width: 0;
  padding-left: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: .02em;
  line-height: 1;
}

.render-header-actions {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 4px;
  align-items: center;
}

.render-icon-button {
  position: relative;
  overflow: hidden;
}

.render-icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.render-icon-button[aria-pressed="true"] {
  color: #111;
  background: rgba(0, 0, 0, .10);
}

.render-import-file {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 32px;
}

.render-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1px 1px 20px;
  scrollbar-width: none;
}

.render-content::-webkit-scrollbar,
.render-entry-preview-output::-webkit-scrollbar,
.render-editor-body::-webkit-scrollbar,
.render-export-choices::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.render-group-list {
  display: grid;
  gap: 6px;
}

.render-empty,
.render-group-card,
.render-entry-card {
  border: 1px solid rgba(10, 10, 10, .055);
  background: rgba(255, 255, 255, .38);
  box-shadow: none;
}

.render-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 112px;
  padding: 14px;
  border-radius: 16px;
  color: rgba(8, 8, 8, .58);
  text-align: center;
}

.render-empty strong {
  color: rgba(8, 8, 8, .78);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 16px;
}

.render-empty span {
  font-size: 12px;
}

.render-group-card {
  display: grid;
  gap: 4px;
  padding: 6px;
  border-radius: 14px;
  contain: content;
}

.render-group-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(232, 232, 230, .72);
}

.render-group-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 30px;
  padding: 0 6px;
  color: inherit;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.render-group-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.render-group-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 12px;
}

.render-group-copy small {
  color: rgba(8, 8, 8, .52);
  font-size: 10px;
}

.render-group-toggle i {
  width: 9px;
  height: 9px;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  opacity: .58;
  transform: rotate(45deg) translate(-1px, -2px);
}

.render-group-card[data-expanded="true"] .render-group-toggle i {
  transform: rotate(225deg) translate(-2px, -1px);
}

.render-group-actions {
  display: grid;
  align-items: center;
}

.render-entry-list {
  display: grid;
  gap: 4px;
}

.render-entry-card {
  overflow: hidden;
  border-radius: 13px;
  contain: content;
}

.render-entry-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  background: rgba(255, 255, 255, .32);
}

.render-entry-toggle {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 6px 8px;
  color: inherit;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.render-entry-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.render-entry-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

.render-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.render-entry-chip {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(232, 232, 230, .78);
  color: rgba(8, 8, 8, .62);
  font-size: 9px;
  line-height: 1;
}

.render-entry-switch {
  position: relative;
  display: inline-grid;
  align-items: center;
  width: 34px;
  margin-right: 8px;
  height: 20px;
  cursor: pointer;
}

.render-entry-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.render-entry-switch span {
  position: relative;
  display: block;
  width: 34px;
  height: 20px;
  border: 1px solid rgba(10, 10, 10, .08);
  border-radius: 999px;
  background: #dededc;
  box-shadow: none;
}

.render-entry-switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #fafafa;
  box-shadow: none;
  transition: transform .14s ease;
}

.render-entry-switch input:checked + span {
  background: #868684;
}

.render-entry-switch input:checked + span::after {
  transform: translateX(14px);
}

.render-entry-switch input:focus-visible + span {
  outline: 2px solid rgba(8, 8, 8, .55);
  outline-offset: 2px;
}

.render-entry-preview {
  display: grid;
  gap: 4px;
  padding: 6px 8px 8px;
  border-top: 1px solid var(--line);
  background: rgba(247, 247, 246, .48);
}

.render-entry-preview-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.render-entry-rule,
.render-entry-preview-output,
.render-preview-box pre {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .50);
  color: rgba(8, 8, 8, .76);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.render-entry-preview-output {
  max-height: 64px;
  overflow: auto;
}

.render-square-button,
.render-dialog-actions button,
.render-editor-close {
  min-height: 30px;
  padding: 0 9px;
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.render-danger-button {
  color: #8f3528;
  background: rgba(245, 245, 243, .88);
}

.render-manage-only {
  display: none;
}

.render-page[data-manage-mode="true"] .render-manage-only {
  display: inline-grid;
  place-items: center;
}

.render-status,
.render-editor-status,
.render-export-status {
  min-height: 18px;
  margin: 0;
  color: rgba(8, 8, 8, .58);
  font-size: 12px;
  line-height: 1.5;
}

.render-status[data-tone="success"],
.render-editor-status[data-tone="success"],
.render-export-status[data-tone="success"] {
  color: #4f6b35;
}

.render-status[data-tone="error"],
.render-editor-status[data-tone="error"],
.render-export-status[data-tone="error"] {
  color: #8f3528;
}

.render-editor-sheet[hidden],
.render-dialog[hidden] {
  display: none;
}

.render-editor-sheet,
.render-dialog {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, .12);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: none;
}

.render-editor-sheet.open,
.render-dialog.open {
  opacity: 1;
  pointer-events: auto;
}

.render-editor-sheet {
  padding-top: max(66px, calc(env(safe-area-inset-top) + 54px));
}

.render-editor-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: rgba(247, 247, 246, .98);
  box-shadow: none;
  overflow: hidden;
  transform: none;
}

.render-editor-header {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 7px 12px;
  border-bottom: 4px solid #d4d4d2;
  background: #dededc;
}

.render-editor-header h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 17px;
}

.render-editor-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.render-editor-body {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px max(14px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.render-field {
  display: grid;
  gap: 5px;
}

.render-field span,
.render-radio-field legend,
.render-preview-box strong {
  color: rgba(8, 8, 8, .66);
  font-size: 12px;
  font-weight: 700;
}

.render-field input,
.render-field textarea {
  width: 100%;
  min-height: 36px;
  padding: 10px 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .62);
  box-shadow: none;
  outline: none;
  resize: vertical;
}

.render-field textarea {
  min-height: 70px;
}

.render-field input:focus,
.render-field textarea:focus {
  border-color: rgba(10, 10, 10, .24);
}

.render-radio-field {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.render-radio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.render-radio-grid.render-timing-grid {
  grid-template-columns: 1fr;
}

.render-radio-grid label {
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .46);
  color: rgba(8, 8, 8, .62);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.render-radio-grid small {
  color: rgba(8, 8, 8, .45);
  font-size: 10px;
  line-height: 1.35;
}

.render-radio-grid input {
  position: absolute;
  opacity: 0;
}

.render-radio-grid label:has(input:checked) {
  color: var(--ink);
  background: rgba(236, 236, 234, .92);
}

.render-preview-box {
  display: grid;
  gap: 5px;
}

.render-save-button {
  min-height: 40px;
  color: #fff;
  background: #3f3f3d;
}

.render-dialog {
  place-items: center;
  align-items: center;
  padding: max(54px, calc(env(safe-area-inset-top) + 40px)) 18px max(18px, env(safe-area-inset-bottom));
}

.render-dialog-card {
  display: grid;
  gap: 10px;
  width: min(100%, 320px);
  max-height: 88%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(247, 247, 246, .98);
  box-shadow: none;
}

.render-dialog-card h2,
.render-dialog-card p {
  margin: 0;
}

.render-dialog-card h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 17px;
}

.render-export-choices {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.render-export-group {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .48);
}

.render-export-entry-list {
  display: grid;
  gap: 5px;
  padding-left: 14px;
}

.render-export-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  color: rgba(8, 8, 8, .72);
  font-size: 12px;
}

.render-export-check input {
  width: 15px;
  height: 15px;
  accent-color: #111;
}

.render-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@supports not selector(:has(*)) {
  .render-radio-grid label {
    align-items: center;
    grid-template-columns: 16px minmax(0, 1fr);
  }

  .render-radio-grid input {
    position: static;
    opacity: 1;
  }
}
