:root {
  --bg: #0f1115;
  --text: #f3f3f3;
  --text-mid: #c7c7c7;
  --text-dim: #9ea3aa;
  --text-muted: #888;
  --accent: #ce2029;
  --link: #8ecae6;
  --subtle: rgba(255, 255, 255, 0.04);
  --subtle-hover: rgba(255, 255, 255, 0.09);
  --ui-bg: rgba(255, 255, 255, 0.08);
  --ui-border: rgba(255, 255, 255, 0.12);
  --ui-border-strong: rgba(255, 255, 255, 0.15);
  --scrollbar: rgba(255, 255, 255, 0.25);
  --scrollbar-hover: rgba(255, 255, 255, 0.4);
  --panel-bg: rgba(20, 20, 24, 0.96);
}

html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; overflow: hidden; overscroll-behavior-y: none; }
#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; }
#globeViz { position: absolute; inset: 0; }
#infoPanel { position: absolute; box-sizing: border-box; top: 20px; left: 20px; width: 340px; max-width: calc(100vw - 40px); max-height: calc(100dvh - 40px); background: var(--panel-bg); background-image: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)); border: 1px solid var(--ui-border); border-radius: 14px; padding: 16px 0 16px 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); z-index: 10; display: flex; flex-direction: column; overflow: hidden; transition: padding 0.25s ease; }
#panelDragHandle { display: none; }
#siteTitle { display: block; background: none; border: none; padding: 0 16px 2px 0; margin: 0; color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; text-align: left; font-family: inherit; flex-shrink: 0; transition: color 0.15s; }
#siteTitle:hover { color: var(--accent); }
#infoPanel.collapsed #siteTitle { display: none; }
#siteTagline { margin: 0; padding: 0 16px 10px 0; font-size: 11px; color: var(--text-dim); flex-shrink: 0; letter-spacing: 0.01em; }
#infoPanel.collapsed #siteTagline { display: none; }
#infoPanel.collapsed { padding: 16px 0 10px 16px; }
#infoPanel.collapsed #panelBody { display: none; }
#panelHeader { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding-right: 16px; }
#searchBar { flex: 1; background: var(--ui-bg); border: 1px solid var(--ui-border-strong); border-radius: 8px; color: var(--text); font-size: 13px; padding: 0px 10px; outline: none; min-width: 0; box-sizing: border-box; height: 32px; }
#searchBar::placeholder { color: var(--text-muted); }
#searchBar::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 2l10 10M12 2L2 12' stroke='%23c7c7c7' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat; cursor: pointer; opacity: 1; }
#searchBar::-webkit-search-cancel-button:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 2l10 10M12 2L2 12' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
#searchBar:focus { border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.11); }
#collapseBtn { background: none; border: none; cursor: pointer; color: var(--text-mid); padding: 0; width: 28px; font-size: 18px; line-height: 1; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: transform 0.25s ease; }
#collapseBtn:hover { color: #fff; }
#infoPanel.collapsed #collapseBtn { transform: rotate(180deg); }
#activeTitle { display: none; flex-shrink: 0; min-height: 34px; font-size: 13px; font-weight: 600; margin-top: 8px; margin-right: 16px; padding: 0 10px; border: 1px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); cursor: pointer; }
#activeTitle:hover { color: #fff; }
#infoPanel.collapsed #activeTitle { display: flex; align-items: center; }
#panelBody { margin-top: 8px; padding-right: 16px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; overscroll-behavior-y: contain; }
#panelBody::-webkit-scrollbar { width: 6px; }
#panelBody::-webkit-scrollbar-track { background: transparent; }
#panelBody::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 6px; }
#panelBody::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }
#entryList { display: flex; flex-direction: column; gap: 2px; }
.entry-item { border-radius: 8px; order: 0; }
.entry-item.active { order: -1; }
.entry-row { display: flex; align-items: center; gap: 6px; padding: 8px 10px; cursor: pointer; border-radius: 8px; background: var(--subtle); border: 1px solid transparent; transition: background 0.15s; user-select: none; }
.entry-row:hover { background: var(--subtle-hover); }
.entry-item.active > .entry-row { background: rgba(206,32,41,0.18); border-color: rgba(206,32,41,0.4); }
.entry-title-group { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.entry-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.entry-date { font-size: 11px; color: var(--text-dim); font-weight: 400; line-height: 1.3; }
.entry-chevron { font-size: 11px; color: var(--text-muted); flex-shrink: 0; transition: transform 0.2s ease; }
.entry-item.active:not(.body-collapsed) .entry-chevron { transform: rotate(180deg); }
.entry-body-wrapper { display: none; }
.entry-item.active:not(.body-collapsed) .entry-body-wrapper { display: block; }
.entry-body { padding: 10px 4px 4px 4px; }
.nav-btn { background: var(--ui-bg); border: 1px solid var(--ui-border-strong); color: var(--text); padding: 0px 12px; border-radius: 6px; cursor: pointer; font-size: 16px; line-height: 1; transition: background 0.15s; flex-shrink: 0; box-sizing: border-box; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.nav-btn:hover:not(:disabled) { background: rgba(255,255,255,0.18); }
.entry-meta { color: var(--text-mid); font-size: 13px; margin: 0 0 10px 0; }
.entry-main-img { width: 100%; border-radius: 10px; margin-bottom: 8px; object-fit: cover; height: 190px; background: #222; display: block; cursor: zoom-in; }
.entry-main-img.portrait { height: 308px; }
.entry-caption { font-size: 12px; color: #bdbdbd; margin-bottom: 6px; min-height: 16px; line-height: 1.4; }
.entry-credit { font-size: 11px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.4; }
.entry-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scroll-snap-type: x mandatory; }
.entry-thumb { width: 56px; height: 56px; flex: 0 0 auto; border-radius: 8px; object-fit: cover; cursor: pointer; border: 2px solid transparent; background: #222; scroll-snap-align: start; }
.entry-thumb.active { border-color: var(--accent); }
.entry-desc { margin: 0; line-height: 1.4; font-size: 14px; }
.entry-source { margin-top: 12px; font-size: 11px; color: var(--text-dim); line-height: 1.45; }
#lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 1000; align-items: center; justify-content: center; cursor: zoom-out; overscroll-behavior: contain; }
#lightbox.open { display: flex; }
#lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; object-fit: contain; box-shadow: 0 8px 40px rgba(0,0,0,0.6); }
.lb-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: var(--ui-border); border: none; color: #fff; font-size: 28px; line-height: 1; width: 52px; height: 52px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; z-index: 1001; }
.lb-arrow:hover { background: rgba(255,255,255,0.28); }
.lb-arrow.hidden { display: none; }
#lbPrev { left: 20px; }
#lbNext { right: 20px; }
#lbCounter { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.6); font-size: 13px; pointer-events: none; }
#loadingScreen { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; transition: opacity 0.6s ease; }
#loadingScreen.fade-out { opacity: 0; pointer-events: none; }
.loading-spinner { width: 44px; height: 44px; border: 3px solid rgba(255,255,255,0.1); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.loading-label { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.04em; }
@keyframes spin { to { transform: rotate(360deg); } }
a { color: var(--link); }
#lbClose { position: absolute; top: 16px; right: 16px; background: var(--ui-border); border: none; color: #fff; font-size: 20px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; z-index: 1002; }
#lbClose:hover { background: rgba(255,255,255,0.28); }
#globeTooltip { position: fixed; background: rgba(20,20,24,0.9); color: var(--text); font-size: 12px; padding: 5px 9px; border-radius: 6px; pointer-events: none; white-space: nowrap; display: none; z-index: 5; border: 1px solid var(--ui-border-strong); left: 0; top: 0; }
@media (max-width: 600px) {
  #infoPanel { top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%; max-height: 75dvh; border-radius: 14px 14px 0 0; padding-top: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  #panelDragHandle { display: flex; justify-content: center; align-items: center; height: 20px; flex-shrink: 0; touch-action: none; cursor: ns-resize; }
  #panelDragHandle::before { content: ''; width: 36px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; }
  #infoPanel.collapsed #panelDragHandle { display: none; }
  #infoPanel.collapsed { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .entry-main-img { height: 140px; }
  .entry-main-img.portrait { height: 280px; }
  .lb-arrow { display: none !important; }
  #lbPrev { left: 10px; }
  #lbNext { right: 10px; }
  #searchBar { font-size: 16px; padding: 0px 12px; height: 44px; }
  .nav-btn { padding: 0px 16px; height: 44px; }
  #collapseBtn { min-width: 40px; min-height: 40px; }
  #panelBody { touch-action: pan-y; }
}
@media (min-width: 601px) and (hover: hover) and (pointer: fine) {
  #infoPanel { background: rgba(20, 20, 24, 0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
}
