/* =====================================================================
   Layout refinements shared by desktop + mobile
   ===================================================================== */
html{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}
body{touch-action:manipulation;overscroll-behavior-y:none}
body.lock{overflow:hidden}
.stage canvas{touch-action:none;display:block}
nav.tabs .ic,nav.bottom{display:none}
nav.tabs a .n{margin-left:6px;font-size:11px;padding:1px 6px;border-radius:99px;background:#5de1ff22;color:var(--cyan)}
.wall{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--sw,96px),1fr));gap:8px}
.sw{width:auto}.sw .img{width:100%;height:auto;aspect-ratio:1}
.show-m,.filterbar,.sheet-h,.actionbar{display:none}
.filterbar .cnt{margin-left:6px;background:var(--cyan);color:#001;border-radius:99px;padding:0 7px;font-size:11px;font-weight:800}
.chips-quick{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;flex:1}.chips-quick::-webkit-scrollbar{display:none}
.chips-quick .chip{white-space:nowrap}

/* ---- action bar (verdict) — shown on touch layouts */
.actionbar button{border:1px solid var(--line2);background:var(--panel2);border-radius:14px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;font-size:19px;line-height:1.1;font-weight:700;min-height:58px;cursor:pointer}
.actionbar button span{font-size:11.5px;font-weight:700;letter-spacing:.02em;color:var(--dim)}
.actionbar button.approved{color:var(--green)}.actionbar button.changes{color:var(--amber)}.actionbar button.rejected{color:var(--red)}.actionbar button.notebtn{color:var(--cyan)}
.actionbar button.on.approved{background:#5ff2a028;border-color:var(--green)}.actionbar button.on.changes{background:#ffd16626;border-color:var(--amber)}.actionbar button.on.rejected{background:#ff6b8126;border-color:var(--red)}
.actionbar button:active{transform:scale(.96)}

/* =====================================================================
   MOBILE (phones & small tablets) — designed for one-handed thumb use
   ===================================================================== */
@media (max-width:760px){
  :root{--sab:env(safe-area-inset-bottom,0px);--sat:env(safe-area-inset-top,0px)}
  body{font-size:15px}
  .hide-m{display:none!important}.show-m{display:block}
  input,select,textarea{font-size:16px!important}
  .btn{min-height:42px;padding:8px 14px}.btn.sm{min-height:38px;padding:6px 12px}
  .chip{padding:8px 13px;font-size:13.5px;min-height:36px;display:inline-flex;align-items:center}

  /* top bar: logo · search · + */
  header.top{padding:calc(8px + var(--sat)) 12px 8px;gap:10px;flex-wrap:nowrap}
  nav.tabs,.brand .bt{display:none}
  .search{display:block;flex:1;width:auto}
  .search input{padding:10px 12px 10px 34px;border-radius:12px}.search::before{top:8px}
  .iconbtn{width:42px;padding:0;justify-content:center;font-size:20px}

  /* bottom tab bar */
  nav.bottom{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;left:0;right:0;bottom:0;z-index:36;background:#0a0e1af2;backdrop-filter:blur(16px);border-top:1px solid var(--line2);padding:6px 4px calc(6px + var(--sab))}
  nav.bottom a{display:flex;flex-direction:column;align-items:center;gap:2px;color:var(--faint);font-size:10.5px;font-weight:700;letter-spacing:.02em;padding:4px 0;border-radius:12px;position:relative}
  nav.bottom a .ic{display:block;width:23px;height:23px}
  nav.bottom a.on{color:var(--cyan)}nav.bottom a.on .ic{filter:drop-shadow(0 0 6px #5de1ff88)}
  nav.bottom a .n{position:absolute;top:0;left:calc(50% + 6px);margin:0;min-width:17px;text-align:center;font-size:10px;padding:1px 5px;background:var(--pink);color:#12000a}
  main{padding:14px 12px calc(92px + var(--sab))}
  h1{font-size:20px}.sub{font-size:13px;margin-bottom:12px}
  #toasts{bottom:calc(82px + var(--sab))}

  /* catalogue */
  .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .card{border-radius:14px}
  .card .meta{padding:8px 10px 10px}.card .nm{font-size:13px}.card .id{display:none}
  .badge{font-size:10px;padding:1px 6px}
  .card .sel{width:28px;height:28px;right:7px;bottom:7px;font-size:15px}
  .filterbar{display:flex;gap:8px;margin-bottom:12px;align-items:center;position:sticky;top:calc(58px + var(--sat));z-index:20;padding:6px 0;background:linear-gradient(var(--bg) 70%,transparent)}
  .filterbar .btn{flex:none}
  .filters:not(.wallf){display:none;position:fixed;left:0;right:0;bottom:0;z-index:60;max-height:78dvh;overflow-y:auto;border-radius:20px 20px 0 0;border:1px solid var(--line2);background:var(--bg2);padding:0 16px calc(18px + var(--sab));margin:0;box-shadow:0 -30px 80px #000d;flex-direction:column}
  .filters.open:not(.wallf){display:flex;animation:sheet .2s ease-out}
  @keyframes sheet{from{transform:translateY(40px);opacity:0}}
  .filters .sheet-h{display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;background:var(--bg2);padding:14px 0 10px;z-index:2}
  .filters:not(.wallf) .lbl{width:100%}
  .selbar{bottom:calc(80px + var(--sab));width:calc(100% - 24px);justify-content:space-between}
  .stat .s{flex:1 1 40%;min-width:0}
  table.t td{padding:10px 6px;font-size:12.5px}table.t td:nth-child(2){display:none}

  /* texture wall */
  .wall{gap:6px}.sw .nm{font-size:9.5px}
  .filters.wallf{padding:10px}
  .filters.wallf .row{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}.filters.wallf .row::-webkit-scrollbar{display:none}
  .filters.wallf .lbl{width:auto}.filters.wallf .chip{flex:none}

  /* detail drawer = full-screen sheet, single column, whole thing scrolls */
  .scrim{display:none}
  .drawer{inset:0;width:100%;display:block;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;border:0;animation:sheet .22s ease-out}
  .drawer>.dh{position:sticky;top:0;z-index:5;padding:calc(10px + var(--sat)) 12px 10px;gap:8px;background:#0a0f1cf2;backdrop-filter:blur(12px)}
  .dh h1{font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dh>div:first-child{min-width:0;flex:1}
  .dh .btn{min-width:40px;justify-content:center;padding:6px 8px}.dh .id{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .pane{overflow:visible;padding:12px}
  .pane.left{border:0;padding-bottom:0}
  .stage{height:min(46dvh,420px);border-radius:14px}
  .stage::after{content:"drag to rotate · pinch to zoom";position:absolute;right:10px;bottom:8px;font:600 10px var(--mono);color:#ffffff55;pointer-events:none;z-index:3}
  .stage .tools{flex-wrap:nowrap;overflow-x:auto;right:0;left:0;top:0;padding:8px 10px;scrollbar-width:none;background:linear-gradient(#070b16cc,transparent)}
  .stage .tools::-webkit-scrollbar{display:none}.stage .tools .chip{flex:none}
  .stage.fourup .quad span{padding:3px 6px;font-size:9px}
  .sprite{height:auto;padding:6px 0}.sprite .big{height:auto;width:min(78vw,340px)}
  .sprite>div{gap:16px!important}
  .strip .t{width:70px}.strip .t .img{width:70px;height:70px}
  .verdict-inline{display:none}
  .actionbar{display:grid;grid-template-columns:1.1fr 1.1fr 1.1fr .9fr;gap:8px;position:fixed;left:0;right:0;bottom:0;z-index:48;padding:10px 12px calc(10px + var(--sab));background:#0a0e1af5;backdrop-filter:blur(16px);border-top:1px solid var(--line2)}
  .pane.right{padding-bottom:calc(110px + var(--sab))}
  .composer textarea{min-height:96px}
  .composer .quick{flex-wrap:nowrap;overflow-x:auto;margin:8px -12px;padding:0 12px;scrollbar-width:none}.composer .quick::-webkit-scrollbar{display:none}.composer .quick .chip{flex:none}
  #addnote{width:100%;justify-content:center;min-height:46px}
  .note{font-size:14.5px}.note .h a{padding:6px 4px}
  .cand{grid-template-columns:repeat(2,1fr)}.cand .c .btn{flex:1;justify-content:center}
  .cmp{position:sticky;top:60px;z-index:2}

  /* focus review mode */
  .focus{display:block;overflow-y:auto;overscroll-behavior:contain}
  .focus .fh{position:sticky;top:0;z-index:6;padding:calc(10px + var(--sat)) 12px 10px;gap:10px;background:#080b14f2;backdrop-filter:blur(12px)}
  .focus .fh>b{max-width:34vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px}
  .focus .prog{flex:1;max-width:none}
  .focus .fh>span{font-size:12px}
  .focus .fl{padding:10px 12px 0;overflow:visible}.focus .fl h1{font-size:18px}
  .focus .fr{border:0;padding:10px 12px calc(110px + var(--sab));overflow:visible}
  .focus .ft{justify-content:center;padding:6px 12px;border:0;font-size:11.5px}

  /* modals become bottom sheets */
  .modal{align-items:end}.modal .box{width:100%;border-radius:20px 20px 0 0;padding:18px 16px calc(18px + var(--sab));animation:sheet .2s ease-out}
}
@media (max-width:760px) and (orientation:landscape){.stage{height:70dvh}}
@media (hover:none){
  .card:hover,.sw:hover .img{transform:none;box-shadow:none}
  .btn:hover{border-color:var(--line2);background:var(--panel2)}
}
@media (min-width:761px) and (max-width:1100px){
  .drawer{grid-template-columns:minmax(0,1.1fr) minmax(320px,.9fr)}
  nav.tabs a{padding:7px 9px}.search{width:200px}
}
@supports (height:100dvh){.focus,.drawer{height:100dvh}}

/* 3D block thumbnails on the texture wall */
.thumb3d{background:radial-gradient(circle at 50% 40%,#202c52,#0c1122 75%);aspect-ratio:1;display:block}
.thumb3d img{width:100%;height:100%;object-fit:contain;display:block;transition:opacity .25s}
.tiled{display:grid;grid-template-columns:1fr 1fr}.tiled img{width:100%;display:block}
