.stationery-overlay {
  --stationery-editor-line: rgb(111 110 86 / .23);
  --stationery-editor-sage: #64744d;
  --stationery-editor-sage-soft: #edf0e5;
  --stationery-editor-paper: #fffcf5;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: rgb(32 31 25 / .55); display: flex; align-items: center; justify-content: center;
}
.stationery-overlay.hidden { display: none; }
.stationery-dialog { width: min(1020px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--stationery-editor-paper); color: var(--md-sys-color-on-surface, #373a30); border: 1px solid rgb(255 255 255 / .5); border-radius: 24px; overflow: hidden; box-shadow: 0 24px 80px #0003; }
.stationery-header, .stationery-footer { flex: 0 0 auto; padding: 17px 24px; background: inherit; }
.stationery-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--stationery-editor-line); }
.stationery-eyebrow { font-size: 10px; letter-spacing: .14em; color: #778063; margin: 0 0 5px; }
.stationery-header h2 { font-size: 23px; font-family: var(--font-serif, Georgia, serif); margin: 0; }
.stationery-dialog button { cursor: pointer; min-height: 44px; border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.stationery-dialog button:disabled { cursor: default; opacity: .55; }
.stationery-dialog button:focus-visible, .stationery-dialog input:focus-visible { outline: 3px solid #87985e; outline-offset: 2px; }
.stationery-dialog-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px 24px 28px; }
.stationery-section { padding-bottom: 18px; }
.stationery-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 11px; }
.stationery-section-heading h3 { margin: 0; font: 650 16px/1.4 var(--font-serif, Georgia, serif); color: inherit; }
.stationery-section-heading > p { max-width: 330px; margin: 0; color: color-mix(in srgb, currentColor 68%, transparent); font-size: 11px; line-height: 1.5; text-align: right; }
.stationery-collections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stationery-dialog .stationery-collection { min-width: 0; padding: 10px; display: flex; flex-direction: column; align-items: stretch; gap: 5px; border: 1px solid var(--stationery-editor-line); background: rgb(171 160 123 / .06); text-align: left; }
.stationery-collection[aria-pressed="true"] { border-color: #75865a; box-shadow: inset 0 0 0 1px #75865a; background: var(--stationery-editor-sage-soft); }
.stationery-collection strong { min-height: 2.7em; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.stationery-collection > span:last-child { color: color-mix(in srgb, currentColor 67%, transparent); font-size: 12px; line-height: 1.4; }
.stationery-collection-preview { position: relative; display: block; height: 92px; overflow: hidden; border: 1px solid rgb(111 110 86 / .18); border-radius: 7px; color: #383a37; background: #fffdf8; }
.stationery-collection-preview[data-paper="ruled"] { background-image: repeating-linear-gradient(transparent 0 13px, rgb(99 104 96 / .15) 14px); }
.stationery-collection-preview[data-paper="grid"] { background-image: linear-gradient(rgb(99 104 96 / .11) 1px, transparent 1px), linear-gradient(90deg, rgb(99 104 96 / .11) 1px, transparent 1px); background-size: 12px 12px; }
.stationery-collection-preview[data-collection="mono-note"] { color: #202322; background-color: #fafaf7; }
.stationery-collection-preview[data-collection="pastel-memo"] { color: #6a526c; background-color: #fff1f8; }
.stationery-collection-preview[data-collection="travel-notebook"] { color: #55422d; background-color: #ead3ae; }
.stationery-collection-preview[data-frame="print"] { box-shadow: inset 0 0 0 6px #fffdf8; }
.stationery-collection-preview[data-frame="line"] { box-shadow: inset 0 0 0 1px #53534c, inset 0 0 0 5px currentColor, inset 0 0 0 6px #fff8; }
.stationery-collection-preview[data-frame="rounded"] { border-radius: 15px; }
.stationery-collection-preview[data-frame="tape"]::before { position: absolute; z-index: 2; top: 2px; left: 50%; width: 44px; height: 11px; content: ''; background: #d8c69fcc; transform: translateX(-50%) rotate(-3deg); }
.stationery-collection-photo { position: absolute; inset: 12px 48% 29px 10px; background: linear-gradient(145deg, #d7dfcc 50%, #aab99a 51%); border-radius: 3px; }
.stationery-collection-copy { position: absolute; right: 9px; bottom: 13px; left: 56%; font-size: 9px; line-height: 1.35; }
.stationery-collection-preview[data-font="serif"] .stationery-collection-copy { font-family: "Maru Buri", MaruBuri, serif; }
.stationery-collection-preview[data-font="soft"] .stationery-collection-copy { font-family: "Oru Gowun Dodum", sans-serif; }
.stationery-collection-preview[data-font="handwriting"] .stationery-collection-copy { font: 13px/1.1 "Oru Nanum Pen", serif; }
.stationery-collection-preview img { position: absolute; z-index: 3; right: 5px; top: 5px; width: 30px; height: 30px; }
.stationery-collection-navigation { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.stationery-collection-navigation span { font-size: 11px; line-height: 1.4; text-align: center; }
.stationery-dialog .stationery-collection-navigation button { min-height: 40px; padding: 6px 10px; }
.stationery-description { font-size: 12px; margin: 9px 2px 0; line-height: 1.6; opacity: .76; }
.stationery-workspace { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(360px, .94fr); align-items: start; gap: 24px; padding-top: 18px; border-top: 1px solid var(--stationery-editor-line); }
.stationery-preview-pane { position: sticky; top: 0; min-width: 0; }
.stationery-preview-label, .stationery-tray-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; }
.stationery-hint { font-size: 11px; opacity: .7; margin-top: 10px; line-height: 1.6; }
#stationery-preview .stationery-paper:empty::before { content: '아직 이야기가 없어요.\A스티커부터 붙여도 좋아요.'; white-space: pre-line; color: var(--stationery-muted); font-size: 14px; line-height: 1.8; }
.stationery-materials { margin-bottom: 20px; }
.stationery-materials-heading { align-items: start; margin-bottom: 4px; }
.stationery-material-group { min-width: 0; margin: 0; padding: 12px 0 14px; border: 0; border-bottom: 1px solid var(--stationery-editor-line); }
.stationery-material-group legend { width: 100%; margin-bottom: 10px; padding: 0; font-size: 14px; font-weight: 650; line-height: 1.4; }
.stationery-material-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.stationery-font-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stationery-dialog .stationery-material-choice { min-width: 0; min-height: 78px; padding: 7px; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 6px; border: 1px solid var(--stationery-editor-line); background: rgb(255 255 255 / .34); text-align: left; }
.stationery-material-choice[aria-checked="true"] { border-color: #718255; box-shadow: inset 0 0 0 1px #718255; background: var(--stationery-editor-sage-soft); }
.stationery-material-choice strong { font-size: 12px; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.stationery-material-sample { position: relative; display: grid; place-items: center; width: 100%; height: 40px; overflow: hidden; border-radius: 5px; color: #4a4e40; background-color: #fffdf7; }
.stationery-paper-choice .stationery-material-sample { border: 1px solid rgb(128 120 90 / .24); }
.stationery-paper-choice .stationery-material-sample[data-paper="ruled"] { background-image: repeating-linear-gradient(transparent 0, transparent 9px, rgb(115 128 85 / .2) 10px); }
.stationery-paper-choice .stationery-material-sample[data-paper="grid"] { background-image: linear-gradient(rgb(115 128 85 / .13) 1px, transparent 1px), linear-gradient(90deg, rgb(115 128 85 / .13) 1px, transparent 1px); background-size: 9px 9px; }
.stationery-frame-choice .stationery-material-sample { padding: 6px; background: #e9eadf; }
.stationery-frame-choice .stationery-material-sample > span { display: block; width: 100%; height: 100%; background: linear-gradient(145deg, #cdd7ba 50%, #aab997 51%); }
.stationery-frame-choice .stationery-material-sample[data-frame="print"] > span { border: 4px solid #fffdf8; box-shadow: 0 1px 2px rgb(50 45 35 / .15); }
.stationery-frame-choice .stationery-material-sample[data-frame="tape"] > span { transform: rotate(-1deg); border: 1px solid rgb(109 98 71 / .17); box-shadow: 7px -5px 0 -3px #d8c69f, -7px 5px 0 -3px #d8c69f; }
.stationery-frame-choice .stationery-material-sample[data-frame="line"] > span { border: 1px solid #5d5d55; box-shadow: inset 0 0 0 3px #fffdf8, inset 0 0 0 4px #77766c66; }
.stationery-frame-choice .stationery-material-sample[data-frame="rounded"] > span { border-radius: 9px; }
.stationery-font-choice .stationery-material-sample { justify-content: start; padding: 0 8px; border: 1px solid rgb(128 120 90 / .16); font-size: 16px; white-space: nowrap; }
.stationery-font-choice .stationery-material-sample[data-font="default"] { font-family: Pretendard, "Noto Sans KR", sans-serif; }
.stationery-font-choice .stationery-material-sample[data-font="serif"] { font-family: "Maru Buri", MaruBuri, AppleMyungjo, serif; }
.stationery-font-choice .stationery-material-sample[data-font="soft"] { font-family: "Oru Gowun Dodum", Pretendard, "Noto Sans KR", sans-serif; }
.stationery-font-choice .stationery-material-sample[data-font="handwriting"] { font: 21px/1 "Oru Nanum Pen", AppleMyungjo, serif; }
.stationery-tray-heading h3 { font-size: 14px; font-weight: 600; }
.stationery-tray-heading div { display: flex; gap: 2px; }
.stationery-dialog .stationery-tray-heading button { padding: 5px; font-size: 11px; }
.stationery-stickers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.stationery-dialog .stationery-sticker-choice { padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 1px solid transparent; background: #a7997410; }
.stationery-dialog .stationery-sticker-choice:hover { border-color: var(--stationery-editor-line); }
.stationery-sticker-choice img { width: 48px; height: 48px; }
.stationery-sticker-choice span { font-size: 10px; overflow-wrap: anywhere; }
.stationery-selection { margin-top: 14px; padding: 12px; border: 1px solid #85876d44; border-radius: 12px; }
.stationery-selection p { font-size: 12px; margin-bottom: 3px; }
.stationery-selection-help { display: block; margin-bottom: 10px; font-size: 11px; line-height: 1.5; opacity: .72; }
.stationery-position-control { display: none !important; }
.stationery-selection label { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.stationery-selection input { width: 68%; min-height: 30px; accent-color: #788755; }
.stationery-selected { outline: 2px dashed #87985e; outline-offset: 4px; }
.stationery-footer { border-top: 1px solid var(--stationery-editor-line); }
.stationery-footer > p { font-size: 12px; min-height: 18px; margin-bottom: 10px; }
.stationery-footer > div { display: flex; gap: 8px; justify-content: flex-end; }
#stationery-apply { background: #59673f; color: #fffdf6; padding: 10px 24px; }
.stationery-write-entry { position: relative; flex: 0 0 44px; width: 44px; min-width: 44px; min-height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid rgb(118 126 91 / .28); border-radius: 12px; color: #66774b; background: #fbf8ee; }
.stationery-write-entry .material-symbols-outlined { font-size: 22px; }
.stationery-write-count { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 4px; border: 1px solid #fbf8ee; border-radius: 999px; color: #fffef8; background: #65754c; font: 700 9px/1 Pretendard, sans-serif; }
.stationery-writing-ruled { background-image: repeating-linear-gradient(transparent 0, transparent 29px, #88966b22 30px); }
.stationery-writing-grid { background-image: linear-gradient(#88966b18 1px, transparent 1px), linear-gradient(90deg, #88966b18 1px, transparent 1px); background-size: 22px 22px; }
[data-stationery-font="serif"] #journal-body-text { font-family: 'Maru Buri', MaruBuri, Lora, AppleMyungjo, serif; }
[data-stationery-font="soft"] #journal-body-text { font-family: "Oru Gowun Dodum", Pretendard, "Noto Sans KR", sans-serif; }
[data-stationery-font="handwriting"] #journal-body-text { font-family: "Oru Nanum Pen", 'Maru Buri', MaruBuri, AppleMyungjo, serif; font-size: 21px; line-height: 1.65; }
#stationery-read-surface .stationery-surface { box-shadow: none; }
.dark .stationery-overlay { --stationery-editor-line: rgb(218 220 192 / .17); --stationery-editor-sage-soft: #343a2c; --stationery-editor-paper: #252821; }
.dark .stationery-dialog { color: #eeeede; }
.dark .stationery-eyebrow, .dark .stationery-write-entry { color: #bac99a; }
.dark .stationery-write-entry { border-color: rgb(190 200 158 / .22); background: #2d3128; }
.dark .stationery-write-count { border-color: #2d3128; background: #aebd8b; color: #24271f; }
.dark .stationery-material-sample { color: #e8e8d9; background-color: #30342a; }
.dark .stationery-frame-choice .stationery-material-sample { background: #363a30; }
@media (max-width: 639px) {
  .stationery-overlay { padding-left: 8px; padding-right: 8px; }
  .stationery-dialog { border-radius: 20px; }
  .stationery-header, .stationery-footer { padding: 14px 16px; }
  .stationery-dialog-scroll { padding: 15px 16px 22px; }
  .stationery-section-heading { display: block; }
  .stationery-section-heading > p { max-width: none; margin-top: 3px; text-align: left; }
  .stationery-workspace { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .stationery-preview-pane { position: static; }
  .stationery-material-options { gap: 6px; }
  .stationery-dialog .stationery-material-choice { min-height: 72px; padding: 6px; }
  .stationery-material-sample { height: 36px; }
  .stationery-footer > div { width: 100%; }
  .stationery-footer > div > button { flex: 1; }
}

@media (max-width: 767px) {
  .stationery-collections { display: flex; gap: 10px; margin-inline: -16px; padding: 2px 16px 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .stationery-dialog .stationery-collection { flex: 0 0 min(76vw, 272px); scroll-snap-align: start; }
  .stationery-collection strong { font-size: 15px; }
}

@media (min-width: 768px) {
  .stationery-collection-navigation { display: none; }
}
@media (min-width: 640px) and (max-height: 480px) {
  .stationery-overlay {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .stationery-header { padding: 6px 16px; }
  .stationery-dialog-scroll { padding: 12px 24px 18px; }
  .stationery-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
  }
  .stationery-footer > p { min-height: 0; margin: 0; line-height: 1.4; }
  .stationery-footer > button { white-space: nowrap; }
  .stationery-footer > div { display: contents; }
  #stationery-apply { white-space: nowrap; }
}
@media (max-height: 700px) {
  html[data-ios-text-scale]:not([data-ios-text-scale="1"]) .stationery-dialog {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  html[data-ios-text-scale]:not([data-ios-text-scale="1"]) .stationery-dialog-scroll {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
  }
}

/* A decorated entry is one photo-and-paper scene; the existing carousel is moved into its canvas. */
.stationery-read-placeholder {
  display: grid;
  place-items: center;
  width: min(calc(100vw - 32px), 720px);
  min-height: min(48dvh, 360px);
  margin-inline: auto;
  border: 1px solid var(--oru-border-subtle);
  border-radius: 10px;
  background: var(--oru-surface-ivory);
  color: var(--oru-text-muted);
  font-size: 13px;
}
#panel-mode-read.stationery-read-loading #panel-read-media { display: none; }
#panel-mode-read.stationery-active { display: flex; flex-direction: column; gap: 12px; }
#panel-mode-read.stationery-active.hidden { display: none; }
#panel-mode-read.stationery-active .inhwa-read-content { display: flex; flex-direction: column; gap: 8px; width: 100%; min-width: 0; }
/* The letter paper's only width rule. The tag row below shares its width and
   sits 8px under it, so it reads as part of the paper. */
#panel-mode-read.stationery-active :is(#stationery-read-surface, .inhwa-read-paper) { width: min(calc(100% - 2 * var(--oru-read-gutter, 0px)), 720px); max-width: 100%; margin-inline: auto; }
#panel-mode-read.stationery-active .inhwa-read-paper { margin-block: 0; padding: 0 2px 8px; background: transparent; border: 0; box-shadow: none; }
#panel-mode-read.stationery-active .inhwa-read-tag-section { margin-top: 0; }
#panel-mode-read.stationery-active #panel-read-media { padding: 0; border: 0; border-radius: 0; box-shadow: none; }
#panel-mode-read.stationery-active #panel-read-media + .stationery-paper { margin-top: -1px; }
#panel-mode-read.stationery-active #panel-read-media-gallery { position: relative; }
#panel-mode-read.stationery-active #panel-carousel-stage {
  width: 100%;
  height: auto;
  min-height: 180px;
  max-height: 440px;
  aspect-ratio: 4 / 3;
  border-radius: 0;
  background: #e8e2d6;
}
#panel-mode-read.stationery-active .stationery-surface[data-frame="rounded"] #panel-carousel-stage { border-radius: 23px 23px 0 0; }
html.dark #panel-mode-read.stationery-active #panel-carousel-stage { background: #383b36; }
#panel-mode-read.stationery-active #panel-carousel-strip {
  position: absolute;
  z-index: 12;
  right: auto;
  bottom: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 20px);
  padding: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  background: rgb(35 38 32 / .62);
  border: 1px solid rgb(255 255 255 / .28);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgb(20 22 18 / .18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  scrollbar-width: thin;
}
#panel-mode-read.stationery-active #panel-carousel-strip .panel-carousel-thumb {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-color: rgb(255 255 255 / .5);
}
@media (max-width: 767px) {
  #panel-mode-read.stationery-active #panel-carousel-counter { top: 8px; right: 8px; }
}
@media (min-width: 768px) {
  #panel-mode-read.stationery-active #panel-carousel-stage { aspect-ratio: 16 / 10; }
}

/* Quick layouts let a first-time writer start with a complete scene. */
.stationery-quick-layouts { padding: 18px 0; border-top: 1px solid var(--stationery-editor-line); }
.stationery-layout-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stationery-layout-heading h3 { margin: 0; font: 600 15px/1.4 var(--font-serif, Georgia, serif); }
.stationery-layout-help { font-size: 12px; line-height: 1.6; margin: 5px 0 10px; opacity: .76; }
.stationery-layouts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stationery-layouts.hidden { display: none; }
.stationery-dialog .stationery-layout-choice { display: flex; flex-direction: column; align-items: stretch; gap: 5px; min-width: 0; padding: 8px; border: 1px solid var(--stationery-editor-line); background: rgb(255 255 255 / .3); text-align: left; }
.stationery-layout-choice[aria-pressed="true"] { border-color: #788755; box-shadow: inset 0 0 0 1px #788755; background: #9aa87c18; }
.stationery-layout-choice strong { font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.stationery-layout-choice > span:last-child { font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; opacity: .8; }
.stationery-layout-mini { display: block; position: relative; height: 56px; margin: 2px 2px 5px; overflow: hidden; background: #fffdf8; border: 1px solid #a7997455; border-radius: 4px; }
.stationery-layout-mini::before { content: ''; position: absolute; inset: 12px 19px; background: repeating-linear-gradient(transparent 0, transparent 6px, #7b846266 6px, #7b846266 7px); }
.stationery-layout-mini[data-layout="photo"]::before { inset: 8px 16px 15px; background: linear-gradient(150deg, #d7e0c4 55%, #a9b896 56%); }
.stationery-layout-mini[data-layout="random"]::after { content: '↻'; position: absolute; z-index: 2; right: 2px; bottom: 1px; color: #59673f; font: 700 12px/1 sans-serif; }
.stationery-layout-mini[data-paper="grid"] { background-image: linear-gradient(#88966b18 1px, transparent 1px), linear-gradient(90deg, #88966b18 1px, transparent 1px); background-size: 8px 8px; }
.stationery-layout-mini img { position: absolute; width: 20px; height: 20px; }
.stationery-preview-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
#stationery-layout-status { font-size: 11px; line-height: 1.55; }
#stationery-edit-details { margin-left: auto; flex-shrink: 0; text-decoration: underline; text-underline-offset: 4px; }
.stationery-tools { scroll-margin-top: 12px; }
.dark .stationery-layout-mini { background-color: #30342a; }
.dark .stationery-layout-mini::before { opacity: .8; }
@media (max-width: 639px) {
  .stationery-description { font-size: 11px; }
  .stationery-layouts { gap: 6px; }
  .stationery-layouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stationery-dialog .stationery-layout-choice { padding: 6px; }
}
@media (max-width: 340px) {
  .stationery-overlay { padding-left: 4px; padding-right: 4px; }
  .stationery-header, .stationery-footer { padding-left: 12px; padding-right: 12px; }
  .stationery-dialog-scroll { padding-left: 12px; padding-right: 12px; }
  .stationery-collections { margin-inline: -12px; padding-inline: 12px; }
  .stationery-material-options { grid-template-columns: minmax(0, 1fr); }
  .stationery-font-options { grid-template-columns: minmax(0, 1fr); }
  .stationery-dialog .stationery-material-choice { min-height: 64px; }
}
html[data-ios-text-scale]:not([data-ios-text-scale="1"]) .stationery-material-options,
html[data-ios-text-scale]:not([data-ios-text-scale="1"]) .stationery-font-options { grid-template-columns: minmax(0, 1fr); }
