@font-face{font-family:LocalNoto;src:url('./fonts/NotoSansCJKjp-Bold.otf') format('opentype');font-weight:700;font-display:swap}
:root{--blue:#1598d4;--blue2:#e7f7fe;--ink:#31465a;--line:#d5dfe7;--panel:#fff;--green:#1fa65a;--orange:#f59e0b;--red:#e64b4b;--shadow:0 4px 14px rgba(44,67,88,.15)}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;font-family:LocalNoto,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--ink);background:#eef3f6}button,input{font:inherit}button{cursor:pointer;touch-action:manipulation}body{overflow:hidden;overscroll-behavior:none}.app{height:100vh;height:100dvh;display:grid;grid-template-rows:48px auto minmax(0,1fr);-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}input[type=text],.stlbox{-webkit-user-select:text;user-select:text}
.topbar{display:flex;align-items:center;gap:8px;padding:5px 10px;background:#f5f7f9;border-bottom:1px solid var(--line)}.brand{font-size:20px;font-weight:900;white-space:nowrap}.stepper{display:flex;gap:6px;flex:1;justify-content:center;min-width:0}.step-chip{height:34px;padding:0 10px;border:1px solid #c7d2dc;background:#fff;border-radius:8px;font-size:14px;font-weight:900;color:#7a8996;white-space:nowrap}.step-chip.active{color:#fff;background:var(--blue);border-color:var(--blue)}.step-chip.done{color:#14733a;background:#e1f7e9;border-color:#9dd6b2}.top-actions{display:flex;gap:6px}.toolbtn{width:44px;height:40px;border:1px solid #c8d3dc;border-radius:8px;background:#fff;font-size:19px;font-weight:900}
.guidebar{position:relative;overflow:hidden;display:flex;align-items:center;gap:10px;padding:7px 12px;background:linear-gradient(90deg,#0a6f9e,#1598d4 55%,#26b0ea);border-bottom:3px solid #095c85;box-shadow:0 2px 7px rgba(15,55,85,.22)}.guidebar::after{content:'';position:absolute;inset:0;background:#ffa41f;opacity:0;pointer-events:none;z-index:0}.guidebar.flash::after{animation:guideflash .9s ease-out 1}@keyframes guideflash{0%{opacity:.9}60%{opacity:.45}100%{opacity:0}}.guide-tag{position:relative;z-index:1;flex:none;background:#ffd83a;color:#4a3300;border-radius:999px;padding:3px 12px;font-size:14px;font-weight:900}.guide-text{position:relative;z-index:1;flex:1;min-width:0;color:#fff;font-size:23px;font-weight:900;line-height:1.25;text-shadow:0 1px 2px rgba(0,40,70,.5)}@media(prefers-reduced-motion:reduce){.guidebar.flash::after{animation:none}}
.workspace{min-height:0;display:grid;grid-template-columns:280px minmax(0,1fr) 205px;overflow:hidden}.leftpanel,.palette{background:#fff;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch;scrollbar-width:thin;padding:8px}.leftpanel{border-right:1px solid var(--line)}.palette{border-left:1px solid var(--line)}
.stage-card{border:1px solid var(--line);border-radius:10px;background:#fff;overflow:hidden;margin-bottom:7px;box-shadow:0 1px 3px rgba(0,0,0,.04)}.stage-head{display:flex;align-items:center;gap:8px;padding:7px 9px;background:#f5f8fa;font-size:17px;font-weight:900;cursor:pointer;user-select:none}.badge{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--blue);color:#fff}.stage-body{padding:8px}.stage-card:not(.current) .stage-body{display:none}.stage-card.completed .stage-head{background:#edf9f1;color:#176f38}.stage-card.completed .badge{background:var(--green)}.stage-card.locked{opacity:.55}.stage-card.current{outline:3px solid rgba(21,152,212,.18)}
label{display:block;font-size:15px;font-weight:900;margin-bottom:3px}.slider-line{display:flex;justify-content:space-between;align-items:center;gap:8px}.value{font-size:17px;color:var(--blue);font-weight:900}.range-wrap{margin:5px 0 8px}input[type=range]{width:100%;height:34px;accent-color:var(--blue)}input[type=text]{width:100%;height:44px;border:2px solid #c8d4de;border-radius:8px;padding:6px 10px;font-size:19px}.action-row{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:7px}.primary,.secondary,.warning,.success{min-height:44px;border:0;border-radius:8px;font-size:16px;font-weight:900}.primary{background:var(--blue);color:#fff}.secondary{background:#e9eef2;color:#405467}.warning{background:var(--orange);color:#fff}.success{background:var(--green);color:#fff}.wide{width:100%}.hint{font-size:13px;line-height:1.45;color:#6e7f8e;margin-top:4px}.status{padding:7px 9px;border-radius:8px;background:#e8f8ee;color:#16703a;font-weight:900}.hidden{display:none!important}
.center{position:relative;min-width:0;min-height:0;background:#e8eef2;overflow:hidden}.canvas-wrap{position:absolute;inset:0;display:flex;align-items:flex-start;justify-content:center;touch-action:none}.canvas-wrap canvas{display:block;touch-action:none;border-radius:6px;box-shadow:0 0 0 1px #cfdae2}.viewer-toolbar{position:absolute;z-index:20;pointer-events:none;left:9px;top:9px;width:72px;display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-start;max-height:calc(100% - 18px);gap:7px;align-items:flex-start}.viewer-toolbar>button{pointer-events:auto;flex:none}.roundbtn{width:48px;height:48px;border:1px solid #c7d2dc;border-radius:50%;background:#fff;box-shadow:var(--shadow);font-size:22px;font-weight:900}.viewbtn{width:72px;pointer-events:auto;min-height:39px;border:1px solid #c7d2dc;border-radius:8px;background:#fff;box-shadow:var(--shadow);padding:4px;font-size:12px;font-weight:900}.viewbtn.active{background:var(--blue);color:#fff;border-color:var(--blue)}.viewbtn:disabled{opacity:.45;cursor:not-allowed}
.palette-title{font-size:18px;font-weight:900;margin:2px 0 7px}.palette-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}.object-btn{min-height:82px;border:2px solid #dfe6ec;border-radius:9px;background:#fbfcfd;padding:6px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;font-size:14px;font-weight:900}.object-btn.selected{border-color:var(--blue);background:var(--blue2)}.shape-icon{width:48px;height:36px;box-shadow:inset -8px -8px 12px rgba(70,90,110,.12)}.icon-rounded,.icon-ellipse,.icon-circle,.icon-hex{background:linear-gradient(135deg,#4ca6d8,#8dc9ea);border:1px solid #2d83b5}.icon-rounded{border-radius:12px}.icon-ellipse{border-radius:50%}.icon-circle{width:40px;height:40px;border-radius:50%}.icon-hex{clip-path:polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%)}.icon-heart{width:44px;height:40px;background:#ef8fb5;border:0;clip-path:path('M22 39 C18 35 2 24 2 12 C2 4 8 0 14 0 C18 0 21 3 22 6 C24 3 27 0 32 0 C39 0 44 5 44 12 C44 24 28 35 22 39 Z')}.icon-star{width:44px;height:42px;background:#f4d35e;border:0;clip-path:polygon(50% 0%,61.8% 34.5%,98% 35%,68.8% 56%,79.4% 91%,50% 70%,20.6% 91%,31.2% 56%,2% 35%,38.2% 34.5%)}.icon-cylinder{width:42px;border-radius:50%/18%;background:repeating-linear-gradient(135deg,#ef5555 0 6px,#ffaaaa 6px 12px);border:1px solid #b72929}.palette-note{font-size:13px;line-height:1.45;color:#6e7f8e;margin-top:9px}
.no-dialog dialog{display:none;position:fixed;z-index:100;left:50%;top:50%;transform:translate(-50%,-50%);max-height:calc(100vh - 20px);overflow:auto}.no-dialog dialog[open]{display:block}.no-dialog dialog[open]::before{content:'';position:fixed;inset:0;z-index:-1;background:rgba(15,23,42,.5)}dialog{border:0;border-radius:15px;padding:0;width:min(680px,calc(100% - 24px));box-shadow:0 25px 80px rgba(15,23,42,.38)}dialog::backdrop{background:rgba(15,23,42,.5)}.modal{padding:19px}.modal h2{font-size:25px;color:#1f5572;margin:0 0 11px}.modal p{font-size:17px;line-height:1.65;margin:7px 0}.modal-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:16px}.modal-actions button{min-width:130px}.stl-grid{display:grid;grid-template-columns:minmax(260px,42%) minmax(0,1fr);gap:12px;align-items:stretch;margin-top:10px}.stl-cg{min-height:250px;border:1px solid #c8d4de;border-radius:8px;background:#f5fbfe;overflow:hidden;display:flex;align-items:center;justify-content:center}.stl-cg canvas{display:block}.stlbox{height:250px;overflow:auto;white-space:pre;font:12px/1.45 ui-monospace,Consolas,monospace;border:1px solid #c8d4de;background:#f8fafc;padding:10px;border-radius:8px;margin:0}.mini{font-size:14px;color:#6e7f8e}@media(max-width:700px){.stl-grid{grid-template-columns:1fr}.stl-cg{min-height:190px}.stlbox{height:180px}}

.print-modal{width:min(1120px,calc(100% - 20px));height:min(720px,calc(100dvh - 20px));max-height:calc(100dvh - 20px)}.print-modal .modal{height:100%;display:flex;flex-direction:column;overflow:hidden;padding:14px}.print-modal .modal h2{flex:none}.print-modal .modal-actions{flex:none;margin-top:10px}.print-lead{margin:0 0 8px!important;font-size:14px!important;line-height:1.5!important}.print-layout{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:10px}.printer-sim-view{position:relative;min-height:0;border:1px solid #bccbd6;border-radius:12px;background:linear-gradient(145deg,#dce5ed,#b8c5d1);overflow:hidden;padding:14px}.printer-frame{position:relative;width:100%;height:100%;border:10px solid #26313d;border-radius:8px;background:#f8fbfd;box-shadow:inset 0 0 45px rgba(20,40,60,.12),0 8px 20px rgba(20,40,60,.18);overflow:hidden;display:flex;align-items:center;justify-content:center}.printer-frame canvas{display:block}.printer-label{position:absolute;top:12px;left:50%;transform:translateX(-50%);z-index:2;background:rgba(255,255,255,.94);border:1px solid #c9d5de;border-radius:999px;padding:6px 13px;font-size:13px;font-weight:900}.print-side{min-height:0;display:flex;flex-direction:column;gap:8px;overflow:hidden}.print-side>.print-card:last-child{flex:1 1 0;min-height:0;display:flex;flex-direction:column;overflow:hidden}.print-side>.print-card:last-child .gcode-screen{flex:1 1 0;min-height:0}.print-card{background:#f5f8fa;border:1px solid #d5dfe7;border-radius:10px;padding:8px}.print-card h3{margin:0 0 5px;font-size:15px;color:#1f5572}.temp-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}.temp-box{background:#fff;border:1px solid #d6e1e9;border-radius:9px;padding:5px 6px;text-align:center}.temp-box strong{display:block;font-size:22px;color:#e4512b}.temp-box small{font-size:12px;color:#607383}.print-slider-wrap{margin:8px 0 5px}.print-slider{width:100%;height:32px;accent-color:#1fa65a;cursor:pointer}.print-slider-labels{display:flex;justify-content:space-between;font-size:11px;font-weight:800;color:#607383;margin-top:-3px}.print-stat{display:flex;justify-content:space-between;font-size:13px;font-weight:900}.print-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px}.print-start{background:#1fa65a;color:#fff}.print-reset{background:#e9eef2;color:#405467}.gcode-screen{flex:1 1 0;min-height:0;background:#18232d;color:#7df29b;border-radius:8px;padding:8px;overflow:hidden;font:12px/1.45 ui-monospace,Consolas,monospace}.gcode-screen div:last-child{color:#fff36b;font-weight:900}.print-note{font-size:11px;line-height:1.35;color:#637585;margin-top:3px}.print-finished{padding:8px;border-radius:8px;background:#e8f8ee;color:#16703a;font-weight:900;text-align:center;display:none}.print-finished.show{display:block}
@media(max-width:850px){.print-layout{grid-template-columns:1fr;grid-template-rows:minmax(200px,1fr) minmax(330px,auto)}.print-side{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto minmax(110px,1fr);min-height:0;overflow:hidden}.print-side>.print-card:nth-child(1){grid-column:1;grid-row:1;overflow:auto}.print-side>.print-card:nth-child(2){grid-column:2;grid-row:1;overflow:auto}.print-side>.print-card:last-child{grid-column:1/-1;grid-row:2;min-height:0;display:flex;flex-direction:column;overflow:hidden}.print-side>.print-card:last-child .gcode-screen{flex:1 1 0;min-height:0}.print-side>.print-card:nth-child(1),.print-side>.print-card:nth-child(2){max-height:260px}.gcode-screen{min-height:70px}}

@media(max-width:1199px) and (orientation:landscape){.workspace{grid-template-columns:255px minmax(0,1fr) 180px}.brand{font-size:17px}.step-chip{font-size:12px;padding:0 7px}.leftpanel,.palette{padding:6px}.stage-head{font-size:15px;padding:6px 8px}.stage-body{padding:6px}.range-wrap{margin:2px 0 5px}.object-btn{min-height:68px;font-size:12px}.shape-icon{width:39px;height:30px}}
@media(max-width:900px) and (orientation:portrait){.app{grid-template-rows:82px auto minmax(0,1fr)}.topbar{flex-wrap:wrap;align-content:center}.brand{width:100%;text-align:center;font-size:18px}.stepper{order:3;width:100%;overflow-x:auto;justify-content:flex-start}.top-actions{position:absolute;right:7px;top:7px}.workspace{grid-template-columns:minmax(0,1fr) 170px;grid-template-rows:minmax(330px,56%) minmax(0,44%);grid-template-areas:"center palette" "left palette"}.center{grid-area:center}.leftpanel{grid-area:left;border-right:0;border-top:1px solid var(--line);padding:6px}.palette{grid-area:palette;overflow:auto;padding:6px}.palette-grid{grid-template-columns:1fr}.stage-card.completed,.stage-card.locked{display:none}.leftpanel{display:flex;flex-direction:column}.stage-card{flex:none}.stage-card.current{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;overflow:hidden}.stage-card.current .stage-head{flex:none}.stage-card.current .stage-body{flex:1 1 auto;min-height:0;overflow:auto}}
@media(max-width:600px){body{overflow:auto}.app{height:auto;min-height:100dvh;display:block}.topbar{position:sticky;top:0;z-index:20}.workspace{display:flex;flex-direction:column;overflow:visible}.center{order:1;height:390px}.palette{order:2;border-left:0;border-top:1px solid var(--line);overflow:visible}.palette-grid{grid-template-columns:repeat(3,1fr)}.leftpanel{order:3;border-right:0;overflow:visible}.stage-card.completed,.stage-card.locked{display:none}.top-actions{display:none}}

@media (max-height:770px){
 .app{grid-template-rows:44px auto minmax(0,1fr)}
 .topbar{padding:4px 8px}.brand{font-size:17px}.step-chip{height:30px;font-size:12px;padding:0 8px}.toolbtn{height:36px}
 .guidebar{padding:5px 11px;border-bottom-width:2px}.guide-text{font-size:20px}.guide-tag{font-size:13px;padding:2px 10px}
 .stage-card{margin-bottom:5px}.stage-head{font-size:15px;padding:5px 8px}.badge{width:24px;height:24px}.stage-body{padding:6px}
 label{font-size:14px;margin-bottom:2px}.value{font-size:15px}
 input[type=range]{height:28px}.range-wrap{margin:2px 0 5px}input[type=text]{height:40px;font-size:17px}
 .primary,.secondary,.warning,.success{min-height:40px;font-size:15px}
 .palette-title{font-size:16px;margin:0 0 5px}.object-btn{min-height:62px;font-size:12px}
 .shape-icon{width:38px;height:28px}.icon-circle{width:32px;height:32px}
 .hint,.palette-note{font-size:12px;line-height:1.4}.status{padding:6px 8px;font-size:14px}
 .print-modal .modal h2{font-size:19px;margin-bottom:4px}.print-lead{font-size:12px!important;margin-bottom:4px!important}
 .modal h2{font-size:21px}.modal p{font-size:15px;line-height:1.5}
 .print-card h3{font-size:14px;margin-bottom:4px}.temp-box strong{font-size:19px}.temp-box small{font-size:11px}
 .print-note{font-size:10px}.print-stat{font-size:12px}
}
@media (max-height:650px){
 .guide-text{font-size:18px}.guide-tag{display:none}
 .stage-card{margin-bottom:4px}.stage-head{font-size:14px;padding:4px 7px}.badge{width:22px;height:22px}
 input[type=range]{height:24px}.primary,.secondary,.warning,.success{min-height:37px}
 .object-btn{min-height:52px}.shape-icon{width:32px;height:24px}.icon-circle{width:27px;height:27px}
 .palette-note{display:none}
}

.version-label{font-size:11px;color:#71808d}
.app-footer{position:fixed;left:0;right:0;bottom:0;z-index:40;padding:3px 10px;background:rgba(245,247,249,.96);border-top:1px solid var(--line);font-size:11px;text-align:center;color:#607383;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.app-footer a,.author-card a{color:#0a6f9e}.author-card{margin-top:14px;padding:10px 12px;border:1px solid #cfe0eb;border-radius:9px;background:#f4fbfe;font-size:14px;line-height:1.6}@media(max-width:700px){.app-footer{position:static;white-space:normal}}
.video-modal{width:min(960px,calc(100% - 20px));max-height:calc(100dvh - 20px)}
.video-modal .modal{padding:16px}
.video-lead{margin:0 0 10px!important;font-size:15px!important;line-height:1.55!important}
.video-frame{position:relative;width:100%;background:#111;border-radius:12px;overflow:hidden;aspect-ratio:16/9;box-shadow:0 8px 24px rgba(15,23,42,.25)}
.video-frame video{display:block;width:100%;height:100%;object-fit:contain;background:#111}
.video-loading{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);padding:9px 15px;border-radius:999px;background:rgba(15,23,42,.78);color:#fff;font-size:14px;font-weight:900;pointer-events:none}
.video-note{margin:8px 0 0!important;font-size:12px!important;line-height:1.45!important;color:#637585}
.author-info{margin-top:14px;padding:10px 12px;border-radius:9px;background:#f3f7fa;border:1px solid #d5dfe7}
.author-info p{font-size:14px!important;line-height:1.5!important;margin:3px 0!important}
.author-info a{color:#0a6f9e;word-break:break-all}
@media(max-height:650px){.video-modal .modal{padding:10px}.video-lead{font-size:13px!important;margin-bottom:5px!important}.video-note{margin-top:4px!important}}

.stl-filename-label{margin-top:8px}.stl-filename-label+input{margin-bottom:2px}

/* アプリ名表示 */
.brand{display:flex;align-items:baseline;gap:8px;min-width:0}
.brand-main{font-size:20px;font-weight:900;white-space:nowrap}
.brand-sub{font-size:13px;font-weight:900;color:#49677d;white-space:nowrap}
.start-subtitle{margin:-2px 0 10px!important;font-size:19px!important;font-weight:900;color:#1598d4}
@media(max-width:1199px) and (orientation:landscape){
 .brand-main{font-size:17px}
 .brand-sub{font-size:11px}
}
@media(max-width:900px) and (orientation:portrait){
 .brand{width:100%;justify-content:center;flex-wrap:wrap;gap:2px 7px;text-align:center}
 .brand-main{font-size:18px}
 .brand-sub{width:100%;font-size:12px}
}
@media(max-width:760px){.brand-sub{display:none}}
@media(max-height:770px){.brand-main{font-size:17px}.brand-sub{font-size:11px}}

/* iPad・スマートフォン操作の安定化 */
button,.object-btn,.step-chip,.viewbtn,.roundbtn{min-width:44px;touch-action:manipulation}
input[type=range]{touch-action:pan-x}
dialog{max-height:calc(100dvh - 20px);overflow:auto;-webkit-overflow-scrolling:touch}
@supports(padding:max(0px)){
 .topbar{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}
 .app-footer{padding-bottom:max(3px,env(safe-area-inset-bottom))}
}
@media(max-width:700px){
 dialog{width:calc(100% - 16px);max-height:calc(100dvh - 16px);margin:auto}
 .modal{padding:14px}
 .modal-actions{position:sticky;bottom:-14px;background:#fff;padding:9px 0 2px;flex-wrap:wrap}
 .modal-actions button{flex:1 1 140px;min-width:0}
 .palette-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .object-btn{min-height:72px}
}
@media(max-width:430px){
 .center{height:340px}
 .guide-text{font-size:17px}
 .palette-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .viewer-toolbar{left:5px;top:5px;gap:5px;max-height:calc(100% - 10px)}
 .roundbtn{width:44px;height:44px}
 .viewbtn{width:68px;min-height:38px}
 .stl-grid{display:block}.stl-cg{margin-bottom:8px}
}
@media(max-height:500px) and (orientation:landscape){
 .topbar{position:relative}.brand-sub,.version-label{display:none}
 .guidebar{padding-block:3px}.guide-text{font-size:16px}
 .workspace{grid-template-columns:220px minmax(0,1fr) 150px}
 .palette-grid{grid-template-columns:1fr 1fr}.object-btn{min-height:48px}
}
/* =========================================================
   Smartphone 3D viewport fix v2
   Replace the previous mobile_sticky_3d_patch.css block with this block.
   ========================================================= */

/* Portrait smartphone: keep the 3D viewport visible below the sticky header. */
@media (max-width: 600px) and (orientation: portrait) {
  html,
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .center {
    order: 1;
    position: sticky;
    top: 82px;
    z-index: 18;
    width: 100%;
    height: min(42dvh, 330px);
    min-height: 250px;
    overflow: hidden;
    background: #e8eef2;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 5px 14px rgba(44, 67, 88, .18);
  }

  .canvas-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
  }

  .canvas-wrap canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
  }

  .viewer-toolbar {
    top: 5px;
    bottom: 5px;
    left: 5px;
    max-height: calc(100% - 10px);
    overflow: hidden;
  }

  .palette {
    order: 2;
  }

  .leftpanel {
    order: 3;
  }

  .palette,
  .leftpanel {
    position: relative;
    z-index: 1;
  }
}

@media (max-width: 430px) and (orientation: portrait) {
  .center {
    height: min(39dvh, 300px);
    min-height: 235px;
  }
}

/* Landscape smartphone: fit the whole app into the visible browser area.
   The 3D viewport remains on screen; only the left/right panels scroll. */
@media (max-width: 950px) and (max-height: 520px) and (orientation: landscape) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  body {
    overscroll-behavior: none;
  }

  .app {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-rows: 44px auto minmax(0, 1fr);
    overflow: hidden;
  }

  .topbar {
    position: relative;
    top: auto;
    z-index: 20;
    min-height: 44px;
    padding: 3px 8px;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .brand {
    width: auto;
    min-width: 190px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    text-align: left;
  }

  .brand-main {
    font-size: 16px;
  }

  .brand-sub,
  .version-label {
    display: none;
  }

  .stepper {
    order: initial;
    width: auto;
    justify-content: center;
    overflow: hidden;
    gap: 4px;
  }

  .step-chip {
    min-width: 0;
    height: 31px;
    padding: 0 7px;
    font-size: 11px;
  }

  .top-actions {
    position: static;
    display: flex;
    flex: none;
  }

  .toolbtn {
    width: 38px;
    min-width: 38px;
    height: 34px;
  }

  .guidebar {
    min-height: 34px;
    padding: 4px 10px;
    border-bottom-width: 2px;
  }

  .guide-tag {
    display: none;
  }

  .guide-text {
    font-size: 16px;
    line-height: 1.2;
  }

  .workspace {
    min-height: 0;
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr) 165px;
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "left center palette";
    overflow: hidden;
  }

  .leftpanel {
    grid-area: left;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
    border-right: 1px solid var(--line);
    border-top: 0;
  }

  .center {
    grid-area: center;
    position: relative;
    top: auto;
    z-index: 1;
    width: auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
    box-shadow: none;
    border: 0;
  }

  .palette {
    grid-area: palette;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
    border-left: 1px solid var(--line);
    border-top: 0;
  }

  .palette-title {
    margin: 0 0 4px;
    font-size: 15px;
  }

  .palette-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .object-btn {
    min-width: 0;
    min-height: 58px;
    padding: 3px;
    gap: 2px;
    font-size: 11px;
  }

  .shape-icon {
    width: 33px;
    height: 25px;
  }

  .icon-circle {
    width: 28px;
    height: 28px;
  }

  .palette-note {
    display: none;
  }

  .stage-card {
    margin-bottom: 4px;
  }

  .stage-head {
    padding: 4px 6px;
    font-size: 13px;
  }

  .stage-body {
    padding: 5px;
  }

  .badge {
    width: 22px;
    height: 22px;
  }

  label {
    font-size: 12px;
  }

  .value {
    font-size: 13px;
  }

  input[type="range"] {
    height: 22px;
  }

  .range-wrap {
    margin: 1px 0 3px;
  }

  .primary,
  .secondary,
  .warning,
  .success {
    min-height: 34px;
    font-size: 13px;
  }

  .hint,
  .status {
    font-size: 11px;
  }

  .viewer-toolbar {
    left: 5px;
    top: 5px;
    bottom: 5px;
    width: 128px;
    max-height: calc(100% - 10px);
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 5px;
    overflow: hidden;
  }

  .roundbtn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .viewbtn {
    width: 62px;
    min-height: 34px;
    padding: 2px;
    font-size: 10px;
  }

  .canvas-wrap,
  .canvas-wrap canvas {
    max-width: 100%;
    max-height: 100%;
  }

  .app-footer {
    display: none;
  }
}

/* =========================================================
   Smartphone print-simulator layout fix
   3DプリンタCGを縦横比を保って表示し、設定欄との重なりを防ぐ。
   ========================================================= */
@media (max-width: 700px) and (orientation: portrait) {
  .print-modal {
    width: calc(100% - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
  }

  .print-modal .modal {
    padding: 10px;
    overflow: hidden;
  }

  .print-modal .modal h2 {
    font-size: 21px;
    margin-bottom: 5px;
  }

  .print-lead {
    font-size: 13px !important;
    line-height: 1.45 !important;
    margin-bottom: 7px !important;
  }

  .print-layout {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
  }

  .printer-sim-view {
    flex: 0 0 auto;
    width: 100%;
    height: clamp(220px, 34dvh, 310px);
    min-height: 220px;
    padding: 8px;
    overflow: hidden;
  }

  .printer-frame {
    width: 100%;
    height: 100%;
    border-width: 7px;
  }

  .printer-frame canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .printer-label {
    top: 7px;
    padding: 4px 10px;
    font-size: 12px;
  }

  .print-side {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(95px, 1fr);
    gap: 7px;
    overflow: hidden;
  }

  .print-side > .print-card:nth-child(1),
  .print-side > .print-card:nth-child(2) {
    min-width: 0;
    max-height: none;
    overflow: auto;
  }

  .print-side > .print-card:last-child {
    grid-column: 1 / -1;
    min-height: 0;
  }

  .print-card {
    padding: 7px;
  }

  .temp-grid {
    gap: 5px;
  }

  .temp-box {
    padding: 5px 3px;
  }

  .temp-box strong {
    font-size: 19px;
  }

  .print-actions {
    gap: 5px;
  }

  .print-actions button {
    min-width: 0;
    padding-inline: 4px;
  }

  .gcode-screen {
    min-height: 78px;
    font-size: 10px;
  }

  .print-modal .modal-actions {
    position: static;
    flex: 0 0 auto;
    margin-top: 7px;
    padding: 0;
  }
}

@media (max-width: 430px) and (orientation: portrait) {
  .printer-sim-view {
    height: clamp(210px, 31dvh, 270px);
    min-height: 210px;
  }

  .print-modal .modal h2 {
    font-size: 19px;
  }

  .print-lead {
    font-size: 12px !important;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .print-modal {
    width: calc(100% - 10px);
    height: calc(100dvh - 10px);
    max-height: calc(100dvh - 10px);
  }

  .print-modal .modal {
    padding: 7px;
  }

  .print-modal .modal h2,
  .print-lead {
    display: none;
  }

  .print-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(250px, .65fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 7px;
  }

  .printer-sim-view {
    min-height: 0;
    padding: 7px;
  }

  .print-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto minmax(72px, 1fr);
    gap: 5px;
  }

  .print-card {
    padding: 5px;
  }

  .print-card h3 {
    font-size: 12px;
  }

  .temp-box strong {
    font-size: 16px;
  }

  .gcode-screen {
    min-height: 62px;
    font-size: 9px;
  }

  .print-modal .modal-actions {
    margin-top: 5px;
  }
}
