/* Tool theme — loaded after /style.css. Does not modify the shared site stylesheet.
   Site chrome (.main-header, footer) uses /style.css variables (--text-primary, etc.). */
:root {
  --sign-bg: #ebebeb;
  --sign-elevated: #ffffff;
  --sign-panel: #ffffff;
  --sign-line: rgba(0, 0, 0, 0.08);
  --sign-text: #333333;
  --sign-muted: #666666;
  --sign-accent: #720eec;
  --sign-accent-text: #ffffff;
  --sign-danger: #a00;
  --bg: var(--sign-bg);
  --bg-elevated: var(--sign-elevated);
  --panel: var(--sign-panel);
  --line: var(--sign-line);
  --text: var(--sign-text);
  --muted: var(--sign-muted);
  --accent: #c4a574;
  --accent-text: #1a1c1e;
  --danger: var(--sign-danger);
  --plate: linear-gradient(145deg, #e8f4f8 0%, #c5e0ea 35%, #d8eef4 65%, #a8c8d4 100%);
  --engrave: #1a3d4a;
  --stage-wash: radial-gradient(ellipse at 40% 30%, rgba(120, 180, 200, 0.14), transparent 55%);
  --radius: 12px;
  --font-ui: var(--font-main, system-ui, -apple-system, sans-serif);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.layout[data-material="acrylic"] {
  --plate: linear-gradient(145deg, #e8f4f8 0%, #c5e0ea 35%, #d8eef4 65%, #a8c8d4 100%);
  --engrave: #1a3d4a;
  --stage-wash: radial-gradient(ellipse at 40% 30%, rgba(120, 180, 200, 0.16), transparent 55%);
  --accent: #2ea2cc;
  --accent-text: #ffffff;
}

.layout[data-material="linden"] {
  --plate: linear-gradient(145deg, #e2c49a 0%, #c9965a 30%, #b8813f 60%, #8f5e2c 100%);
  --engrave: #2a1810;
  --stage-wash: radial-gradient(ellipse at 45% 35%, rgba(180, 120, 60, 0.18), transparent 55%);
  --accent: #958e09;
  --accent-text: #ffffff;
}

.layout[data-material="trophy"][data-finish="silver-black"],
.layout[data-material="trophy"]:not([data-finish]) {
  --plate: linear-gradient(145deg, #e8e8ea 0%, #c8c8cc 40%, #dcdce0 70%, #b8b8bc 100%);
  --engrave: #121212;
  --stage-wash: radial-gradient(ellipse at 40% 30%, rgba(180, 180, 190, 0.12), transparent 55%);
  --accent: #720eec;
  --accent-text: #ffffff;
}

.layout[data-material="trophy"][data-finish="gold-black"] {
  --plate: linear-gradient(145deg, #f3e0a8 0%, #d4b15a 35%, #e6c878 70%, #b8923a 100%);
  --engrave: #121212;
  --stage-wash: radial-gradient(ellipse at 40% 30%, rgba(212, 177, 90, 0.16), transparent 55%);
  --accent: #d4b15a;
  --accent-text: #1a1c1e;
}

.layout[data-material="trophy"][data-finish="white-black"] {
  --plate: linear-gradient(145deg, #ffffff 0%, #f2f2f2 45%, #e0e0e0 100%);
  --engrave: #121212;
  --stage-wash: radial-gradient(ellipse at 40% 30%, rgba(255, 255, 255, 0.08), transparent 55%);
  --accent: #515151;
  --accent-text: #ffffff;
}

.layout[data-material="trophy"][data-finish="black-white"] {
  --plate: linear-gradient(145deg, #3a3a3a 0%, #1a1a1a 40%, #0c0c0c 100%);
  --engrave: #f5f5f5;
  --stage-wash: radial-gradient(ellipse at 40% 30%, rgba(60, 60, 60, 0.25), transparent 55%);
  --accent: #333333;
  --accent-text: #ffffff;
}

.layout[data-material="sticker"] {
  --plate: linear-gradient(145deg, #ffffff 0%, #f7f7f7 45%, #ececec 100%);
  --engrave: #1a1a1a;
  --stage-wash: radial-gradient(ellipse at 42% 28%, rgba(255, 90, 70, 0.1), transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(60, 140, 220, 0.08), transparent 55%);
  --accent: #e85d3b;
  --accent-text: #ffffff;
}

@font-face {
  font-family: "Sign Classic";
  src: url("./classic-sans.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sign Classic Bold";
  src: url("./classic-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sign Condensed";
  src: url("./condensed.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sign Display";
  src: url("./russo-one.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html, body.sign-generator {
  margin: 0;
  height: 100%;
  background: var(--sign-bg);
  color: var(--sign-text);
  font-family: var(--font-ui);
}

body.sign-generator {
  display: flex;
  flex-direction: column;
  /* svh ignores the mobile keyboard — keeps stage from rescaling while typing */
  height: 100svh;
  max-height: 100svh;
  overflow: hidden;
}

/* Neutralize shared style.css globals that clash inside the editor */
body.sign-generator .sign-app p,
body.sign-generator .image-overlay p {
  color: inherit;
  font-size: inherit;
}

body.sign-generator .toast {
  color: #fff;
  font-size: 0.85rem;
}

body.sign-generator .sign-app h2,
body.sign-generator .image-overlay h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0;
  color: var(--sign-text);
}

body.sign-generator .main-header {
  position: relative;
  top: auto;
  margin-bottom: 0;
  padding: 0.45rem 0;
  border-bottom: none;
  box-shadow: none;
}

body.sign-generator .header-left .logo img {
  height: 36px;
}

body.sign-generator .header-center {
  max-width: min(52vw, 560px);
}

body.sign-generator .header-center h1 {
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  font-weight: 800;
  margin: 0;
  letter-spacing: 0;
}

body.sign-generator .header-center p {
  font-size: clamp(0.58rem, 1vw, 0.68rem);
  line-height: 1.3;
  margin: 0.1rem 0 0;
  color: #cccccc;
}

@media (max-width: 768px) {
  /* Keep header as one slim row — don't stack title under logo. */
  body.sign-generator .header-container {
    flex-wrap: nowrap;
    padding: 0 0.65rem;
    gap: 0.35rem;
    min-height: 0;
  }

  body.sign-generator .main-header {
    padding: 0.2rem 0;
  }

  body.sign-generator .header-left {
    gap: 0.35rem;
    flex-shrink: 0;
  }

  body.sign-generator .header-left .logo img {
    height: 26px;
  }

  body.sign-generator .header-center {
    position: static;
    transform: none;
    flex: 1 1 auto;
    order: 0;
    margin: 0;
    max-width: none;
    align-items: flex-start;
    text-align: left;
    min-width: 0;
  }

  body.sign-generator .header-center h1 {
    font-size: 0.82rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  body.sign-generator .header-center p {
    display: none;
  }

  body.sign-generator .header-right {
    gap: 0.25rem;
    flex-shrink: 0;
  }

  body.sign-generator .header-right .nav-btn {
    display: none;
  }

  body.sign-generator .lang-switcher {
    font-size: 0.7rem;
  }

  body.sign-generator .tool-bar {
    min-height: 1.85rem;
    padding: 0.12rem 0.55rem;
    gap: 0.3rem;
  }

  body.sign-generator .back {
    font-size: 0.72rem;
    padding: 0.12rem 0.3rem;
    gap: 0.25rem;
  }

  body.sign-generator .back span {
    display: none;
  }

  body.sign-generator .project-actions {
    padding: 0.08rem;
    gap: 0.2rem;
  }

  body.sign-generator .project-actions .btn {
    padding: 0.28rem 0.7rem;
    font-size: 0.78rem;
    gap: 0.3rem;
    min-height: 1.7rem;
  }

  body.sign-generator .project-actions .btn span {
    display: inline;
  }

  body.sign-generator .project-actions .btn i {
    font-size: 0.72rem;
  }
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* Sticky brand + slim tool bar as one chrome block (no gap) */
.sign-top-chrome {
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  background: #333333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.sign-app {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.tool-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.25rem;
  padding: 0.2rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: #3a3a3a;
  position: relative;
  top: auto;
  z-index: 1;
  box-shadow: none;
}

.tool-bar-spacer {
  flex: 1;
  min-width: 0;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 0.8rem;
  white-space: nowrap;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.back i {
  font-size: 0.72rem;
}

.back:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.project-actions,
.top-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.project-actions {
  padding: 0.12rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.project-actions-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  padding: 0 0.25rem 0 0.45rem;
  user-select: none;
}

.project-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1.2;
}

.project-actions .btn i {
  font-size: 0.75rem;
}

.project-actions .btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #f2f2f2;
  border-color: transparent;
}

.project-actions .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.project-actions .btn.primary {
  padding: 0.22rem 0.75rem;
}

@media (max-width: 520px) {
  .project-actions-label {
    display: none;
  }
}

body.sign-generator .btn {
  border: 1px solid var(--sign-line);
  background: #f5f5f5;
  color: var(--sign-text);
  border-radius: 50px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  font-weight: 600;
}

body.sign-generator .btn:active {
  transform: scale(0.98);
}

body.sign-generator .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

body.sign-generator .btn.primary {
  background: var(--accent, var(--sign-accent));
  color: var(--accent-text, var(--sign-accent-text));
  border-color: transparent;
}

body.sign-generator .btn.ghost {
  background: transparent;
}

body.sign-generator .btn.danger {
  color: var(--sign-danger);
  border-color: rgba(170, 0, 0, 0.3);
}

body.sign-generator .btn.full {
  width: 100%;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  /* Stage stays stable; panel keeps room and scrolls its own content. */
  grid-template-rows: minmax(0, 42vh) minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 1fr min(380px, 36vw);
    grid-template-rows: minmax(0, 1fr);
  }
}

.stage-wrap {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background:
    var(--stage-wash, radial-gradient(ellipse at 30% 20%, rgba(114, 14, 236, 0.06), transparent 50%)),
    #e4e4e4;
}

.stage-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 0;
}

.view-mode-switch {
  display: flex;
  width: 100%;
  flex-shrink: 0;
  padding: 4px;
  border-radius: 12px;
  background: rgba(114, 14, 236, 0.08);
  border: 1px solid rgba(114, 14, 236, 0.22);
  gap: 4px;
  box-sizing: border-box;
}

.panel-view-switch {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 0 0.15rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  background: #fff;
}

.view-mode-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  flex: 1;
  padding: 0.75rem 0.9rem;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  transition: background 0.15s ease, color 0.15s ease;
}

.view-mode-btn[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.view-mode-btn:hover:not([aria-selected="true"]) {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.view-mode-switch.is-revealing {
  outline: 2px solid rgba(114, 14, 236, 0.35);
  outline-offset: 3px;
  animation: viewSwitchGlow 1.4s ease-in-out infinite;
}

.view-mode-switch.is-revealing .view-mode-btn {
  transition: background 0.45s ease, color 0.45s ease, transform 0.45s ease;
}

.view-mode-switch.is-revealing .view-mode-btn[aria-selected="true"] {
  animation: viewModePulse 1.4s ease-in-out infinite;
}

.stage-wrap.is-revealing .plate {
  transition: opacity 0.55s ease;
  animation: stageRevealPulse 1.4s ease-in-out infinite;
}

@keyframes viewSwitchGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(114, 14, 236, 0.08);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(114, 14, 236, 0.14);
  }
}

@keyframes viewModePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.035);
  }
}

@keyframes stageRevealPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.88;
  }
}

@media (prefers-reduced-motion: reduce) {
  .view-mode-switch.is-revealing,
  .view-mode-switch.is-revealing .view-mode-btn[aria-selected="true"],
  .stage-wrap.is-revealing .plate {
    animation: none;
  }
}

.stage-meta-info {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  min-width: 0;
  overflow: hidden;
}

.stage-meta-info #sizeLabel,
.stage-meta-info .material-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.material-label {
  color: var(--accent);
}

.stage-scroll {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 1rem 0.5rem 1.5rem;
}

.plate-frame {
  --ruler: 22px;
  --px-per-mm: 6;
  display: grid;
  grid-template-columns: var(--ruler) auto;
  grid-template-rows: var(--ruler) auto;
  align-items: stretch;
  justify-items: stretch;
  overflow: visible;
}

.plate-frame.is-vorschau .ruler {
  opacity: 0;
  pointer-events: none;
}

.ruler {
  position: relative;
  overflow: hidden;
  background: #f3f3f3;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  color: rgba(0, 0, 0, 0.55);
}

.ruler-corner {
  grid-column: 1;
  grid-row: 1;
  border-radius: 2px 0 0 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(to bottom right, transparent calc(50% - 0.5px), rgba(0, 0, 0, 0.18) 50%, transparent calc(50% + 0.5px)),
    #ececec;
}

.ruler-corner-unit {
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1;
  color: rgba(0, 0, 0, 0.5);
  background: #ececec;
  padding: 0 1px;
}

.ruler-h {
  grid-column: 2;
  grid-row: 1;
  border-left: none;
}

.ruler-v {
  grid-column: 1;
  grid-row: 2;
  border-top: none;
}

.ruler-tick {
  position: absolute;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.ruler-h .ruler-tick {
  bottom: 0;
  width: 1px;
  transform: translateX(-0.5px);
}

.ruler-h .ruler-tick.is-mm {
  height: 4px;
  background: rgba(0, 0, 0, 0.22);
}

.ruler-h .ruler-tick.is-5 {
  height: 8px;
  background: rgba(0, 0, 0, 0.38);
}

.ruler-h .ruler-tick.is-cm {
  height: 12px;
  background: rgba(0, 0, 0, 0.55);
}

.ruler-v .ruler-tick {
  right: 0;
  height: 1px;
  transform: translateY(-0.5px);
}

.ruler-v .ruler-tick.is-mm {
  width: 4px;
  background: rgba(0, 0, 0, 0.22);
}

.ruler-v .ruler-tick.is-5 {
  width: 8px;
  background: rgba(0, 0, 0, 0.38);
}

.ruler-v .ruler-tick.is-cm {
  width: 12px;
  background: rgba(0, 0, 0, 0.55);
}

.ruler-label {
  position: absolute;
  font-size: 8px;
  font-weight: 600;
  line-height: 1;
  color: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  pointer-events: none;
}

.ruler-h .ruler-label {
  left: 2px;
  top: 1px;
}

.ruler-v .ruler-label {
  right: 13px;
  top: 2px;
  transform-origin: right top;
  transform: rotate(-90deg);
}

.plate {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  background: var(--plate);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 -2px 6px rgba(0, 0, 0, 0.18) inset,
    0 18px 40px rgba(0, 0, 0, 0.45);
  border-radius: 2px;
  touch-action: none;
  flex-shrink: 0;
  overflow: hidden;
}

.layout[data-material="acrylic"] .plate.is-edit {
  box-shadow:
    0 0 0 1px rgba(120, 170, 190, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 14px 32px rgba(40, 90, 110, 0.35);
}

.layout[data-material="linden"] .plate.is-edit {
  box-shadow:
    0 0 0 1px rgba(120, 80, 40, 0.35),
    0 1px 0 rgba(255, 230, 190, 0.35) inset,
    0 14px 32px rgba(60, 35, 15, 0.4);
}

.layout[data-material="sticker"] .plate.is-edit {
  box-shadow:
    0 0 0 1px rgba(200, 200, 200, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 14px 32px rgba(40, 40, 40, 0.22);
}

.layout[data-material="trophy"][data-finish="silver-black"] .plate.is-edit,
.layout[data-material="trophy"]:not([data-finish]) .plate.is-edit {
  background: var(--plate);
  box-shadow:
    0 0 0 1px rgba(120, 120, 130, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 -2px 6px rgba(0, 0, 0, 0.12) inset,
    0 14px 32px rgba(40, 40, 50, 0.38);
}

.layout[data-material="trophy"][data-finish="gold-black"] .plate.is-edit {
  background: var(--plate);
  box-shadow:
    0 0 0 1px rgba(180, 140, 50, 0.55),
    0 1px 0 rgba(255, 240, 180, 0.65) inset,
    0 -2px 6px rgba(90, 60, 10, 0.18) inset,
    0 14px 32px rgba(90, 60, 20, 0.38);
}

.layout[data-material="trophy"][data-finish="white-black"] .plate.is-edit {
  background: var(--plate);
  box-shadow:
    0 0 0 1px rgba(160, 160, 160, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 -2px 6px rgba(0, 0, 0, 0.08) inset,
    0 14px 32px rgba(40, 40, 40, 0.28);
}

.layout[data-material="trophy"][data-finish="black-white"] .plate.is-edit {
  background: var(--plate);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 -2px 8px rgba(0, 0, 0, 0.55) inset,
    0 14px 32px rgba(0, 0, 0, 0.55);
}

.layout[data-material="trophy"] .plate.is-vorschau:not(.is-shaped) {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.18),
    0 22px 48px rgba(0, 0, 0, 0.5);
}

.layout[data-material="trophy"][data-finish="black-white"] .plate.is-vorschau:not(.is-shaped) {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.15),
    0 22px 48px rgba(0, 0, 0, 0.65);
}

.plate.is-edit {
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 12px 28px rgba(0, 0, 0, 0.35);
  /* Allow plate scale handles to sit outside the edge */
  overflow: visible;
}

.plate.is-edit .plate-svg {
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.plate.is-vorschau {
  background: transparent;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.55);
  border-radius: 0;
}

.plate.is-shaped {
  box-shadow: none;
  border-radius: 0;
}

/* Shaped outer cut: silhouette follows the replace-plate path (not the plate rect). */
.plate.is-vorschau.is-shaped {
  overflow: visible;
  box-shadow: none;
  background: transparent;
}

.plate.is-vorschau.is-shaped .plate-svg {
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.42));
}

.stage-wrap.is-vorschau .hint {
  color: var(--accent);
}

.plate-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  flex-shrink: 0;
}

@media (max-width: 899px) {
  .stage-wrap .hint {
    display: none;
  }
}

.panel {
  background: var(--sign-panel);
  border-top: 1px solid var(--sign-line);
  padding: 0.85rem 1rem calc(1.25rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.04);
}

/* Prevent accordion sections from being squashed — panel scrolls instead. */
.panel > * {
  flex-shrink: 0;
}

@media (min-width: 900px) {
  .panel {
    border-top: none;
    border-left: 1px solid var(--sign-line);
  }
}

.panel-section {
  border: 1px solid var(--sign-line);
  border-radius: 16px;
  background: #fafafa;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.panel-section-material {
  border-color: rgba(114, 14, 236, 0.28);
  background: linear-gradient(180deg, rgba(114, 14, 236, 0.06), #fafafa 55%);
  box-shadow: 0 0 0 1px rgba(114, 14, 236, 0.08);
}

.layout[data-material="acrylic"] .panel-section-material {
  border-color: rgba(46, 162, 204, 0.4);
  background: linear-gradient(180deg, rgba(46, 162, 204, 0.08), #fafafa 55%);
}

.layout[data-material="linden"] .panel-section-material {
  border-color: rgba(149, 142, 9, 0.4);
  background: linear-gradient(180deg, rgba(149, 142, 9, 0.08), #fafafa 55%);
}

.layout[data-material="sticker"] .panel-section-material {
  border-color: rgba(232, 93, 59, 0.4);
  background: linear-gradient(180deg, rgba(232, 93, 59, 0.08), #fafafa 55%);
}

.layout[data-material="trophy"] .panel-section-material {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, #ffffff), #fafafa 55%);
}

.material-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.material-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--sign-line);
  background: #ffffff;
  color: var(--sign-text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.material-card:hover {
  border-color: rgba(0, 0, 0, 0.18);
  background: #f7f7f7;
}

.material-card.is-selected,
.material-card[aria-selected="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, #ffffff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.material-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.material-card-text strong {
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.material-card-text small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.material-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: hidden;
}

.material-thumb-acrylic {
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.75) 0%, transparent 42%),
    linear-gradient(145deg, #e8f4f8 0%, #b8d8e4 45%, #8eb8c8 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    inset 0 -10px 18px rgba(60, 120, 150, 0.28),
    0 4px 10px rgba(0, 0, 0, 0.25);
}

.material-thumb-acrylic::after {
  content: "";
  position: absolute;
  inset: 18% 58% 18% 12%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.05));
  border-radius: 2px;
  transform: skewX(-12deg);
}

.material-thumb-linden {
  background:
    repeating-linear-gradient(
      92deg,
      rgba(90, 50, 20, 0.12) 0 1px,
      transparent 1px 5px
    ),
    linear-gradient(145deg, #e2c49a 0%, #c9965a 40%, #8f5e2c 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 220, 170, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.28);
}

.material-thumb-trophy {
  background: linear-gradient(145deg, #f0f0f2 0%, #c8c8cc 40%, #b0b0b4 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    inset 0 -8px 14px rgba(0, 0, 0, 0.18),
    0 4px 10px rgba(0, 0, 0, 0.28);
}

.material-thumb-trophy::before {
  content: "Aa";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #111;
  letter-spacing: 0.04em;
}

.material-thumb-sticker {
  background:
    linear-gradient(135deg, #ff6b4a 0%, #ffb347 35%, #6bcB77 65%, #4a90e2 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.22);
}

.material-thumb-sticker::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 4px;
  border: 1.5px dashed rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.material-options {
  margin-top: 0.15rem;
}

.material-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.material-option-btn {
  border: 1px solid var(--sign-line);
  background: #ffffff;
  color: var(--sign-text);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.material-option-btn.is-selected,
.material-option-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, #ffffff);
}

.material-finish-btn .finish-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.material-finish-btn.finish-silver-black .finish-swatch {
  background: linear-gradient(135deg, #eee, #aaa);
}

.material-finish-btn.finish-gold-black .finish-swatch {
  background: linear-gradient(135deg, #f3e0a8, #b8923a);
}

.material-finish-btn.finish-white-black .finish-swatch {
  background: #f5f5f5;
}

.material-finish-btn.finish-black-white .finish-swatch {
  background: #1a1a1a;
}

.panel-section.is-active {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--sign-line));
  background: color-mix(in srgb, var(--accent) 7%, #ffffff);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
    0 4px 14px rgba(0, 0, 0, 0.05);
}

.panel-section.is-active > .panel-summary {
  color: var(--sign-text);
  background: color-mix(in srgb, var(--accent) 10%, #ffffff);
  border-bottom-color: color-mix(in srgb, var(--accent) 22%, var(--sign-line));
}

.panel-section.is-active > .panel-summary .panel-summary-icon {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent);
}

.panel-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  margin: 0;
  padding: 0.7rem 0.75rem;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--sign-text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #f3f3f3;
  border-bottom: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.panel-summary:hover {
  background: #ececec;
}

.panel-section[open] > .panel-summary {
  background: #f0f0f0;
  border-bottom-color: var(--sign-line);
}

.panel-summary-icon {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, #ffffff);
  color: color-mix(in srgb, var(--accent) 75%, #333333);
  font-size: 0.78rem;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.panel-summary-label {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

.panel-summary::-webkit-details-marker {
  display: none;
}

.panel-summary::after {
  content: "";
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.15rem;
  border-right: 2px solid color-mix(in srgb, var(--accent) 55%, #666);
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 55%, #666);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
}

.panel-section[open] > .panel-summary::after {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}

.panel-delete-btn {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  padding: 0;
  position: relative;
  z-index: 1;
}

.panel-delete-btn[hidden] {
  display: none !important;
}

.panel-body {
  padding: 0 0.85rem 0.85rem;
}

.panel-section h2 {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}

label.stack {
  margin: 0.65rem 0;
}

input, select, textarea {
  background: #ffffff;
  border: 1px solid var(--sign-line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  color: var(--sign-text);
  width: 100%;
  font-size: 1rem; /* ≥16px — prevents iOS zoom on focus */
}

textarea {
  resize: vertical;
  min-height: 4.5rem;
}

@media (max-width: 768px) {
  .panel input,
  .panel select,
  .panel textarea {
    font-size: 16px;
  }
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
}

.chip {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  border: 1px solid var(--sign-line);
  background: #ffffff;
  color: var(--sign-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}

.control-label {
  margin: 0.35rem 0 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  padding: 0.45rem;
  border-radius: 8px;
}

.icon-btn i {
  font-size: 0.95rem;
}

.panel-footnote {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.text-block {
  position: absolute;
  /* Hitbox only — visible text comes from the shared plate SVG */
  color: transparent;
  caret-color: transparent;
  white-space: pre;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  outline: 1px solid transparent;
  min-width: 8px;
  min-height: 8px;
  box-sizing: border-box;
  z-index: 1;
}

.plate-block {
  position: absolute;
  inset: 0;
  z-index: 0;
  box-sizing: border-box;
  cursor: default;
  outline: 1px solid transparent;
  pointer-events: auto;
}

.plate-block.selected {
  outline: 1px dashed rgba(18, 18, 18, 0.45);
  outline-offset: 2px;
}

.text-block.selected {
  outline: 1px dashed rgba(18, 18, 18, 0.45);
  outline-offset: 2px;
  /* Let edge-centered handles paint outside the hitbox */
  overflow: visible;
}

.text-block.dragging {
  cursor: grabbing;
}

.handle {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border-radius: 3px;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  display: none;
  touch-action: none;
  box-sizing: border-box;
  z-index: 3;
  /* Avoid transform — keeps hit-testing stable while parent size changes */
  transform: none;
}

/* Center handles on the frame edge (half of 14px) */
.handle-se {
  right: -7px;
  bottom: -7px;
  cursor: nwse-resize;
}

.handle-e {
  right: -7px;
  top: calc(50% - 7px);
  cursor: ew-resize;
}

.handle-s {
  left: calc(50% - 7px);
  bottom: -7px;
  cursor: ns-resize;
}

.text-block.selected .handle,
.handle.plate-handle {
  display: block;
}

.handle.plate-handle {
  z-index: 6;
}

.obj-delete-btn {
  display: none;
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  border: 1.5px solid #fff;
  background: #c62828;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 7;
  touch-action: manipulation;
  box-sizing: border-box;
  line-height: 1;
}

.obj-delete-btn i {
  font-size: 0.55rem;
  pointer-events: none;
}

.obj-delete-btn:hover {
  background: #a01f1f;
}

.text-block.selected .obj-delete-btn {
  display: inline-flex;
}

.text-block.is-image.selected {
  outline-color: rgba(18, 18, 18, 0.45);
}

.text-block.is-cut.selected {
  outline: 1px dashed rgba(255, 60, 60, 0.75);
}

.image-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.image-overlay[hidden] {
  display: none !important;
}

.image-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 10, 0.72);
}

.image-overlay-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(90dvh, 720px);
  overflow: auto;
  background: #ffffff;
  border: 1px solid var(--sign-line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  padding: 1rem;
  color: var(--sign-text);
}

.image-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.image-overlay-header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 220px;
  padding: 1.5rem;
  border: 1.5px dashed rgba(114, 14, 236, 0.35);
  border-radius: 12px;
  background: #f7f5fb;
  text-align: center;
  cursor: pointer;
  color: var(--sign-muted);
}

.dropzone i {
  font-size: 1.75rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.dropzone strong {
  color: var(--sign-text);
  font-size: 1rem;
}

.dropzone span {
  font-size: 0.82rem;
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, #ffffff);
}

.image-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  background:
    linear-gradient(45deg, #2a2d30 25%, transparent 25%),
    linear-gradient(-45deg, #2a2d30 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2d30 75%),
    linear-gradient(-45deg, transparent 75%, #2a2d30 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #1a1c1e;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 0.85rem;
}

#imagePreviewCanvas {
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  image-rendering: auto;
}

.cut-preview-wrap {
  background: #111;
}

.cut-preview-svg {
  width: 100%;
  max-height: 320px;
  display: block;
}

.cut-stats {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cut-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.65rem;
}

#cutOverlay .cut-meta-row .cut-stats {
  font-size: 0.72rem;
  flex: 1 1 12rem;
  text-align: right;
}

.cut-tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0;
}

@media (max-width: 520px) {
  .cut-tool-grid {
    grid-template-columns: 1fr;
  }
}

.cut-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin: 0.15rem 0 0;
}

.cut-fit-row {
  margin-top: 0.25rem;
}

/* Compact cut import dialog: actions stay visible without scrolling. */
#cutOverlay .image-overlay-panel {
  width: min(520px, 100%);
  max-height: min(88dvh, 680px);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#cutOverlay .image-overlay-header {
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}

#cutOverlay .cut-dropzone {
  min-height: 160px;
  padding: 1.1rem;
}

#cutOverlay .cut-edit-view {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
  flex: 1;
}

#cutOverlay .cut-edit-view[hidden],
#cutOverlay .image-drop-view[hidden] {
  display: none !important;
}

#cutOverlay .cut-edit-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.1rem;
}

#cutOverlay .cut-preview-wrap {
  min-height: 0;
  margin-bottom: 0;
  flex-shrink: 0;
}

#cutOverlay .cut-preview-svg {
  max-height: min(28vh, 200px);
}

#cutOverlay .outer-edge-option-compact {
  margin: 0;
  padding: 0.45rem 0.55rem;
  gap: 0.35rem 0.45rem;
  align-self: stretch;
}

#cutOverlay .outer-edge-option-compact .outer-edge-option-visual {
  display: none;
}

#cutOverlay .outer-edge-option-compact .outer-edge-option-copy strong {
  font-size: 0.78rem;
}

#cutOverlay .outer-edge-option-compact .outer-edge-option-copy small {
  font-size: 0.65rem;
}

#cutOverlay .cut-raster-tools {
  margin: 0;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
}

#cutOverlay .cut-advanced {
  margin: 0.15rem 0 0;
  border: 1px solid var(--sign-line);
  border-radius: 10px;
  background: #fafafa;
  flex-shrink: 0;
}

#cutOverlay .cut-advanced-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sign-text);
  user-select: none;
}

#cutOverlay .cut-advanced-summary::-webkit-details-marker {
  display: none;
}

#cutOverlay .cut-advanced-summary::before {
  content: '';
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.45rem;
  border-right: 1.5px solid var(--sign-muted);
  border-bottom: 1.5px solid var(--sign-muted);
  transform: rotate(-45deg);
  vertical-align: 0.1rem;
  transition: transform 0.15s ease;
}

#cutOverlay .cut-advanced[open] .cut-advanced-summary::before {
  transform: rotate(45deg);
  vertical-align: 0.2rem;
}

#cutOverlay .cut-advanced-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0 0.7rem 0.7rem;
}

#cutOverlay .cut-advanced-body .stack {
  margin: 0;
}

#cutOverlay .cut-advanced-body .cut-check-row {
  margin: 0;
}

#cutOverlay .cut-edit-actions {
  flex-shrink: 0;
  margin: 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--sign-line);
  background: #ffffff;
}

.check-row {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

.check-row input {
  width: auto;
  margin: 0;
}

/* Prominent “use as outer plate edge” control (shapes + cut panels + import). */
.outer-edge-option {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem 0.75rem;
  margin: 0.15rem 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--sign-line));
  border-radius: 12px;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent) 10%, #ffffff) 0%,
      #ffffff 55%
    );
  color: var(--sign-text);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.outer-edge-option:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--sign-line));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 12%, transparent);
}

.outer-edge-option:focus-within {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

.outer-edge-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.outer-edge-option-visual {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: color-mix(in srgb, var(--accent) 70%, var(--sign-muted));
  font-size: 0.7rem;
}

.outer-edge-glyph {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}

.outer-edge-glyph-rect {
  border-radius: 2px;
}

.outer-edge-glyph-shape {
  border-radius: 50% 40% 55% 35% / 45% 55% 40% 60%;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.outer-edge-option-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.outer-edge-option-copy strong {
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.outer-edge-option-copy small {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--sign-muted);
}

.outer-edge-option-switch {
  position: relative;
  width: 2.4rem;
  height: 1.35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sign-muted) 28%, #e8e8e8);
  flex-shrink: 0;
  transition: background 0.18s ease;
}

.outer-edge-option-switch::after {
  content: '';
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.outer-edge-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--sign-line));
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent) 18%, #ffffff) 0%,
      color-mix(in srgb, var(--accent) 6%, #ffffff) 100%
    );
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

.outer-edge-option:has(input:checked) .outer-edge-option-switch {
  background: var(--accent);
}

.outer-edge-option:has(input:checked) .outer-edge-option-switch::after {
  transform: translateX(1.05rem);
}

.outer-edge-option:has(input:checked) .outer-edge-option-copy strong::after {
  content: ' · aktiv';
  font-weight: 500;
  color: color-mix(in srgb, var(--accent) 75%, var(--sign-text));
  font-size: 0.78em;
}

.outer-edge-option:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

@media (max-width: 520px) {
  .outer-edge-option {
    grid-template-columns: 1fr auto;
    padding: 0.7rem 0.75rem;
  }

  .outer-edge-option-visual {
    display: none;
  }
}

.cut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.cut-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cut-legend-item::before {
  content: "";
  width: 0.85rem;
  height: 0.18rem;
  border-radius: 2px;
  background: currentColor;
}

.cut-legend-cut {
  color: #ff6b6b;
}

.cut-legend-score {
  color: #333333;
}

.cut-empty-hint {
  margin: 0.5rem 0 0.65rem;
}

.cut-selected-tools {
  margin: 0.75rem 0;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.cut-selected-tools:not([hidden]) ~ .cut-empty-hint {
  display: none;
}

.shape-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 0.35rem 0 0.75rem;
}

.shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 3.4rem;
  padding: 0.55rem 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.shape-btn i {
  font-size: 1.15rem;
  color: var(--text);
}

.shape-btn:hover {
  color: var(--text);
  border-color: rgba(196, 165, 116, 0.45);
}

.image-sliders {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

#cutDraftFillRow[hidden],
#cutDraftReplaceRow[hidden],
#cutAdvancedRasterOpts[hidden],
#cutFillRow[hidden],
#shapeFillRow[hidden],
#cutStrokeRow[hidden],
#cutStrokeGrayRow[hidden],
#shapeStrokeRow[hidden],
#shapeStrokeGrayRow[hidden],
#shapeReplaceRow[hidden],
#cutReplaceRow[hidden],
.outer-edge-option[hidden],
.image-sliders[hidden] {
  display: none !important;
}

.image-sliders label {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
}

.image-sliders label span {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.image-sliders input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  padding: 0;
  accent-color: var(--accent);
}

.image-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + var(--safe-bottom));
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 220;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-width: min(90vw, 360px);
  text-align: center;
}

/* Compact single-band footer (~20% of former gallery footer height) */
.sign-footer {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  background: rgba(250, 250, 250, 0.95);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 0.55rem 1rem calc(0.55rem + var(--safe-bottom));
}

.sign-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.sign-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  font-size: 0.72rem;
  line-height: 1.3;
}

.sign-footer-links a {
  color: var(--text-secondary, #666);
  text-decoration: none;
  white-space: nowrap;
}

.sign-footer-links a:hover {
  color: var(--text-primary, #333);
  text-decoration: underline;
}

.sign-footer-sep {
  color: rgba(0, 0, 0, 0.25);
  user-select: none;
}

.sign-footer-credit {
  margin: 0;
  font-size: 0.68rem;
  color: var(--text-secondary, #666);
  opacity: 0.8;
  white-space: nowrap;
}

.sign-footer-credit a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 899px), (max-height: 720px) {
  /*
   * Document scroll: editor fills the first screen; footer sits after the panel
   * and is only reached by scrolling the page (never fixed/stuck over the UI).
   * Also covers landscape phones (>899px wide) via max-height.
   */
  html {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.sign-generator {
    display: block;
    height: auto !important;
    max-height: none !important;
    min-height: 100svh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto !important;
  }

  .sign-top-chrome {
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .sign-app {
    display: flex;
    flex-direction: column;
    flex: none;
    width: 100%;
    /* First screen under sticky chrome (~header + tool bar). */
    height: calc(100svh - 6.5rem);
    height: calc(100dvh - 6.5rem);
    min-height: 22rem;
    overflow: hidden;
  }

  .sign-footer {
    position: static !important;
    bottom: auto;
    left: auto;
    right: auto;
    inset: auto;
    display: block;
    width: 100%;
    flex: none;
    margin: 0;
    z-index: auto;
  }

  /* Let scroll chain from panel end → page so the footer is reachable. */
  .panel {
    overscroll-behavior-y: auto;
    padding-bottom: 1.25rem;
  }

  .sign-footer-inner {
    justify-content: center;
    text-align: center;
  }

  .sign-footer-links {
    justify-content: center;
  }
}

@media (max-width: 700px) {
  .sign-footer-inner {
    justify-content: center;
    text-align: center;
  }

  .sign-footer-links {
    justify-content: center;
  }
}
