/* 作って贈る画面（#compose-root）と、知らせ（#notice-root） */
#compose-root { position: fixed; left: 0; right: 0; top: 0; height: 100%; height: 100dvh; z-index: 15; display: flex; flex-direction: column; overflow: hidden;
  color: #3a2e22; background: radial-gradient(120% 90% at 20% 0%, #2c6265, #14363a 55%, #0c2426); }
html.compose-open, html.compose-open body { overflow: hidden; overscroll-behavior: none; }
html.compose-open .dafb-btn { display: none; }

.cmp-head { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; min-height: 52px;
  padding: calc(4px + env(safe-area-inset-top, 0px)) 10px 4px; color: #fdf6e6; background: rgba(6, 22, 24, .55); }
.cmp-head h1 { font-size: 15px; white-space: nowrap; }
.cmp-back { justify-self: start; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 6px; font-size: 14px; }
.cmp-make { background: #b3372f; color: #fff8ec; font-weight: 700; border-radius: 6px; box-shadow: 0 2px 0 #7c221c, 0 3px 8px rgba(0, 0, 0, .3); }
.cmp-make:active { transform: translateY(1px); box-shadow: 0 1px 0 #7c221c; }
.cmp-make-top { justify-self: end; min-height: 40px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
.cmp-make-big { display: block; width: 100%; min-height: 52px; font-size: 17px; margin-top: 10px; }
.cmp-warn { flex: none; padding: 6px 14px; font-size: 12.5px; line-height: 1.45; text-align: center; background: #ffe58f; box-shadow: 0 2px 5px rgba(0, 0, 0, .3); z-index: 1; }
.cmp-warn.is-over { background: #ffd9d2; color: #7c1d15; font-weight: 700; }

.cmp-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 12px 10px calc(24px + env(safe-area-inset-bottom, 0px)); }
.cmp-page { max-width: 560px; margin: 0 auto; padding: 14px 12px 18px; border-radius: 6px; background: #f3e9d0 url(/assets/paper.svg) repeat;
  box-shadow: 2px 2px 0 #bfae88, 0 12px 28px rgba(0, 0, 0, .4); }
.cmp-intro { text-align: center; line-height: 1.5; }
.cmp-lead { font-size: 14px; font-weight: 700; }
.cmp-from-sample { font-size: 12.5px; background: #fff3b8; padding: 5px 10px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.cmp-names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.cmp-names label { display: block; min-width: 0; }
.cmp-cap { display: block; font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.cmp-names input { width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; font-size: 16px; color: #2c241a; background: #fffdf6; border: 1px solid #b9a57c; border-radius: 5px; }
.cmp-names input::placeholder { color: #8d7d60; font-size: 13px; }

.cmp-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 8px; }
.cmp-status { font-size: 12.5px; line-height: 1.5; }
.cmp-small { flex: none; min-height: 44px; padding: 0 12px; font-size: 13px; font-weight: 700; color: #3a2e22; background: #fffdf6; border: 1px solid #b9a57c; border-radius: 6px; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.cmp-small:disabled { opacity: .4; box-shadow: none; cursor: default; }
.cmp-small.cmp-strong { background: #1f565a; border-color: #1f565a; color: #fdf6e6; }
.cmp-small.is-armed { background: #ffd9d2; border-color: #b3372f; }
.cmp-ask { background: #fffdf6; border-radius: 6px; padding: 12px; margin-bottom: 10px; box-shadow: 0 3px 10px rgba(0, 0, 0, .25); font-size: 14px; }
.cmp-keep { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.cmp-keep input { width: 20px; height: 20px; accent-color: #1f565a; }
.cmp-row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }

.cmp-grid { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.cmp-grid li { min-width: 0; }
.cmp-grid .cmp-last { grid-column: 1 / -1; }
.cmp-card { position: relative; display: flex; align-items: flex-start; gap: 7px; width: 100%; height: 100%; min-height: 76px; padding: 9px 8px 12px 7px; text-align: left; color: #2c241a;
  background: #fffaee; border-radius: 3px; box-shadow: 0 1px 0 #cdbb92, 0 2px 5px rgba(60, 40, 10, .22); }
.cmp-card::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 4px; border-bottom: 2px dotted #d3c39d; }
.cmp-num { flex: none; min-width: 26px; height: 26px; display: grid; place-items: center; font: 700 14px/1 ui-rounded, "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  color: #fdf6e6; background: #1f4e63; border-radius: 4px; box-shadow: 0 0 0 1.5px #fffaee, 0 0 0 2.5px #1f4e63; }
.cmp-last .cmp-num { background: #b3372f; box-shadow: 0 0 0 1.5px #fffaee, 0 0 0 2.5px #b3372f; }
.cmp-text { min-width: 0; font-size: 13px; line-height: 1.45; white-space: pre-line; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.cmp-mine { position: absolute; right: 4px; top: -6px; font-size: 10px; font-weight: 700; padding: 1px 7px; background: #ffe58f; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transform: rotate(3deg); }
.cmp-card.is-mine { background: #fffdf8; }
.cmp-card.is-editing { box-shadow: 0 0 0 2.5px #b3372f, 0 2px 6px rgba(60, 40, 10, .3); }

.cmp-editor { grid-column: 1 / -1; background: #fffdf6; border-radius: 6px; padding: 10px; box-shadow: 0 0 0 1.5px #b3372f, 0 6px 16px rgba(60, 40, 10, .3); }
.cmp-editor-title { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.cmp-editor textarea { display: block; width: 100%; resize: none; padding: 8px 10px; font: inherit; font-size: 16px; line-height: 1.5; color: #2c241a;
  background: #fff; border: 1px solid #b9a57c; border-radius: 5px; }
.cmp-count { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12.5px; }
.cmp-meter { flex: 1; height: 6px; border-radius: 3px; background: #e6dabb; overflow: hidden; }
.cmp-meter i { display: block; height: 100%; background: #2c6265; }
.cmp-count.is-near .cmp-meter i { background: #d9821f; }
.cmp-count.is-near .cmp-left { color: #9a5200; font-weight: 700; }
.cmp-count.is-full .cmp-meter i { background: #b3372f; }
.cmp-count.is-full .cmp-left { color: #a12a22; }
.cmp-left { min-width: 5.5em; text-align: right; font-variant-numeric: tabular-nums; }
.cmp-why { font-size: 11.5px; line-height: 1.4; color: #6d5d44; margin: 3px 0 7px; }
.cmp-notice { font-size: 12.5px; font-weight: 700; color: #a12a22; margin-bottom: 6px; }
.cmp-editor .cmp-row { justify-content: space-between; flex-wrap: nowrap; gap: 6px; }
.cmp-editor .cmp-small { flex: 1 1 auto; padding: 0 6px; }
#compose-root.is-low .cmp-why { display: none; }
#compose-root.is-low .cmp-editor textarea { height: 62px; }
#compose-root.is-low .cmp-count { margin-bottom: 7px; }

.cmp-foot { margin-top: 16px; text-align: center; }
.cmp-private, .cmp-length, .cmp-not-saved { font-size: 12px; line-height: 1.5; color: #5d4e37; }
.cmp-problem { margin-top: 8px; padding: 8px 10px; font-size: 13px; font-weight: 700; color: #7c1d15; background: #ffd9d2; border-radius: 5px; }
.cmp-not-saved { margin-top: 8px; }

.cmp-undo { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: 12px;
  width: max-content; max-width: calc(100% - 24px); padding: 6px 6px 6px 16px; font-size: 14px; background: #fff3b8; border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }

.cmp-sheet { position: absolute; inset: 0; z-index: 3; display: flex; overflow-y: auto; padding: 16px 12px calc(16px + env(safe-area-inset-bottom, 0px)); background: rgba(6, 18, 20, .78); }
.cmp-board { position: relative; margin: auto; width: 100%; max-width: 420px; padding: 24px 18px 12px; text-align: center; font-size: 14px; line-height: 1.55;
  background: #fffaee url(/assets/paper.svg) repeat; border-radius: 6px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); animation: cmp-up .28s ease-out; }
.cmp-board::before { content: ""; position: absolute; left: 50%; top: -9px; width: 96px; height: 20px; transform: translateX(-50%) rotate(-2deg); background: rgba(240, 215, 140, .92); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
@keyframes cmp-up { from { transform: translateY(24px); opacity: 0; } }
.cmp-board h2 { font-size: 22px; margin-bottom: 4px; }
.cmp-link { margin-top: 12px; padding: 8px 10px; text-align: left; background: #fff; border: 1.5px dashed #b9a57c; border-radius: 6px; }
.cmp-url { font: 12.5px/1.4 ui-monospace, Menlo, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-url-size { margin-top: 2px; font-size: 11.5px; color: #5d4e37; }
.cmp-by-hand {margin-top: 12px; font-size: 12.5px; text-align: left; }
.cmp-by-hand textarea { width: 100%; margin-top: 4px; padding: 8px; resize: none; font: 12px/1.4 ui-monospace, Menlo, monospace; word-break: break-all; border: 1.5px solid #1f565a; border-radius: 6px; }
.cmp-board-long { margin-top: 10px; padding: 7px 10px; font-size: 12.5px; text-align: left; background: #ffe58f; border-radius: 5px; }
.cmp-actions { display: flex; gap: 8px; margin-top: 12px; }
.cmp-action { flex: 1; min-height: 50px; font-size: 15px; font-weight: 700; color: #fff8ec; background: #b3372f; border-radius: 6px; box-shadow: 0 2px 0 #7c221c; }
.cmp-action + .cmp-action { background: #1f565a; box-shadow: 0 2px 0 #0f3235; }
.cmp-action.is-done { background: #2f7a4b; box-shadow: 0 2px 0 #1d5230; }
.cmp-said { font-size: 12.5px; color: #a12a22; }
.cmp-out { flex: none; }
.cmp-preview-said { margin-top: 6px; padding: 7px 10px; font-size: 12.5px; font-weight: 700; line-height: 1.5; background: #fff3b8; border-radius: 5px; }
.cmp-preview-said p { text-wrap: balance; word-break: auto-phrase; }
.cmp-preview-said.is-blocked { background: #ffd9d2; color: #7c1d15; }
.cmp-preview-said a { display: flex; align-items: center; justify-content: center; min-height: 44px; color: #1f565a; text-decoration: underline; text-underline-offset: 4px; }
.cmp-preview { display: flex; align-items: center; justify-content: center; gap: 7px;min-height: 46px; margin-top: 8px; font-weight: 700; color: #1f565a; text-decoration: none; border: 1.5px solid #1f565a; border-radius: 6px; }
.cmp-fine { margin-top: 6px; font-size: 11.5px; line-height: 1.5; color: #5d4e37; }
.cmp-edit { min-height: 44px; margin-top: 4px; padding: 0 14px; font-size: 13px; color: #3a2e22; text-decoration: underline; text-underline-offset: 4px; }

/* 受け取った札の長い名前（上限は宛名と差出人が各20字）。字を小さくして、切らずに全部見せる。
   置き場所と紙の見た目は main.css の .plate。字は ui/received.js の renderPlate が描く */
#plate .plate-part { display: inline-block; max-width: 100%; white-space: pre-wrap; }
#plate.is-long { display: block; max-height: none; overflow: visible; width: 100%; padding: 3px 4px; font-size: 11.5px; line-height: 1.3; letter-spacing: 0; word-break: normal; text-wrap: wrap; }
#plate.is-long[hidden] { display: none; }

/* 読めないリンク: ちぎれた紙 */
.ntc-veil { position: fixed; inset: 0; z-index: 12; display: flex; padding: 24px 22px; overflow-y: auto; background: rgba(6, 20, 22, .68); }
.ntc-torn { position: relative; margin: auto; width: 100%; max-width: 360px; padding: 24px 20px 20px; text-align: center; color: #3a2e22;
  background: #fffaee url(/assets/paper.svg) repeat; border-radius: 6px; box-shadow: 0 16px 40px rgba(0, 0, 0, .55); }
.ntc-torn h2 { font-size: 18px; line-height: 1.5; text-wrap: balance; }
.ntc-torn p { margin-top: 8px; font-size: 14px; line-height: 1.7; text-wrap: pretty; }
.ntc-torn .ntc-primary { width: 100%; min-height: 50px; margin-top: 18px; }
.ntc-scrap { display: flex; justify-content: center; gap: 10px; height: 48px; margin-bottom: 14px; filter: drop-shadow(0 2px 3px rgba(60, 40, 10, .35)); }
.ntc-scrap i { width: 56px; background: #1f4e63; border: 4px solid #fff; border-width: 4px 0 4px 4px; transform: rotate(-6deg);
  clip-path: polygon(0 0, 88% 0, 100% 17%, 80% 31%, 96% 48%, 78% 66%, 94% 82%, 82% 100%, 0 100%); }
.ntc-scrap i + i { border-width: 4px 4px 4px 0; transform: rotate(8deg) translateY(4px); clip-path: polygon(14% 0, 100% 0, 100% 100%, 8% 100%, 20% 82%, 4% 66%, 22% 48%, 6% 31%, 26% 17%); }
.ntc-primary { min-height: 44px; padding: 0 18px; font-weight: 700; color: #fff8ec; background: #b3372f; border-radius: 6px; box-shadow: 0 2px 0 #7c221c; }
.ntc-quiet { min-height: 44px; padding: 0 14px; font-size: 13px; color: #5d4e37; text-decoration: underline; text-underline-offset: 4px; }

.ntc-storage { position: fixed; left: 50%; bottom: calc(48px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 4; width: max-content; max-width: calc(100% - 24px);
  padding: 4px 12px; font-size: 12px; text-align: center; color: #3a2e22; background: #fff3b8; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); pointer-events: none; }

.ntc-ask { position: fixed; left: 6px; right: 6px; bottom: calc(1px + env(safe-area-inset-bottom, 0px)); z-index: 2147483001; display: flex; align-items: center; gap: 4px; height: 48px; max-width: 420px; margin: 0 auto; padding: 0 4px 0 10px; color: #3a2e22;
  background: #fffaee url(/assets/paper.svg) repeat; border-radius: 6px; box-shadow: 0 2px 12px rgba(0, 0, 0, .55); animation: cmp-up .35s ease-out; }
.ntc-ask p { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; line-height: 1.35; text-wrap: balance; word-break: auto-phrase; }
.ntc-ask-row { flex: none; display: flex; align-items: center; gap: 2px; }
.ntc-ask .ntc-quiet { padding: 0 8px; }
.ntc-ask .ntc-primary { min-height: 40px; padding: 0 12px; font-size: 13px; }

@media (min-width: 720px) {
  .cmp-grid { grid-template-columns: repeat(3, 1fr); }
  .cmp-page { max-width: 720px; padding: 22px 24px 26px; }
  .cmp-head { grid-template-columns: 1fr auto 1fr; padding-left: max(14px, calc(50% - 360px)); padding-right: max(14px, calc(50% - 360px)); }
}
@media (prefers-reduced-motion: reduce) { .cmp-board, .ntc-ask { animation: none; } }

/* 言葉の折り返し: 行の終わりに1〜2字だけが残らないようにする */
.cmp-lead, .cmp-from-sample, .cmp-board > p, .cmp-fine, .cmp-warn, .cmp-problem, .cmp-private, .ntc-torn p, .ntc-ask p { text-wrap: balance; word-break: auto-phrase; }
/* 英語は1行に入る字が少ないので、札に4行まで見せる */
#compose-root:lang(en) .cmp-text { -webkit-line-clamp: 4; font-size: 12.5px; }
/* 番号は小さな窓の形（紺の地 + 白い点線の縁 + クリームの数字）。絵の切り抜きは小さすぎて何の絵か読めないので敷かない */
.cmp-num, .cmp-last .cmp-num { min-width: 28px; height: 34px; font-size: 15px; color: #fff3d6; background: #1f4e63; border-radius: 3px;
  outline: 1px dashed rgba(255, 255, 255, .85); outline-offset: -3px; box-shadow: 0 1px 3px rgba(40, 25, 0, .45); }
.cmp-last .cmp-num { min-width: 52px; font-size: 18px; background: #b3372f; }
/* おまかせの文は、どの幅でも4行までで全部読める */
.cmp-text { -webkit-line-clamp: 4; }
