@font-face {
  font-family: 'Archivo';
  src: url('/static/fonts/Archivo_regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap; /* ensures text is visible while loading */
}
@font-face {
  font-family: 'Archivo';
  src: url('/static/fonts/Archivo_medium.woff') format('woff');
  font-weight: 700;
  font-style: medium;
  font-display: swap;
}
@font-face {
  font-family: 'Inconsolata';
  src: url('/static/fonts/Inconsolata-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inconsolata';
  src: url('/static/fonts/Inconsolata-Bold.woff') format('woff');
  font-weight: 400;
  font-style: bold;
  font-display: swap;
}


html {
  background: black;
}

html, body {
  margin: 0;
  padding: 0;
/*  color: #ddd; */
  width: 100%;
  height: 100%;
  font-family: 'Archivo', regular;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
}

* {
  cursor: default;
}

/* Override for specific interactive elements */
button, 
.similar-panel-header,
.node,
.link {
  cursor: pointer;
}

/* Only show text cursor for inputs and textareas */
input[type="text"],
textarea {
  cursor: text;
}

p {
  font-family: 'Inconsolata', normal;
}

a:hover {
  color: darkorange;
}

h1, h2, h3 {
  font-family: Archivo, normal;
}

.menu {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
}

.menu a {
  font-family: 'Archivo', sans-serif; /* to match your headings */
  text-decoration: none;
  color: white; /* or your preferred text color */
  font-size: 16px;
  padding: 8px 12px;
  transition: color 0.3s ease;
  position: relative; /* Add this */
  z-index: 201;
}

.menu a:hover {
  color: orange; /* subtle hover effect */
  text-decoration: underline;
}


#star-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1; /* puts it behind everything else */
  display: block;
  pointer-events: none;
  background: black; /* fallback in case canvas fails */
  user-select: none;  /* Prevent text selection */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  outline: none;  /* Remove focus outline */
  cursor: default !important;
}

.input-container {
  position: fixed;      /* stays fixed in the viewport */
  padding-left: 10px;
  padding-right: 10px; 
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column; 
  justify-content: center;
  align-items: center;
  pointer-events: auto; /* keeps inputs clickable */
  z-index: 100;         /* stays above canvas */
}

.input-container img {
  max-width: 200px;
  margin-bottom: 40px;
  animation: glowPulse 5s ease-in-out infinite;
}

.dream-box {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  box-sizing: border-box;
  padding: 20px;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.08),
              0 0 50px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  transition: box-shadow 0.3s ease;
  width: 80vw;
  max-width: 800px;
}
.dream-box:hover {
  box-shadow: 0 0 35px rgba(255, 255, 255, 0.15),
              0 0 60px rgba(255, 255, 255, 0.1);
}
.dream-box textarea {
  width: 100%;
  height: 160px;
  background: transparent;
  border: none;
  color: #eee;
  font-family: 'Inconsolata', normal;
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  resize: none;
}

.submit-form {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.submit-form button {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 10px 20px;
  color: #ddd;
  font-family: 'Inconsolata', monospace;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}
.submit-form button:hover {
  background: rgba(100, 100, 100, 0.8);
}

/* modal for help and info on how to use */
.help-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  display: none;  /* <-- HIDDEN initially */
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.help-modal button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 10px;
  color: #ddd;
  font-family: 'Inconsolata', monospace;
  font-size: 14px;
  cursor: pointer;
}
.help-modal.show {
  display: flex;
}
.help-modal-content {
  position: relative;
  background: #111;
  color: #eee;
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  text-align: left;
}

button {
  margin-top: 10px;
  padding: 8px 16px;
  font-size: 16px;
  cursor: pointer;
}


#explore-dreams {
  margin-top: 20px;
  text-align: right;
}

#explore-dreams a {
  font-family: 'Archivo', regular;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
}
#explore-dreams a:hover {
  color: orange;
  text-decoration: underline;
}

/* ———————————— constellation ——————————— */
.constellation-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  cursor: default;
}
.node.selected {
  fill: #ffd700 !important; /* Force gold/yellow color */
  stroke: #ffd700 !important; /* Force gold stroke */
  stroke-width: 3px !important; /* Force thick stroke */
}

/* ↓ Header ↓ */
.header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 10px;
  text-align: center;
  z-index: 10;
}
.header button {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 10px;
  color: #ddd;
  font-family: 'Inconsolata', normal;
  font-size: 13px;
}
.header button:hover {
  background: rgba(100,100,100);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 10px;
  color: #ddd;
}
/* Full-screen overlay for dream modal */
#dreamModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8); /* 80% black opacity */
  display: none; /* hidden by default */
  z-index: 2000; /* above everything else */
  pointer-events: all; /* accept clicks */
  
  /* Center the content when shown */
  align-items: center;
  justify-content: center;
}

/* When modal is shown */
#dreamModal.show {
  display: flex;
}

/* The actual modal container */
.dream-modal-container {
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 40px;
  border-radius: 12px;
  width: 25vw; /* 1/4 of screen width */
  max-width: 600px;
  min-width: 400px;
  max-height: 70vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  
  /* Smooth animations */
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* When modal is shown */
#dreamModal.show .dream-modal-container {
  opacity: 1;
  transform: scale(1);
}

/* Dream ID heading */
.dream-modal-container h2 {
  font-family: 'Archivo', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 30px 0;
}

/* Dream text */
/* Catalogue address shown with a dream: DA-<id> never changes, the J-part is
   where the dream currently sits, so it moves as the sky re-lays-out. */
.dream-modal-designation {
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #ffd27f;
  margin: 0 0 14px;
  opacity: 0.85;
}

.dream-modal-text {
  font-family: 'Inconsolata', monospace;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Close instruction (subtle) */
.dream-modal-close-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Inconsolata', monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  opacity: 0;
  animation: fadeInDelay 2s ease-out 1s forwards;
}

@keyframes fadeInDelay {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .dream-modal-container {
    width: 30vw; /* Slightly larger on smaller screens */
  }
}

@media (max-width: 900px) {
  .dream-modal-container {
    width: 40vw;
    min-width: 350px;
  }
}

@media (max-width: 768px) {
  /* Hide on mobile - use bottom drawer instead */
  #dreamModal {
    display: none !important;
  }
}
/* ↑ end on dream modal ↑ */ 

/* ↓ Panel similar dreams ↓ */
.left-column {
  position: absolute;
  top: 100px;
  left: 20px;
  bottom: 56px;          /* stop above the contact line */
  width: 300px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 20;
  pointer-events: none;   /* the sky stays draggable between the panels */
}
.left-column > * { pointer-events: auto; }

/* The dream you have selected. Sits directly under the logo because it is the
   thing you are actually reading; everything else is context for it. */
.selected-panel {
  /* Shares the column with the most-similar list, so neither can take the
     whole window. A long dream scrolls inside its own box. */
  max-height: 34vh;
  background: rgba(0,0,0,0.82);
  border: 1px solid #3a3f52;
  border-radius: 4px;
  padding: 11px 13px 13px;
  flex: 0 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.selected-panel[hidden] { display: none; }
.selected-desig {
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  letter-spacing: 0.13em;
  color: #ffd27f;
  margin-bottom: 7px;
  flex: none;
}
.selected-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: #e6eaf5;
  overflow-y: auto;
}

.similar-panel {
  /* Back in the left column, under the dream you selected — the thing you are
     reading and the things it is near, in one place. It is a child of
     .left-column in the markup, so it only has to stop taking itself out. */
  position: static;
  width: auto;
  max-width: 300px;
  /* The column starts at 100px and the contact line sits at the bottom; this
     keeps the list from running underneath it however long the dream is. */
  max-height: 34vh;
  min-height: 0;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.8);
  border: 1px solid #444;
  border-radius: 4px;
  z-index: 20;
  color: #ddd;
  overflow: hidden;
  font-family: 'Inconsolata', normal;
}
/* Collapsed, it should be just the header — not a tall empty box. */
.similar-panel.collapsed { flex: 0 0 auto; }
.similar-panel-header {
  background: #222;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  font-size: 14px;
}
.similar-panel-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 5px 10px;
  font-size: 14px;
}
.similar-panel-content li {
  padding: 7px 8px;
  display: -webkit-box;
  -webkit-line-clamp: 5;      /* a preview, not the whole dream */
  -webkit-box-orient: vertical;
  overflow: hidden;
  border-radius: 3px;
  transition: background 0.13s ease, color 0.13s ease;
}
.similar-panel-content li:hover,
.similar-panel-content li:focus-visible {
  background: rgba(255, 210, 127, 0.11);
  color: #fff;
  outline: none;
}
.similar-panel-content li:hover small { color: #ffd27f; }
@media (prefers-reduced-motion: reduce) {
  .similar-panel-content li { transition: none; }
}
/* ↑ end of similar dreams ↑ */

/* Mobile Bottom Sheet - Hidden on Desktop */
.bottom-sheet-container {
  display: none; /* Hidden by default */
}

/* —————— Submit another dream ———————*/
.another_dream {
  /* Sits inside .left-column now (selected dream, then this, then the
     most-similar list). It used to be position:fixed, which took it out of the
     column and dropped it on top of the panel below. */
  position: static;
  flex: none;
  text-align: left;
  color: #ddd;
  font-family: 'Inconsolata', monospace;
  font-size: 13px;
  max-width: 300px;
}

/* The contact line belongs at the bottom of the window, not wherever the left
   column happens to end — that moves with however long the selected dream is. */
.another_dream p {
  position: fixed;
  bottom: 18px;
  left: 20px;
  margin: 0;
  max-width: 300px;
  color: #b9bed0;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}

.another_dream button {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 10px;
  color: #ddd;
  font-family: 'Inconsolata', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.another_dream button:hover {
  background: rgba(100, 100, 100, 0.8);
}

/* ———————————————————— Search function ————————————————— */
/* Search bar */
.search-container {
  position: relative;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 0 12px;
  color: #ddd;
  height: 45px; /* Same height */
  min-width: 250px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.search-container input {
  background: transparent;
  border: none;
  color: #ddd;
  padding: 0;
  width: 100%;
  height: 100%;
  outline: none;
  font-family: 'Inconsolata', monospace;
  font-size: 13px;
}

.search-container input::placeholder {
  color: #666;
  font-family: 'Inconsolata', monospace;
}



/* Clear search button */
.clear-search-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  margin-left: 8px;
  margin-bottom: 10px;
  border-radius: 3px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  height: auto;
}

.clear-search-btn:hover {
  color: #999;
  background: rgba(255, 255, 255, 0.1);
}


.clear-search-btn:active {
  transform: scale(0.95);
}

/* Search results display */
.search-results {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 8px;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: 8px;
  font-size: 12px;
  color: #ddd;
  z-index: 1000;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  max-height: 300px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(10px);
  animation: searchResultsSlideIn 0.2s ease-out forwards;
}

.search-results::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(255, 107, 107, 0.4);
}

@keyframes searchResultsSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom scrollbar for search results */
.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 107, 0.4);
  border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 107, 0.6);
}

.search-results-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 107, 107, 0.2);
  margin-bottom: 8px;
}

.match-count {
  font-weight: bold;
  color: #ff6b6b;
  font-size: 13px;
}

.keywords {
  color: #999;
  font-style: italic;
  font-size: 11px;
}

/* Search dreams list */
.search-dreams-list {
  margin-top: 0;
}

.search-dreams-list h4 {
  margin: 0 0 8px 0;
  color: #ddd;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ff6b6b;
}

.search-dream-item {
  padding: 8px 10px;
  margin: 1px 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  position: relative;
}

.search-dream-item:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.3);
  transform: translateX(2px);
}

.search-dream-item:active {
  transform: translateX(2px) scale(0.98);
}

.dream-id {
  display: inline-block;
  font-size: 10px;
  color: #ff6b6b;
  font-weight: bold;
  background: rgba(255, 107, 107, 0.1);
  padding: 2px 6px;
  border-radius: 10px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dream-text {
  display: block;
  font-size: 11px;
  color: #ddd;
  line-height: 1.3;
  font-weight: 300;
}

/* Search loading indicator */
.search-loading {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 20px;
}

/* Highlight search matches */
.node.search-match {
  filter: drop-shadow(0 0 8px rgba(255, 107, 107, 0.6));
}

/* Search term highlighting in text */
.search-highlight {
  background-color: rgba(255, 107, 107, 0.3);
  color: #fff;
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: bold;
}


/* ——————————————————— Toolbar ————————————————————*/
.toolbar {
  position: fixed;
  bottom: 20px;
  left: 0; 
  right: 0;
  display: flex;
  flex-direction: row-reverse; /* Keep header on right, content on left */
  align-items: center; /* Center align all items */
  gap: 12px;
  padding: 0 20px;
  font-family: 'Inconsolata', monospace;
  font-size: 13px;
  z-index: 101;
  height: 45px; /* Fixed height for all elements */
}

.toolbar-header {
  background: rgba(34, 34, 34, 0.8);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #444;
  border-radius: 4px;
  color: #ddd;
  height: 45px; /* Same height as toolbar */
  min-width: 80px;
  flex-shrink: 0; /* Prevent shrinking */
  box-sizing: border-box;
}

.toolbar-content {
  display: flex;
  flex-direction: row; /* Horizontal layout for content */
  align-items: center;
  gap: 12px;
  height: 45px; /* Same height as toolbar */
}

.toolbar.collapsed .toolbar-content {
  display: none;
}

/* When toolbar is collapsed: disable its interactions */
.toolbar.collapsed {
  pointer-events: none;
  padding: 0 20px; /* Keep padding */
}

/* But keep the header clickable to reopen it */
.toolbar.collapsed .toolbar-header {
  pointer-events: auto;
}



/* Threshold slider*/
.threshold-slider {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 8px 12px;
  color: #ddd;
  height: 45px; /* Same height */
  min-width: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

.threshold-slider label {
  font-size: 10px;
  color: #aaa;
  margin: 0 0 2px 0;
  line-height: 1;
}

.threshold-slider input[type="range"] {
  width: 100%;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  margin: 0;
}

.threshold-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}

.threshold-slider input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}


/* SVG constellation */
svg {
  width: 100vw;
  height: 100vh;
  background: #000;
  overscroll-behavior: contain;
}
.node { cursor: pointer; }
.link { stroke-opacity: 0.3; }
.tooltip {
  position: absolute;
  text-align: left;
  padding: 8px 12px;
  font-family: 'Inconsolata', monospace;
  font-size: 11px;
  line-height: 1.3;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  color: #ddd;
  backdrop-filter: blur(10px);
  max-width: 300px;
  max-height: calc(1.3em * 3 + 16px); /* 3 lines of text + padding */
  overflow: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.spinner-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  z-index: 999; 
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  border: 8px solid #222;
  border-top: 8px solid #fff;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

/* Live page specific styles */
.live-container .spinner {
  border: 4px solid #333;
  border-top: 4px solid #fff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes glowPulse {
  0% {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
  }
  100% {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
  }
}

/* ——————————— about page ——————————*/
.about-content p {
  font-family: 'Archivo', regular;
  color: #fff;
  padding-left: 50vw;
  padding-right: 5vw;
}

.logo-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 90;
}

.logo-container a {
  display: inline-block;
  transition: all 0.3s ease;
  border-radius: 8px;
  padding: 8px;
}

.logo-container a:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.logo-container a:active {
  transform: scale(0.98);
}

.logo-container img {
  height: 50px;
  width: auto;
  cursor: pointer;
  display: block;
  transition: filter 0.3s ease;
}

.logo-container a:hover img {
  filter: brightness(1.2) drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

/* Mobile improvements */
@media (max-width: 768px) {
  .logo-container {
    top: 15px;
    left: 15px;
  }
  
  .logo-container a {
    padding: 12px; /* Larger touch target on mobile */
    min-width: 44px; /* iOS recommended minimum touch target */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .logo-container img {
    height: 40px; /* Slightly smaller on mobile */
  }
  
  .logo-container a:hover {
    /* Disable hover effects on mobile to prevent sticky states */
    transform: none;
    background: none;
    box-shadow: none;
  }
  
  .logo-container a:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.1);
  }
}

/* —————— footer —————— */
footer {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
  cursor: default;
}

.landing-footer .horizon {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 10vh;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  cursor: default;
}

/* ————————————————————————————————————————— MOBILE version ———————————————————————————————————————————————————————————————————————————————————————————————————————— */

@media (max-width: 768px) {
  /* --- GENERAL LAYOUT --- */
  body {
    font-size: 16px; /* slightly larger for readability */
  }

  /* GPU perf: limit repaint scope of the constellation SVG */
  #constellation {
    contain: layout style paint;
  }

  .similar-panel {
    display: none !important; /* Your existing similar panel hidden */
  }
  #tooltip {
    display: none !important; /* Desktop tooltips hidden */
  }
  .input-container {
    position: fixed;      /* stays fixed in the viewport */
    padding-left: 10px;
    padding-right: 10px; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column; 
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* keeps inputs clickable */
    z-index: 90;         /* stays above canvas */
  }
  /* --- TOOLBAR --- */
  /* EXPANDED STATE - When toolbar is open */
  .toolbar {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align everything to the right */
    gap: 10px;
    padding: 0;
    height: auto;
    z-index: 100;
  }
  
  .toolbar-header {
    background: rgba(34, 34, 34, 0.8);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px 15px;
    margin-bottom: 10px;
    color: #ddd;
    height: 40px;
    width: 80px; /* Fixed width for header */
    min-width: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    box-sizing: border-box;
  }
  
  .toolbar-content {
    display: flex;
    flex-direction: column;
    align-items: stretch; /* Make content items full width */
    gap: 10px;
    width: 100%; /* Full width for content */
    height: auto;
    display: none;
  }

  
  /* COLLAPSED STATE - When toolbar is minimized */
  .toolbar.collapsed {
    position: fixed;
    top: 10px;
    right: 10px;
    left: auto;
    width: 80px;
    height: 40px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column; /* Keep column but it only has header */
    pointer-events: none;
  }
  
  .toolbar.collapsed .toolbar-header {
    pointer-events: auto;
    width: 80px;
    height: 40px;
    margin: 0;
  }
  
  .toolbar.collapsed .toolbar-content {
    display: none;
  }

  /* Search container for mobile */
  .search-container {
    position: relative;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0 12px;
    color: #ddd;
    height: 40px;
    width: 100%; /* Full width */
    min-width: auto;
    display: flex;
    align-items: center;
    box-sizing: border-box;
  }
  
  .search-container input {
    background: transparent;
    border: none;
    color: #ddd;
    padding: 0;
    width: 100%;
    height: 100%;
    outline: none;
    font-family: 'Inconsolata', monospace;
    font-size: 16px; /* Larger for mobile */
  }
  /* Hide search results banner on mobile */
  .search-results {
    display: none !important;
  }
  /* Threshold slider for mobile */
  .threshold-slider {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 12px;
    color: #ddd;
    height: 40px;
    width: 100%; /* Full width */
    min-width: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
  }
  
  .threshold-slider label {
    font-size: 10px;
    color: #aaa;
    margin: 0 0 2px 0;
    line-height: 1;
  }
  
  .threshold-slider input[type="range"] {
    width: 100%;
    height: 6px; /* Slightly larger for mobile touch */
    background: #333;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    margin: 0;
  }
  
  .threshold-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px; /* Larger for mobile touch */
    height: 20px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
  }
  
  .threshold-slider input[type="range"]::-moz-range-thumb {
    width: 20px; /* Larger for mobile touch */
    height: 20px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
  }


  /* Hide desktop panel on mobile */
  .similar-panel {
    display: none !important;
  }

  /* Show bottom sheet container on mobile */
  .bottom-sheet-container {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100vh;
    pointer-events: none;
    z-index: 30;
  }

  /* Bottom sheet styles */
  .bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.97);
    /* backdrop-filter removed — extremely GPU-expensive on mobile */
    border-radius: 16px 16px 0 0;
    transform: translateY(calc(100% - 200px)); /* Peek by default */
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: auto;
    max-height: 85vh;
    min-height: 80px;
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  /* Sheet states */
  .bottom-sheet.peek {
    transform: translateY(calc(100% - 120px));
  }

  .bottom-sheet.expanded {
    transform: translateY(5vh); /* Only 5% from top */
    max-height: 95vh;
  }

  /* Sheet handle */
  .sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.4);
    border-radius: 2px;
    margin: 12px auto;
    cursor: grab;
    transition: background 0.2s;
  }

  .sheet-handle:active {
    cursor: grabbing;
    background: rgba(255,255,255,0.6);
  }

  /* Sheet header */
  .sheet-header {
    padding: 0 20px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    user-select: none;
  }

  .sheet-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
  }

  .sheet-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
  }

  /* Sheet content */
  .sheet-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(70vh - 120px);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; /* Prevent pull-to-refresh */
    touch-action: pan-y; /* Allow vertical scrolling */
  }

  .no-selection {
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-style: italic;
    padding: 40px 20px;
  }

  .dream-display {
    display: none;
  }

  .dream-display.active {
    display: block;
  }

  .dream-text {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: rgba(255,255,255,0.9);
    max-height: 120px; /* Preview in peek state */
    overflow: hidden;
  }
  .bottom-sheet.expanded .dream-text {
    max-height: none; /* Full text in expanded */
  }

  .dream-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
  }

  .similarity-score {
    background: rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 12px;
  }

  /* ——————— Similar dreams list ———————— */
  .similar-dreams h4 {
    font-size: 14px;
    margin-bottom: 15px;
    color: rgba(255,255,255,0.8);
  }

  .similar-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .similar-item {
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
  }

  .similar-item:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
  }

  .similar-item:active {
    background: rgba(255,255,255,0.15);
  }

  .similar-text {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .similar-score {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
  }

  /* Hide desktop similar panel on mobile only */
  .similar-panel {
    display: none;
  }

  /* Hide "Submit Another Dream" button on mobile to avoid bottom sheet conflicts */
  .another_dream {
    display: none;
  }

  /* --- DREAM INPUT BOX --- */
  .dream-box {
    width: 90vw;          /* scale with screen */
    max-width: none;      /* remove fixed 900px */
    font-size: 16px;
  }

  /* --- BUTTONS --- */
  .buttons button {
    width: 100%;           /* big easy-to-tap buttons */
    font-size: 18px;
    padding: 14px;
  }

  /* --- HIDE CLUTTER --- */
  .another_dream p { 
    display: none; /* hide "for questions contact..." on mobile */
  }

  /* ——— BOTTOM DRAWER ———*/
  /* Show bottom sheet container on mobile */
  .bottom-sheet-container {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100vh;
    pointer-events: none;
    z-index: 30;
  }

  /* Sheet states */
  .bottom-sheet.peek {
    transform: translateY(calc(100% - 120px));
  }

  .bottom-sheet.expanded {
    transform: translateY(15vh);
  }

  /* Sheet handle */
  .sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    margin: 12px auto;
    cursor: grab;
    transition: background 0.2s ease;
    touch-action: none;
  }

  .sheet-handle:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.6);
  }

  /* Sheet header */
  .sheet-header {
    padding: 0 20px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    user-select: none;
    pointer-events: none; /* Prevent interference with drag */
  }

  .sheet-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
    font-family: 'Archivo', sans-serif;
  }

  /* Sheet content */
  .sheet-content {
    padding: 20px;
    padding-bottom: 60px;
    overflow-y: auto;
    max-height: calc(70vh - 120px);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; /* Keep this specific one */
    overscroll-behavior-y: contain; /* Prevent pull-to-refresh */
    touch-action: pan-y; /* Allow vertical scrolling */
    overflow-scrolling: touch;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  /* No selection state */
  .no-selection {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    font-size: 14px;
    font-family: 'Inconsolata', monospace;
  }

  /* Dream display */
  .dream-display {
    display: none;
  }

  .dream-display.active {
    display: block;
  }

  .dream-text {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Inconsolata', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  .dream-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Inconsolata', monospace;
  }

  .similarity-score {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
  }

  /* Similar dreams section */
  .similar-dreams {
    margin-top: 20px;
    margin-bottom: 40px; /* Add extra bottom margin */
  }

  /* Last similar item gets extra margin */
  .similar-item:last-child {
    margin-bottom: 20px;
  }

  .similar-dreams h4 {
    font-size: 14px;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Archivo', sans-serif;
  }
  
  .similar-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  
  .similar-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    touch-action: manipulation;
  }

  .similar-item:hover,
  .similar-item:active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
  }

  .similar-item:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.15);
  }

  .similar-text {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Inconsolata', monospace;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .similar-score {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Inconsolata', monospace;
  }

  /* Improve touch targets */
  .similar-item {
    min-height: 44px; /* iOS recommended touch target size */
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  /* Scrollbar styling for webkit browsers */
  .sheet-content::-webkit-scrollbar {
    width: 6px;
  }

  .sheet-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
  }

  .sheet-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
  }

  .sheet-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
  }

  /* Prevent text selection during drag */
  .bottom-sheet * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }

  /* Allow text selection in content areas */
  .dream-text,
  .similar-text {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
  }

  /* Safe area handling for devices with notches */
  @supports (padding-bottom: env(safe-area-inset-bottom)) {
    .sheet-content {
      padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
  }

  

  /* Responsive adjustments for smaller screens */
  @media (max-height: 600px) {
    .bottom-sheet {
      max-height: 90vh;
    }
    
    .bottom-sheet.expanded {
      transform: translateY(10vh);
    }
    
    .sheet-content {
      max-height: calc(80vh - 120px);
    }
  }

  /* Very small screens */
  @media (max-height: 500px) {
    .bottom-sheet.expanded {
      transform: translateY(5vh);
    }
    
    .sheet-content {
      max-height: calc(85vh - 120px);
      padding: 15px;
    }
    
    .dream-text {
      font-size: 14px;
      line-height: 1.5;
    }
  }
}

/* Right Third - AI Analysis + QR Code */
.analysis-section {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.section-header {
  font-family: 'Archivo', sans-serif;
  font-size: 24px;
  color: #fff;
  margin: 0 0 25px 0;
  text-align: center;
}

.analysis-header {
  color: #ff6b6b;
}

/* Remove the old analysis-header-container styles and replace with: */
/* AI Analysis Content - takes most of the space */
.analysis-content {
  flex: 1;
  font-family: 'Inconsolata', monospace;
  font-size: 18px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  overflow-y: auto;
  background: rgba(255, 107, 107, 0.05);
  border: 1px solid rgba(255, 107, 107, 0.2);
  border-radius: 15px;
  padding: 30px;
  word-wrap: break-word;
  margin-bottom: 20px;
}

/* Large QR Code Container - below analysis */
.qr-code-container-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  min-height: 200px;
}

#qrCodeImg {
  width: 150px;
  height: 150px;
  opacity: 0.9;
  transition: opacity 0.3s ease, transform 0.3s ease;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#qrCodeImg:hover {
  opacity: 1;
  transform: scale(1.05);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.qr-code-label {
  font-family: 'Inconsolata', monospace;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Large screen optimizations */
@media (min-width: 1920px) and (min-height: 3000px) {
  /* 55" vertical screen optimizations */
  .constellation-section {
    height: 75vh;
  }

  .content-section {
    height: 25vh;
  }

  .live-status {
    font-size: 24px;
    padding: 16px 32px;
  }

  .section-header {
    font-size: 28px;
  }

  .latest-dream-id {
    font-size: 28px;
  }

  .latest-dream-text {
    font-size: 20px;
  }

  .similar-item-text {
    font-size: 18px;
  }

  .analysis-content {
    font-size: 20px;
  }

  /* Super large QR code for 55" screen */
  #qrCodeImg {
    width: 200px;
    height: 200px;
  }

  .qr-code-label {
    font-size: 20px;
  }

  .qr-code-container-large {
    min-height: 280px;
    padding: 30px;
  }
}

/* Remove old qr-code-container styles and replace with fallback for mobile */
@media (max-width: 768px) {
  .constellation-section {
    height: 60vh;
  }

  .content-section {
    height: 40vh;
    flex-direction: column;
  }

  .latest-dream-section,
  .similar-dreams-section,
  .analysis-section {
    padding: 20px;
    border: none;
    flex: 1;
  }

  .latest-dream-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .similar-dreams-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Smaller QR code on mobile but still prominent */
  #qrCodeImg {
    width: 100px;
    height: 100px;
  }

  .qr-code-label {
    font-size: 14px;
  }

  .qr-code-container-large {
    min-height: 150px;
    padding: 15px;
  }

  .analysis-content {
    margin-bottom: 15px;
  }
}

/* Very small screens - still show QR code but smaller */
@media (max-width: 480px) {
  #qrCodeImg {
    width: 80px;
    height: 80px;
  }

  .qr-code-label {
    font-size: 12px;
  }

  .qr-code-container-large {
    min-height: 120px;
    padding: 10px;
  }
}

/* ——— Mobile GPU performance: disable backdrop-filter globally ——— */
@media (max-width: 768px) {
  .dream-box,
  .search-results,
  #dreamModal .dream-modal-container,
  #tooltip {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}



/* The dream you have selected, shown above its most-similar list so it stays
   visible after the popup is dismissed. */

.selected-desig {
  font-family: "Courier New", Courier, monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: #ffd27f;
  margin-bottom: 6px;
}
.selected-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: #dfe4f2;
  max-height: 22vh;
  overflow-y: auto;
}


/* ————————————————————— MOBILE: THE DRAWER ————————————————————
   The sheet was draggable only by a bar 40px wide and 4px tall, and the header
   above it was set to pointer-events: none, so a finger landing anywhere else
   did nothing at all. That is why it was so hard to pull. Everything above the
   scrolling content is now a grab area, and the bar is drawn inside a target
   tall enough to hit without looking. */
@media (max-width: 768px) {
  .sheet-handle {
    width: 100%;
    height: 30px;                 /* the target */
    margin: 0;
    background: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;           /* the gesture is ours, not the browser's */
    -webkit-tap-highlight-color: transparent;
  }
  .sheet-handle::before {         /* the bar you actually see */
    content: "";
    display: block;
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.4);
    transition: background 0.2s ease, width 0.2s ease;
  }
  .sheet-handle:active::before,
  .bottom-sheet.dragging .sheet-handle::before {
    background: rgba(255, 210, 127, 0.85);
    width: 56px;
  }
  .sheet-handle:active { background: none; }

  /* The header drags too — it is the obvious place to grab. */
  .sheet-header {
    pointer-events: auto;
    touch-action: none;
    padding: 0 20px 12px;
    cursor: grab;
  }
  .bottom-sheet.dragging .sheet-header { cursor: grabbing; }

  /* Expanded should actually give the dream room. */
  .bottom-sheet.expanded .sheet-content {
    max-height: calc(85vh - 108px);
  }
  /* No transition while a finger is on it, or the sheet lags behind. */
  .bottom-sheet.dragging { transition: none !important; }
}

/* ————————————————— MOBILE: THE TOOLBAR ——————————————————
   Opened on a phone, the tools were a single unwrapped row of seven controls
   with a slider in the middle. Everything here is about giving each control a
   finger-sized target and letting the panel wrap and scroll instead of
   overflowing the screen. */
@media (max-width: 768px) {
  .toolbar-content {
    max-height: 62vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 12px;
  }

  /* No 300ms wait before a tap does anything. */
  .toolbar button,
  .growth-tool button,
  .const-tool button,
  .clear-search-btn { touch-action: manipulation; }

  .const-tool button,
  .growth-tool button {
    min-height: 38px;
    padding: 8px 12px;
  }
  #growthPrev, #growthNext, #growthPlay {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* The playback row wraps: buttons on one line, the scrubber on its own. */
  .growth-row {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  #growthRange {
    order: 10;
    flex: 1 0 100%;
    min-width: 0;
    height: 28px;                 /* a thumb you can actually catch */
  }
  .growth-speeds .spd { min-height: 34px; padding: 6px 9px; }

  /* Same for the visibility slider. */
  .threshold-slider input[type="range"] { height: 28px; width: 100%; }
  .threshold-slider label { display: block; margin-bottom: 4px; }

  #dreamSearch { font-size: 16px; }   /* under 16px, iOS zooms the page in */

  /* Between 700 and 768 the readout was still sitting on top of the tools. */
  #hoverCoord { display: none; }
}

/* Search results open upwards, because on a desktop the toolbar sits at the
   bottom of the screen. On a phone it sits at the top, so upwards is off the
   screen — and inside a scrolling panel it would be clipped anyway. Let them
   flow underneath the input instead. */
@media (max-width: 768px) {
  .search-results {
    position: static;
    bottom: auto;
    margin-top: 8px;
    max-height: 34vh;
    box-shadow: none;
  }
}

/* Peek shows a line of the dream, not just the title bar. Keep this in step
   with peekHeight in the drawer code. */
@media (max-width: 768px) {
  .bottom-sheet.peek { transform: translateY(calc(100% - 150px)); }
}
