/* style.css - China Culture Interactive Map — Light Heritage Theme */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f5f0e8;
  background-image: url('images/heritage_bg.png');
  background-size: cover;
  background-attachment: fixed;
  text-align: center;
  overflow-x: hidden;
  color: #3a2e1f;
}

.hidden { display: none !important; }

/* ===== Splash Screen ===== */
#splash-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
#splash-screen.fade-out {
  animation: splashFadeOut 1.2s ease forwards;
}
@keyframes splashFadeOut {
  0% { opacity: 1; transform: scale(1); }
  60% { opacity: 0.6; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.1); pointer-events: none; }
}

.splash-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  filter: brightness(0.85) saturate(1.2);
  animation: bgZoom 20s ease-in-out infinite alternate;
}
@keyframes bgZoom {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}
.splash-bg::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, rgba(245,240,232,0.3) 30%, rgba(60,30,10,0.5) 100%);
}

.splash-content {
  position: relative;
  z-index: 2;
  text-align: center;
  animation: contentSlideUp 1.2s ease-out 0.3s both;
}
@keyframes contentSlideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

.splash-particles {
  position: absolute;
  top: -100px; left: -200px; right: -200px; bottom: -100px;
  background:
    radial-gradient(2px 2px at 20% 30%, rgba(200,60,40,0.6), transparent),
    radial-gradient(2px 2px at 80% 20%, rgba(180,140,60,0.5), transparent),
    radial-gradient(2px 2px at 40% 70%, rgba(60,140,80,0.4), transparent),
    radial-gradient(2px 2px at 60% 50%, rgba(60,100,180,0.4), transparent),
    radial-gradient(2px 2px at 10% 80%, rgba(200,100,50,0.5), transparent),
    radial-gradient(2px 2px at 90% 60%, rgba(180,60,60,0.5), transparent),
    radial-gradient(1px 1px at 50% 10%, rgba(180,140,60,0.3), transparent),
    radial-gradient(1px 1px at 30% 90%, rgba(200,180,140,0.2), transparent);
  animation: particlesFloat 8s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes particlesFloat {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-20px) rotate(2deg); }
}

.splash-title {
  font-size: 52px;
  color: #fff;
  text-shadow: 0 0 40px rgba(180,60,40,0.5), 0 2px 10px rgba(0,0,0,0.5);
  letter-spacing: 8px;
  margin-bottom: 16px;
  font-weight: 900;
  animation: titleGlow 3s ease-in-out infinite alternate;
}
@keyframes titleGlow {
  0% { text-shadow: 0 0 30px rgba(180,60,40,0.4), 0 2px 10px rgba(0,0,0,0.5); }
  100% { text-shadow: 0 0 60px rgba(200,160,60,0.7), 0 0 100px rgba(200,160,60,0.2), 0 2px 10px rgba(0,0,0,0.5); }
}

.splash-subtitle {
  font-size: 18px;
  color: rgba(255,255,255,0.85);
  letter-spacing: 4px;
  margin-bottom: 30px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

.splash-divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(200,60,40,0.8), transparent);
  margin: 0 auto 36px;
  animation: dividerPulse 2s ease-in-out infinite;
}
@keyframes dividerPulse {
  0%, 100% { width: 80px; opacity: 0.6; }
  50% { width: 120px; opacity: 1; }
}

.splash-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 48px;
  background: linear-gradient(135deg, rgba(200,60,40,0.2), rgba(200,160,60,0.1));
  border: 1px solid rgba(200,160,60,0.6);
  border-radius: 50px;
  color: #ffd7a0;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.4s ease;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}
.splash-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,215,0,0.2), transparent);
  transition: left 0.6s ease;
}
.splash-btn:hover::before { left: 100%; }
.splash-btn:hover {
  background: linear-gradient(135deg, rgba(200,60,40,0.35), rgba(200,160,60,0.15));
  border-color: rgba(255,215,0,0.8);
  box-shadow: 0 0 30px rgba(200,160,60,0.3), 0 0 60px rgba(200,160,60,0.1);
  transform: translateY(-2px);
}
.btn-icon {
  font-size: 22px;
  transition: transform 0.3s ease;
}
.splash-btn:hover .btn-icon { transform: translateX(6px); }

.splash-hint {
  margin-top: 20px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
}

.splash-footer {
  position: absolute;
  bottom: 30px;
  z-index: 2;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 3px;
}

/* ===== Main Map View ===== */
#main-view {
  padding: 20px;
  min-height: 100vh;
  animation: mainFadeIn 1s ease 0.3s both;
}
@keyframes mainFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 90%;
  margin: 0 auto 16px;
}
#top-bar h1 {
  font-size: 24px;
  color: #5a3a1a;
  letter-spacing: 3px;
  text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}
#top-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.top-hint {
  font-size: 13px;
  color: rgba(90,58,26,0.55);
  letter-spacing: 1px;
}

/* Language Toggle Button */
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: rgba(255,250,240,0.85);
  border: 1px solid rgba(180,140,80,0.35);
  border-radius: 20px;
  color: #5a3a1a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(6px);
  letter-spacing: 0.5px;
}
.lang-btn:hover {
  background: rgba(200,60,40,0.1);
  border-color: rgba(200,60,40,0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(200,60,40,0.15);
}
.lang-btn.active {
  background: rgba(200,60,40,0.12);
  border-color: rgba(200,60,40,0.6);
  color: #8b2500;
}
.lang-icon {
  font-size: 15px;
}
.lang-label {
  font-size: 12px;
  font-weight: 700;
}

h1 {
  font-size: 28px;
  color: #5a3a1a;
  margin-bottom: 20px;
}

/* Map container */
#map-container {
  position: relative;
  width: 92%;
  max-width: 960px;
  margin: 0 auto;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(120,80,40,0.12), 0 0 0 1px rgba(180,140,80,0.15);
  border: 1px solid rgba(180,140,80,0.2);
  overflow: visible;
}

#china-map {
  width: 100%;
  height: auto;
  display: block;
}

/* Responsive: tablet */
@media (max-width: 768px) {
  #map-container { width: 96%; border-radius: 10px; }
  #top-bar { flex-direction: column; gap: 6px; }
  #top-bar h1 { font-size: 18px; }
  #top-right { justify-content: center; }
}

/* Responsive: phone */
@media (max-width: 480px) {
  #map-container { width: 100%; border-radius: 0; border-left: none; border-right: none; }
  #top-bar h1 { font-size: 16px; }
  .top-hint { font-size: 11px; }
  #top-right { flex-wrap: wrap; justify-content: center; gap: 8px; }
  .top-hint { display: none; }
}

/* Tooltip on hover */
#tooltip {
  display: none;
  position: absolute;
  background: rgba(255, 250, 240, 0.96);
  color: #5a3a1a;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  pointer-events: none;
  white-space: normal;
  max-width: 260px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(120,80,40,0.18), 0 0 0 1px rgba(180,140,80,0.15);
  border: 1px solid rgba(200,60,40,0.2);
}

/* Map legend */
#map-legend {
  text-align: center;
  padding: 10px 0 4px;
  font-size: 12px;
  color: #5a3a1a;
}
#map-legend .legend-item {
  display: inline-block;
  margin: 0 12px;
  padding: 3px 10px;
  background: rgba(255,250,240,0.8);
  border-radius: 12px;
  border: 1px solid rgba(180,140,80,0.15);
}
#tooltip strong {
  font-size: 15px;
  display: block;
  margin-bottom: 4px;
  color: #8b2500;
}

/* Info panel overlay */
#info-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(60,30,10,0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
}
#info-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
#info-panel {
  background: linear-gradient(180deg, #fffaf0, #f5f0e8);
  border-radius: 16px;
  width: 90%;
  max-width: 620px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 32px;
  position: relative;
  box-shadow: 0 8px 40px rgba(120,80,40,0.2), 0 0 0 1px rgba(180,140,80,0.15);
  text-align: left;
  border: 1px solid rgba(180,140,80,0.25);
}
#info-panel::-webkit-scrollbar { width: 6px; }
#info-panel::-webkit-scrollbar-track { background: transparent; }
#info-panel::-webkit-scrollbar-thumb { background: rgba(180,140,80,0.3); border-radius: 3px; }
#info-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none; border: none;
  font-size: 28px; color: rgba(90,58,26,0.4);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
#info-close:hover { color: #8b2500; }
/* Province hero image */
#info-content .hero-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(120,80,40,0.15);
  border: 1px solid rgba(180,140,80,0.15);
}
#info-content h2 {
  font-size: 24px; color: #5a3a1a;
  margin-bottom: 4px; border-bottom: 2px solid #c8402a;
  padding-bottom: 8px;
}
#info-content .en-name {
  font-size: 14px; color: rgba(90,58,26,0.45); margin-bottom: 16px;
}
#info-content .section {
  margin-bottom: 16px;
}
#info-content .section-title {
  font-size: 15px; font-weight: bold; color: #8b2500;
  margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
#info-content .food-name, #info-content .place-name {
  font-weight: bold; color: #3a2e1f;
}
#info-content .desc {
  font-size: 14px; color: rgba(58,46,31,0.7); line-height: 1.7; margin: 2px 0 8px 0;
}
#info-content ul {
  list-style: none; padding-left: 0; margin: 4px 0;
}
#info-content li {
  font-size: 14px; color: rgba(58,46,31,0.7); line-height: 1.8;
}
#info-content .history-row {
  font-size: 14px; color: rgba(58,46,31,0.7); line-height: 1.8;
}
/* Expandable item cards */
#info-content .item-card {
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid rgba(180,140,80,0.15);
  transition: border-color 0.2s, box-shadow 0.2s;
}
#info-content .item-card:hover {
  border-color: rgba(200,60,40,0.25);
  box-shadow: 0 2px 8px rgba(120,80,40,0.08);
}
#info-content .item-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 15px;
  color: #3a2e1f;
  padding: 4px 0;
}
#info-content .item-title:hover { color: #8b2500; }
#info-content .arrow {
  font-size: 11px;
  color: rgba(200,60,40,0.5);
  transition: transform 0.2s;
}
#info-content .item-detail {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(200,60,40,0.04);
  border-left: 3px solid rgba(200,60,40,0.5);
  border-radius: 4px;
  font-size: 14px;
  color: rgba(58,46,31,0.7);
  line-height: 1.8;
  animation: fadeIn 0.3s ease;
}
#info-content .item-detail.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Craft Experience Entry ===== */
.craft-preview-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.craft-entry {
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #fff8e7 0%, #ffe4cc 100%);
  border-radius: 16px;
  border: 2px solid #d4a574;
  text-align: left;
}
.craft-entry-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.craft-emoji {
  font-size: 40px;
  flex-shrink: 0;
}
.craft-entry-title {
  font-size: 17px;
  font-weight: bold;
  color: #8b4513;
  margin-bottom: 4px;
}
.craft-entry-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
}
.craft-start-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  background: linear-gradient(135deg, #c62828, #e53935);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.craft-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(198,40,40,0.4);
}

/* ===== Craft Interactive Flow ===== */
.craft-img-wrap {
  width: 100%;
  margin-bottom: 14px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.craft-step-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.craft-step-img:hover {
  transform: scale(1.05);
}
.craft-done-img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: block;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  border: 4px solid #c62828;
}
.craft-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.craft-back-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #666;
}
.craft-back-btn:hover { background: #f5f5f5; }
.craft-title {
  font-size: 16px;
  font-weight: bold;
  color: #8b4513;
}
.craft-progress {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.craft-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #c62828, #e53935);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.craft-step-label {
  font-size: 12px;
  color: #999;
  text-align: left;
  margin-bottom: 10px;
}
.craft-step-title {
  font-size: 20px;
  font-weight: bold;
  color: #333;
  text-align: left;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e53935;
}
.craft-ai-bubble {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  animation: craftSlideIn 0.4s ease;
}
@keyframes craftSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.craft-ai-avatar {
  font-size: 28px;
  flex-shrink: 0;
}
.craft-ai-msg {
  background: #f0f4ff;
  border-radius: 12px 12px 12px 4px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
  color: #333;
  flex: 1;
}
.craft-ai-msg.craft-q {
  background: #fff3e0;
  font-weight: 600;
  border-radius: 12px;
}
.craft-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.craft-opt {
  padding: 12px 16px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}
.craft-opt:hover:not(:disabled) {
  border-color: #e53935;
  background: #fff5f5;
  transform: translateX(4px);
}
.craft-opt-disabled {
  opacity: 0.5;
  cursor: default;
}
.craft-opt-selected {
  border-color: #e53935;
  background: #ffe8e8;
  font-weight: 600;
}
.craft-opt-correct {
  border-color: #4caf50;
  background: #e8f5e9;
}
.craft-opt-wrong {
  border-color: #ff9800;
  background: #fff3e0;
}
.craft-next-btn {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 12px;
  background: linear-gradient(135deg, #1565c0, #42a5f5);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.15s;
}
.craft-next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(21,101,192,0.4);
}
.craft-next-btn.hidden { display: none; }
.craft-tip {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-radius: 12px;
  padding: 14px;
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.7;
  color: #2e7d32;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: craftSlideIn 0.4s ease;
}
.craft-tip.hidden { display: none; }

/* ===== Craft Done Screen ===== */
.craft-done {
  text-align: center;
  padding: 30px 10px;
}
.craft-done-emoji {
  font-size: 64px;
  margin-bottom: 16px;
  animation: craftBounce 0.6s ease;
}
@keyframes craftBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}
.craft-done-title {
  font-size: 24px;
  font-weight: bold;
  color: #c62828;
  margin-bottom: 12px;
}
.craft-done-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.7;
  margin-bottom: 20px;
}
.craft-done-quote {
  font-size: 16px;
  font-style: italic;
  color: #8b4513;
  margin-bottom: 20px;
  padding: 12px;
  background: #fff8e7;
  border-radius: 8px;
  border-left: 4px solid #d4a574;
}
.craft-done-stats {
  font-size: 15px;
  color: #333;
  margin-bottom: 20px;
}
.craft-retry-btn {
  padding: 12px 30px;
  background: linear-gradient(135deg, #4caf50, #66bb6a);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.15s;
}
.craft-retry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76,175,80,0.4);
}
