        :root {
            --bg: #000000;
            --surface: #111111;
            --primary: #00eeff;
            --accent: #00eeff;
            --text: #f3f8f8;
            --text-light: #aaaaaa;
            --text-secondary: var(--text-light);
            --accent-light: var(--accent);
            --success: #4CAF50;
            --warning: #FF9800;
            --danger: #F44336;
        }
        [data-theme="light"] {
            --bg: #f8fdfd;
            --surface: #ffffff;
            --primary: #00bbc6;
            --accent: #00bbc6;
            --text: #222222;
            --text-light: #555555;
            --text-secondary: var(--text-light);
            --accent-light: var(--accent);
            --success: #388e3c;
            --warning: #f57c00;
            --danger: #d32f2f;
        }
        body {
            font-family: 'Segoe UI', Arial, sans-serif;
            margin: 0;
            padding: 0;
            background: var(--bg);
            color: var(--text);
            line-height: 1.6;
            transition: background 0.4s, color 0.4s;
        }
    



        /* ===============================
   FORCE THEME TOGGLE TRANSPARENCY
   =============================== */



        #themeToggle:hover {
            transform: scale(1.1);
            box-shadow: 0 0 25px rgba(0, 238, 255, 0.5);
        }
        h1 {
            text-align: center;
            color: var(--primary);
            margin: 10px 0 30px;
        }
        .container { max-width: 1400px; margin: 0 auto; padding: 16px; }
        .tabs {
    margin: 30px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}

        .tabs button {
            padding: 14px 32px;
            font-size: 1.3em;
            background: #003333;
            color: white;
            border: none;
            cursor: pointer;
            border-radius: 8px;
            margin: 0 10px;
            transition: all 0.3s;
        }
        [data-theme="light"] .tabs button {
            background: #e0f7fa;
            color: #006064;
        }
        .tabs button.active {
            background: var(--primary);
            color: black;
            box-shadow: 0 0 20px var(--primary);
        }
        .tab-content { display: none; }
        .tab-content.active { display: block; }
        .controls {
            background: var(--surface);
            padding: 20px;
            border-radius: 12px;
            border: 1px solid var(--primary);
            margin-bottom: 20px;
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            align-items: center;
            justify-content: center;
            transition: background 0.4s, border 0.4s;
        }
        .controls label { margin-right: 10px; font-weight: bold; }
        select, input[type="text"], input[type="number"] {
            padding: 12px;
            background: var(--bg);
            color: var(--primary);
            border: 1px solid var(--primary);
            border-radius: 6px;
            min-width: 200px;
            transition: all 0.4s;
        }
        [data-theme="light"] select, [data-theme="light"] input[type="text"], [data-theme="light"] input[type="number"] {
            background: #ffffff;
            color: #006064;
            border: 1px solid var(--primary);
        }
        button {
            padding: 12px 20px;
            background: var(--primary);
            color: black;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s;
        }
        button:hover { background: #00ffff; }
        button.clear-btn { background: var(--danger); color: white; }
        button.clear-btn:hover { background: #C62828; }
        #search, #myGardenSearch {
            width: 100%;
            max-width: 425px;
            margin: 20px auto;
            display: block;
            padding: 20px;
            background: var(--bg);
            border: 1px solid var(--primary);
            border-radius: 6px;
            color: var(--primary);
            transition: all 0.4s;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            background: var(--surface);
            border: 1px solid var(--primary);
            margin-top: 20px;
            transition: background 0.4s;
        }
        th, td {
            border: 1px solid var(--primary);
            padding: 12px;
            text-align: left;
            transition: border 0.4s;
        }
        th {
            background: #003333;
            cursor: pointer;
        }
        [data-theme="light"] th {
            background: #b2ebf2;
            color: #006064;
        }
        .section td {
            background: #002222;
            color: var(--accent);
            font-weight: bold;
        }
        [data-theme="light"] .section td {
            background: #80deea;
            color: #004d40;
        }
        .add-btn {
            background: #003333;
            color: var(--primary);
            border: 2px solid var(--primary);
            padding: 6px 14px;
            font-size: 1em;
            border-radius: 0px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s ease;
        }
        .add-btn:hover {
            background: var(--primary);
            color: black;
            box-shadow: 0 0 12px rgba(0, 238, 255, 0.4);
        }
        [data-theme="light"] .add-btn {
            background: #e0f7fa;
            color: #006064;
        }
        [data-theme="light"] .add-btn:hover {
            background: var(--primary);
            color: black;
        }
        .dashboard-header {
            text-align: center;
            margin-bottom: 30px;
        }
        .plan-selector {
            background: var(--surface);
            padding: 15px;
            border-radius: 12px;
            border: 1px solid var(--primary);
            margin-bottom: 30px;
            display: flex;
            flex-direction: column;
            gap: 15px;
            align-items: center;
            transition: all 0.4s;
        }
        .plan-tabs {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: center;
        }
        .plan-tab-wrapper {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .plan-tab {
            padding: 10px 20px;
            background: #003333;
            color: white;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s;
            white-space: nowrap;
        }
        [data-theme="light"] .plan-tab {
            background: #b2ebf2;
            color: #006064;
        }
        .plan-tab.active {
            background: var(--primary);
            color: black;
            box-shadow: 0 0 15px rgba(0, 238, 255, 0.4);
        }
        .plan-tab:hover:not(.active) {
            background: #004444;
        }
        [data-theme="light"] .plan-tab:hover:not(.active) {
            background: #80deea;
        }
        .reorder-btn {
            background: transparent;
            color: var(--text-light);
            border: none;
            font-size: 1.2em;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 4px;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
        }
        .reorder-btn:hover {
            background: rgba(0, 238, 255, 0.2);
            color: var(--primary);
        }
        .reorder-btn:disabled {
            color: #444;
            cursor: not-allowed;
        }
        [data-theme="light"] .reorder-btn {
            color: #666;
        }
        [data-theme="light"] .reorder-btn:hover {
            background: rgba(0, 187, 198, 0.2);
        }
        .plan-actions {
            display: flex;
            gap: 10px;
            align-items: center;
            flex-wrap: wrap;
            justify-content: center;
        }
        .crops-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
            gap: 20px;
            margin: 30px 0;
        }
        .crop-card {
            background: var(--surface);
            border: 1px solid var(--primary);
            border-radius: 12px;
            padding: 20px;
            transition: all 0.4s;
        }
        .crop-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 206, 209, 0.2);
        }
        .crop-name {
            font-size: 1.4em;
            font-weight: bold;
            color: var(--accent);
            margin-bottom: 10px;
        }
        .added-date {
            font-size: 0.9em;
            color: var(--text-light);
            margin-bottom: 12px;
            font-style: italic;
        }
        .card-settings {
            font-size: 0.9em;
            color: var(--text-light);
            margin: 10px 0;
            padding: 8px;
            background: var(--bg);
            border-radius: 6px;
            transition: background 0.4s;
        }
        .crop-info {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin: 15px 0;
            font-size: 0.95em;
        }
        .crop-info div {
            background: var(--bg);
            padding: 8px;
            border-radius: 6px;
            transition: background 0.4s;
        }
        .progress-buttons {
            display: flex;
            gap: 10px;
            margin: 15px 0;
        }
        .progress-btn {
            flex: 1;
            padding: 10px;
            border-radius: 8px;
            font-size: 0.9em;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s;
            background: #003333;
            color: white;
        }
        [data-theme="light"] .progress-btn {
            background: #b2ebf2;
            color: #006064;
        }
        .progress-btn.done {
            background: var(--success);
            color: white;
        }
        .crop-notes {
            margin-top: 15px;
        }
        .crop-notes textarea {
            width: 100%;
            background: var(--bg);
            color: var(--text);
            border: 1px solid var(--primary);
            border-radius: 6px;
            padding: 0px;
            resize: vertical;
            min-height: 80px;
            transition: all 0.4s;
        }
        .remove-crop {
            background: var(--danger);
            color: white;
            margin-top: 10px;
            width: 100%;
        }
        /* TIMELINE */
        .timeline-wrapper {
            margin: 50px 0;
            background: var(--surface);
            padding: 20px;
            border-radius: 12px;
            border: 1px solid var(--primary);
            overflow-x: auto;
            transition: all 0.4s;
        }
        .timeline-grid {
            display: grid;
            grid-template-columns: 220px 1fr;
            gap: 0;
            min-width: 1000px;
        }
        .month-labels {
            grid-column: 2;
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
            font-weight: bold;
            font-size: 1em;
            color: var(--accent);
            position: sticky;
            top: 0;
            background: var(--surface);
            z-index: 5;
            padding-right: 10px;
        }
        .month-labels div {
            flex: 1;
            text-align: center;
            min-width: 80px;
        }
        .timeline-rows > .timeline-row {
  position: relative;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
}

.timeline-rows > .timeline-row:nth-child(even) {
  background: rgba(255,255,255,0.02);
        }
        .timeline-rows {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: subgrid;
        }
        .timeline-row {
            display: contents;
        }
        .crop-label {
            height: 70px;
            display: grid;
            place-items: center start;
            padding-left: 10px;
            font-weight: bold;
            color: var(--accent);
            border-bottom: 1px solid #002222;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        [data-theme="light"] .crop-label {
            border-bottom: 1px solid #b2ebf2;
        }
        .bar-container {
            position: relative;
            height: 70px;
            border-bottom: 1px solid #002222;
        }
        [data-theme="light"] .bar-container {
            border-bottom: 1px solid #b2ebf2;
        }
        .timeline-bar {
            position: absolute;
            top: 10px;
            left: var(--bar-left);
            width: var(--bar-width);
            height: 50px;
            border-radius: 25px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.6);
            display: flex;
            align-items: center;
            justify-content: center;
            color: black;
            font-weight: bold;
            font-size: 0.95em;
            padding: 0 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .timeline-bar {
  border-radius: 6px;
  height: 22px;
}



        .progress-marker {
            position: absolute;
            top: 25px;
            left: var(--marker-left);
            width: 20px;
            height: 20px;
            background: white;
            border: 3px solid black;
            border-radius: 50%;
            box-shadow: 0 0 12px rgba(255,255,255,0.8);
            z-index: 20;
            pointer-events: none;
        }

        .progress-marker::after {
            content: attr(data-date);
            position: absolute;
            bottom: -24px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 0.75em;
            font-weight: bold;
            color: white;
            background: rgba(0,0,0,0.7);
            padding: 2px 6px;
            border-radius: 4px;
            white-space: nowrap;
        }
        

.timeline-rows {
  position: relative;
}

.today-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  z-index: 10;
  pointer-events: none;
}



        .legend {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 30px;
            margin: 20px 0;
            font-weight: bold;
            flex-wrap: wrap;
        }
        .legend-item {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .legend-color {
            width: 40px;
            height: 25px;
            border-radius: 12px;
        }
        .perpetual-tips {
            margin-top: 30px;
            background: #002222;
            padding: 20px;
            border-radius: 12px;
            font-size: 1em;
            color: var(--text-light);
            transition: all 0.4s;
        }
        [data-theme="light"] .perpetual-tips {
            background: #e0f7fa;
            color: #004d40;
        }
        .method-note {
            font-size: 0.9em;
            color: var(--text-light);
            font-style: italic;
            margin-top: 5px;
        }
        /* Spacing & Yield Calculator styles */
        .spacing-controls {
            background: var(--surface);
            padding: 25px;
            border-radius: 12px;
            border: 1px solid var(--primary);
            margin: 20px 0;
            display: grid;
            gap: 20px;
            max-width: 800px;
            margin-left: auto;
            margin-right: auto;
        }
        .spacing-controls label {
            font-weight: bold;
            display: block;
            margin-bottom: 8px;
        }
        .spacing-result {
            background: var(--surface);
            padding: 20px;
            border-radius: 12px;
            border: 1px solid var(--primary);
            margin: 30px auto;
            max-width: 800px;
            text-align: center;
            font-size: 1.1em;
        }
        .spacing-result strong {
            color: var(--accent);
        }
        .input-group {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
        }
        @media (max-width: 600px) {
            .input-group { grid-template-columns: 1fr; }
        }
        /* Help & About styles */
        .help-content {
            max-width: 900px;
            margin: 0 auto;
            padding: 30px;
            line-height: 1.8;
        }
        .help-content h2 {
            color: var(--accent);
            margin-top: 40px;
            border-bottom: 1px solid var(--primary);
            padding-bottom: 10px;
        }
        .help-content ul {
            padding-left: 20px;
        }
        .disclaimer {
            background: var(--surface);
            border: 1px solid var(--warning);
            color: var(--text);
            padding: 20px;
            border-radius: 12px;
            margin: 40px auto;
            max-width: 900px;
            font-style: italic;
            text-align: center;
            font-size: 1.05em;
        }



        /* ===== Responsive Fixes ===== */

#logo {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
}


.timeline-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .controls > div,
    select,
    input,
    button {
        width: 100%;
    }
}
/* Responsive overflow safety */
#table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}



#table-wrapper table {
    min-width: 900px;
}

/* Prevent layout overflow */
table {
    min-width: 1100px;
}


@media (max-width: 480px) {
    .crops-grid {
        grid-template-columns: 1fr;
    }
}
/* ===== UX POLISH: SPACING, RESULTS, PRIMARY ACTION ===== */

/*  Improve spacing & visual breathing room */
section {
    margin-bottom: 2.5rem;
}

.section-group {
    padding: 1.25rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 2rem;
}

/*  Make results feel important */
.results-box {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    margin-top: 1.5rem;
}

.results-box strong,
.results-box .result-value {
    font-size: 1.25rem;
}
/* Space between Calculate and Reset buttons */
.calc-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}


/*  Primary action button styling */
button.primary {
    background: #00eeff;
    color: #000;
    font-weight: 600;
    border-radius: 14px;
    padding: 0.75rem 1.25rem;
}

button.primary:hover {
    filter: brightness(1.05);
}

button {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

button:active {
    transform: scale(0.97);
}
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    #logo {
        font-size: 3em;
    }

    h1 {
        font-size: 1.4em;
    }

    .tabs button {
        font-size: 1em;
        padding: 10px 14px;
        margin: 4px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .controls > div {
        width: 100%;
    }

    select,
    input,
    button {
        width: 100%;
    }
}
/* ===============================
   MOBILE TAB GRID FIX (CLEAN)
   Consolidated: removes invalid nested @media and conflicting spacing rules
   =============================== */

@media (max-width: 768px) {
    .tabs {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;

        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        justify-items: stretch;
    }

    .tabs button {
        width: 100%;
        font-size: 0.85rem;
        padding: 10px 8px;
        white-space: normal;
        line-height: 1.2;
        min-height: 44px; /* Touch-friendly */
        border-radius: 10px;
        margin: 0; /* grid controls spacing */
    }

    #themeToggle {
        opacity: 0.65;
        transition: opacity 0.2s ease, background 0.2s ease;
    }

    #themeToggle:hover { opacity: 1; }

    /* Keep perpetual layout readable on small screens */
    .perpetual-timeline { grid-auto-flow: row; grid-auto-rows: 1fr; }
}

 /*  THEME TOGGLE — FINAL FIX
   =============================== */

button#themeToggle{
  position: fixed;
  top: 12px;
  right: 12px;
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  border-radius: 999px;
  z-index: 10000;

  /* IMPORTANT: prevent downloading the huge header PNG */
  background-image: none !important;

  background-color: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255,255,255,0.25);
}

button#themeToggle:hover{
  background-color: rgba(255, 255, 255, 0.35) !important;
}

@media (max-width: 768px){
  button#themeToggle{
    width: 38px;
    height: 38px;
    font-size: 18px;
    top: 10px;
    right: 10px;
  }
}
.action-buttons {
    display: flex;
    gap: 12px; /* creates space between buttons */
    flex-wrap: wrap;
}

.action-buttons button {
    flex: 1;
    min-width: 140px;

}
input {
    box-sizing: border-box;
}

/* ===== PERPETUAL TIMELINE (compact + centered) ===== */

/* Wraps the whole perpetual planner card area */
.perpetual-plan-wrapper {
  max-width: 900px;
  margin: 0 auto 24px;
  padding: 12px 16px 18px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

/* Controls grid (crop list + inputs) */
.perpetual-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 18px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.perpetual-controls label {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Let the crop list breathe but stay compact */
#perpetualCropList {
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--primary);
  padding: 8px 10px;
}

/* One independent perpetual run (a set of successions built together) */
.perpetual-run {
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}


/* The whole perpetual timeline area */
#perpetualTimeline {
  max-width: 1100px;          /* keeps it inside the main card width */
  margin: 0 auto 40px;        /* center it */
  overflow-x: auto;           /* if we *do* overflow, scroll just this, not the whole page */
}

/* One "run" (each Build Perpetual Plan click) */
.perpetual-run {
  padding: 10px 0 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* One crop stack inside a run */
.perpetual-crop-group {
  border: 1px solid rgba(0, 238, 255, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(0, 20, 30, 0.75);
}

/* Header with crop name + small meta line */
.perpetual-crop-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
}

.perpetual-crop-title {
  font-weight: 600;
  color: var(--accent);
}

.perpetual-crop-meta {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Where the succession tiles live */
.perpetual-crop-body {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;           /* side-by-side with wrapping */
  gap: 8px;                  /* tighter spacing */
}

/* Succession tile */
.perpetual-block {
  background: var(--surface);
  border: 1px solid rgba(0, 238, 255, 0.25);
  border-radius: 10px;
  padding: 8px 9px;
  font-size: 0.75rem;        /* smaller text */
  line-height: 1.3;
  box-shadow: 0 3px 8px rgba(0, 238, 255, 0.12);

  flex: 0 0 180px;           /* each block ~180px wide */
  min-width: 160px;
  max-width: 190px;
}



.perpetual-block strong {
  font-size: 0.9rem;
}

/* Meta section at bottom of card */
.perpetual-meta {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.78rem;
  opacity: 0.9;
}

/* Companions line, slightly deemphasized */
.perpetual-companions {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-light);
}

/* Small screen tweaks */
@media (max-width: 768px) {
  .perpetual-plan-wrapper {
    padding: 10px 12px 14px;
    margin-bottom: 18px;
  }

  .perpetual-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .perpetual-timeline {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Collapsed: hide the body containing the succession tiles */
.perpetual-crop-group.collapsed .perpetual-crop-body {
  display: none;
}

/* Dim the meta when collapsed */
.perpetual-crop-group.collapsed .perpetual-crop-meta {
  opacity: 0.6;
}

/* Chevron styling + rotation */
.perpetual-chevron {
  margin-left: 8px;
  font-size: 0.8rem;
  opacity: 0.8;
  transition: transform 0.15s ease;
}

.perpetual-crop-group.collapsed .perpetual-chevron {
  transform: rotate(-90deg);
}


/* ===== Layout Grid (Collapsible Bed Cards) ===== */
#layoutGrid {
  display: grid;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--primary);
  padding: 16px;
  border-radius: 12px;
}

.layout-bed-card {
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.layout-bed-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 238, 255, 0.12);
}

.layout-bed-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: rgba(0, 238, 255, 0.06);
  transition: background 0.2s ease;
}

.layout-bed-summary:hover {
  background: rgba(0, 238, 255, 0.12);
}

.layout-bed-summary::-webkit-details-marker {
  display: none;
}

.layout-bed-body {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 238, 255, 0.18);
}

.layout-cell {
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 6px;
  min-height: 44px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  user-select: none;
  background: rgba(255,255,255,0.06);
  transition: all 0.15s ease;
}

.layout-cell:hover {
  background: rgba(255,255,255,0.12);
  transform: scale(1.03);
}

.layout-empty {
  opacity: 0.45;
  background: transparent;
}

/* ===== Property / Farm Layout Sketch ===== */
.property-layout-section {
  margin-top: 24px;
  padding: 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(0, 238, 255, 0.25);
}

.property-layout-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  align-items: center;
}

.property-layout-controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  gap: 6px;
  color: var(--text-secondary);
}

.property-layout-controls input,
.property-layout-controls select {
  min-width: 90px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.property-canvas {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  border: 1px solid var(--primary);
  background: 
    radial-gradient(circle at top left, rgba(0, 238, 255, 0.08), transparent 60%),
    var(--surface);
  margin: 0 auto;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Grid lines (subtle + strong every 5 cells) */
#propertyCanvas {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(to right, rgba(255,255,255,0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.18) 1px, transparent 1px);
  background-size: 16px 16px, 16px 16px, 80px 80px, 80px 80px;
  background-position: 0 0;
}

/* Legend */
.property-legend {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.92);
  pointer-events: none;
  z-index: 10;
}

/* ===== Garden Score UI ===== */
.property-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.property-score-badge {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 238, 255, 0.3);
  background: rgba(0, 0, 0, 0.25);
  max-width: 100%;
}

.property-score-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 238, 255, 0.5);
  background: rgba(0, 238, 255, 0.15);
  font-weight: 800;
  font-size: 1.1rem;
}

.property-score-rank {
  font-size: 0.9rem;
  opacity: 0.9;
}

.property-score-tips {
  font-size: 0.9rem;
  opacity: 0.9;
  line-height: 1.4;
}

.property-score-actions button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 238, 255, 0.4);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.property-score-actions button:hover {
  background: rgba(0, 238, 255, 0.15);
}

/* ===== Beds & Obstacles ===== */
.property-bed-block,
.property-obstacle-block {
  position: absolute;
  border-radius: 8px;
  border: 1px solid rgba(0, 238, 255, 0.7);
  background: rgba(0, 238, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  text-align: center;
  padding: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.property-bed-block:hover,
.property-obstacle-block:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 24px rgba(0, 238, 255, 0.25);
}

.property-bed-block:active,
.property-obstacle-block:active {
  cursor: grabbing;
  transform: scale(1.02);
}

.property-bed-block.selected {
  outline: 3px solid var(--accent);
  box-shadow: 0 0 0 6px rgba(0, 238, 255, 0.25);
  z-index: 5;
}

/* Resize handle (only visible on selected bed) */
.property-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  right: 4px;
  bottom: 4px;
  border-radius: 4px;
  border: 2px solid var(--accent);
  background: rgba(0, 0, 0, 0.6);
  cursor: nwse-resize;
  z-index: 20;
  pointer-events: auto;
  display: none;
}

.property-bed-block.selected .property-resize-handle {
  display: block;
}

/* Obstacle label */
.property-obstacle-block .obstacle-label {
  position: absolute;

  /* match bed label placement/shape */
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: auto;

  display: block;
  width: auto;
  max-width: calc(100% - 4px);

  z-index: 2;
  padding: 2px 4px;
  border-radius: 6px;

  background: rgba(0,0,0,0.55);
  border: none;                 /* remove pill border */
  color: rgba(255,255,255,0.95);
  font-weight: 900;
  font-size: clamp(9px, 1.9vw, 12px);
  line-height: 1.05;
  letter-spacing: 0.1px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);

  pointer-events: none;

  /* keep it tight like bed label */
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Full-cover emoji/skin layer */
.property-obstacle-block::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  opacity: 0.98;
  pointer-events: none;
}

/* Optional overlay (e.g., fence posts) */
.property-obstacle-block::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
}

/* Light theme adjustments */
[data-theme="light"] .property-bed-block,
[data-theme="light"] .property-obstacle-block {
  border-color: rgba(0, 187, 198, 0.5);
  background: rgba(0, 187, 198, 0.12);
}

[data-theme="light"] .property-bed-block.selected {
  outline-color: var(--accent-light);
  box-shadow: 0 0 0 6px rgba(0, 187, 198, 0.25);
}

[data-theme="light"] .property-obstacle-block .obstacle-label {
  background: rgba(255,255,255,0.75);
  border-color: rgba(0,0,0,0.12);
  color: #111;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}


/* ---------- SHED: BIG EMOJI FILL ---------- */
.property-obstacle-block[data-type="shed"]::after{
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 80'>\
<rect width='120' height='80' fill='rgba(0,0,0,0.0)'/>\
<text x='60' y='52' text-anchor='middle' font-size='64'>🏚️</text>\
</svg>");
}

/* ---------- HOUSE: BIG EMOJI FILL ---------- */
.property-obstacle-block[data-type="house"]::after{
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 80'>\
<rect width='120' height='80' fill='rgba(0,0,0,0.0)'/>\
<text x='60' y='52' text-anchor='middle' font-size='64'>🏠</text>\
</svg>");
}

/* ---------- TREE: keep circular look + BIG EMOJI FILL ---------- */
.property-obstacle-block[data-type="tree"]{
  border-radius: 999px;
}
.property-obstacle-block[data-type="tree"]::after{
  border-radius: 999px;
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 80'>\
<rect width='120' height='80' fill='rgba(0,0,0,0.0)'/>\
<text x='60' y='52' text-anchor='middle' font-size='64'>🌳</text>\
</svg>");
}

/* ---------- COMPOST: BIG EMOJI FILL ---------- */
.property-obstacle-block[data-type="compost"]::after{
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 80'>\
<rect width='120' height='80' fill='rgba(0,0,0,0.0)'/>\
<text x='60' y='52' text-anchor='middle' font-size='64'>♻️</text>\
</svg>");
}

/* ---------- FENCE: pattern fill + posts overlay (scales for 5ft x 1ft) ---------- */
.property-obstacle-block[data-type="fence"]::after{
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.22) 0px,
      rgba(255,255,255,0.22) 6px,
      rgba(0,0,0,0.10) 6px,
      rgba(0,0,0,0.10) 9px
    );
  background-color: rgba(120, 88, 46, 0.35);
}

/* Posts on top of fence skin */
.property-obstacle-block[data-type="fence"]::before{
  opacity: 0.55; /* turn on */
  background:
    repeating-linear-gradient(
      to right,
      rgba(0,0,0,0.22) 0px,
      rgba(0,0,0,0.22) 2px,
      transparent 2px,
      transparent 26px
    );
}

/* Light theme fence tuning */
[data-theme="light"] .property-obstacle-block[data-type="fence"]::after{
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(0,0,0,0.10) 0px,
      rgba(0,0,0,0.10) 5px,
      rgba(255,255,255,0.35) 5px,
      rgba(255,255,255,0.35) 8px
    );
  background-color: rgba(0,0,0,0.05);
}


/* ===== Property Bed Visual Skins ===== */

/* Make sure pseudo-elements can render inside the bed */
.property-bed-block {
  position: absolute;           /* you already set this inline, but harmless */
  border-radius: 10px;          /* base rounding */
  overflow: hidden;             /* required for wood/soil overlays */
}

/* --- RAISED BED (wood frame + soil) --- */
.property-bed-block[data-type="raised"] {
  /* Wood frame base */
  border: 2px solid rgba(120, 78, 44, 0.95);
  box-shadow:
    inset 0 0 0 2px rgba(210, 170, 120, 0.12),
    inset 0 10px 18px rgba(0, 0, 0, 0.28),
    0 6px 14px rgba(0, 0, 0, 0.25);

  /* Subtle plank texture */
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(150, 98, 58, 0.85) 0px,
      rgba(150, 98, 58, 0.85) 10px,
      rgba(138, 88, 52, 0.88) 10px,
      rgba(138, 88, 52, 0.88) 20px
    );
}

/* Soil inset layer */
.property-bed-block[data-type="raised"]::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 8px;

  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.10) 0%, transparent 55%),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.08) 0%, transparent 60%),
    repeating-linear-gradient(
      45deg,
      rgba(0,0,0,0.10) 0px,
      rgba(0,0,0,0.10) 2px,
      transparent 2px,
      transparent 6px
    ),
    linear-gradient(to bottom, rgba(55, 35, 18, 0.92), rgba(35, 22, 12, 0.96));

  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    inset 0 8px 18px rgba(0,0,0,0.35);
  pointer-events: none;
}

/* Wood lip highlight */
.property-bed-block[data-type="raised"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;

  /* top edge highlight + slight sheen */
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.18), transparent 22%),
    linear-gradient(to top, rgba(0,0,0,0.25), transparent 35%);
  pointer-events: none;
}

/* Keep text readable above the visuals */
.property-bed-block[data-type="raised"] {
  color: rgba(255,255,255,0.95);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  padding: 6px 8px;  /* gives the label breathing room */
}

/* In light theme, darken label for readability if needed */
[data-theme="light"] .property-bed-block[data-type="raised"] {
  color: rgba(0,0,0,0.82);
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

/* --- GREENHOUSE (translucent glazing + hoops + glare) --- */
.property-bed-block[data-type="greenhouse"] {
  border-radius: 12px;
  overflow: hidden;

  /* Frame */
  border: 2px solid rgba(180, 220, 255, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.18),
    inset 0 10px 22px rgba(0,0,0,0.22),
    0 8px 18px rgba(0,0,0,0.22);

  /* Glass + subtle internal tint */
  background:
    linear-gradient(to bottom, rgba(160, 230, 255, 0.22), rgba(90, 170, 220, 0.14));
}

/* Hoops / ribs + pane lines (layered) */
.property-bed-block[data-type="greenhouse"]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;

  background:
    /* faint vertical pane lines */
    repeating-linear-gradient(
      to right,
      rgba(255,255,255,0.22) 0px,
      rgba(255,255,255,0.22) 1px,
      transparent 1px,
      transparent 16px
    ),
    /* hoops (horizontal bands) */
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.20) 0px,
      rgba(255,255,255,0.20) 2px,
      transparent 2px,
      transparent 22px
    ),
    /* slight internal shading */
    radial-gradient(circle at 50% 110%, rgba(0,0,0,0.28), transparent 62%);

  opacity: 0.9;
  pointer-events: none;
}

/* Glare highlight / sheen */
.property-bed-block[data-type="greenhouse"]::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 18px;

  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,0.30) 0%,
      rgba(255,255,255,0.10) 18%,
      transparent 45%
    );
  pointer-events: none;
}

/* Label styling */
.property-bed-block[data-type="greenhouse"] {
  color: rgba(255,255,255,0.96);
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,0.65);
  padding: 6px 8px;
}

/* Light theme: keep contrast */
[data-theme="light"] .property-bed-block[data-type="greenhouse"] {
  border: 2px solid rgba(80, 130, 170, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.10),
    inset 0 10px 22px rgba(0,0,0,0.10),
    0 8px 18px rgba(0,0,0,0.12);

  background:
    linear-gradient(to bottom, rgba(120, 210, 255, 0.20), rgba(70, 150, 205, 0.10));
  color: rgba(0,0,0,0.80);
  text-shadow: 0 1px 0 rgba(255,255,255,0.55);
}

[data-theme="light"] .property-bed-block[data-type="greenhouse"]::before {
  background:
    repeating-linear-gradient(
      to right,
      rgba(0,0,0,0.12) 0px,
      rgba(0,0,0,0.12) 1px,
      transparent 1px,
      transparent 16px
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0.12) 0px,
      rgba(0,0,0,0.12) 2px,
      transparent 2px,
      transparent 22px
    ),
    radial-gradient(circle at 50% 110%, rgba(0,0,0,0.12), transparent 62%);
}

/* --- IN-GROUND (tilled soil patch, softer/organic edges) --- */
.property-bed-block[data-type="inground"] {
  border-radius: 16px;
  overflow: hidden;

  /* Soft edge instead of hard frame */
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.18),
    inset 0 18px 28px rgba(0,0,0,0.28),
    0 8px 16px rgba(0,0,0,0.18);

  /* Base soil tone */
  background: linear-gradient(to bottom, rgba(70, 45, 22, 0.92), rgba(40, 26, 14, 0.96));
}

/* Tilled texture + subtle pebbles */
.property-bed-block[data-type="inground"]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;

  background:
    /* little highlight specks */
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.08) 0%, transparent 30%),
    radial-gradient(circle at 72% 64%, rgba(255,255,255,0.06) 0%, transparent 34%),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,0.05) 0%, transparent 36%),
    /* tilled ridges (diagonal fine texture) */
    repeating-linear-gradient(
      35deg,
      rgba(0,0,0,0.18) 0px,
      rgba(0,0,0,0.18) 2px,
      transparent 2px,
      transparent 7px
    ),
    /* secondary ridge layer for depth */
    repeating-linear-gradient(
      -25deg,
      rgba(255,255,255,0.05) 0px,
      rgba(255,255,255,0.05) 1px,
      transparent 1px,
      transparent 10px
    );

  opacity: 0.9;
  pointer-events: none;
}

/* Soft “feather” edge (organic) */
.property-bed-block[data-type="inground"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;

  /* vignette edge that makes it feel like ground, not a sticker */
  background: radial-gradient(circle at 50% 50%, transparent 58%, rgba(0,0,0,0.30) 100%);
  pointer-events: none;
}

/* Label readability */
.property-bed-block[data-type="inground"] {
  color: rgba(255,255,255,0.96);
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,0.70);
  padding: 6px 8px;
}

/* Light theme tuning */
[data-theme="light"] .property-bed-block[data-type="inground"] {
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.10),
    inset 0 18px 28px rgba(0,0,0,0.10),
    0 8px 16px rgba(0,0,0,0.10);

  background: linear-gradient(to bottom, rgba(120, 85, 45, 0.55), rgba(85, 58, 30, 0.62));
  color: rgba(0,0,0,0.82);
  text-shadow: 0 1px 0 rgba(255,255,255,0.55);
}

[data-theme="light"] .property-bed-block[data-type="inground"]::after {
  background: radial-gradient(circle at 50% 50%, transparent 58%, rgba(0,0,0,0.16) 100%);
}

/* --- CONTAINER (tray of pots / grow-bags) --- */
.property-bed-block[data-type="container"] {
  border-radius: 14px;
  overflow: hidden;

  border: 1px solid rgba(255,255,255,0.16);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.18),
    inset 0 12px 24px rgba(0,0,0,0.22),
    0 8px 16px rgba(0,0,0,0.18);

  /* Base ground/tray tint */
  background: linear-gradient(to bottom, rgba(40,40,40,0.40), rgba(10,10,10,0.35));
}

/* Pots pattern */
.property-bed-block[data-type="container"]::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 12px;

  background:
    /* pot fill (soil) */
    radial-gradient(circle, rgba(40,25,14,0.88) 0 45%, transparent 46%) 0 0 / 22px 22px,
    /* pot rim */
    radial-gradient(circle, transparent 0 58%, rgba(255,255,255,0.20) 59% 62%, transparent 63%) 0 0 / 22px 22px,
    /* pot shadow */
    radial-gradient(circle at 55% 60%, rgba(0,0,0,0.25) 0 44%, transparent 45%) 0 0 / 22px 22px;

  opacity: 0.95;
  pointer-events: none;
}

/* subtle glass/plastic sheen */
.property-bed-block[data-type="container"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;

  background:
    linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 28%),
    linear-gradient(to bottom, rgba(255,255,255,0.08), transparent 30%);
  pointer-events: none;
}

/* Label readability */
.property-bed-block[data-type="container"] {
  color: rgba(255,255,255,0.95);
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,0.70);
  padding: 6px 8px;
}

/* Light theme tuning */
[data-theme="light"] .property-bed-block[data-type="container"] {
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.08),
    inset 0 12px 24px rgba(0,0,0,0.10),
    0 8px 16px rgba(0,0,0,0.10);

  background: linear-gradient(to bottom, rgba(220,220,220,0.55), rgba(200,200,200,0.45));
  color: rgba(0,0,0,0.80);
  text-shadow: 0 1px 0 rgba(255,255,255,0.55);
}

[data-theme="light"] .property-bed-block[data-type="container"]::before {
  opacity: 0.85;
}




#inventoryTable {
    display: table !important;
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#inventoryTableWrapper {
    display: block !important;
}

    #app-header {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        background: #000;
        padding: 20px 0;
    }

    .app-logo {
        max-width: 100%;
        height: auto;
        display: block;
    }

@media (max-width: 768px) {
    #app-header {
        padding-top: 70%; /* Taller on mobile for better fit */
        background-position: center center;
    }
}

@media (max-width: 480px) {
    #app-header {
        padding-top: 80%;
    }
}

.tagline {
  text-align: center;
  color: #ccc;
  font-size: 0.95rem;
  margin-top: 10px;
  margin-bottom: 20px;
}

button[onclick*="addQuantity"] {
    background: var(--success); /* green */
    color: white;
    border: none;
    padding: 4px 8px;
    margin: 0 4px;
    border-radius: 10px;
    cursor: pointer;

    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;}

button[onclick*="addQuantity"]:hover {
    background: #388e3c;
}

button[onclick*="useInventory"] {
    background: var(--warning); /* orange/warning color from your theme */
    color: white;
    border: none;
    padding: 4px 8px;
    margin: 0 4px;
    border-radius: 10px;
    cursor: pointer;

    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;}

button[onclick*="useInventory"]:hover {
    background: #f57c00;
}

button[onclick*="deleteInventoryItem"] {
    background: var(--danger); /* red */
    color: white;
    border: none;
    padding: 4px 8px;
    margin: 0 4px;
    border-radius: 10px;
    cursor: pointer;

    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;}

button[onclick*="deleteInventoryItem"]:hover {
    background: #fa0000;
}        


/* ===============================
   Layout tab: Property Map sizing
   =============================== */

/* #propertyCanvas is the actual drawing surface. It must be allowed to exceed the card width
   so the *viewport* can scroll; otherwise the whole card will resize (or content will clip). */
#propertyCanvas.property-canvas {
  max-width: none !important;
  width: auto;
  height: auto;
  aspect-ratio: auto;
  overflow: visible;
}

/* The scroll/pan viewport that wraps #propertyCanvas (created by layout.js). */
.propertyCanvasViewport {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Prevent CSS grid/flex items from expanding due to wide children (important for large properties). */
#layoutSummaryWrap,
#layoutSummary,
#layoutToolbarHost,
#layoutSelectedBedHost,
#propertyViewport,
.propertyMapCard,
.propertyMapSection {
  min-width: 0;
}

/* -------- Theme parity tweaks -------- */
/* Ensure borders are visible in light mode */
[data-theme="light"] .property-layout-section {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 187, 198, 0.30);
}
[data-theme="light"] .property-canvas {
  border-color: rgba(0, 187, 198, 0.45);
}

/* Keep selected-bed panel contrast in both themes */
.selected-bed-panel .square {
  border: 1px solid rgba(0, 238, 255, 0.18);
}
[data-theme="light"] .selected-bed-panel .square {
  border: 1px solid rgba(0, 187, 198, 0.22);
}



/* -------- Mobile / small tablets -------- */
@media (max-width: 900px) {
  /* Stack the two-column workspace into one column */
  #layout #layoutSummary + div {
    grid-template-columns: 1fr !important;
  }

  /* Reduce padding on panels so they fit */
  #layout .property-layout-section {
    padding: 14px;
  }

  /* Controls wrap better on small widths */
  #layout .property-layout-controls {
    gap: 10px;
  }
  #layout .property-layout-controls label {
    flex: 1 1 140px;
    min-width: 140px;
  }
  #layout .property-layout-controls input,
  #layout .property-layout-controls select {
    width: 100%;
    min-width: 0;
  }

  /* Make action buttons wrap and stay readable */
  #layout .bed-offset-controls button,
  #layout .selected-bed-panel button,
  #layout button {
    padding: 10px 12px;
  }
}

/* -------- Phones -------- */
@media (max-width: 560px) {
  /* Tighten card spacing */
  #layout #layoutSummary { margin-bottom: 10px !important; }

  /* If any inline h3 headings look oversized */
  #layout h3 { font-size: 1.05rem; }

  /* Selected-bed squares: slightly tighter tiles so more fit */
  #layout .selected-bed-panel .square {
    min-width: 44px;
    min-height: 34px;
    font-size: 0.72rem;
  }

  /* Let property viewport be scrollable if needed */
  #layout .property-viewport {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ─────────────────────────────────────────────────────────────
   PERPETUAL – Crop Picker usability (search + grouped list)
   ───────────────────────────────────────────────────────────── */
.perpetual-crop-tools {
  display: flex;
    flex-direction: column;
  gap: 10px;
  margin: 10px 0 12px;
  }

.perpetual-crop-tools-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.perpetual-crop-search {
  flex: 1 1 320px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--primary);
  border-radius: 10px;
  color: var(--text);
  outline: none;
}

.perpetual-crop-search::placeholder {
  color: var(--text-light);
}

.perpetual-crop-category {
  flex: 0 0 180px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--primary);
  border-radius: 10px;
  color: var(--text);
  }

.perpetual-crop-actions {
  justify-content: space-between;
  }

.perpetual-crop-toggle {
  display: inline-flex;
  align-items: center;
    gap: 8px;
  color: var(--text);
    font-size: 0.95rem;
  user-select: none;
  }

.perpetual-crop-actions-buttons {
  display: inline-flex;
  gap: 10px;
  }

.perpetual-crop-action-btn {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: rgba(0, 238, 255, 0.10);
  color: var(--text);
  cursor: pointer;
}

.perpetual-crop-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  }

.perpetual-crop-group {
  border: 1px solid rgba(0, 238, 255, 0.25);
  border-radius: 10px;
  margin: 10px 0;
  background: rgba(0, 0, 0, 0.35);
  }

.perpetual-crop-group-title {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--accent);
  font-weight: 700;
  list-style: none;
}

.perpetual-crop-group summary::-webkit-details-marker {
      display: none;
    }

.perpetual-crop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 12px;
  padding: 10px 12px 14px;
  }

.perpetual-crop-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(0, 238, 255, 0.18);
  background: rgba(17, 17, 17, 0.65);
  color: var(--text);
}

.perpetual-crop-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

/* Phone: keep tools stacked cleanly */
@media (max-width: 560px) {
  .perpetual-crop-search { flex-basis: 100%; }
  .perpetual-crop-category { flex-basis: 100%; }
  .perpetual-crop-actions-buttons { width: 100%; }
  .perpetual-crop-action-btn { flex: 1 1 0; width: 100%; }
  .perpetual-crop-grid { grid-template-columns: 1fr; }
}


/* Keep scrolling/panning functional, just hide the bars */

/* Inventory should fit the viewport */
    #inventoryTable {
        min-width: 0;
    }

    /* Layout viewport: always scrollable when canvas exceeds viewport */
    .propertyCanvasViewport {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

/* Keep scrolling/panning functional, just hide the bars */
#propertyViewport {
  overflow: auto;
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* IE/Edge legacy */
}
#propertyViewport::-webkit-scrollbar {
  width: 0;
  height: 0;
}


/* ─────────────────────────────────────────────────────────────
   PERPETUAL – Fit & usability fixes (crop picker + plan tabs)
   ───────────────────────────────────────────────────────────── */
#perpetual .controls,
#perpetual .plan-selector,
#perpetualPlanTabs,
#perpetual .plan-tabs {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#perpetual .plan-tab-wrapper {
  min-width: 0;
  max-width: 100%;
}

#perpetual .plan-tab {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#perpetualCropList,
#perpetualCropList * {
  box-sizing: border-box;
}

#perpetualCropList {
  width: 100%;
  max-width: 100%;
}

#perpetualCropList .perpetual-crop-tools-row {
  width: 100%;
}

#perpetualCropList .perpetual-crop-tools-row.perpetual-crop-expand {
  justify-content: flex-end;
}

#perpetualCropList .perpetual-crop-search,
#perpetualCropList .perpetual-crop-category {
  min-width: 0;
  max-width: 100%;
}

#perpetualCropList .perpetual-crop-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

#perpetualCropList .perpetual-crop-item {
  min-width: 0;
}

#perpetualCropList .perpetual-crop-item span {
  min-width: 0;
  white-space: normal;
  word-break: break-word;
}

#perpetualCropList .perpetual-crop-item.is-selected {
  border-color: rgba(0, 238, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 238, 255, 0.25) inset;
}

@media (max-width: 560px) {
  #perpetual .plan-tabs { justify-content: stretch; }
  #perpetual .plan-tab-wrapper { width: 100%; }
  #perpetual .plan-tab { width: 100%; text-align: center; }
}
/* === Calculator: hide category separator rows inside the big tables === */
#calculator table tr.section { display: none; }
/* ===============================
   CALCULATOR — MOBILE COMPACT TABLE
   (CSS-only: improves phone usability without touching JS)
   =============================== */

@media (max-width: 640px) {

  /* Tighten the calculator controls stack */
  #calculator .controls {
    gap: 10px;
  }

  #calculator .controls label {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }

  #calculator .controls select,
  #calculator .controls input {
    padding: 10px 12px;
    font-size: 0.95rem;
    min-width: 0; /* override any desktop min-width so it can actually fit */
  }

  /* Make the search bar match the controls */
  #calculator #search {
    width: 100%;
    max-width: 700px;
    margin: 10px auto 14px;
    display: block;
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  /* Turn the huge table into a contained, scrollable region */
  #calculator #table-wrapper {
    max-height: 70vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--primary);
  }

  /* Keep a sensible minimum width (horizontal scroll stays available) */
  #calculator #table-wrapper table {
    min-width: 900px; /* smaller than desktop so the scroll-distance isn't absurd */
  }

  /* Compact cell sizing (biggest win for “desktop-y” look on phones) */
  #calculator #table-wrapper th,
  #calculator #table-wrapper td {
    padding: 6px 8px;
    font-size: 0.78rem;
    line-height: 1.15;
    vertical-align: top;
  }

  /* Sticky header while you scroll 100+ rows */
  #calculator #table-wrapper thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--surface);
  }

  /* Section rows (Vegetables/Fruits/etc) */
  #calculator #table-wrapper tbody tr.section td {
    padding: 8px 10px;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
  }

  /* Smaller +Add buttons */
  #calculator #table-wrapper .add-btn {
    padding: 4px 8px;
    font-size: 0.78rem;
    border-radius: 10px;
    line-height: 1;
    white-space: nowrap;
  }

  #calculator #table-wrapper .add-header {
    font-size: 0.75rem;
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  /* Extra-tight phones */
  #calculator #table-wrapper {
    max-height: 68vh;
  }

  #calculator #table-wrapper table {
    min-width: 820px;
  }

  #calculator #table-wrapper th,
  #calculator #table-wrapper td {
    padding: 5px 7px;
    font-size: 0.74rem;
  }
}

/* Hide scrollbars but keep scrolling (Calculator table wrapper) */
#calculator #table-wrapper {
  -ms-overflow-style: none;   /* IE/old Edge */
  scrollbar-width: none;      /* Firefox */
}
#calculator #table-wrapper::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Calculator: apply the same compact, scrollable table panel on desktop/full view */
@media (min-width: 641px) {
  #calculator #table-wrapper {
    max-height: 72vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--primary);
  }

  #calculator #table-wrapper table { min-width: 900px; }

  #calculator #table-wrapper th,
  #calculator #table-wrapper td {
    padding: 6px 8px;
    font-size: 0.80rem;
    line-height: 1.15;
    vertical-align: top;
  }

  #calculator #table-wrapper thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--surface);
  }

  #calculator #table-wrapper .add-btn {
    padding: 4px 8px;
    font-size: 0.78rem;
    border-radius: 10px;
    line-height: 1;
    white-space: nowrap;
  }

  #calculator #table-wrapper .add-header {
    font-size: 0.75rem;
    white-space: nowrap;
  }
}
/* ===============================
   INVENTORY — SCROLL PANEL TABLE (ALL VIEWS)
   Matches Calculator UX: compact density, sticky header, hidden scrollbar
   =============================== */

#inventory #inventoryTableWrapper {
  max-height: 72vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--primary);
}

/* Hide scrollbars but keep scrolling (Inventory table wrapper) */
#inventory #inventoryTableWrapper {
  -ms-overflow-style: none;   /* IE/old Edge */
  scrollbar-width: none;      /* Firefox */
}
#inventory #inventoryTableWrapper::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Keep a sensible minimum width (horizontal scroll stays available) */
#inventory #inventoryTable {
  min-width: 900px;
}

/* Compact cell sizing + sticky header */
#inventory #inventoryTable th,
#inventory #inventoryTable td {
  padding: 6px 8px;
  font-size: 0.80rem;
  line-height: 1.15;
  vertical-align: top;
}

#inventory #inventoryTable thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
}

/* Inventory search input should fit nicely */
#inventory #inventorySearch {
  width: min(420px, 92vw) !important;
  max-width: 420px;
  margin-left: 0 !important;
  padding: 10px 12px;
  font-size: 0.95rem;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  #inventory #inventoryTableWrapper { max-height: 70vh; }
  #inventory #inventoryTable { min-width: 900px; }

  #inventory #inventoryTable th,
  #inventory #inventoryTable td {
    padding: 6px 8px;
    font-size: 0.78rem;
  }
}

@media (max-width: 420px) {
  #inventory #inventoryTableWrapper { max-height: 68vh; }
  #inventory #inventoryTable { min-width: 820px; }

  #inventory #inventoryTable th,
  #inventory #inventoryTable td {
    padding: 5px 7px;
    font-size: 0.74rem;
  }
}
/* ===============================
   Combined top control panel
   (Timeline / My Garden / Inventory)
   Makes the Plan selector + adjacent controls read as ONE container.
   =============================== */

:where(#timeline, #mygarden, #inventory) .plan-selector {
  width: 100%;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* ---- TIMELINE: Plan selector + Legend become a single panel ---- */
#timeline .plan-selector {
  margin-bottom: 0;
  border-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding-bottom: 12px;
}

#timeline .legend {
  max-width: 980px;
  margin: 0 auto 30px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-top: 0;
  padding: 10px 15px 15px;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  box-sizing: border-box;

  /* tighten the legend so it feels like part of the panel */
  gap: 18px;
  width: 100%;
}

#timeline .legend-item { font-size: 0.95em; }
#timeline .legend-color { width: 32px; height: 18px; border-radius: 10px; }

/* ---- INVENTORY: Plan selector + Controls become a single panel ---- */
#inventory .plan-selector {
  margin-bottom: 0;
  border-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding-bottom: 12px;
}

/* The .controls block already has the same surface/border styling.
   We just "attach" it to the plan selector and align widths. */
#inventory .controls {
  max-width: 980px !important;
  margin: 0 auto 30px !important;
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-sizing: border-box;
  width: 100% !important;
}

/* ---- MY GARDEN: Plan selector + Search become a single panel ---- */
#mygarden .plan-selector {
  margin-bottom: 0;
  border-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding-bottom: 12px;
}

/* Override the generic search styling so it docks into the plan panel */
#mygarden #myGardenSearch {
  max-width: 980px;
  margin: 0 auto 30px;
  display: block;

  background: var(--surface);
  border: 1px solid var(--primary);
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;

  padding: 14px 16px;
  color: var(--primary);
  box-sizing: border-box;
  width: 100%;
}

/* Slightly tighten on small phones so the combined panel doesn't feel tall */
@media (max-width: 520px) {
  #timeline .plan-selector,
  #inventory .plan-selector,
  #mygarden .plan-selector {
    padding: 12px;
    gap: 10px;
  }

  #timeline .legend { padding: 10px 12px 12px; gap: 12px; }
  #inventory .controls { padding: 12px; gap: 10px; }
  #mygarden #myGardenSearch { padding: 12px 12px; }
}

/* ─────────────────────────────────────────────
   Donations banner (Free web app)
   ───────────────────────────────────────────── */
.pg-donate-banner {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border: 1px solid rgba(0, 238, 255, 0.35);
  background: rgba(0, 0, 0, 0.86);
  color: var(--text);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
}

.pg-donate-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.pg-donate-text .pg-donate-sub {
  font-size: 12px;
  opacity: 0.85;
}

.pg-donate-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.pg-donate-btn {
  background: var(--primary);
  color: #000;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.pg-donate-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
  opacity: 0.8;
}

.pg-donate-close:hover { opacity: 1; }

@media (max-width: 520px) {
  .pg-donate-banner {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}


/* ───────────────────────────────────────────────────────────────
   Mobile keyboard usability (Layout editor inputs)
   Keeps inputs usable when virtual keyboard opens.
   Safe: only affects Layout tab + editor controls.
   ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #selectedBedPanel,
  .selected-bed-panel,
  #bedOffsetControls,
  #obstacleControls {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--kbpad, 0px);
    max-height: calc(var(--vvh, 100vh) - 140px);
  }

  #layout input,
  #layout textarea,
  #layout select {
    font-size: 16px; /* prevents iOS auto-zoom on focus */
  }
}

/* ================================
   FIX: Obstacle tiles should NOT have the cyan bed frame/tint
   (beds keep the frame; obstacles show clean PNG/emoji)
   Put this at the VERY BOTTOM of styles.css
   ================================ */

.property-obstacle-block{
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: hidden;          /* keeps the cover image clipped to rounded corners */
}

/* make sure the full-cover image layer fills cleanly */
.property-obstacle-block::after{
  opacity: 1 !important;
  background-size: cover !important;
  background-position: center !important;
}

/* Optional: keep a subtle highlight only when selected/active */
.property-obstacle-block.selected,
.property-obstacle-block.is-selected,
.property-obstacle-block.active{
  outline: 2px solid rgba(0,238,255,0.85);
  outline-offset: 2px;
}

/* Prevent transition lag during theme toggle */
html.pg-theme-switching, html.pg-theme-switching * {
  transition: none !important;
}
