/* ==========================================
   1. CORE CONTAINER & BODY RESET
   ========================================== */
html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #0d0907;
  font-family: 'Georgia', 'Cinzel', 'Times New Roman', serif;
  color: #2b1d0c;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ==========================================
   2. WORLD VIEW MAIN LAYOUT (DARK LEATHER/STONE TABLE)
   ========================================== */
#world-view {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: row;
  box-sizing: border-box;
  padding: 12px;
  gap: 12px;
  background: 
    radial-gradient(circle at center, rgba(30, 20, 15, 0.8) 0%, rgba(10, 6, 4, 0.98) 100%),
    repeating-linear-gradient(45deg, rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 2px, transparent 2px, transparent 4px),
    #120c08;
  overflow: hidden;
}

/* Common Column Rules (Ancient Parchment Panels) */
.world-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* CSS-textured Weathered Parchment Cards */
.parchment-panel {
  background-color: #e3d2b2;
  background-image: 
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.35) 0%, rgba(160, 120, 70, 0.4) 100%),
    radial-gradient(circle at 10% 20%, rgba(110, 75, 35, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(90, 50, 20, 0.2) 0%, transparent 50%),
    repeating-linear-gradient(0deg, rgba(120, 80, 40, 0.03) 0px, rgba(120, 80, 40, 0.03) 1px, transparent 1px, transparent 3px);
  border: 2px solid #593e22;
  border-radius: 6px;
  box-shadow: 
    0 0 0 1px #8c683c,
    inset 0 0 20px rgba(70, 40, 10, 0.5),
    0 8px 24px rgba(0, 0, 0, 0.6);
  padding: 12px;
}

/* ==========================================
   3. COLUMN 1: WAYFINDER DEV CONTROLS (LEFT 5x5 GRID & ZOOM SLIDER)
   ========================================== */
.dev-col {
  align-items: center;
  justify-content: center;
}

.dev-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.dev-title {
  font-size: 0.8rem;
  color: #5c3e1e;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
  text-align: center;
}

/* 5x5 Extended D-Pad Grid */
.dpad-grid-5x5 {
  display: grid;
  grid-template-columns: repeat(5, 34px);
  grid-template-rows: repeat(5, 34px);
  gap: 4px;
}

.dpad-center {
  background: rgba(90, 62, 34, 0.25);
  border-radius: 50%;
  border: 1px dashed #8c683c;
}

/* Carved Runestone Buttons */
.dev-btn {
  background: radial-gradient(circle, #3d3227 0%, #211a14 100%);
  color: #d4af37;
  border: 1.5px solid #6b5335;
  border-radius: 4px;
  font-weight: bold;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  text-shadow: 0 0 4px rgba(212, 175, 55, 0.5);
  transition: all 0.1s ease;
}

.dev-btn-far {
  color: #e67e22;
  border-color: #a0522d;
  font-size: 0.65rem;
}

.dev-btn:active {
  background: #d4af37;
  color: #120c08;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
  text-shadow: none;
}

/* Runestone Zoom Control Box */
.zoom-control-box {
  margin-top: 12px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(40, 26, 15, 0.15);
  padding: 6px 10px;
  border: 1px dashed #8c683c;
  border-radius: 6px;
}

.zoom-label {
  font-size: 0.75rem;
  font-weight: bold;
  color: #4a321a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.zoom-label span {
  color: #8b0000;
  font-family: monospace;
  font-size: 0.85rem;
}

/* Styled Range Slider */
#zoom-slider {
  width: 100%;
  accent-color: #8b0000;
  cursor: pointer;
}

/* ==========================================
   4. COLUMN 2: ARCANE COMPASS (MIDDLE)
   ========================================== */
.radar-col {
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.view-header {
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 1px dashed #8c683c;
  width: 100%;
}

.view-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3b230f;
}

#gps-status {
  margin: 4px 0 0 0;
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7a4d1d;
}

.coord-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  background: rgba(20, 14, 10, 0.85);
  border: 1px solid #8c683c;
  border-radius: 12px;
  color: #d4af37;
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.8);
}

.radar-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
}

/* Brass Outer Compass Housing */
.compass-frame {
  padding: 8px;
  background: radial-gradient(circle, #b8860b 0%, #593e22 70%, #2b1d0c 100%);
  border-radius: 50%;
  border: 2px solid #d4af37;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6), inset 0 0 8px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canvas Glass / Arcane Pool */
#radar-canvas {
  background-color: #12100d;
  background-image: radial-gradient(circle at center, #1f1810 0%, #080605 100%);
  border: 2px solid #8c683c;
  border-radius: 50%;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9), 0 0 12px rgba(212, 175, 55, 0.2);
  max-width: 100%;
  max-height: 60vh;
  aspect-ratio: 1 / 1;
}

/* ==========================================
   5. COLUMN 3: LANDMARK SCROLL LIST (RIGHT)
   ========================================== */
.nodes-col h3 {
  margin: 0 0 10px 0;
  font-size: 1.05rem;
  border-bottom: 1px dashed #8c683c;
  padding-bottom: 6px;
  color: #3b230f;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.node-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.node-list::-webkit-scrollbar {
  width: 6px;
}
.node-list::-webkit-scrollbar-track {
  background: rgba(90, 50, 20, 0.1);
  border-radius: 3px;
}
.node-list::-webkit-scrollbar-thumb {
  background: #8c683c;
  border-radius: 3px;
}

/* Scroll Entry / Card */
.node-card {
  background: rgba(255, 248, 230, 0.65);
  border: 1px solid #a88454;
  border-radius: 4px;
  padding: 10px 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15), inset 0 0 8px rgba(160, 120, 70, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #4a341b;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.node-card:active {
  transform: scale(0.98);
  background: rgba(255, 240, 210, 0.85);
}

.node-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.node-card strong {
  font-size: 0.95rem;
  color: #2b1d0c;
  font-family: inherit;
}

.node-dist {
  font-size: 0.75rem;
  font-weight: bold;
  color: #8c5a2b;
}

.node-type {
  font-size: 0.75rem;
  color: #7a4d1d;
  font-style: italic;
}

/* Wax-Seal / Leather Action Button */
.engage-btn {
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #8b0000 0%, #5c0000 100%);
  border: 1px solid #d4af37;
  border-radius: 4px;
  color: #f7e7ce;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.engage-btn:active:not(:disabled) {
  transform: scale(0.97);
  background: linear-gradient(135deg, #5c0000 0%, #3b0000 100%);
}

.engage-btn:disabled {
  background: #3a3228 !important;
  border-color: #594a38 !important;
  color: #8a7a68 !important;
  cursor: not-allowed;
  box-shadow: none !important;
  text-shadow: none !important;
  opacity: 0.7;
}

.node-card:has([data-type="market"]) .engage-btn:not(:disabled) {
  background: linear-gradient(135deg, #1b4d2e 0%, #0d2b19 100%);
}

.node-card:has([data-type="market"]) .engage-btn:active:not(:disabled) {
  background: linear-gradient(135deg, #0d2b19 0%, #05140b 100%);
}