/* terrain-fx.css — Terrain FX panel and dock button styles */
/* Accent color: #44ddaa (teal-green) */

/* ─────────────────────────────────────────────
   Dock button
───────────────────────────────────────────── */
#module-terrain-fx .module-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

#module-terrain-fx .tfx-btn-icon {
  width: 44px;
  height: 44px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Planet globe */
#module-terrain-fx .tfx-btn-globe {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 34%,
      #a8f0d8 0%,
      #2eb88a 38%,
      #1a6e54 72%,
      #0a2e22 100%);
  box-shadow:
    0 0 8px rgba(68, 221, 170, 0.6),
    inset -3px -2px 7px rgba(0, 0, 0, 0.45);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  overflow: hidden;
}

/* Continent silhouette overlay inside the globe */
#module-terrain-fx .tfx-btn-globe::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 40% 28% at 45% 42%, rgba(68, 200, 140, 0.55) 0%, transparent 100%),
    radial-gradient(ellipse 22% 18% at 28% 62%, rgba(44, 160, 100, 0.45) 0%, transparent 100%),
    radial-gradient(ellipse 18% 14% at 68% 30%, rgba(50, 180, 115, 0.4) 0%, transparent 100%);
}

/* Animated atmosphere halo */
#module-terrain-fx .tfx-btn-halo {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(68, 221, 170, 0.45);
  box-shadow:
    0 0 8px rgba(68, 221, 170, 0.3),
    inset 0 0 6px rgba(68, 221, 170, 0.12);
  animation: tfx-halo-pulse 2.8s ease-in-out infinite;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
}

@keyframes tfx-halo-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.06); }
}

/* Active state */
#module-terrain-fx.is-active {
  background: rgba(68, 221, 170, 0.15);
  border-color: rgba(68, 221, 170, 0.5);
}

#module-terrain-fx.is-active .tfx-btn-halo {
  border-color: rgba(100, 240, 190, 0.85);
  box-shadow: 0 0 14px rgba(68, 221, 170, 0.65);
  animation-duration: 1.4s;
}

/* ─────────────────────────────────────────────
   Panel
───────────────────────────────────────────── */
.tfx-panel {
  position: fixed;
  right: 88px;
  top: 56px;
  width: 264px;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(68, 221, 170, 0.3) transparent;

  background: rgba(4, 18, 14, 0.90);
  border: 1px solid rgba(68, 221, 170, 0.20);
  border-radius: 14px;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 60px rgba(30, 140, 100, 0.10);

  padding: 0;
  z-index: 9000;

  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
  transform-origin: top right;
  transition:
    opacity 200ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.tfx-panel--open {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

/* ── Header ── */
.tfx-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(68, 221, 170, 0.13);
  position: sticky;
  top: 0;
  background: rgba(4, 18, 14, 0.94);
  backdrop-filter: blur(12px);
  z-index: 1;
  border-radius: 14px 14px 0 0;
  cursor: grab;
  user-select: none;
}
.tfx-header:active {
  cursor: grabbing;
}

.tfx-title {
  font-family: "Syne", "IBM Plex Mono", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(140, 240, 205, 0.92);
}

.tfx-close {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(68, 200, 155, 0.55);
  font-size: 14px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 150ms, background 150ms;
}
.tfx-close:hover {
  color: rgba(130, 240, 195, 0.9);
  background: rgba(68, 221, 170, 0.13);
}

/* ── Sections ── */
.tfx-section {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(68, 221, 170, 0.07);
}
.tfx-section:last-child {
  border-bottom: none;
  padding-bottom: 18px;
}

.tfx-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tfx-section-label {
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(68, 200, 155, 0.60);
}

/* ── Controls area ── */
.tfx-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 200ms;
}
.tfx-controls--disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Row ── */
.tfx-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tfx-label {
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 10px;
  color: rgba(130, 215, 185, 0.60);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tfx-val {
  color: rgba(155, 235, 205, 0.85);
  font-variant-numeric: tabular-nums;
}

/* ── Slider ── */
.tfx-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(68, 221, 170, 0.16);
  outline: none;
  cursor: pointer;
  transition: background 150ms;
}
.tfx-slider:hover {
  background: rgba(68, 221, 170, 0.28);
}
.tfx-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #a8f0d8, #29a878);
  box-shadow: 0 0 0 2px rgba(68, 221, 170, 0.35), 0 2px 6px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 120ms, box-shadow 120ms;
}
.tfx-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px rgba(68, 221, 170, 0.5), 0 2px 8px rgba(0,0,0,0.5);
}
.tfx-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 36% 34%, #a8f0d8, #29a878);
  box-shadow: 0 0 0 2px rgba(68, 221, 170, 0.35), 0 2px 6px rgba(0,0,0,0.5);
  cursor: pointer;
}

/* ── Color picker ── */
.tfx-color {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(68, 221, 170, 0.3);
  background: none;
  padding: 1px;
  cursor: pointer;
}
.tfx-color::-webkit-color-swatch-wrapper {
  padding: 0;
}
.tfx-color::-webkit-color-swatch {
  border-radius: 3px;
  border: none;
}

.tfx-select {
  width: 100%;
  background: rgba(8, 32, 24, 0.9);
  border: 1px solid rgba(68, 221, 170, 0.18);
  border-radius: 8px;
  color: rgba(180, 242, 220, 0.92);
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 10px;
  padding: 8px 10px;
}

.tfx-texture-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.tfx-planet-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tfx-planet-type-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(12, 55, 38, 0.18);
  border: 1px solid rgba(68, 221, 170, 0.14);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 150ms, border-color 150ms, transform 100ms, box-shadow 150ms;
}

.tfx-planet-type-card:hover {
  background: rgba(44, 160, 110, 0.24);
  border-color: rgba(68, 221, 170, 0.38);
  transform: translateY(-1px);
}

.tfx-planet-type-card--active {
  background: rgba(44, 160, 110, 0.32);
  border-color: rgba(68, 221, 170, 0.62);
  box-shadow: 0 0 12px rgba(68, 221, 170, 0.18);
}

.tfx-planet-type-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(circle at 30% 26%, rgba(127, 255, 222, 0.18), rgba(12, 18, 32, 0.92));
}

.tfx-planet-type-thumb-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tfx-planet-type-name {
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(160, 235, 200, 0.94);
}

.tfx-planet-type-copy {
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 8px;
  line-height: 1.45;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(144, 210, 182, 0.62);
}

.tfx-texture-grid--compact {
  max-height: 160px;
}

.tfx-texture-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(12, 55, 38, 0.18);
  border: 1px solid rgba(68, 221, 170, 0.14);
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, transform 100ms, box-shadow 150ms;
}

.tfx-texture-card:hover {
  background: rgba(44, 160, 110, 0.24);
  border-color: rgba(68, 221, 170, 0.38);
  transform: translateY(-1px);
}

.tfx-texture-card--active {
  background: rgba(44, 160, 110, 0.32);
  border-color: rgba(68, 221, 170, 0.62);
  box-shadow: 0 0 12px rgba(68, 221, 170, 0.18);
}

.tfx-texture-frame {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.tfx-texture-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tfx-texture-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(180, 242, 220, 0.72);
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tfx-texture-name {
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(160, 235, 200, 0.9);
}

/* ── Preset grid (5 terrain presets) ── */
.tfx-preset-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.tfx-preset-btn {
  background: rgba(20, 80, 55, 0.14);
  border: 1px solid rgba(68, 221, 170, 0.16);
  border-radius: 8px;
  color: rgba(100, 210, 165, 0.65);
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 16px;
  line-height: 1;
  padding: 7px 2px 5px;
  cursor: pointer;
  text-align: center;
  transition: background 160ms, border-color 160ms, color 160ms, transform 120ms;
}
.tfx-preset-btn span {
  display: block;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 3px;
  color: rgba(90, 195, 150, 0.60);
  transition: color 160ms;
}
.tfx-preset-btn:hover {
  background: rgba(68, 200, 140, 0.20);
  border-color: rgba(68, 221, 170, 0.40);
  color: rgba(180, 245, 220, 0.9);
  transform: translateY(-1px);
}
.tfx-preset-btn:hover span { color: rgba(160, 235, 200, 0.85); }

.tfx-preset-btn--active {
  background: rgba(44, 160, 110, 0.28);
  border-color: rgba(68, 221, 170, 0.55);
  color: rgba(200, 250, 230, 1);
  box-shadow: 0 0 10px rgba(68, 221, 170, 0.22);
}
.tfx-preset-btn--active span { color: rgba(160, 240, 205, 0.9); }

/* ── Toggle switch ── */
.tfx-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.tfx-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tfx-toggle-track {
  display: block;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: rgba(20, 80, 55, 0.28);
  border: 1px solid rgba(68, 221, 170, 0.22);
  transition: background 200ms, border-color 200ms;
  position: relative;
}

.tfx-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(68, 200, 155, 0.55);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), background 200ms;
}

.tfx-toggle input:checked + .tfx-toggle-track {
  background: rgba(44, 160, 110, 0.48);
  border-color: rgba(68, 221, 170, 0.50);
}

.tfx-toggle input:checked + .tfx-toggle-track::after {
  transform: translateX(14px);
  background: #44ddaa;
  box-shadow: 0 0 6px rgba(68, 221, 170, 0.7), 0 1px 3px rgba(0,0,0,0.4);
}

/* ── Toggle row (label + toggle inline) ── */
.tfx-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.tfx-toggle-row .tfx-label {
  justify-content: flex-start;
}

/* ── Sub-indent (controls indented under a toggle) ── */
.tfx-sub-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 4px;
  transition: opacity 200ms;
}
.tfx-sub-controls--hidden {
  opacity: 0.3;
  pointer-events: none;
}

/* ── Status chip shown when Terrain FX is active ── */
.tfx-active-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(68, 221, 170, 0.9);
  background: rgba(44, 160, 110, 0.18);
  border: 1px solid rgba(68, 221, 170, 0.30);
  border-radius: 4px;
  padding: 2px 6px;
}

/* ── Subsections ── */
.tfx-subsection {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(68, 221, 170, 0.06);
  margin-bottom: 2px;
}
.tfx-subsection:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tfx-sub-label {
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(68, 200, 155, 0.45);
  margin-bottom: 2px;
}

/* ── Feature row (label + toggle inline) ── */
.tfx-feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

/* ── Shader library grid ── */
.tfx-shader-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}

.tfx-shader-card {
  background: rgba(12, 55, 38, 0.18);
  border: 1px solid rgba(68, 221, 170, 0.14);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 3px 5px;
  gap: 2px;
  transition: background 150ms, border-color 150ms, transform 100ms;
  position: relative;
}
.tfx-shader-card:hover {
  background: rgba(44, 160, 110, 0.24);
  border-color: rgba(68, 221, 170, 0.40);
  transform: translateY(-1px);
}
.tfx-shader-card--active {
  background: rgba(44, 160, 110, 0.32);
  border-color: rgba(68, 221, 170, 0.60);
  box-shadow: 0 0 10px rgba(68, 221, 170, 0.20);
}

.tfx-shader-icon {
  font-size: 18px;
  line-height: 1;
}
.tfx-shader-name {
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(100, 210, 165, 0.70);
}
.tfx-shader-card--active .tfx-shader-name {
  color: rgba(160, 240, 205, 0.95);
}
.tfx-shader-tag {
  position: absolute;
  top: 2px;
  right: 2px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(68, 221, 170, 0.55);
  background: rgba(44, 160, 110, 0.18);
  border-radius: 2px;
  padding: 1px 2px;
}

/* ── Sun sync controls ── */
#tfx-sun-manual {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 200ms;
}
#tfx-sun-manual.tfx-controls--disabled {
  opacity: 0.3;
  pointer-events: none;
}

.tfx-subsection--reset {
  margin-top: 6px;
}

.tfx-reset {
  width: 100%;
  border: 1px solid rgba(68, 221, 170, 0.32);
  background: linear-gradient(180deg, rgba(18, 64, 48, 0.86), rgba(8, 26, 21, 0.96));
  color: rgba(182, 252, 226, 0.96);
  border-radius: 12px;
  min-height: 38px;
  font-family: "IBM Plex Mono", monospace, system-ui;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.tfx-reset:hover {
  transform: translateY(-1px);
  border-color: rgba(100, 238, 191, 0.55);
  box-shadow: 0 0 14px rgba(68, 221, 170, 0.16);
}
