﻿.stage {
  margin-bottom: 32px;
}

.stage[hidden] {
  display: none;
}

.stage {
  scroll-margin-top: 24px;
}

.flow {
  display: grid;
  gap: 28px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head.compact {
  margin-bottom: 10px;
}

.section-title-wrap {
  display: grid;
  gap: 4px;
}

.section-step {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.section-subtitle {
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 280px;
  text-align: right;
}

.stage.is-active .section-step {
  color: var(--accent-orange);
}

.stage.is-active .section-title {
  color: var(--accent-ink);
}

.layout {
  display: grid;
  gap: 16px;
}

.main-block {
  display: grid;
  gap: 16px;
  width: 100%;
}

.create-card {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.28));
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(59, 27, 18, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: grid;
  gap: 18px;
  overflow: visible;
}

.create-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 22px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.create-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.card-block {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: 0 16px 32px rgba(59, 27, 18, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: visible;
}

.card-block::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.create-card > .card-block {
  position: relative;
  z-index: 1;
}

.create-card > .card-block:first-of-type {
  z-index: 20;
}

.create-card > .card-block:nth-of-type(2) {
  z-index: 2;
}

.block-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.select-grid {
  display: grid;
  gap: 14px;
}

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

.select-item {
  display: grid;
  gap: 8px;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.select-row.select-row-single {
  grid-template-columns: minmax(0, 1fr);
}

.select-btn {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 12px 24px rgba(59, 27, 18, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.select-btn:hover {
  border-color: rgba(255, 107, 157, 0.4);
  box-shadow: 0 12px 24px rgba(59, 27, 18, 0.08);
  transform: translateY(-1px);
}

.select-input {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  box-shadow: 0 12px 22px rgba(59, 27, 18, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.select-input:focus {
  outline: none;
  border-color: rgba(255, 107, 157, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.12);
}

.arrow {
  font-size: 16px;
  color: var(--ink-soft);
}

.dropdowns {
  position: relative;
  z-index: 999;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  margin-top: 8px;
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 18px 36px rgba(59, 27, 18, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 9999;
}

.dropdown-menu button {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 107, 157, 0.08);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-menu button:hover {
  border-color: rgba(255, 107, 157, 0.4);
  background: rgba(255, 107, 157, 0.16);
}

.dropdown-custom {
  display: grid;
  gap: 8px;
}

.visually-hidden-selects {
  position: absolute;
  left: -9999px;
  top: 0;
}

.inline-custom {
  width: 100%;
}

.text-area {
  position: relative;
}

.text-area textarea {
  width: 100%;
  min-height: 160px;
  border-radius: 16px;
  padding: 16px 220px 72px 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  line-height: 1.7;
  resize: none;
  overflow: hidden;
  box-shadow: 0 18px 32px rgba(59, 27, 18, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.text-area textarea:focus {
  outline: none;
  border-color: rgba(255, 107, 157, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.12);
}

.mic-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 20px rgba(255, 107, 157, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.mic-icon {
  display: inline-block;
  width: 18px;
  height: 24px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg width='20' height='28' viewBox='0 0 20 28' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 2C11.66 2 13 3.34 13 5V13C13 14.66 11.66 16 10 16C8.34 16 7 14.66 7 13V5C7 3.34 8.34 2 10 2Z' fill='%23ff6b9d'/%3E%3Cpath d='M4 12C4 15.31 6.69 18 10 18C13.31 18 16 15.31 16 12H18C18 16.08 14.87 19.45 11 19.95V24H9V19.95C5.13 19.45 2 16.08 2 12H4Z' fill='%23ff6b9d'/%3E%3C/svg%3E");
}

.timer {
  position: absolute;
  right: 20px;
  bottom: 72px;
  font-size: 12px;
  color: var(--ink-soft);
}

.confirm-btn {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.text-actions {
  position: absolute;
  right: 16px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}

.text-actions .mic-btn,
.text-actions .confirm-btn {
  position: static;
}

.undo-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.82);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.undo-btn:hover {
  border-color: rgba(255, 107, 157, 0.35);
}

.undo-btn {
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 7L4 11L8 15' stroke='%23ff6b9d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M4 11H14C17.314 11 20 13.686 20 17' stroke='%23ff6b9d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.action-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.action-row .pill-btn {
  width: 100%;
}

.input-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.input-hint {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(78, 205, 196, 0.12);
  color: var(--ink);
  border: 1px solid rgba(78, 205, 196, 0.35);
}

.assist-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.assist-note {
  font-size: 12px;
  color: var(--ink-soft);
}

.btn {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b9d, #ffb366);
  color: #fff;
  border-color: rgba(255, 107, 157, 0.6);
  box-shadow: 0 16px 30px rgba(255, 107, 157, 0.25);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-cta {
  width: 100%;
  font-size: 15px;
}

.pill-btn {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 18px rgba(59, 27, 18, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.pill-btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.pill-btn:hover,
.btn-ghost:hover {
  border-color: rgba(255, 107, 157, 0.4);
}

.gift-btn {
  background: linear-gradient(90deg, #ff6ea6 0%, #f4a56b 100%);
  color: #fff;
  border-color: #fff2dc;
  box-shadow: 0 14px 26px rgba(255, 107, 157, 0.3);
}

.gift-btn:hover {
  border-color: #fff2dc;
  box-shadow: 0 18px 32px rgba(255, 107, 157, 0.36);
}

.processing-panel {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 26px 60px rgba(59, 27, 18, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}

.processing-title {
  font-size: 18px;
  font-weight: 700;
}

.processing-icons {
  font-size: 26px;
  margin: 12px 0;
}

.processing-bar {
  height: 8px;
  background: rgba(59, 27, 18, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0 8px;
}

.processing-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff6b9d, #4ecdc4);
  transition: width 0.3s ease;
}

.processing-percent {
  font-size: 14px;
  font-weight: 600;
}

.processing-status {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 8px;
}

.processing-quote {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 16px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 16px;
}

.preview-layout {
  grid-template-columns: 1fr;
  width: 100%;
}

.preview-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 20px;
  padding: 18px;
  display: grid;
  gap: 12px;
  box-shadow: 0 18px 36px rgba(59, 27, 18, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.preview-card.preview-card-flat {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-title {
  font-weight: 700;
  font-size: 15px;
}

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

.preview-textarea {
  width: 100%;
  min-height: 140px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.preview-textarea:focus {
  outline: none;
  border-color: rgba(255, 107, 157, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.12);
}

.polish-panel,
.music-panel {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.assist-panel {
  display: grid;
  gap: 16px;
  margin-top: 4px;
}

.music-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.music-drawer-panel {
  width: min(920px, 100%);
  max-height: 80vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 28px 60px rgba(59, 27, 18, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 16px;
  animation: slideUp 0.25s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.preview-bar {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  width: 100%;
}

.preview-text {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 700;
}

.side-actions {
  display: flex;
  gap: 8px;
}

.candidates {
  display: grid;
  gap: 10px;
}

.candidate {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.candidate.selected {
  border-color: rgba(255, 107, 157, 0.6);
  box-shadow: 0 12px 20px rgba(255, 107, 157, 0.12);
}

.music-inline {
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.music-inline-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.music-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.music-search {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.music-search input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.music-results {
  display: grid;
  gap: 8px;
}

.music-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fffdf9;
  gap: 10px;
  cursor: pointer;
}

.music-item.loading {
  opacity: 0.65;
  pointer-events: none;
}

.music-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.music-meta {
  font-size: 11px;
  color: var(--ink-soft);
}

.music-actions {
  display: flex;
  gap: 12px;
}

.music-empty {
  font-size: 13px;
  color: var(--ink-soft);
}

.music-item.selected {
  border-color: rgba(255, 107, 157, 0.6);
  background: rgba(255, 107, 157, 0.08);
}

.assist-row-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fffdf9;
  min-height: 56px;
  display: grid;
  align-items: center;
}

.voice-select {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.voice-label {
  font-size: 14px;
  font-weight: 600;
}

.voice-picker {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 600;
}

.tts-inline-hint {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  background: rgba(255, 186, 120, 0.18);
  border: 1px solid rgba(255, 186, 120, 0.45);
  box-shadow: 0 8px 18px rgba(255, 155, 90, 0.15);
}

.tts-inline-hint::before {
  content: "!";
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff8a65, #ffb74d);
  flex-shrink: 0;
}

.tts-panel {
  margin-top: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.tts-status {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.tts-player {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.tts-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(59, 27, 18, 0.08);
  overflow: hidden;
  cursor: pointer;
}

.tts-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff6b9d, #4ecdc4);
}

.tts-time {
  font-size: 12px;
  color: var(--ink-soft);
}

.tts-audio {
  display: none;
}

.tts-panel.tts-disabled {
  opacity: 0.75;
}

.tts-panel.tts-disabled .tts-player,
.tts-panel.tts-disabled .pill-btn {
  pointer-events: none;
  filter: grayscale(0.4);
}

.preview-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-subtitle {
    text-align: left;
    max-width: none;
  }

  .page {
    padding: 20px 0 80px;
  }

  .create-card {
    padding: 16px;
    border-radius: 18px;
    gap: 14px;
  }

  .card-block {
    padding: 12px;
    border-radius: 14px;
  }

  .select-btn {
    min-height: 44px;
  }

  .text-area textarea {
    min-height: 140px;
    padding: 14px 200px 64px 14px;
  }


  .confirm-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .text-actions {
    right: 12px;
    bottom: 12px;
    gap: 8px;
  }

  .timer {
    right: 14px;
    bottom: 66px;
  }

  .select-row {
    grid-template-columns: 1fr;
  }

  .select-grid.select-grid-inline {
    grid-template-columns: 1fr;
  }

  .voice-select {
    grid-template-columns: 1fr;
  }

  .preview-footer {
    flex-direction: column;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .preview-bar {
    left: 16px;
    right: 16px;
    transform: none;
    flex-direction: column;
    align-items: stretch;
  }

  .music-drawer-panel {
    max-height: 88vh;
    padding: 14px;
  }
}
