/* Estilos originales de la portada y sus tres demos. */
:root {
  color-scheme: light;
  --paper: #f4f7fa;
  --light: #ffffff;
  --ink: #10263b;
  --muted: #5c6d7e;
  --line: #cbd6e0;
  --blue: #1268c4;
  --blue-deep: #074c91;
  --blue-pale: #dcecfb;
  --focus: #006fd6;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --bottle-image: url("assets/botella.png");
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent 0 49.94%, rgba(16, 38, 59, .045) 49.94% 50.06%, transparent 50.06%),
    var(--paper);
  font-family: "Manrope", "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

::selection { color: var(--light); background: var(--blue-deep); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

a { color: inherit; }

.page-shell {
  width: min(100%, 1680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(20px, 2.8vw, 46px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(22px, 2.5vw, 38px);
}

.masthead {
  display: grid;
  grid-template-columns: minmax(180px, .72fr) minmax(420px, 1.45fr) minmax(180px, .6fr);
  gap: 28px;
  align-items: end;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  color: var(--blue-deep);
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: -.01em;
}

h1 {
  max-width: 770px;
  margin: 0;
  font-size: clamp(2rem, 3.65vw, 4.7rem);
  line-height: 1.08;
  letter-spacing: -.035em;
  font-weight: 700;
  text-wrap: balance;
}

.intro {
  max-width: 29ch;
  margin: 0 0 3px auto;
  color: var(--muted);
  font-size: clamp(.88rem, 1.05vw, 1.02rem);
  line-height: 1.55;
}

.contact-sheet {
  min-height: 530px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, .8vw, 12px);
  background: transparent;
}

.design-frame {
  --accent: #1268c4;
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid #aebcc9;
  background: #f9fbfd;
  text-decoration: none;
  isolation: isolate;
  transition: background-color 380ms var(--ease);
}

.design-frame::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 0 auto 0 -34%;
  width: 23%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .64), transparent);
  transform: skewX(-9deg);
  transition: left 700ms var(--ease), opacity 260ms ease;
}

.design-frame:hover::after,
.design-frame:focus-visible::after {
  left: 112%;
  opacity: 1;
}

.design-frame:hover,
.design-frame:focus-visible { background: #eef6fd; }

.frame-head,
.frame-foot {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px clamp(16px, 1.5vw, 24px);
}

.frame-head { border-bottom: 1px solid var(--line); }
.frame-foot { border-top: 1px solid var(--line); }

.design-name {
  font-size: clamp(1rem, 1.25vw, 1.28rem);
  font-weight: 700;
  letter-spacing: -.025em;
}

.frame-index {
  font-variant-numeric: tabular-nums;
  font-size: .72rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.frame-index { color: var(--blue-deep); }

.preview {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  background: #e9eef3;
}

.product-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: var(--bottle-image);
  background-repeat: no-repeat;
  background-position: center 54%;
  background-size: auto 84%;
  filter: saturate(.58) contrast(1.1) brightness(.76);
  transition: transform 800ms var(--ease), filter 500ms var(--ease);
}

.design-frame:hover .product-photo,
.design-frame:focus-visible .product-photo {
  transform: scale(1.025);
  filter: saturate(.82) contrast(1.05) brightness(1);
}

.preview::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 35, 59, .07), transparent 36%, rgba(6, 24, 41, .22));
  pointer-events: none;
}

.ui-one .preview::before,
.ui-two .preview::before {
  background: linear-gradient(90deg, rgba(246, 250, 253, .2), transparent 62%, rgba(8, 34, 58, .08));
}

.mini-rail,
.mini-panel,
.mini-selector,
.mini-info,
.mini-actions,
.mini-bottom-actions {
  position: absolute;
  z-index: 2;
}

.mini-line {
  display: block;
  height: 4px;
  border-radius: 5px;
  background: #9aabb9;
}

.mini-line + .mini-line { margin-top: 6px; }
.mini-line.short { width: 62%; }
.mini-line.tiny { width: 38%; }

.mini-swatch-row {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}

.mini-swatch {
  width: clamp(9px, 1.05vw, 14px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 50%;
  background: #1f6fb6;
  box-shadow: 0 0 0 1px rgba(18, 48, 73, .22);
}

.mini-swatch:nth-child(2) { background: #c6d0d8; }
.mini-swatch:nth-child(3) { background: #1e2d3a; }

.mini-thumb {
  display: block;
  width: clamp(22px, 3vw, 36px);
  aspect-ratio: .64;
  flex: 0 0 auto;
  background: var(--bottle-image) center / contain no-repeat;
}

.mini-icon {
  position: relative;
  display: block;
  width: clamp(19px, 2.1vw, 27px);
  aspect-ratio: 1;
  border: 1px solid #c2ced9;
  border-radius: 5px;
  background: #fff;
}

.mini-icon::before,
.mini-icon::after {
  content: "";
  position: absolute;
  background: #7890a4;
  border-radius: 4px;
}

.mini-icon::before { width: 42%; height: 2px; left: 29%; top: calc(50% - 1px); }
.mini-icon::after { width: 2px; height: 42%; left: calc(50% - 1px); top: 29%; }

/* Diseño 1: categorías / producto y configuración / escena 3D */
.layout-one .categories {
  inset: 0 auto 0 0;
  width: 15%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(9px, 1.2vw, 15px);
  padding-top: clamp(15px, 1.6vw, 23px);
  background: #f7fafc;
  border-right: 1px solid #c5d1dc;
}

.layout-one .categories .mini-icon:first-child {
  border-color: #79a9d4;
  background: #e3f0fb;
}

.layout-one .config {
  inset: 0 auto 0 15%;
  width: 29%;
  padding: clamp(13px, 1.4vw, 20px) clamp(8px, 1vw, 14px);
  background: rgba(241, 246, 250, .94);
  border-right: 1px solid #bdcbd7;
}

.layout-one .product-select {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 50px;
  margin-bottom: clamp(16px, 2vw, 25px);
  padding: 7px;
  border: 1px solid #c9d5df;
  border-radius: 6px;
  background: #fff;
}

.layout-one .product-select .mini-lines { flex: 1; }

.layout-one .control-group + .control-group {
  margin-top: clamp(14px, 1.7vw, 22px);
  padding-top: clamp(12px, 1.35vw, 18px);
  border-top: 1px solid #d2dce4;
}

.layout-one .stage {
  position: absolute;
  inset: 0 0 0 44%;
  overflow: hidden;
  background: #e1e8ee;
}

.layout-one .product-photo {
  background-position: 54% 52%;
  background-size: auto 78%;
}

.layout-one .stage::after,
.layout-two .stage::after,
.layout-three .stage::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 9%;
  height: 1px;
  background: rgba(42, 71, 95, .2);
}

/* Diseño 2: configuración lateral / selector superior / escena principal */
.layout-two { background: #d8e2ea; }

.layout-two .config {
  inset: 0 auto 0 0;
  width: 31%;
  padding: clamp(13px, 1.4vw, 20px) clamp(9px, 1vw, 15px);
  background: rgba(247, 250, 252, .96);
  border-right: 1px solid #b9c8d5;
}

.layout-two .panel-product {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: clamp(16px, 2vw, 26px);
  padding-bottom: clamp(13px, 1.4vw, 18px);
  border-bottom: 1px solid #d2dce4;
}

.layout-two .panel-product .mini-lines { flex: 1; }

.layout-two .control-group + .control-group { margin-top: clamp(14px, 1.7vw, 22px); }

.layout-two .stage {
  position: absolute;
  inset: 0 0 0 31%;
  overflow: hidden;
  background: #e1e8ee;
}

.layout-two .product-photo {
  background-position: 53% 58%;
  background-size: auto 83%;
}

.layout-two .selector {
  top: clamp(12px, 1.25vw, 18px);
  left: calc(31% + clamp(12px, 1.25vw, 18px));
  right: clamp(12px, 1.25vw, 18px);
  height: clamp(34px, 3.3vw, 43px);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid #bfccd7;
  border-radius: 6px;
  background: rgba(251, 253, 255, .96);
}

.layout-two .selector .mini-thumb { width: clamp(16px, 2vw, 27px); height: 100%; }
.layout-two .selector .mini-line { width: 24%; margin-left: 1px; }
.layout-two .selector .mini-line:last-child { width: 14%; margin-left: auto; }

/* Diseño 3: gran escena / información / acciones laterales e inferiores */
.layout-three { background: #e1e8ee; }

.layout-three::before {
  background: linear-gradient(90deg, rgba(246, 250, 253, .2), transparent 62%, rgba(8, 34, 58, .08));
}

.layout-three .stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #e1e8ee;
}

.layout-three .product-photo {
  background-position: 50% 53%;
  background-size: auto 88%;
}

.layout-three .info {
  top: clamp(13px, 1.45vw, 21px);
  left: clamp(13px, 1.45vw, 21px);
  width: min(34%, 145px);
  padding: clamp(9px, 1vw, 13px);
  border: 1px solid #c2ced9;
  border-radius: 6px;
  background: rgba(251, 253, 255, .96);
}

.layout-three .info .mini-line:first-child { width: 72%; }

.layout-three .actions {
  top: 50%;
  right: clamp(11px, 1.35vw, 19px);
  display: grid;
  gap: clamp(7px, .8vw, 10px);
  transform: translateY(-50%);
}

.layout-three .bottom-actions {
  left: 50%;
  bottom: clamp(13px, 1.35vw, 20px);
  display: flex;
  gap: clamp(7px, .8vw, 10px);
  transform: translateX(-50%);
}

.layout-three .bottom-actions span {
  display: block;
  width: clamp(22px, 2.35vw, 31px);
  height: clamp(18px, 1.8vw, 24px);
  border: 1px solid #c2ced9;
  border-radius: 5px;
  background: #fff;
}

.open-action {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--blue-deep);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.open-action svg {
  width: 17px;
  height: 17px;
  transition: transform 350ms var(--ease);
}

.design-frame:hover .open-action svg,
.design-frame:focus-visible .open-action svg { transform: translate(3px, -3px); }

.sheet-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: #647587;
  font-size: .7rem;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .page-shell { padding: 24px; }
  .masthead {
    grid-template-columns: 1fr 1.6fr;
    align-items: start;
  }
  .masthead h1 { grid-column: 1 / -1; grid-row: 2; margin-top: 8px; }
  .contact-sheet { min-height: 480px; }
  .preview { min-height: 355px; }
  .mini-line { height: 3px; }
  .layout-one .categories { width: 16%; }
  .layout-one .config { left: 16%; width: 30%; }
  .layout-one .stage { left: 46%; }
  .layout-two .config { width: 33%; }
  .layout-two .stage { left: 33%; }
  .layout-two .selector { left: calc(33% + 10px); right: 10px; }
}

@media (max-width: 720px) {
  body { background: var(--paper); }
  .page-shell {
    grid-template-columns: minmax(0, 1fr);
    width: 100vw;
    max-width: 100vw;
    padding: 20px 16px 28px;
    gap: 26px;
  }
  .masthead {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    gap: 21px;
    padding-bottom: 24px;
  }
  h1 { max-width: 12ch; font-size: clamp(2.5rem, 12vw, 4.5rem); }
  .intro { max-width: 34ch; margin: 0; }
  .contact-sheet {
    display: block;
    inline-size: calc(100vw - 32px);
    min-width: 0;
    max-width: calc(100vw - 32px);
    border: 0;
    background: transparent;
  }
  .design-frame {
    contain: inline-size;
    inline-size: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 565px;
    margin-bottom: 16px;
    border: 1px solid #aebcc9;
  }
  .preview { min-width: 0; min-height: 445px; }
  .frame-head, .frame-foot { width: 100%; min-width: 0; padding: 16px 14px; }
  .frame-foot { display: flex; justify-content: flex-end; }
  .open-action { flex: 0 0 auto; font-size: 0; white-space: nowrap; }
  .open-action::before { content: "Abrir"; font-size: .72rem; }
  .mini-line { height: 4px; }
  .layout-one .categories { width: 15%; }
  .layout-one .config { left: 15%; width: 29%; }
  .layout-one .stage { left: 44%; }
  .layout-two .config { width: 31%; }
  .layout-two .stage { left: 31%; }
  .layout-two .selector { left: calc(31% + 12px); right: 12px; }
  .sheet-footer { width: 100%; min-width: 0; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Diseñador: pestañas exteriores, ajustes y configurador en vistas separadas. */
[hidden] { display: none !important; }
button, select, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button, select, input[type="color"], input[type="checkbox"] { cursor: pointer; }
button { color: inherit; }
.icon { width: 22px; height: 22px; flex: 0 0 auto; }
.masthead { grid-template-columns: minmax(140px,.8fr) minmax(360px,1.8fr) minmax(240px,.85fr); }
.intro-actions { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 19px; }
.intro { margin: 0; }
.primary-button, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 46px; padding: 12px 21px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 700; line-height: 1.4; text-decoration: none; transition: background-color 150ms, border-color 150ms; }
.primary-button { color: #fff; background: var(--blue); }
.primary-button:hover { background: var(--blue-deep); }
.text-button { color: var(--blue); background: transparent; padding-inline: 8px; }
.text-button:hover { background: var(--blue-pale); }
#open-designer { width: 100%; white-space: nowrap; background: #165681; }
#open-designer:hover { background: #104366; }
#open-designer:active { background: #0c3653; }
.design-frame { border-radius: 5px; }
body.has-designer { overflow: hidden; }
.designer-dialog { --panel: #fafdff; --soft-line: #d8e3ee; width: min(1440px,92vw); max-width: none; max-height: none; height: min(830px,calc(100dvh - 48px)); margin: auto; padding: 0; border: 0; overflow: visible; color: var(--ink); background: transparent; }
.designer-dialog[open] { display: flex; flex-direction: column; }
.designer-dialog::backdrop { background: rgb(33 62 82 / 43%); backdrop-filter: blur(5px); }
.designer-tabs { display: flex; flex: 0 0 52px; align-items: stretch; padding-left: 25px; position: relative; z-index: 2; gap: 5px; }
.designer-tab { position: relative; padding: 0 28px; min-width: 220px; border: 1px solid #c4d4e2; border-bottom: 0; border-radius: 15px 15px 0 0; background: #e1eaf2; color: #35516b; font-size: 16px; font-weight: 700; }
.designer-tab:hover { background: #edf3f9; }
.designer-tab[aria-selected="true"] { color: var(--ink); background: var(--panel); border-color: var(--panel); }
/* El foco automático/táctil no dibuja un recuadro; el teclado conserva su indicador. */
.designer-tab:focus { outline: none; }
.designer-dialog.keyboard-navigation .designer-tab:focus { box-shadow: inset 0 0 0 2px var(--focus); }
.designer-surface { position: relative; flex: 1; min-height: 0; border: 1px solid #e1e9f1; border-radius: 18px; background: var(--panel); box-shadow: 0 22px 70px rgb(18 43 62 / 14%); overflow: hidden; }
.modal-close { position: absolute; top: 16px; right: 16px; z-index: 3; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; color: #234158; background: transparent; }
.modal-close:hover { background: #e8eff5; }
.settings-panel { height: 100%; display: flex; flex-direction: column; }
.settings-content { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 28px 8px; scrollbar-width: thin; scrollbar-color: #b5c8d8 transparent; }
.settings-heading { padding: 0 44px 18px 12px; }
.settings-heading h2 { font-size: clamp(28px,2.4vw,36px); font-weight: 800; letter-spacing: -.035em; line-height: 1.15; margin: 0 0 8px; }
.settings-heading p, .setting-card > p { margin: 0; color: #637d97; line-height: 1.5; }
.settings-heading p { font-size: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.setting-card { min-width: 0; border: 1px solid var(--soft-line); border-radius: 16px; padding: 18px 24px; background: #f8fbfe; }
.setting-card h3 { margin: 0 0 3px; font-size: 20px; letter-spacing: -.025em; line-height: 1.3; }
.setting-card > p { font-size: 13px; margin-bottom: 20px; }
.design-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.design-option { border: 0; background: transparent; color: #688099; padding: 0; font-size: 14px; font-weight: 700; }
.design-thumbnail { display: block; position: relative; border: 1px solid var(--soft-line); border-radius: 9px; padding: 16px; margin-bottom: 12px; background: #f4f8fc; }
.design-option[aria-pressed="true"] { color: var(--blue); }
.design-option[aria-pressed="true"] .design-thumbnail { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 1px var(--blue); }
.design-option:hover .design-thumbnail { background: #eef5fb; }
.selection-check { position: absolute; z-index: 2; pointer-events: none; top: 9px; right: 9px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 6px; background: var(--blue); color: #fff; opacity: 0; }
.selection-check .icon { width: 18px; height: 18px; }
[aria-pressed="true"] .selection-check { opacity: 1; }
.design-mini { position: relative; z-index: 0; display: grid; grid-template-columns: 10px 1fr 1.6fr; gap: 5px; height: 83px; }
.design-mini i { border-radius: 4px; background: #e5edf4; display: block; }
.design-mini .sketch-rail { background: #eaf1f7; }
.design-mini .sketch-controls { padding: 10px 6px; }
.sketch-controls b { display: block; height: 4px; border-radius: 3px; background: #a9c0d3; margin-bottom: 8px; }
.sketch-controls b:nth-child(2) { width: 65%; }
.design-mini .sketch-view { background: #d8e5f0; }
.mini-two { grid-template-columns: 1fr 2.1fr; grid-template-rows: 16px 1fr; }
.mini-two .sketch-rail { grid-column: 2; grid-row: 1; background: #c7d8e6; }
.mini-two .sketch-controls { grid-column: 1; grid-row: 1 / 3; }
.mini-two .sketch-view { grid-column: 2; grid-row: 2; }
.mini-three { grid-template-columns: 1fr 10px; position: relative; }
.mini-three .sketch-view { grid-column: 1 / 3; grid-row: 1; }
.mini-three .sketch-rail { grid-column: 2; grid-row: 1; margin: 35px 3px 5px 0; z-index: 1; }
.mini-three .sketch-controls { position: absolute; width: 55%; height: 31px; left: 6px; top: 6px; padding: 5px; background: #f5f9fc; }
.mini-three .sketch-controls b { height: 3px; margin-bottom: 4px; }
.language-checks { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px 12px; margin-bottom: 17px; }
.language-checks label { display: flex; gap: 11px; align-items: center; padding: 10px 12px; min-height: 44px; border: 1px solid var(--soft-line); border-radius: 8px; font-size: 13px; background: #fff; cursor: pointer; }
.language-checks label:has(input:checked) { border-color: #bfd3e7; }
.language-checks input { width: 20px; height: 20px; accent-color: var(--blue); flex: 0 0 auto; margin: 0; }
.select-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.language-trigger { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-width: 0; min-height: 42px; padding: 9px 12px; border: 1px solid #c5d6e5; border-radius: 10px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 650; line-height: 1.25; text-align: left; }
.language-trigger:hover, .language-trigger[aria-expanded="true"] { border-color: #83aac5; background: #f3f8fc; color: #165681; }
.language-trigger:focus-visible { outline: 2px solid rgb(20 123 193 / 24%); outline-offset: 2px; }
.language-chevron { flex-shrink: 0; width: 7px; height: 7px; margin: -3px 2px 0 5px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); transition: transform 150ms ease; }
.language-trigger[aria-expanded="true"] .language-chevron { margin-top: 3px; transform: rotate(225deg); }
.language-menu { position: fixed; z-index: 10; display: grid; gap: 3px; padding: 5px; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #d6e1e9; border-radius: 11px; color: var(--ink); background: rgb(255 255 255 / 98%); box-shadow: 0 14px 34px rgb(11 45 69 / 13%); backdrop-filter: blur(14px); scrollbar-width: thin; }
.language-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 7px 10px; border-radius: 8px; font-size: 14px; font-weight: 620; line-height: 1.25; cursor: pointer; }
.language-option::after { content: '✓'; color: #147bc1; opacity: 0; }
.language-option[aria-selected="true"]::after { opacity: 1; }
.language-option:hover, .language-option.is-active, .language-option[aria-selected="true"] { color: #165681; background: #edf5fb; }
.language-option.is-active { box-shadow: inset 0 0 0 1px #c5d6e5; }
.color-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px 22px; }
.color-control { display: grid; gap: 7px; font-size: 13px; font-weight: 700; min-width: 0; }
.color-control input[type="color"] { display: block; width: 100%; height: 47px; padding: 0; border: 1px solid #bfd1e1; border-radius: 8px; overflow: hidden; background: transparent; }
.color-control input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-control input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.color-control input[type="color"]::-moz-color-swatch { border: 0; border-radius: 6px; }
.button-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.button-option { position: relative; display: flex; flex-direction: column; align-items: stretch; padding: 16px; min-height: 140px; border: 1px solid var(--soft-line); border-radius: 9px; background: #fff; text-align: left; }
.button-option[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.button-option:hover { background: #f1f7fc; }
.option-label { display: block; font-size: 14px; font-weight: 700; padding-right: 24px; }
.example-button { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 54px; align-self: center; padding: 12px 20px; border-radius: 8px; margin: 18px 0 0; background: var(--blue); color: #fff; font-size: 18px; font-weight: 600; }
.example-icon { padding-inline: 17px; }
.panel-status { color: #536f86; font-size: 13px; margin: 12px 4px 4px; }
.settings-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-shrink: 0; padding: 11px 0 13px; margin: 0 28px; border-top: 1px solid var(--soft-line); }
.configurator-panel { height: 100%; display: flex; flex-direction: column; }
.configurator-heading { flex-shrink: 0; padding: 19px 72px 19px 24px; display: flex; gap: 16px; align-items: center; border-bottom: 1px solid var(--soft-line); }
.configurator-heading h2 { margin: 0; font-size: 16px; }
#design-caption { font-size: 13px; color: var(--muted); }
.preview-stage { position: relative; flex: 1; min-height: 0; background: #e9eef2; overflow: hidden; }
.preview-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.preview-loading { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; padding: 24px; text-align: center; background: #f4f7fa; }
.preview-loading strong { font-size: 20px; }
.preview-loading p { max-width: 470px; font-size: 14px; color: var(--muted); line-height: 1.7; margin: 0; }
.preview-footer { display: flex; justify-content: space-between; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--soft-line); color: var(--muted); font-size: 12px; }
.spinner { width: 34px; height: 34px; border: 3px solid #d3e2ef; border-top-color: var(--blue); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1100px) {
  .masthead { grid-template-columns: 1fr 1fr; }
  .masthead h1 { grid-column: 1 / -1; grid-row: 2; }
  .intro-actions { grid-column: 2; grid-row: 1; max-width: 340px; justify-self: end; }
  .intro { max-width: none; }
  .settings-content { padding: 25px 20px 8px; }
  .setting-card { padding: 18px; }
  .design-options { gap: 10px; }
  .design-thumbnail { padding: 12px 8px; }
  .language-checks { gap: 8px; }
  .language-checks label { padding: 10px 8px; gap: 7px; }
  .color-grid { gap: 12px; }
  .button-option { padding: 14px 12px; }
  .example-button { font-size: 16px; padding-inline: 13px; }
}
@media (max-width: 760px) {
  .designer-dialog { width: calc(100vw - 24px); height: calc(100dvh - 32px); }
  .designer-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 16px; gap: 6px; flex-basis: 46px; align-items: end; }
  .designer-tab { width: 100%; min-width: 0; max-width: none; height: 46px; padding: 0 8px; font-size: 13px; line-height: 1.2; border-radius: 12px 12px 0 0; border-color: #cad8e4; background: #e2eaf1; }
  .designer-tab[aria-selected="true"] { z-index: 1; bottom: -1px; border-color: #dce5ed; background: var(--panel); }
  .designer-surface { border-radius: 16px; }
  .settings-content { padding: 22px 14px 12px; }
  .settings-heading { padding: 0 30px 22px 4px; }
  .settings-heading h2 { font-size: 28px; }
  .settings-heading p { font-size: 14px; }
  .settings-grid { grid-template-columns: 1fr; gap: 12px; }
  .design-card { order: 0; }
  .palette-card { order: 1; }
  .language-card { order: 2; }
  .buttons-card { order: 3; }
  .setting-card { padding: 18px 16px; }
  .setting-card h3 { font-size: 19px; }
  .setting-card > p { margin-bottom: 17px; }
  .settings-footer { margin: 0 14px; gap: 5px; }
  .settings-footer .primary-button { font-size: 12px; padding: 12px; gap: 7px; }
  .settings-footer .text-button { font-size: 12px; gap: 7px; padding: 10px 4px; }
  .modal-close { right: 8px; top: 9px; width: 35px; height: 35px; }
  .language-checks { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .color-control { font-size: 12px; }
  .design-mini { height: 70px; grid-template-columns: 6px 1fr 1.5fr; gap: 3px; }
  .mini-two { grid-template-columns: 1fr 2.1fr; }
  .mini-three { grid-template-columns: 1fr 10px; }
  .preview-footer { padding: 10px 16px; }
  .preview-footer > span:last-child { display: none; }
  .configurator-heading { padding: 18px 46px 18px 16px; gap: 9px; }
  .configurator-heading h2 { font-size: 14px; }
  #design-caption { font-size: 12px; }
}
@media (max-width: 720px) {
  .buttons-card { display: none; }
  .intro-actions { max-width: 100%; width: 100%; gap: 16px; }
  .intro { max-width: 36ch; }
  #open-designer { width: 100%; min-height: 48px; padding: 13px 18px; align-self: start; }
  .masthead h1 { margin-top: 0; max-width: none; font-size: clamp(35px,8.5vw,60px); }
}
@media (max-width: 380px) {
  .settings-content { padding-inline: 10px; }
  .setting-card { padding-inline: 12px; }
  .color-grid { gap: 12px 8px; }
  .button-options { gap: 10px; }
  .button-option { padding: 12px 9px; }
  .option-label { font-size: 12px; }
  .example-button { padding: 10px; font-size: 14px; }
  .selection-check { width: 20px; height: 20px; top: 7px; right: 7px; }
  .settings-footer .primary-button { padding-inline: 9px; }
  .settings-footer .icon { width: 18px; height: 18px; }
}
@media (min-width: 761px) and (max-height: 820px) {
  .settings-content { padding-top: 22px; }
  .settings-heading { padding-bottom: 18px; }
  .settings-heading h2 { font-size: 32px; }
  .settings-heading p { font-size: 14px; }
  .setting-card { padding: 15px 20px; }
  .setting-card h3 { font-size: 18px; }
  .setting-card > p { margin-bottom: 14px; font-size: 12px; }
  .design-mini { height: 64px; }
  .design-thumbnail { padding-top: 12px; padding-bottom: 12px; }
  .language-checks { margin-bottom: 12px; gap: 7px 10px; }
  .language-checks label { min-height: 37px; padding-block: 7px; }
  .language-checks input { width: 18px; height: 18px; }
  .language-trigger { min-height: 36px; padding-block: 6px; }
  .color-control input[type="color"] { height: 36px; }
  .color-grid { gap: 9px 18px; }
  .button-option { min-height: 118px; padding: 12px 14px; }
  .example-button { min-height: 46px; margin-top: 13px; font-size: 16px; }
}

/* Evita seleccionar la interfaz al arrastrar en pantallas táctiles.
   No cambia touch-action ni los eventos de desplazamiento/rotación. */
@media (any-pointer: coarse) {
  .designer-dialog,
  .designer-dialog *,
  #open-designer,
  #open-designer * {
    -webkit-user-select: none;
    user-select: none;
  }

  /* Incluye campos de solo lectura, como el enlace para compartir. */
  .designer-dialog :is(input, textarea, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]),
  .designer-dialog :is(input, textarea, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]) * {
    -webkit-user-select: text;
    user-select: text;
  }
}

/* Acciones de configuración integradas en el pie del panel. */
.settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.settings-actions > button { white-space: nowrap; }
.settings-footer > #reset-demo { flex-shrink: 0; }
.exchange-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 11px 16px; border: 1px solid #c5d6e5; border-radius: 10px; background: #fff; color: #234158; font-size: 13px; font-weight: 700; line-height: 1.4; }
.exchange-button:hover { background: #f5f9fc; border-color: #9dbbd0; }
.exchange-button .icon { width: 19px; height: 19px; }
.exchange-button:disabled { opacity: .6; cursor: progress; }
.preview-footer { align-items: center; padding-block: 6px; }
.preview-footer > #preview-status { min-width: 0; }
.preview-footer > #share-preview { display: inline-flex; flex-shrink: 0; min-height: 44px; padding: 8px 10px; font-size: 12px; color: #165681; }
.share-dialog { box-sizing: border-box; width: min(480px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 30px; overflow-y: auto; border: 1px solid #d8e3ee; border-radius: 20px; color: var(--ink); background: #fafdff; box-shadow: 0 22px 70px rgb(18 43 62 / 22%); }
.share-dialog::backdrop { background: rgb(33 62 82 / 35%); backdrop-filter: blur(3px); }
.share-dialog h2 { margin: 0 30px 10px 0; font-size: 25px; line-height: 1.2; letter-spacing: -.03em; }
.share-dialog > p { color: #637d97; font-size: 14px; line-height: 1.6; }
.share-dialog label { display: block; margin: 22px 0 8px; font-size: 13px; font-weight: 700; }
#configuration-link { box-sizing: border-box; width: 100%; min-width: 0; min-height: 46px; padding: 12px; border: 1px solid #bfd1e1; border-radius: 10px; background: #fff; color: #234158; font-size: 16px; cursor: text; -webkit-user-select: text; user-select: text; }
#copy-configuration-link { width: 100%; margin-top: 12px; }
#view-configurator, #share-configuration, #copy-configuration-link { color: #fff; background: #165681; border-color: transparent; }
#view-configurator:hover, #share-configuration:hover, #copy-configuration-link:hover { background: #104366; border-color: transparent; }
.share-dialog .share-status { margin: 12px 0 0; font-size: 13px; color: #234158; }
.share-dialog .share-note { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid #d8e3ee; font-size: 12px; }
@media (max-width: 760px) {
  .settings-footer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding: 10px 0; }
  .settings-actions { display: contents; }
  .settings-actions > button { width: 100%; min-width: 0; }
  #import-configuration { grid-column: 1; grid-row: 1; }
  #export-configuration { grid-column: 2; grid-row: 1; }
  #share-configuration { grid-column: 3; grid-row: 1; }
  .settings-footer > #reset-demo { grid-column: 1; grid-row: 2; min-width: 0; }
  .settings-footer > #reset-demo .icon { display: none; }
  #view-configurator { grid-column: 2 / -1; grid-row: 2; }
  .exchange-button { padding-inline: 8px; font-size: 12px; gap: 6px; }
  .preview-footer { gap: 4px; padding-inline: 12px; }
  .preview-footer > #preview-status { font-size: 11px; }
  .preview-footer > #share-preview { max-width: 52%; padding-inline: 6px; font-size: 11px; text-align: center; }
  .share-dialog { padding: 24px 20px; }
  .share-dialog h2 { font-size: 23px; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  .settings-footer { margin-inline: 20px; gap: 8px; }
  .settings-actions { gap: 6px; }
  .settings-footer .primary-button, .settings-footer .text-button, .settings-footer .exchange-button { padding-inline: 10px; font-size: 12px; gap: 6px; }
  .settings-footer .icon { width: 18px; height: 18px; }
}
@media (max-width: 380px) {
  .settings-actions .exchange-button { padding-inline: 4px; gap: 4px; font-size: 11px; }
  .settings-actions .exchange-button .icon { width: 16px; height: 16px; }
}
@media (any-pointer: coarse) {
  .share-dialog { -webkit-user-select: none; user-select: none; }
  .share-dialog input { -webkit-user-select: text; user-select: text; }
}

/* Medidas y fondo del widget original (src/widget/widget.ts). */
.designer-dialog.demo-widget {
  position: fixed;
  inset: 0;
  width: 90vw;
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 28px 90px color-mix(in srgb, #0b2d45 24%, transparent);
}
.designer-dialog.demo-widget::backdrop { background: color-mix(in srgb, #0b2d45 58%, transparent); backdrop-filter: blur(4px); }
.demo-widget .designer-surface { border: 0; border-radius: 0; box-shadow: none; }
.demo-widget .configurator-heading { display: none; }
.demo-widget .preview-stage { border-radius: 0; }
.demo-widget > .designer-surface > .modal-close {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 40px;
  height: 40px;
}
.demo-widget > .designer-surface > .modal-close:focus { outline: none; }
.demo-widget.keyboard-navigation > .designer-surface > .modal-close:focus {
  outline: 2px solid var(--focus);
  outline-offset: -4px;
}

@media (max-height: 620px) and (min-width: 901px) {
  .designer-dialog.demo-widget { width: calc(100vw - 24px); height: calc(100dvh - 24px); border-radius: 14px; }
}
@media (max-width: 720px) {
  .designer-dialog.demo-widget { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}
.designer-dialog.demo-widget.demo-widget-mobile { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
.designer-dialog.mobile-device .buttons-card { display: none; }
