@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito+Sans:wght@400;600;700&display=swap');

:root {
  color-scheme: light;
  --ink: #181b20;
  --muted: #5b6572;
  --line: #dfe4ea;
  --paper: #f7f7f5;
  --panel: #ffffff;
  --accent: #d83f31;
  --accent-dark: #a92f25;
  --primary: #6750a4;
  --primary-dark: #4f378b;
  --teal: #1f7a76;
  --gold: #b28b45;
  --steel: #8a929b;
  --shadow: 0 18px 60px rgba(24, 27, 32, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Nunito Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: Fredoka, "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.3px;
}


img,
canvas {
  max-width: 100%;
  display: block;
}

/* Global link styles */
a {
  color: var(--gold);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

a:hover {
  color: var(--ink);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Text links within content (paragraphs, lists, etc.) */
p a,
li a,
.content a,
.faq-answer a {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-color: rgba(178, 139, 69, 0.4);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

p a:hover,
li a:hover,
.content a:hover,
.faq-answer a:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
  text-decoration-thickness: 2px;
}

/* Navigation and UI links (header, nav, buttons) - keep minimal */
.site-header a,
.site-nav a,
nav a,
.button,
button {
  color: inherit;
  text-decoration: none;
}

.site-header a:hover,
.site-nav a:hover,
nav a:hover {
  color: var(--gold);
}

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 5vw;
  background: rgba(247, 247, 245, 0.92);
  border-bottom: 1px solid rgba(24, 27, 32, 0.08);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, transparent 42%, rgba(255, 255, 255, 0.72) 43%, transparent 53%),
    linear-gradient(135deg, var(--accent), var(--teal));
  box-shadow: 0 7px 18px rgba(216, 63, 49, 0.28);
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 0.94rem;
}

.nav a:hover {
  color: var(--ink);
}

.hero {
  position: relative;
  min-height: calc(100vh - 72px);
  display: grid;
  align-items: center;
  padding: 84px 5vw 120px;
  overflow: hidden;
}

.hero-image,
.hero-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-image {
  object-fit: cover;
}

.hero-shade {
  background:
    linear-gradient(90deg, rgba(15, 16, 18, 0.82), rgba(15, 16, 18, 0.44) 44%, rgba(15, 16, 18, 0.16)),
    linear-gradient(0deg, rgba(15, 16, 18, 0.22), rgba(15, 16, 18, 0));
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  color: #ffffff;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #ffb4aa;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 12px;
  line-height: 1.15;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
}

.hero p:not(.eyebrow) {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 1.1rem;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(103, 80, 164, 0.26);
}

.button.primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.button.secondary {
  background: #ffffff;
  color: var(--primary);
  border-color: rgba(103, 80, 164, 0.22);
}

.button.danger {
  background: #b3261e;
  color: #ffffff;
}

.button.icon-only {
  min-height: 40px;
  padding: 0;
  width: 40px;
  border-radius: 8px;
}

.full {
  width: 100%;
}

section:not(.hero) {
  padding: 88px 5vw;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.section-heading {
  max-width: 820px;
  margin-bottom: 34px;
}

.steps,
.product-grid,
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.steps article,
.product-card,
.portfolio-grid article,
.checkout,
.controls,
.canvas-shell,
.faq-list details,
.md-card {
  background: var(--panel);
  box-shadow: 0 2px 6px rgba(24, 27, 32, 0.08), 0 10px 28px rgba(24, 27, 32, 0.06);
}

.steps article,
.product-card,
.portfolio-grid article {
  padding: 24px;
}

.steps span {
  display: inline-block;
  margin-bottom: 32px;
  color: var(--teal);
  font-weight: 900;
}

.steps p,
.product-card p,
.portfolio-grid p,
.faq-list p,
.checkout p {
  color: var(--muted);
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.product-visual {
  position: relative;
  min-height: 172px;
  border-radius: 7px;
  overflow: hidden;
  background: #22262d;
}

.product-image-container {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
  cursor: pointer;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.product-image-container:hover {
  transform: scale(1.02);
}

.product-image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
  display: block;
}

.product-visual.card::after,
.product-visual.tag::after {
  content: "";
  position: absolute;
  inset: 32px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at 70% 32%, rgba(255, 255, 255, 0.28), transparent 18%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
}

.product-visual.tag::after {
  inset: 26px 55px;
  border-radius: 20px;
}

.product-visual.tag::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 44px;
  left: 78px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(247, 247, 245, 0.94);
}

.variant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variant-list span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef1f2;
  color: var(--muted);
  font-size: 0.82rem;
}

.variant-swatches {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(24, 27, 32, 0.12);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(24, 27, 32, 0.08);
}

.color-swatch:hover {
  transform: scale(1.15);
  border-color: var(--primary);
  box-shadow: 0 3px 8px rgba(103, 80, 164, 0.3);
}

.studio {
  background: #eef1f2;
}

.studio-info {
  background: #eef1f2;
}

.studio-info-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.studio-info-copy {
  max-width: 720px;
}

.studio-info-copy p {
  color: var(--muted);
  font-size: 1.02rem;
}

.studio-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.studio-feature-grid article {
  padding: 20px;
}

.studio-feature-grid p {
  color: var(--muted);
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.canvas-shell {
  padding: 18px;
}

.canvas-wrap {
  display: grid;
  place-items: center;
  min-height: 380px;
  padding: 22px;
  background:
    linear-gradient(45deg, #e1e6e9 25%, transparent 25%),
    linear-gradient(-45deg, #e1e6e9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e1e6e9 75%),
    linear-gradient(-45deg, transparent 75%, #e1e6e9 75%);
  background-color: #f4f6f7;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  background-size: 22px 22px;
  border-radius: 7px;
}


.tip {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.controls {
  display: grid;
  gap: 16px;
  padding: 0;
}

.controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.controls input,
.controls select {
  width: 100%;
  min-height: 43px;
  border: 1px solid #79747e;
  border-radius: 4px;
  background: #fffbfe;
  color: var(--ink);
  padding: 8px 10px;
}

.rotation-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
}

.controls .degree-input {
  min-height: 36px;
  padding: 6px 8px;
  text-align: right;
}

.controls .checkbox-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 43px;
  padding-top: 24px;
}

.checkbox-control input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--primary);
}

.studio-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: #f3edf7;
  color: var(--muted);
  font-size: 0.88rem;
}

.studio-summary strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.studio-summary span {
  display: block;
}

.controls input:focus,
.controls select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(103, 80, 164, 0.16);
  outline: none;
}

.controls input:disabled,
.controls select:disabled,
.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.controls input:disabled,
.controls select:disabled {
  background: #ece9ee;
  border-color: #c9c5cc;
  color: #79747e;
}

.controls select option:disabled {
  color: #999;
  font-style: italic;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkout {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 22px;
  align-items: center;
  margin: 88px 5vw;
  padding: 28px;
}

.checkout-actions {
  display: grid;
  gap: 10px;
}

.checkout .form-status {
  min-height: 20px;
  margin: 0;
  color: var(--teal);
  font-size: 0.88rem;
  font-weight: 700;
}

.checkout .form-status.error {
  color: var(--accent);
}

.checkout h2 {
  font-size: clamp(1.55rem, 3vw, 2.4rem);
}

.terms-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--muted);
}

.terms-box input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.sample {
  min-height: 210px;
  border-radius: 7px;
  border: 1px solid rgba(24, 27, 32, 0.1);
}

.sample-black {
  background:
    linear-gradient(135deg, transparent 45%, rgba(255, 255, 255, 0.15) 45% 48%, transparent 48%),
    radial-gradient(circle at 65% 36%, rgba(255, 255, 255, 0.24), transparent 20%),
    #1d2228;
}

.sample-gold {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16) 1px, transparent 1px, transparent 8px),
    linear-gradient(135deg, #8a6327, #e1bd73);
}

.sample-steel {
  background:
    radial-gradient(circle at 26% 34%, #f4f5f5 0 7px, transparent 8px),
    linear-gradient(135deg, #6f7882, #d2d6d9 45%, #848d96);
}

.faq-list {
  display: grid;
  gap: 12px;
  max-width: 900px;
}

.faq-list details {
  padding: 18px 20px;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 800;
}

.faq-list p {
  margin: 12px 0 0;
}

.site-footer {
  padding: 28px 5vw 42px;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;f
}

.site-footer strong {
  color: #ffffff;
}

.studio-page {
  min-height: 100vh;
  overflow: hidden;
  background: #eef1f2;
}

.studio-topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: #fffbfe;
  border-bottom: 1px solid rgba(24, 27, 32, 0.1);
}

.studio-topbar-actions {
  display: flex;
  gap: 10px;
}

.fullscreen-studio {
  height: calc(100vh - 64px);
  /* iOS Safari's address bar shows/hides as the page scrolls, and 100vh
     is sized to the viewport *without* it -- overestimating the
     actually-visible height while it's showing. 100dvh tracks the real,
     current visible height instead. A browser that doesn't recognize the
     dvh unit treats this whole declaration as invalid and ignores it,
     silently keeping the 100vh-based line above -- safe to add
     unconditionally, nothing to gate on. */
  height: calc(100dvh - 64px);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 360px;
  grid-template-rows: auto minmax(0, 1fr);
  transition: grid-template-columns 0.2s ease;
  /* Blocks native pinch/double-tap zoom for every touch starting anywhere in
     the studio (canvas-toolbar's Front/Back tabs, rulers, zoom-widget,
     pip-preview, icon-toolbar, studio-panel -- not just .canvas-stage, which
     already had touch-action:none). Without this, a pinch gesture with one
     finger landing outside the canvas proper (very easy on a small phone --
     the toolbar row sits right above the card) still lets Android Chrome's
     native page zoom engage alongside the app's own JS-driven canvas zoom,
     which is what was actually causing the out-of-bounds mask to drift
     during pinch-zoom on Android. The viewport meta tag's maximum-scale=1/
     user-scalable=no (see studio.php) doesn't reliably stop this by itself --
     Android Chrome has ignored that attribute for accessibility reasons
     since ~2019 -- touch-action is the mechanism Android actually honors.
     pan-x/pan-y (rather than none) keeps native single-finger scrolling
     working in the side panels; touch-action is computed as the
     intersection down the ancestor chain, so .canvas-stage's own stricter
     touch-action:none (full custom pan+zoom control) still wins there. */
  touch-action: pan-x pan-y;
}

/* Canvas toolbar - side toggle and view controls */
.canvas-toolbar {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: white;
  border-bottom: 1px solid var(--line);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.design-title-input {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink, #1c2027);
  padding: 6px 10px;
  max-width: 260px;
  min-width: 80px;
  text-align: center;
  text-overflow: ellipsis;
}

.design-title-input:hover {
  border-color: var(--line);
}

.design-title-input:focus {
  border-color: var(--accent, #4a6cf7);
  background: white;
  outline: none;
  text-align: left;
}

/* "Download our template" prompt next to the Front/Back toggle */
.template-download-prompt {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.82rem;
  color: var(--muted, #5b6572);
  cursor: pointer;
  text-align: left;
}

.template-download-prompt strong {
  color: var(--primary, #6750a4);
  text-decoration: underline;
}

.template-download-prompt:hover strong {
  text-decoration: none;
}

/* Segmented control (iOS-style toggle) */
.side-toggle {
  display: inline-flex;
  background: #f0f0f0;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  position: relative;
}

.side-toggle-option {
  position: relative;
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.side-toggle-option .material-symbols-outlined {
  font-size: 18px;
}

.side-toggle-option:hover:not(:disabled):not(.active) {
  color: var(--ink);
}

.side-toggle-option.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.side-toggle-option:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  color: var(--muted);
}

.side-toggle-option .layer-count {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.side-toggle-option.active .layer-count {
  color: var(--primary);
}

.toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* View control buttons */
.view-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.icon-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.fullscreen-studio.toolbar-collapsed {
  grid-template-columns: 52px minmax(0, 1fr) 360px;
}

.icon-toolbar {
  grid-row: 1 / -1;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 4px;
  background: #fefbff;
  border-right: 1px solid rgba(24, 27, 32, 0.1);
  overflow-y: auto;
  overflow-x: hidden;
  width: 220px;
  transition: width 0.2s ease;
  padding: 0;
}

/* Collapsed toolbar state */
.fullscreen-studio.toolbar-collapsed .icon-toolbar {
  width: 52px;
  padding: 8px 0;
  align-items: center;
}

/* Hide titles when collapsed */
.fullscreen-studio.toolbar-collapsed .toolbar-group-title {
  display: none;
}

/* Show all group content when collapsed (disable collapsing) */
.fullscreen-studio.toolbar-collapsed .toolbar-group.collapsed .toolbar-group-content {
  display: flex !important;
}

/* Hide labels when collapsed */
.fullscreen-studio.toolbar-collapsed .tool-button-label {
  display: none;
}

/* Center icons when collapsed */
.fullscreen-studio.toolbar-collapsed .tool-button {
  width: 44px;
  height: 44px;
  padding: 0;
  gap: 0;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

/* Flip toggle button arrow when collapsed */
.fullscreen-studio.toolbar-collapsed .toolbar-toggle .material-symbols-outlined {
  transform: rotate(180deg);
}

/* Template download link in left panel */
.toolbar-external-link {
  padding: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: auto;
}

.toolbar-external-link .template-download-prompt {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: #f0f4ff;
  border: 1px solid #d1e0ff;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.toolbar-external-link .template-download-prompt:hover {
  background: #e3edff;
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.toolbar-external-link .template-download-prompt strong {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Hide when toolbar collapsed */
.fullscreen-studio.toolbar-collapsed .toolbar-external-link {
  display: none;
}

.tool-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.88rem;
  text-align: left;
  transition: all 0.15s;
}

.tool-button .material-symbols-outlined {
  flex-shrink: 0;
  font-size: 20px;
  color: var(--primary);
}

.tool-button:hover {
  background: #f3edf7;
}

.tool-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tool-button:disabled:hover {
  background: transparent;
}

.tool-button.active {
  background: #e8def8;
  margin-bottom: 5px;
}

.tool-button-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapsible Toolbar Groups */
.toolbar-group {
  border-bottom: 1px solid rgba(24, 27, 32, 0.1);
  padding: 8px 4px;
}

.toolbar-group:last-child {
  border-bottom: none;
}

.toolbar-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  margin-bottom: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(24, 27, 32, 0.6);
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  transition: background-color 0.15s, opacity 0.2s;
}

.toolbar-group-title:hover {
  background-color: #f8f9fa;
}

.chevron-icon-left {
  font-size: 16px;
  transition: transform 0.2s;
  margin-left: auto;
}

.toolbar-group.collapsed .chevron-icon-left {
  transform: rotate(-90deg);
}

.toolbar-group-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.2s;
}

.toolbar-group.collapsed .toolbar-group-content {
  display: none;
}

.slider-popout {
  position: fixed;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 16px;
  width: 200px;
  z-index: 1000;
}

.popout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.popout-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popout-title .material-symbols-outlined {
  font-size: 18px;
  color: var(--primary);
}

.reset-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reset-btn:hover {
  background: #f3edf7;
}

.reset-btn .material-symbols-outlined {
  font-size: 18px;
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-value {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.slider-popout input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e8def8;
  border-radius: 3px;
  outline: none;
  margin: 8px 0;
}

.slider-popout input[type="range"]::-webkit-slider-track {
  width: 100%;
  height: 6px;
  background: #e8def8;
  border-radius: 3px;
}

.slider-popout input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  margin-top: -7px;
}

.slider-popout input[type="range"]::-moz-range-track {
  width: 100%;
  height: 6px;
  background: #e8def8;
  border-radius: 3px;
}

.slider-popout input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  border: none;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #999;
  margin-top: -4px;
}

.material-symbols-outlined {
  font-size: 24px;
  line-height: 1;
}

.studio-workspace {
  grid-row: 2;
  grid-column: 2;
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  /* Native pinch/double-tap zoom is blocked from the ancestor
     .fullscreen-studio rule (touch-action: pan-x pan-y), which also keeps
     this element's own native scroll working -- touch-action:none here
     would additionally kill that scroll, which isn't needed for the fix. */
}

/* Being a <section> makes .studio-workspace an accidental match for the
   marketing-page rule "section:not(.hero) { max-width: 1400px; padding:
   88px 5vw; }" further down this file -- meant for public-page content
   sections, but a plain element+:not() selector doesn't know or care that
   this particular section is actually the studio canvas area. Its
   specificity (element + :not(.class) => 0,1,1) beats the plain
   ".studio-workspace" rule above (0,1,0) regardless of source order, so
   fixing it needs matching specificity here too (0,2,0), not just adding
   the properties to that rule -- same lesson documented repeatedly
   elsewhere in this file. Silently capped the canvas at 1400px wide with
   marketing-page padding on any window wider than ~1400px, on both this
   page and studio.php (which shares the same class). */
.fullscreen-studio .studio-workspace {
  max-width: none;
  padding: 0;
}

.studio-canvas-toolbar {
  grid-column: 1 / 4;
  grid-row: 1;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.toolbar-left {
  display: flex;
  gap: 16px;
  align-items: center;
}

.toolbar-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.view-controls {
  font-size: 0.85rem;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.view-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.view-toggle span {
  color: var(--muted);
}

.bg-color-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.bg-color-control input[type="color"] {
  width: 32px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
}

.mask-opacity-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.mask-opacity-control input[type="range"] {
  cursor: pointer;
}

.zoom-display {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  padding: 4px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  min-width: 50px;
  text-align: center;
}

.canvas-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(45deg, #dce2e5 25%, transparent 25%),
    linear-gradient(-45deg, #dce2e5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dce2e5 75%),
    linear-gradient(-45deg, transparent 75%, #dce2e5 75%);
  background-color: #f4f6f7;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  cursor: default;
  touch-action: none;
  transition: outline 0.15s ease;
}

.canvas-stage.drag-active {
  outline: 3px dashed #4caf50 !important;
  outline-offset: -6px;
  background-color: rgba(76, 175, 80, 0.05);
}

.canvas-stage.solid-background {
  background-image: none !important;
}


.ruler {
  position: absolute;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dfe4ea;
  z-index: 10;
  pointer-events: none;
  font-size: 10px;
  color: #5b6572;
}

.ruler-horizontal {
  top: 0;
  left: 32px;
  right: 0;
  height: 32px;
  border-bottom: 1px solid #dfe4ea;
}

.ruler-vertical {
  left: 0;
  top: 32px;
  bottom: 0;
  width: 32px;
  border-right: 1px solid #dfe4ea;
}

.ruler-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.95);
  border-right: 1px solid #dfe4ea;
  border-bottom: 1px solid #dfe4ea;
  z-index: 11;
}

.ruler-tick {
  position: absolute;
  background: #8a929b;
}

.ruler-horizontal .ruler-tick {
  width: 1px;
  height: 6px;
  bottom: 0;
}

.ruler-horizontal .ruler-tick.major {
  height: 8px;
}

.ruler-vertical .ruler-tick {
  height: 1px;
  width: 6px;
  right: 0;
}

.ruler-vertical .ruler-tick.major {
  width: 8px;
}

.ruler-label {
  position: absolute;
  font-size: 10px;
  font-weight: 500;
  color: #5b6572;
  white-space: nowrap;
}

.ruler-horizontal .ruler-label {
  top: 50%;
  transform: translate(-50%, -50%);
}

.ruler-vertical .ruler-label {
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
}


.studio-panel {
  grid-row: 1 / -1;
  grid-column: 3;
  display: flex;
  flex-direction: column;
  background: #fefbff;
  border-left: 1px solid rgba(24, 27, 32, 0.1);
  overflow: hidden;
}

.panel-scroll-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.panel-section {
  margin-bottom: 20px;
}

.panel-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Sticky CTA section at bottom */
.panel-cta {
  flex-shrink: 0;
  padding: 16px;
  background: #fefbff;
  border-top: 2px solid var(--line);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.panel-cta .button {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.panel-cta .button.primary {
  background: var(--primary);
  color: white;
  margin-bottom: 12px;
}

.panel-cta .button.primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(103, 80, 164, 0.3);
}

.panel-cta .button.success {
  background: #4caf50;
  color: white;
}

.panel-cta .button.success:hover:not(:disabled) {
  background: #388e3c;
}

.panel-cta .button.secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.panel-cta .button.secondary:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.panel-cta .button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.panel-cta .button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.button.danger {
  background: #fff;
  color: #d32f2f;
  border-color: #d32f2f;
}

.button.danger:hover:not(:disabled) {
  background: #d32f2f;
  color: white;
}

.form-status {
  font-size: 0.85rem;
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  margin-top: 8px;
}

.form-status.error {
  background: #fdecea;
  color: #d32f2f;
}

.form-status.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.panel-heading {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.panel-section.collapsible .panel-heading:hover {
  background-color: rgba(103, 80, 164, 0.05);
}

.chevron-icon {
  font-size: 20px;
  transition: transform 0.2s;
}

.panel-section.collapsible.collapsed .chevron-icon {
  transform: rotate(-90deg);
}

.panel-section.collapsible .panel-content {
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.2s;
}

.panel-section.collapsible.collapsed .panel-content {
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}

/* Layer Properties Styles */
.layer-info-callout {
  background: #f3edf7;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--primary);
}

.layer-info-callout strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.inline-check {
  margin: 0;
  font-weight: 500;
  color: var(--ink);
}

.style-button-group {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.style-btn,
.align-btn {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.style-btn:hover,
.align-btn:hover {
  background: #f3edf7;
  border-color: var(--primary);
}

.style-btn.active,
.align-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.style-btn .material-symbols-outlined,
.align-btn .material-symbols-outlined {
  font-size: 20px;
}

/* Dual Control Pattern (slider + number input) */
.dual-control {
  display: grid;
  grid-template-columns: 1fr 60px;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.dual-control input[type="range"] {
  width: 100%;
}

.dual-control .number-input {
  width: 60px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
  max-height: 50vh; /* allows up to 50% of viewport height for layers */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  touch-action: none;
}

.layer-list:empty::after {
  content: "No layers yet";
  display: block;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 20px;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--panel);
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: grab;
  transition: all 0.15s ease;
  position: relative;
}

.layer-item:hover {
  border-color: rgba(103, 80, 164, 0.2);
  background: rgba(103, 80, 164, 0.05);
}

.layer-item.active {
  border-color: var(--primary);
  background: rgba(103, 80, 164, 0.1);
}

.layer-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.layer-drag-handle {
  width: 28px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.layer-drag-handle:hover,
.layer-drag-handle:focus-visible {
  color: var(--primary);
  background: rgba(103, 80, 164, 0.08);
}

.layer-item.dragging .layer-drag-handle {
  cursor: grabbing;
}

.layer-item.drag-over-top::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
}

.layer-item.drag-over-bottom::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
}

.layer-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 1.2rem;
  color: var(--muted);
}

.layer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.layer-info {
  flex: 1;
  min-width: 0;
}

.layer-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-type {
  font-size: 0.75rem;
  color: var(--muted);
}

.layer-actions {
  display: flex;
  gap: 8px;
}

.layer-actions .button {
  flex: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  width: auto;
  min-width: 400px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.modal-body {
  padding: 28px;
}

.shortcut-section {
  margin-bottom: 28px;
}

.shortcut-section:last-child {
  margin-bottom: 0;
}

.shortcut-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 14px 0;
}

.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 20px;
  margin: 0;
}

.shortcut-list dt {
  font-weight: 600;
  color: var(--ink);
  display: flex;
  gap: 4px;
  align-items: center;
}

.shortcut-list dd {
  margin: 0;
  color: var(--muted);
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-family: ui-monospace, monospace;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  color: var(--ink);
  font-weight: 600;
}

.compact {
  font-size: 0.82rem;
}

.compact-row {
  margin-top: 0;
}

.auth-page,
.drafts-page {
  min-height: 100vh;
  padding: 8vh 5vw;
}

.auth-page {
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
}

.auth-card h1 {
  font-size: 2.2rem;
  line-height: 1;
}

.auth-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.auth-card input {
  min-height: 44px;
  border: 1px solid #79747e;
  border-radius: 4px;
  padding: 8px 10px;
}

.draft-grid {
  display: grid;
  /* Let a card shrink below its desktop 400px minimum on narrow phones. */
  grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));
  gap: 24px;
}

.draft-card {
  min-width: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.draft-card h3 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}

.draft-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.draft-meta {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
}

.draft-ref {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

.draft-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 140px; /* Reduced from 280px to 50% */
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(45deg, #dce2e5 25%, transparent 25%),
    linear-gradient(-45deg, #dce2e5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dce2e5 75%),
    linear-gradient(-45deg, transparent 75%, #dce2e5 75%);
  background-color: #f4f6f7;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  border: 1px solid rgba(24, 27, 32, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}

.draft-thumb img {
  max-width: 100%;
  max-height: 140px; /* Reduced from 280px to 50% */
  object-fit: contain;
  padding: 8px; /* Reduced padding proportionally from 16px */
}

.draft-thumb.empty {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
}

/* PiP Preview for dual-sided drafts */
.pip-preview-container {
  position: relative;
}

.pip-preview-container .pip-main-image {
  width: 100%;
  height: 100%;
}

.pip-thumbnail-wrapper {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 100px;
  height: 65px;
  border: 3px solid white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  background: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.pip-thumbnail-wrapper:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  border-color: var(--primary);
}

.pip-thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  margin: 0;
}

.pip-thumbnail-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 3px 6px;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.02em;
}

.draft-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.draft-actions .button {
  flex: 1;
  text-align: center;
}

/* Collapse/expand toggle shared by the left icon-toolbar and right
   studio-panel. Base (desktop) styling is deliberately minimal -- these
   toggles only take on their prominent "handle bar" look on mobile,
   where the studio-panel becomes a bottom sheet (see media query below). */
.panel-mini-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 8px;
  flex-shrink: 0;
}

.icon-toolbar .panel-mini-header {
  justify-content: center;
}

.panel-mini-header .panel-collapse-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted, #5b6572);
}

.panel-mini-header .panel-collapse-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.panel-mini-header-label {
  display: none;
}

.panel-mini-chevron {
  font-size: 20px;
}

@media (max-width: 900px) {
  /* Header shrinks the available height, so recompute against the
     smaller mobile header (see includes/header.php's mobile media query). */
  .fullscreen-studio {
    height: calc(100vh - 57px);
    /* See the desktop .fullscreen-studio rule above for why -- same fix,
       same safe-to-add-unconditionally reasoning. */
    height: calc(100dvh - 57px);
  }

  /* Mobile grid columns stay locked at rail/canvas/0 at all times, not
     just while .toolbar-collapsed is set -- manually expanding the left
     icon-toolbar (tapping its mini-header, which removes .toolbar-collapsed)
     must not reflow this grid back to the desktop 220px/.../360px column
     widths, which squeezed the canvas-toolbar's Front/Back tabs into a
     sliver instead of just letting the expanded rail sit on top of them.
     The expanded rail is turned into a position:fixed overlay below
     instead, so the grid never needs to change for it. Both rules below
     need :not(.toolbar-collapsed)/.toolbar-collapsed two-class
     specificity (0,2,0) to beat the base (desktop) .fullscreen-studio
     rule's 220px/.../360px columns AND the pre-existing (also 0,2,0)
     .fullscreen-studio.toolbar-collapsed desktop-manual-collapse rule --
     a single-class .fullscreen-studio selector loses that fight
     regardless of media query or source order (same lesson as
     everywhere else in this file; learned the hard way rewriting this
     exact rule down to single-class once already). */
  .fullscreen-studio.toolbar-collapsed {
    grid-template-columns: 52px minmax(0, 1fr) 0;
  }

  .fullscreen-studio:not(.toolbar-collapsed) {
    grid-template-columns: 52px minmax(0, 1fr) 0;
  }

  /* Expanding the icon-toolbar no longer changes the grid (see above), so
     give it position:fixed here to float above the canvas-toolbar and
     canvas as a full-height drawer instead of squeezing into the
     now-locked 52px column. z-index 60 keeps it above the canvas-toolbar
     (row 1, static stacking) and the right panel's bottom sheet (z-index
     50), so it reads as "on top" per the reported layering request. */
  .fullscreen-studio:not(.toolbar-collapsed) .icon-toolbar {
    position: fixed;
    top: 57px;
    left: 0;
    /* Stop above the right panel's bottom-sheet handle (see below) instead
       of running underneath it -- the handle's label/chevron are centered
       in its full-width bar, which would otherwise fall inside this
       drawer's 220px width and become covered by it. */
    bottom: 48px;
    z-index: 60;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  }

  /* The bottom-sheet handle bar below is position:fixed and spans the
     full screen width (left:0; right:0), so it silently covers whatever
     falls under it -- including the bottom of this same-side icon rail,
     since both start at x:0. Without this, buttons near the bottom of a
     scrolled toolbar (e.g. Project Settings) are visible but physically
     un-tappable, covered by the sheet handle sitting on top of them.
     Needs .fullscreen-studio.toolbar-collapsed .icon-toolbar's own
     specificity (which sets the shorthand `padding: 8px 0`, resetting
     padding-bottom) to actually win -- same lesson as everywhere else
     in this file: a plain .icon-toolbar selector loses that fight
     regardless of media query or source order. */
  .fullscreen-studio.toolbar-collapsed .icon-toolbar {
    padding-bottom: 48px;
  }

  .studio-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-height: 75vh;
    z-index: 50;
    border-left: none;
    border-top: 2px solid var(--line);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(calc(100% - 48px));
    transition: transform 0.25s ease;
  }

  .studio-panel.sheet-open {
    transform: translateY(0);
  }

  .studio-panel .panel-mini-header {
    justify-content: center;
    height: 48px;
    padding: 0;
    background: #fefbff;
    border-bottom: 1px solid rgba(24, 27, 32, 0.08);
  }

  .studio-panel .panel-collapse-toggle {
    width: 100%;
    height: 100%;
    justify-content: center;
    border-radius: 0;
  }

  .studio-panel .panel-mini-header-label {
    display: inline;
  }

  .studio-panel.sheet-open .panel-mini-chevron {
    transform: rotate(90deg);
  }

  .studio-panel .panel-scroll-content {
    max-height: calc(75vh - 48px);
  }

  /* The front/back picture-in-picture preview is a nice-to-have on a
     spacious desktop canvas; on mobile it just eats into already-tight
     canvas space, so hide it. studio.js only shows it via
     style.display = 'block'/'none' (see updatePipVisibility()), not a
     class, so !important is needed to win over that inline style. */
  .pip-preview {
    display: none !important;
  }
}

@media (max-width: 920px) {
  .steps,
  .product-grid,
  .portfolio-grid,
  .studio-info-layout,
  .studio-feature-grid,
  .studio-layout,
  .checkout {
    grid-template-columns: 1fr;
  }

  .checkout {
    margin: 64px 5vw;
  }
}

@media (max-width: 680px) {
  .site-header {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.86rem;
  }

  .hero {
    min-height: 720px;
    padding-top: 72px;
  }

  section:not(.hero) {
    padding: 64px 5vw;
  }

  .control-row {
    grid-template-columns: 1fr;
  }

  .canvas-toolbar {
    flex-direction: column;
  }
}

/* Upload and Text Modals */
.upload-dropzone {
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  background: #f8f5ff;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-dropzone:hover {
  border-color: #4a3a7a;
  background: #f3edf7;
}

.upload-dropzone.drag-over {
  border-color: #4a3a7a;
  background: #e8def8;
}

.upload-icon {
  font-size: 64px !important;
  color: var(--primary);
  margin-bottom: 16px;
  display: block;
}

.upload-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.upload-subtitle {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

.upload-hint {
  font-size: 12px;
  color: #999;
}

.upload-formats {
  font-size: 11px;
  color: #999;
  margin-top: 8px;
}

.upload-file-input {
  display: none;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}

.char-count {
  font-size: 12px;
  color: #999;
  text-align: right;
  margin-top: 4px;
}

.char-count.warning {
  color: #f44336;
}

.shade-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.shade-box {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  flex-shrink: 0;
}

.shade-controls {
  flex: 1;
}

.shade-slider {
  margin: 8px 0;
}

.shade-slider input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, #000000, #808080, #ffffff);
  border-radius: 3px;
  outline: none;
}

.shade-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  margin-top: -7px;
}

.shade-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  border: none;
}

.shade-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #999;
}

.shade-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
  margin-bottom: 4px;
}

.modal-content h3 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-content h3 .material-symbols-outlined {
  color: var(--primary);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Zoom widget - fixed bottom right of canvas */
.zoom-widget {
  position: absolute;
  bottom: 32px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.zoom-widget .zoom-display {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  min-width: 45px;
  text-align: center;
}

.zoom-widget .icon-btn {
  width: 28px;
  height: 28px;
}

.zoom-widget .material-symbols-outlined {
  font-size: 18px;
}

/* PiP preview of opposite side */
.pip-preview {
  position: absolute;
  bottom: 32px;
  left: 54px;
  width: 140px;
  height: 90px;
  background: white;
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s;
  z-index: 5;
}

.pip-preview:hover {
  transform: scale(1.05);
  border-color: var(--primary);
}

.pip-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pip-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
}

/* Flip vertical icon rotation */
.tool-button[data-action="flip-vertical"] .material-symbols-outlined {
  transform: rotate(90deg);
}

/* Modal tabs */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: #f8f9fa;
}

.modal-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.modal-tab:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.02);
}

.modal-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Keyboard shortcut grid */
.shortcut-grid {
  display: grid;
  gap: 12px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.shortcut-item kbd {
  display: inline-block;
  padding: 4px 8px;
  background: #e8e8e8;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: monospace;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.shortcut-item span {
  color: var(--muted);
}

.shortcut-section h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.shortcut-section p {
  margin: 8px 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.shortcut-section p strong {
  font-weight: 600;
  color: var(--ink);
}

/* Inline checkbox control */
.checkbox-control.inline-check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
  font-size: 0.88rem;
}

.checkbox-control.inline-check input {
  margin: 0;
  flex-shrink: 0;
}

/* Text color preview */
#textColorPreview {
  flex-shrink: 0;
}

/* Character count styling */
#charWarning {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
