/* 游玩预览 — 爱风月角色卡对话前端 */

html.app-view-play,
body.app-view-play {
  overflow: hidden;
  height: 100dvh;
}

.play-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px 1fr 380px;
  gap: 0;
  background: var(--bg);
}

.play-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #1a1520 0%, var(--surface) 100%);
}

.play-sidebar-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.play-sidebar-head h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #ffb6c8;
}

.play-card-name {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
}

.play-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.play-nav-btn:hover {
  background: rgba(255, 182, 200, 0.08);
  color: var(--text);
}

.play-nav-btn.active {
  background: linear-gradient(135deg, rgba(196, 69, 105, 0.35), rgba(232, 107, 138, 0.2));
  color: #ffd6e7;
  border: 1px solid rgba(240, 196, 212, 0.25);
}

.play-nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.play-nav-btn.active .play-nav-icon {
  background: rgba(255, 182, 200, 0.2);
}

.play-char-preview {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.play-char-card {
  margin-top: 8px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(240, 196, 212, 0.2);
  background: linear-gradient(145deg, rgba(255, 245, 248, 0.06), rgba(26, 16, 32, 0.4));
}

.play-char-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #ffb6c8;
}

.play-char-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}

.play-char-field {
  margin-bottom: 8px;
}

.play-char-field label {
  display: block;
  font-size: 11px;
  color: #c44569;
  margin-bottom: 3px;
  font-weight: 600;
}

.play-char-field input,
.play-char-field select,
.play-char-field textarea {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(240, 196, 212, 0.2);
  background: rgba(0, 0, 0, 0.25);
  font-size: 12px;
  color: var(--text);
}

.play-char-field textarea {
  min-height: 60px;
  resize: vertical;
  line-height: 1.5;
}

.play-char-readonly {
  font-size: 12px;
  line-height: 1.55;
  color: #d4c4c8;
  max-height: 120px;
  overflow-y: auto;
}

.play-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #121018;
}

.play-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(26, 16, 32, 0.6);
  flex-shrink: 0;
}

.play-main-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #ffe0ea;
}

.play-main-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.play-main-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.play-pane {
  flex: 1;
  min-height: 0;
  display: none;
  flex-direction: column;
}

.play-pane.active {
  display: flex;
}

/* —— 游戏落地页 —— */
.play-landing-body {
  flex: 1;
  min-height: 0;
  position: relative;
}

.play-landing-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.play-landing-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}

.play-landing-empty p {
  margin: 0 0 8px;
  font-size: 14px;
}

.play-landing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

/* —— 聊天区 —— */
.play-chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  scroll-behavior: smooth;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(196, 69, 105, 0.12), transparent),
    linear-gradient(180deg, #14101a, #0f0d14);
}

.play-chat-welcome {
  max-width: 520px;
  margin: 40px auto;
  padding: 28px 24px;
  border-radius: 16px;
  border: 1px solid rgba(240, 196, 212, 0.25);
  background: linear-gradient(145deg, rgba(255, 245, 247, 0.05), rgba(26, 16, 32, 0.5));
  text-align: center;
}

.play-chat-welcome h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #ffb6c8;
}

.play-chat-welcome p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.7;
  color: #c4a8b0;
}

.play-msg {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  max-width: 100%;
  animation: play-msg-in 0.3s ease;
}

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

.play-msg.user {
  flex-direction: row-reverse;
}

.play-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.play-msg.assistant .play-msg-avatar {
  background: linear-gradient(135deg, #c44569, #e86b8a);
  color: #fff;
}

.play-msg.user .play-msg-avatar {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
}

.play-msg.system .play-msg-avatar {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 11px;
}

.play-msg-bubble {
  flex: 1;
  min-width: 0;
  max-width: min(680px, 100%);
}

.play-msg.user .play-msg-bubble {
  display: flex;
  justify-content: flex-end;
}

.play-msg-text {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
}

.play-msg.user .play-msg-text {
  background: linear-gradient(135deg, #5b21b6, #7c3aed);
  color: #f5f3ff;
  border-bottom-right-radius: 4px;
}

.play-msg.assistant .play-msg-text {
  background: linear-gradient(145deg, #fffafb, #fff0f5);
  color: #2d2326;
  border: 1px solid #f0c4d4;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 20px rgba(196, 69, 105, 0.12);
}

.play-msg.system .play-msg-text {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 12px;
  border-radius: 10px;
}

.play-msg-content {
  /* builtInCss targets fy-* inside here */
}

.play-msg-content .fy-choice-item {
  cursor: pointer;
  padding: 8px 10px;
  margin: 4px 0;
  border-radius: 8px;
  transition: background 0.15s;
}

.play-msg-content .fy-choice-item:hover {
  background: rgba(196, 69, 105, 0.12);
}

.play-msg-streaming::after {
  content: '▋';
  animation: play-blink 0.8s step-end infinite;
  color: #c44569;
  margin-left: 2px;
}

@keyframes play-blink {
  50% { opacity: 0; }
}

.play-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: rgba(26, 16, 32, 0.5);
  max-height: 100px;
  overflow-y: auto;
  flex-shrink: 0;
}

.play-suggest-chip {
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 11px;
  color: #ffb6c8;
  border: 1px solid rgba(240, 196, 212, 0.3);
  background: rgba(196, 69, 105, 0.12);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-suggest-chip:hover {
  background: rgba(196, 69, 105, 0.25);
}

.play-compose {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.play-compose-inner {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.play-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(240, 196, 212, 0.25);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 14px;
  resize: none;
  line-height: 1.5;
}

.play-input:focus {
  outline: none;
  border-color: rgba(232, 107, 138, 0.5);
  box-shadow: 0 0 0 2px rgba(196, 69, 105, 0.15);
}

.play-compose-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* —— 右侧设定面板 —— */
.play-settings-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.play-settings-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.play-settings-head h2 {
  margin: 0;
  font-size: 14px;
  color: #ffb6c8;
}

.play-settings-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
}

.play-settings-section {
  margin-bottom: 18px;
}

.play-settings-section h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: #c44569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.play-stage-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.play-stage-pill {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: rgba(255, 182, 200, 0.1);
  color: #d4a8b8;
  border: 1px solid rgba(240, 196, 212, 0.15);
}

.play-stage-pill.current {
  background: linear-gradient(135deg, rgba(196, 69, 105, 0.4), rgba(232, 107, 138, 0.25));
  color: #ffe0ea;
  border-color: rgba(240, 196, 212, 0.35);
}

.play-load-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 8px;
}

.play-status-bar {
  padding: 6px 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.play-status-bar.error { color: var(--danger); }
.play-status-bar.ok { color: var(--ok); }

/* —— 响应式 —— */
@media (max-width: 1100px) {
  .play-layout {
    grid-template-columns: 240px 1fr;
  }
  .play-settings-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  .play-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .play-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .play-sidebar-head { display: none; }
  .play-nav {
    flex-direction: row;
    flex: 1;
    overflow-x: auto;
  }
  .play-nav-btn { white-space: nowrap; padding: 8px 10px; }
  .play-char-preview { display: none; }
  .play-chat-body { padding: 12px; }
}
