:root {
  color-scheme: dark;
  --bg: #05070f;
  --panel-bg: rgba(15, 20, 35, 0.72);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text-main: #f2f0e8;
  --text-sub: rgba(242, 240, 232, 0.65);
  --accent-gold: #f4c95d;
  --accent-green: #6fd08c;
  --accent-blue: #5fb4ef;
  --accent-danger: #ef5350;
  --font-serif: "Hiragino Mincho ProN", "游明朝", YuMincho, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow: hidden;
  overscroll-behavior: none;
}

#globe-container {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(5, 7, 15, 0.85), transparent);
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#app-header h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: var(--text-main);
}

#visited-counter {
  pointer-events: auto;
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(5, 7, 15, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

#filter-bar {
  pointer-events: auto;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px 10px;
  background: rgba(5, 7, 15, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  border: 1px solid var(--panel-border);
}

#category-toggles {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-sub);
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
}

.filter-chip.active {
  background: rgba(244, 201, 93, 0.18);
  border-color: var(--accent-gold);
  color: var(--text-main);
}

#danger-toggle.active {
  background: rgba(239, 83, 80, 0.22);
  border-color: var(--accent-danger);
  color: var(--text-main);
}

#search-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-size: 0.85rem;
}

#search-input::placeholder {
  color: var(--text-sub);
}

#search-input:focus {
  outline: none;
  border-color: var(--accent-gold);
}

#card-backdrop,
#visited-backdrop {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#card-backdrop.open,
#visited-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#info-card,
#visited-list {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  max-height: 68vh;
  overflow-y: auto;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--panel-border);
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

#info-card.open,
#visited-list.open {
  transform: translateY(0);
}

.info-card-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(244, 201, 93, 0.18);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.info-card-badge[hidden] {
  display: none;
}

#visited-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.visited-item {
  width: 100%;
  text-align: left;
  padding: 12px 4px;
  border: none;
  border-bottom: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
}

.visited-item:last-child {
  border-bottom: none;
}

.visited-item .visited-item-country {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-sub);
}

.info-card-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  margin: 6px auto 12px;
}

.card-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.info-card-category {
  margin: 0 0 4px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--text-sub);
}

.info-card-name {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-main);
  padding-right: 36px;
}

.info-card-meta {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.info-card-description {
  margin: 0 0 20px;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-main);
}

.info-card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: block;
  text-align: center;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--panel-border);
}

.btn-primary {
  background: var(--accent-gold);
  color: #201a08;
  border-color: transparent;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.btn-secondary.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.6);
}

#timeline-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--panel-border);
}

#timeline-play {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent-gold);
  color: #201a08;
  font-size: 0.95rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#timeline-slider {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--accent-gold);
}

#timeline-info {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
  min-width: 64px;
  font-size: 0.72rem;
  color: var(--text-sub);
}

#timeline-year {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 600;
}

/* 情報ボタン(ヘッダー左下、about/privacy/寄付への導線) */
#info-btn {
  position: fixed;
  left: 10px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 12;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(5, 7, 15, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-main);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* 情報モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 300px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 24px 20px 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.modal-panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text-main);
  font-family: var(--font-serif);
}

.modal-desc {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-sub);
}

.modal-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-links a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-sub);
  cursor: pointer;
}
