/* Make a Farm Story */
.mf-big { font-size: 21px; min-height: max(64px, var(--tap)); width: 100%; }
.mf-privacy { background: #eef8ea; border: 2px solid #9fd08f; border-radius: 14px; padding: 10px 14px; font-size: 15px; font-weight: 700; color: #234b1c; }
.mf-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* library */
.mf-stories { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mf-story { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px 12px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 8px; }
.mf-story__thumb { width: 104px; }
.mf-story__title { font-weight: 900; font-size: 18px; overflow-wrap: anywhere; }
.mf-story__btns { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (min-width: 600px) { .mf-story { grid-template-columns: 120px minmax(0, 1fr) auto; } .mf-story__thumb { width: 120px; } .mf-story__btns { grid-column: auto; } }

/* new story */
.mf-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.mf-choice { min-height: 120px; border-radius: 18px; border: 3px solid #d8cfbd; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; font-size: 19px; text-align: center; box-shadow: 0 4px 0 rgba(29, 39, 51, .12); }
.mf-choice__icon { font-size: 42px; line-height: 1; }
.mf-choice[aria-pressed="true"], .mf-count[aria-pressed="true"], .mf-pick[aria-pressed="true"], .mf-optbtn[aria-pressed="true"] { border-color: #c98f00; background: var(--straw-2); box-shadow: 0 0 0 3px var(--straw); }
.mf-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.mf-count { min-width: max(56px, var(--tap)); min-height: max(56px, var(--tap)); border-radius: 16px; border: 3px solid #d8cfbd; background: #fff; font-size: 22px; font-weight: 900; }
.mf-picks { display: grid; grid-template-columns: 1fr; gap: 8px; }
.mf-picks--bubbles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.mf-pick { min-height: max(56px, var(--tap)); border-radius: 16px; border: 3px solid #d8cfbd; background: #fff; font-size: 18px; font-weight: 800; padding: 8px 12px; text-align: left; overflow-wrap: anywhere; }
.mf-pick--bubble { text-align: center; border-radius: 22px; }
.mf-field { display: flex; flex-direction: column; gap: 6px; }
.mf-input { width: 100%; box-sizing: border-box; min-height: 52px; font: inherit; font-size: 18px; font-weight: 700; padding: 10px 12px; border-radius: 14px; border: 3px solid #d8cfbd; background: #fff; color: var(--ink); }
.mf-input:focus { outline: 3px solid var(--straw); border-color: #c98f00; }
.mf-textarea { min-height: 96px; resize: vertical; line-height: 1.35; }

/* editor */
.mf-edhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mf-title { flex: 1 1 200px; min-width: 0; min-height: var(--tap); text-align: left; background: none; border: 0; font-size: clamp(22px, 5.5vw, 30px); font-weight: 900; color: var(--ink); overflow-wrap: anywhere; padding: 4px; margin: 0; }
.mf-title__pen { font-size: .7em; }
.mf-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.mf-pagebtn { position: relative; min-width: max(58px, var(--tap)); min-height: max(56px, var(--tap)); border-radius: 14px; border: 3px solid #d8cfbd; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px 6px; line-height: 1.05; }
.mf-pagebtn b { font-size: 20px; }
.mf-pagebtn small { font-size: 11px; font-weight: 800; color: var(--ink-2); }
.mf-pagebtn[aria-pressed="true"] { background: var(--barn); border-color: var(--barn-2); color: #fff; }
.mf-pagebtn[aria-pressed="true"] small { color: #fff; }
.mf-pagebtn--add { border-style: dashed; }
.mf-pagebtn__mic { position: absolute; top: -8px; right: -6px; font-size: 14px; }
.mf-work { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mf-canvas { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mf-frame { background: #fff; border-radius: 18px; padding: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.mf-frame--comic { border: 4px solid var(--ink); border-radius: 8px; }
.mf-frame--book { border: 3px solid #e7d7b5; background: #fffaf0; }
.mf-stage { position: relative; aspect-ratio: 4 / 3; width: 100%; overflow: hidden; border-radius: 10px; background: #bfe6ff; container-type: inline-size; user-select: none; -webkit-user-select: none; }
.mf-bg, .mf-bg svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mf-item { position: absolute; transform: translate(-50%, -50%); touch-action: none; }
.mf-stage--edit .mf-item { cursor: grab; }
.mf-item:focus-visible { outline: 3px solid #1d6fd6; outline-offset: 2px; }
.mf-item.is-selected { outline: 3px dashed var(--barn); outline-offset: 3px; border-radius: 8px; background: rgba(255, 255, 255, .25); }
.mf-art { display: block; width: 100%; height: auto; pointer-events: none; }
.mf-flip.is-flipped, .mf-prop.is-flipped { transform: scaleX(-1); }
.mf-prop { display: block; line-height: 1; text-align: center; pointer-events: none; }
.mf-bubble { position: relative; background: #fff; border: max(2px, .5cqw) solid var(--ink); border-radius: 1.1em; padding: .35em .6em; font-weight: 800; line-height: 1.2; text-align: center; overflow-wrap: anywhere; color: var(--ink); pointer-events: none; }
.mf-bubble::before, .mf-bubble::after { content: ''; position: absolute; top: 100%; left: 22%; width: 1.1em; height: 1em; clip-path: polygon(0 0, 100% 0, 0 100%); }
.mf-bubble::before { background: var(--ink); margin-top: 0; transform: translateY(max(2px, .5cqw)) scale(1.35); transform-origin: 20% 0; }
.mf-bubble::after { background: #fff; margin-top: -2px; }
.mf-bubble.tail-right::before, .mf-bubble.tail-right::after { left: auto; right: 22%; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.mf-bubble.tail-right::before { transform-origin: 80% 0; }
.mf-bubble.is-thought { border-radius: 999px; }
.mf-bubble.is-thought::before, .mf-bubble.is-thought::after { clip-path: none; border-radius: 50%; background: #fff; border: max(2px, .45cqw) solid var(--ink); transform: none; }
.mf-bubble.is-thought::before { width: .7em; height: .7em; margin-top: .25em; }
.mf-bubble.is-thought::after { width: .42em; height: .42em; margin-top: 1.05em; left: 15%; }
.mf-bubble.is-thought.tail-right::after { left: auto; right: 15%; }
.mf-stage__hint { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); background: rgba(255, 255, 255, .92); border-radius: 999px; padding: 8px 16px; font-weight: 900; font-size: clamp(14px, 3.6cqw, 20px); text-align: center; pointer-events: none; width: max-content; max-width: 90%; }
.mf-caption { font-size: 19px; font-weight: 700; line-height: 1.35; min-height: 1.35em; padding: 2px 6px; overflow-wrap: anywhere; font-family: Georgia, 'Times New Roman', serif; }
.mf-caption__empty { color: var(--ink-2); font-family: inherit; font-weight: 700; font-size: 15px; font-style: italic; }
.mf-caption--read { font-size: 22px; }
.mf-itembar { background: var(--paper); border-radius: 16px; padding: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.mf-itembar__label { font-size: 14px; font-weight: 800; color: var(--ink-2); overflow-wrap: anywhere; }
.mf-itembar__btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(56px, var(--tap)), 1fr)); gap: 6px; }
.mf-tool { min-height: max(56px, var(--tap)); border-radius: 14px; border: 3px solid #d8cfbd; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; line-height: 1.05; padding: 2px; }
.mf-tool small { font-size: 11px; font-weight: 800; }
.mf-tool[disabled] { opacity: .45; }
.mf-saved { font-size: 13px; font-weight: 800; color: #2f6b22; text-align: right; }
.mf-saved.is-bad { color: var(--barn); }
.mf-tools { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mf-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.mf-tab { min-height: max(58px, var(--tap)); border-radius: 14px 14px 8px 8px; border: 3px solid #d8cfbd; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; line-height: 1.05; padding: 2px; min-width: 0; }
.mf-tab small { font-size: 12px; font-weight: 900; }
.mf-tab[aria-selected="true"] { background: var(--straw); border-color: #c98f00; }
.mf-panel { max-height: none; }
.mf-grid { display: grid; gap: 8px; }
.mf-grid--bg { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.mf-grid--chars { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.mf-grid--props { grid-template-columns: repeat(auto-fill, minmax(max(56px, var(--tap)), 1fr)); }
.mf-optbtn { min-height: max(56px, var(--tap)); border-radius: 14px; border: 3px solid #d8cfbd; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; min-width: 0; }
.mf-optbtn small { font-size: 12px; font-weight: 800; overflow-wrap: anywhere; text-align: center; line-height: 1.1; }
.mf-bgthumb { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; position: relative; }
.mf-bgthumb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mf-optart { width: 64px; height: 56px; }
.mf-propicon { font-size: 34px; line-height: 1; }
.mf-group { display: flex; flex-direction: column; gap: 6px; }
.mf-group__name { font-size: 15px; font-weight: 900; }
.mf-prompt { background: #fff3c7; border: 2px solid var(--straw); border-radius: 14px; padding: 8px 12px; font-weight: 700; }
.mf-bank { display: flex; flex-wrap: wrap; gap: 6px; background: #f6f1e6; border-radius: 14px; padding: 8px; }
.mf-bank[hidden] { display: none; }
.mf-word { min-height: var(--tap); min-width: var(--tap); border-radius: 999px; border: 2px solid #d8cfbd; background: #fff; font-weight: 800; font-size: 16px; padding: 4px 12px; }
.mf-voice__status { font-weight: 800; }
.mf-edactions { background: rgba(255, 253, 247, .94); border-radius: 22px; padding: 8px; box-shadow: var(--shadow); }


/* modal + toast */
.mf-modal { position: fixed; inset: 0; background: rgba(29, 39, 51, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.mf-modal__card { width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; box-sizing: border-box; }
.mf-modal__title { font-size: 24px; font-weight: 900; }
.mf-modal__text { font-size: 18px; font-weight: 600; }
.mf-morelist { display: flex; flex-direction: column; gap: 8px; }
.mf-morelist .lf-btn { width: 100%; justify-content: flex-start; }
.mf-missing { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mf-missing__btn { width: 100%; min-height: max(52px, var(--tap)); text-align: left; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 16px; padding: 6px 10px; }
.mf-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; font-weight: 800; padding: 12px 18px; border-radius: 999px; z-index: 60; max-width: calc(100vw - 32px); box-sizing: border-box; text-align: center; }

/* finish + read */
.mf-finish__title { font-size: 22px; font-weight: 900; overflow-wrap: anywhere; }
.mf-finish__cover { max-width: 420px; border: 4px solid var(--ink); }
.mf-read { display: flex; flex-direction: column; gap: 10px; }
.mf-title--read { flex: 1; }

/* print view */
.mf-print { background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.mf-print__title { font-size: 32px; font-weight: 900; text-align: center; color: var(--barn); overflow-wrap: anywhere; }
.mf-print__by { text-align: center; font-weight: 700; color: var(--ink-2); margin-bottom: 12px; }
.mf-print__pages { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.mf-print--book .mf-print__pages { grid-template-columns: 1fr; }
.mf-print__page { border: 3px solid var(--ink); border-radius: 10px; padding: 8px; break-inside: avoid; page-break-inside: avoid; position: relative; }
.mf-print__num { position: absolute; top: 12px; left: 12px; background: var(--straw); border-radius: 999px; width: 30px; height: 30px; display: grid; place-items: center; font-weight: 900; }
@media print {
  body { background: #fff !important; }
  .ssg-top, .ssg-footer, .mf-noprint, .lf-progress, .mf-toast { display: none !important; }
  .ssg-shell { max-width: none; padding: 0; }
  .mf-print { box-shadow: none; padding: 0; }
  .mf-stage, .mf-print__num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .mf-print--comic .mf-print__pages { grid-template-columns: 1fr 1fr; }
  .mf-print--book .mf-print__page { break-after: page; page-break-after: always; border: 0; }
}
