@font-face{
  font-family:"Field Guide Doorway";
  font-style:normal;
  font-weight:400;
  font-display:swap;
  src:url("./doorway.woff2") format("woff2")
}
.couplet-tool{
  --ink:#2e211f;
  --wine:#891b2f;
  color:var(--ink)
}
.couplet-tool [lang="zh-Hans"],.couplet-story [lang="zh-Hans"]{
  font-family:"Field Guide Doorway","Songti SC","Noto Serif CJK SC","SimSun",serif
}
.couplet-tool p,.couplet-story p{max-width:72ch}
.couplet-tool .couplet-form{
  display:flex;
  align-items:flex-end;
  flex-wrap:wrap;
  gap:.9rem 1.2rem;
  margin:1.4rem 0
}
.couplet-tool .couplet-form[hidden]{display:none}
.couplet-form>div{display:grid;gap:.35rem;min-width:0;max-width:100%}
.couplet-form label{font-size:.9rem;font-weight:650}
.couplet-form select,.couplet-form button{
  min-height:44px;border:1px solid #ac8a77;border-radius:.35rem;padding:.45rem .8rem;
  background:#fffaf2;color:var(--ink);font:inherit;max-width:100%
}
.couplet-form .couplet-print{background:#a41934;color:white;border-color:#a41934;cursor:pointer}
.couplet-form :focus-visible{outline:3px solid #286077;outline-offset:3px}
.couplet-example{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:clamp(1rem,4vw,3rem);align-items:start}
.couplet-preview{margin:0 0 .8rem}
.couplet-preview figcaption,.couplet-paper-note{margin-top:.7rem;color:#614b40;font-size:.94rem;line-height:1.55}
#couplet-door{
  display:grid;grid-template-columns:minmax(2rem,1fr) minmax(0,3.4fr) minmax(2rem,1fr);
  grid-template-rows:auto minmax(11rem,1fr);gap:.65rem .45rem;
  max-width:27rem;width:100%;margin:0 auto;padding:clamp(.85rem,3vw,1.65rem);
  border:1px solid #dbbd98;border-radius:.45rem;
  background:linear-gradient(110deg,#f8edda,#ebd8b9);box-sizing:border-box
}
#couplet-door .couplet-paper{
  display:flex;align-items:center;justify-content:space-evenly;min-width:0;
  color:#fff2ce;background:#ab1d37;border:1px solid #8e172f;
  box-shadow:inset 0 0 0 3px #ab1d37,inset 0 0 0 4px #db9b76;
  font-family:"Field Guide Doorway","Songti SC","Noto Serif CJK SC","SimSun",serif;
  font-weight:400;line-height:1.2;box-sizing:border-box
}
#couplet-door .couplet-paper span{display:block;line-height:1.12}
#couplet-door .couplet-plaque{grid-column:1/-1;grid-row:1;flex-direction:row-reverse;justify-self:center;width:66%;padding:.43rem .55rem;font-size:clamp(1.3rem,4vw,2.25rem)}
#couplet-door .couplet-upper,#couplet-door .couplet-lower{grid-row:2;flex-direction:column;gap:.1em;padding:.43rem .1rem;font-size:clamp(1.32rem,3.1vw,2.25rem)}
#couplet-door .couplet-upper{grid-column:3}
#couplet-door .couplet-lower{grid-column:1}
#couplet-door .couplet-leaf{
  grid-column:2;grid-row:2;align-self:stretch;min-height:0;
  background:linear-gradient(to right,transparent 49%,#422a21 49%,#422a21 51%,transparent 51%),linear-gradient(115deg,#6e4b39,#55392d);
  border:3px double #966d51;position:relative
}
#couplet-door .couplet-leaf::before,#couplet-door .couplet-leaf::after{
  content:"";border:1px solid #a37854;position:absolute;top:8%;bottom:8%;width:31%
}
#couplet-door .couplet-leaf::before{left:9%}
#couplet-door .couplet-leaf::after{right:9%}
.couplet-reading h3{margin:0 0 .5rem}
.couplet-reading dl,.couplet-reading dd{margin:0}
.couplet-reading dl>div{padding:.65rem 0;border-top:1px solid #dccbb5}
.couplet-reading dt{color:var(--wine);font-size:.88rem;font-weight:650}
.couplet-reading dd [data-cn]{display:block;font-size:1.27rem;letter-spacing:.06em}
.couplet-reading dd .couplet-pinyin{font-size:.86rem;color:#694b41;display:block}
.couplet-reading dd p{margin:.3rem 0 0;line-height:1.45}
.couplet-story{margin-block:2rem;max-width:72ch}
.couplet-story h3{margin-block-start:1.5rem}
@media(max-width:680px){
  .couplet-example{grid-template-columns:1fr}
  .couplet-tool .couplet-form>div{flex:1 1 14rem}
  .couplet-form select{width:100%}
  #couplet-door{max-width:22rem}
}
@media print{
  @page{size:auto;margin:12mm}
  body *:not(:has(#couplet-door)):not(#couplet-door):not(#couplet-door *){display:none!important}
  html,body,body *:has(#couplet-door){
    display:block!important;position:static!important;float:none!important;overflow:visible!important;
    box-sizing:border-box!important;inset:auto!important;height:auto!important;min-height:0!important;max-height:none!important;
    width:auto!important;max-width:none!important;min-width:0!important;margin:0!important;padding:0!important;
    transform:none!important;border:0!important;background:white!important;box-shadow:none!important;break-before:auto!important;break-after:auto!important
  }
  body *:has(#couplet-door)::before,body *:has(#couplet-door)::after{content:none!important}
  #couplet-door{
    display:grid!important;width:154mm!important;max-width:100%!important;height:auto!important;
    grid-template-columns:27mm 1fr 27mm!important;grid-template-rows:24mm 148mm!important;
    gap:10mm 0!important;margin:auto!important;padding:0!important;background:none!important;
    border:none!important;box-shadow:none!important;break-inside:avoid;page-break-inside:avoid
  }
  #couplet-door .couplet-leaf{display:none!important}
  #couplet-door .couplet-paper{
    color:black!important;border:.3mm solid #333!important;background:white!important;box-shadow:none!important;border-radius:0!important;
    font-size:15mm!important;padding:2mm!important;gap:0!important
  }
  #couplet-door .couplet-plaque{width:106mm!important;align-self:stretch!important}
}
