/* Keep action labels readable when palettes change and allow long labels to wrap. */
html body :is(a, button, input).primary {
  color: var(--on-accent, #111111);
}
html body :is(a, button).secondary:not(.admin-tool-card) {
  color: var(--on-raised, var(--ink, #f6f8fc));
}
html body :is(a, button).primary,
html body :is(a, button).secondary,
html body :is(a, button).btn {
  min-height: 40px;
  max-width: 100%;
  height: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.35;
}
html[data-theme="pizza_kitchen"] body :is(a, button, input).primary { color: #fff9f1; }
html body .admin-tool-card .admin-tool-label { color: inherit; text-shadow: none; }
html body .segmented button { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
html body .segmented button.selected { color: var(--on-raised, var(--ink, #f6f8fc)); }
html body .segmented { flex-wrap: wrap; }
html body :is(button, input).primary:disabled, html body button.secondary:disabled { opacity: .76; }

.theme-studio-links, .theme-studio-sample-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.theme-studio section, .theme-studio form { margin-block: 1.25rem; }
.theme-studio-form > label:not(.field) { display: block; margin-block: .7rem; }
.theme-studio-form [hidden] { display: none; }
.theme-studio-preview {
  padding: clamp(18px, 6vw, 64px);
  color: var(--ink);
  background: linear-gradient(120deg, color-mix(in srgb,var(--bg) var(--theme-photo-overlay-start,76%),transparent), color-mix(in srgb,var(--bg) var(--theme-photo-overlay-end,50%),transparent)),
              var(--theme-photo, linear-gradient(135deg,var(--raised),var(--surface))) center/cover;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.theme-studio-sample {
  width: min(100%, 34rem);
  padding: clamp(14px, 3vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.theme-studio-sample h3 { color: var(--ink); }
.theme-studio-sample p { color: var(--muted); }
.theme-studio-sample-actions span { padding: .55rem .8rem; border-radius: 8px; overflow-wrap: anywhere; }
.theme-studio-sample-actions span:first-child { color: var(--on-accent); background: var(--accent); }
.theme-studio-sample-actions span:last-child { color: var(--on-raised); background: var(--raised); }
.theme-preview-banner { padding: .55rem 1rem; text-align: center; background: #152637; color: #fff; }

.theme-frame-panel { min-width: 0; }
.theme-frame-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .75rem;
  margin-block-end: .65rem;
}
.theme-frame-toolbar .field { margin: 0; }
.theme-frame-toolbar a { display: inline-grid; place-items: center; }
.theme-frame-scroll {
  max-width: 100%;
  overflow: auto;
  padding: .5rem;
  border: 1px solid var(--line, #5d6b7d);
  border-radius: 12px;
  background: var(--raised, #1b2636);
  overscroll-behavior-inline: contain;
}
.theme-frame-scroll iframe {
  display: block;
  box-sizing: border-box;
  width: max(100%, 1120px);
  height: clamp(360px, 68vh, 840px);
  max-width: none;
  border: 0;
  border-radius: 6px;
  background: #fff;
}
.theme-frame-scroll[data-device="mobile"] iframe {
  width: min(390px, 100%);
  margin-inline: auto;
}
.theme-preview-window {
  margin: 0;
  padding: .75rem;
  background: #101722;
  color: #f3f5f9;
  font: 14px/1.4 system-ui, sans-serif;
}
.theme-preview-window h1 { margin: 0 0 .65rem; font-size: 1rem; }
.theme-preview-window iframe { height: calc(100vh - 5rem); height: calc(100dvh - 5rem); }

.theme-studio .theme-colors {
  min-inline-size: 0;
  max-inline-size: 100%;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(9rem, 1fr);
  overflow-x: auto;
  padding: .75rem;
  overscroll-behavior-inline: contain;
}
.theme-studio .theme-colors .field { min-width: 0; margin: 0; }
