:root {
  --paper: #f8f6f0;
  --ink: #252b29;
  --muted: #5f6966;
  --line: #d8ddd8;
  --coral: #db5d61;
  --mint: #b5d7ca;
}

html { scroll-behavior: smooth; }
body { color: var(--ink); background: var(--paper); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; cursor: auto; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, .island-item:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
#mapSection, #emotionSection, #semanticSection { scroll-margin-top: 62px; }

.museum-nav {
  position: fixed; inset: 0 0 auto; height: 62px; z-index: 3000;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 0 clamp(20px, 4vw, 64px);
  background: rgba(248, 246, 240, .96); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px); transition: opacity .22s ease, transform .22s ease;
}
body.is-intro .museum-nav { opacity: 0; transform: translateY(-100%); pointer-events: none; }
body.is-intro .lab-float-btn { display: none !important; }
.museum-nav a { text-decoration: none; color: var(--ink); }
.museum-brand { font: 700 15px/1 Georgia, serif; letter-spacing: .06em; white-space: nowrap; }
.museum-brand span { font: 600 13px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; letter-spacing: 0; margin-left: 10px; }
.museum-nav nav { display: flex; align-items: center; gap: clamp(16px, 2.6vw, 40px); }
.museum-nav nav a { font-size: 13px; color: var(--muted); padding: 20px 0; transition: color .18s; }
.museum-nav nav a:hover { color: var(--coral); }
.museum-nav nav a.is-current { color: var(--ink); box-shadow: inset 0 -2px var(--coral); }
.museum-index { color: var(--muted); font-size: 12px; letter-spacing: .08em; white-space: nowrap; }

.scrolling-section.intro-section {
  min-height: 100svh; padding: 28px 24px 54px; box-sizing: border-box;
  display: grid; place-items: center; background: #edcfce;
}
.intro-section::before, .intro-section::after,
.intro-image-lt, .intro-image-rt, .intro-image-lb, .intro-image-rb, #fogContainer { display: none !important; }
.intro-welcome { width: min(850px, 100%); text-align: center; position: relative; z-index: 2; }
.intro-brand { margin: 0 0 4px; font: 800 clamp(18px, 2vw, 28px)/1 Georgia, serif; letter-spacing: .03em; }
.intro-mascot { display: block; width: clamp(210px, 25vw, 350px); max-height: 32svh; object-fit: contain; margin: 0 auto 2px; }
.intro-welcome .intro-eyebrow { margin: 4px 0 16px; color: #9f484d; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.intro-heading { margin: 0; font: 500 clamp(45px, 5.4vw, 82px)/1.08 Georgia, "Songti SC", "Noto Serif CJK SC", serif; letter-spacing: -.04em; color: var(--ink); }
.intro-heading em { color: var(--coral); font-style: normal; }
.intro-welcome .intro-lead { max-width: 48em; margin: 20px auto 0; color: #4d4644; font-size: clamp(14px, 1.3vw, 17px); line-height: 1.75; }
.intro-hint { margin: 14px 0 18px; color: #746866; font-size: 13px; }
.creepy-btn { position: relative; min-width: 176px; min-height: 52px; margin-top: 0; border: 2px solid var(--ink); border-radius: 0; background: #fffaf5; color: var(--ink); cursor: pointer; transition: transform .18s, background .18s; }
.creepy-btn:hover { transform: translateY(-3px); background: var(--coral); }
.creepy-btn__cover { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 0 18px; border-radius: 2px; background: transparent; box-shadow: none; transform: none; letter-spacing: 0; font: 600 15px/1.2 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.creepy-btn:hover .creepy-btn__cover, .creepy-btn:focus-visible .creepy-btn__cover { background: transparent; transform: none; }
.creepy-btn__eyes { display: none; }

.map-section {
  min-height: 0; height: auto; overflow: hidden;
  background: #b5d2cd;
  border-block: 1px solid var(--ink);
}
.map-section .map-container {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 3295 / 1959;
  background-image: url('./assets/map/背景.png');
  background-position: center top;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.map-section .islands-container {
  position: absolute;
  inset: -10px 0 10px;
  width: 100%;
  height: 100%;
}
.map-guide { position: absolute; z-index: 900; top: 86px; left: clamp(20px, 3vw, 50px); width: min(330px, calc(100% - 40px)); padding: 20px 22px 18px; background: rgba(248,246,240,.96); border: 1px solid var(--ink); box-shadow: 6px 6px 0 rgba(37,43,41,.12); }
.map-guide-kicker { font-size: 11px; letter-spacing: .08em; color: var(--coral); font-weight: 700; }
.map-guide h2 { margin: 10px 0 8px; font: 600 24px/1.3 Georgia, "Songti SC", serif; color: var(--ink); }
.map-guide p:not(.map-guide-kicker) { font: 14px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; color: var(--muted); }
.map-guide-years { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; margin-top: 16px; padding: 0 12px; background: var(--paper); border: 1px solid var(--ink); font: 600 14px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; cursor: pointer; }
.map-guide-years:hover { background: #f8d8d3; }
.map-guide-years span { font-size: 20px; }
.sidebar { position: absolute; top: 62px; height: calc(100% - 62px); width: min(300px, 82vw); background: var(--paper); box-shadow: 8px 0 25px rgba(37,43,41,.12); }
.sidebar.open { z-index: 1100; }
.sidebar-content { padding: 24px 22px; }
.sidebar-content h3 { font: 600 25px/1.3 Georgia, "Songti SC", serif; text-align: left; margin-bottom: 20px; }
.sidebar-content h3 small { display: block; margin-top: 4px; font: 12px/1.4 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; color: var(--muted); }
.year-grid { gap: 8px; }
.year-item { min-height: 44px; padding: 8px; background: white; border: 1px solid var(--line); border-radius: 2px; box-shadow: none; font: 600 14px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.year-item:hover { background: #f7e4db; border-color: var(--coral); box-shadow: none; transform: none; }
.year-item.active { background: var(--ink); color: white; border-color: var(--ink); box-shadow: none; }
.sidebar-toggle { right: -52px; width: 52px; height: 82px; border-radius: 0 3px 3px 0; background: var(--paper); box-shadow: none; }
.sidebar-toggle h3.sidebar-toggle-content { font-size: 15px; line-height: 1.1; }
.mouse-detector { display: none; }
.island-item { transition: opacity .2s ease, filter .2s ease; }
.island-item.is-filtered-out { display: none; }
.island-item:hover .island-image, .island-item:focus-visible .island-image { transform: scale(1.08); }
.island-tooltip { border: 1px solid var(--ink); border-radius: 3px; box-shadow: 4px 4px 0 rgba(37,43,41,.18); }
.year-discover { position: absolute; z-index: 950; right: clamp(18px,3vw,48px); top: 86px; width: min(410px, calc(100% - 36px)); padding: 17px 18px; background: rgba(248,246,240,.96); border: 1px solid var(--ink); box-shadow: 5px 5px 0 rgba(37,43,41,.12); }
.year-discover[hidden] { display: none; }
.year-discover-title { margin: 0 0 11px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.year-discover-list { display: flex; flex-wrap: wrap; gap: 7px; max-height: 140px; overflow: auto; }
.year-discover-list button { min-height: 34px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 2px; background: white; color: var(--ink); font: 12px/1.3 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; cursor: pointer; }
.year-discover-list button:hover { border-color: var(--coral); background: #fff2ec; }
.modal-content { width: min(900px, calc(100% - 32px)); max-width: 900px; max-height: min(86vh, 650px); border: 1px solid var(--ink); border-radius: 4px; box-shadow: 12px 12px 0 rgba(37,43,41,.2); }
.modal-header { padding: 16px 22px; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--paper); }
.modal-header h3 { flex: 1; text-align: left; font: 600 27px/1.2 Georgia, "Songti SC", serif; }
.close-btn { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 2px; background: white; font-size: 26px; }
.close-btn:hover { color: var(--coral); transform: none; border-color: var(--coral); }
.modal-body { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); align-items: start; gap: 28px; padding: 24px; max-height: calc(min(86vh, 650px) - 70px); }
.modal-image { width: 100%; min-height: 260px; max-height: 430px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 2px; background: #f3f3ef; }
.modal-image img { max-height: min(380px, 46vh); border-radius: 0; }
.modal-info { gap: 8px; color: var(--muted); font: 15px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.modal-info h4 { margin: 10px 0 0; color: var(--ink); font-size: 14px; }

/* Meme lab: keep the dialog compact and prevent the generic modal close style
   from creating a large white square in the header. */
.lab-content {
  width: min(1120px, calc(100% - 40px));
  height: auto;
  max-height: min(88svh, 720px);
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 10px 10px 0 rgba(37, 43, 41, .18);
}
.lab-header {
  flex: 0 0 auto;
  padding: 18px 24px;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
}
.lab-header h3 { font: 600 29px/1.15 Georgia, "Songti SC", serif; }
.lab-header .close-btn {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 400 31px/1 -apple-system, BlinkMacSystemFont, sans-serif;
}
.lab-header .close-btn:hover,
.lab-header .close-btn:focus-visible {
  color: var(--ink);
  border: 0;
  outline: 1px solid var(--ink);
  outline-offset: -4px;
  transform: none;
}
.lab-body {
  display: grid;
  grid-template-columns: minmax(280px, .82fr) minmax(440px, 1.45fr);
  flex: 0 1 auto;
  align-items: stretch;
  justify-content: initial;
  gap: 24px;
  padding: 24px;
  overflow: hidden;
}
.camera-container {
  width: 100%;
  max-width: none;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--ink);
  border-radius: 4px;
}
.lab-memory-section { min-width: 0; max-height: none; gap: 12px; }
.memory-list {
  flex: 0 1 auto;
  grid-template-columns: repeat(5, minmax(76px, 1fr));
  gap: 10px;
  max-height: 292px;
  padding: 8px 4px 8px 0;
}
.lab-generate-btn { margin-top: 2px; }
.generate-button { border-radius: 4px; box-shadow: none; }
.generate-button:hover { transform: translateY(-2px); box-shadow: none; }
.api-status:empty { display: none; }

#emotionSection, #semanticSection { background: var(--paper); }
#emotionSection { padding: 92px 24px; }
.section-kicker { color: var(--coral); font-size: 12px; font-weight: 700; letter-spacing: .08em; margin: 0 0 12px; }
#emotionSection .viz-title { font: 600 clamp(34px, 4vw, 56px)/1.2 Georgia, "Songti SC", serif; color: var(--ink); background: none; -webkit-text-fill-color: currentColor; }
#emotionSection .viz-subtitle { max-width: 600px; margin: 14px auto 36px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.viz-grid { max-width: 1040px; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 22px 12px; padding: 0; }
.viz-grid-item {
  width: 100%;
  max-width: none;
  padding: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.viz-grid-item:hover { border-color: transparent; transform: translateY(-2px); }
.viz-grid-item img { border-radius: 0; }
.viz-grid-label { font: 600 13px/1.3 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.viz-legend {
  padding-bottom: 30px;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.viz-legend-items {
  background: transparent;
  border: 0;
  box-shadow: none;
}
.semantic-section { display: none !important; }
.semantic-section .semantic-title { color: var(--ink) !important; font-family: Georgia, "Songti SC", serif !important; }

@media (max-width: 900px) {
  .museum-nav { padding-inline: 18px; }
  .museum-index { display: none; }
  .scrolling-section.intro-section { min-height: 100svh; padding: 76px 22px 42px; }
  .intro-heading { font-size: clamp(43px, 7vw, 68px); }
  .viz-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 600px) {
  #mapSection, #emotionSection, #semanticSection { scroll-margin-top: 56px; }
  .museum-nav { height: 56px; }
  .museum-brand span, .museum-index { display: none; }
  .museum-nav nav { gap: 12px; }
  .museum-nav nav a { font-size: 11px; }
  .scrolling-section.intro-section { padding: 72px 18px 36px; }
  .intro-heading { font-size: clamp(38px, 10vw, 52px); }
  .intro-mascot { width: min(260px, 72vw); max-height: 29svh; }
  .intro-welcome .intro-lead br { display: none; }
  .map-section {
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
  .map-section .map-container {
    width: max(100%, 980px);
    min-width: 980px;
    min-height: 0;
  }
  .map-guide { top: 70px; padding: 12px 14px; width: min(310px, calc(100% - 32px)); }
  .map-guide h2 { font-size: 20px; }
  .map-guide p:not(.map-guide-kicker) { display: none; }
  .map-guide-years { margin-top: 10px; }
  .sidebar { top: 56px; height: calc(100% - 56px); }
  .year-discover { left: 16px; right: 16px; top: auto; bottom: 112px; width: auto; padding: 12px; }
  .year-discover-list { max-height: 72px; }
  .modal-content { max-height: 88vh; }
  .modal-body { grid-template-columns: 1fr; gap: 12px; padding: 16px; max-height: calc(88vh - 70px); }
  .modal-image { min-height: 0; max-height: 36vh; }
  .modal-image img { max-height: 32vh; }
  .viz-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  #emotionSection { padding-inline: 18px; }
  .lab-content { width: calc(100% - 20px); max-height: 92svh; }
  .lab-header { padding: 13px 16px; }
  .lab-header h3 { font-size: 23px; }
  .lab-body { display: flex; padding: 14px; gap: 14px; overflow-y: auto; }
  .camera-container { aspect-ratio: 16 / 9; }
  .memory-list { grid-template-columns: repeat(4, minmax(58px, 1fr)); max-height: 230px; }
}
@media (max-height: 650px) {
  .map-guide { top: 76px; padding: 10px 12px; }
  .map-guide-kicker { margin-bottom: 4px; }
  .map-guide h2 { margin: 4px 0 6px; font-size: 18px; }
  .map-guide p:not(.map-guide-kicker) { display: none; }
  .map-guide-years { min-height: 38px; margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
