* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: #fafaf7;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

/* === NAV (из других страниц промптбука) === */
.nav {
  padding: 18px 6vw; display: flex; justify-content: space-between; align-items: center;
  background: rgba(250,250,247,0.92); backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  position: sticky; top: 0; z-index: 100;
}
.nav-brand {
  font: 600 13px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.15em; text-transform: uppercase; text-decoration: none; color: inherit;
}
.nav-brand .star { color: #c97c50; }
.nav-cta {
  font: 600 12px/1 'JetBrains Mono'; letter-spacing: 0.15em;
  text-transform: uppercase; text-decoration: none; color: inherit;
  padding: 10px 18px; border: 1px solid #1a1a1a; border-radius: 100px;
}
.nav-cta:hover { background: #1a1a1a; color: white; }

/* === STUDIO === */
.studio { max-width: 1280px; margin: 0 auto; padding: 24px 6vw 60px; }

.label {
  font: 600 11px/1 'JetBrains Mono';
  letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(0,0,0,0.5);
}
.hint { font: 400 11px/1.4 'JetBrains Mono'; color: rgba(0,0,0,0.4); letter-spacing: 0.05em; }

/* Sets carousel */
.sets-row { margin-bottom: 18px; }
.sets-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.sets {
  display: flex; gap: 12px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.sets::-webkit-scrollbar { height: 4px; }
.sets::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }
.set-card {
  min-width: 200px; max-width: 200px; flex-shrink: 0;
  background: #fff; border: 2px solid transparent; border-radius: 8px;
  padding: 10px; cursor: pointer; transition: border-color 0.15s, transform 0.15s;
  scroll-snap-align: start;
}
.set-card:hover { transform: translateY(-2px); }
.set-card.selected { border-color: #c97c50; background: #fff8f3; }
.set-card.disabled { opacity: 0.45; cursor: not-allowed; }
.set-card.coming-soon { opacity: 0.55; cursor: not-allowed; }
.set-card.coming-soon:hover { transform: none; }
.set-card .soon-badge {
  position: absolute; top: 6px; left: 6px;
  font: 600 9px/1 'JetBrains Mono'; letter-spacing: 0.15em; text-transform: uppercase;
  padding: 4px 8px; background: rgba(255,255,255,0.92); color: #1a1a1a;
  border-radius: 100px;
}
.set-card .cover {
  width: 100%; aspect-ratio: 4/3; border-radius: 5px;
  background: linear-gradient(135deg, #c97c50, #8a4a2c);
  background-size: cover; background-position: center;
  position: relative;
}
.set-card .frames-badge {
  position: absolute; bottom: 6px; right: 6px;
  font: 600 9px/1 'JetBrains Mono'; letter-spacing: 0.1em;
  padding: 3px 7px; background: rgba(0,0,0,0.6); color: white; border-radius: 100px;
}
.set-card .name {
  font: italic 600 16px/1.2 'Playfair Display';
  margin-top: 8px;
}
.set-card.selected .name { color: #c97c50; }
.set-card .sub {
  font: 400 11px/1.3 'Inter';
  color: rgba(0,0,0,0.5); margin-top: 2px;
}
.set-card .muse {
  font: 500 10px/1.2 'JetBrains Mono';
  letter-spacing: 0.05em;
  color: rgba(0,0,0,0.4);
  margin-top: 4px;
}

/* Layout cols */
.cols { display: grid; grid-template-columns: 360px 1fr; gap: 18px; }
.block { background: #fff; border-radius: 8px; padding: 18px; }

/* Photo grid (4 slots default, 2x2) */
.photo-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin: 12px 0;
}
.photo-slot {
  aspect-ratio: 1/1; border-radius: 5px;
  background: #fafaf7; border: 2px dashed rgba(0,0,0,0.18);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.photo-slot:hover, .photo-slot.dragover { border-color: #c97c50; background: #fff8f3; }
.photo-slot.filled { border-style: solid; border-color: rgba(0,0,0,0.06); padding: 0; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .plus { font: 300 28px/1 'Inter'; color: rgba(0,0,0,0.3); }
.photo-slot .remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: white;
  display: none; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
}
.photo-slot.filled .remove { display: flex; }
.add-slot {
  aspect-ratio: 1/1; border: 1px dashed rgba(0,0,0,0.18); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: rgba(0,0,0,0.4); font: 600 10px/1 'JetBrains Mono';
  letter-spacing: 0.15em; text-transform: uppercase;
}
.add-slot:hover { background: #fff8f3; color: #c97c50; }

.btn-generate {
  width: 100%; margin-top: 14px; padding: 14px;
  background: #c97c50; color: white;
  font: 600 13px/1 'JetBrains Mono'; letter-spacing: 0.2em; text-transform: uppercase;
  border-radius: 100px; transition: background 0.15s, opacity 0.15s;
}
.btn-generate:hover { background: #b56b40; }
.btn-generate:disabled { background: rgba(0,0,0,0.1); color: rgba(0,0,0,0.4); cursor: not-allowed; }
.cost-hint { text-align: center; font: 400 11px/1.4 'JetBrains Mono'; color: rgba(0,0,0,0.4); margin-top: 8px; }

/* Model select под Generate */
.model-select-wrap {
  display: flex; flex-direction: column; gap: 5px;
  margin-top: 12px;
}
.model-select-wrap .label { font-size: 10px; }
.model-select {
  appearance: none; -webkit-appearance: none;
  width: 100%; padding: 9px 32px 9px 12px;
  background: #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1L6 6L11 1' stroke='%23999' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid rgba(0,0,0,0.1); border-radius: 6px;
  font: 500 12px/1.2 'JetBrains Mono', monospace;
  color: #1a1a1a; cursor: pointer;
  transition: border-color 0.15s;
}
.model-select:hover { border-color: #c97c50; }
.model-select:focus { outline: none; border-color: #c97c50; box-shadow: 0 0 0 3px rgba(201,124,80,0.15); }
.model-select:disabled { opacity: 0.5; cursor: not-allowed; }

/* Result grid */
.result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.toolbar { display: flex; gap: 6px; }
.ico {
  width: 32px; height: 32px; border-radius: 5px;
  background: #fff; border: 1px solid rgba(0,0,0,0.1);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; color: rgba(0,0,0,0.6);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ico:hover { border-color: #c97c50; color: #c97c50; }
.ico.on { background: #c97c50; color: white; border-color: #c97c50; }
.ico:disabled { opacity: 0.4; cursor: not-allowed; }
.col-right { background: #1a1a1a; color: #e8e8e8; border-radius: 8px; padding: 18px; position: relative; min-height: 600px; }
.col-right .label { color: rgba(255,255,255,0.55); }
.col-right .ico { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); }
.col-right .ico.on { background: #c97c50; color: white; border-color: #c97c50; }
.result-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.frame-slot {
  aspect-ratio: 3/4; border-radius: 5px;
  background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.35);
  font: italic 800 36px/1 'Playfair Display';
  cursor: pointer; position: relative; overflow: hidden;
}
.frame-slot.loading {
  background: linear-gradient(90deg, #1f1f1f, #2f2f2f, #1f1f1f);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
.frame-slot.error { color: #e8745a; }
.frame-slot.ready img { width: 100%; height: 100%; object-fit: cover; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Lightbox */
.lightbox {
  position: absolute; inset: 0; background: rgba(0,0,0,0.95);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 30px 60px 80px;
}
.lightbox[hidden] { display: none; }
.lb-image { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lb-close, .lb-arrow {
  position: absolute; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; transition: background 0.15s;
}
.lb-close:hover, .lb-arrow:hover { background: rgba(255,255,255,0.25); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { top: 50%; left: 12px; transform: translateY(-50%); }
.lb-next { top: 50%; right: 12px; transform: translateY(-50%); }
.lb-counter {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  font: 600 11px/1 'JetBrains Mono'; letter-spacing: 0.2em; color: rgba(255,255,255,0.7);
  padding: 6px 14px; background: rgba(0,0,0,0.4); border-radius: 100px;
}
.lb-strip {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px;
}
.lb-strip .thumb {
  width: 38px; aspect-ratio: 3/4; border-radius: 3px;
  background: rgba(255,255,255,0.1); cursor: pointer; opacity: 0.5;
  overflow: hidden;
}
.lb-strip .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb-strip .thumb.active { opacity: 1; outline: 2px solid #c97c50; outline-offset: 1px; }

/* === MOBILE === */
@media (max-width: 767px) {
  .studio { padding: 16px 4vw 100px; }
  .cols { grid-template-columns: 1fr; gap: 12px; }
  .col-right { min-height: 0; padding: 12px; }

  /* Sets — крупные карточки, 1.7 видно */
  .set-card { min-width: 56vw; max-width: 56vw; }
  .set-card .cover { aspect-ratio: 4/3; }

  /* Фото — 4 в строку */
  .photo-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .add-slot { display: none; } /* На мобилке +Add возможен через long-press, пока — только 4 слота. См. Task 10 */

  /* Generate — sticky к низу */
  .btn-generate {
    position: sticky; bottom: 12px; z-index: 10;
    box-shadow: 0 10px 24px -8px rgba(201,124,80,0.5);
  }

  /* Lightbox — fullscreen */
  .lightbox {
    position: fixed; inset: 0; border-radius: 0;
    padding: 60px 16px 90px;
  }
}

/* Очень мелкие — 2 в строку для photo-grid если меньше 320px */
@media (max-width: 359px) {
  .photo-grid { grid-template-columns: 1fr 1fr; }
}
