/* Board Creator's page parts. Unlayered, above dq.css: the prototype's rules sit in dq.css's legacy block, where a rule
   that refines a dq.css class (.btn, .row) can never win. */
/* The page head (.phead) in a column too narrow for the title and the tools on one line puts the tools under the title. */
/* With no buttons the head is read, not shown (dq.css .phead with no actions), so the card starts the page area. */
.chead{align-self:stretch;row-gap:24px;border-bottom-color:transparent}
.chead h1{flex-basis:auto}
@media (min-width:768px) and (min-height:520px){ #card{margin-block:4px 12px} }
.send.btn{width:420px;max-width:100%;height:56px;font-size:17px}
/* A phone lying flat is the one place Send may shrink, with the height it has. */
@media (orientation:landscape){ .send.btn{height:clamp(52px, 9vh, 56px);font-size:clamp(16px, 2.1vh, 17px)} }
.send.btn:disabled{opacity:.55;cursor:not-allowed}
.send.btn[hidden]{display:none}
.sendfix{width:420px;max-width:100%;align-items:center}
.sendfix > span{flex:1 1 auto}
.sendfix > .btn{flex:none}
.sendfix[hidden]{display:none}
.reviewpair{display:flex;gap:10px;width:520px;max-width:100%}
.reviewpair[hidden]{display:none}
/* Two buttons share Send's place, so a long word wraps inside its button rather than past it. */
.reviewpair > .btn{flex:1 1 0;min-width:0;height:56px;padding:0 12px;font-size:17px;white-space:normal;line-height:1.15;text-align:center}
@media (orientation:landscape){ .reviewpair > .btn{height:clamp(52px, 9vh, 56px);font-size:clamp(16px, 2.1vh, 17px)} }
.reviewpair > .btn[hidden]{display:none}
.reviewpair > .save-first{background:var(--gold);border-color:var(--gold);color:var(--gold-ink)}
.creview{display:flex;align-items:center;flex-wrap:wrap;justify-content:center;gap:8px 12px;margin:0;font-size:14px;color:var(--ink)}
.creview[hidden]{display:none}
.promo{align-self:stretch;gap:14px;padding:16px 18px;margin-top:28px;background:var(--sel-tint);border-color:var(--accent-line)}
.promo[hidden]{display:none}
.promo-ic{flex:none;display:flex;align-items:center;justify-content:center;width:42px;height:42px;
  border-radius:12px;background:var(--panel);color:var(--accent-line)}
.promo-tx{flex-grow:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.promo-tx > b{font-size:15px;font-weight:800}
.promo-tx p{margin:0;font-size:13px;line-height:1.4;color:var(--muted)}
.promo .btn{flex:none}
.stagein > .sup{align-self:stretch;margin-top:28px}
/* With no supporter to show the block is empty, and its margin alone would be a gap. */
.stagein > .sup:not(:has(.panel)){display:none}

/* The QSL menu on the card (new-design-editor.js drawMenuButton): above the toolbar, the tray and every element. */
.cmenu{position:absolute;top:10px;right:10px;z-index:12;display:flex;align-items:center;gap:8px;height:40px;padding:0 14px;
  border:1px solid var(--line);border-radius:20px;background:var(--panel);color:var(--ink);font-family:Archivo,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;font-size:14px;font-weight:800;line-height:1;white-space:nowrap;
  box-shadow:0 8px 20px -10px rgba(0,0,0,.55);cursor:pointer}
.cmenu svg{width:20px;height:20px}
.cmenu:focus-visible{outline:2px solid var(--accent-line);outline-offset:2px}
/* Turn the card over: round, left of the QSL menu button (its right edge is set by qsl-editor-behaviours.js cardBack). */
.cmenu.flip{width:40px;padding:0;justify-content:center;border-radius:50%}
/* The back hides every part of the front; only the back's picture or its empty state shows. */
#card.onback > .el{visibility:hidden}
#card .cardback{position:absolute;inset:0;z-index:11;border-radius:inherit;overflow:hidden;background:var(--panel2)}
#card .cardback img{width:100%;height:100%;object-fit:cover;display:block}
#card .cardback.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:24px;text-align:center;border:2px dashed var(--line);color:var(--ink)}
#card .cardback.empty h3{margin:0;font-size:22px}
#card .cardback.empty p{margin:0;color:var(--muted);max-width:460px}
#card .cardback .row{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
#card .cardback .btn svg{flex:none}
#card .cardback.empty,#card .cardback .btn{font-family:Archivo,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif}
/* The creator's own dialog (#modal) in board .dlg, filled with dq.css's board parts (CreatorDialogs). */
@media (min-width:600px){ #modal .modalin{width:460px;max-width:100%} #modal.chip-dialog .modalin{width:510px} }
#modal .hd > div{flex-grow:1;min-width:0}
#modal .modalin:focus{outline:none}
#mClose{flex:none;margin:-8px -10px 0 auto;color:var(--ink)}
/* A Done waiting on a valid value keeps its green, faded, so it still reads as the same button. */
#mOk:disabled:not([aria-busy="true"]){opacity:.45;cursor:default}
#mBody .inp,#emenuin .inp{text-transform:none}
#mBody .gline .btn{height:46px}
#mBody .grow > .quick{margin-top:10px}
/* A signal report's picks share the box's line, and drop under it when the box would get too narrow. */
#mBody :is(.gline,.bigline):has(> .quick){flex-wrap:wrap}
#mBody :is(.gline,.bigline):has(> .quick) > .inwrap{flex:1 1 150px}
#mBody :is(.gline,.bigline) > .quick{display:flex;flex:none;gap:6px}
#mBody :is(.gline,.bigline) > .quick .opt{min-width:48px;padding:0 8px}
#mBody .quick .opt:disabled{opacity:.45;cursor:not-allowed}
#mBody .cnt.near{color:var(--neg)}
#mBody select.inp{text-overflow:ellipsis;background-position:calc(100% - 20px) center,calc(100% - 14px) center}
#mBody .row:has(> input[type=range]){flex-wrap:wrap;justify-content:space-between;row-gap:10px}
#mBody .row > .lbl{display:flex;justify-content:space-between;align-items:center;flex:1 1 100%;margin:0}
#mBody .swatches{display:flex;flex-wrap:wrap;gap:10px}
:is(#mBody,.eltray) input.swc{-webkit-appearance:none;appearance:none}
:is(#mBody,.eltray) input.swc::-webkit-color-swatch-wrapper{padding:0}
:is(#mBody,.eltray) input.swc::-webkit-color-swatch{border:0;opacity:0}
:is(#mBody,.eltray) input.swc::-moz-color-swatch{border:0;opacity:0}
:is(#mBody,#mBody [data-pane]) > :not(.swrow) + .swrow{border-top:1px solid var(--row)}
:is(#mBody,#mBody [data-pane]) > .swrow + .swrow{margin-top:-16px}
/* The options dialog's Text, Style and Card panes (new-design-editor.js optionPanes); a phone's sheet stops at about half height. */
#mBody [data-pane]{display:flex;flex-direction:column;gap:16px}
#mBody [data-pane][hidden]{display:none}
#mBody [data-pane] .changebtn.d{align-self:flex-start;display:inline-flex;align-items:center;gap:8px}
#mBody [data-pane] .changebtn svg{width:18px;height:18px}
/* The creator's own phone query (new-design-editor.js PHONE_Q), which picks the sheet over the toolbar. */
@media not all and (min-width:768px) and (min-height:520px){ #modal.half{background:rgba(0,0,0,.3)} #modal.half .modalin{max-height:min(60%, 560px)} }
#mBody [data-band-extras],#mBody [data-mode-extras]{display:flex;flex-direction:column;gap:16px}
#mBody .mockrow{display:flex;align-items:center;gap:10px;font-size:15px;font-weight:700;cursor:pointer}
#mBody .opt[data-more]{font-family:inherit;font-size:clamp(10px, calc((100vw - 64px) / 28), 15px)}
#mBody .opt.one-word{white-space:nowrap}
#mBody .restore{align-self:flex-start;padding:0 2px;color:var(--muted)}
#mBody .hint2[data-this-qsl-only]{background:var(--sel-tint);color:var(--ink)}
#mBody .hint2[data-this-qsl-only] .ic{display:flex;flex-shrink:0;color:var(--accent-line)}
#mBody .hint2[data-this-qsl-only] a{font-weight:800}
#mBody .hint2[hidden],#mBody .errmsg[hidden],#mBody .hint[hidden]{display:none}
#mBody .lbl .pill{height:18px;margin-left:8px;padding:0 7px;border-radius:6px;font-size:11px;letter-spacing:.06em}
#mBody .gin[data-custom]{border:2px solid var(--accent-line)}
/* The mono box writes capitals; its "(optional)" hint keeps its own case. */
#mBody [data-key="MY_RST"] .inp::placeholder{text-transform:none}
#mBody .hint2[data-send-route="resolved"]{background:var(--sel-tint);color:var(--ink)}
#mBody .hint2[data-send-route] .ic{display:flex;flex-shrink:0;color:var(--accent-line)}
#mBody [data-send-route].hint{margin-top:-8px}
#mBody .lbl .lblnote{font-weight:500;color:var(--muted)}
#mBody textarea.inp{resize:none;text-transform:none}
/* The send message's counter sits in the box's bottom right corner, under the last line. */
#mBody .cf.area .inp{display:block;padding:12px 14px 30px}
#mBody .cf.area .cnt{top:auto;bottom:9px}
#mBody .mailprev{padding:12px 14px;border-radius:12px;border:1px solid var(--line-soft);background:var(--panel2);font-size:13px;line-height:1.5;color:var(--muted);overflow-wrap:anywhere}
#mBody .mailprev p{margin:0 0 8px;white-space:pre-line}
#mBody .mailprev p:last-child{margin-bottom:0}
#mBody .sendattach{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:12px;padding:10px;border-radius:12px;background:var(--panel2);font-size:13px;color:var(--muted)}
#mBody .sendattach figure{margin:0;display:flex;flex-direction:column;align-items:center;gap:4px;font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase}
#mBody .sendattach img{width:84px;aspect-ratio:1654/1063;object-fit:cover;border-radius:6px;border:1px solid var(--line-soft);background:var(--panel)}
#mBody .sendattach > span:last-child{flex:1 1 160px}
#modal .mbtns.sendsplit{position:relative;gap:0}
#modal .mbtns.sendsplit .ok{height:50px;border-radius:13px 0 0 13px}
#modal .mbtns.sendsplit .sendmore{flex:0 0 50px;width:50px;height:50px;border-radius:0 13px 13px 0;border-left:1px solid rgba(255,255,255,.35)}
#modal .sendmenu{position:absolute;right:22px;bottom:calc(100% - 12px);min-width:200px;z-index:2}
/* Templates beside the Message label, and the line under the box naming the one in use. */
#mBody .tplrow{position:relative;display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 6px}
#mBody .tplrow .lbl{margin:0}
#mBody .tplbtn{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--ink);font:inherit;font-size:13px;font-weight:800;cursor:pointer}
#mBody .tplbtn[aria-expanded="true"]{background:var(--sel-tint);border-color:var(--accent-line)}
#mBody .tplbtn svg{flex:none}
#mBody .tplprem{display:flex;color:var(--accent-line)}
#mBody .tplmenu{position:absolute;right:0;top:calc(100% + 6px);z-index:3;width:min(330px,calc(100vw - 48px));padding:6px}
#mBody .tplmenu .mrow{height:auto;min-height:46px;padding:6px 12px;white-space:normal}
#mBody .tplmenu .mrow:disabled{cursor:default}
#mBody .tplmenu .mrow.dis .prem-badge{margin-left:auto}
#mBody .tplmenu .mrow.cur{background:var(--sel-tint)}
#mBody .tpltxt{display:flex;flex:1;flex-direction:column;min-width:0}
#mBody .tpltxt span{font-size:13px;font-weight:500;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#mBody .tplsep{height:1px;margin:6px 4px;background:var(--line-soft)}
#mBody .tplcount{padding:4px 12px 2px;font-size:12px;font-weight:700;color:var(--muted)}
#mBody .tplnote{padding:6px 12px 10px;font-size:13px;color:var(--muted)}
#mBody .tplitem{display:flex;align-items:center;gap:2px}
#mBody .tplitem .mrow{flex:1;min-width:0}
#mBody .tpledit{flex:none;width:40px;height:40px;color:var(--muted)}
#mBody .tplupsell{margin:4px;padding:12px;border-radius:12px;background:var(--sel-tint);font-size:13px;line-height:1.45;color:var(--ink)}
#mBody .tplupsell b{display:block;margin-bottom:4px}
#mBody .tplupsell a{font-weight:800;color:var(--accent-line)}
#mBody .tplfrom{position:absolute;left:14px;bottom:9px;max-width:calc(100% - 90px);font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
@media (hover:hover){ #mBody .tplmenu .mrow:not(:disabled):hover,#mBody .tplbtn:hover{background:var(--row)} }
.template-modal .inp{text-transform:none}
.template-modal .modal-body > div > * + *{margin-top:12px}
.template-modal textarea.inp{resize:none}
.template-modal .cf.area .inp{display:block;padding:12px 14px 30px}
.template-modal .cf.area .cnt{top:auto;bottom:9px}
.template-modal .tplsaves{font-size:13px;line-height:1.5;color:var(--muted);overflow-wrap:anywhere;white-space:pre-line}
.template-modal select{width:100%}
#mBody .seg{display:flex;padding:4px;gap:4px;border-radius:14px;border:1px solid var(--line-soft)}
#mBody .seg button{flex:1;height:42px;border-radius:10px;font-size:15px}
#mBody .seg .on{box-shadow:0 1px 0 var(--line-soft),0 2px 8px -4px rgba(0,0,0,.25)}
/* Older Safari draws an outline square over rounded corners; a box-shadow follows them. */
#mBody .opt:focus-visible{outline:none;box-shadow:0 0 0 3px var(--accent-line)}
#mBody .swc:focus-visible,#mBody .thumb:focus-visible{outline-offset:4px}
#mBody .thumb{padding:0;background:var(--panel2);cursor:pointer}
#mBody .thumb img{width:100%;height:100%;object-fit:cover;display:block}
#mBody .storedpics:empty{display:none}
#mBody .storedpics > .hint{margin-bottom:12px}
#mBody .thumbcell{position:relative}
#mBody .thumb[aria-current=true]{box-shadow:0 0 0 3px var(--accent-line)}
#mBody .thumbflip{position:absolute;top:4px;right:4px;width:30px;height:30px;padding:0;display:grid;place-items:center;border:0;border-radius:8px;background:rgba(12,16,19,.75);color:#fff;cursor:pointer}
#mBody .thumbflip svg{width:16px;height:16px}
#mBody .hiddenpics{display:block;margin-top:10px;padding:0;border:0;background:none;color:var(--muted);font-size:13px;font-weight:700;text-decoration:underline;cursor:pointer}

/* The card menu (#emenuin), board .menu: a popup on a desktop, below that a sheet with a handle (M-CreatorMenu). */
#emenuin{border-radius:22px 22px 0 0;border-bottom:0;padding:0 8px calc(12px + env(safe-area-inset-bottom))}
:is(#emenuin,#qslmenu) .emtitle{text-transform:uppercase}
:is(#emenuin,#qslmenu) .grow{padding:0 4px 6px}
:is(#emenuin,#qslmenu) button.gin{width:100%;height:44px;font-size:15px}
:is(#emenuin,#qslmenu) :is([data-station-list],[data-design-list]){position:fixed;z-index:1;overflow:auto;border:2px solid var(--accent-line)}
:is(#emenuin,#qslmenu) :is([data-station-list],[data-design-list])[hidden]{display:none}
:is(#emenuin,#qslmenu) .emthumbrow{height:auto;min-height:56px;padding-top:5px;padding-bottom:5px}
/* The tick's place is kept on every row, so the pictures line up whether or not a row is ticked. */
:is(#emenuin,#qslmenu) .emthumbrow .ic{width:18px}
:is(#emenuin,#qslmenu) .emthumb{flex:none;width:72px;height:auto;aspect-ratio:140 / 90;border-radius:5px;object-fit:cover;box-shadow:0 0 0 1px var(--line-soft)}
/* The QSL menu's parts: a row that opens or adds the part, and the creator's switch beside it. */
:is(#emenuin,#qslmenu) .emline{display:flex;align-items:center;gap:8px;padding-right:10px;border-radius:12px}
:is(#emenuin,#qslmenu) .emline > .emrow{flex:1;min-width:0;height:auto;min-height:52px;padding:6px 8px}
:is(#emenuin,#qslmenu) .emline .ic{width:38px;height:38px;border-radius:11px;align-items:center;justify-content:center;background:var(--panel2)}
:is(#emenuin,#qslmenu) .emline.on .ic{background:var(--sel-tint)}
:is(#emenuin,#qslmenu) .emline.on .ic > svg{color:var(--accent-line)}
:is(#emenuin,#qslmenu) .emtx{display:flex;flex-direction:column;gap:2px;min-width:0}
:is(#emenuin,#qslmenu) .emsub{font-size:12px;font-weight:600;line-height:1.25;color:var(--muted);white-space:normal}
:is(#emenuin,#qslmenu) .emline .sw:focus-visible{outline:2px solid var(--accent-line);outline-offset:2px}
#emenuin .app-modal-grab{display:flex;justify-content:center;padding:10px 0 6px;touch-action:none;cursor:grab}
#emenuin .app-modal-grab::before{content:'';width:40px;height:5px;border-radius:3px;background:var(--line)}
@media (hover:hover){ :is(#emenuin,#qslmenu) .mrow:hover,#modal .sendmenu .mrow:hover{background:var(--row)} }
@media (hover:hover) and (pointer:fine) and (min-width:820px){
  #emenuin{border-radius:18px;border-bottom:1px solid var(--line-soft);padding:8px}
  #emenuin .app-modal-grab{display:none}
}

/* The phone's creator, board M-Creator; the same breakpoint as dq.css's phone shell. */
@media not all and (min-width:768px) and (min-height:520px){
  .chead{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px 8px;padding-bottom:0;border-bottom:0}
  .promo{display:none}
  .stagein > .sup{display:none}
  /* The QSL menu is drawn under the card instead (new-design-editor.js drawInlineMenu). */
  .cmenu:not(.flip){display:none}
  .cmenu.flip{right:10px !important}
  /* No card around the page on a phone: the menu loses its frame and sits on the page. */
  #qslmenu{align-self:stretch;padding:4px 0 8px;border:0;border-radius:0;background:transparent;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
  /* Above the Send band, which the popup's sheet sat above too. */
  #qslmenu :is([data-station-list],[data-design-list]){z-index:600}
  #qslmenu .emsep{margin:4px}
  /* The page area is the creator's height, so the card stays put and only the menu scrolls. */
  .main-content:has(.stagein),.creator-wrap:has(.stagein),#qsl-creator-container{flex:1 1 0;min-height:0;display:flex;flex-direction:column}
  .stagein{flex:1 1 0;min-height:0}
  .stagein > #card{flex:none}
  .stagein > #qslmenu{flex:1 1 0;min-height:0;overflow:auto;overscroll-behavior:contain}
}
#qslmenu[hidden]{display:none}
/* A phone lying flat: the card on the left, the menu and Send on the right (new-design-editor.js fitCard reads this column). */
@media not all and (min-width:768px) and (min-height:520px){
  @media (orientation:landscape){
    .stagein{display:grid;grid-template-columns:minmax(0,1fr) minmax(240px,40%);grid-template-rows:minmax(0,1fr) auto auto auto;
      align-items:start;column-gap:12px}
    .stagein > .chead{grid-column:1 / -1}
    .stagein > #card{grid-column:1;grid-row:1 / span 3;justify-self:center}
    .stagein > #qslmenu{grid-column:2;grid-row:1;align-self:stretch;min-height:0;overflow:auto}
    .stagein > #sendFix{grid-column:2;grid-row:2;width:100%;margin-top:8px}
    .stagein > .send.btn,.stagein > .reviewpair{grid-column:2;grid-row:3;width:100%}
    .stagein > .send.btn,.reviewpair > .btn{height:42px}
    .stagein > #cardReview{grid-column:1 / -1;grid-row:4}
  }
}
/* Board M-Creator's Send sits at the bottom edge; a phone lying flat has it under the menu, beside the card. */
@media not all and (min-width:768px) and (min-height:520px){
  @media (orientation:portrait){
    .stage{--send-band:58px}
    .send.btn,.reviewpair{position:fixed;z-index:20;left:var(--gutter, 14px);right:var(--gutter, 14px);bottom:calc(env(safe-area-inset-bottom) + 8px);width:auto}
    .send.btn,.reviewpair > .btn{height:42px;font-size:16px}
    .stagein::after{content:'';position:fixed;z-index:19;left:0;right:0;bottom:env(safe-area-inset-bottom);height:var(--send-band);
      background:var(--bg);border-top:1px solid var(--line-soft)}
    /* The footer scrolls last in .stage, so the room for the band goes after it, not after the card. */
    .stage:has(.stagein)::after{content:'';flex:none;height:var(--send-band)}
    /* The development badge stands above the Send band (58px, the .stage value above), not on the button. */
    body:has(.stagein) .dev-badge{bottom:calc(env(safe-area-inset-bottom) + 58px + 8px)}
  }
}
