/* ROHLAN FORGE - PHONE layer (v80). Loaded after tablet.css.
   Only for touch screens narrower than 761 px. Tablets and laptops do not change at all.
   Idea: the 3D view gets the whole screen. Every bar is ONE thin row of icons that slides sideways.
   The side menu (Library, Objects ...) and the panel open only when you tap the panel button. */
@media (max-width:760px){

/* ---- 1. top bar: one row, icons only, slides sideways ---- */
html.is-touch{--bar:46px}
html.is-touch #top{height:var(--bar)!important;min-height:var(--bar)!important;flex-wrap:nowrap!important;row-gap:0;column-gap:5px;padding:4px 8px!important;
  overflow-x:auto!important;overflow-y:hidden!important;white-space:nowrap;align-content:center;align-items:center;-webkit-overflow-scrolling:touch;scrollbar-width:none;overscroll-behavior-x:contain}
html.is-touch #top::-webkit-scrollbar{display:none}
html.is-touch #top>*{flex:0 0 auto}
html.is-touch #top .grow,html.is-touch #top .sep{display:none!important}
html.is-touch #top .btn{height:36px;min-width:36px;padding:0 8px;border-radius:10px}
html.is-touch #top .btn .ico,html.is-touch #top .btn svg{width:18px;height:18px}
html.is-touch #top .logo{margin:0 2px 0 0}
html.is-touch #top .logo .wm{display:none!important}
html.is-touch #snap-size{height:36px;font-size:14px;padding:0 4px;border-radius:10px;width:auto}
/* Modeling / Animation: icons instead of words */
html.is-touch .seg2{height:36px;flex:0 0 auto}
html.is-touch .seg2 button{width:40px;height:30px;padding:0!important;font-size:0!important;background-repeat:no-repeat;background-position:center;background-size:19px 19px}
html.is-touch .seg2 button[data-md=modeling]{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23444' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 4.5v9L12 21l-8-4.5v-9z'/%3E%3Cpath d='M4 7.5l8 4.5 8-4.5M12 12v9'/%3E%3C/svg%3E")}
html.is-touch .seg2 button[data-md=modeling].on{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 4.5v9L12 21l-8-4.5v-9z'/%3E%3Cpath d='M4 7.5l8 4.5 8-4.5M12 12v9'/%3E%3C/svg%3E")}
html.is-touch .seg2 button[data-md=animation]{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23444' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M10 9l5 3-5 3z'/%3E%3C/svg%3E")}
html.is-touch .seg2 button[data-md=animation].on{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M10 9l5 3-5 3z'/%3E%3C/svg%3E")}
/* "Back to 3D" / "Rohlan home": arrow icon */
html.is-touch #b-back{font-size:0!important;width:36px;padding:0!important;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E") center/20px no-repeat}
/* the panel button stays pinned at the right end, the rest slides under it */
html.is-touch #b-panel{position:sticky;right:0;z-index:3;box-shadow:-10px 0 8px -4px #fff}
body.rail-open #b-panel,body.panel-open #b-panel{background:var(--ink)!important;color:#fff!important;border-color:var(--ink)!important}

/* ---- 2. 3D view uses every pixel ---- */
html.is-touch #stage{top:var(--topH,46px)}
html.is-touch body.pinned #stage{right:0}
html.is-touch #p-pin{display:none}
html.is-touch #hint{left:8px;top:8px;max-width:calc(100vw - 16px);font-size:11.5px;padding:7px 11px}
html.is-touch #mini{left:8px;bottom:64px;width:72px;height:72px}
html.is-touch #mini canvas{width:72px;height:72px}
html.is-touch .kpad{display:none!important}               /* the floating keyboard button is gone */

/* ---- 3. side menu (Library, Objects ...) : hidden until you tap the panel button, then ONE icon row under the top bar ---- */
html.is-touch #rail{position:fixed;top:var(--topH,46px);left:0;right:0!important;bottom:auto;width:auto;max-height:none;height:50px;flex-direction:row;gap:4px;padding:4px 8px;border-radius:0;
  overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-x:contain;z-index:45;border:0;border-bottom:1px solid var(--line)}
html.is-touch #rail::-webkit-scrollbar{display:none}
html.is-touch body:not(.rail-open):not(.panel-open) #rail{display:none!important}
html.is-touch #rail button{flex:0 0 44px;width:44px;height:40px;padding:0;font-size:0;border-radius:10px}
html.is-touch #rail button .ico{width:21px;height:21px}
html.is-touch #rail button *{font-size:0}

/* ---- 4. panel = bottom sheet (about half the screen), the 3D view stays visible above it ---- */
html.is-touch #panel{top:auto!important;bottom:0;left:0;right:0!important;width:100%!important;max-width:100vw;height:52dvh;max-height:calc(100dvh - var(--topH,46px) - 60px);
  border-radius:16px 16px 0 0;border-left:0;border-top:1px solid var(--line);box-shadow:0 -10px 34px rgba(0,0,0,.18);z-index:44}
html.is-touch #panel.closed{transform:translateY(105%)!important}
html.is-touch .phead{height:46px}
html.is-touch .phead button{width:38px;height:38px}
html.is-touch #pfoot{display:none}

/* ---- 5. bottom edit toolbar: one row, icons only, slides sideways ---- */
html.is-touch #etool,html.is-touch #pipetool,html.is-touch #sktool{left:0!important;right:0!important;bottom:0!important;top:auto!important;transform:none!important;width:100%;max-width:100vw!important;
  flex-wrap:nowrap!important;overflow-x:auto!important;overflow-y:hidden!important;border-radius:0;border-left:0;border-right:0;border-bottom:0;padding:4px 8px;gap:4px;
  scrollbar-width:none;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
html.is-touch #etool::-webkit-scrollbar,html.is-touch #pipetool::-webkit-scrollbar,html.is-touch #sktool::-webkit-scrollbar{display:none}
html.is-touch #etool>*,html.is-touch #pipetool>*,html.is-touch #sktool>*{flex:0 0 auto}
html.is-touch #etool .eg,html.is-touch #pipetool .eg,html.is-touch #sktool .eg{display:flex;flex-wrap:nowrap}
html.is-touch #etool .esep,html.is-touch #pipetool .esep,html.is-touch #sktool .esep{display:block!important}
html.is-touch #etool button,html.is-touch #pipetool button,html.is-touch #sktool button{min-width:42px;width:auto;height:40px;padding:0 9px}
html.is-touch #etool button .lb,html.is-touch #pipetool button .lb,html.is-touch #sktool button .lb{display:none}
html.is-touch #etool button .ico{width:22px;height:22px}
html.is-touch body.sketching #etool{display:none!important}

/* ---- 6. sketch bar: docked at the bottom, one sliding row ---- */
html.is-touch #sk-bar{top:auto!important;bottom:0!important;left:0!important;right:0!important;transform:none!important;max-width:none!important;align-items:stretch;gap:0}
html.is-touch #sk-bar .sk-row{max-width:100%;overflow-x:auto;overflow-y:hidden;border-radius:0}
html.is-touch #sk-bar .sk-tools .lb,html.is-touch #sk-bar .sk-title{display:none}
html.is-touch #sk-bar button{height:40px;min-width:40px;padding:0 9px}
html.is-touch #sk-card,html.is-touch #pipe-card{left:8px!important;right:8px!important;max-width:none;bottom:60px!important;top:auto!important;max-height:46dvh}

/* ---- 7. ANIMATION: like a video editor. 16:9 picture on top, small timeline underneath ---- */
html.is-touch body.m-anim #stage{bottom:auto!important;height:56.25vw!important;right:0!important}
html.is-touch body.m-anim #tl{position:fixed!important;left:0;right:0;top:calc(var(--topH,46px) + 56.25vw)!important;bottom:0!important;height:auto!important;z-index:20;box-shadow:none}
html.is-touch body.m-anim #etool,html.is-touch body.m-anim #mini{display:none!important}
html.is-touch #tl-min{display:none!important}
html.is-touch .tl-bar{height:42px!important;min-height:42px!important;padding:0 8px!important;gap:5px!important;overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
html.is-touch .tl-bar::-webkit-scrollbar{display:none}
html.is-touch .tl-bar>*{flex:0 0 auto}
html.is-touch .tl-bar .tl-grow{display:none}
html.is-touch .tl-bar button,html.is-touch .tl-bar .btn,html.is-touch .tl-bar .mini{min-height:34px!important;min-width:34px!important;height:34px;padding:0 7px}
html.is-touch .tl-bar svg{width:17px;height:17px}
html.is-touch .tl-bar .tl-opt span,html.is-touch .tl-f em{display:none!important}
html.is-touch .tl-bar input[type=number],html.is-touch .tl-bar select{height:34px!important;font-size:14px}
html.is-touch .tl-time{font-size:12px}
html.is-touch .tl-time b,html.is-touch .tl-time strong{font-size:15px}
}
@media (max-width:760px){
/* blocks.css hides the menu while the panel is open - on a phone we want it to stay so you can switch tabs */
html.is-touch body.panel-open #rail{display:flex!important;right:0!important}
html.is-touch body.panel-open #tl,html.is-touch body.pinned #tl{right:0!important}
html.is-touch body.m-anim.panel-open #stage{right:0!important}
}
@media (max-width:760px){
/* the orange / black "on" state repainted the background and made the icon repeat - lock it to one centred icon */
html.is-touch .seg2 button{background-repeat:no-repeat!important;background-position:center!important;background-size:19px 19px!important;flex:0 0 40px}
}

@media (max-width:760px){
/* ---- long-press / right-click menu: bottom sheet that always fits, no keyboard hints ---- */
html.is-touch #ctx{left:0!important;right:0!important;top:auto!important;bottom:0!important;z-index:210}
html.is-touch #ctx>ul{width:100%;min-width:0;max-height:62dvh;overflow-y:auto;-webkit-overflow-scrolling:touch;border-radius:16px 16px 0 0;border-width:1px 0 0;padding:8px 8px calc(10px + env(safe-area-inset-bottom,0px));font-size:15px;box-shadow:0 -14px 40px rgba(0,0,0,.22)}
html.is-touch #ctx li{padding:13px 14px;font-size:15px}
html.is-touch #ctx li em{display:none}
html.is-touch #ctx li.head{font-size:11px;padding:8px 14px 4px}
/* sub-menus open inline under their parent instead of off to the right */
html.is-touch #ctx li>ul{position:static;left:auto;top:auto;width:100%;min-width:0;box-shadow:none;border:0;padding:2px 0 2px 14px;background:transparent}
html.is-touch #ctx li.has{flex-wrap:wrap}
}
@media (max-width:760px){
html.is-touch #ctx li.sep{padding:0!important;height:1px!important;min-height:0!important;margin:6px 10px}
}
@media (max-width:760px){
/* instruction text: one small line (was hidden/huge). The long idle help text stays hidden, tool tips show. */
html.is-touch #hint{display:block!important;left:8px!important;right:auto;top:6px!important;max-width:calc(100vw - 16px)!important;
  padding:5px 10px!important;font-size:10.5px!important;line-height:1.3!important;border-radius:8px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html.is-touch #hint.m-idle{display:none!important}
html.is-touch body.rail-open #hint{top:58px!important}
}

/* v52 - phone timeline: narrow icon-only name column, finger scrolling, tiny empty message */
@media (max-width:760px){
html.is-touch .tl-grid{grid-template-columns:42px 1fr!important;grid-template-rows:24px 1fr!important}
html.is-touch .tl-corner span{display:none}
html.is-touch .tn{padding:0!important;justify-content:center!important;gap:0!important}
html.is-touch .tn b,html.is-touch .tn .x,html.is-touch .tn .car,html.is-touch .tn>span:not(.ic):not(.cdot),html.is-touch .tn button{display:none!important}
html.is-touch .tn.chn{font-size:0}
html.is-touch .tn.chn .cdot{display:block!important}
html.is-touch .tl-tracks{touch-action:pan-x pan-y!important;-webkit-overflow-scrolling:touch}
html.is-touch .tl-tracks .kf,html.is-touch .tl-tracks .cutf{touch-action:none}
html.is-touch .tl-empty{padding:8px 10px!important;font-size:11px!important;line-height:1.4!important;max-width:none}
html.is-touch .tl-empty .tl-ei,html.is-touch .tl-empty>span:not(.tl-ei){display:none!important}
html.is-touch #tl-fr{display:none}
}
