:root {
  --bg: #000000;
  --text: #f3f1ed;
  --muted: #7d7f87;

  --cyan: #56cfd2;
  --gold: #b78a36;
  --blue: #5aaee8;
  --red: #d94a43;

  --white-soft: rgba(243, 241, 237, 0.92);
  --white-faint: rgba(255, 255, 255, 0.42);
  --green-role: #8fe3c8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Serif SC", sans-serif;
  overflow: hidden;
}

body {
  overflow: hidden;
}
/* 返回按钮 */
.back-btn {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  color: #cecdcb;
  background: rgba(8, 12, 20, 0.72);
  /* border: 1px solid rgba(95, 219, 210, 0.22); */
  backdrop-filter: blur(10px);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.25s ease;
}

.back-btn:hover {
  color: #ffffff;
  /* border-color: rgba(95, 219, 210, 0.5); */
  /* box-shadow: 0 0 18px rgba(95, 219, 210, 0.16); */
  transform: translateY(-2px);
}

.back-btn svg {
  flex-shrink: 0;
}

@media (max-width: 680px) {
  .back-btn {
    top: 14px;
    left: 14px;
    height: 38px;
    padding: 0 14px;
    font-size: 13px;
  }
}
/* ===== 页面背景 ===== */
.page-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: url("./ai页面拆分/第一页背景装饰暗纹.png") center/cover no-repeat;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.18)),
    radial-gradient(circle at center, transparent 42%, rgba(0, 0, 0, 0.16) 100%);
  pointer-events: none;
}

/* ===== 页面主体 ===== */
.artisan-page {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 72px));
  height: 100vh;
  margin: 0 auto;
  padding: 42px 0 26px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.page-header {
  flex: 0 0 auto;
  text-align: center;
  margin-bottom: 38px;
  padding-top: 2px;
}

.page-header h1 {
  margin: 0 0 14px;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(34px, 3.5vw, 60px);
  font-weight: 900;
  letter-spacing: 0;
  color: #f5f5f5;
  line-height: 1.15;
}

.page-header p {
  margin: 0;
  color: #8b8d92;
  font-size: clamp(13px, 1.1vw, 17px);
  font-weight: 500;
  letter-spacing: 0;
}

/* ===== 卡片网格 ===== */
.artisan-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  align-items: stretch;
}

/* ===== 卡片 ===== */
.artisan-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(7, 10, 17, 0.1) 0%, rgba(8, 10, 19, 0.98) 57%);
  border: 1px solid rgba(69, 128, 141, 0.35);
  transition: transform 0.32s ease, border-color 0.32s ease;
  cursor: pointer;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.artisan-card:hover {
  transform: translateY(-6px);
  border-color: rgba(90, 170, 188, 0.52);
}

.card-image-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #111;
}

.card-image-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(5, 7, 13, 0.96) 100%);
  pointer-events: none;
}

.card-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.card-body {
  flex: 0 0 auto;
  background: linear-gradient(180deg, #0a0d17 0%, #080a14 100%);
  padding: 18px 20px 16px;
  min-height: 208px;
}

.card-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-name {
  font-family: "Noto Serif SC", serif;
  font-size: 21px;
  font-weight: 700;
  color: #f2efea;
  line-height: 1.2;
}

.card-dynasty {
  font-size: 14px;
  font-weight: 600;
  color: #7e8088;
  white-space: nowrap;
}

.card-role {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 18px;
  color: var(--green-role);
  cursor: default;
}

.card-desc {
  font-family: "Noto Serif SC", serif;
  color: #e8e3dc;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.7;
  min-height: 52px;
  padding-right: 8px;
}

.card-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(115, 123, 140, 0.20);
}

.open-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.open-chat-btn span {
  transition: transform 0.25s ease;
}

.open-chat-btn:hover span {
  transform: translateX(4px);
}

/* ===== 四张卡片按钮单独颜色 ===== */
.accent-gold .open-chat-btn {
  color: #b88a36;
}

.accent-cyan .open-chat-btn {
  color: #4fc9c9;
}

.accent-blue .open-chat-btn {
  color: #58ace7;
}

.accent-red .open-chat-btn {
  color: #d84843;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.chat-modal {
  width: min(600px, 100%);
  min-height: 640px;
  max-height: min(92vh, 760px);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(55, 86, 116, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(13, 16, 26, 0.97), rgba(10, 12, 19, 0.98));
  border: 1px solid rgba(110, 143, 175, 0.24);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.62);
  padding: 20px 20px 18px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 24px;
  cursor: pointer;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-right: 38px;
  margin-bottom: 14px;
}

.modal-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.modal-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.modal-header-text h2 {
  margin: 0 0 4px;
  font-family: "Noto Serif SC", serif;
  font-size: 22px;
  line-height: 1.2;
}

.modal-header-text p {
  margin: 0;
  color: var(--green-role);
  font-size: 13px;
  font-weight: 700;
}

.modal-switch-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.switch-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(122, 152, 173, 0.24);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(239, 245, 249, 0.9);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: all 0.25s ease;
}

.switch-btn:hover {
  border-color: rgba(99, 228, 221, 0.42);
  color: #fff;
}

.modal-switch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.switch-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(135, 155, 177, 0.22);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(239, 245, 249, 0.72);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.switch-chip:hover {
  border-color: rgba(99, 228, 221, 0.4);
  color: #fff;
}

.switch-chip.active {
  color: #fff;
  border-color: rgba(99, 228, 221, 0.48);
  background: rgba(99, 228, 221, 0.08);
}

.chat-body {
  flex: 1;
  min-height: 220px;
  padding: 12px 0;
  overflow: auto;
}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.message {
  max-width: 88%;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.8;
}

.artisan-message {
  background: rgba(41, 52, 73, 0.46);
  border: 1px solid rgba(108, 140, 173, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.quick-questions-wrap {
  margin-top: 8px;
}

.quick-title {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  margin-bottom: 10px;
}

.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-chip {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(135, 155, 177, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(239, 245, 249, 0.82);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.quick-chip:hover {
  border-color: rgba(99, 228, 221, 0.4);
  color: #fff;
}

.input-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.input-row input {
  flex: 1;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(98, 129, 154, 0.32);
  background: rgba(8, 12, 20, 0.88);
  color: #fff;
  padding: 0 18px;
  outline: none;
}

.input-row input:focus {
  border-color: rgba(95, 219, 210, 0.55);
  box-shadow: 0 0 0 4px rgba(99, 228, 221, 0.08);
}

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  color: #032b2f;
  background: linear-gradient(135deg, #7cf0e8, #4ccabf);
  box-shadow: 0 8px 20px rgba(76, 202, 191, 0.28);
  font-size: 20px;
}

/* ===== 响应式 ===== */
@media (max-width: 1180px) {
  html,
  body {
    overflow: auto;
  }

  .page-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .artisan-page {
    height: auto;
    min-height: 100vh;
    width: min(100% - 48px, 1240px);
    padding-bottom: 40px;
  }

  .artisan-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .page-header h1 {
    font-size: 44px;
  }
}

@media (max-width: 680px) {
  html,
  body {
    overflow: auto;
  }

  .page-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .artisan-page {
    width: min(100% - 24px, 1240px);
    height: auto;
    min-height: 100vh;
    padding-top: 28px;
    padding-bottom: 30px;
  }

  .page-header {
    margin-bottom: 28px;
  }

  .page-header h1 {
    font-size: 30px;
  }

  .page-header p {
    font-size: 14px;
    line-height: 1.7;
  }

  .artisan-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .card-image-wrap {
    aspect-ratio: 16 / 11;
  }

  .card-body {
    min-height: auto;
  }

  .chat-modal {
    min-height: auto;
    max-height: calc(100vh - 32px);
    padding: 18px 16px 16px;
  }

  .modal-header {
    align-items: flex-start;
  }

  .modal-switch-list {
    margin-bottom: 10px;
  }

  .chat-body {
    min-height: 140px;
  }

  .message {
    max-width: 100%;
  }

  .modal-overlay {
    padding: 16px;
  }
}