:root {
      --signal: #C59D39;
      --node: #151413;
      --warm-grey: #7E7570;
      --beige: #E3D6BB;
      --light-gold: #EFCB6D;
      --charcoal: #443F3A;
      --white: #FFFFFF;

      --bg: #F7F1E4;
      --card: #FFFFFF;
      --card-soft: #FBF7ED;
      --text: var(--node);
      --muted: var(--warm-grey);
      --accent: var(--signal);
      --accent-hover: #9f7f2d;
      --danger: #A33A2F;
      --grid: rgba(68, 63, 58, 0.22);
      --grid-soft: rgba(68, 63, 58, 0.11);
      --shadow: 0 24px 70px rgba(21, 20, 19, 0.13);
      --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      --headline-font: "Poppins", "Inter", system-ui, sans-serif;
    }

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

    body {
      font-family: var(--font);
      background:
        radial-gradient(circle at top left, rgba(197, 157, 57, 0.20), transparent 34rem),
        linear-gradient(135deg, var(--white) 0%, var(--bg) 58%, var(--beige) 100%);
      color: var(--text);
      line-height: 1.5;
      padding: 2rem 1rem;
      min-height: 100vh;
    }

    .container {
      width: 90vw;
      max-width: none;
      margin: 0 auto;
    }

    header {
      position: relative;
      margin-bottom: 1.5rem;
      background:
        linear-gradient(135deg, rgba(21, 20, 19, 0.96), rgba(68, 63, 58, 0.94)),
        var(--node);
      color: var(--white);
      border: 1px solid rgba(239, 203, 109, 0.20);
      border-radius: 18px;
      padding: clamp(1.25rem, 4vw, 2.25rem);
      overflow: hidden;
      box-shadow: 0 18px 50px rgba(21, 20, 19, 0.16);
    }

    header::before,
    header::after {
      content: "";
      position: absolute;
      pointer-events: none;
    }

    header::before {
      inset: 0;
      background:
        radial-gradient(circle at 85% 18%, rgba(239, 203, 109, 0.22), transparent 18rem),
        linear-gradient(90deg, rgba(197, 157, 57, 0.14), transparent 38%);
      opacity: 0.9;
    }

    header::after {
      width: calc(100% - 2.5rem);
      height: 1px;
      left: 1.25rem;
      bottom: 1.05rem;
      background: linear-gradient(90deg, transparent, rgba(239, 203, 109, 0.50), transparent);
      opacity: 0.75;
    }

    .brand-header-content {
      position: relative;
      z-index: 1;
      display: grid;
      grid-template-columns: minmax(190px, 280px) minmax(0, 1fr);
      gap: clamp(1rem, 3vw, 2rem);
      align-items: center;
    }

    .brand-logo-card {
      min-height: 100px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
    }

    .brand-logo {
      display: block;
      width: min(100%, 250px);
      height: auto;
    }

    .brand-kicker, .eyebrow {
      color: var(--signal);
      font-size: 0.78rem;
      font-weight: 800;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      margin-bottom: 0.55rem;
    }

    .brand-header-content h1 + .brand-kicker {
      margin-top: 0.85rem;
      font-size: clamp(0.88rem, 1.2vw, 1rem);
    }

    h1, h2, h3 {
      font-family: var(--headline-font);
      font-weight: 700;
    }

    h1 {
      font-size: clamp(2.1rem, 6vw, 4.6rem);
      margin-bottom: 0.35rem;
      line-height: 0.95;
      letter-spacing: -0.055em;
    }

    h2 {
      font-size: clamp(1.5rem, 2.4vw, 2.05rem);
      margin-bottom: 0.35rem;
      letter-spacing: -0.035em;
    }

    h3 {
      font-size: 1rem;
      margin-bottom: 0.6rem;
      color: var(--text);
    }

    .subtitle {
      color: rgba(255, 255, 255, 0.78);
      font-size: clamp(0.98rem, 1.7vw, 1.12rem);
      max-width: 58rem;
    }

    .section-subtitle {
      color: var(--muted);
      font-size: 0.95rem;
      max-width: 70rem;
    }

    .tool-section {
      position: relative;
      background: linear-gradient(180deg, var(--white), var(--card-soft));
      border: 1px solid rgba(68, 63, 58, 0.14);
      border-radius: 18px;
      padding: clamp(1rem, 3vw, 2rem);
      box-shadow: var(--shadow);
      margin-bottom: 1.5rem;
      overflow: hidden;
    }

    .tool-section::before {
      content: "";
      position: absolute;
      inset: 0 0 auto 0;
      height: 5px;
      background: linear-gradient(90deg, var(--signal), var(--light-gold), var(--signal));
    }

    .section-header {
      margin-bottom: 1.2rem;
      padding-bottom: 1rem;
      border-bottom: 2px solid var(--node);
    }

    .controls, .placement-controls, .map-controls, .scale-controls {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
      gap: 1rem;
      margin-bottom: 1.25rem;
      padding: 1.25rem;
      background: rgba(227, 214, 187, 0.32);
      border-radius: 14px;
      border: 1px solid var(--grid);
    }

    .control-block-title {
      grid-column: 1 / -1;
      font-family: var(--headline-font);
      font-weight: 700;
      font-size: 1rem;
      letter-spacing: -0.02em;
      color: var(--charcoal);
      margin-bottom: -0.25rem;
    }

    .input-group {
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
    }

    label {
      font-weight: 600;
      font-size: 0.86rem;
      color: var(--muted);
    }

    input, select {
      width: 100%;
      background: var(--white);
      border: 1px solid var(--grid);
      color: var(--text);
      padding: 0.62rem 0.75rem;
      border-radius: 9px;
      font-size: 1rem;
      transition: border 0.2s, box-shadow 0.2s;
    }

    input[type="range"] {
      padding: 0;
      accent-color: var(--signal);
    }

    input:focus, select:focus {
      border-color: var(--accent);
      outline: none;
      box-shadow: 0 0 0 3px rgba(197, 157, 57, 0.20);
    }

    button { font: inherit; }

    .toggle-btn, .action-btn, .mode-btn, .small-btn {
      background: var(--white);
      border: 1px solid var(--grid);
      color: var(--text);
      padding: 0.62rem 1rem;
      border-radius: 9px;
      cursor: pointer;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.45rem;
      transition: all 0.2s;
      min-height: 42px;
    }

    .toggle-btn:hover, .action-btn:hover, .mode-btn:hover, .small-btn:hover {
      border-color: var(--accent);
      background: rgba(197, 157, 57, 0.14);
    }

    .toggle-btn.active, .mode-btn.active, .small-btn.active, .action-btn.primary {
      background: var(--accent);
      border-color: var(--accent);
      color: var(--node);
    }

    .action-btn.primary:hover {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
    }

    .action-btn.warning {
      border-color: rgba(197, 157, 57, 0.55);
    }

    .small-btn {
      min-height: 0;
      padding: 0.42rem 0.65rem;
      font-size: 0.82rem;
      border-radius: 7px;
    }

    .small-btn.danger {
      border-color: rgba(239, 68, 68, 0.7);
      color: #A33A2F;
    }


    button:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }

    button:disabled:hover {
      background: var(--white);
      border-color: var(--grid);
    }

    .recommend-btn {
      background: var(--node);
      border-color: var(--node);
      color: var(--white);
    }

    .recommend-btn:hover {
      background: var(--charcoal);
      border-color: var(--signal);
    }

    .recommend-btn.loading {
      cursor: progress;
      background: var(--charcoal);
      border-color: var(--signal);
    }

    .button-spinner {
      width: 0.95rem;
      height: 0.95rem;
      border: 2px solid rgba(255, 255, 255, 0.35);
      border-top-color: var(--light-gold);
      border-radius: 50%;
      display: none;
      flex: 0 0 auto;
      animation: recommendation-spin 0.72s linear infinite;
    }

    .recommend-btn.loading .button-spinner {
      display: inline-block;
    }

    @keyframes recommendation-spin {
      to { transform: rotate(360deg); }
    }

    .chart-container {
      position: relative;
      height: 450px;
      margin: 1.2rem 0;
      background: var(--white);
      border-radius: 14px;
      padding: 1rem;
      border: 1px solid var(--grid);
    }

    .legend-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 0.75rem;
      margin-top: 1rem;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      font-size: 0.9rem;
      padding: 0.55rem;
      background: rgba(227, 214, 187, 0.30);
      border: 1px solid rgba(68, 63, 58, 0.10);
      border-radius: 9px;
    }

    .dot {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .highlight {
      border: 1px solid var(--signal);
      background: rgba(239, 203, 109, 0.30);
    }

    .note {
      margin-top: 1.2rem;
      font-size: 0.86rem;
      color: var(--muted);
      padding: 0.85rem;
      background: rgba(227, 214, 187, 0.34);
      border-radius: 10px;
      border-left: 4px solid var(--accent);
    }

    .hint {
      color: var(--muted);
      font-size: 0.86rem;
      margin-top: 0.7rem;
    }

    .site-footer {
      margin: 0 0 1rem;
      padding: 1rem;
      color: var(--charcoal);
      font-size: 0.9rem;
      text-align: center;
    }

    .site-footer a {
      color: var(--node);
      font-weight: 800;
      text-decoration-color: var(--signal);
      text-underline-offset: 0.2em;
    }

    .site-footer a:hover {
      color: var(--accent-hover);
    }

    .error-msg {
      color: var(--danger);
      font-size: 0.84rem;
      margin-top: 0.2rem;
      display: none;
    }

    .placement-layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 1rem;
      align-items: start;
    }

    .placement-workspace { min-width: 0; }

    .placement-canvas-wrap {
      position: relative;
      width: 100%;
      max-width: 100%;
      margin-inline: auto;
      background: var(--node);
      border: 1px solid var(--grid);
      border-radius: 14px;
      overflow: hidden;
      touch-action: none;
    }

    #placementCanvas {
      display: block;
      width: 100%;
      height: 560px;
      cursor: crosshair;
      background: var(--node);
    }

    .canvas-toolbar {
      position: sticky;
      top: 0.5rem;
      z-index: 20;
      display: flex;
      flex-wrap: wrap;
      align-items: stretch;
      gap: 0.45rem;
      margin-bottom: 0.75rem;
      padding: 0.45rem;
      background: rgba(247, 245, 239, 0.96);
      border: 1px solid rgba(68, 63, 58, 0.20);
      border-radius: 10px;
      backdrop-filter: blur(12px);
      box-shadow: 0 7px 20px rgba(21, 20, 19, 0.10);
    }

    .toolbar-brand {
      display: none;
      align-items: center;
      justify-content: center;
      align-self: stretch;
      width: 112px;
      min-height: 38px;
      padding: 0.2rem 0.55rem;
      border-right: 1px solid rgba(68, 63, 58, 0.18);
      text-decoration: none;
    }

    .toolbar-logo {
      display: block;
      width: 100%;
      max-height: 28px;
      object-fit: contain;
    }

    .toolbar-group {
      display: flex;
      align-items: stretch;
      gap: 2px;
      padding: 0 0.42rem 0 0;
      margin-right: 0.1rem;
      border-right: 1px solid rgba(68, 63, 58, 0.18);
    }

    .toolbar-group:last-child {
      border-right: 0;
      padding-right: 0;
      margin-right: 0;
    }

    .canvas-toolbar .mode-btn,
    .canvas-toolbar .menu-btn,
    .canvas-toolbar .action-btn,
    .canvas-toolbar .small-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 38px;
      height: 38px;
      padding: 0.42rem 0.62rem;
      gap: 0.38rem;
      border-radius: 6px;
      border-color: transparent;
      background: transparent;
      color: var(--charcoal);
      font-size: 0.78rem;
      font-weight: 700;
      white-space: nowrap;
      box-shadow: none;
    }

    .canvas-toolbar .mode-btn:hover,
    .canvas-toolbar .menu-btn:hover,
    .canvas-toolbar .action-btn:hover,
    .canvas-toolbar .small-btn:hover {
      border-color: rgba(68, 63, 58, 0.15);
      background: rgba(197, 157, 57, 0.14);
    }

    .canvas-toolbar .mode-btn.active,
    .canvas-toolbar .menu-btn.active,
    .canvas-toolbar .action-btn.active {
      color: var(--node);
      border-color: rgba(197, 157, 57, 0.72);
      background: rgba(239, 203, 109, 0.78);
      box-shadow: inset 0 -2px 0 rgba(159, 127, 45, 0.45);
    }

    .canvas-toolbar .recommend-btn {
      padding-inline: 0.78rem;
      color: var(--white);
      background: var(--node);
      border-color: var(--node);
    }

    .canvas-toolbar .recommend-btn:hover {
      color: var(--white);
      background: var(--charcoal);
      border-color: var(--signal);
    }

    .toolbar-separator {
      align-self: stretch;
      width: 1px;
      min-height: 32px;
      margin: 0 0.25rem;
      background: rgba(68, 63, 58, 0.24);
    }

    .toolbar-select-field {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      height: 38px;
      padding: 0.25rem 0.45rem;
      border: 1px solid transparent;
      border-radius: 6px;
      color: var(--charcoal);
      background: transparent;
      white-space: nowrap;
    }

    .toolbar-select-field:hover {
      border-color: rgba(68, 63, 58, 0.15);
      background: rgba(197, 157, 57, 0.10);
    }

    .toolbar-select-label {
      font-size: 0.68rem;
      font-weight: 800;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .toolbar-select-field select {
      width: auto;
      min-width: 128px;
      height: 29px;
      padding: 0.25rem 1.6rem 0.25rem 0.45rem;
      border-radius: 5px;
      font-size: 0.74rem;
      font-weight: 700;
      background-color: rgba(255,255,255,0.88);
    }

    .toolbar-icon {
      width: 16px;
      height: 16px;
      flex: 0 0 16px;
      align-self: center;
      stroke: currentColor;
      fill: none;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
      pointer-events: none;
    }

    .toolbar-button-text {
      line-height: 1;
      pointer-events: none;
    }

    .power-source-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.16rem 0.42rem;
      border: 1px solid rgba(68, 63, 58, 0.18);
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.75);
      color: var(--charcoal);
      font-size: 0.72rem;
      font-weight: 800;
    }

    .status-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 0.6rem;
      justify-content: space-between;
      align-items: center;
      font-size: 0.86rem;
      color: var(--muted);
      margin-top: 0.65rem;
      padding: 0.7rem 0.8rem;
      background: rgba(227, 214, 187, 0.30);
      border: 1px solid rgba(68, 63, 58, 0.14);
      border-radius: 10px;
    }

    .heat-legend {
      display: grid;
      grid-template-columns: repeat(8, 1fr);
      gap: 0.35rem;
      margin-top: 0.85rem;
      font-size: 0.78rem;
      font-weight: 800;
      color: var(--white);
      text-align: center;
    }

    .heat-legend span {
      padding: 0.45rem 0.25rem;
      border-radius: 7px;
      text-shadow: 0 1px 2px rgba(0,0,0,0.45);
    }

    .side-panel {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      gap: 1rem;
      background: rgba(255, 255, 255, 0.72);
      border: 1px solid var(--grid);
      border-radius: 14px;
      padding: 1rem;
    }

    .panel-section + .panel-section {
      margin-top: 0;
      padding-top: 0;
      border-top: 0;
    }

    .selected-card {
      background: rgba(227, 214, 187, 0.28);
      border: 1px solid rgba(68, 63, 58, 0.16);
      border-radius: 11px;
      padding: 0.85rem;
      margin-bottom: 1rem;
    }

    .selected-card.empty {
      color: var(--muted);
      font-size: 0.9rem;
    }

    .selected-card .mini-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.65rem;
      margin-top: 0.65rem;
    }

    .object-list {
      display: flex;
      flex-direction: column;
      gap: 0.65rem;
    }

    .object-row {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 0.5rem;
      align-items: center;
      padding: 0.65rem;
      background: rgba(227, 214, 187, 0.22);
      border: 1px solid transparent;
      border-radius: 9px;
    }

    .object-row.selected {
      border-color: var(--signal);
      background: rgba(239, 203, 109, 0.26);
    }

    .object-title {
      font-weight: 800;
      font-size: 0.91rem;
    }

    .object-meta {
      color: var(--muted);
      font-size: 0.79rem;
      margin-top: 0.15rem;
    }

    .map-file-row {
      grid-column: 1 / -1;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.75rem;
    }

    .file-input-label {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 42px;
      padding: 0.62rem 1rem;
      border: 1px solid var(--grid);
      border-radius: 9px;
      background: var(--white);
      font-weight: 800;
      color: var(--text);
      cursor: pointer;
    }

    .file-input-label:hover {
      border-color: var(--accent);
      background: rgba(197, 157, 57, 0.14);
    }

    input[type="file"] {
      position: absolute;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;
    }

    .map-name {
      color: var(--muted);
      font-size: 0.9rem;
    }


    .share-url-output {
      min-width: 0;
      font-size: 0.82rem;
      color: var(--muted);
      background: rgba(255, 255, 255, 0.86);
    }


    .calibration-readout {
      color: var(--charcoal);
      font-size: 0.84rem;
      font-weight: 700;
    }

    .checkbox-row {
      flex-direction: row;
      align-items: center;
      gap: 0.65rem;
      padding-top: 1.55rem;
    }

    .checkbox-row input[type="checkbox"] {
      width: 1.05rem;
      height: 1.05rem;
      accent-color: var(--signal);
      flex-shrink: 0;
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 1000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1rem;
      background: rgba(21, 20, 19, 0.58);
    }

    .modal-backdrop[hidden] { display: none; }

    .modal-card {
      width: min(420px, 100%);
      background: var(--white);
      border: 1px solid rgba(197, 157, 57, 0.48);
      border-radius: 16px;
      padding: 1.2rem;
      box-shadow: var(--shadow);
      touch-action: none;
    }

    .modal-card h3 {
      cursor: grab;
      user-select: none;
    }

    .modal-card.dragging h3 {
      cursor: grabbing;
    }

    .modal-copy {
      color: var(--muted);
      font-size: 0.92rem;
      margin-bottom: 1rem;
    }

    .modal-grid {
      display: grid;
      grid-template-columns: 1fr 130px;
      gap: 0.8rem;
    }

    .modal-choice-list {
      display: grid;
      gap: 0.55rem;
      margin: 0.9rem 0 1rem;
    }

    .modal-choice-card {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 0.65rem;
      align-items: flex-start;
      padding: 0.7rem;
      border: 1px solid rgba(68, 63, 58, 0.18);
      border-radius: 10px;
      background: rgba(227, 214, 187, 0.20);
      color: var(--text);
      cursor: pointer;
    }

    .modal-choice-card:has(input:checked) {
      border-color: rgba(197, 157, 57, 0.78);
      background: rgba(239, 203, 109, 0.24);
    }

    .modal-choice-card input {
      width: auto;
      margin-top: 0.2rem;
      accent-color: var(--signal);
    }

    .modal-choice-card strong,
    .modal-choice-card small {
      display: block;
    }

    .modal-choice-card small {
      color: var(--muted);
      font-size: 0.8rem;
      line-height: 1.35;
      margin-top: 0.12rem;
    }

    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 0.55rem;
      margin-top: 1rem;
    }


    .side-panel {
      display: none;
    }

    .object-popup {
      position: absolute;
      z-index: 30;
      width: min(310px, calc(100% - 24px));
      max-height: calc(100% - 24px);
      overflow: auto;
      background: rgba(255, 255, 255, 0.96);
      border: 1px solid rgba(197, 157, 57, 0.58);
      border-radius: 13px;
      padding: 0.78rem;
      box-shadow: 0 18px 46px rgba(21, 20, 19, 0.24);
      backdrop-filter: blur(8px);
    }

    .object-popup[hidden] {
      display: none;
    }

    .object-popup .popup-title {
      display: flex;
      align-items: start;
      justify-content: space-between;
      gap: 0.75rem;
      margin-bottom: 0.55rem;
      cursor: grab;
      user-select: none;
    }

    .object-popup.dragging .popup-title {
      cursor: grabbing;
    }

    .object-popup .popup-heading {
      font-weight: 900;
      letter-spacing: -0.025em;
      color: var(--node);
    }

    .object-popup .popup-meta {
      color: var(--muted);
      font-size: 0.76rem;
      font-weight: 700;
      margin-top: 0.1rem;
    }

    .object-popup .popup-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.55rem;
    }

    .object-popup .input-group {
      gap: 0.25rem;
    }

    .object-popup label {
      font-size: 0.74rem;
    }

    .object-popup input,
    .object-popup select {
      font-size: 0.86rem;
      padding: 0.48rem 0.55rem;
      border-radius: 7px;
    }

    .power-source-button-row {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 0.35rem;
    }

    .power-source-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 2.35rem;
      border: 1px solid rgba(68, 63, 58, 0.24);
      border-radius: 8px;
      background: var(--white);
      color: var(--charcoal);
      cursor: pointer;
      font-size: 1.05rem;
      font-weight: 900;
      line-height: 1;
      box-shadow: inset 0 -2px 0 rgba(68, 63, 58, 0.08);
    }

    .power-source-button:hover,
    .power-source-button.active {
      border-color: rgba(197, 157, 57, 0.78);
      background: rgba(239, 203, 109, 0.24);
      color: var(--node);
    }

    .power-source-button.active {
      box-shadow: inset 0 -3px 0 rgba(197, 157, 57, 0.42);
    }

    .power-source-icon {
      width: 1.15rem;
      height: 1.15rem;
      stroke: currentColor;
      fill: currentColor;
      stroke-width: 1.6;
      stroke-linecap: round;
      stroke-linejoin: round;
      overflow: visible;
    }

    .power-source-unspecified {
      font-size: 1.2rem;
      line-height: 1;
    }

    .object-popup .popup-actions {
      display: flex;
      justify-content: space-between;
      gap: 0.45rem;
      margin-top: 0.65rem;
      flex-wrap: wrap;
    }

    .object-popup .popup-save-action {
      margin-left: auto;
      background: #2F8F4E;
      border-color: #2F8F4E;
      color: var(--white);
    }

    .object-popup .popup-save-action:hover {
      background: #267A41;
      border-color: #267A41;
      color: var(--white);
    }

    .popup-close {
      border: 0;
      background: transparent;
      color: var(--warm-grey);
      cursor: pointer;
      font-weight: 900;
      font-size: 1.1rem;
      line-height: 1;
      padding: 0.1rem;
    }

    .popup-close:hover {
      color: var(--node);
    }

    @media (max-width: 980px) {
      .container { width: min(96vw, 100%); }
      .brand-header-content { grid-template-columns: 1fr; }
      .placement-layout { grid-template-columns: 1fr; }
      .side-panel { order: 2; grid-template-columns: 1fr; }
    }

    @media (max-width: 620px) {
      body { padding: 1rem 0.75rem; }
      .tool-section { padding: 1rem; }
      .controls, .placement-controls, .map-controls, .scale-controls { padding: 0.85rem; }
      .chart-container { height: 350px; }
      #placementCanvas { height: 420px; }
      .heat-legend { grid-template-columns: repeat(4, 1fr); }
      .selected-card .mini-grid { grid-template-columns: 1fr; }
      .share-config-row { grid-template-columns: 1fr; }
      .canvas-toolbar { position: static; }
      .toolbar-group { flex: 1 1 auto; flex-wrap: wrap; }
      .canvas-toolbar .mode-btn,
      .canvas-toolbar .menu-btn,
      .canvas-toolbar .action-btn,
      .canvas-toolbar .small-btn { flex: 1 1 auto; }
    }

    .tool-menu {
      position: relative;
      display: inline-flex;
      align-items: stretch;
    }

    .tool-menu > summary {
      list-style: none;
    }

    .tool-menu > summary::-webkit-details-marker {
      display: none;
    }

    .tool-menu > summary::after {
      content: "▾";
      display: inline-flex;
      align-items: center;
      align-self: center;
      font-size: 0.68rem;
      line-height: 1;
      margin-left: 0.15rem;
    }

    .tool-menu[open] > summary,
    .reference-tool-menu.reference-mode > summary,
    .deterrent-tool-menu.deterrent-mode > summary {
      color: var(--node);
      border-color: rgba(197, 157, 57, 0.72);
      background: rgba(239, 203, 109, 0.78);
      box-shadow: inset 0 -2px 0 rgba(159, 127, 45, 0.45);
    }

    .tool-menu-panel {
      position: absolute;
      top: calc(100% + 0.45rem);
      left: 0;
      z-index: 50;
      min-width: min(88vw, 22rem);
      padding: 0.85rem;
      background: rgba(255, 255, 255, 0.98);
      border: 1px solid rgba(68, 63, 58, 0.20);
      border-radius: 12px;
      box-shadow: 0 18px 45px rgba(21, 20, 19, 0.18);
      display: grid;
      gap: 0.75rem;
      color: var(--text);
    }

    .map-menu-panel {
      min-width: min(92vw, 28rem);
    }

    .reference-menu-panel,
    .deterrent-menu-panel {
      min-width: min(88vw, 18rem);
    }

    .reference-option-btn,
    .deterrent-option-btn {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.8rem;
      width: 100%;
      border: 1px solid rgba(68, 63, 58, 0.18);
      border-radius: 8px;
      padding: 0.55rem 0.65rem;
      background: rgba(255, 255, 255, 0.86);
      color: var(--text);
      cursor: pointer;
      font-weight: 800;
    }

    .reference-option-btn span,
    .deterrent-option-btn span {
      color: var(--muted);
      font-size: 0.78rem;
      font-weight: 700;
      text-align: right;
    }

    .reference-option-btn:hover,
    .reference-option-btn.active,
    .deterrent-option-btn:hover,
    .deterrent-option-btn.active {
      border-color: rgba(197, 157, 57, 0.74);
      background: rgba(239, 203, 109, 0.24);
    }

    .crop-menu-panel {
      min-width: 13rem;
    }

    .map-file-row.compact {
      display: grid;
      grid-template-columns: 1fr;
      gap: 0.6rem;
      align-items: stretch;
    }

    .map-file-row.compact .map-name {
      max-width: 100%;
    }

    .crop-menu-panel .mode-btn,
    .crop-menu-panel .small-btn,
    .map-menu-panel .mode-btn,
    .map-menu-panel .small-btn,
    .reference-menu-panel .small-btn {
      width: 100%;
      justify-content: center;
    }

    @media (max-width: 720px) {
      .tool-menu {
        flex: 1 1 auto;
      }

      .tool-menu > summary {
        width: 100%;
      }

      .tool-menu-panel {
        position: fixed;
        left: 1rem;
        right: 1rem;
        top: auto;
        width: auto;
        min-width: 0;
      }
    }

    .placement-workspace:fullscreen {
      width: 100vw;
      height: 100vh;
      padding: 0.75rem;
      background: linear-gradient(135deg, var(--node), var(--charcoal));
      overflow: auto;
    }

    .placement-workspace:fullscreen .canvas-toolbar {
      top: 0;
      margin-bottom: 0.75rem;
    }

    .placement-workspace:fullscreen .toolbar-brand {
      display: inline-flex;
      width: 128px;
      flex: 0 0 128px;
    }

    .placement-workspace:fullscreen .placement-canvas-wrap {
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    }

    .placement-workspace:fullscreen .status-bar,
    .placement-workspace:fullscreen .note {
      max-width: min(100%, 1200px);
      margin-left: auto;
      margin-right: auto;
    }

    .help-container {
      max-width: 1440px;
    }

    .help-shell {
      display: grid;
      grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr) minmax(12rem, 16rem);
      gap: clamp(1rem, 2vw, 1.5rem);
      align-items: start;
    }

    .help-sidebar,
    .help-toc {
      position: sticky;
      top: 1rem;
      display: grid;
      gap: 0.45rem;
      padding: 1rem;
      background: rgba(227, 214, 187, 0.26);
      border: 1px solid rgba(68, 63, 58, 0.14);
      border-radius: 14px;
    }

    .help-sidebar nav,
    .help-toc {
      display: grid;
      gap: 0.45rem;
    }

    .help-doc-link,
    .help-toc a {
      color: var(--charcoal);
      text-decoration: none;
      border-radius: 9px;
      padding: 0.52rem 0.65rem;
      font-weight: 700;
      transition: background 0.2s, color 0.2s;
    }

    .help-doc-link:hover,
    .help-doc-link.active,
    .help-toc a:hover {
      color: var(--node);
      background: rgba(239, 203, 109, 0.38);
    }

    .help-article {
      min-width: 0;
      padding: clamp(1rem, 2vw, 1.65rem);
      background: rgba(255, 255, 255, 0.78);
      border: 1px solid rgba(68, 63, 58, 0.12);
      border-radius: 16px;
    }

    .help-article h1,
    .help-article h2,
    .help-article h3,
    .help-article h4,
    .help-article h5,
    .help-article h6 {
      scroll-margin-top: 1rem;
      margin: 1.15rem 0 0.55rem;
      color: var(--node);
    }

    .help-article h1 { margin-top: 0; font-size: clamp(2rem, 4vw, 3.4rem); }
    .help-article p, .help-article ul, .help-article pre { margin-bottom: 1rem; }
    .help-article ul { padding-left: 1.25rem; }
    .help-article a { color: var(--accent-hover); font-weight: 800; }
    .help-article code { padding: 0.12rem 0.28rem; border-radius: 5px; background: rgba(68, 63, 58, 0.10); }
    .help-article pre { overflow-x: auto; padding: 1rem; border-radius: 12px; background: var(--node); color: var(--white); }
    .help-article pre code { padding: 0; background: transparent; color: inherit; }
    .help-article img { display: block; max-width: 100%; height: auto; margin: 1rem 0; border-radius: 14px; box-shadow: 0 14px 38px rgba(21, 20, 19, 0.14); }

    .help-toc .toc-level-1 { font-size: 0.96rem; }
    .help-toc .toc-level-2 { padding-left: 1rem; }
    .help-toc .toc-level-3,
    .help-toc .toc-level-4,
    .help-toc .toc-level-5,
    .help-toc .toc-level-6 { padding-left: 1.8rem; font-size: 0.9rem; color: var(--muted); }

    @media (max-width: 1050px) {
      .help-shell { grid-template-columns: 1fr; }
      .help-sidebar,
      .help-toc { position: static; }
    }

    .section-help-link {
      display: inline-flex;
      align-items: center;
      width: fit-content;
      margin-top: 0.9rem;
      padding: 0.62rem 0.95rem;
      border: 1px solid rgba(197, 157, 57, 0.55);
      border-radius: 999px;
      color: var(--node);
      background: rgba(239, 203, 109, 0.28);
      font-weight: 800;
      text-decoration: none;
      transition: background 0.2s, border-color 0.2s, transform 0.2s;
    }

    .section-help-link:hover {
      background: rgba(239, 203, 109, 0.44);
      border-color: rgba(197, 157, 57, 0.85);
      transform: translateY(-1px);
    }

    .section-header .section-subtitle {
      max-width: none;
    }

    .quick-start-panel {
      width: 100%;
      margin-top: 0.9rem;
      border: 1px solid rgba(68, 63, 58, 0.18);
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.78);
      box-shadow: 0 12px 28px rgba(21, 20, 19, 0.08);
      overflow: hidden;
    }

    .quick-start-panel > summary {
      cursor: pointer;
      padding: 0.85rem 1rem;
      font-family: var(--headline-font);
      font-weight: 700;
      color: var(--node);
      list-style-position: inside;
    }

    .quick-start-panel[open] > summary {
      border-bottom: 1px solid rgba(68, 63, 58, 0.14);
      background: rgba(239, 203, 109, 0.18);
    }

    .quick-start-content {
      display: grid;
      gap: 0.75rem;
      max-height: min(62vh, 42rem);
      overflow: auto;
      padding: 1rem;
    }

    .quick-start-content h2,
    .quick-start-content h3,
    .quick-start-content h4 {
      margin-top: 0.35rem;
      color: var(--node);
    }

    .quick-start-content p,
    .quick-start-content ul {
      margin: 0;
    }

    .quick-start-content ul {
      padding-left: 1.2rem;
    }

    .quick-start-content a {
      color: var(--accent-hover);
      font-weight: 800;
    }

    .quick-start-image-placeholder {
      display: block;
      padding: 0.7rem 0.8rem;
      border: 1px dashed rgba(197, 157, 57, 0.72);
      border-radius: 10px;
      background: rgba(239, 203, 109, 0.16);
      color: var(--charcoal);
      font-weight: 700;
      font-size: 0.9rem;
    }

    .help-image-figure {
      margin: 1rem 0;
    }

    .help-image-missing {
      display: block;
      margin-top: 0.5rem;
      padding: 0.7rem 0.8rem;
      border: 1px dashed rgba(197, 157, 57, 0.72);
      border-radius: 10px;
      background: rgba(239, 203, 109, 0.16);
      color: var(--charcoal);
      font-weight: 700;
      font-size: 0.9rem;
    }

    /* Public site and building-creation shell */
    .site-nav {
      width: min(100% - 2rem, 1480px);
      margin: 1rem auto 0;
      padding: 0.72rem 0.85rem 0.72rem 1rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      border: 1px solid rgba(255,255,255,.12);
      border-radius: 14px;
      background: rgba(21,20,19,.94);
      box-shadow: 0 14px 40px rgba(21,20,19,.16);
    }
    .nav-brand { display:flex; align-items:center; gap:.8rem; color:var(--white); text-decoration:none; font-family:var(--headline-font); font-weight:700; }
    .nav-brand img { width: 98px; height: 32px; object-fit:contain; }
    .nav-brand span { padding-left:.8rem; border-left:1px solid rgba(255,255,255,.25); }
    .nav-links { display:flex; align-items:center; gap:.3rem; }
    .nav-links a { color:rgba(255,255,255,.78); text-decoration:none; font-size:.88rem; font-weight:700; padding:.65rem .8rem; border-radius:8px; }
    .nav-links a:hover { color:var(--white); background:rgba(255,255,255,.08); }
    .nav-links .nav-login { color:var(--node); background:var(--light-gold); padding-inline:1rem; }
    .nav-links .nav-login:hover { color:var(--node); background:var(--beige); }

    .marketing-page { min-height:100vh; color:var(--white); background:var(--node); }
    .marketing-page::before { content:""; position:fixed; inset:0; pointer-events:none; background:radial-gradient(circle at 75% 15%, rgba(197,157,57,.17), transparent 31%), linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size:auto, 44px 44px, 44px 44px; }
    .marketing-page main, .marketing-footer, .marketing-page .site-nav { position:relative; z-index:1; }
    .marketing-hero { width:min(100% - 2rem, 1380px); min-height:650px; margin:0 auto; display:grid; grid-template-columns:minmax(0,.85fr) minmax(450px,1.15fr); gap:clamp(2rem,6vw,6rem); align-items:center; padding:clamp(4rem,8vw,8rem) 0; }
    .hero-copy h1 { max-width:780px; font-size:clamp(3rem,6vw,6rem); line-height:.96; letter-spacing:-.06em; }
    .hero-copy > p { max-width:670px; color:rgba(255,255,255,.68); font-size:clamp(1rem,1.5vw,1.2rem); line-height:1.7; margin-top:1.5rem; }
    .hero-actions { display:flex; gap:.8rem; flex-wrap:wrap; margin-top:2rem; }
    .marketing-button { min-height:50px; padding:.85rem 1.25rem; border:1px solid rgba(255,255,255,.2); border-radius:9px; display:inline-flex; align-items:center; justify-content:center; color:var(--white); text-decoration:none; font-weight:800; transition:.2s ease; }
    .marketing-button:hover { transform:translateY(-2px); }
    .marketing-button.primary { background:var(--light-gold); border-color:var(--light-gold); color:var(--node); }
    .marketing-button.secondary { background:rgba(255,255,255,.05); }
    .marketing-button.full { width:100%; }
    .hero-copy .trial-note { margin-top:1rem; font-size:.82rem; color:rgba(255,255,255,.48); }
    .preview-window { overflow:hidden; border:1px solid rgba(239,203,109,.28); border-radius:17px; background:#f7f1e4; box-shadow:0 36px 90px rgba(0,0,0,.4); transform:perspective(1200px) rotateY(-4deg) rotateX(2deg); }
    .preview-bar { height:48px; padding:0 1rem; display:flex; gap:.42rem; align-items:center; background:#fff; color:var(--charcoal); border-bottom:1px solid rgba(68,63,58,.12); font-size:.72rem; }
    .preview-bar span { width:8px; height:8px; border-radius:50%; background:var(--beige); }.preview-bar span:first-child{background:var(--signal)}.preview-bar b{margin-left:auto}
    .preview-canvas { position:relative; aspect-ratio:1.35; overflow:hidden; }
    .preview-grid { position:absolute; inset:0; opacity:.35; background:linear-gradient(rgba(68,63,58,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(68,63,58,.18) 1px,transparent 1px); background-size:22px 22px; }
    .preview-building { position:absolute; background:rgba(68,63,58,.12); border:3px solid var(--charcoal); clip-path:polygon(4% 15%,74% 4%,96% 28%,88% 88%,17% 96%,0 65%); }
    .preview-building.one { inset:18% 17% 20% 13%; }.preview-building.two { width:22%; height:28%; right:5%; bottom:6%; transform:rotate(8deg); }
    .strike-dot { position:absolute; width:18px; height:18px; background:#b84b3d; border:4px solid #fff; border-radius:50%; box-shadow:0 0 0 7px rgba(184,75,61,.15); }.d1{left:27%;top:33%}.d2{left:58%;top:23%}.d3{left:67%;top:59%}.d4{right:12%;bottom:18%}
    .preview-legend { position:absolute; left:1rem; bottom:1rem; display:grid; gap:.35rem; width:160px; padding:.75rem; border:1px solid rgba(68,63,58,.12); border-radius:9px; color:var(--charcoal); background:rgba(255,255,255,.92); font-size:.68rem; box-shadow:0 8px 24px rgba(21,20,19,.12); }.preview-legend span{display:flex;align-items:center;gap:.4rem}.preview-legend i{width:8px;height:8px;border-radius:50%;background:#b84b3d}.preview-legend em{width:11px;height:8px;border:2px solid var(--charcoal)}
    .trust-strip { width:min(100% - 2rem, 1380px); margin:0 auto; padding:1.4rem 0; display:flex; align-items:center; justify-content:space-between; gap:1.5rem; border-block:1px solid rgba(255,255,255,.12); color:rgba(255,255,255,.62); font-size:.83rem; text-transform:uppercase; letter-spacing:.08em; }.trust-strip span{color:var(--signal);font-weight:800}
    .process-section { width:min(100% - 2rem, 1200px); margin:0 auto; padding:8rem 0; }.section-intro{max-width:760px}.section-intro h2,.closing-cta h2{font-size:clamp(2.2rem,4vw,4rem);line-height:1.04}.section-intro p,.closing-cta p{margin-top:1rem;color:rgba(255,255,255,.62);line-height:1.7}
    .process-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:1rem; margin-top:3rem; }.process-grid article{min-height:230px;padding:1.6rem;border:1px solid rgba(255,255,255,.12);border-radius:14px;background:linear-gradient(145deg,rgba(255,255,255,.065),rgba(255,255,255,.02))}.process-grid article>span{color:var(--signal);font-weight:800;font-size:.8rem}.process-grid h3{color:var(--white);font-size:1.3rem;margin-top:3rem}.process-grid p{color:rgba(255,255,255,.58);line-height:1.65;margin-top:.7rem}
    .closing-cta { width:min(100% - 2rem, 1380px); margin:0 auto 3rem; padding:clamp(2rem,5vw,4rem); display:flex; align-items:center; justify-content:space-between; gap:2rem; border-radius:18px; color:var(--node); background:var(--beige); }.closing-cta .eyebrow{color:#82671f}.closing-cta p{color:var(--charcoal)}.closing-cta .marketing-button{flex:0 0 auto;background:var(--node);border-color:var(--node);color:var(--white)}
    .marketing-footer { width:min(100% - 2rem, 1380px); margin:auto; padding:2rem 0 3rem; display:flex; justify-content:space-between; align-items:center; color:rgba(255,255,255,.45); font-size:.8rem; }.marketing-footer a{color:inherit}

    .builder-nav { margin-bottom:0; }
    .builder-container { max-width:1480px; padding-top:1.5rem; }
    .builder-header { min-height:0; padding:2rem clamp(1rem,3vw,2.5rem); display:flex; align-items:flex-end; justify-content:space-between; border-radius:16px; }
    .builder-header h1 { font-size:clamp(2rem,4vw,3.6rem); }.builder-header p{color:rgba(255,255,255,.7);margin-top:.8rem}.draft-badge{display:flex;align-items:center;gap:.55rem;padding:.55rem .75rem;border:1px solid rgba(255,255,255,.2);border-radius:999px;color:rgba(255,255,255,.75);font-size:.8rem;font-weight:700;white-space:nowrap}.draft-badge span{width:7px;height:7px;background:var(--light-gold);border-radius:50%;box-shadow:0 0 0 4px rgba(239,203,109,.14)}
    .building-details-card { margin:1.5rem 0; padding:clamp(1.1rem,2.5vw,1.7rem); border:1px solid rgba(68,63,58,.14); border-radius:16px; background:var(--white); box-shadow:0 15px 45px rgba(21,20,19,.09); }.building-details-heading{display:flex;align-items:end;justify-content:space-between;gap:2rem;margin-bottom:1.2rem}.building-details-heading h2{margin:0}.building-details-heading p{max-width:520px;color:var(--muted);font-size:.85rem}.building-details-grid{display:grid;grid-template-columns:1.25fr 1.25fr 1fr auto;align-items:end;gap:.8rem}.save-building-details{white-space:nowrap}.building-save-status{min-height:1.2em;margin-top:.75rem;color:#567346;font-size:.82rem;font-weight:700}.compact-section-header{display:grid;grid-template-columns:1fr auto;column-gap:1rem}.compact-section-header .eyebrow,.compact-section-header .section-subtitle{grid-column:1}.compact-section-header .section-help-link{grid-column:2;grid-row:1 / span 3;align-self:center}.compact-section-header .quick-start-panel{grid-column:1 / -1}

    .auth-page { min-height:100vh; background:var(--node); }.auth-shell{min-height:calc(100vh - 90px);padding:3rem 1rem;display:grid;place-items:center;background:radial-gradient(circle at 50% 15%,rgba(197,157,57,.18),transparent 35%)}.auth-card{width:min(100%,500px);padding:clamp(1.5rem,4vw,2.5rem);border-radius:18px;background:var(--white);box-shadow:0 30px 80px rgba(0,0,0,.35)}.auth-card h1{font-size:clamp(2rem,5vw,3rem);line-height:1.05}.auth-card>p{color:var(--muted);line-height:1.6;margin-top:1rem}.auth-form{display:grid;gap:1rem;margin-top:1.5rem}.auth-divider{display:flex;align-items:center;gap:.8rem;margin:1.4rem 0;color:var(--muted);font-size:.78rem}.auth-divider::before,.auth-divider::after{content:"";height:1px;flex:1;background:var(--grid)}
    @media(max-width:900px){.marketing-hero{grid-template-columns:1fr;padding-top:4rem}.hero-visual{max-width:700px}.trust-strip{flex-wrap:wrap;justify-content:flex-start}.process-grid{grid-template-columns:1fr}.building-details-grid{grid-template-columns:1fr 1fr}.save-building-details{min-height:44px}.compact-section-header{display:block}}
    @media(max-width:620px){.site-nav{align-items:flex-start}.nav-brand span{display:none}.nav-links{flex-wrap:wrap;justify-content:flex-end}.nav-links a:not(.nav-login){display:none}.marketing-hero{min-height:0}.preview-window{transform:none}.trust-strip{display:grid}.closing-cta,.marketing-footer,.builder-header,.building-details-heading{align-items:flex-start;flex-direction:column}.building-details-grid{grid-template-columns:1fr}.draft-badge{margin-top:1rem}}
