/* ============================================
   西湖寻宝 — 样式表
   West Lake Park Treasure Hunt Theme
   ============================================ */

/* === CSS Variables === */
:root {
  --color-primary: #C0392B;
  --color-primary-light: #D44637;
  --color-gold: #C8960C;
  --color-gold-light: #E8B830;
  --color-jade: #3D7A5C;
  --color-jade-light: #5A9E78;
  --color-water: #5B9CB5;
  --color-water-light: #8EC8DD;

  /* 西湖公园色调 */
  --color-sky: #e8f2f5;
  --color-cloud: #f0f6f8;
  --color-lake: #d4e8ed;
  --color-willow: #7BA688;
  --color-stone: #8B7D6B;
  --color-stone-dark: #5D4E37;
  --color-wood: #6B4226;
  --color-earth: #9B8C7A;
  --color-pavilion: #A0522D;

  /* 文字色 */
  --color-text: #3D2E1F;
  --color-text-light: #f8f5f0;
  --color-text-muted: #7B6E5D;
  --color-text-muted-light: #b8a898;

  /* 功能色 */
  --color-bg-card: #fffef9;
  --color-bg-input: #faf8f2;
  --color-bg-input-dark: #4a3828;
  --color-border: #d4cdbf;
  --color-border-dark: #6B5D4B;
  --color-success: #4A8C5C;
  --color-warning: #C8870A;
  --color-error: #B8442A;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 8px rgba(61, 46, 31, 0.07);
  --shadow: 0 4px 20px rgba(61, 46, 31, 0.10);
  --shadow-lg: 0 8px 32px rgba(61, 46, 31, 0.14);
  --transition: all 0.3s ease;
}

/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Serif SC', serif;
  background: var(--color-sky);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* === 西湖公园背景 === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* 天空 + 湖面 + 绿树 */
  background:
    /* 上方：天空渐变 */
    linear-gradient(180deg,
      #dceef5 0%,      /* 浅蓝天 */
      #e4f0f6 15%,     /* 淡蓝天 */
      #eaf3f0 40%,     /* 过渡到绿调 */
      #e8f0e8 60%,     /* 柳树绿 */
      #dcece4 100%     /* 地面绿 */
    ),
    /* 远处山影 */
    radial-gradient(ellipse at 80% 45%, rgba(122, 166, 136, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 50%, rgba(122, 166, 136, 0.12) 0%, transparent 45%),
    /* 阳光 */
    radial-gradient(circle at 75% 15%, rgba(255, 248, 220, 0.5) 0%, transparent 40%),
    /* 湖面反光 */
    radial-gradient(ellipse at 50% 65%, rgba(142, 200, 221, 0.15) 0%, transparent 50%);
}

/* 水波纹 + 柳叶装饰 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background:
    /* 水波纹横线 */
    repeating-linear-gradient(0deg,
      transparent,
      transparent 40px,
      rgba(91, 156, 181, 0.6) 40px,
      rgba(91, 156, 181, 0.6) 40.5px,
      transparent 40.5px,
      transparent 80px
    ),
    /* 淡淡竖线（柳枝） */
    repeating-linear-gradient(90deg,
      transparent,
      transparent 60px,
      rgba(122, 166, 136, 0.4) 60px,
      rgba(122, 166, 136, 0.4) 60.5px,
      transparent 60.5px,
      transparent 120px
    );
}

/* === App Container === */
.app-container {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* === 侧边栏 — 石亭风格 === */
.sidebar {
  width: 320px;
  background: linear-gradient(180deg,
    rgba(93, 78, 55, 0.95) 0%,
    rgba(75, 62, 42, 0.95) 30%,
    rgba(93, 78, 55, 0.95) 100%
  );
  border-right: 3px solid rgba(160, 130, 100, 0.4);
  box-shadow: 4px 0 24px rgba(61, 46, 31, 0.3);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  color: var(--color-text-light);
  backdrop-filter: blur(5px);
}

/* 石纹 */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background: repeating-linear-gradient(
    3deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,0.4) 4px,
    rgba(255,255,255,0.4) 5px
  );
  z-index: 0;
}

.sidebar > * { position: relative; z-index: 1; }

.sidebar-header {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 2px solid rgba(180, 150, 120, 0.3);
  background: linear-gradient(180deg, rgba(160, 82, 45, 0.5) 0%, rgba(160, 82, 45, 0.1) 100%);
}

.sidebar-header .logo {
  font-size: 52px;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}

.sidebar-header h1 {
  font-size: 21px;
  color: var(--color-gold-light);
  margin-bottom: 4px;
  letter-spacing: 3px;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.sidebar-header .subtitle {
  font-size: 12px;
  color: var(--color-text-muted-light);
  letter-spacing: 2px;
}

/* === Sidebar Sections === */
.sidebar-section {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(180, 150, 120, 0.2);
}

.sidebar-section h3 {
  font-size: 13px;
  color: var(--color-gold-light);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 1px;
  font-weight: 500;
}

/* === Progress === */
.progress-bar-wrap {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  height: 8px;
  margin: 8px 0;
  overflow: hidden;
  border: 1px solid rgba(180, 150, 120, 0.2);
}

.progress-bar-fill {
  background: linear-gradient(90deg, #C8960C, #E8B830, #F0D060);
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease;
  box-shadow: 0 0 8px rgba(232, 184, 48, 0.4);
}

.progress-text {
  font-size: 12px;
  color: var(--color-text-muted-light);
  text-align: center;
}

/* === Category List === */
.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.category-tag {
  padding: 5px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(180, 150, 120, 0.25);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--color-text-muted-light);
}

.category-tag:hover, .category-tag.active {
  background: rgba(200, 150, 12, 0.25);
  border-color: var(--color-gold-light);
  color: var(--color-gold-light);
}

/* === Stats Grid === */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(180, 150, 120, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--color-gold-light);
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.stat-label {
  font-size: 11px;
  color: var(--color-text-muted-light);
  margin-top: 2px;
}

/* === Achievement List === */
.achievement-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 3px 0;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  color: var(--color-text-muted-light);
}

.achievement-item .ach-icon {
  font-size: 20px;
  opacity: 0.3;
  transition: var(--transition);
}

.achievement-item.unlocked .ach-icon { opacity: 1; }

.achievement-item.unlocked {
  background: rgba(74, 140, 92, 0.2);
  border: 1px solid rgba(74, 140, 92, 0.3);
  color: #b8d8c0;
}

/* === Main Content — 西湖景色 === */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background:
    /* 树影 */
    radial-gradient(ellipse at 15% 80%, rgba(122, 166, 136, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 70%, rgba(122, 166, 136, 0.06) 0%, transparent 45%),
    /* 湖光 */
    radial-gradient(ellipse at 50% 60%, rgba(142, 200, 221, 0.08) 0%, transparent 50%);
}

/* === Top Bar === */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(248,245,240,0.95) 0%, rgba(240,237,230,0.9) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--color-border);
  box-shadow: 0 2px 12px rgba(61, 46, 31, 0.05);
}

.top-bar h2 {
  font-size: 16px;
  color: var(--color-wood);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

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

/* === Buttons === */
.btn {
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-card);
  color: var(--color-text);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: #f0ebe0;
  border-color: var(--color-gold);
  box-shadow: var(--shadow);
}

.btn-primary {
  background: linear-gradient(135deg, #A0522D, #C0392B);
  border-color: #A0522D;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #B8653A, #D44637);
  box-shadow: 0 4px 16px rgba(160, 82, 45, 0.3);
}

.btn-gold {
  background: linear-gradient(135deg, #8B6914, var(--color-gold));
  border-color: var(--color-gold);
  color: #fff;
  font-weight: 600;
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
  box-shadow: 0 4px 16px rgba(200, 150, 12, 0.3);
}

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

/* 侧边栏按钮 */
.sidebar .btn {
  background: rgba(255,255,255,0.08);
  border-color: rgba(180, 150, 120, 0.3);
  color: var(--color-text-light);
  box-shadow: none;
}

.sidebar .btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--color-gold-light);
  color: var(--color-gold-light);
}

.sidebar .btn-primary {
  background: linear-gradient(135deg, #8B4513, #A0522D);
  border-color: #A0522D;
  color: #fff;
}

/* === Chat Area === */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(248, 245, 240, 0.4) 0%, transparent 70%);
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

/* === Message Bubbles === */
.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: messageSlideIn 0.3s ease;
}

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

.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.assistant { align-self: flex-start; }

.message-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.message.user .message-avatar {
  background: linear-gradient(135deg, var(--color-jade), #7AB890);
}

.message.assistant .message-avatar {
  background: linear-gradient(135deg, var(--color-pavilion), #C07040);
}

.message-bubble {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  line-height: 1.7;
  font-size: 14px;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: var(--shadow-sm);
}

.message.user .message-bubble {
  background: linear-gradient(135deg, #e8f0e8, #dcecde);
  border: 1px solid #b8d0b8;
  border-bottom-right-radius: 4px;
  color: var(--color-text);
}

.message.assistant .message-bubble {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
  color: var(--color-text);
}

.message-bubble strong { color: var(--color-primary); }
.message-bubble em { color: var(--color-text-muted); }

/* === System Message === */
.message.system { align-self: center; max-width: 90%; }

.message.system .message-bubble {
  background: linear-gradient(135deg, #fdf8ee, #faf3e3);
  border: 1px solid rgba(200, 150, 12, 0.3);
  text-align: center;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-stone-dark);
}

/* === Typing Indicator === */
.typing-indicator { display: flex; gap: 5px; padding: 8px 0; }

.typing-indicator span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-text-muted);
  animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* === Chat Input === */
.chat-input-area {
  padding: 16px 28px;
  background: linear-gradient(180deg, rgba(240,237,230,0.7) 0%, rgba(248,245,240,0.95) 100%);
  backdrop-filter: blur(10px);
  border-top: 2px solid var(--color-border);
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: 6px;
  border: 2px solid var(--color-border);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.chat-input-wrap:focus-within {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 4px rgba(200, 150, 12, 0.07);
}

.chat-input-wrap input {
  flex: 1; background: transparent; border: none;
  color: var(--color-text); font-size: 14px;
  padding: 10px 14px; outline: none; font-family: inherit;
}

.chat-input-wrap input::placeholder { color: var(--color-text-muted); }

.chat-input-wrap button {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--color-jade), #3D6B4F);
  border: none; border-radius: var(--radius-sm);
  color: #fff; cursor: pointer;
  font-weight: 600; font-size: 14px;
  transition: var(--transition); font-family: inherit;
}

.chat-input-wrap button:hover {
  filter: brightness(1.1);
  box-shadow: 0 2px 8px rgba(61, 122, 92, 0.3);
}

.chat-input-wrap button:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Quick Actions === */
.quick-actions {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}

.quick-action {
  padding: 5px 14px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  font-size: 12px; color: var(--color-text-muted);
  cursor: pointer; transition: var(--transition);
  font-family: inherit;
}

.quick-action:hover {
  background: #f0ebe0;
  border-color: var(--color-jade);
  color: var(--color-jade);
}

/* === Knowledge Panel === */
.knowledge-panel {
  position: absolute; top: 0; right: 0;
  width: 400px; height: 100%;
  background: linear-gradient(180deg, #fffef9 0%, #f7f4ec 100%);
  border-left: 2px solid var(--color-border);
  box-shadow: -4px 0 24px rgba(61, 46, 31, 0.10);
  z-index: 10;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  display: flex; flex-direction: column; overflow-y: auto;
}

.knowledge-panel.open { transform: translateX(0); }

.knowledge-panel-header {
  padding: 18px 20px;
  border-bottom: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: var(--color-bg-card); z-index: 1;
}

.knowledge-panel-header h3 {
  color: var(--color-wood); font-size: 16px; font-weight: 600;
}

.knowledge-panel-content { padding: 16px 20px; }

/* === Relic Card === */
.relic-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 12px;
  cursor: pointer; transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.relic-card:hover {
  border-color: var(--color-gold);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.relic-card.discovered {
  border-color: var(--color-success);
  background: linear-gradient(135deg, #fafdf7, #f4faf5);
}

.relic-card-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}

.relic-card-image { font-size: 32px; }

.relic-card-info h4 {
  font-size: 15px; color: var(--color-wood);
  margin-bottom: 2px; font-weight: 600;
}

.relic-card-meta { font-size: 11px; color: var(--color-text-muted); }

.relic-card-desc {
  font-size: 12px; color: var(--color-text-muted);
  line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* === Relic Detail Modal === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30, 18, 10, 0.7);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(2px);
}

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

.modal {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  max-width: 520px; width: 90%; max-height: 80vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease;
  box-shadow: 0 16px 48px rgba(61, 46, 31, 0.2);
}

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

.modal-header {
  padding: 20px 24px;
  border-bottom: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, rgba(61, 122, 92, 0.06) 0%, transparent 100%);
}

.modal-header h2 {
  font-size: 18px; color: var(--color-wood);
  display: flex; align-items: center; gap: 8px; font-weight: 600;
}

.modal-close {
  background: none; border: none;
  color: var(--color-text-muted); font-size: 24px;
  cursor: pointer; padding: 4px 8px;
  transition: var(--transition); border-radius: 4px;
}

.modal-close:hover { color: var(--color-wood); background: #f0ebe0; }

.modal-body { padding: 20px 24px; }

.modal-body .relic-meta-row {
  display: flex; gap: 24px; margin-bottom: 20px; flex-wrap: wrap;
  padding: 14px 18px; background: #f7f4ec;
  border-radius: var(--radius-sm);
}

.modal-body .relic-meta-item { display: flex; flex-direction: column; gap: 2px; }

.modal-body .relic-meta-label {
  font-size: 10px; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 1px;
}

.modal-body .relic-meta-value {
  font-size: 14px; color: var(--color-wood); font-weight: 500;
}

.modal-body .relic-description { line-height: 1.9; margin-bottom: 16px; font-size: 14px; }

.modal-body .relic-facts {
  background: linear-gradient(135deg, #fdf8ee, #faf3e3);
  border: 1px solid rgba(200, 150, 12, 0.2);
  border-radius: var(--radius-sm); padding: 14px 18px;
}

.modal-body .relic-facts h4 {
  color: var(--color-gold); margin-bottom: 8px; font-size: 14px; font-weight: 600;
}

.modal-body .relic-facts li {
  font-size: 13px; color: var(--color-text-muted);
  margin: 5px 0; padding-left: 4px; line-height: 1.6;
}

/* === Settings Panel === */
.settings-panel {
  position: absolute; top: 0; right: 0;
  width: 400px; height: 100%;
  background: var(--color-bg-card);
  border-left: 2px solid var(--color-border);
  box-shadow: -4px 0 24px rgba(61, 46, 31, 0.10);
  z-index: 20;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  display: flex; flex-direction: column;
}

.settings-panel.open { transform: translateX(0); }

.settings-header {
  padding: 18px 20px;
  border-bottom: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
}

.settings-header h3 { color: var(--color-wood); font-size: 16px; font-weight: 600; }

.settings-body { padding: 20px; }

.settings-group { margin-bottom: 22px; }

.settings-group label {
  display: block; font-size: 13px; color: var(--color-wood);
  margin-bottom: 8px; font-weight: 500;
}

.settings-group input {
  width: 100%; padding: 10px 14px;
  background: var(--color-bg-input);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text); font-size: 14px;
  font-family: inherit; outline: none;
  transition: var(--transition);
}

.settings-group input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 4px rgba(200, 150, 12, 0.05);
}

.settings-group .hint {
  font-size: 11px; color: var(--color-text-muted);
  margin-top: 6px; line-height: 1.6;
}

.settings-group .hint a { color: var(--color-gold); text-decoration: none; font-weight: 500; }

/* === Responsive === */
@media (max-width: 768px) {
  .app-container { flex-direction: column; }

  .sidebar { width: 100%; max-height: 220px; flex-shrink: 0; }

  .knowledge-panel, .settings-panel { width: 100%; }

  .message { max-width: 92%; }
}
