/* =========================================================
   Модуль — Генератор цветовых сочетаний на нейросети
   Стиль по modul_design.md
   ========================================================= */

.main--palette {
  max-width: 1320px;
}

.palette-app {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

/* 5-Color Swatch Strip */
.pbpal-strip-wrapper {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.pbpal-strip {
  display: flex;
  width: 100%;
}

.pbpal-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--hairline);
}

.pbpal-col:last-child {
  border-right: none;
}

.pbpal-swatch {
  display: block;
  width: 100%;
  height: 220px;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: background-color 0.4s var(--ease), opacity 0.2s;
  position: relative;
}

.pbpal-swatch:hover {
  opacity: 0.94;
}

.pbpal-swatch:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.pbpal-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--paper);
  border-top: 1px solid var(--hairline);
  white-space: nowrap;
}

.pbpal-code {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-transform: uppercase;
  transition: color var(--base) var(--ease);
}

.pbpal-code:hover {
  color: var(--muted);
  text-decoration: underline;
}

.pbpal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all var(--fast) var(--ease);
}

.pbpal-btn:hover {
  color: var(--ink);
  background: var(--tile);
  border-color: var(--hairline);
}

.pbpal-btn:focus-visible {
  outline: 1px solid var(--ink);
}

.pbpal-lock.is-on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.pbpal-lock.is-on:hover {
  opacity: 0.88;
}

.pbpal-edit.is-on {
  background: var(--tile);
  color: var(--ink);
  border-color: var(--ink);
}

.pbpal-col:first-child .pbpal-left {
  visibility: hidden;
}

.pbpal-col:last-child .pbpal-right {
  visibility: hidden;
}

/* Action Bar */
.pbpal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 16px 20px;
  background: var(--tile);
  border: 1px solid var(--hairline);
  border-radius: 12px;
}

.pbpal-action {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.pbpal-generate {
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
}

.pbpal-generate.is-loading svg {
  animation: pbpal-spin 0.7s linear infinite;
}

@keyframes pbpal-spin {
  100% { transform: rotate(360deg); }
}

.pbpal-kbd-hint {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pbpal-kbd-hint kbd {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  color: var(--ink);
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.pbpal-desc-group {
  display: flex;
  gap: 24px;
  flex: 1;
}

.pbpal-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  flex: 1;
}

/* Cards (Wheel and Tips) */
.pbpal-card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.pbpal-card-title {
  margin: 0 0 18px 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* Wheel Section */
.pbpal-wheel {
  display: flex;
  align-items: flex-start;
  gap: 40px;
}

.pbpal-wheel-left {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pbpal-wheel-holder {
  position: relative;
  width: 240px;
  height: 240px;
}

.pbpal-wheel-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  cursor: crosshair;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.pbpal-wheel-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
  left: 50%;
  top: 50%;
}

.pbpal-wheel-input-wrap {
  width: 140px;
}

.pbpal-wheel-hex {
  width: 100%;
  background: var(--tile);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 10px;
  outline: none;
  transition: border-color var(--base) var(--ease);
}

.pbpal-wheel-hex:focus {
  border-color: var(--ink);
}

.pbpal-wheel-right {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pbpal-schemes {
  display: flex;
  gap: 8px;
}

.pbpal-scheme {
  cursor: pointer;
}

.pbpal-scheme-colors {
  display: flex;
  gap: 12px;
}

.pbpal-sch-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  background: var(--tile);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
}

.pbpal-sch-swatch {
  display: block;
  width: 100%;
  height: 100px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.pbpal-sch-swatch:hover {
  opacity: 0.9;
}

.pbpal-wheel-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* Video Lesson */
.pbpal-wheel-video {
  flex: 0 0 240px;
  max-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pbpal-video-wrap {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.pbpal-video-player {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.pbpal-video-player:fullscreen {
  object-fit: contain;
  background: #000;
  width: 100vw;
  height: 100vh;
}

.pbpal-video-player:-webkit-full-screen {
  object-fit: contain;
  background: #000;
  width: 100vw;
  height: 100vh;
}

.pbpal-video-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pbpal-video-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.pbpal-video-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
}

/* Tips Section */
.pbpal-tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.pbpal-tip-card {
  background: var(--tile);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.pbpal-tip-info h3 {
  margin: 0 0 8px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.pbpal-tip-info p {
  margin: 0 0 8px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.pbpal-tip-info p:last-child {
  margin-bottom: 0;
}

.pbpal-tip-demos {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pbpal-demo {
  display: flex;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--hairline);
}

.pbpal-demo span {
  flex: 1 1 0;
  min-width: 0;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* Popover Picker */
.pbpal-pop {
  position: fixed;
  z-index: 9999;
  display: flex;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.pbpal-pop[hidden] {
  display: none;
}

.pbpal-sat {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 6px;
  cursor: crosshair;
  background-color: #f00;
  background-image:
    linear-gradient(to top, #000, rgba(0, 0, 0, 0)),
    linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
}

.pbpal-sat-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
  pointer-events: none;
  left: 50%;
  top: 50%;
}

.pbpal-hue {
  position: relative;
  width: 22px;
  height: 180px;
  border-radius: 6px;
  cursor: ns-resize;
  background: linear-gradient(to bottom,
    #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%,
    #00f 67%, #f0f 83%, #f00 100%);
}

.pbpal-hue-mark {
  position: absolute;
  left: -2px;
  right: -2px;
  height: 4px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
  transform: translateY(-50%);
  pointer-events: none;
  top: 0;
}

.pbpal-pop-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100px;
}

.pbpal-pop-prev {
  height: 52px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: #888888;
}

.pbpal-pop-hex {
  width: 100%;
  background: var(--tile);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 8px;
  outline: none;
}

.pbpal-pop-hex:focus {
  border-color: var(--ink);
}

/* Toast */
.pbpal-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 9999px;
  padding: 8px 16px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  animation: pbpal-toast-in 0.2s var(--ease);
}

.pbpal-toast[hidden] {
  display: none;
}

@keyframes pbpal-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 1100px) {
  .pbpal-tips-grid {
    grid-template-columns: 1fr;
  }
  .pbpal-wheel {
    flex-wrap: wrap;
    gap: 28px;
  }
  .pbpal-wheel-right {
    min-width: 260px;
  }
  .pbpal-wheel-video {
    flex: 1 1 100%;
    max-width: 280px;
    margin: 8px auto 0 auto;
  }
}

@media (max-width: 860px) {
  .pbpal-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .pbpal-desc-group {
    flex-direction: column;
    gap: 8px;
  }
  .pbpal-wheel {
    flex-direction: column;
    align-items: center;
  }
  .pbpal-wheel-right {
    width: 100%;
  }
  .pbpal-wheel-video {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .pbpal-strip {
    flex-direction: column;
  }
  .pbpal-swatch {
    height: 70px;
  }
  .pbpal-col {
    border-right: none;
    border-bottom: 1px solid var(--hairline);
  }
  .pbpal-col:last-child {
    border-bottom: none;
  }
  .pbpal-col:first-child .pbpal-left,
  .pbpal-col:last-child .pbpal-right {
    visibility: visible;
  }
}
