/* workshop.css — 工房パネル・手紙パネル・便箋・郵便フクロウの演出（接頭辞 .ws-）。
   共通の変数・部品は style.css（docs/engine_api.md §8）。
   便箋の本文だけは手書き風の Klee One（Google Fonts）。読めないときは M PLUS Rounded 1c。 */
@import url('https://fonts.googleapis.com/css2?family=Klee+One:wght@400;600&display=swap');

:root {
  --ws-paper: #f7ecd3;
  --ws-paper-2: #efdfbd;
  --ws-ink: #4a3426;
  --ws-ink-soft: #7a5c44;
  --ws-rule: rgba(128, 140, 182, .34);
  --ws-hand: 'Klee One', 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', serif;
}

/* ================================================================== 共通 */
.ws-root { display: flex; flex-direction: column; gap: 12px; padding-top: 2px; }
.ws-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 2px 2px 8px; }
.ws-sec-title {
  margin: 0; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-dot); font-weight: normal; font-size: 15px; color: var(--lavender); letter-spacing: .06em;
}
.ws-sec-title img { width: 20px; height: 20px; }
.ws-sec-sub { font-size: 12px; color: var(--muted); }
.ws-empty {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  padding: 26px 12px; border: 2px dashed rgba(183, 162, 255, .22); border-radius: 10px; color: var(--text);
}
.ws-empty p { margin: 2px 0; }
.ws-empty img { width: 32px; height: 32px; opacity: .8; margin-bottom: 6px; }
.ws-empty-owl { width: 64px !important; height: 64px !important; opacity: 1 !important; }

/* ================================================================== 工房：作業台 */
.ws-bench {
  padding: 10px 10px 8px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 191, 94, .10), transparent 60%),
    linear-gradient(180deg, rgba(70, 44, 30, .38), rgba(36, 24, 30, .42));
  border: 2px solid rgba(201, 146, 84, .5);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 230, 180, .12), inset 0 -3px 0 rgba(0, 0, 0, .2);
}
.ws-bench .ws-sec-title { color: var(--honey); }
.ws-slot {
  position: relative;
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 8px;
  background: rgba(11, 13, 36, .55);
  border: 1px solid rgba(255, 217, 138, .18);
}
.ws-slot + .ws-slot { margin-top: 6px; }
.ws-slot-icon {
  position: relative; width: 52px; height: 52px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 60%, #3a2a3e, #17142c 70%);
  border: 2px solid rgba(255, 217, 138, .35);
  box-shadow: inset 0 0 0 2px rgba(16, 7, 42, .7);
}
.ws-slot-icon img { width: 32px; height: 32px; position: relative; z-index: 1; }
.ws-slot-icon.empty { border-style: dashed; background: rgba(11, 13, 36, .35); }
.ws-slot-num { font-size: 18px; color: rgba(183, 162, 255, .45); }
.ws-slot-icon.busy {
  border-color: var(--honey);
  background: radial-gradient(circle at 50% 62%, rgba(255, 191, 94, .55), #3a2440 55%, #17142c 80%);
  animation: wsKiln 2.4s ease-in-out infinite;
}
.ws-slot-icon.busy img { animation: wsBob 1.8s ease-in-out infinite; }
@keyframes wsKiln {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(16, 7, 42, .7), 0 0 6px rgba(255, 191, 94, .25); }
  50% { box-shadow: inset 0 0 0 2px rgba(16, 7, 42, .7), 0 0 16px rgba(255, 191, 94, .6); }
}
@keyframes wsBob { 50% { transform: translateY(-2px); } }
.ws-steam {
  position: absolute; top: 4px; left: 40%; width: 4px; height: 4px; z-index: 2;
  background: rgba(255, 243, 220, .8); box-shadow: 0 0 4px rgba(255, 243, 220, .8);
  opacity: 0; animation: wsSteam 2.2s linear infinite;
}
.ws-steam.s2 { left: 62%; animation-delay: 1.1s; }
@keyframes wsSteam {
  0% { transform: translate(0, 10px); opacity: 0; }
  20% { opacity: .9; }
  100% { transform: translate(3px, -16px); opacity: 0; }
}
.ws-slot-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ws-slot-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.ws-slot-name { font-weight: 700; color: var(--cream); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-slot.idle .ws-slot-name { color: var(--muted); font-weight: 500; }
.ws-slot-hint { line-height: 1.35; }
.ws-slot-time { font-size: 13px; color: var(--honey); white-space: nowrap; }
.ws-bar {
  position: relative; height: 10px; border-radius: 3px; overflow: hidden;
  background: #0a0b1e; border: 1px solid rgba(255, 217, 138, .4);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, .35);
}
.ws-bar-fill {
  height: 100%; width: 0;
  background: repeating-linear-gradient(-45deg, var(--honey) 0 5px, var(--amber) 5px 10px);
  background-size: 14.14px 14.14px;
  box-shadow: 0 0 8px rgba(255, 191, 94, .7);
  animation: wsStripe 1s linear infinite;
}
@keyframes wsStripe { to { background-position: 14.14px 0; } }
.ws-bar-shine { position: absolute; inset: 0 0 50% 0; background: rgba(255, 255, 255, .14); pointer-events: none; }
.ws-slot.almost .ws-bar-fill { background: repeating-linear-gradient(-45deg, #fff3c4 0 5px, var(--honey) 5px 10px); background-size: 14.14px 14.14px; }
.ws-slot.almost .ws-slot-icon { animation-duration: .9s; }
.ws-x {
  width: 26px; height: 26px; border-radius: 6px; padding: 0; line-height: 1;
  background: transparent; border: 1px solid rgba(183, 162, 255, .3); color: var(--muted); cursor: pointer;
  font-size: 16px;
}
.ws-x:hover { color: var(--danger); border-color: var(--danger); }
.ws-wait { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 1px; }
.ws-wait-label { color: var(--muted); margin-right: 2px; }
.ws-wait-item {
  position: relative; width: 36px; height: 36px; padding: 1px; border-radius: 6px; cursor: pointer;
  background: rgba(11, 13, 36, .6); border: 1px dashed rgba(255, 217, 138, .4);
}
.ws-wait-item img { width: 32px; height: 32px; opacity: .75; display: block; }
.ws-wait-x {
  position: absolute; top: -5px; right: -5px; width: 14px; height: 14px; border-radius: 7px;
  font-size: 10px; line-height: 14px; text-align: center; color: #fff; background: #5a1f36;
  opacity: 0; transition: opacity .15s;
}
.ws-wait-item:hover .ws-wait-x, .ws-wait-item:focus-visible .ws-wait-x { opacity: 1; }
.is-mobile .ws-wait-x { opacity: .85; }
.ws-reserve-note { margin: 6px 2px 0; line-height: 1.4; }

/* ================================================================== 工房：タブ・レシピ */
.ws-tabs { margin-bottom: 2px; }
.ws-tab-n { font-size: 11px; opacity: .8; margin-left: 2px; }
.ws-recipes { display: flex; flex-direction: column; gap: 8px; }
.ws-recipe {
  position: relative;
  display: grid; grid-template-columns: 48px 1fr; align-items: start; gap: 10px;
  padding: 9px 10px 9px 9px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .025));
  border: 1px solid rgba(183, 162, 255, .24);
  border-radius: 9px;
  transition: border-color .2s, background .2s;
}
.ws-recipe:hover { border-color: rgba(255, 217, 138, .45); }
.ws-recipe.need {
  border-color: rgba(255, 191, 94, .65);
  background: linear-gradient(90deg, rgba(255, 191, 94, .13), rgba(255, 191, 94, .02) 70%);
}
.ws-recipe.need::before {
  content: ''; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px;
  background: var(--amber); box-shadow: 0 0 8px var(--amber);
}
.ws-recipe.ws-focus { animation: wsFocus 1.4s ease-out 2; }
@keyframes wsFocus { 0%, 100% { box-shadow: none; } 40% { box-shadow: 0 0 0 2px var(--honey), 0 0 18px rgba(255, 191, 94, .7); } }
.ws-recipe-icon {
  position: relative; width: 48px; height: 48px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #2b3470, #141838 75%);
  border: 2px solid rgba(255, 217, 138, .35);
  box-shadow: inset 0 0 0 2px rgba(16, 7, 42, .6);
}
.ws-recipe-icon img { width: 32px; height: 32px; }
.ws-own {
  position: absolute; right: -6px; bottom: -6px; padding: 0 4px; min-width: 20px; height: 16px;
  font-size: 11px; line-height: 16px; text-align: center; color: #2a1606; background: var(--honey); border-radius: 4px;
  box-shadow: 0 0 0 2px #10072a;
}
.ws-recipe-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ws-recipe-name { font-weight: 700; color: var(--cream); line-height: 1.3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-making { font-weight: 500; color: var(--honey); padding: 0 6px; border: 1px solid rgba(255, 217, 138, .45); border-radius: 8px; line-height: 1.5; font-size: 11px; }
.ws-recipe-desc { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.ws-recipe-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 1px; }
.ws-cost { display: inline-flex; gap: 8px; align-items: center; }
.ws-cost-part { display: inline-flex; align-items: center; gap: 3px; font-size: 14px; color: var(--honey); white-space: nowrap; }
.ws-cost-part img { width: 16px; height: 16px; }
.ws-cost-part.lack { color: var(--danger); }
.ws-cost-part.free { color: var(--good); }
.ws-time { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; color: var(--lavender); white-space: nowrap; }
.ws-time img { width: 16px; height: 16px; opacity: .85; }
.ws-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ws-need {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 4px;
  font-size: 11.5px; line-height: 1.5; color: var(--honey);
  background: rgba(255, 191, 94, .14); border: 1px solid rgba(255, 191, 94, .55); border-radius: 10px;
}
.ws-need img { width: 14px; height: 14px; }
.ws-need b { font-weight: normal; }
.ws-need.ok { color: var(--good); border-color: rgba(158, 240, 200, .55); background: rgba(158, 240, 200, .1); }
.ws-make { min-width: 72px; margin-left: auto; }
.ws-recipe-icon { margin-top: 2px; }
.ws-need-text { min-width: 0; }

/* ================================================================== 工房：たな（在庫） */
.ws-shelf-wrap { position: relative; }
.ws-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.ws-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 6px; cursor: pointer; color: var(--cream);
  background: linear-gradient(180deg, rgba(54, 36, 40, .55), rgba(84, 56, 40, .62) 78%, rgba(120, 82, 52, .8) 78% 84%, rgba(60, 40, 30, .7) 84%);
  border: 2px solid #6b4a32; border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 220, 170, .08), 0 2px 0 rgba(0, 0, 0, .3);
}
.ws-tile:hover { border-color: var(--amber); }
.ws-tile.need { border-color: var(--amber); box-shadow: 0 0 10px rgba(255, 191, 94, .35); }
.ws-tile-icon img { width: 32px; height: 32px; display: block; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
.ws-tile-n { position: absolute; top: 3px; right: 5px; font-size: 12px; color: var(--honey); }
.ws-tile-name { font-size: 11px; line-height: 1.3; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-item-modal .modal-body { text-align: center; }
.ws-item-big { display: flex; justify-content: center; margin: 4px 0 8px; }
.ws-item-big-img { width: 64px !important; height: 64px !important; }
.ws-item-desc { margin: 0 0 6px; }
.ws-item-own { margin: 0; color: var(--honey); }
.ws-item-need { margin: 6px 0 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--amber); font-size: 13px; }
.ws-item-need img { width: 16px; height: 16px; }

/* ================================================================== 手紙パネル */
.ws-lsec { display: flex; flex-direction: column; gap: 8px; }
.ws-env {
  position: relative; display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px 10px 10px; text-align: left; cursor: pointer; color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .02));
  border: 1px solid rgba(183, 162, 255, .24); border-radius: 10px;
  transition: transform .12s, border-color .2s, background .2s;
}
.ws-env:hover { transform: translateY(-1px); border-color: rgba(255, 217, 138, .5); }
.ws-env:active { transform: translateY(1px); }
.ws-env.unread { border-color: rgba(255, 217, 138, .6); background: linear-gradient(90deg, rgba(255, 217, 138, .12), rgba(255, 217, 138, .02)); }
.ws-env.ready { border-color: var(--honey); animation: wsReady 2s ease-in-out infinite; }
@keyframes wsReady { 50% { box-shadow: 0 0 0 1px rgba(255, 217, 138, .6), 0 0 16px rgba(255, 191, 94, .45); } }
.ws-env.done { opacity: .72; }
.ws-env-art {
  position: relative; width: 64px; height: 44px; border-radius: 3px;
  background: linear-gradient(180deg, #f6e8cc, #e8d4ae);
  box-shadow: 0 0 0 2px #8a6a48, 0 3px 0 2px rgba(0, 0, 0, .3);
  overflow: hidden;
}
.ws-env-art::after { /* 封筒の下の折り目 */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top right, transparent 49%, rgba(138, 106, 72, .35) 50%, transparent 51%) left / 50% 100% no-repeat,
              linear-gradient(to top left, transparent 49%, rgba(138, 106, 72, .35) 50%, transparent 51%) right / 50% 100% no-repeat;
}
.ws-env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 62%; z-index: 1;
  background: linear-gradient(180deg, #efdcb6, #e2c99c);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.ws-env-art.done .ws-env-flap { clip-path: polygon(0 0, 100% 0, 50% 18%); }
.ws-env-art .ws-seal.sm { position: absolute; left: 50%; top: 62%; transform: translate(-50%, -50%); z-index: 2; }
.ws-env-art.done .ws-seal.sm { display: none; }
.ws-env-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ws-env-from { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ws-env-face { width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 243, 220, .12); box-shadow: 0 0 0 2px var(--seal, rgba(255, 217, 138, .35)); flex: none; }
.ws-env-from { font-size: 13px; color: var(--lavender); }
/* 表情シートのない町の人：封蝋の色の丸に一文字 */
.ws-initial {
  --seal: #c95a6a; --sz: 32px;
  display: inline-grid; place-items: center; flex: none; width: var(--sz); height: var(--sz);
  font-family: var(--font-dot); font-size: calc(var(--sz) * .52); line-height: 1; color: #fff8ea;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--seal) 60%, #fff), var(--seal) 60%, color-mix(in srgb, var(--seal) 60%, #000));
  text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}
.ws-stamp .ws-initial.ws-stamp-img { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 0; font-size: 34px; outline: 2px solid color-mix(in srgb, var(--seal) 70%, #6b4a32); outline-offset: -2px; }
.ws-env-from { padding-right: 92px; }
.ws-env-subject { font-weight: 700; color: var(--cream); line-height: 1.35; }
.ws-env-wants { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.ws-want-chip {
  display: inline-flex; align-items: center; gap: 2px; padding: 0 7px 0 1px; border-radius: 6px;
  background: rgba(11, 13, 36, .55); border: 1px solid rgba(183, 162, 255, .25); font-size: 13px; color: var(--lavender);
}
.ws-want-chip img { width: 32px; height: 32px; margin: -3px 0; }
.ws-want-chip-name { font-size: 12px; color: var(--text); margin: 0 4px 0 2px; }
.ws-want-chip.ok .ws-want-chip-name { color: var(--good); }
.ws-want-chip-n { font-size: 13px; }
.ws-want-chip.ok { color: var(--good); border-color: rgba(158, 240, 200, .5); }
.ws-env-badge {
  position: absolute; top: 8px; right: 10px; padding: 0 8px; border-radius: 9px;
  font-family: var(--font-dot); font-size: 11px; line-height: 18px; white-space: nowrap;
}
.ws-env-badge.new { color: #2a1606; background: var(--amber); box-shadow: 0 0 0 2px #10072a, 0 0 8px rgba(255, 191, 94, .7); }
.ws-env-badge.ready { color: #10240f; background: var(--good); box-shadow: 0 0 0 2px #10072a, 0 0 8px rgba(158, 240, 200, .6); }
.ws-env-badge.done { color: var(--muted); border: 1px solid rgba(183, 162, 255, .35); }
.ws-calm {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted);
  border: 1px dashed rgba(183, 162, 255, .25); border-radius: 10px;
}
.ws-calm img { width: 24px; height: 24px; opacity: .8; flex: none; }
.ws-done-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 4px;
  font-family: var(--font-dot); font-size: 14px; color: var(--muted);
  background: transparent; border: 0; border-top: 1px solid rgba(183, 162, 255, .18); cursor: pointer; text-align: left;
}
.ws-done-toggle span:first-child { flex: 1; }
.ws-done-toggle:hover { color: var(--text); }
.ws-caret { font-size: 10px; }

/* ================================================================== 封蝋 */
.ws-seal {
  --seal: #c95a6a;
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  border-radius: 47% 53% 50% 48% / 52% 46% 54% 48%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .45), transparent 32%),
    radial-gradient(circle at 50% 50%, var(--seal) 52%, color-mix(in srgb, var(--seal) 62%, #2a0a12) 100%);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--seal) 45%, #1a0408), 0 3px 6px rgba(60, 20, 10, .35),
              inset 0 0 0 4px color-mix(in srgb, var(--seal) 82%, #000);
}
.ws-seal-star { font-size: 19px; line-height: 1; color: color-mix(in srgb, var(--seal) 55%, #fff); text-shadow: 0 1px 0 color-mix(in srgb, var(--seal) 50%, #000); }
.ws-seal.sm { width: 20px; height: 20px; box-shadow: 0 1px 0 color-mix(in srgb, var(--seal) 45%, #1a0408), inset 0 0 0 2px color-mix(in srgb, var(--seal) 82%, #000); }
.ws-seal.sm .ws-seal-star { font-size: 10px; }

/* ================================================================== 便箋オーバーレイ */
#ws-overlay { position: fixed; inset: 0; z-index: 58; }
.ws-ov-back {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + 14px) 12px calc(var(--safe-bottom) + 14px);
  background: radial-gradient(ellipse at 50% 60%, rgba(40, 30, 60, .45), rgba(5, 6, 20, .72));
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .26s;
}
.ws-ov.show .ws-ov-back { opacity: 1; }
.ws-stage { position: relative; perspective: 1400px; display: flex; align-items: center; justify-content: center; max-height: 100%; width: 100%; }

.ws-paper {
  position: relative; display: flex; flex-direction: column;
  width: min(470px, 100%); max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 28px);
  color: var(--ws-ink);
  background-color: var(--ws-paper);
  background-image:
    radial-gradient(ellipse at 18% 8%, rgba(255, 255, 255, .55), transparent 45%),
    radial-gradient(ellipse at 90% 100%, rgba(200, 160, 100, .22), transparent 55%),
    linear-gradient(180deg, var(--ws-paper), var(--ws-paper-2));
  border-radius: 3px;
  box-shadow: 0 0 0 2px #d8c093, 0 0 0 4px #7d5d40, 0 0 0 6px rgba(16, 7, 42, .6), 0 22px 50px rgba(0, 0, 0, .6);
  transform-origin: 50% 60%;
  transform: translateY(18px) scale(.97); opacity: 0;
  transition: transform .34s cubic-bezier(.2, .9, .25, 1.1), opacity .26s;
}
/* 便箋の絵（ui/paper.webp から罫線を消した paper_blank.webp）。2:3 の紙をそのまま拡大し、中身はスクロール */
.ws-paper.has-art {
  width: min(470px, 100%, calc((100dvh - var(--safe-top) - var(--safe-bottom) - 40px) * 2 / 3));
  aspect-ratio: 2 / 3; height: auto; max-height: none; min-height: 0;
  background-color: transparent;
  background-image: url(../assets/img/ui/paper_blank.webp), var(--ws-paper-img, none);
  background-size: 100% 100%; background-repeat: no-repeat; image-rendering: pixelated;
  border-radius: 2px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, .6), 0 0 0 1px rgba(90, 60, 30, .35);
}
.ws-paper.has-art .ws-paper-inner { flex: 1 1 auto; min-height: 0; margin: 4.5% 4% 6%; padding: 14px 18px 12px; }
.ws-paper.has-art .ws-paper-actions { padding-left: 64px; }
.ws-paper.has-art .ws-pressed-flower { display: none; }
.ws-ov.show .ws-paper { transform: none; opacity: 1; }
.ws-ov.show .ws-paper.ws-paper-wait { opacity: 0; transform: translateY(60px) scale(.6); transition: none; }
.ws-ov.show .ws-paper.ws-paper-rise { animation: wsRise .7s cubic-bezier(.2, .9, .25, 1.08) both; }
@keyframes wsRise { 0% { transform: translateY(70px) scale(.55); opacity: 0; } 55% { opacity: 1; } 100% { transform: none; opacity: 1; } }
.ws-ov.show .ws-paper.ws-flip-out { transform: rotateY(90deg) scale(.96); opacity: .4; transition: transform .28s ease-in, opacity .28s; }
.ws-ov.show .ws-paper.ws-reply { transform: rotateY(-90deg) scale(.96); }
.ws-ov.show .ws-paper.ws-reply.ws-flip-in { transform: none; opacity: 1; transition: transform .36s cubic-bezier(.2, .9, .3, 1.1), opacity .2s; }

.ws-paper-inner {
  position: relative; overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 30px 18px; user-select: text; -webkit-user-select: text;
  scrollbar-color: rgba(125, 93, 64, .5) transparent;
}
.ws-paper-inner::-webkit-scrollbar-thumb { background: rgba(125, 93, 64, .45); }
.ws-paper-close {
  position: absolute; top: -14px; right: -14px; z-index: 5; width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(180deg, #2a2f66, #151839); border: 2px solid var(--honey); border-radius: 50%;
  box-shadow: 0 0 0 2px #10072a, 0 4px 10px rgba(0, 0, 0, .5);
}
.ws-paper-close img { width: 24px; height: 24px; }
.ws-paper-close:hover { filter: brightness(1.2); }
.ws-pressed-flower { position: absolute; left: 10px; bottom: 10px; width: 32px; height: 32px; opacity: .55; transform: rotate(-14deg); pointer-events: none; z-index: 0; }

.ws-paper-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ws-paper-to { font-family: var(--ws-hand); font-size: 15px; color: var(--ws-ink-soft); padding-top: 6px; }
.ws-stamp {
  --seal: #c95a6a;
  flex: none; width: 76px; height: 84px; padding: 5px; margin-right: 15%;
  background: #fffaf0;
  -webkit-mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle at 4px 4px, transparent 2.6px, #000 3px) -4px -4px / 8px 8px;
          mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle at 4px 4px, transparent 2.6px, #000 3px) -4px -4px / 8px 8px;
  transform: rotate(4deg);
  filter: drop-shadow(0 2px 1px rgba(90, 60, 30, .35));
}
.ws-stamp-img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--seal) 30%, #fff8ea), color-mix(in srgb, var(--seal) 55%, #fff8ea));
  outline: 2px solid color-mix(in srgb, var(--seal) 70%, #6b4a32); outline-offset: -2px;
}
.ws-paper-subject {
  margin: 4px 0 10px; font-family: var(--ws-hand); font-weight: 600; font-size: 20px; line-height: 1.45; color: #5a3824;
  padding-bottom: 6px; border-bottom: 2px dashed rgba(125, 93, 64, .35);
}
.ws-paper-body {
  font-family: var(--ws-hand); font-size: 16px; line-height: 32px; color: var(--ws-ink);
  background-image: repeating-linear-gradient(180deg, transparent 0 31px, var(--ws-rule) 31px 32px);
  background-attachment: local;
  padding: 0 2px; margin-bottom: 8px; white-space: pre-wrap; word-break: break-word;
}
.ws-paper-body p { margin: 0; }
.ws-paper.ink .ws-paper-body p { animation: wsInk .7s ease-out var(--d, 0s) both; }
@keyframes wsInk { from { opacity: 0; filter: blur(2px); transform: translateX(-4px); } to { opacity: 1; filter: none; transform: none; } }
.ws-paper-sign { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 4px 0 12px; }
.ws-sign-name { font-family: var(--ws-hand); font-weight: 600; font-size: 17px; color: #5a3824; }

.ws-wants, .ws-rewards {
  margin: 4px 0 14px; padding: 10px 12px 8px; border-radius: 6px;
  background: rgba(125, 93, 64, .09); border: 2px solid rgba(125, 93, 64, .28);
}
.ws-wants-title { font-family: var(--font-dot); font-size: 13px; color: var(--ws-ink-soft); letter-spacing: .08em; margin-bottom: 4px; }
.ws-want-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-top: 1px dashed rgba(125, 93, 64, .25); }
.ws-want-row:first-of-type { border-top: 0; }
.ws-want-icon img { width: 32px; height: 32px; display: block; filter: drop-shadow(0 1px 0 rgba(90, 60, 30, .35)); }
.ws-want-name { flex: 1; font-weight: 700; color: var(--ws-ink); min-width: 0; }
.ws-want-making { color: #a06a20; white-space: nowrap; }
.ws-want-n { font-size: 15px; color: #a0453a; white-space: nowrap; }
.ws-want-row.ok .ws-want-n { color: #2f7a52; }
.ws-want-check { width: 18px; text-align: center; color: #2f7a52; font-weight: 800; }

.ws-paper-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 2px; }
.ws-paper-actions .btn { min-width: 120px; }
.ws-paper-actions .btn img { width: 20px; height: 20px; }
.ws-paper .btn:not(.btn-primary) { color: var(--cream); }
.ws-deliver:not(:disabled) { animation: wsDeliverGlow 1.8s ease-in-out infinite; }
@keyframes wsDeliverGlow { 50% { box-shadow: 0 0 0 2px #3a1d06, inset 0 2px 0 rgba(255, 255, 255, .5), 0 0 22px rgba(255, 191, 94, .85); } }
.ws-paper-reply-note { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid rgba(201, 90, 106, .5); background: rgba(255, 255, 255, .25); }
.ws-paper-reply-note p { margin: 2px 0 0; font-family: var(--ws-hand); line-height: 1.8; }
.ws-reply-label { font-family: var(--font-dot); font-size: 13px; letter-spacing: .12em; color: #a0453a; padding-top: 6px; }
.ws-reply-text { margin: 6px 0 8px; font-family: var(--ws-hand); font-size: 17px; line-height: 34px; white-space: pre-wrap;
  background-image: repeating-linear-gradient(180deg, transparent 0 33px, var(--ws-rule) 33px 34px); background-attachment: local; }
.ws-reward {
  display: flex; align-items: center; gap: 10px; padding: 4px 0; color: var(--ws-ink); font-weight: 700;
  animation: wsRewardIn .45s cubic-bezier(.2, .9, .3, 1.3) var(--d, 0s) both;
}
.ws-reward b { color: #a0453a; font-weight: normal; font-size: 16px; }
.ws-reward-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; flex: none;
  background: rgba(125, 93, 64, .14); border-radius: 50%; }
.ws-reward-icon img { width: 24px; height: 24px; }
.ws-reward-icon img[width="32"] { width: 32px; height: 32px; }
@keyframes wsRewardIn { from { opacity: 0; transform: translateY(8px) scale(.9); } to { opacity: 1; transform: none; } }

/* 封筒がひらく（はじめて読むとき） */
.ws-open-env {
  position: absolute; left: 50%; top: 50%; width: 230px; height: 148px; margin: -74px 0 0 -115px; z-index: 2;
  transition: transform .6s ease-in, opacity .5s;
}
.ws-open-env-back {
  position: absolute; inset: 0; border-radius: 4px;
  background: linear-gradient(180deg, #f6e8cc, #e4cfa6);
  box-shadow: 0 0 0 3px #8a6a48, 0 16px 34px rgba(0, 0, 0, .5);
}
.ws-open-env-back::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top right, transparent 49.5%, rgba(138, 106, 72, .4) 50%, transparent 50.8%) left / 50% 100% no-repeat,
              linear-gradient(to top left, transparent 49.5%, rgba(138, 106, 72, .4) 50%, transparent 50.8%) right / 50% 100% no-repeat;
}
.ws-open-env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 60%; transform-origin: 50% 0;
  background: linear-gradient(180deg, #f0dfbb, #dcc193);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .5s cubic-bezier(.5, 0, .3, 1);
}
.ws-open-env > .ws-seal { position: absolute; left: 50%; top: 60%; transform: translate(-50%, -50%); transition: transform .4s, opacity .3s; }
.ws-open-env.open .ws-open-env-flap { transform: rotateX(180deg); }
.ws-open-env.open > .ws-seal { transform: translate(-50%, -90%) scale(.6); opacity: 0; }
.ws-open-env.gone { transform: translateY(90px) scale(.9); opacity: 0; }

/* ================================================================== 演出レイヤー */
#ws-fx { position: fixed; inset: 0; z-index: 59; pointer-events: none; overflow: hidden; }
#ws-fx > * { position: absolute; left: 0; top: 0; will-change: transform; pointer-events: none; }
.ws-owl { width: 96px; height: 96px; }
.ws-owl-img { width: 96px; height: 96px; display: block; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); }
.ws-owl-letter { position: absolute; left: 36px; top: 64px; transform: rotate(-8deg); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.ws-owl-letter img { width: 22px; height: 22px; display: block; }
.ws-drop img { width: 28px; height: 28px; display: block; filter: drop-shadow(0 0 6px rgba(255, 217, 138, .9)); }
.ws-spark { width: 4px; height: 4px; box-shadow: 0 0 6px rgba(255, 217, 138, .9); }
.ws-pop { display: flex; flex-direction: column; align-items: center; gap: 0; }
.ws-pop img { width: 32px; height: 32px; filter: drop-shadow(0 0 8px rgba(255, 217, 138, .95)); }
.ws-pop-text { font-family: var(--font-dot); font-size: 13px; color: var(--honey); text-shadow: 0 0 6px rgba(255, 191, 94, .9), 0 2px 0 #10072a; white-space: nowrap; }
.ws-fly img { width: 20px; height: 20px; display: block; filter: drop-shadow(0 0 6px rgba(255, 230, 140, .95)); }

/* ================================================================== スマホ縦 */
@media (max-width: 600px), (orientation: portrait) and (max-width: 820px) {
  .ws-recipe { grid-template-columns: 44px 1fr; gap: 8px; padding: 8px; }
  .ws-recipe-icon { width: 44px; height: 44px; }
  .ws-make { min-width: 60px; padding: 3px 8px; }
  .ws-env { grid-template-columns: 52px 1fr; gap: 10px; padding: 9px 10px 9px 8px; }
  .ws-env-art { width: 52px; height: 36px; }

  .ws-ov-back { padding: calc(var(--safe-top) + 10px) 8px calc(var(--safe-bottom) + 10px); }
  .ws-paper { max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 20px); }
  .ws-paper-inner { padding: 20px 18px 14px; }
  .ws-stamp { width: 64px; height: 72px; margin-right: 26px; }
  .ws-paper-subject { font-size: 18px; }
  .ws-paper-body { font-size: 15px; line-height: 30px; background-image: repeating-linear-gradient(180deg, transparent 0 29px, var(--ws-rule) 29px 30px); }
  .ws-paper-actions .btn { min-width: 0; flex: 1 1 auto; }
  .ws-owl, .ws-owl-img { width: 64px; height: 64px; }
  .ws-owl-letter { left: 22px; top: 42px; }
}

/* ================================================================== 追加：レシピの見出し */
.ws-rhead {
  display: flex; align-items: center; gap: 6px; margin: 6px 2px 0;
  font-family: var(--font-dot); font-size: 13px; letter-spacing: .06em; color: var(--muted);
}
.ws-rhead:first-child { margin-top: 0; }
.ws-rhead img { width: 20px; height: 20px; }
.ws-rhead.need { color: var(--honey); }
.ws-rhead::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255, 217, 138, .35), transparent); }
.ws-rhead-n { font-size: 11px; padding: 0 6px; border-radius: 8px; background: rgba(255, 255, 255, .07); }

/* ================================================================== 届けた：封蝋をぽんと押す */
.ws-press {
  --seal: #c95a6a;
  position: absolute; left: 50%; top: 52%; z-index: 6; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transform: translate(-50%, -50%);
}
.ws-seal-big { width: 104px; height: 104px; box-shadow: 0 4px 0 color-mix(in srgb, var(--seal) 45%, #1a0408), 0 8px 18px rgba(60, 20, 10, .45), inset 0 0 0 7px color-mix(in srgb, var(--seal) 80%, #000); animation: wsPress .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.ws-seal-big .ws-seal-star { font-size: 48px; }
.ws-press-ring {
  position: absolute; left: 50%; top: 52px; width: 104px; height: 104px; margin: -52px 0 0 -52px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--seal) 70%, #fff); opacity: 0;
  animation: wsPressRing .7s ease-out .22s both;
}
.ws-press-text {
  font-family: var(--ws-hand); font-weight: 600; font-size: 18px; color: color-mix(in srgb, var(--seal) 75%, #2a1006);
  padding: 2px 12px; background: rgba(255, 250, 235, .85); border-radius: 12px;
  animation: wsPressText .4s ease-out .3s both;
}
@keyframes wsPress { 0% { transform: scale(2.6) rotate(-18deg); opacity: 0; } 55% { transform: scale(.88) rotate(4deg); opacity: 1; } 100% { transform: scale(1) rotate(-6deg); opacity: 1; } }
@keyframes wsPressRing { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes wsPressText { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.reduce-motion .ws-seal-big, .reduce-motion .ws-press-ring, .reduce-motion .ws-press-text { animation: none; }

/* ================================================================== 完成：作業台がぱっと光る */
.ws-flash {
  width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 246, 210, .95) 0 12%, rgba(255, 210, 120, .55) 28%, rgba(255, 191, 94, 0) 66%);
  mix-blend-mode: screen;
  animation: wsFlash .9s ease-out both;
}
.ws-flash::before, .ws-flash::after {
  content: ''; position: absolute; left: 50%; top: 50%; background: #fff6d8; box-shadow: 0 0 10px #ffd98a;
}
.ws-flash::before { width: 4px; height: 110px; margin: -55px 0 0 -2px; }
.ws-flash::after { width: 110px; height: 4px; margin: -2px 0 0 -55px; }
@keyframes wsFlash { 0% { transform: scale(.3) rotate(0deg); opacity: 0; } 25% { transform: scale(1.05) rotate(20deg); opacity: 1; } 100% { transform: scale(1.4) rotate(45deg); opacity: 0; } }

/* ================================================================== スマホ縦：ボトムシートで作業台をコンパクトに */
@media (max-width: 600px), (orientation: portrait) and (max-width: 820px) {
  .ws-root { gap: 10px; }
  .ws-bench { padding: 8px 8px 6px; }
  .ws-bench .ws-sec-head { margin-bottom: 6px; }
  .ws-slot { grid-template-columns: 44px 1fr auto; gap: 8px; padding: 5px 6px; }
  .ws-slot + .ws-slot { margin-top: 4px; }
  .ws-slot-icon { width: 44px; height: 44px; }
  .ws-slot-hint { display: none; }
  .ws-wait-item { width: 32px; height: 32px; }
  .ws-wait-item img { width: 28px; height: 28px; }
  .ws-x { width: 32px; height: 32px; }
  .ws-recipe-desc { font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ws-env-from { padding-right: 84px; }
  .ws-want-chip-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ws-paper-close { top: -10px; right: -6px; }
  .ws-paper.has-art .ws-paper-inner { padding: 10px 12px 10px; }
  .ws-paper.has-art .ws-paper-actions { padding-left: 48px; }
  .ws-seal-big { width: 88px; height: 88px; }
}

/* 便箋：ボタンは紙の下に固定、本文がはみ出すときは下をぼかす */
.ws-paper > .ws-paper-actions { flex: none; padding: 8px 30px 18px; }
.ws-paper.has-art > .ws-paper-actions { margin: 0 6% 6.5% 0; padding: 0 0 0 64px; align-items: center; }
.ws-paper.has-art .ws-paper-inner { margin-bottom: 2%; }
.ws-paper-inner.more { -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent); }
@media (max-width: 600px), (orientation: portrait) and (max-width: 820px) {
  .ws-paper.has-art > .ws-paper-actions { padding-left: 48px; margin-right: 5%; }
}
.ws-act-wants { display: flex; gap: 4px; margin-right: auto; flex-wrap: wrap; }
.ws-act-want {
  display: inline-flex; align-items: center; gap: 1px; padding: 0 6px 0 0; border-radius: 6px;
  font-size: 14px; color: #a0453a; background: rgba(125, 93, 64, .12); border: 1px solid rgba(125, 93, 64, .3);
}
.ws-act-want img { width: 32px; height: 32px; margin: -2px 0; }
.ws-act-want.ok { color: #2f7a52; border-color: rgba(47, 122, 82, .45); background: rgba(47, 122, 82, .1); }
@media (max-width: 600px), (orientation: portrait) and (max-width: 820px) {
  .ws-paper > .ws-paper-actions .btn { flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; }
  .ws-act-wants { flex: 0 0 auto; }
  .ws-reserve-note { display: none; }
}

/* ================================================================== あいている作業台は1行にまとめる */
.ws-slot-idle-sum {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px;
  background: rgba(11, 13, 36, .35); border: 1px dashed rgba(255, 217, 138, .2);
}
.ws-slot + .ws-slot-idle-sum { margin-top: 6px; }
.ws-slot-idle-sum .ws-slot-name { color: var(--muted); font-weight: 500; }
.ws-idle-chips { display: flex; gap: 4px; }
.ws-slot-icon.mini { width: 28px; height: 28px; border-radius: 6px; border-width: 2px; }
.ws-slot-icon.mini .ws-slot-num { font-size: 13px; }

/* 便箋（スマホ）：ボタンの字が途中で折れないように。ほしい品のチップは自分の行へ */
@media (max-width: 600px), (orientation: portrait) and (max-width: 820px) {
  .ws-slot-idle-sum { padding: 4px 6px; gap: 8px; }
  .ws-slot + .ws-slot-idle-sum { margin-top: 4px; }
  .ws-slot-idle-sum .ws-slot-hint { display: block; font-size: 11px; }
  .ws-paper > .ws-paper-actions { flex-wrap: wrap; row-gap: 6px; }
  .ws-paper > .ws-paper-actions .ws-act-wants { flex: 1 0 100%; margin-right: 0; }
  .ws-paper > .ws-paper-actions .btn { white-space: nowrap; font-size: 14px; padding-left: 8px; padding-right: 8px; letter-spacing: 0; }
}
