@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&display=swap');

html, body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    background-color: #f8f5ec;
    font-family: 'Source Sans 3', Arial, sans-serif;
    overflow-x: hidden;
  }
  
  #canvas-wrapper {
    position: relative;
    display: inline-block;
    /* Wrapper hugs the canvas' own rendered size so the overlay below stays
       pinned to the canvas corner at any viewport width. */
    max-width: 100%;
  }

  .lattice-canvas {
    display: block;
    /* p5 writes inline width/height styles on the element, so !important is
       required. height: auto keeps the aspect ratio while max-width downscales;
       height fitting is handled by windowResized() in sketch.js. */
    max-width: 100% !important;
    height: auto !important;
    touch-action: none;
  }

  .info-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    max-width: 220px;
    background-color: rgba(255, 255, 255, 0.85);
    border: 1px solid #ded5bf;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #34302a;
    pointer-events: none;
  }

  .ui-container {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
  }
  
  button {
    background-color: #4f9143;
    border: none;
    color: white;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition-duration: 0.4s;
  }
  
  button:hover {
    background-color: #45a049;
  }
  
  input[type="checkbox"] {
    margin-right: 5px;
    transform: scale(1.5);
  }
  
  label {
    user-select: none;
  }
  
  @media (max-width: 600px) {
    .lattice-canvas {
      max-height: calc(100vh - 250px);
    }
    
    .ui-container {
      padding: 5px;
    }
    
    button {
      font-size: 14px;
      padding: 8px 12px;
    }
    
    label {
      font-size: 14px;
    }
  }