/* ————— Aldencarte: aged-atlas UI ————— */

:root {
  --wood-dark: #2a1d12;
  --wood: #3a2a19;
  --wood-light: #4d3922;
  --paper: #e9dcbe;
  --paper-dim: #d9c9a4;
  --ink: #3b2a18;
  --ink-soft: #5d4630;
  --gold: #b98a2f;
  --gold-bright: #dcae51;
  --accent: #7c2d1e;
}

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

html, body { height: 100%; }

body {
  font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', Palatino, serif;
  background:
    radial-gradient(1200px 700px at 70% 30%, rgba(255, 214, 140, 0.05), transparent 60%),
    repeating-linear-gradient(94deg, rgba(0,0,0,0.10) 0 3px, transparent 3px 90px),
    repeating-linear-gradient(86deg, rgba(255,255,255,0.02) 0 2px, transparent 2px 55px),
    linear-gradient(160deg, #241809, #170f06 55%, #0e0903);
  color: var(--paper);
  overflow: hidden;
}

#app { display: flex; height: 100vh; }

/* ————— Sidebar ————— */

#sidebar {
  width: 300px;
  min-width: 300px;
  height: 100%;
  overflow-y: auto;
  padding: 20px 18px 14px;
  background:
    linear-gradient(180deg, rgba(255,225,160,0.05), transparent 140px),
    linear-gradient(90deg, rgba(0,0,0,0.25), transparent 14px),
    linear-gradient(270deg, rgba(0,0,0,0.45), transparent 10px),
    var(--wood);
  border-right: 3px solid #120b04;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5);
  scrollbar-width: thin;
  scrollbar-color: var(--wood-light) transparent;
}

.panel-head { text-align: center; margin-bottom: 14px; }

.panel-head h1 {
  font-variant: small-caps;
  font-weight: 600;
  font-size: 34px;
  letter-spacing: 4px;
  color: var(--gold-bright);
  text-shadow: 0 2px 6px rgba(0,0,0,0.7), 0 0 22px rgba(220,174,81,0.25);
}

.subtitle {
  font-style: italic;
  font-size: 12.5px;
  color: var(--paper-dim);
  opacity: 0.8;
  margin-top: 2px;
}

.panel-section {
  margin: 14px 0;
  padding: 12px 12px 10px;
  background: linear-gradient(180deg, rgba(233,220,190,0.07), rgba(233,220,190,0.03));
  border: 1px solid rgba(220,174,81,0.22);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.panel-section h2 {
  font-variant: small-caps;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 2px;
  color: var(--gold-bright);
  border-bottom: 1px solid rgba(220,174,81,0.25);
  padding-bottom: 5px;
  margin-bottom: 9px;
}

/* seed */
.seed-row label {
  display: block;
  font-variant: small-caps;
  letter-spacing: 1.5px;
  font-size: 13px;
  color: var(--gold-bright);
  margin-bottom: 6px;
}
.seed-controls { display: flex; gap: 6px; }
#seed-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 14px;
  padding: 7px 9px;
  color: var(--ink);
  background: linear-gradient(180deg, #efe3c6, #dfcfa8);
  border: 1px solid #8a6d3b;
  border-radius: 4px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.25);
}
#seed-input:focus { outline: 2px solid var(--gold); }
#dice-btn {
  font-size: 20px;
  line-height: 1;
  width: 38px;
  cursor: pointer;
  color: var(--paper);
  background: linear-gradient(180deg, var(--wood-light), var(--wood-dark));
  border: 1px solid rgba(220,174,81,0.4);
  border-radius: 4px;
}
#dice-btn:hover { color: var(--gold-bright); border-color: var(--gold-bright); }

/* generate button */
.big-btn {
  display: block;
  width: 100%;
  margin: 12px 0 2px;
  padding: 12px 10px;
  font-family: inherit;
  font-variant: small-caps;
  font-size: 17px;
  letter-spacing: 2px;
  font-weight: 700;
  cursor: pointer;
  color: #2b1c08;
  background: linear-gradient(180deg, #e8c46c, #c1913a 60%, #a87b2b);
  border: 1px solid #7a5a1e;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.45);
  transition: transform 0.06s ease, filter 0.15s ease;
}
.big-btn:hover { filter: brightness(1.08); }
.big-btn:active { transform: translateY(1px); }
.big-btn.working { filter: saturate(0.4) brightness(0.8); pointer-events: none; }

/* sliders */
.slider-row { margin: 9px 0; }
.slider-row label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  color: var(--paper);
  margin-bottom: 3px;
}
.slider-ends { display: flex; gap: 10px; }
.slider-ends em {
  font-size: 10.5px;
  color: var(--paper-dim);
  opacity: 0.75;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: #1b1207;
  border: 1px solid rgba(220,174,81,0.35);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.8);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f2d891, #c1913a 55%, #8a6420);
  border: 1px solid #5f4415;
  box-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #1b1207;
  border: 1px solid rgba(220,174,81,0.35);
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f2d891, #c1913a 55%, #8a6420);
  border: 1px solid #5f4415;
}

/* checkboxes */
.checks { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.checks label {
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--paper);
}
.checks input { accent-color: var(--gold); width: 15px; height: 15px; }

/* survey */
#survey-body { font-size: 13px; line-height: 1.45; }
#survey-body .site-name {
  font-variant: small-caps;
  letter-spacing: 1px;
  font-size: 15px;
  color: var(--gold-bright);
}
#survey-body .verdict { font-style: italic; margin: 6px 0; color: var(--paper); }
#survey-body table { width: 100%; border-collapse: collapse; margin-top: 4px; }
#survey-body td { padding: 2px 0; color: var(--paper-dim); }
#survey-body td:last-child { text-align: right; color: var(--paper); }
#survey-body .stars { color: var(--gold-bright); letter-spacing: 1px; }

/* legend */
.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}
.legend-grid span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--paper-dim);
}
.legend-grid canvas {
  background: #e7d9b5;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.35);
}

.panel-foot {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(220,174,81,0.2);
  font-size: 11.5px;
  font-style: italic;
  color: var(--paper-dim);
  opacity: 0.75;
  text-align: center;
  line-height: 1.5;
}

/* ————— Map area ————— */

#map-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  min-width: 0;
}

#map-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
  border: 10px solid transparent;
  border-image: linear-gradient(145deg, #6b5023, #3c2c11 30%, #7c5d29 55%, #2e2109 80%, #5c451d) 1;
  box-shadow:
    0 18px 60px rgba(0,0,0,0.75),
    inset 0 0 0 2px #16100a,
    inset 0 0 60px rgba(0,0,0,0.35);
  background: #d8c69d;
}

#map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  display: block;
}
#map-canvas.dragging { cursor: grabbing; }

#tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  max-width: 240px;
  padding: 8px 11px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--paper);
  background: linear-gradient(180deg, rgba(38,26,12,0.94), rgba(24,16,7,0.94));
  border: 1px solid rgba(220,174,81,0.5);
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}
#tooltip .tt-region {
  font-variant: small-caps;
  letter-spacing: 1px;
  font-size: 13.5px;
  color: var(--gold-bright);
}
#tooltip .tt-biome { color: var(--paper); }
#tooltip .tt-note { font-style: italic; color: var(--paper-dim); font-size: 11.5px; }

#forging[hidden] { display: none; }

#forging {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 13, 5, 0.35);
  backdrop-filter: blur(1px) sepia(0.3);
}
#forging span {
  font-variant: small-caps;
  letter-spacing: 3px;
  font-size: 22px;
  color: #f4e3b2;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
  animation: forgepulse 1.2s ease-in-out infinite;
}
@keyframes forgepulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* narrow screens */
@media (max-width: 760px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; min-width: 0; height: 45%; border-right: none; border-bottom: 3px solid #120b04; }
  #map-wrap { padding: 10px; }
}
