/* V4 styling for the decree input screen only. */
body:has(#v3-quick.active > .decree-form-v4) { background:#eee5db; }
.app:has(#v3-quick.active > .decree-form-v4) {
  --bg:#faf6ef; --paper:#fffdf9; --ink:#46352f; --muted:#79665e;
  --wine:#873a4c; --wine-dark:#702b3e; --line:#eadbd0;
  --serif:"Songti SC","Noto Serif CJK SC","STSong","SimSun",serif;
  --sans:"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",system-ui,sans-serif;
  width:100%; max-width:480px; min-height:100vh; min-height:100dvh; margin:0 auto;
  display:flex; flex-direction:column; overflow:clip;
  background:var(--bg); color:var(--ink); font:16px/1.5 var(--sans);
}
.app:has(#v3-quick.active > .decree-form-v4) > .topbar { display:none; }
.app:has(#v3-quick.active > .decree-form-v4) > .v3-main { padding:0; flex:1 0 auto; }
.decree-form-v4 {
  padding:calc(24px + env(safe-area-inset-top, 0px))
    max(clamp(15px, 5vw, 24px), env(safe-area-inset-right, 0px)) 28px
    max(clamp(15px, 5vw, 24px), env(safe-area-inset-left, 0px));
  background:radial-gradient(ellipse 260px 255px at 100% 0,#f6e7d6,transparent);
}
.decree-v4-intro { position:relative; margin:14px 0 17px; }
.decree-v4-back {
  min-height:44px; padding:0; border:0; background:none; color:var(--wine);
  font:650 .875rem/1.4 var(--sans);
}
.decree-v4-back span { margin-right:4px; }
.decree-v4-kicker {
  display:flex; align-items:center; gap:8px; color:#8c6147;
  font-size:.66rem; font-weight:750; letter-spacing:.1em;
}
.decree-v4-kicker::before { content:""; width:20px; border-top:1px solid #c79a7a; }
.decree-v4-intro h1 {
  margin:5px 64px 0 0; color:#4b3435;
  font:900 clamp(25px,7.2vw,32px)/1.4 var(--serif); letter-spacing:.025em;
}
.decree-v4-intro p { margin:7px 64px 0 0; color:var(--muted); font-size:.81rem; line-height:1.6; }
.decree-v4-crown {
  position:absolute; right:4px; bottom:5px; width:clamp(43px,14vw,60px);
  aspect-ratio:1; display:grid; place-items:center; transform:rotate(8deg);
  border:1px solid #d9bd87; border-radius:14px; color:#926c35;
  background:linear-gradient(145deg,#fff9e9,#efdfbd); box-shadow:4px 4px 0 #e9dbc2;
  pointer-events:none;
}
.decree-v4-crown svg { width:68%; }
.decree-v4-flair {
  display:flex; align-items:center; justify-content:center; gap:10px; min-height:34px; margin:0 0 13px;
  border-block:1px solid #e1cba5; background:linear-gradient(90deg,transparent,#f8f0df,transparent);
  color:#835c40; font:700 .78rem/1.5 var(--serif); letter-spacing:.13em;
}
.decree-v4-flair span { color:#9e784f; }
.decree-form-v4 .template-switch { margin:0 0 14px; display:flex; flex-wrap:wrap; gap:7px; }
.decree-form-v4 .template-switch button {
  min-height:44px; padding:6px clamp(10px,3vw,15px); border:1px solid #dfcfc3;
  border-radius:999px; background:var(--paper); color:#725952; font:700 .81rem/1.4 var(--sans);
}
.decree-form-v4 .template-switch button.active { background:#4f342e; border-color:#4f342e; color:#fff; }
.decree-v4-sheet {
  padding:13px; border:1px solid var(--line); border-top:3px solid #c9ad7b;
  border-radius:22px; background:var(--paper); box-shadow:0 10px 28px #7d5a4e0a;
}
.decree-v4-sheet-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:1px 1px 12px; }
.decree-v4-sheet-head h2 { display:flex; align-items:center; gap:8px; margin:0; font-size:.94rem; }
.decree-v4-sheet-head h2 span {
  display:grid; place-items:center; width:29px; height:29px; transform:rotate(-6deg);
  border:2px double #bca073; border-radius:5px; background:#f7ead4; color:#885a38; font:800 1rem/1 var(--serif);
}
.decree-v4-sheet-head > span {
  padding:5px 7px; border:1px dashed #dcca9d; border-radius:7px; background:#fff9ed;
  color:#80613c; font:700 .65rem/1.25 Georgia,serif; letter-spacing:.08em; white-space:nowrap;
}
.decree-v4-fields { display:grid; gap:10px; }
.decree-v4-field {
  display:grid; gap:8px; min-width:0; padding:11px; border:1px solid #eadbd2;
  border-radius:16px; background:var(--paper); box-shadow:0 4px 15px #9a66580a;
}
.decree-v4-field:focus-within { border-color:#cda39c; }
.decree-v4-field-head { display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.decree-v4-field-num {
  padding:4px 6px; border-radius:5px; background:#f4ead7; color:#835e37;
  font:700 .72rem/1.3 Georgia,serif;
}
.decree-v4-field-name { font-size:.91rem; font-weight:750; }
.decree-v4-field-head small { margin-inline-start:auto; font-size:.72rem; color:var(--muted); }
.decree-form-v4 :is(.v3-input,.v3-textarea) {
  display:block; width:100%; min-width:0; min-height:44px; padding:8px 10px;
  border:1px solid #e5d5ca; border-radius:11px; background:#fcf7f1; color:var(--ink);
  font:400 1rem/1.5 var(--sans); scroll-margin-block:16px 80px;
}
.decree-form-v4 .v3-textarea {
  field-sizing:content; min-height:72px; max-height:min(13rem,45svh); resize:vertical; overflow-y:auto;
}
.decree-form-v4 :is(input,textarea)::placeholder { color:#806b61; opacity:1; }
.decree-form-v4 :is(button,input,textarea):focus-visible { outline:2px solid #ad6573; outline-offset:2px; }
.decree-form-v4 .decree-v4-submit {
  width:100%; min-height:52px; margin-top:15px; border:1px solid var(--wine);
  border-radius:13px; background:var(--wine); color:#fff; font:750 1rem/1.4 var(--sans);
  box-shadow:0 5px 0 #743044,0 9px 16px #8c405022;
}
.decree-form-v4 .decree-v4-submit:hover { background:var(--wine-dark); }
.decree-form-v4 .decree-v4-submit span { margin-left:7px; }
.decree-v4-note { margin:12px 0 0; text-align:center; color:var(--muted); font-size:.78rem; }

.app:has(#v3-quick.active > .decree-form-v4) > .bottom-nav,
.app:has(#v3-quick.active > .decree-form-v4) > .topbar > .desktop-nav {
  position:sticky; inset:auto 0 0; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0;
  height:auto; padding:8px 16px calc(11px + env(safe-area-inset-bottom, 0px));
  background:#fffdf9f5; border-top:1px solid #eaded4; z-index:4;
}
.app:has(#v3-quick.active > .decree-form-v4) :is(.desktop-nav,.bottom-nav) button {
  position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center;
  min-height:44px; gap:4px; padding:3px 6px; color:#786a60; background:none; border:0;
  font:650 .69rem/1.3 var(--sans);
}
.app:has(#v3-quick.active > .decree-form-v4) :is(.desktop-nav,.bottom-nav) button[data-v3screen="home"] { color:var(--wine); }
.app:has(#v3-quick.active > .decree-form-v4) :is(.desktop-nav,.bottom-nav) button[data-v3screen="home"]::after {
  content:""; position:absolute; bottom:-4px; width:4px; height:4px; border-radius:50%; background:#aa5061;
}
.app:has(#v3-quick.active > .decree-form-v4) :is(.desktop-nav,.bottom-nav) .v5-nav-icon { display:block; width:21px; height:21px; stroke-width:1.8; }
.app:has(#v3-quick.active > .decree-form-v4) :is(.desktop-nav,.bottom-nav) .v5-nav-caption { display:block; }
.app:has(#v3-quick.active > .decree-form-v4) :is(.desktop-nav,.bottom-nav) .v5-nav-original { display:none; }
@media (max-width:767px) and (pointer:coarse) {
  .app:has(#v3-quick.active > .decree-form-v4 :is(input,textarea):focus) > .bottom-nav { position:static; }
}
@media (min-width:768px) {
  body:has(#v3-quick.active > .decree-form-v4) {
    padding:42px 25px; background:radial-gradient(circle at 24% 22%,#f5e0cf,transparent 26%),#eee9e2;
  }
  .app:has(#v3-quick.active > .decree-form-v4) {
    width:430px; border-radius:30px; border:7px solid #fdf9f4;
    box-shadow:0 26px 75px #76574a35,0 0 0 1px #d9cbc1;
  }
  .app:has(#v3-quick.active > .decree-form-v4) > .topbar { display:contents; }
  .app:has(#v3-quick.active > .decree-form-v4) > .topbar > :not(.desktop-nav) { display:none; }
  .app:has(#v3-quick.active > .decree-form-v4) > .topbar > .desktop-nav { display:grid; order:1; }
  .app:has(#v3-quick.active > .decree-form-v4) > .bottom-nav { display:none; }
}
