/* style.css v0.9.18 — desktop + mobile, final controls row & hint */
html{box-sizing:border-box;}*,*::before,*::after{box-sizing:inherit;}
html,body{width:100%;max-width:100%;overflow-x:hidden;}
img{max-width:100%;height:auto;}
body{background:#111;color:#eee;font-family:sans-serif;margin:0;display:flex;flex-direction:column;height:100vh;overflow-y:hidden;}

/* Header */
#app-header{background:#0f0f0f;padding:0;text-align:center;box-shadow:0 1px 4px rgba(0,0,0,.6);}
#header-logo{display:block;width:100%;height:auto;max-height:56px;object-fit:contain;margin:0 auto;}

/* Layout */
#main-container{flex:1;display:flex;overflow:hidden;width:100%;max-width:100%;}
#sidebar{flex:0 0 260px;background:#1c1c1c;padding:15px;box-shadow:2px 0 5px rgba(0,0,0,.4);display:flex;flex-direction:column;gap:12px;overflow-y:auto;}
#editor-area{flex:1;position:relative;background:#222;display:flex;flex-direction:column;align-items:center;justify-content:center;overflow:hidden;width:100%;min-width:0;touch-action:none;overscroll-behavior:contain;}
#mainCanvas{display:block;width:100%;height:auto;max-width:100%;max-height:100%;touch-action:none;outline:none;}

/* Controls area under canvas */
#controls-bottom{display:flex;flex-direction:column;gap:10px;justify-content:center;align-items:center;padding:10px 0;}
#controls-bottom .btn-row{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
#controls-bottom .btn-row > button{width:100%;min-width:0;display:inline-flex;justify-content:center;align-items:center}

/* Hint */
.touch-hint{
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.55);
  border-radius:8px;
  padding:10px 12px;
  text-align:center;
  max-width:720px;
  width:clamp(240px,95%,720px);
  margin:0 auto 6px auto;
}

/* Panels & common UI */
.panel{background:#1f1f1f;border-radius:6px;padding:14px 16px;box-shadow:0 0 0 1px rgba(255,255,255,.05);}
.panel h2{margin:0 0 8px;font-size:18px;}
.panel p{font-size:13px;line-height:1.35;opacity:.85;}
.panel label{display:block;margin-top:8px;font-size:13px;}
.ring-row{display:flex;justify-content:space-evenly;gap:10px;padding:10px;border:1px solid #333;border-radius:6px;background:#1b1b1b;margin-bottom:10px;}
.hint{font-size:12px;opacity:.9;margin:6px 0;color:#eee;}

/* Nudge buttons */
.nudge-controls{display:flex;flex-direction:column;gap:6px;margin-top:6px;align-items:center;}
.nudge-row{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;}
.nudge-btn{width:52px;height:52px;display:inline-flex;align-items:center;justify-content:center;font-size:20px;line-height:1;user-select:none;border-radius:8px;border:1px solid #3a3d43;background:#2f3237;color:#e8eaef;box-shadow:0 1px 0 rgba(255,255,255,.06) inset,0 1px 2px rgba(0,0,0,.4);}
#nudgeUp{margin-bottom:4px;}
.complete-btn{padding:6px 10px;background:#28a745;color:#fff;border:none;cursor:pointer;border-radius:4px;}
.danger-btn{padding:6px 10px;background:#8b1e1e;color:#fff;border:none;cursor:pointer;border-radius:4px;}

/* Swatches */
.swatch-container{display:grid;grid-template-columns:repeat(4,40px);gap:10px;margin-top:8px;}
.swatch{width:40px;height:40px;border-radius:50%;border:2px solid #222;cursor:pointer;box-sizing:border-box;display:inline-block;touch-action:manipulation;-webkit-tap-highlight-color:transparent;pointer-events:auto;}
.swatch.add-color{display:flex;align-items:center;justify-content:center;font-weight:bold;background:#fff;color:#000;}

/* Sliders / fine inputs */
button,input[type="range"],input[type="color"]{width:100%;margin:4px 0;}
.fine-row{display:flex;gap:6px;align-items:center;margin-top:6px}
.fine-row input{max-width:100px;background:#1b1b1b;border:1px solid #444;color:#eee;padding:6px;border-radius:4px}
.fine-row button{width:40px;height:34px;border:1px solid #444;background:#555;color:#fff;border-radius:4px;cursor:pointer}

/* Overlay instructions (hidden on mobile) */
#editor-instructions{position:absolute;top:0;left:0;right:0;bottom:0;padding:16px;background:rgba(0,0,0,0.86);color:#eee;overflow-y:auto;z-index:3;width:100%;max-width:100%;}
#editor-instructions h2{margin:0 0 8px;font-size:22px;}
.instructions-list{margin:0 0 0 1.2em;padding:0;list-style:disc;line-height:1.45;font-size:14px;}
.instructions-list li{margin-bottom:8px;}
.step-panel{display:block;}

/* Mobile layout */
@media (max-width:600px){
  #header-logo{max-height:56px;}
  html,body{height:auto;overflow-y:auto;overflow-x:hidden;}
  #main-container{flex-direction:column !important;width:100% !important;max-width:100% !important;}
  #editor-area,#sidebar{width:100% !important;max-width:100% !important;}
  #sidebar{flex:none !important;order:2;margin-bottom:72px;}
  #editor-area{order:1;flex:1 1 auto;min-height:60vh;padding:0;}
  .step-panel{display:none;}
  .step-panel.active{display:block;}
  #mobile-stepper{position:fixed;bottom:0;left:0;right:0;display:flex;justify-content:space-between;align-items:center;padding:8px env(safe-area-inset-right) calc(8px + env(safe-area-inset-bottom)) env(safe-area-inset-left);background:#1c1c1c;box-shadow:0 -2px 4px rgba(0,0,0,0.5);z-index:200;}
  #mobile-stepper button{flex:1;margin:0 4px;}
  #mobile-stepper .step-counter{flex:1;text-align:center;font-size:14px;color:#eee;}
  #completeBtn{display:inline-block;}
  .nudge-btn{width:44px;height:44px;font-size:18px;}
@media (max-width:600px){
  /* Allow overlay on mobile; JS will hide it once an image is loaded */
  #editor-instructions{display:block;}
}

}

/* Desktop-only: hide Complete button (click outside to clear highlight) */
@media (min-width:601px){
  #mobile-stepper{display:none;}
  #completeBtn{display:none;}
}
