/* fusen: the writing pad (root) and the fixed layer of stuck notes. */
@property --toy-fusen-note{syntax:"<color>";inherits:true;initial-value:#f3de8a}
@property --toy-fusen-glue{syntax:"<color>";inherits:true;initial-value:#ead07a}
@property --toy-fusen-edge{syntax:"<color>";inherits:true;initial-value:#d9bf62}
@property --toy-fusen-flap{syntax:"<color>";inherits:true;initial-value:#faefc2}
@keyframes toy-fusen-blink{0%,49%{opacity:1}50%,100%{opacity:0}}

.toy-fusen,.toy-fusen-layer{--toy-fusen-size:112px;--toy-fusen-label:9.82;--toy-fusen-strike:.075em}
@media (max-width:760px){.toy-fusen,.toy-fusen-layer{--toy-fusen-size:84px;--toy-fusen-label:13.1}}

.toy-fusen,.toy-fusen-stuck{--toy-fusen-note:#f3de8a;--toy-fusen-glue:#ead07a;--toy-fusen-edge:#d9bf62;--toy-fusen-flap:#faefc2}
.toy-fusen[data-kind="not"],.toy-fusen-stuck[data-kind="not"]{--toy-fusen-note:#f2c4c0;--toy-fusen-glue:#e9b0aa;--toy-fusen-edge:#d9a29c;--toy-fusen-flap:#f9dedb}

/* ---- desk ---- */
.toy-fusen{position:relative;width:100%;height:100%;container-type:size;display:grid;place-items:center;overflow:hidden;color:var(--ink,#0b2a45);font-family:var(--text);
  background-image:radial-gradient(circle,rgba(11,42,69,.07) 1px,transparent 1.5px);background-position:50% 50%;background-size:22px 22px;
  transition:--toy-fusen-note .34s ease,--toy-fusen-glue .34s ease,--toy-fusen-edge .34s ease,--toy-fusen-flap .34s ease}
.toy-fusen-desk{--pad:clamp(132px,min(300px,56cqw,calc(100cqh - 236px)),300px);display:flex;flex-direction:column;align-items:center;width:100%;padding:0 16px}
.toy-fusen-pad{position:relative;width:var(--pad);height:var(--pad);margin-bottom:34px}
/* the rest of the pad: stacked sheet edges below the top sheet */
.toy-fusen-pad::before{content:"";position:absolute;inset:6px 0 -8px;border-radius:2px;
  background:repeating-linear-gradient(to bottom,var(--toy-fusen-note) 0 1.3px,var(--toy-fusen-edge) 1.3px 2px) 0 100%/100% 12px no-repeat,
    linear-gradient(to bottom,var(--toy-fusen-glue) 0,var(--toy-fusen-glue) 13.4%,transparent 14.4%),var(--toy-fusen-note);
  box-shadow:0 1px 1px rgba(11,42,69,.12),0 14px 22px -12px rgba(11,42,69,.42)}

/* ---- a note face, shared by the draft and stuck notes; sizes in --u (1/100 of a side) ---- */
.toy-fusen-note{position:absolute;isolation:isolate;display:block}
.toy-fusen-sheet{position:absolute;inset:0;z-index:0;border-radius:2px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--u) * 2.2);
  padding:calc(var(--u) * 16) calc(var(--u) * 8) calc(var(--u) * 6);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .26 0 0 0 0 .22 0 0 0 -1.1 .6'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E"),
    linear-gradient(to bottom,var(--toy-fusen-glue) 0,var(--toy-fusen-glue) 13.4%,rgba(120,90,20,.12) 13.6%,transparent 14.4%),
    linear-gradient(172deg,rgba(255,255,255,.42),rgba(255,255,255,0) 38%,rgba(70,50,40,0) 70%,rgba(70,50,40,.06)),
    var(--toy-fusen-note);
  -webkit-mask:linear-gradient(315deg,transparent 6%,#000 6.25%);mask:linear-gradient(315deg,transparent 6%,#000 6.25%)}
/* curled corner: the folded flap, and the shadow of the lifted corner */
.toy-fusen-note::after{content:"";position:absolute;right:0;bottom:0;z-index:1;width:12%;height:12%;pointer-events:none;
  background:linear-gradient(to bottom right,var(--toy-fusen-flap) 0%,var(--toy-fusen-note) 36%,var(--toy-fusen-glue) 49.4%,transparent 50%);
  filter:drop-shadow(calc(var(--u) * -.5) calc(var(--u) * -.5) calc(var(--u) * .9) rgba(80,55,0,.22))}
.toy-fusen-note::before{content:"";position:absolute;right:1%;bottom:1%;z-index:-1;width:34%;height:16%;border-radius:50%;pointer-events:none;
  background:rgba(11,42,69,.34);filter:blur(calc(var(--u) * 2.6));transform:translate(calc(var(--u) * 1.2),calc(var(--u) * 2)) rotate(-10deg)}
.toy-fusen-not{font-family:var(--text);font-weight:700;font-size:calc(var(--u) * var(--toy-fusen-label));line-height:1;letter-spacing:.16em;margin-right:-.16em;color:var(--shu,#c23a22)}
.toy-fusen-not[hidden]{display:none}
.toy-fusen-words{display:block;max-width:100%;font-family:var(--hand);font-weight:400;font-size:calc(var(--u) * var(--fs,18));line-height:1.3;text-align:center;white-space:pre;color:var(--ink,#0b2a45);font-feature-settings:"palt" 0}

/* ---- the draft on the pad ---- */
.toy-fusen-draft{--u:calc(var(--pad) / 100);inset:0;filter:drop-shadow(0 1px 0 rgba(11,42,69,.1))}
.toy-fusen-input{position:absolute;inset:0;z-index:2;width:100%;height:100%;margin:0;padding:calc(var(--u) * 14) calc(var(--u) * 8) 0;border:0;border-radius:2px;background:transparent;
  font-family:var(--hand);font-size:calc(var(--u) * 14);text-align:center;color:transparent;caret-color:transparent;cursor:text;outline-offset:8px}
.toy-fusen-input::placeholder{color:transparent}
.toy-fusen-input::selection{background:transparent;color:transparent}
.toy-fusen-input:focus-visible{outline:1.5px solid rgba(11,42,69,.24)}
.toy-fusen-ph{opacity:.34}
.toy-fusen-sel{background:rgba(11,42,69,.16);border-radius:2px}
.toy-fusen-comp{text-decoration:underline;text-decoration-thickness:.06em;text-underline-offset:.16em}
.toy-fusen-caret{position:relative;display:inline-block;width:0;height:1.06em;vertical-align:-.16em}
.toy-fusen-caret::after{content:"";position:absolute;left:-1px;top:0;bottom:0;width:2px;border-radius:1px;background:var(--ink,#0b2a45);animation:toy-fusen-blink 1.06s infinite}

/* ---- controls ---- */
.toy-fusen-controls{display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap}
.toy-fusen-kinds{display:flex;gap:2px;padding:3px;border-radius:4px;background:rgba(11,42,69,.07)}
.toy-fusen-kind,.toy-fusen-post{-webkit-appearance:none;appearance:none;border:0;margin:0;font:inherit;cursor:pointer;min-height:44px;border-radius:4px;transition:background-color .2s ease,color .2s ease,box-shadow .2s ease,opacity .2s ease}
.toy-fusen-kind{display:inline-flex;align-items:center;gap:8px;padding:0 15px 0 13px;background:transparent;color:rgba(11,42,69,.6);font-size:15px;font-weight:700;letter-spacing:.02em;line-height:1}
.toy-fusen-kind:hover{color:var(--ink,#0b2a45)}
.toy-fusen-kind[aria-pressed="true"]{background:var(--paper,#fbfaf5);color:var(--ink,#0b2a45);box-shadow:0 1px 2px rgba(11,42,69,.16),0 2px 6px -2px rgba(11,42,69,.14)}
.toy-fusen-chip{width:13px;height:13px;border-radius:1px;background:linear-gradient(to bottom,#ead07a 0 26%,#f3de8a 26%);box-shadow:0 1px 1px rgba(11,42,69,.18);transform:rotate(-4deg)}
.toy-fusen-kind[data-kind="not"] .toy-fusen-chip{background:linear-gradient(to bottom,#e9b0aa 0 26%,#f2c4c0 26%);transform:rotate(3deg)}
.toy-fusen-post{min-height:50px;padding:0 30px;background:var(--ink,#0b2a45);color:var(--paper,#fbfaf5);font-size:16px;font-weight:700;letter-spacing:.3em;text-indent:.3em;box-shadow:0 1px 1px rgba(11,42,69,.2),0 6px 14px -8px rgba(11,42,69,.6)}
.toy-fusen-post:hover{background:#163c5f}
.toy-fusen-post[aria-disabled="true"]{opacity:.42}
.toy-fusen-kind:active,.toy-fusen-post:active{transform:translateY(1px)}
.toy-fusen-kind:focus-visible,.toy-fusen-post:focus-visible{outline:2px solid var(--ink,#0b2a45);outline-offset:3px}
.toy-fusen-desc{margin-top:16px;min-height:1.7em;max-width:32em;font-size:15px;line-height:1.7;text-align:center;color:rgba(11,42,69,.7)}
.toy-fusen-desc.is-notice{color:var(--ink,#0b2a45);font-weight:700}
@container (max-width:480px){
  .toy-fusen-desk{padding:0 12px}
  .toy-fusen-pad{margin-bottom:28px}
  .toy-fusen-controls{gap:8px;flex-wrap:nowrap}
  .toy-fusen-kind{gap:6px;padding:0 10px 0 9px;font-size:14px}
  .toy-fusen-chip{width:11px;height:11px}
  .toy-fusen-post{padding:0 18px;letter-spacing:.2em;text-indent:.2em}
  .toy-fusen-desc{margin-top:12px;min-height:3.4em}
}

/* ---- fixed layer ---- */
.toy-fusen-layer{position:fixed;top:84px;right:16px;z-index:12;width:var(--toy-fusen-size);height:0;pointer-events:none}
.toy-fusen-stuck{--u:calc(var(--toy-fusen-size) / 100);top:0;right:0;z-index:var(--slot,0);width:var(--toy-fusen-size);height:var(--toy-fusen-size);margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer;pointer-events:auto;
  -webkit-appearance:none;appearance:none;-webkit-tap-highlight-color:transparent;
  transform:translate(var(--jx,0px),calc(var(--slot,0) * var(--toy-fusen-size) * .84)) rotate(var(--r,0deg));
  filter:drop-shadow(0 1px 1px rgba(11,42,69,.16)) drop-shadow(0 4px 5px rgba(11,42,69,.1));
  transition:transform .36s var(--ease,cubic-bezier(.16,1,.3,1)),scale .22s var(--ease,cubic-bezier(.16,1,.3,1))}
.toy-fusen-stuck:hover{scale:1.04}
.toy-fusen-stuck:active{scale:1.01}
.toy-fusen-stuck:focus-visible{outline:2px solid var(--ink,#0b2a45);outline-offset:4px}
.toy-fusen-stuck:disabled{cursor:default}
.toy-fusen-stuck .toy-fusen-words{line-height:1.26}
.toy-fusen-ink{background:linear-gradient(currentColor,currentColor) 0 60%/0% var(--toy-fusen-strike) no-repeat}

/* ---- still ---- */
@media (prefers-reduced-motion:reduce){
  .toy-fusen *,.toy-fusen-layer *,.toy-fusen{transition:none!important;animation:none!important}
}
html[data-still] .toy-fusen,html[data-still] .toy-fusen *,html[data-still] .toy-fusen-layer *{transition:none!important;animation:none!important}
