/* ==========================================================================
   ZellRayy — Theme Tokens
   Two moods, one system: "Night Console" (dark) & "Paper Console" (cream)
   api.zellrayy.com
   ========================================================================== */

:root{
  --radius: 10px;
  --radius-sm: 6px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

/* ---------- DARK (default) : black / charcoal / warm-cream accent ---------- */
:root,
[data-theme="dark"]{
  --bg: #0a0a0b;
  --bg-soft: #121213;
  --surface: #19191b;
  --surface-2: #222224;
  --border: #2b2b2e;
  --border-soft: #1f1f21;
  --text: #d9d4c7;
  --text-muted: #8b877c;
  --text-dim: #5c5952;
  --accent: #cdbd94;
  --accent-strong: #ded0aa;
  --accent-ink: #17150f;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.25);
  --grain-opacity: .05;
  --code-bg: #101011;
  color-scheme: dark;
}

/* ---------- LIGHT : cream / beige / ink accent ---------- */
[data-theme="light"]{
  --bg: #f3ecdb;
  --bg-soft: #ece1c8;
  --surface: #faf6ec;
  --surface-2: #efe4cb;
  --border: #ddd0ac;
  --border-soft: #e7dbbd;
  --text: #211f1a;
  --text-muted: #756c5b;
  --text-dim: #a89d86;
  --accent: #1c1a16;
  --accent-strong: #000000;
  --accent-ink: #f6f0e2;
  --shadow: 0 8px 30px rgba(60,50,20,.10);
  --shadow-sm: 0 2px 10px rgba(60,50,20,.08);
  --grain-opacity: .035;
  --code-bg: #efe4cc;
  color-scheme: light;
}

*, *::before, *::after{
  box-sizing: border-box;
}

html{
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body{
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s var(--ease), color .35s var(--ease);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Sleek Dark/Light Scrollbar (No white) */
::-webkit-scrollbar{ width: 8px; height: 8px; }
::-webkit-scrollbar-track{ background: transparent; }
::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover{ background: var(--text-dim); }
*{ scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

::selection{ background: var(--accent); color: var(--accent-ink); }

.font-display{ font-family: 'Space Grotesk', 'Inter', sans-serif; }
.font-mono{ font-family: 'JetBrains Mono', monospace; }

a{ color: inherit; text-decoration: none; }

.hidden{ display: none !important; }

/* Subtle film-grain texture */
.grain{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.app-header{
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  transition: background-color .35s var(--ease), border-color .35s var(--ease);
  width: 100%;
}

.header-container{
  max-width: 1380px;
  margin: 0 auto;
  padding: .75rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand{
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.brand-icon{
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.brand-text{
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
}

.brand-text h1{
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  margin: 0;
  color: var(--text);
  white-space: nowrap;
}

.brand-badge{
  font-size: .68rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.header-nav{
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}

/* ---------- Theme Dial (No Emoji, Clean SVG) ---------- */
.theme-dial{
  position: relative;
  width: 50px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  outline: none;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.theme-dial .knob{
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left .3s var(--ease), background .3s var(--ease);
  color: var(--accent-ink);
}
.theme-dial .knob svg{
  display: block;
}
[data-theme="light"] .theme-dial .knob{ left: 26px; }

/* ---------- Buttons (Zero Green) ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 600;
  font-size: .8rem;
  padding: .6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease), background-color .2s var(--ease), opacity .2s var(--ease), border-color .2s var(--ease);
  white-space: nowrap;
  touch-action: manipulation;
}

.btn:active{ transform: scale(.98); }

.btn-primary{
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-primary:hover{ transform: translateY(-2px); box-shadow: var(--shadow-sm); filter: brightness(1.05); }

.btn-ghost{
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover{ border-color: var(--text-muted); transform: translateY(-2px); }

.btn-secondary{
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover{ border-color: var(--text-muted); transform: translateY(-2px); }

.btn-generate{
  width: 100%;
  padding: .8rem 1.4rem;
  font-size: .92rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
}
.btn-generate:hover{ filter: brightness(1.06); transform: translateY(-2px); box-shadow: var(--shadow); }

.btn-shortcut{
  font-size: .7rem;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0,0,0,.15);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.btn-sm{
  padding: .35rem .75rem;
  font-size: .76rem;
}

/* ---------- Main Layout ---------- */
.main-wrapper{
  position: relative;
  z-index: 1;
  max-width: 1380px;
  margin: 0 auto;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ---------- 1. Top Section: Preview Stage ---------- */
.preview-stage-section{
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.stage-container{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.stage-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem;
  padding: 0 .2rem;
  width: 100%;
  box-sizing: border-box;
}

.stage-meta{
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Accent Neutral Dot (No Green) */
.meta-dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.meta-divider{ color: var(--text-dim); }

.stage-actions{
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

/* Canvas Scroll Stage - No top clipping */
.stage-canvas-scroll{
  width: 100%;
  max-width: 100%;
  min-height: 240px;
  max-height: 72vh;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  border: 1px solid var(--border-soft);
  padding: 1.6rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  box-sizing: border-box;
}

.stage-canvas-wrapper{
  position: relative;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-width: 100%;
}

.stage-canvas-wrapper img{
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.preview-loading{
  position: absolute;
  inset: 0;
  background: var(--code-bg);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  color: var(--text);
  font-size: .85rem;
  font-weight: 500;
  z-index: 10;
}

.spinner{
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* API Link Bar - Strict Container Bounds (No horizontal overflow) */
.api-link-bar{
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .75rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.api-link-badge{
  font-size: .68rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.api-link-input{
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  outline: none;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

#btnCopyBarUrl{
  flex-shrink: 0;
}

/* ---------- 2. Middle Section: Controls ---------- */
.controls-section{
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.controls-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.panel-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.card-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  flex-wrap: wrap;
}

.card-title{
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: 'Space Grotesk', sans-serif;
}

.card-title svg{ color: var(--accent); flex-shrink: 0; }

.presets-dropdown{
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  color: var(--text-muted);
}

/* Form Controls */
.form-grid-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
  width: 100%;
  box-sizing: border-box;
}

.form-group{
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
}

.form-group label{
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-select, .form-select-sm{
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .85rem;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  outline: none;
  transition: border-color .2s var(--ease);
}

.form-select-sm{
  padding: .35rem .65rem;
  font-size: .76rem;
}

.form-input:focus, .form-select:focus, .form-select-sm:focus{
  border-color: var(--accent);
}

/* Code Editor Textarea */
.code-editor-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.editor-hints{
  font-size: .7rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.code-editor-wrapper{
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--code-bg);
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.code-editor-wrapper:focus-within{
  border-color: var(--accent);
}

.code-textarea{
  width: 100%;
  height: 200px;
  background: transparent;
  border: none;
  outline: none;
  padding: .9rem;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: .85rem;
  line-height: 1.6;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
  box-sizing: border-box;
}

.generate-btn-row{ margin-top: .2rem; }

/* Swatches */
.bg-palette{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: .5rem;
  width: 100%;
  box-sizing: border-box;
}

.bg-swatch{
  height: 34px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform .15s var(--ease);
}
.bg-swatch:hover{ transform: scale(1.08); }
.bg-swatch.active{
  border-color: var(--text);
  box-shadow: var(--shadow-sm);
}
.swatch-transparent{
  background: repeating-conic-gradient(#2a2a2e 0% 25%, #19191b 0% 50%) 50% / 8px 8px !important;
}

/* Footer row */
.options-footer-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: .3rem;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.checkbox-label{
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  user-select: none;
}
.custom-checkbox{ display: none; }
.checkbox-custom{
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.custom-checkbox:checked + .checkbox-custom{
  background: var(--accent);
  border-color: var(--accent);
}
.custom-checkbox:checked + .checkbox-custom::after{
  content: '✓';
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
}
.checkbox-text{
  font-size: .82rem;
  color: var(--text);
  font-weight: 500;
}

.watermark-badge-info{
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .3rem .7rem;
  border-radius: 999px;
}

.slider-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.slider-val{
  font-size: .72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-strong);
  font-weight: 600;
}

.form-range{
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  outline: none;
  cursor: pointer;
}
.form-range::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* ---------- 3. Bottom Section: Documentation ---------- */
.docs-section-bottom{
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.docs-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.docs-header{
  display: flex;
  flex-direction: column;
  gap: .3rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.docs-tag{
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: .08em;
  font-family: 'JetBrains Mono', monospace;
}

.docs-title-group h2{
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  margin: 0;
}

.docs-title-group p{
  font-size: .84rem;
  color: var(--text-muted);
  margin: 0;
}

.endpoint-container{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.endpoint-item{
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.endpoint-header{
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-header code{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-desc{
  font-size: .76rem;
  color: var(--text-dim);
  margin: 0;
}
.endpoint-desc code{
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.method-tag{
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.method-tag.get{
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.method-tag.post{
  background: var(--accent);
  color: var(--accent-ink);
}

.docs-subsection{
  display: flex;
  flex-direction: column;
  gap: .8rem;
  width: 100%;
  box-sizing: border-box;
}

.docs-subsection h3{
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
}

.table-responsive{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.docs-table{
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  text-align: left;
  min-width: 600px;
}
.docs-table th{
  padding: .75rem .9rem;
  background: var(--surface-2);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}
.docs-table td{
  padding: .75rem .9rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
}
.docs-table code{
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-strong);
  background: var(--surface-2);
  padding: 2px 5px;
  border-radius: 4px;
}

/* Status tags (No Green) */
.status-tag{
  font-size: .7rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
}
.status-tag.required{
  background: var(--accent);
  color: var(--accent-ink);
}
.status-tag.optional{
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Tabs */
.tabs-header{
  display: flex;
  gap: .5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  box-sizing: border-box;
}

.tab-btn{
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: .45rem 1rem;
  font-size: .78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.tab-btn:hover{ color: var(--text); }
.tab-btn.active{
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.tab-pane{
  display: none;
  margin-top: .6rem;
  width: 100%;
  box-sizing: border-box;
}
.tab-pane.active{ display: block; }

.tab-pane pre{
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: 'JetBrains Mono', monospace;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

/* ---------- Toast Notifications (No emoji) ---------- */
.toast-container{
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast{
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Mobile & Tablet Responsiveness (HP Optimization & No Horizontal Scroll)
   ========================================================================== */

@media (max-width: 900px){
  .controls-grid{ grid-template-columns: 1fr; }
  .endpoint-container{ grid-template-columns: 1fr; }
}

@media (max-width: 768px){
  .header-container{
    padding: .6rem 1rem;
  }
  .main-wrapper{
    padding: .85rem;
    gap: 1.1rem;
  }
  .stage-container{
    padding: .85rem;
  }
  .stage-toolbar{
    flex-direction: column;
    align-items: stretch;
    gap: .65rem;
  }
  .stage-meta{
    justify-content: space-between;
  }
  .stage-actions{
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: .5rem;
  }
  .stage-actions .btn{
    width: 100%;
    justify-content: center;
    padding: .55rem .4rem;
    font-size: .76rem;
  }
  .stage-canvas-scroll{
    padding: .85rem;
    min-height: 180px;
    max-height: 55vh;
  }
  .panel-card{
    padding: .9rem;
  }
  .form-grid-2{
    grid-template-columns: 1fr;
    gap: .75rem;
  }
  .code-textarea{
    height: 170px;
    font-size: .8rem;
  }
  .docs-card{
    padding: 1rem;
  }
  .toast-container{
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast{
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px){
  .brand-text h1{ font-size: 1rem; }
  .brand-badge{ display: none; }
  .btn{ padding: .5rem .75rem; font-size: .75rem; }
  .stage-canvas-scroll{ padding: .65rem; }
  .api-link-bar{
    padding: .4rem .6rem;
    gap: .4rem;
  }
  .api-link-badge{
    font-size: .62rem;
    padding: 2px 4px;
  }
  .api-link-input{
    font-size: .72rem;
  }
  #btnCopyBarUrl{
    padding: .3rem .55rem;
    font-size: .72rem;
  }
}
