/* Cozy Tree: the layout of item 10 (design worker, CONTRACT.md b/c).
   Wide (>= 900 px): ornaments = a column on the LEFT under the tab icons; design rows = a column on the RIGHT under the
   round buttons, shown whenever the own tree is on screen; the tree in the middle, never covered.
   Narrow (< 900 px): one bottom strip with two tabs, Ornaments | Design (js/design.js); visiting = ornaments only.
   This file comes after app.css and social.css, so it moves their pieces without editing them. */

/* ---------- wide ---------- */
@media (min-width:900px){
  /* the palette button is the column itself now (still in the page for keyboard-less code and the checks) */
  #tune{display:none}

  /* the design column: under the round buttons, its own width, scrolls when the window is short */
  .panel,:root:has(#account-actions > .round:not([hidden])) .panel{
    top:calc(var(--box-top,140px) - 9px);right:calc(max(16px,env(safe-area-inset-right)) - 9px);bottom:auto;left:auto;
    box-sizing:border-box;width:calc(clamp(180px,calc(50vw - 236px),236px) + 18px);
    max-height:calc(100% - var(--box-top,140px) - max(6px,env(safe-area-inset-bottom)) - 22px);
    padding:9px 9px 30px;display:flex;flex-direction:column;align-items:stretch;gap:20px;
    overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none;
    -webkit-mask-image:linear-gradient(180deg,#000 calc(100% - 30px),transparent);
            mask-image:linear-gradient(180deg,#000 calc(100% - 30px),transparent);
  }
  .panel::-webkit-scrollbar{display:none}
  /* the empty space between the rows stays the tree's (a drag there still turns it) */
  .panel.open{pointer-events:none}
  .panel.open .row{pointer-events:auto}
  /* each row: its name on its own line after a hairline (like the ornament groups), the choices under it */
  .panel .row{flex-wrap:wrap;justify-content:flex-end;column-gap:14px;row-gap:9px}
  .panel .row > span:first-child{flex:0 0 100%;display:flex;align-items:center;gap:8px;margin:0 0 3px;line-height:15px}
  .panel .row > span:first-child::before{content:"";flex:1;height:1px;background:currentColor;opacity:.5}
  .panel .row.more{justify-content:flex-end}
  /* backgrounds: every choice on screen, in short lines (flat colours, then scenes and pictures) */
  .panel .bg-strip{flex:0 0 auto;box-sizing:border-box;width:calc(100% + 18px);max-width:none;flex-wrap:wrap;justify-content:flex-end;row-gap:9px;
    overflow:visible;touch-action:manipulation;-webkit-mask-image:none;mask-image:none}
  .panel .bg-strip .bg-sep{flex:0 0 100%;height:0;opacity:0}
  /* tree shapes: short lines like the backgrounds, so every shape is on screen at any count (the owner, 2026-11-23:
     "나무모양 뒤에 가려서 안보여"; the one swiping line hid its last shapes behind the hidden scrollbar) */
  .panel .row[data-group="shape"] .bg-strip{row-gap:9px}

  /* the ornament column: on the left under the tab icons, above the legal line */
  .tray{left:max(22px,env(safe-area-inset-left));right:auto;top:var(--left-top,142px);
    bottom:calc(max(6px,env(safe-area-inset-bottom)) + 30px + var(--tray-cut,0px));transform:translateX(-16px)}
  .tray.ready{transform:none}
  .tray .grp{justify-content:start}
  .tray .lab{flex-direction:row-reverse;justify-content:flex-end}
  .tray.done{top:calc(var(--left-top,142px) + 44px)}
  .tray-note{right:auto;left:max(22px,env(safe-area-inset-left));top:var(--left-top,142px);text-align:left}
  /* the letter sheet and the letter box open on the same left side: the column steps aside while one is open */
  :root:has(.sheet:not([hidden])) .tray,:root:has(.inbox.open) .tray{opacity:0;pointer-events:none;transform:translateX(-14px);transition-delay:0s}
  :root:has(.sheet:not([hidden])) .tray-note.show,:root:has(.inbox.open) .tray-note.show{opacity:0}

  /* the hint line: under the tree in the middle (the left side is the ornament column now) */
  .hint{left:0;right:0;max-width:none;text-align:center;bottom:calc(max(6px,env(safe-area-inset-bottom)) + 30px)}
  /* the visiting arrows clear the ornament column (the visit worker may place them by the tree instead) */
  .nav.prev{left:calc(max(22px,env(safe-area-inset-left)) + 146px)}
  .nav.next{right:max(22px,env(safe-area-inset-right))}
}

/* ---------- narrow: one bottom strip, two tabs ---------- */
.strip-tabs[hidden]{display:none}
@media (max-width:899px){
  #tune{display:none}
  .strip-tabs{position:fixed;z-index:3;left:0;right:0;bottom:calc(max(4px,env(safe-area-inset-bottom)) + 16px);height:34px;
    display:flex;justify-content:center;align-items:center;gap:18px;pointer-events:none}
  .strip-tab{position:relative;pointer-events:auto;border:0;background:none;margin:0;padding:0 10px;min-width:44px;height:34px;cursor:pointer;
    font:inherit;font-size:13px;letter-spacing:.02em;color:var(--ink);opacity:.55;text-shadow:var(--halo);
    -webkit-tap-highlight-color:transparent;transition:opacity .2s ease,color .9s ease}
  .strip-tab[aria-selected="true"]{opacity:1}
  .strip-tab[aria-selected="true"]::after{content:"";position:absolute;left:10px;right:10px;bottom:5px;height:1.5px;border-radius:1px;background:currentColor}
  .strip-tab + .strip-tab::before{content:"";position:absolute;left:-9.5px;top:50%;width:1px;height:14px;margin-top:-7px;background:currentColor;opacity:.3}
  .strip-tab:focus-visible{outline:1px solid var(--ink);outline-offset:-2px;border-radius:4px}

  /* the tray row, the hint and the letter sheet step up by the tabs' height */
  :root[data-strip="tabs"] .tray{bottom:calc(max(12px,env(safe-area-inset-bottom)) + 12px + 34px)}
  :root[data-strip="tabs"] .hint{bottom:calc(max(12px,env(safe-area-inset-bottom)) + 94px + 34px)}
  :root[data-strip="tabs"] .sheet{max-height:calc(100% - var(--sheet-top) - 118px - 34px)}
  /* Design tab: the rows take the strip, the ornaments wait */
  :root[data-strip="tabs"] .panel.open ~ .tray{opacity:0;pointer-events:none;transform:translateY(12px);transition-delay:0s}

  /* the design rows: at the bottom over the tabs, one line each (a long line swipes sideways), never over the
     tree's middle: the tree moves into the band above them (chrome.js placeTree) */
  .panel,:root:has(#account-actions > .round:not([hidden])) .panel{
    top:auto;left:0;right:0;bottom:calc(max(4px,env(safe-area-inset-bottom)) + 16px + 36px);
    box-sizing:border-box;max-height:min(46vh,380px);
    padding:10px max(16px,env(safe-area-inset-right)) 6px max(16px,env(safe-area-inset-left));
    display:flex;flex-direction:column;align-items:stretch;gap:12px;
    overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none;
  }
  .panel::-webkit-scrollbar{display:none}
  .panel .row{flex-wrap:wrap;justify-content:flex-start;column-gap:14px;row-gap:9px;min-height:26px;transform:translateY(10px)}
  .panel.open .row{transform:none}
  .panel .row > span:first-child{flex:0 0 52px;margin:0}
  .panel .bg-strip,.panel .row[data-group="shape"] .bg-strip{flex:1 1 0;min-width:0;width:auto;max-width:none;flex-wrap:nowrap;justify-content:flex-start;
    overflow-x:auto;overflow-y:hidden;touch-action:pan-x;
    -webkit-mask-image:var(--strip-fade,none);
            mask-image:var(--strip-fade,none)}
  /* backgrounds: every choice on screen without a swipe (two short lines: the flat colours, then the scenes) */
  .panel .row[data-group="bg"] .bg-strip{flex-wrap:wrap;justify-content:flex-start;row-gap:9px;overflow:visible;touch-action:manipulation;
    -webkit-mask-image:none;mask-image:none}
  .panel .row[data-group="bg"] .bg-strip .bg-sep{flex:0 0 100%;height:0;opacity:0}
  .panel .row[data-group="bg"]{align-items:flex-start}
  .panel .row[data-group="bg"] > span{line-height:15px;padding-top:5px}
  .panel .row .pat{margin-left:calc(52px + 14px - 9px)}
}
:root[data-place="closed"] .strip-tabs{display:none}
@media (prefers-reduced-motion:reduce){.strip-tab,.panel .row{transition:none}}
