/* ============ 创作台 ============ */

.app-main {
  padding: clamp(28px, 4.6vw, 54px) 24px 72px;
}

.app-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.app-head h1 {
  margin: 12px 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 0.1em;
}

.app-sub {
  font-size: 13.5px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  background: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

.mode-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bamboo);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(18px, 2.4vw, 28px);
  align-items: start;
}

.panel {
  background: rgba(255, 253, 247, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(20px, 2.6vw, 30px);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(2px);
}

/* 表单 */
.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
}

.field-label {
  font-size: 12.5px;
  letter-spacing: 0.16em;
  color: var(--ink-2);
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.quick {
  padding: 5px 10px;
  font-size: 12px;
  color: var(--ink-3);
  border: 1px dashed var(--line-strong);
  border-radius: 99px;
  transition: all var(--dur) var(--ease);
}

.quick:hover {
  color: var(--cinnabar);
  border-color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

/* 分段控件 */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  width: 100%;
}

.seg {
  flex: 1;
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  border-radius: 3px;
  transition: all var(--dur) var(--ease);
}

.seg:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.seg.is-active {
  background: #fffdf7;
  color: var(--cinnabar);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

.segmented-sm {
  width: auto;
  flex: none;
}

.segmented-sm .seg {
  min-width: 74px;
  min-height: 34px;
  font-size: 12.5px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.switch-row .hint {
  flex: 1;
  min-width: 180px;
}

/* 风格 chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.55);
  transition: all var(--dur) var(--ease);
}

.chip-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.chip-btn.is-active {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

#poem-form .btn-primary {
  min-height: 52px;
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: 0.24em;
}

.privacy {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-4);
}

/* 结果区 */
.result {
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.result-head h2 {
  font-size: 15px;
  letter-spacing: 0.3em;
  color: var(--ink-2);
}

.result-meta {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-4);
}

/* 空状态 */
.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 20px;
  text-align: center;
}

.empty .seal {
  --seal-size: 52px;
  font-size: 24px;
  opacity: 0.35;
  box-shadow: none;
  background: transparent;
  color: var(--ink-3);
  border: 1px dashed var(--line-strong);
}

.empty p {
  font-family: var(--font-poem);
  font-size: 19px;
  letter-spacing: 0.16em;
  color: var(--ink-2);
}

.empty span {
  font-size: 12px;
  color: var(--ink-4);
  letter-spacing: 0.08em;
}

/* 加载 */
.loading {
  padding: 46px 6px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.loading-steps {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.lstep {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  transition: color var(--dur) var(--ease);
}

.lstep i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper-3);
  transition: all var(--dur) var(--ease);
}

.lstep.active {
  color: var(--cinnabar);
}

.lstep.active i {
  background: var(--cinnabar);
  box-shadow: 0 0 0 4px var(--cinnabar-soft);
  animation: pulse 1.2s infinite;
}

.lstep.done {
  color: var(--bamboo);
}

.lstep.done i {
  background: var(--bamboo);
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 7px rgba(195, 39, 43, 0.04);
  }
}

.loading-paper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.loading-line {
  height: 13px;
  border-radius: 99px;
  background: var(--paper-3);
  position: relative;
  overflow: hidden;
}

.loading-line::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: shimmer 1.5s infinite;
}

.w70 {
  width: 70%;
}
.w90 {
  width: 90%;
}
.w60 {
  width: 60%;
}
.w80 {
  width: 80%;
}

/* 结果 */
.poem-result {
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fade-up 0.5s var(--ease);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.block-label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.34em;
  color: var(--ink-4);
  margin-bottom: 10px;
}

.imagery-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.5);
}

.chip.on {
  border-color: rgba(195, 39, 43, 0.45);
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

.imagery-chips .chip {
  animation: chip-in 0.42s var(--ease) backwards;
}

@keyframes chip-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
}

.poem-card {
  position: relative;
  padding: clamp(22px, 3vw, 32px);
  background: linear-gradient(165deg, #fffdf7 0%, #faf6ea 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.poem-card::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -34px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 1px solid rgba(195, 39, 43, 0.14);
  box-shadow: 0 0 0 12px rgba(195, 39, 43, 0.03);
  pointer-events: none;
}

.poem-card-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.poem-title {
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: 0.3em;
}

.poem-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

.poem-tags span {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.poem-tags .mood {
  color: var(--bamboo);
  border-color: var(--bamboo-soft);
  background: var(--bamboo-soft);
}

.poem-lines {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.4vw, 14px);
  font-family: var(--font-poem);
  font-size: clamp(21px, 2.6vw, 25px);
  letter-spacing: 0.16em;
  line-height: 1.9;
}

.poem-lines p {
  opacity: 0;
  animation: line-in 0.62s var(--ease) forwards;
  animation-delay: calc(var(--i) * 0.16s);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.poem-lines p .punct {
  color: var(--ink-3);
  font-size: 0.86em;
}

.poem-lines p:nth-child(even) {
  padding-left: clamp(10px, 2vw, 26px);
}

@keyframes line-in {
  from {
    opacity: 0;
    transform: translateY(9px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.rhyme {
  position: relative;
  color: var(--cinnabar);
}

.rhyme::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 1px;
  height: 2px;
  background: var(--cinnabar);
  opacity: 0.55;
  transform-origin: left;
  animation: underline 0.5s var(--ease) 0.7s backwards;
}

@keyframes underline {
  from {
    transform: scaleX(0);
  }
}

.poem-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--ink-4);
}

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

.poem-actions .btn {
  flex: 1 1 auto;
  min-width: 84px;
}

.paraphrase {
  padding: 16px 18px;
  background: rgba(92, 115, 96, 0.045);
  border-left: 2px solid var(--bamboo);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  animation: fade-up 0.35s var(--ease);
}

.paraphrase ol {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 2;
  color: var(--ink-2);
}

.validation {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  display: flex;
  align-items: center;
  gap: 6px;
}

.validation::before {
  content: "✓";
  color: var(--bamboo);
  font-size: 12px;
}

.result-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
  letter-spacing: 0.06em;
}

/* 抽屉 */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(43, 43, 43, 0.34);
  backdrop-filter: blur(2px);
  z-index: 60;
  animation: fade-in 0.25s var(--ease);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  z-index: 70;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(102%);
  transition: transform 0.36s var(--ease);
  visibility: hidden;
}

.drawer.open {
  transform: none;
  visibility: visible;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  font-size: 16px;
  letter-spacing: 0.2em;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-3);
  border-radius: 50%;
  transition: all var(--dur) var(--ease);
}

.icon-btn:hover {
  background: rgba(43, 43, 43, 0.06);
  color: var(--ink);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-foot {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
}

.hist-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(255, 253, 247, 0.7);
  transition: border-color var(--dur) var(--ease);
}

.hist-item:hover {
  border-color: var(--line-strong);
}

.hist-item header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.hist-item h3 {
  font-size: 15px;
  letter-spacing: 0.14em;
}

.hist-item time {
  font-size: 10.5px;
  color: var(--ink-4);
  font-family: var(--font-mono);
}

.hist-lines {
  font-family: var(--font-poem);
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-2);
  letter-spacing: 0.06em;
}

.hist-item footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.hist-del {
  font-size: 11.5px;
  color: var(--ink-4);
  letter-spacing: 0.06em;
}

.hist-del:hover {
  color: var(--cinnabar);
}

.hist-empty {
  padding: 60px 10px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-4);
  letter-spacing: 0.08em;
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  margin-left: 2px;
  border-radius: 99px;
  background: var(--cinnabar);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-family: var(--font-mono);
  vertical-align: 2px;
}

.user-name {
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  padding: 0 4px;
}

@media (max-width: 940px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
  .result {
    min-height: 380px;
  }
  .app-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .app-main {
    padding: 22px 18px 56px;
  }
  .panel {
    padding: 18px 16px;
  }
  #poem-form .btn-primary {
    min-height: 50px;
  }
  .poem-lines {
    font-size: 22px;
    letter-spacing: 0.12em;
  }
  .poem-actions .btn {
    min-width: 0;
    flex: 1 1 44%;
  }
  .topnav .user-name {
    display: none;
  }
  .topnav a,
  .topnav button {
    padding: 8px 9px;
    font-size: 13px;
  }
}
