/* 填词故事 */
:root {
  --sf-accent: #f0a050;
  --sf-accent-soft: rgba(240, 160, 80, 0.16);
  --sf-bg: #101018;
  --sf-panel: #181824;
  --sf-border: rgba(255, 255, 255, 0.08);
  --sf-muted: #9494aa;
  --sf-blank: #ffd166;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  background: var(--sf-bg);
  color: #ececf4;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(240, 160, 80, 0.1), transparent 38%),
    var(--sf-bg);
}

.page {
  min-height: calc(100dvh - var(--site-nav-height, 0px));
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  background: linear-gradient(90deg, #ffd166, #f0a050);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--sf-muted);
}

.settings-btn {
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.header {
  margin-bottom: 1rem;
}

.screen[hidden] {
  display: none !important;
}

.panel {
  background: var(--sf-panel);
  border: 1px solid var(--sf-border);
  border-radius: 14px;
  padding: 1.15rem 1.2rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.hint {
  margin: 0 0 1rem;
  color: var(--sf-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.modal-hint {
  margin-top: -0.35rem;
}

.rule-list {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  color: #c8c8dc;
  font-size: 0.875rem;
  line-height: 1.65;
}

.rule-list li + li {
  margin-top: 0.35rem;
}

.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0 0 1.25rem;
}

.tutorial-step {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tutorial-step-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: #e2e8f0;
}

.tutorial-step p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #94a3b8;
}

.teach-panel {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
}

.teach-panel-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: #bfdbfe;
}

.teach-panel-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #94a3b8;
}

.teach-panel-list li + li {
  margin-top: 0.4rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.toolbar-compact {
  margin: 0;
}

.primary-button,
.secondary-button,
.ghost-button {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.55rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.link-btn {
  display: inline-block;
  text-decoration: none;
}

.primary-button {
  background: linear-gradient(135deg, #ffd166, #f0a050);
  color: #1a1208;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--sf-border);
  color: #ececf4;
}

.ghost-button {
  background: transparent;
  border-color: var(--sf-border);
  color: var(--sf-muted);
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.danger-text {
  color: #ff8a8a;
}

.paragraph-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.para-card {
  border: 1px solid var(--sf-border);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  background: rgba(0, 0, 0, 0.15);
}

.para-editor {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--sf-border);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.95rem;
  line-height: 1.55;
  color: #ececf4;
  outline: none;
  resize: none;
  overflow: hidden;
  font-family: inherit;
}

.para-editor:focus {
  border-color: rgba(255, 209, 102, 0.45);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.1);
}

.para-editor::placeholder {
  color: rgba(148, 148, 170, 0.55);
}

.para-tools {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.para-insert-num {
  min-width: 2rem;
  padding: 0.3rem 0.45rem;
  color: var(--sf-blank);
  border-color: rgba(255, 209, 102, 0.28);
}

.para-char-count {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--sf-muted);
}

.para-char-count.is-warn {
  color: #ff9f7a;
}

.preview-blank-mark {
  color: var(--sf-blank);
  font-weight: 700;
}

.para-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.para-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.para-image-option {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: #c8c8dc;
  cursor: pointer;
  user-select: none;
}

.para-image-option input {
  margin: 0;
}

.write-ai-hint {
  margin-top: -0.35rem;
  margin-bottom: 0.75rem;
  color: var(--sf-muted);
  font-size: 0.8rem;
}

.para-label {
  font-size: 0.78rem;
  color: var(--sf-muted);
  font-weight: 600;
}

.preview-panel {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sf-border);
}

.preview-label {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  color: var(--sf-muted);
  font-weight: 600;
}

.preview-story {
  font-size: 0.875rem;
  line-height: 1.65;
  color: #b8b8cc;
  margin-bottom: 0.75rem;
}

.preview-sub-label {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  color: var(--sf-muted);
  font-weight: 600;
}

.preview-blank-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.preview-blank-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--sf-border);
  background: rgba(255, 255, 255, 0.03);
  color: #d8d8ea;
  font-size: 0.82rem;
  line-height: 1.45;
  cursor: pointer;
  font-family: inherit;
}

.preview-blank-item.is-empty {
  color: var(--sf-muted);
  font-style: italic;
}

.preview-blank-item:hover {
  border-color: rgba(255, 209, 102, 0.35);
  background: rgba(255, 209, 102, 0.08);
}

.preview-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--sf-muted);
}

.preview-para + .preview-para {
  margin-top: 0.55rem;
}

.preview-para {
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field span {
  font-size: 0.82rem;
  color: #d8d8ea;
  line-height: 1.45;
}

.field input,
.field select {
  border-radius: 10px;
  border: 1px solid var(--sf-border);
  background: rgba(0, 0, 0, 0.22);
  color: #ececf4;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
  font-family: inherit;
}

.field-feedback {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: #ff8a8a;
}

.provider-hint {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.78rem;
  color: var(--sf-muted);
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.reveal-book {
  margin: 0.5rem 0 1rem;
}

.reveal-book-pages {
  position: relative;
  min-height: min(62vw, 420px);
}

.reveal-book-page {
  display: none;
  min-height: min(62vw, 420px);
  padding: 1.35rem 1.25rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(165deg, rgba(36, 32, 48, 0.95), rgba(22, 20, 32, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 10px 28px rgba(0, 0, 0, 0.35);
}

.reveal-book-page.is-active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.reveal-book-page .story-result {
  font-size: 1.05rem;
  line-height: 1.85;
  text-align: left;
}

.reveal-book-page .reveal-image-slot {
  margin-bottom: 0.85rem;
  flex-shrink: 0;
}

.reveal-book-page .reveal-prompt-details {
  margin-top: auto;
  padding-top: 0.75rem;
}

.reveal-book-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.reveal-page-indicator {
  min-width: 4.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--sf-muted);
  font-variant-numeric: tabular-nums;
}

.reveal-autoplay-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--sf-border);
  background: rgba(240, 160, 80, 0.05);
  font-size: 0.84rem;
  line-height: 1.45;
  color: #d0d0e4;
  cursor: pointer;
}

.reveal-autoplay-option input {
  margin-top: 0.18rem;
  flex-shrink: 0;
}

.reveal-para {
  border-top: 1px solid var(--sf-border);
  padding-top: 0.85rem;
}

.reveal-image-slot {
  margin-bottom: 0.65rem;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  line-height: 0;
}

.reveal-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.reveal-video-area {
  margin-bottom: 1rem;
}

.reveal-video-banner {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.reveal-video-banner.is-error {
  background: rgba(220, 80, 80, 0.12);
  border: 1px solid rgba(220, 80, 80, 0.35);
  color: #e8a0a0;
}

.reveal-video-banner.is-ok {
  background: rgba(80, 180, 120, 0.1);
  border: 1px solid rgba(80, 180, 120, 0.28);
  color: #8fd4a0;
}

.reveal-video-single {
  margin-bottom: 0.5rem;
}

.reveal-video-label {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e8c890;
}

.reveal-video-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.reveal-video-card {
  min-width: 0;
}

.reveal-video-card-error {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: #e8a0a0;
}

.reveal-prompt-details {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--sf-muted);
}

.reveal-prompt-details summary {
  cursor: pointer;
  user-select: none;
}

.reveal-prompt-details pre {
  margin: 0.45rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #c8c8dc;
}

.fill-video-sub {
  margin-top: -0.55rem;
  margin-left: 1.35rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  background: rgba(240, 160, 80, 0.03);
}

@media (max-width: 720px) {
  .reveal-video-compare {
    grid-template-columns: 1fr;
  }
}

.reveal-video-slot {
  margin-bottom: 1rem;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  line-height: 0;
}

.reveal-video {
  display: block;
  width: 100%;
  max-height: min(56vw, 420px);
  background: #000;
}

.reveal-image-placeholder {
  font-size: 0.78rem;
  color: var(--sf-muted);
  padding: 1rem;
}

.fill-image-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--sf-border);
  background: rgba(240, 160, 80, 0.06);
  font-size: 0.875rem;
  line-height: 1.5;
  color: #d8d8ea;
  cursor: pointer;
}

.fill-image-option input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.generating-panel {
  text-align: center;
}

.generating-spinner {
  width: 2.25rem;
  height: 2.25rem;
  margin: 1rem auto 0.5rem;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--sf-accent);
  animation: sf-spin 0.85s linear infinite;
}

.generating-note {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

@keyframes sf-spin {
  to {
    transform: rotate(360deg);
  }
}

.story-result {
  font-size: 1rem;
  line-height: 1.75;
  color: #ececf4;
}

.story-answer {
  color: var(--sf-blank);
  font-weight: 700;
  padding: 0 0.12rem;
  border-bottom: 2px solid rgba(255, 209, 102, 0.35);
}

.sf-mp-nick-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.sf-mp-nick-row input {
  flex: 1;
  min-width: 0;
}

.sf-mp-test-hint {
  font-size: 0.8rem;
  color: var(--sf-muted);
  margin-top: -0.25rem;
}

.sf-mp-layout {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) 1fr;
  gap: 0.85rem;
  align-items: start;
}

.sf-mp-sidebar .player-list {
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.sf-mp-sidebar .player-list li {
  padding: 0.35rem 0;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sf-mp-phase .panel-title {
  margin-top: 0;
}

.sf-mp-leader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.sf-mp-phase-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sf-mp-progress {
  margin: 0;
}

.sf-mp-banner {
  margin: 0.65rem 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.88rem;
}

.sf-mp-banner.is-ok {
  background: rgba(80, 180, 120, 0.12);
  border: 1px solid rgba(80, 180, 120, 0.35);
  color: #9fd4a0;
}

.sf-mp-fill-form {
  margin: 0.75rem 0;
}

.sf-mp-fill-done {
  margin: 0.5rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  font-size: 0.88rem;
  line-height: 1.55;
}

.sf-mp-reveal-author {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  color: var(--sf-muted);
  font-weight: 600;
}

.sf-mp-reveal-para {
  margin: 0 0 0.85rem;
}

.sf-mp-contributions {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.sf-mp-contributions ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.sf-mp-ai-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  margin: 0.75rem 0;
}

.sf-mp-ai-outline {
  flex: 1 1 12rem;
  min-width: 0;
}

.sf-mp-score-area {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  text-align: center;
}

.sf-mp-score-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.sf-mp-score-timer {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  color: #fbbf24;
}

.sf-mp-score-progress {
  margin: 0 0 0.85rem;
}

.sf-mp-score-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  max-width: 28rem;
  margin: 0 auto;
}

.sf-mp-score-btn {
  min-width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.sf-mp-score-btn:hover:not(:disabled) {
  background: rgba(147, 197, 253, 0.18);
  border-color: rgba(147, 197, 253, 0.45);
}

.sf-mp-score-btn.is-selected {
  background: rgba(59, 130, 246, 0.35);
  border-color: rgba(147, 197, 253, 0.7);
}

.sf-mp-score-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sf-mp-score-done {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  color: #86efac;
}

.sf-mp-results {
  margin-top: 1.25rem;
}

.sf-mp-results-list {
  margin: 0.65rem 0 0;
  padding-left: 1.2rem;
}

.sf-mp-results-list li {
  margin: 0.35rem 0;
}

.sf-mp-log-title {
  margin-top: 1.25rem;
}

.sf-mp-log {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
  max-height: 10rem;
  overflow: auto;
  font-size: 0.82rem;
  color: var(--sf-muted);
}

.sf-mp-log li {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sf-mp-fill-preview {
  margin: 0.65rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  list-style: none;
}

.sf-mp-fill-preview li {
  padding: 0.3rem 0;
  font-size: 0.88rem;
}

.sf-mp-fill-label {
  color: var(--sf-accent);
  font-weight: 600;
  margin-right: 0.35rem;
}

.sf-mp-reveal-story {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.sf-mp-reveal-story h3 {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
}

.sf-mp-reveal-story p {
  margin: 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

@media (max-width: 720px) {
  .sf-mp-layout {
    grid-template-columns: 1fr;
  }
}

.blank-modal-label {
  color: var(--sf-blank);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(8, 8, 14, 0.72);
}

.modal[hidden] {
  display: none !important;
}

.modal-card {
  width: min(100%, 420px);
  background: var(--sf-panel);
  border: 1px solid var(--sf-border);
  border-radius: 14px;
  padding: 1.1rem 1.15rem;
}

.modal-card-wide {
  width: min(100%, 480px);
}

.modal-card h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.modal-actions-split {
  justify-content: space-between;
  align-items: center;
}

.modal-actions-right {
  display: flex;
  gap: 0.5rem;
}
