.design-panel[hidden],
.eye-selector[hidden],
.design-composer[hidden] {
  display: none !important;
}

body.design-mode {
  overflow: hidden;
  background: #eaf1f5;
}

body.design-mode .app-viewport {
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
}

.design-panel {
  width: min(100%, 700px);
  height: min(980px, calc(100svh - 20px));
  min-height: 560px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(190, 211, 225, 0.9);
  border-radius: clamp(22px, 3.8vw, 34px);
  background: #fff;
  box-shadow: var(--shadow);
}

.design-header {
  min-height: 72px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  padding: 10px 16px 8px;
}

.design-back-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0 0 5px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--interojo-blue-deep);
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.design-back-button:hover {
  background: #edf5fa;
}

.design-back-button:focus-visible {
  outline: 3px solid rgba(7, 88, 143, 0.2);
  outline-offset: 2px;
}

.design-home-button {
  justify-self: center;
  width: min(55%, 220px);
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.design-home-button:focus-visible {
  outline: 3px solid rgba(7, 88, 143, 0.2);
  outline-offset: 5px;
  border-radius: 8px;
}

.design-brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.eye-selector {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: clamp(10px, 2.4vh, 24px) clamp(16px, 4.5vw, 34px) clamp(22px, 4vh, 36px);
}

.eye-selector-copy {
  margin-bottom: clamp(18px, 3vh, 30px);
  text-align: center;
}

.eye-selector-copy h2 {
  margin: 0;
  color: #11283b;
  font-size: clamp(1.35rem, 3.6vw, 1.9rem);
  line-height: 1.35;
  letter-spacing: -0.045em;
  word-break: keep-all;
}

.eye-selector-copy p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: clamp(0.75rem, 1.9vw, 0.9rem);
  line-height: 1.5;
}

.eye-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2.5vw, 20px);
}

.eye-choice-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 6px 10px;
  overflow: hidden;
  border: 1px solid #d6e2ea;
  border-radius: 18px;
  background: #fff;
  color: #173247;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(28, 74, 104, 0.06);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

.eye-choice-card:hover {
  transform: translateY(-2px);
  border-color: rgba(7, 88, 143, 0.58);
  box-shadow: 0 14px 28px rgba(28, 74, 104, 0.12);
}

.eye-choice-card:focus-visible {
  outline: 4px solid rgba(7, 88, 143, 0.18);
  outline-offset: 3px;
}

.eye-choice-card img {
  width: 100%;
  aspect-ratio: 5001 / 3099;
  display: block;
  object-fit: cover;
  border-radius: 13px;
  background: #eef3f6;
}

.eye-choice-card span {
  padding-top: 8px;
  font-size: clamp(0.74rem, 2vw, 0.88rem);
  font-weight: 850;
  letter-spacing: 0.05em;
  text-align: center;
}

.design-composer {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.design-stage {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 5001 / 3099;
  margin: 0 16px;
  overflow: hidden;
  border-radius: 19px;
  background: #e7edf1;
}

#designCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #eef2f4;
}

.design-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(13, 35, 51, 0.36);
  color: #fff;
  font-size: clamp(0.82rem, 2.2vw, 1rem);
  font-weight: 800;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition: opacity 160ms ease;
}

.design-loading.ready {
  opacity: 0;
  pointer-events: none;
}

.design-selected-name {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  min-width: 56px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: rgba(7, 30, 47, 0.62);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-align: center;
  backdrop-filter: blur(8px);
}

.design-camera-shot {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 4;
  width: 54px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.design-camera-shot img {
  width: 39px;
  height: 31px;
  display: block;
  object-fit: contain;
  filter: none;
}

.design-camera-shot span {
  font-size: 0.61rem;
  font-weight: 850;
  line-height: 1;
  text-shadow: none;
}

.design-camera-shot:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 3px;
  border-radius: 10px;
}

.design-camera-shot:active {
  transform: scale(0.96);
}

.design-camera-shot:disabled {
  opacity: 0.58;
  cursor: wait;
}

.design-opacity-controls {
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.design-opacity-button {
  width: 44px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding: 5px 3px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  text-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.design-opacity-button.active {
  background: transparent;
  color: #fff;
}

.design-opacity-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.design-opacity-button > span:last-child {
  font-size: 0.64rem;
  font-weight: 850;
  line-height: 1;
}

.design-drop-icon {
  width: 24px;
  height: 24px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 60% 0 60% 60%;
  transform: rotate(-45deg);
  background-repeat: no-repeat;
}

.design-drop-icon.fill-one-third {
  background-image: linear-gradient(45deg, currentColor 0 33.333%, transparent 33.333% 100%);
}

.design-drop-icon.fill-two-thirds {
  background-image: linear-gradient(45deg, currentColor 0 66.667%, transparent 66.667% 100%);
}

.design-color-picker {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 13px 16px 2px;
  background: #fff;
}

.design-color-title {
  color: #617787;
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.design-layer-tabs {
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 1px;
}

.design-layer-tab {
  min-width: 69px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #d4e0e7;
  border-radius: 999px;
  background: #f7fafc;
  color: #657a89;
  font-size: 0.57rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.design-layer-tab.active {
  border-color: var(--interojo-blue);
  background: #eef7fc;
  color: var(--interojo-blue);
  box-shadow: 0 0 0 1px rgba(7, 88, 143, 0.1);
}

.design-layer-tab:focus-visible {
  outline: 2px solid rgba(7, 88, 143, 0.35);
  outline-offset: 2px;
}

.design-layer-indicator {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: var(--layer-color);
  box-shadow: 0 0 0 1px #c7d5de;
}

.design-layer-indicator.is-original {
  background: conic-gradient(from 20deg, #9b6b4b, #778288, #4c7f90, #ad7180, #718b72, #9b6b4b);
}

.design-color-chips {
  max-width: 100%;
  display: flex;
  justify-content: center;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 5px 10px;
  scrollbar-width: none;
}

.design-color-chips::-webkit-scrollbar {
  display: none;
}

.design-color-chip {
  width: 44px;
  flex: 0 0 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #647887;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.design-color-swatch {
  width: 30px;
  height: 30px;
  display: block;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--chip-color);
  box-shadow: 0 0 0 1px #cbd8e1, 0 3px 9px rgba(31, 56, 73, 0.13);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.design-color-chip.is-original .design-color-swatch {
  background: conic-gradient(
    from 20deg,
    #9b6b4b,
    #778288,
    #4c7f90,
    #ad7180,
    #718b72,
    #9b6b4b
  );
}

.design-color-chip span:last-child {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1;
}

.design-color-chip:hover .design-color-swatch,
.design-color-chip:focus-visible .design-color-swatch {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(7, 88, 143, 0.24), 0 4px 10px rgba(31, 56, 73, 0.16);
}

.design-color-chip:focus-visible {
  outline: none;
}

.design-color-chip.active {
  color: var(--interojo-blue);
}

.design-color-chip.active .design-color-swatch {
  box-shadow: 0 0 0 3px var(--interojo-blue), 0 4px 10px rgba(31, 56, 73, 0.18);
  transform: scale(1.06);
}

.design-lens-dock {
  padding-top: 11px;
}

@media (min-width: 700px) {
  .design-header {
    min-height: 82px;
    padding-inline: 22px;
  }

  .design-stage {
    margin-inline: 22px;
    border-radius: 23px;
  }
}

@media (max-width: 520px) {
  body.design-mode .app-viewport {
    padding: 0;
  }

  .design-panel {
    width: 100%;
    height: 100svh;
    min-height: 520px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .design-header {
    min-height: 62px;
    padding: max(5px, env(safe-area-inset-top)) 10px 5px;
  }

  .design-home-button {
    width: min(52%, 190px);
  }

  .eye-selector {
    padding: 9px 12px max(18px, env(safe-area-inset-bottom));
  }

  .eye-selector-copy {
    margin-bottom: 16px;
  }

  .eye-selector-copy h2 {
    font-size: clamp(1.18rem, 5.5vw, 1.46rem);
  }

  .eye-grid {
    gap: 10px;
  }

  .eye-choice-card {
    padding: 4px 4px 8px;
    border-radius: 14px;
  }

  .eye-choice-card img {
    border-radius: 10px;
  }

  .design-stage {
    margin: 0 10px;
    border-radius: 14px;
  }

  .design-selected-name {
    top: 10px;
    right: 10px;
  }

  .design-camera-shot {
    left: 10px;
    bottom: 10px;
    width: 50px;
    min-height: 52px;
  }

  .design-camera-shot img {
    width: 35px;
    height: 28px;
  }

  .design-opacity-controls {
    right: 10px;
    bottom: 9px;
    gap: 7px;
  }

  .design-opacity-button {
    width: 40px;
    min-height: 52px;
  }

  .design-drop-icon {
    width: 22px;
    height: 22px;
  }

  .design-lens-dock {
    padding-top: 9px;
  }

  .design-color-picker {
    gap: 5px;
    padding: 9px 9px 1px;
  }

  .design-layer-tabs {
    gap: 5px;
  }

  .design-layer-tab {
    min-width: 64px;
    height: 25px;
    padding-inline: 8px;
  }

  .design-color-chips {
    justify-content: flex-start;
    gap: 7px;
    padding: 8px 5px 9px;
  }

  .design-color-chip {
    width: 42px;
    flex-basis: 42px;
  }

  .design-color-swatch {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 390px) {
  .eye-selector-copy p {
    font-size: 0.7rem;
  }

  .eye-choice-card span {
    padding-top: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .eye-choice-card,
  .design-loading {
    transition: none;
  }
}
