
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0a0a0a; color: #fff; min-height: 100vh; padding: 20px; }
    h1 { text-align: center; font-size: 2.3rem; font-weight: 800; letter-spacing: -0.5px; color: #fff; margin-bottom: 10px; text-transform: uppercase; }
    .subtitle { text-align: center; font-size: 1.1rem; color: #888; margin-bottom: 30px; }
    .container { max-width: 1400px; margin: 0 auto; width: 100%; }
    
    #chart-container { background: linear-gradient(135deg, #1a1a1a 0%, #111 100%); border: 1px solid #2a2a2a; padding: 1.5rem; margin-bottom: 25px; height: 450px; border-radius: 4px; position: relative; }
    
    .chart-legend { display: flex; justify-content: center; gap: 1rem; padding: 0.5rem 0; margin-bottom: 15px; flex-wrap: wrap; }
    .legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: #bbb; }
    .legend-line { width: 20px; height: 3px; border-radius: 1px; }
    .legend-line.temp { background: #60a5fa; }
    .legend-line.setpoint { background: #00BFFF; height: 1px; border-top: 2px dashed #00BFFF; }
    .legend-line.evap { background: #BF00FF; }
    .legend-line.cond { background: #f97316; }
    .legend-line.limit { background: transparent; height: 1px; border-top: 2px dashed #ef4444; }
    .legend-line.ambiente { background: #4ade80; }
    .legend-line.aspirazione { background: #ffeb3b; }
    
    .controls { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; }
    .btn { background: linear-gradient(135deg, #4a4a4a 0%, #3a3a3a 100%); border: 1px solid #5a5a5a; color: #ccc; padding: 8px 16px; font-size: 0.7rem; font-weight: 600; cursor: pointer; text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.15s ease; border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
    .btn:active { background: linear-gradient(135deg, #6a6a6a 0%, #5a5a5a 100%) !important; border-color: #7a7a7a !important; color: #fff !important; transform: scale(0.95); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.1); }
    .btn#btn-reset { background: linear-gradient(135deg, #7a2a2a 0%, #5a1a1a 100%); border: 1px solid #8a3a3a; color: #ffcccc; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
    .btn#btn-reset:active { background: linear-gradient(135deg, #aa4a4a 0%, #8a3a3a 100%) !important; border-color: #ba5a5a !important; color: #fff !important; transform: scale(0.95); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 200, 200, 0.2); }
    .classe-btn:not(.active):active { background: linear-gradient(135deg, #2a3a5a, #1a2a4a) !important; border-color: #3a4a6a !important; }
    .btn.primary { background: linear-gradient(135deg, #4a4a4a 0%, #3a3a3a 100%); border: 1px solid #5a5a5a; color: #ccc; }
    .btn.primary:active { background: linear-gradient(135deg, #6a6a6a 0%, #5a5a5a 100%) !important; border-color: #7a7a7a !important; color: #fff !important; transform: scale(0.95); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.1); }
    .btn.analyze { background: linear-gradient(135deg, #4a4a4a 0%, #3a3a3a 100%); border: 1px solid #5a5a5a; color: #ccc; }
    .btn.analyze:active { background: linear-gradient(135deg, #6a6a6a 0%, #5a5a5a 100%) !important; border-color: #7a7a7a !important; color: #fff !important; transform: scale(0.95); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.1); }
    
    .stats { background: linear-gradient(135deg, #1a1a1a 0%, #111 100%); border: 1px solid #2a2a2a; padding: 15px; margin-bottom: 20px; border-radius: 4px; }
    .stats h3 { font-size: 0.8rem; color: #aaa; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
    .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .stat-item { display: flex; flex-direction: column; align-items: center; padding: 8px; background: #111; border: 1px solid #222; border-radius: 4px; }
    .stat-label { color: #bbb; font-size: 0.8rem; margin-bottom: 4px; font-weight: 500; }
    .stat-value { color: #fff; font-size: 1rem; font-weight: 600; }
    .stat-value.warning { color: #f97316; }
    .stat-value.danger { color: #ef4444; }
    .stat-value.ok { color: #4ade80; }
    
    .config { background: linear-gradient(135deg, #1a1a1a 0%, #111 100%); border: 1px solid #2a2a2a; padding: 15px; margin-bottom: 20px; border-radius: 4px; }
    .config h3 { font-size: 0.8rem; color: #aaa; margin-bottom: 10px; text-transform: uppercase; }
    .config-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .config-row { display: flex; align-items: center; gap: 10px; }
    .config-row label { color: #bbb; font-size: 0.75rem; flex: 1; }
    .config-row input { background: #111; border: 1px solid #333; color: #fff; padding: 6px 10px; width: 70px; font-size: 0.8rem; border-radius: 4px; }
    .model-buttons { display: flex; gap: 8px; align-items: center; }
    .model-btn { background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%); border: 1px solid #3a3a3a; color: #888; padding: 6px 14px; font-size: 0.7rem; font-weight: 600; cursor: pointer; text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.2s; border-radius: 4px; }
    .model-btn.active { background: linear-gradient(135deg, #2a5a3a 0%, #3a7a4a 100%); border-color: #4a9a5a; color: #fff; }
    .classe-btn.active { background: linear-gradient(135deg, #7a2a2a 0%, #9a3a3a 100%) !important; border-color: #ba5a5a !important; color: #fff !important; }
    .model-btn:active { opacity: 0.8; }
    .defr-btn { background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%); border: 1px solid #3a3a3a; color: #888; }
    .defr-btn.active { background: linear-gradient(135deg, #7a2a7a 0%, #9a3a9a 100%) !important; border-color: #ba5aba !important; color: #fff !important; }
    
    .log { background: #111; border: 1px solid #2a2a2a; padding: 10px; max-height: 120px; overflow-y: auto; font-family: monospace; font-size: 0.7rem; color: #666; margin-bottom: 20px; border-radius: 4px; display: none; /* Nascosto visivamente ma codice funzionante */ }
    .log::-webkit-scrollbar, .analysis-content::-webkit-scrollbar { width: 8px; }
    .log::-webkit-scrollbar-track, .analysis-content::-webkit-scrollbar-track { background: #111; }
    .log::-webkit-scrollbar-thumb, .analysis-content::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
    .log::-webkit-scrollbar-thumb:hover, .analysis-content::-webkit-scrollbar-thumb:hover { background: #444; }
    .log-entry { padding: 2px 0; border-bottom: 1px solid #1a1a1a; }
    .log-entry.warning { color: #f97316; }
    .log-entry.danger { color: #ef4444; }
    
    .analysis-box { background: linear-gradient(135deg, #1a1a1a 0%, #111 100%); border: 1px solid #2a2a2a; padding: 20px; margin-bottom: 20px; display: none; border-radius: 4px; }
    .analysis-box.visible { display: block; }
    .analysis-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid #333; margin-bottom: 15px; }
    .analysis-title { font-size: 1rem; font-weight: 600; color: #3a7a9a; }
    .analysis-copy { background: #2a2a2a; border: 1px solid #3a3a3a; color: #ddd; padding: 6px 12px; font-size: 0.75rem; cursor: pointer; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.2s; }
    .analysis-copy:active { background: #3a3a3a; color: #fff; }
    .analysis-content { font-size: 0.9rem; color: #ccc; line-height: 1.8; padding: 10px 0; max-height: 500px; overflow-y: auto; }
    .interval-selector { background: #111; border: 1px solid #2a2a2a; padding: 15px; margin: 15px 0; border-radius: 4px; }
    .interval-selector h4 { color: #aaa; font-size: 0.85rem; margin-bottom: 10px; }
    .interval-item { display: flex; align-items: center; gap: 10px; padding: 8px; margin: 5px 0; background: #0a0a0a; border-radius: 4px; border: 1px solid #222; }
    .interval-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
    .interval-item label { flex: 1; color: #ccc; font-size: 0.8rem; cursor: pointer; }
    .interval-badge { padding: 2px 8px; border-radius: 3px; font-size: 0.7rem; font-weight: 600; }
    .interval-badge.drift { background: rgba(234, 179, 8, 0.2); color: #fbbf24; }
    .interval-badge.soglia { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
    .interval-badge.entrambi { background: rgba(239, 68, 68, 0.2); color: #f87171; }
    .analysis-loading { color: #888; font-style: italic; }
    .popup { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.95); z-index: 1000; align-items: center; justify-content: center; padding: 2rem; }
    .popup.active { display: flex; }
    .popup-content { background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%); border: 1px solid #3a3a3a; padding: 2rem; text-align: center; max-width: 400px; width: 100%; border-radius: 4px; }
    .popup-content p { font-size: 1rem; margin-bottom: 1.5rem; color: #ccc; line-height: 1.5; white-space: pre-line; }
    .popup-content button { background: #2a2a2a; border: 1px solid #3a3a3a; color: #ddd; padding: 0.8rem 2rem; font-size: 0.9rem; cursor: pointer; text-transform: uppercase; letter-spacing: 0.6px; margin: 0.3rem; border-radius: 4px; transition: all 0.2s; }
    .popup-content button:active { background: #3a3a3a; color: #fff; }
    
    .token-bar { background: #111; border: 1px solid #2a2a2a; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; border-radius: 4px; }
    .token-label { color: #666; }
    .token-value { color: #4ade80; font-weight: 600; }
    
    @media (min-width: 1024px) {
      body { padding: 40px; }
      .container { max-width: 1400px; }
      #chart-container { height: 500px; }
      .config-grid { grid-template-columns: repeat(4, 1fr); }
    }
    
    @media (max-width: 1023px) and (min-width: 769px) {
      body { padding: 20px; }
      .container { max-width: 100%; }
      #chart-container { height: 400px; }
      .config-grid { grid-template-columns: repeat(3, 1fr); }
    }
    
    @media (max-width: 768px) {
      .config-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
      .stats-grid { grid-template-columns: repeat(2, 1fr); }
      #chart-container { height: 350px; padding: 1rem; }
    }
    
    @media (max-width: 480px) {
      body { padding: 4px; overflow-x: hidden; }
      h1 { font-size: 0.95rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .subtitle { font-size: 0.75rem; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .container { max-width: 100%; overflow-x: hidden; }
      #chart-container { height: 200px; padding: 0.4rem; margin-bottom: 8px; overflow: hidden; }
      .chart-legend { gap: 0.3rem; padding: 0.2rem 0; margin-bottom: 6px; flex-wrap: wrap; }
      .legend-item { font-size: 0.65rem; gap: 0.15rem; white-space: nowrap; }
      .legend-line { width: 12px; height: 2px; }
      .stats { padding: 6px; margin-bottom: 8px; }
      .stats h3 { font-size: 0.65rem; margin-bottom: 6px; }
      .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
      .stat-item { padding: 4px; }
      .stat-label { font-size: 0.6rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .stat-value { font-size: 0.75rem; white-space: nowrap; }
      .config { padding: 6px; margin-bottom: 8px; }
      .config h3 { font-size: 0.65rem; margin-bottom: 6px; }
      .config-grid { grid-template-columns: 1fr; gap: 4px; }
      .config-row { gap: 4px; flex-wrap: wrap; }
      .config-row label { font-size: 0.6rem; white-space: nowrap; }
      .config-row input { width: 55px; padding: 4px 6px; font-size: 0.7rem; }
      .model-buttons { gap: 4px; flex-wrap: wrap; }
      .model-btn { padding: 4px 8px; font-size: 0.6rem; }
      .controls { gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
      .btn { padding: 5px 8px; font-size: 0.55rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .log { max-height: 60px; padding: 6px; font-size: 0.55rem; margin-bottom: 8px; }
      .analysis-box { padding: 8px; margin-bottom: 8px; }
      .analysis-header { padding-bottom: 6px; margin-bottom: 6px; }
      .analysis-title { font-size: 0.7rem; }
      .analysis-content { font-size: 0.65rem; line-height: 1.4; }
      .token-bar { padding: 6px 8px; font-size: 0.6rem; }
      .interval-selector { padding: 8px; margin: 8px 0; }
      .interval-selector h4 { font-size: 0.65rem; margin-bottom: 6px; }
      .interval-item { padding: 6px; margin: 3px 0; }
      .interval-item label { font-size: 0.65rem; }
      .interval-badge { padding: 2px 6px; font-size: 0.6rem; }
    }
    
    /* Pagina Analisi Termodinamica */
    .analysis-page { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #0a0a0a; z-index: 2000; overflow-y: auto; }
    .analysis-page.active { display: block; }
    .analysis-navbar { background: linear-gradient(135deg, #1a1a1a 0%, #111 100%); border-bottom: 1px solid #2a2a2a; padding: 12px 20px; display: flex; justify-content: center; align-items: center; position: sticky; top: 0; z-index: 10; }
    .analysis-navbar h2 { font-size: 1.5rem; font-weight: 700; color: #fff; text-transform: none; letter-spacing: -0.3px; }
    .analysis-navbar .exit-btn { display: none; }
    .analysis-content-container { max-width: 1600px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
    .analysis-column { background: linear-gradient(135deg, #1a1a1a 0%, #111 100%); border: 1px solid #2a2a2a; padding: 20px; border-radius: 4px; }
    .analysis-column h3 { font-size: 1.1rem; color: #fff; margin-bottom: 15px; text-transform: none; letter-spacing: 0.5px; border-bottom: 1px solid #333; padding-bottom: 10px; font-weight: 600; position: relative; display: flex; justify-content: space-between; align-items: center; }
    .copy-icon-column { 
      cursor: pointer; 
      font-size: 0.85rem; 
      color: #888; 
      transition: color 0.2s ease; 
      background: none; 
      border: none; 
      padding: 4px 6px; 
      margin-left: 10px; 
      width: 20px;
      height: 20px;
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .copy-icon-column:hover { color: #fff; }
    .copy-icon-column::before {
      content: '';
      position: absolute;
      width: 14px;
      height: 16px;
      border: 1.5px solid currentColor;
      border-radius: 1px;
      background: transparent;
    }
    .copy-icon-column::after {
      content: '';
      position: absolute;
      width: 14px;
      height: 16px;
      border: 1.5px solid currentColor;
      border-radius: 1px;
      background: transparent;
      top: 6px;
      left: 6px;
      opacity: 0.7;
    }
    .analysis-column-content { font-size: 0.85rem; color: #ccc; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; text-align: left; font-style: normal; }
    .loading-spinner { text-align: left; padding: 40px; color: #888; font-style: normal; }
    .btn.active { background: linear-gradient(135deg, #3a5a7a 0%, #4a7a9a 100%) !important; border-color: #5a9aba !important; color: #fff !important; }
    
    @media (max-width: 768px) {
      .analysis-content-container { grid-template-columns: 1fr; gap: 15px; padding: 15px; }
      .analysis-navbar { padding: 10px 15px; }
      .analysis-navbar h2 { font-size: 1.3rem; }
      .analysis-column { padding: 15px; }
      .analysis-column h3 { font-size: 1rem; }
      .analysis-column-content { font-size: 0.75rem; }
    }
    
    @media (max-width: 480px) {
      .analysis-content-container { padding: 10px; gap: 10px; }
      .analysis-navbar { padding: 8px 10px; }
      .analysis-navbar h2 { font-size: 1.1rem; }
      .analysis-navbar .exit-btn { padding: 6px 12px; font-size: 0.65rem; }
      .analysis-column { padding: 10px; }
      .analysis-column h3 { font-size: 0.95rem; margin-bottom: 10px; padding-bottom: 8px; }
      .analysis-column-content { font-size: 0.7rem; line-height: 1.6; }
    }
  