:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --line: #dbe3ee;
  --text: #18345c;
  --muted: #6a768a;
  --brand: #193e76;
  --brand-deep: #102d59;
  --accent: #f5bd17;
  --shadow: 0 10px 28px rgba(20, 47, 89, 0.08);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button,
.button-like {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

button:hover:not(:disabled),
.button-like:hover {
  background: var(--brand-deep);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

button.secondary {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--brand);
}

button.secondary:hover:not(:disabled) {
  background: #edf2f8;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.compact {
  min-height: 34px;
  padding-inline: 10px;
}

.wide {
  width: 100%;
}

.app-shell {
  width: min(100vw - 24px, 1760px);
  height: 100vh;
  margin: 0 auto;
  padding: 12px 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) 118px;
  gap: 10px;
  overflow: hidden;
}

.topbar,
.step-strip,
.stage-panel,
.control-panel,
.frames-dock {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px;
}

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

.brand-logo-link {
  flex: 0 0 auto;
  display: inline-flex;
  border-radius: 8px;
}

.brand-logo-link:focus-visible {
  outline: 3px solid rgba(245, 189, 23, 0.7);
  outline-offset: 3px;
}

.brand-logo {
  width: 104px;
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.admin-link {
  width: 34px;
  min-height: 34px;
  height: 34px;
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--brand);
}

.admin-link:hover {
  background: var(--brand);
  color: #fff;
}

.admin-icon {
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 4px;
  display: block;
  position: relative;
}

.admin-icon::before,
.admin-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  height: 2px;
  background: currentColor;
}

.admin-icon::before {
  top: 4px;
}

.admin-icon::after {
  bottom: 4px;
}

.customer-icon {
  width: 18px;
  height: 18px;
  display: block;
  position: relative;
}

.customer-icon::before,
.customer-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: currentColor;
}

.customer-icon::before {
  top: 1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.customer-icon::after {
  bottom: 1px;
  width: 15px;
  height: 8px;
  border-radius: 10px 10px 4px 4px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.25rem;
  line-height: 1.2;
}

h2 {
  font-size: 0.92rem;
  line-height: 1.2;
}

.topbar-actions,
.canvas-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button {
  width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: var(--brand);
}

.canvas-actions #cameraActionBtn {
  width: 52px;
  min-height: 52px;
  height: 52px;
}

.image-upload-button {
  background: var(--panel-soft);
  border-color: var(--line);
}

.help-button {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--brand);
  font-size: 1rem;
  font-weight: 800;
}

.help-popover {
  position: relative;
}

.help-popover summary {
  list-style: none;
}

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

.help-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  width: 260px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--muted);
}

.help-panel p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  line-height: 1.35;
}

.help-panel p:last-child {
  margin-bottom: 0;
}

.camera-icon {
  width: 18px;
  height: 14px;
  display: block;
  position: relative;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.camera-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.camera-icon::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 3px;
  width: 7px;
  height: 4px;
  background: currentColor;
  border-radius: 3px 3px 0 0;
}

.image-icon {
  width: 18px;
  height: 16px;
  display: block;
  position: relative;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.image-icon::before {
  content: "";
  position: absolute;
  right: 3px;
  top: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.image-icon::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 7px;
  background: currentColor;
  clip-path: polygon(0 100%, 35% 38%, 53% 65%, 72% 28%, 100% 100%);
}

.list-icon {
  width: 18px;
  height: 16px;
  display: block;
  background:
    linear-gradient(currentColor, currentColor) 0 2px / 18px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 7px / 18px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 12px / 18px 2px no-repeat;
}

.sample-faces-button {
  background: var(--panel-soft);
  border-color: var(--line);
}

.step-strip {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 6px 8px;
  overflow-x: auto;
}

.step {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.step + .step::before {
  content: "";
  width: 7px;
  height: 7px;
  margin: 0 12px 0 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--muted);
  transform: rotate(-45deg);
}

.step.active {
  background: #e9f0f9;
  color: var(--brand);
}

.step.done {
  color: var(--brand);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 10px;
  overflow: hidden;
}

.stage-panel {
  min-height: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
}

.stage-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.canvas-wrap {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.canvas-wrap::after {
  content: "Pusťte fotku sem";
  position: absolute;
  inset: 12px;
  z-index: 9;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(25, 62, 118, 0.34);
  border-radius: calc(var(--radius) + 2px);
  background: rgba(248, 251, 255, 0.82);
  color: var(--brand);
  font-size: 1rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition: opacity 140ms ease, transform 140ms ease;
}

.canvas-wrap.drag-over::after {
  opacity: 1;
  transform: scale(1);
}

.app-shell.camera-live canvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='38' height='38' viewBox='0 0 38 38'%3E%3Cg fill='none' stroke='%23193e76' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' opacity='0.72'%3E%3Crect x='7' y='12' width='24' height='18' rx='4'/%3E%3Cpath d='M14 12l2-4h7l2 4'/%3E%3Ccircle cx='19' cy='21' r='5.2'/%3E%3Cpath d='M29 10h3M30.5 8.5v3'/%3E%3C/g%3E%3C/svg%3E") 19 19, pointer;
}

.canvas-actions {
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: 4;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 32px rgba(20, 47, 89, 0.12);
  backdrop-filter: blur(8px);
  transform: translate(-50%, -50%);
  transition: top 180ms ease, right 180ms ease, left 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.blog-ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: 34px;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid rgba(219, 227, 238, 0.92);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 -8px 18px rgba(20, 47, 89, 0.06);
  backdrop-filter: blur(8px);
  scrollbar-width: thin;
  scrollbar-color: rgba(25, 62, 118, 0.28) transparent;
  overscroll-behavior-x: contain;
}

.blog-ticker-track {
  width: max-content;
  height: 100%;
  display: flex;
  align-items: center;
  padding-right: 42px;
}

.blog-ticker-item {
  min-height: 34px;
  padding: 0 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

.blog-ticker-item::before {
  content: "Článek";
  margin-right: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(245, 189, 23, 0.2);
  color: var(--brand);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.blog-ticker-item:hover,
.blog-ticker-item:focus-visible {
  background: var(--brand);
  color: #fff;
}

.blog-ticker-item:hover::before,
.blog-ticker-item:focus-visible::before {
  background: var(--accent);
  color: var(--brand-deep);
}

.app-shell.has-media .blog-ticker,
.app-shell.camera-live .blog-ticker {
  display: none;
}

.app-shell.has-media .canvas-actions {
  top: 12px;
  right: 12px;
  left: auto;
  padding: 6px;
  box-shadow: 0 8px 22px rgba(20, 47, 89, 0.12);
  transform: none;
}

.app-shell.has-media .canvas-actions .icon-button {
  width: 36px;
  min-height: 36px;
  height: 36px;
}

.app-shell.has-media .canvas-actions #cameraActionBtn {
  width: 40px;
  min-height: 40px;
  height: 40px;
}

.rotation-wheel-tools {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: none;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 22px rgba(20, 47, 89, 0.1);
  backdrop-filter: blur(8px);
}

.rotation-wheel-hint {
  position: absolute;
  right: 10px;
  bottom: calc(100% + 8px);
  min-width: max-content;
  padding: 6px 9px;
  border: 1px solid rgba(25, 62, 118, 0.18);
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 24px rgba(20, 47, 89, 0.16);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.rotation-wheel-tools:hover .rotation-wheel-hint,
.rotation-wheel-tools:focus-within .rotation-wheel-hint {
  opacity: 1;
  transform: translateY(0);
}

.app-shell.photo-ready .rotation-wheel-tools {
  display: flex;
}

.face-type-popover {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 5;
  display: none;
}

.app-shell.face-type-ready .face-type-popover {
  display: block;
}

.face-type-popover summary {
  list-style: none;
}

.face-type-popover summary::-webkit-details-marker {
  display: none;
}

.face-type-trigger {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(25, 62, 118, 0.18);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand);
  box-shadow: 0 8px 22px rgba(20, 47, 89, 0.12);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

.face-type-trigger:hover {
  background: var(--brand);
  color: #fff;
}

.face-type-icon {
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 48% 48% 44% 44%;
  display: inline-block;
  position: relative;
}

.face-type-icon::before,
.face-type-icon::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
}

.face-type-icon::before {
  left: 5px;
}

.face-type-icon::after {
  right: 5px;
}

.face-type-card {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(420px, calc(100vw - 36px));
  padding: 14px;
  max-height: min(360px, calc(100dvh - 190px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(20, 47, 89, 0.18);
  scrollbar-width: thin;
}

.face-type-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.face-type-content {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.face-schema {
  min-height: 158px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #f9fbff, #eef4fb);
}

.face-schema-shape {
  width: 86px;
  height: 122px;
  border: 3px solid var(--brand);
  border-radius: 48% 48% 44% 44%;
  position: relative;
  background: rgba(25, 62, 118, 0.04);
}

.face-schema-shape.oval {
  border-radius: 50% 50% 46% 46%;
  height: 132px;
  width: 82px;
}

.face-schema-shape.round {
  border-radius: 50%;
  height: 104px;
  width: 94px;
}

.face-schema-shape.angular {
  border-radius: 34% 34% 24% 24%;
  width: 92px;
}

.face-schema-shape.heart {
  border-radius: 52% 52% 38% 38%;
  clip-path: polygon(12% 0, 88% 0, 82% 62%, 50% 100%, 18% 62%);
}

.schema-line {
  position: absolute;
  left: 50%;
  height: 2px;
  background: var(--accent);
  transform: translateX(-50%);
}

.schema-line.brow {
  top: 24%;
  width: 68%;
}

.schema-line.cheek {
  top: 49%;
  width: 84%;
}

.schema-line.jaw {
  top: 76%;
  width: 54%;
}

.schema-label {
  position: absolute;
  left: calc(100% + 8px);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.schema-label.top {
  top: 18%;
}

.schema-label.middle {
  top: 43%;
}

.schema-label.bottom {
  top: 70%;
}

.face-type-copy p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.38;
}

.face-type-copy ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.36;
}

.face-gallery-open {
  margin-top: 10px;
}

.face-frame-pick {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(25, 62, 118, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  background: #f8fbff;
}

.face-frame-pick[hidden] {
  display: none;
}

.face-frame-pick strong {
  color: var(--brand);
  font-size: 0.9rem;
  line-height: 1.25;
}

.face-frame-pick span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.rotate-tool {
  min-width: 86px;
  min-height: 34px;
  padding: 0 12px;
  gap: 6px;
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--brand);
  font-size: 0.78rem;
  touch-action: none;
  user-select: none;
}

.rotate-tool:hover,
.rotate-tool:focus-visible,
.rotate-tool.dragging {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.rotate-icon {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  line-height: 1;
}

.rotate-icon::before {
  content: "↻";
  font-size: 1rem;
  font-weight: 800;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

#cameraPreview,
#photoInput {
  display: none;
}

.control-panel {
  min-height: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

.panel-section {
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

details.panel-section {
  display: block;
}

details.panel-section[open] {
  display: grid;
}

.tuning-panel,
.background-panel,
.filter-panel,
.output-panel {
  display: none;
}

.app-shell.photo-ready details.tuning-panel,
.app-shell.photo-ready details.background-panel,
.app-shell.photo-ready details.filter-panel {
  display: block;
}

.app-shell.photo-ready details.tuning-panel[open],
.app-shell.photo-ready details.background-panel[open],
.app-shell.photo-ready details.filter-panel[open],
.app-shell.photo-ready .output-panel {
  display: grid;
}

.panel-summary {
  cursor: pointer;
  list-style: none;
}

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

.summary-chevron {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: var(--muted);
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.summary-chevron::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transform-origin: 50% 50%;
}

.panel-summary:hover .summary-chevron {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

details.panel-section[open] .summary-chevron {
  transform: rotate(90deg);
}

.tuning-actions {
  display: flex;
  justify-content: flex-end;
}

.action-section {
  background: #eef4fb;
}

.action-section #autoPlaceBtn {
  display: none;
}

.detect-spinner {
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid rgba(25, 62, 118, 0.16);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
}

.detect-spinner[hidden] {
  display: none;
}

.spinner-dot {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(25, 62, 118, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 780ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.frame-typology-panel {
  background: #f8fbff;
  gap: 0;
  padding: 18px 20px;
}

.frame-typology-panel .panel-summary {
  margin-bottom: 24px;
}

.mini-pill {
  margin-bottom: 8px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  background: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.typology-title {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.22;
}

.typology-summary {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.typology-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.typology-badges span {
  padding: 4px 7px;
  border-radius: 999px;
  background: #e9f0f9;
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 800;
}

.typology-more {
  margin: 0 0 14px;
}

.typology-more summary {
  padding-block: 2px;
  color: var(--brand);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.typology-more ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.5;
}

.frame-type-gallery-open {
  justify-self: start;
  margin-top: 2px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.layer-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.chip {
  min-height: 36px;
}

.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.control-grid {
  display: grid;
  gap: 10px;
}

.slider-group {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.slider-group span {
  color: var(--text);
  font-weight: 650;
}

.slider-group output {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.subtle-range {
  width: 100%;
  accent-color: var(--brand);
}

.download-actions {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 0.62fr);
  gap: 8px;
  align-items: start;
}

.download-actions .more-downloads {
  min-width: 0;
  position: relative;
}

.more-downloads summary {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.more-downloads summary.secondary {
  width: 100%;
  background: var(--panel-soft);
  color: var(--brand);
}

.more-downloads summary.secondary:hover {
  background: #edf2f8;
}

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

.download-format-grid {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 10;
  min-width: 220px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(20, 47, 89, 0.16);
}

.output-extra-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 0.72fr);
  gap: 8px;
  align-items: start;
}

.filter-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-preset {
  min-height: 30px;
  padding: 0 9px;
  border-color: var(--line);
  background: #fff;
  color: var(--brand);
  font-size: 0.78rem;
}

.filter-preset:hover,
.filter-preset:focus-visible {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.background-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.background-mode {
  min-height: 36px;
  padding: 0 10px;
  border-color: var(--line);
  background: #fff;
  color: var(--brand);
  font-size: 0.82rem;
}

.background-mode:hover,
.background-mode.active {
  border-color: rgba(25, 62, 118, 0.3);
  background: var(--brand);
  color: #fff;
}

.background-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.share-menu {
  min-width: 0;
  position: relative;
}

.share-trigger {
  min-height: 38px;
}

.share-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  position: relative;
}

.share-icon::before,
.share-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.share-icon::before {
  left: 3px;
  top: 7px;
  width: 10px;
  height: 2px;
  transform: rotate(-28deg);
}

.share-icon::after {
  left: 4px;
  top: 8px;
  width: 9px;
  height: 2px;
  transform: rotate(30deg);
}

.share-icon {
  background:
    radial-gradient(circle at 3px 8px, currentColor 0 3px, transparent 3.2px),
    radial-gradient(circle at 13px 3px, currentColor 0 3px, transparent 3.2px),
    radial-gradient(circle at 13px 13px, currentColor 0 3px, transparent 3.2px);
}

.share-options {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 8;
  width: 190px;
  padding: 8px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.share-options[hidden] {
  display: none;
}

.share-option {
  min-height: 36px;
  justify-content: flex-start;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  font-size: 0.86rem;
}

.share-option:hover {
  background: var(--panel-soft);
}

.share-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #e9f0f9;
  color: var(--brand);
}

.share-badge svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-badge .social-fill path {
  fill: currentColor;
  stroke: none;
}

.ai-prompt-button {
  min-width: 0;
  font-size: 0.82rem;
}

.ai-badge {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0;
}

.ai-prompt-button:hover:not(:disabled) .ai-badge {
  background: var(--accent);
  color: var(--brand);
}

.button-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(25, 62, 118, 0.24);
  border-top-color: var(--brand);
  border-radius: 50%;
  display: none;
  animation: spin 780ms linear infinite;
}

.ai-prompt-button.loading .ai-badge {
  display: none;
}

.ai-prompt-button.loading .button-spinner {
  display: inline-block;
}

.text-button {
  min-height: 34px;
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
}

.text-button:hover:not(:disabled) {
  background: transparent;
  text-decoration: underline;
}

.calibration-link {
  min-height: 24px;
  margin-top: -2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.calibration-link:hover:not(:disabled) {
  color: var(--brand);
}

.frames-dock {
  min-height: 0;
  padding: 8px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  overflow: hidden;
}

.mobile-action-bar {
  display: none;
}

.mobile-action-icon {
  width: 20px;
  height: 20px;
  position: relative;
  display: inline-block;
  color: currentColor;
}

.glasses-icon::before,
.glasses-icon::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.glasses-icon::before {
  left: 1px;
}

.glasses-icon::after {
  right: 1px;
}

.glasses-icon {
  border-top: 2px solid currentColor;
  transform: translateY(5px);
}

.filter-icon::before {
  content: "";
  position: absolute;
  inset: 3px 2px;
  border: 2px solid currentColor;
  border-top: 0;
  clip-path: polygon(0 0, 100% 0, 62% 48%, 62% 100%, 38% 100%, 38% 48%);
  background: currentColor;
}

.tune-icon::before,
.tune-icon::after,
.background-icon::before,
.save-icon::before {
  content: "";
  position: absolute;
}

.tune-icon::before {
  inset: 5px 2px auto;
  height: 2px;
  background: currentColor;
  box-shadow: 0 6px 0 currentColor;
}

.tune-icon::after {
  top: 2px;
  left: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 8px 6px 0 currentColor;
}

.background-icon::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 5px;
  background: linear-gradient(135deg, transparent 45%, currentColor 46% 56%, transparent 57%);
}

.save-icon::before {
  inset: 2px 4px;
  border: 2px solid currentColor;
  border-radius: 3px;
  box-shadow: inset 0 -5px 0 currentColor;
}

.dock-arrow {
  width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
}

.frame-slider {
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px;
  scrollbar-width: thin;
}

.frame-card {
  flex: 0 0 128px;
  min-height: 98px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: 48px auto auto;
  align-items: start;
  gap: 2px;
  background: #fff;
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.frame-card:hover,
.frame-card.active {
  border-color: var(--brand);
  color: #fff;
}

.frame-card:hover {
  background: #24508b;
  box-shadow: 0 8px 20px rgba(20, 47, 89, 0.16);
}

.frame-card.active {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px rgba(25, 62, 118, 0.16);
}

.frame-thumb {
  width: 100%;
  height: 48px;
  padding: 3px;
  border: 1px solid rgba(194, 207, 226, 0.85);
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #fff;
  position: relative;
}

.frame-card img {
  width: 100%;
  height: 40px;
  object-fit: contain;
}

.frame-card strong {
  display: -webkit-box;
  overflow: hidden;
  color: currentColor;
  font-size: 0.7rem;
  line-height: 1.05;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.frame-card span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.05;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.frame-card:hover span,
.frame-card.active span {
  color: #fff;
}

.frame-card:hover .frame-thumb,
.frame-card.active .frame-thumb {
  border-color: rgba(255, 255, 255, 0.7);
}

.frame-gallery-btn {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 24px;
  min-height: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--brand);
  color: var(--brand);
  box-shadow: 0 4px 10px rgba(20, 47, 89, 0.2);
}

.frame-card:hover .frame-gallery-btn,
.frame-card.active .frame-gallery-btn {
  border-color: #fff;
  background: var(--accent);
  color: var(--brand);
}

.frame-gallery-btn .image-icon {
  width: 12px;
  height: 10px;
  border-width: 1.6px;
  color: #fff;
}

.frame-gallery-btn .image-icon::before {
  right: 2px;
  top: 2px;
  width: 2.5px;
  height: 2.5px;
}

.frame-gallery-btn .image-icon::after {
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 5px;
}

.frame-gallery-btn:hover .image-icon,
.frame-gallery-btn:focus-visible .image-icon,
.frame-card:hover .frame-gallery-btn .image-icon,
.frame-card.active .frame-gallery-btn .image-icon {
  color: var(--brand);
}

.frame-gallery-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.frame-gallery-dialog::backdrop {
  background: rgba(18, 38, 73, 0.42);
  backdrop-filter: blur(5px);
}

.frame-gallery-modal {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 16px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(20, 47, 89, 0.22);
}

.frame-gallery-header,
.frame-gallery-body {
  display: flex;
  gap: 16px;
}

.frame-gallery-header {
  align-items: start;
  justify-content: space-between;
}

.frame-gallery-header h2 {
  margin: 0;
  color: var(--brand);
}

.frame-gallery-header p:not(.eyebrow) {
  margin: 4px 0 0;
  color: var(--muted);
}

.frame-gallery-body {
  align-items: stretch;
}

.frame-gallery-image-wrap {
  position: relative;
  min-height: 280px;
  flex: 1 1 58%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  overflow: hidden;
}

.frame-gallery-image-wrap img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.frame-gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(25, 62, 118, 0.18);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand);
  box-shadow: 0 10px 24px rgba(20, 47, 89, 0.16);
  transform: translateY(-50%);
}

.frame-gallery-nav[hidden],
.frame-gallery-count[hidden] {
  display: none;
}

.frame-gallery-nav::before {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.frame-gallery-prev {
  left: 12px;
}

.frame-gallery-prev::before {
  transform: rotate(135deg);
}

.frame-gallery-next {
  right: 12px;
}

.frame-gallery-next::before {
  transform: rotate(-45deg);
}

.frame-gallery-nav:hover,
.frame-gallery-nav:focus-visible {
  background: var(--brand);
  color: #fff;
}

.frame-gallery-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(10, 28, 59, 0.78);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.frame-gallery-info {
  flex: 1 1 240px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.frame-gallery-info dl {
  margin: 0;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px 10px;
  font-size: 0.86rem;
}

.frame-gallery-info dt {
  color: var(--muted);
  font-weight: 800;
}

.frame-gallery-info dd {
  margin: 0;
  color: var(--text);
}

.frame-gallery-typology {
  padding: 12px;
  border: 1px solid rgba(25, 62, 118, 0.14);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  background: #f8fbff;
}

.frame-gallery-typology[hidden] {
  display: none;
}

.frame-gallery-typology h3 {
  margin: 0;
  color: var(--brand);
  font-size: 0.98rem;
  line-height: 1.25;
}

.frame-gallery-typology p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.42;
}

.frame-gallery-face-fit {
  padding: 8px 9px;
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 3px;
}

.frame-gallery-face-fit strong {
  color: var(--brand);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.frame-gallery-face-fit span {
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.35;
}

.frame-gallery-typology ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.38;
}

.face-type-gallery-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.face-type-gallery-dialog::backdrop {
  background: rgba(18, 38, 73, 0.46);
  backdrop-filter: blur(5px);
}

.face-type-gallery-modal {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 14px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(20, 47, 89, 0.22);
}

.face-type-gallery-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.face-type-gallery-header h2 {
  color: var(--brand);
}

.face-type-gallery-stage {
  min-height: 420px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: stretch;
}

.face-gallery-track {
  min-width: 0;
  display: grid;
}

.face-gallery-card {
  min-height: 420px;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fbff;
}

.face-gallery-art {
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(245, 189, 23, 0.12), transparent 42%),
    #f3f7fc;
}

.face-gallery-image {
  width: min(100%, 360px);
  max-height: 390px;
  display: block;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 16px 38px rgba(20, 47, 89, 0.14);
}

.face-gallery-shape {
  width: 154px;
  height: 220px;
  border: 4px solid var(--brand);
  border-radius: 48% 48% 44% 44%;
  position: relative;
  background: rgba(255, 255, 255, 0.62);
}

.face-gallery-shape.oval {
  width: 142px;
  height: 236px;
  border-radius: 50% 50% 46% 46%;
}

.face-gallery-shape.round {
  width: 170px;
  height: 176px;
  border-radius: 50%;
}

.face-gallery-shape.square {
  width: 166px;
  height: 196px;
  border-radius: 30% 30% 22% 22%;
}

.face-gallery-shape.rectangle {
  width: 148px;
  height: 238px;
  border-radius: 34% 34% 24% 24%;
}

.face-gallery-shape.heart {
  width: 174px;
  height: 218px;
  border-radius: 52% 52% 38% 38%;
  clip-path: polygon(10% 0, 90% 0, 84% 62%, 50% 100%, 16% 62%);
}

.face-gallery-shape.triangle {
  width: 172px;
  height: 218px;
  border-radius: 35% 35% 48% 48%;
  clip-path: polygon(31% 0, 69% 0, 96% 78%, 50% 100%, 4% 78%);
}

.face-gallery-shape.diamond {
  width: 172px;
  height: 222px;
  border-radius: 42% 42% 36% 36%;
  clip-path: polygon(50% 0, 93% 38%, 76% 82%, 50% 100%, 24% 82%, 7% 38%);
}

.face-gallery-copy {
  padding: 34px;
  display: grid;
  align-content: center;
  gap: 14px;
  background: #fff;
}

.face-gallery-copy h3 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.face-gallery-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.52;
}

.face-gallery-copy .face-gallery-counter {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 900;
}

.face-gallery-nav {
  align-self: center;
  width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--brand);
}

.face-gallery-nav::before {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.face-gallery-prev::before {
  transform: rotate(135deg);
}

.face-gallery-next::before {
  transform: rotate(-45deg);
}

.face-gallery-nav:hover {
  background: var(--brand);
  color: #fff;
}

.face-gallery-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.face-gallery-dot {
  width: 10px;
  min-height: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #cdd8e8;
}

.face-gallery-dot.active {
  width: 28px;
  background: var(--brand);
}

.sample-faces-dialog {
  width: min(980px, calc(100vw - 28px));
  max-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.sample-faces-dialog::backdrop {
  background: rgba(18, 38, 73, 0.46);
  backdrop-filter: blur(5px);
}

.sample-faces-modal {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 14px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(20, 47, 89, 0.22);
}

.sample-faces-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.sample-faces-header h2 {
  color: var(--brand);
}

.sample-faces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.sample-face-card {
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  background: var(--panel-soft);
  color: var(--brand);
  text-align: left;
}

.sample-face-card:hover,
.sample-face-card.active {
  border-color: rgba(25, 62, 118, 0.38);
  background: #edf2f8;
}

.sample-face-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
  background: #fff;
}

.sample-face-card span {
  min-height: 34px;
  display: flex;
  align-items: center;
  color: var(--brand);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
}

.blog-article-dialog {
  width: min(860px, calc(100vw - 28px));
  max-width: 100%;
  max-height: min(86vh, 920px);
  border: 0;
  padding: 0;
  background: transparent;
}

.blog-article-dialog::backdrop {
  background: rgba(18, 38, 73, 0.48);
  backdrop-filter: blur(5px);
}

.blog-article-modal {
  max-height: min(86vh, 920px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(20, 47, 89, 0.22);
}

.blog-article-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.blog-article-header h2 {
  max-width: 680px;
  color: var(--brand);
  font-size: clamp(1.15rem, 2.4vw, 1.65rem);
  line-height: 1.18;
}

.blog-article-content {
  min-height: 0;
  overflow: auto;
  padding: 2px 12px 8px 2px;
  color: var(--text);
  line-height: 1.62;
}

.blog-article-content h3 {
  margin: 24px 0 8px;
  color: var(--brand);
  font-size: 1.05rem;
  line-height: 1.25;
}

.blog-article-content p {
  margin: 0 0 13px;
  color: #2e4468;
}

.blog-article-content ul,
.blog-article-content ol {
  margin: 0 0 14px;
  padding-left: 22px;
  color: #2e4468;
}

@media (prefers-reduced-motion: reduce) {
  .blog-ticker-track {
    animation: none;
  }
}

.frame-type-gallery-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.frame-type-gallery-dialog::backdrop {
  background: rgba(18, 38, 73, 0.46);
  backdrop-filter: blur(5px);
}

.frame-type-gallery-modal {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 14px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(20, 47, 89, 0.22);
}

.frame-type-gallery-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.frame-type-gallery-header h2 {
  color: var(--brand);
}

.frame-type-gallery-stage {
  min-height: 420px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: stretch;
}

.frame-type-track {
  min-width: 0;
  display: grid;
}

.frame-type-card {
  min-height: 420px;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fbff;
}

.frame-type-art {
  min-height: 420px;
  padding: 26px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(25, 62, 118, 0.05), transparent 46%),
    #f3f7fc;
}

.frame-type-image {
  display: block;
  width: min(100%, 520px);
  max-height: 340px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(20, 47, 89, 0.08);
}

.frame-type-copy {
  padding: 34px;
  display: grid;
  align-content: center;
  gap: 14px;
  background: #fff;
}

.frame-type-copy h3 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.frame-type-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.52;
}

.frame-type-copy .frame-type-counter {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 900;
}

.frame-type-products {
  margin-top: 6px;
  display: grid;
  gap: 9px;
}

.frame-type-products .eyebrow {
  margin-bottom: 0;
}

.frame-type-products-empty {
  padding: 10px 12px;
  border: 1px dashed rgba(25, 62, 118, 0.2);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.86rem;
}

.frame-type-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.frame-type-product {
  min-height: 78px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  background: #f8fbff;
  color: var(--text);
  text-align: left;
}

.frame-type-product:hover,
.frame-type-product:focus-visible {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.frame-type-product-thumb {
  height: 58px;
  border: 1px solid rgba(194, 207, 226, 0.85);
  border-radius: 6px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
}

.frame-type-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.frame-type-product-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.frame-type-product-copy strong,
.frame-type-product-copy small {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

.frame-type-product-copy strong {
  color: currentColor;
  font-size: 0.78rem;
  line-height: 1.18;
  -webkit-line-clamp: 2;
}

.frame-type-product-copy small {
  color: currentColor;
  opacity: 0.72;
  font-size: 0.68rem;
  line-height: 1.2;
  -webkit-line-clamp: 2;
}

.frame-type-nav {
  align-self: center;
  width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--brand);
}

.frame-type-nav::before {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.frame-type-prev::before {
  transform: rotate(135deg);
}

.frame-type-next::before {
  transform: rotate(-45deg);
}

.frame-type-nav:hover {
  background: var(--brand);
  color: #fff;
}

.frame-type-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.frame-type-dot {
  width: 10px;
  min-height: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #cdd8e8;
}

.frame-type-dot.active {
  width: 28px;
  background: var(--brand);
}

.calibration-dialog {
  width: min(980px, calc(100vw - 32px));
  max-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.calibration-dialog::backdrop {
  background: rgba(18, 38, 73, 0.42);
  backdrop-filter: blur(5px);
}

.calibration-modal {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 16px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(20, 47, 89, 0.22);
}

.calibration-header,
.calibration-body,
.calibration-actions,
.calibration-points {
  display: flex;
}

.calibration-header {
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.calibration-header p,
.calibration-side p,
.calibration-points span {
  margin: 4px 0 0;
  color: var(--muted);
}

.calibration-body {
  gap: 16px;
  align-items: stretch;
}

.calibration-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(28, 63, 120, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(28, 63, 120, 0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(28, 63, 120, 0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(28, 63, 120, 0.04) 75%),
    #f8fbff;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  overflow: hidden;
  cursor: crosshair;
}

.calibration-canvas-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.calibration-side {
  width: 250px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.calibration-tools {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.calibration-auto-notice {
  margin: 0;
  padding: 8px 9px;
  border: 1px solid rgba(245, 189, 23, 0.42);
  border-radius: 8px;
  background: rgba(245, 189, 23, 0.12);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.3;
}

.calibration-auto-notice[hidden] {
  display: none;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 650;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.calibration-radius {
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 6px 8px;
  align-items: center;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 650;
}

.calibration-radius input {
  grid-column: 1 / -1;
}

.calibration-radius output {
  text-align: right;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.calibration-points {
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.calibration-points strong,
.calibration-points span {
  display: block;
}

.calibration-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.calibration-marker {
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(20, 47, 89, 0.18);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.calibration-guide-line,
.calibration-guide-circle {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.calibration-guide-line {
  background: rgba(25, 62, 118, 0.38);
}

.calibration-guide-line.left {
  background: rgba(245, 189, 23, 0.7);
}

.calibration-guide-line.vertical {
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
}

.calibration-guide-line.horizontal {
  left: 0;
  right: 0;
  height: 1px;
  transform: translateY(-50%);
}

.calibration-guide-circle {
  border: 1px dashed rgba(25, 62, 118, 0.62);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.calibration-guide-circle.left {
  border-color: rgba(245, 189, 23, 0.9);
}

.calibration-marker.left {
  background: var(--accent);
}

.calibration-marker.right {
  background: var(--brand);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100vw - 16px, 1760px);
    grid-template-rows: auto auto minmax(0, 1fr) 108px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .control-panel {
    max-height: 240px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
  }

  .panel-section {
    flex: 0 0 min(320px, 82vw);
    align-content: start;
  }
}

@media (max-width: 680px) {
  html,
  body {
    min-height: 100%;
    overflow: hidden;
  }

  .app-shell {
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    gap: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    background: var(--bg);
  }

  .topbar {
    min-height: 52px;
    padding: 7px 10px;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
  }

  .brand {
    gap: 9px;
  }

  .brand-logo {
    width: 74px;
  }

  .brand .eyebrow,
  .topbar-actions,
  .step-strip,
  .blog-ticker,
  .sample-faces-button,
  .rotation-wheel-hint {
    display: none;
  }

  .brand h1 {
    font-size: 0.98rem;
    line-height: 1.15;
  }

  .workspace {
    min-height: 0;
    display: block;
    overflow: hidden;
    border-radius: 0;
  }

  .stage-panel {
    height: 100%;
    padding: 8px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    grid-template-rows: auto minmax(0, 1fr);
    background: #eef3f9;
  }

  .stage-status {
    min-height: 18px;
    padding: 0 4px;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .canvas-wrap {
    border-radius: 14px;
    background: #fff;
  }

  .canvas-actions {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 7px;
    gap: 7px;
  }

  .canvas-actions .icon-button {
    width: 44px;
    min-height: 44px;
    height: 44px;
  }

  .face-type-popover {
    left: 10px;
    top: 74px;
  }

  .face-type-trigger {
    min-height: 34px;
    padding-inline: 10px;
    font-size: 0.76rem;
  }

  .face-type-card {
    width: min(360px, calc(100vw - 20px));
    max-height: min(56dvh, 390px);
    padding: 12px;
  }

  .face-type-content {
    grid-template-columns: 1fr;
  }

  .face-schema {
    display: none;
  }

  .control-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 76px;
    z-index: 20;
    max-height: min(52dvh, 420px);
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 18px 52px rgba(20, 47, 89, 0.25);
    display: none;
    flex-direction: column;
    overflow: auto;
  }

  .app-shell.mobile-control-open .control-panel {
    display: flex;
  }

  .control-panel > .panel-section,
  .app-shell.photo-ready .control-panel > .panel-section,
  .app-shell.photo-ready details.tuning-panel,
  .app-shell.photo-ready details.background-panel,
  .app-shell.photo-ready details.filter-panel,
  .app-shell.photo-ready .output-panel {
    display: none;
  }

  .app-shell[data-mobile-sheet="tune"] .tuning-panel,
  .app-shell[data-mobile-sheet="filters"] .filter-panel,
  .app-shell[data-mobile-sheet="background"] .background-panel,
  .app-shell[data-mobile-sheet="output"] .output-panel {
    display: grid;
  }

  .app-shell[data-mobile-sheet="filters"] .filter-panel,
  .app-shell[data-mobile-sheet="background"] .background-panel,
  .app-shell[data-mobile-sheet="tune"] .tuning-panel {
    gap: 12px;
  }

  .action-section,
  .frame-typology-panel {
    display: none;
  }

  .panel-section {
    border-radius: 12px;
  }

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

  .filter-presets,
  .background-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .frames-dock {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 76px;
    z-index: 20;
    min-height: 126px;
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 18px 52px rgba(20, 47, 89, 0.25);
    display: none;
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.mobile-frames-open .frames-dock {
    display: grid;
  }

  .dock-arrow {
    display: none;
  }

  .frame-slider {
    padding-bottom: 2px;
  }

  .frame-card {
    flex-basis: 118px;
    min-height: 104px;
  }

  .mobile-action-bar {
    position: relative;
    z-index: 30;
    min-height: 68px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -10px 28px rgba(20, 47, 89, 0.12);
  }

  .mobile-action {
    min-height: 54px;
    padding: 5px 2px;
    border-radius: 12px;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border-color: transparent;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
  }

  .mobile-action:hover:not(:disabled),
  .mobile-action.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
  }

  .download-actions {
    grid-template-columns: 1fr;
  }

  .frame-gallery-body {
    flex-direction: column;
  }

  .face-type-gallery-stage {
    min-height: 0;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
  }

  .face-gallery-card {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .face-gallery-art {
    min-height: 260px;
    padding: 12px;
  }

  .face-gallery-image {
    max-height: 238px;
  }

  .face-gallery-copy {
    padding: 20px;
  }

  .face-gallery-copy h3 {
    font-size: 1.8rem;
  }

  .sample-faces-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .frame-type-gallery-stage {
    min-height: 0;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
  }

  .frame-type-card {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .frame-type-art {
    min-height: 250px;
    padding: 14px;
  }

  .frame-type-image {
    max-height: 220px;
  }

  .frame-type-copy {
    padding: 20px;
  }

  .frame-type-copy h3 {
    font-size: 1.8rem;
  }

  .frame-type-product-grid {
    grid-template-columns: 1fr;
  }

  .calibration-body {
    flex-direction: column;
  }

  .calibration-side {
    width: 100%;
  }
}
