:root {
  --bg-dark: #0b0f14;
  --bg-card: rgba(16, 23, 30, 0.88);
  --bg-glass: rgba(22, 32, 44, 0.75);
  --border-gold: rgba(212, 175, 55, 0.35);
  --border-gold-bright: rgba(255, 215, 0, 0.8);
  --gold-primary: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.4);
  --text-primary: #f0ede1;
  --text-muted: #9ba7b5;
  --cyan-accent: #4ae0e0;
  --cyan-glow: rgba(74, 224, 224, 0.5);
  --radius-ui: 14px;
  --shadow-fantasy: 0 8px 32px rgba(0, 0, 0, 0.65), 0 0 16px rgba(212, 175, 55, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text-primary);
  user-select: none;
}

#app-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Fullscreen Map */
#map {
  width: 100%;
  height: 100%;
  background: #0b0f14;
  z-index: 1;
}

/* Leaflet Container Styling */
.leaflet-container {
  background-color: #0b0f14 !important;
}

/* Custom Marker Styling */
.skyrim-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.25s ease;
}

.skyrim-marker:hover {
  transform: scale(1.3) translateY(-4px);
  filter: drop-shadow(0 0 10px var(--cyan-accent));
}

.skyrim-marker.marker-active {
  transform: scale(1.4) translateY(-6px);
  filter: drop-shadow(0 0 14px #ffdf00);
  animation: markerPulse 1.8s infinite alternate ease-in-out;
}

/* Pin Drop Impact Animation when targeted */
.skyrim-marker.pin-drop-impact {
  animation: pinDrop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, markerPulse 1.8s infinite alternate ease-in-out 0.5s !important;
}

@keyframes pinDrop {
  0% {
    transform: translateY(-80px) scale(2.2);
    opacity: 0;
  }
  60% {
    transform: translateY(0) scale(1.5);
    opacity: 1;
  }
  80% {
    transform: translateY(-12px) scale(1.35);
  }
  100% {
    transform: translateY(-6px) scale(1.4);
    opacity: 1;
  }
}

@keyframes markerPulse {
  0% { filter: drop-shadow(0 0 8px #ffdf00); }
  100% { filter: drop-shadow(0 0 20px #ffea70) drop-shadow(0 0 30px #d4af37); }
}

.marker-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 20, 28, 0.9);
  border: 2px solid var(--gold-primary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.7);
  font-size: 16px;
}

/* Radar Beacon Ripple Animation on Searched Location */
.target-beacon {
  position: absolute;
  width: 48px;
  height: 48px;
  top: 50%;
  left: 50%;
  margin-top: -24px;
  margin-left: -24px;
  pointer-events: none;
  border-radius: 50%;
  border: 2px solid #ff4757;
  box-shadow: 0 0 16px #ff4757;
  animation: beaconWave 2s infinite ease-out;
}

@keyframes beaconWave {
  0% { transform: scale(0.2); opacity: 1; }
  100% { transform: scale(3.5); opacity: 0; }
}

/* Dedicated Target Needle Pin (突き刺さる特大マップピン) */
.skyrim-needle-pin-wrapper {
  z-index: 99999 !important;
  pointer-events: none;
}

.needle-pin-inner {
  position: relative;
  width: 44px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transform-origin: bottom center;
}

.needle-pin-inner.pin-drop-impact {
  animation: needlePinDrop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes needlePinDrop {
  0% {
    transform: translateY(-160px) scale(2.2);
    opacity: 0;
  }
  65% {
    transform: translateY(0) scale(1.15);
    opacity: 1;
  }
  80% {
    transform: translateY(-12px) scale(0.95);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.needle-pin-card {
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 20, 28, 0.95);
  border: 1.5px solid var(--border-gold-bright);
  border-radius: 12px;
  padding: 4px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8), 0 0 10px var(--gold-glow);
  white-space: nowrap;
  pointer-events: auto;
  z-index: 10;
}

.needle-pin-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.needle-pin-icon {
  width: 44px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 6px 14px rgba(255, 71, 87, 0.9));
  animation: pinFloat 2.4s infinite ease-in-out;
  transform-origin: bottom center;
}

@keyframes pinFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.needle-pin-svg {
  width: 100%;
  height: 100%;
}

.needle-pin-shadow {
  position: absolute;
  bottom: -4px;
  width: 28px;
  height: 8px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.8) 0%, transparent 80%);
  border-radius: 50%;
}

/* Skyrim Atmospheric Overlays */
.skyrim-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 40%, rgba(5, 8, 12, 0.75) 100%);
  z-index: 2;
}

.skyrim-mist {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(11, 15, 20, 0.4) 0%, transparent 25%, transparent 75%, rgba(11, 15, 20, 0.7) 100%);
  z-index: 2;
}

/* Header & Floating Search UI */
.compass-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 12px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(180deg, rgba(8, 12, 16, 0.92) 0%, rgba(8, 12, 16, 0.6) 80%, transparent 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-inner {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.title-wrap {
  text-align: center;
  flex: 1;
}

.game-title {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--gold-primary);
  text-shadow: 0 0 8px var(--gold-glow);
  font-weight: 700;
}

.sub-title {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  letter-spacing: 2px;
  color: #fff;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.dragon-emblem {
  width: 32px;
  height: 32px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23d4af37'%3E%3Cpath d='M12 2L9.5 8.5L2 12l7.5 3.5L12 22l2.5-6.5L22 12l-7.5-3.5L12 2z'/%3E%3C/svg%3E") no-repeat center/contain;
  filter: drop-shadow(0 0 6px var(--gold-glow));
}

.world-switch-group {
  display: flex;
  background: rgba(14, 20, 28, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: 18px;
  padding: 2px;
  gap: 2px;
}

.world-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.world-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.4), rgba(180, 140, 20, 0.25));
  color: #fff;
  box-shadow: 0 0 8px var(--gold-glow);
}

.icon-btn {
  background: rgba(25, 36, 48, 0.8);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

.svg-icon {
  width: 18px;
  height: 18px;
  fill: var(--gold-primary);
}

/* Floating Search Bar */
.search-box-wrap {
  position: relative;
  width: 100%;
}

.search-input-group {
  display: flex;
  align-items: center;
  background: var(--bg-glass);
  border: 1.5px solid var(--border-gold);
  border-radius: 24px;
  padding: 0 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-input-group:focus-within {
  border-color: var(--cyan-accent);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 0 14px var(--cyan-glow);
  transform: translateY(-1px);
}

.search-icon {
  font-size: 16px;
  margin-right: 8px;
  opacity: 0.8;
}

#search-input {
  flex: 1;
  height: 42px;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
}

#search-input::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}

.clear-btn:hover {
  color: #fff;
}

/* Auto-complete Suggestions Dropdown */
.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-ui);
  list-style: none;
  box-shadow: var(--shadow-fantasy);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 50;
  animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Search History Panel */
.search-history-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-ui);
  box-shadow: var(--shadow-fantasy);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 45;
  padding: 10px 12px;
  animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.history-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-primary);
  letter-spacing: 0.5px;
}

.history-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.history-clear-btn:hover {
  color: #ff6b6b;
}

.history-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.history-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: #f0ede1;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.history-tag:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: var(--gold-primary);
  transform: translateY(-1px);
}

.history-tag-del {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 2px;
}

.history-tag-del:hover {
  color: #ff4757;
}

/* Pinned Marker Styling */
.skyrim-marker.marker-pinned {
  filter: drop-shadow(0 0 14px #ff4757) !important;
  z-index: 50 !important;
}

.skyrim-marker.marker-pinned::after {
  content: '📍';
  position: absolute;
  top: -16px;
  right: -8px;
  font-size: 18px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
  animation: bouncePin 1.5s infinite alternate ease-in-out;
}

@keyframes bouncePin {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

.skyrim-marker.marker-pinned .marker-inner {
  border-color: #ff4757 !important;
  background: rgba(45, 12, 18, 0.95) !important;
  box-shadow: 0 0 12px rgba(255, 71, 87, 0.8) !important;
}

.pin-btn {
  background: rgba(255, 71, 87, 0.15);
  color: #ff6b81;
  border: 1px solid rgba(255, 71, 87, 0.4);
}

.pin-btn:hover {
  background: rgba(255, 71, 87, 0.3);
}

.pin-btn.is-pinned {
  background: linear-gradient(135deg, #ff4757, #c0392b);
  color: #fff;
  border-color: #ff4757;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.suggestion-item:hover, .suggestion-item.highlighted {
  background: rgba(212, 175, 55, 0.18);
}

.sugg-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sugg-name-ja {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.sugg-name-en {
  font-size: 11px;
  color: var(--gold-primary);
  font-family: 'Cinzel', serif;
}

.sugg-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

/* Filter Chips Bar */
.filter-chips-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 6px;
  scrollbar-width: none;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.filter-chips-container::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  white-space: nowrap;
  background: rgba(18, 26, 36, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chip-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.35), rgba(180, 140, 20, 0.2));
  border-color: var(--gold-primary);
  color: #fff;
  box-shadow: 0 0 10px var(--gold-glow);
  transform: translateY(-1px);
}

/* Location Card UI (Bottom Sheet on Mobile, Floating on Desktop) */
.location-card {
  position: absolute;
  bottom: 24px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1.5px solid var(--border-gold-bright);
  border-radius: 18px;
  box-shadow: var(--shadow-fantasy);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 30;
  padding: 16px 18px;
  animation: cardEnter 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold-primary);
  border: 1px solid rgba(212, 175, 55, 0.4);
  margin-bottom: 4px;
}

.card-name-ja {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.card-name-en {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: var(--gold-primary);
  letter-spacing: 1px;
}

.btn-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.meta-row {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.meta-label {
  color: var(--gold-primary);
}

/* Quest Highlight Box */
.quest-box {
  background: linear-gradient(135deg, rgba(74, 224, 224, 0.12), rgba(20, 50, 70, 0.3));
  border-left: 3px solid var(--cyan-accent);
  padding: 10px 12px;
  border-radius: 4px 8px 8px 4px;
  margin-bottom: 10px;
}

.quest-box-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan-accent);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.quest-text {
  font-size: 13px;
  color: #e2f1f8;
  line-height: 1.45;
}

.desc-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

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

.action-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.primary-btn {
  background: linear-gradient(135deg, #d4af37, #aa8214);
  color: #0b0f14;
  border: none;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.4);
}

.primary-btn:active {
  transform: scale(0.96);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* HUD Footer Compass */
.hud-footer {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.hud-pill {
  background: rgba(11, 15, 20, 0.85);
  border: 1px solid var(--border-gold);
  padding: 4px 14px;
  border-radius: 14px;
  font-size: 11px;
  color: var(--gold-primary);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.compass-pointer {
  color: var(--cyan-accent);
  font-size: 9px;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Mobile responsive improvements */
@media (max-width: 640px) {
  .compass-header {
    padding: 8px 10px 4px;
    gap: 6px;
  }
  .brand-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .title-wrap {
    order: 1;
    text-align: left;
    flex: 1;
  }
  .dragon-emblem {
    display: none;
  }
  .world-switch-group {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 2px;
  }
  .world-btn {
    flex: 1;
    text-align: center;
    padding: 5px 6px;
    font-size: 11px;
  }
  .icon-btn {
    order: 2;
    width: 32px;
    height: 32px;
  }
  .game-title {
    font-size: 9px;
    letter-spacing: 2px;
  }
  .sub-title {
    font-size: 13px;
    letter-spacing: 1px;
  }
  #search-input {
    height: 38px;
    font-size: 13px;
  }
}

/* Desktop responsiveness adjustments */
@media (min-width: 768px) {
  .compass-header {
    padding: 16px 24px 8px;
  }
  .location-card {
    bottom: 32px;
    right: 24px;
    left: auto;
    width: 380px;
  }
}
