:root {
  --bg-deep: #0a0a0f;
  --bg-navy: #0d1117;
  --surface: rgba(15, 15, 25, 0.85);
  --surface-solid: #0f0f19;
  --gold: #c9a959;
  --gold-muted: #8b7355;
  --gold-dark: #3d3424;
  --silver-blue: #7b8fa3;
  --text-primary: #e8e4dc;
  --text-dim: #6b6a65;
  --border-bronze: #3d3424;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: radial-gradient(ellipse at 50% 0%, var(--bg-navy) 0%, var(--bg-deep) 70%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

#root { min-height: 100vh; }

.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-serif { font-family: 'Cormorant Garamond', serif; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-muted); }

/* Animations */
@keyframes pulse-infinity {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

@keyframes rippleIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes borderGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(201, 169, 89, 0.3), inset 0 0 8px rgba(201, 169, 89, 0.05); }
  50% { box-shadow: 0 0 20px rgba(201, 169, 89, 0.6), inset 0 0 12px rgba(201, 169, 89, 0.1); }
}

@keyframes odometer {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes particleFloat {
  0% { transform: translate(0, 0) scale(1); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

.animate-pulse-infinity {
  animation: pulse-infinity 3s ease-in-out infinite;
}

.shimmer-bg {
  background: linear-gradient(90deg, transparent 0%, rgba(201,169,89,0.08) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

.cell-enter {
  animation: rippleIn 0.3s ease-out both;
}

.border-glow-active {
  animation: borderGlow 2s ease-in-out infinite;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--gold-muted);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(201,169,89,0.05), transparent);
  background-size: 200% 100%;
  animation: shimmer 4s ease-in-out infinite;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--gold);
  background: rgba(201, 169, 89, 0.05);
}

/* Grid cell */
.grid-cell {
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-bronze);
  overflow: hidden;
  background: var(--surface-solid);
}

.grid-cell:hover {
  border-color: var(--gold-muted);
  transform: scale(1.03);
  z-index: 10;
  box-shadow: 0 0 12px rgba(201, 169, 89, 0.2);
}

.grid-cell.center-cell {
  border: 2px solid var(--gold);
  animation: borderGlow 2s ease-in-out infinite;
  z-index: 5;
}

.grid-cell .cell-address {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 4px;
  background: rgba(10,10,15,0.85);
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  color: var(--gold-muted);
  opacity: 0;
  transition: opacity 0.2s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid-cell:hover .cell-address {
  opacity: 1;
}

/* Vignette on grid */
.grid-vignette {
  position: relative;
}

.grid-vignette::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 60px 30px rgba(10, 10, 15, 0.5);
  border-radius: 4px;
}

/* Skeleton loading */
.skeleton-cell {
  background: linear-gradient(90deg, var(--surface-solid) 25%, rgba(61,52,36,0.3) 50%, var(--surface-solid) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* Button styles */
.btn-gold {
  background: var(--gold);
  color: var(--bg-deep);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}

.btn-gold:hover {
  background: #d4b668;
  box-shadow: 0 0 12px rgba(201, 169, 89, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-muted);
  font-family: 'JetBrains Mono', monospace;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
}

.btn-outline:hover {
  border-color: var(--gold);
  background: rgba(201, 169, 89, 0.1);
}

/* Tab buttons */
.tab-btn {
  background: transparent;
  color: var(--silver-blue);
  border: 1px solid transparent;
  border-bottom: none;
  padding: 8px 16px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  transition: all 0.2s;
  border-radius: 4px 4px 0 0;
}

.tab-btn.active {
  color: var(--gold);
  border-color: var(--gold-muted);
  background: var(--surface);
}

.tab-btn:hover:not(.active) {
  color: var(--text-primary);
}

/* Input styles */
.input-dark {
  background: rgba(10, 10, 15, 0.9);
  border: 1px solid var(--border-bronze);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.input-dark:focus {
  border-color: var(--gold);
}

/* Context menu */
.context-menu {
  position: fixed;
  background: rgba(15, 15, 25, 0.95);
  border: 1px solid var(--gold-muted);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 180px;
  z-index: 1000;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.context-menu-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.context-menu-item:hover {
  background: rgba(201, 169, 89, 0.1);
  color: var(--gold);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: var(--surface-solid);
  border: 1px solid var(--gold-muted);
  border-radius: 8px;
  padding: 40px;
  max-width: 560px;
  width: 90%;
  position: relative;
  box-shadow: 0 0 60px rgba(201, 169, 89, 0.1);
}

.modal-content::before,
.modal-content::after {
  content: '✦';
  position: absolute;
  color: var(--gold-muted);
  font-size: 14px;
}

.modal-content::before { top: 12px; left: 16px; }
.modal-content::after { bottom: 12px; right: 16px; }

/* Ornate corners for image preview */
.ornate-frame {
  position: relative;
  padding: 8px;
  border: 1px solid var(--gold-dark);
}

.ornate-frame::before,
.ornate-frame::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--gold-muted);
  border-style: solid;
}

.ornate-frame::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.ornate-frame::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

/* Sidebar */
.sidebar-panel {
  background: var(--surface);
  border-right: 1px solid var(--border-bronze);
  backdrop-filter: blur(12px);
}

/* Scale slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border-bronze);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: 2px solid var(--bg-deep);
}

/* Bookmark item */
.bookmark-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.bookmark-item:hover {
  border-color: var(--gold-dark);
  background: rgba(201, 169, 89, 0.05);
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-bronze);
  }
}

@media (max-width: 768px) {
  .modal-content {
    padding: 24px;
    max-width: 95%;
  }
}

/* Tooltip */
.tooltip-container {
  position: relative;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 25, 0.95);
  border: 1px solid var(--gold-dark);
  color: var(--text-primary);
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 100;
  transition: all 0.15s;
  pointer-events: none;
  margin-bottom: 4px;
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Particle */
.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gold);
  pointer-events: none;
  animation: particleFloat 1.5s ease-out forwards;
}

/* Footer */
.archive-footer {
  border-top: 1px solid var(--border-bronze);
  background: rgba(10, 10, 15, 0.6);
}

.archive-footer a {
  color: var(--gold-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.archive-footer a:hover {
  color: var(--gold);
}