/* STYLE BLOCK 1 */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: #000;
  /* Prevent rubber-band / pull-to-refresh drag on iOS */
  overscroll-behavior: none;
  touch-action: none;
  position: fixed;
  width: 100%;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 780px;
  margin: 0 auto;
  background: #000;
  /* Allow internal scrolling only, not the outer page */
  touch-action: pan-y;
  /* Safe area padding for notch/home-indicator devices */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── HEADER ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  flex-shrink: 0;
  animation: fadeDown 0.4s ease both;
}

.logo { display: flex; align-items: center; gap: 9px; flex-shrink: 0; position: relative; }

/* ── LOGO DROPDOWN MENU ── */
#logoDropdownMenu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #111;
  border: 1px solid rgba(129,140,248,0.3);
  border-radius: 12px;
  overflow: visible;
  z-index: 9999;
  min-width: 160px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#logoDropdownMenu.open { display: block; }
#headerMenuBtn {
  display:flex; align-items:center; gap:10px;
  background:#111; border:1px solid rgba(129,140,248,0.28);
  color:#cbd5e1; border-radius:14px; padding:10px 12px;
  cursor:pointer; font-size:10px; font-weight:800; letter-spacing:.14em;
  text-transform:uppercase; box-shadow:0 8px 20px rgba(0,0,0,.22);
}
#headerMenuBtn .menu-lines { display:flex; flex-direction:column; gap:3px; }
#headerMenuBtn .menu-lines span {
  display:block; width:16px; height:2px; border-radius:999px;
  background:linear-gradient(90deg,#818cf8,#c084fc);
}
#headerMenuBtn:active { transform:scale(.98); }
#rhrSignalProgressLabel {
  margin-top:6px; text-align:center; font-size:10px; letter-spacing:.08em;
  color:#7c8596; min-height:14px;
}
.rhr-secondary-actions {
  display:flex; gap:10px; margin-top:14px; justify-content:center; flex-wrap:wrap;
}
.rhr-secondary-btn {
  border:1px solid rgba(129,140,248,0.28); background:rgba(129,140,248,0.08);
  color:#c7d2fe; border-radius:999px; padding:10px 14px; cursor:pointer;
  font-size:11px; font-weight:700; letter-spacing:.04em;
}
.rhr-secondary-btn.ghost {
  background:transparent; color:#94a3b8; border-color:rgba(148,163,184,0.2);
}
.tr-flow-hint, .tr-picker-hint {
  font-size:11px; color:#7c8596; line-height:1.6; margin-bottom:12px;
}
.logo-dropdown-item {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  color: #e2e8f0;
}
.logo-dropdown-item:hover {
  opacity: 0.7;
}
.logo-dropdown-item + .logo-dropdown-item {
  border-top: 1px solid rgba(129,140,248,0.1);
}
.logo-dropdown-submenu-wrap {
  position: relative;
}
.logo-dropdown-item--parent {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-dropdown-item--parent::after {
  content: '›';
  font-size: 16px;
  font-style: normal;
  opacity: 0.6;
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-left: 8px;
  transition: transform 0.15s;
}
.logo-dropdown-submenu-wrap.open .logo-dropdown-item--parent::after {
  transform: rotate(0deg);
}
.logo-dropdown-submenu {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  background: #111;
  border: 1px solid rgba(129,140,248,0.3);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-width: 160px;
  z-index: 10000;
  overflow: hidden;
}
.logo-dropdown-submenu-wrap.open .logo-dropdown-submenu {
  display: block;
}
.logo-dropdown-item--sub {
  padding: 14px 20px;
  font-size: 12px;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.logo-dropdown-submenu-wrap + .logo-dropdown-item,
.logo-dropdown-item + .logo-dropdown-submenu-wrap .logo-dropdown-item--parent {
  border-top: 1px solid rgba(129,140,248,0.1);
}

.logo-mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, rgba(129,140,248,0.15), rgba(192,132,252,0.08));
  border: 1px solid rgba(129,140,248,0.3);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.logo-mark svg {
  width: 18px; height: 18px;
  stroke: #000; fill: none;
  stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

.logo-text {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.15em;
  background: linear-gradient(90deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 100px;
  font-family: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10px;
  color: #888;
  letter-spacing: 0.04em;
}

.status-dot {
  width: 5px; height: 5px;
  background: #34c759;
  border-radius: 50%;
  animation: pulse 2.4s infinite;
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── MESSAGES ── */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 22px calc(90px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  /* iOS momentum scrolling */
  -webkit-overflow-scrolling: touch;
  /* Allow vertical scroll only inside this element */
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.messages::-webkit-scrollbar { width: 3px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: #222; border-radius: 2px; }

.welcome { flex: 1; display: flex; align-items: center; justify-content: center; background: transparent; pointer-events: none; }

/* ── MESSAGE ROWS ── */
.message-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 22px;
  animation: fadeUp 0.25s ease both;
}

.message-row.user { align-items: flex-end; }
.message-row.bot  { align-items: flex-start; }

.message-label {
  font-family: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #3a3a3a;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.bubble {
  max-width: 78%;
  padding: 12px 16px;
  font-size: 13.5px;
  line-height: 1.76;
  border-radius: 18px;
}

.message-row.user .bubble {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #f5f5f5;
  border-bottom-right-radius: 5px;
  font-family: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, monospace;
  font-weight: 300;
  font-size: 13px;
}

.message-row.bot .bubble {
  background: transparent;
  padding: 0;
  max-width: 100%;
}

.bot-content {
  font-size: 14px;
  line-height: 1.85;
  color: #f0f0f0;
}

.bot-content p { margin-bottom: 10px; }
.bot-content p:last-child { margin-bottom: 0; }

.bot-content strong {
  font-weight: 700;
  color: #cbd5e1;
}

.bot-content code {
  font-family: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  padding: 2px 6px;
  border-radius: 4px;
  color: #ccc;
}

/* ── TYPING ── */
.typing { display: flex; align-items: center; gap: 4px; padding: 6px 0; }

.typing-dot {
  width: 5px; height: 5px;
  background: #555;
  border-radius: 50%;
  animation: bounce 1.3s infinite;
}

.typing-dot:nth-child(2) { animation-delay: .18s; }
.typing-dot:nth-child(3) { animation-delay: .36s; }

@keyframes bounce {
  0%,100%{ transform:translateY(0); opacity:.3; }
  45%    { transform:translateY(-5px); opacity:1; }
}

/* ── ATTACH PREVIEW ── */
#attachPreview {
  padding: 8px 22px 0;
  flex-shrink: 0;
  display: none;
  flex-direction: column;
}

.attach-preview-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 8px 12px;
}

.attach-icon { font-size: 13px; flex-shrink: 0; }

.attach-name {
  font-family: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  color: #aaa;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-remove {
  background: none; border: none;
  font-size: 12px; color: #555;
  cursor: pointer; padding: 0 2px;
  transition: color .15s;
}

.attach-remove:hover { color: #aaa; }

.attach-warning {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  margin-top: 6px;
  padding: 0 2px;
  line-height: 1.5;
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: #1f1f1f;
  flex-shrink: 0;
  margin-top: 4px;
}

/* ── INPUT AREA ── */
.input-area {
  padding: 14px 16px 22px;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}

.input-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 1px solid #333;
  border-radius: 28px;
  padding: 10px 10px 10px 14px;
  transition: border-color .2s;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.03),
    0 4px 24px rgba(0,0,0,.6);
}

.input-container:focus-within {
  border-color: #3a3a3a;
  border-top-color: #444;
}

.attach-btn {
  width: 30px; height: 30px; min-width: 30px;
  background: transparent; border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: .35; transition: opacity .15s;
  padding: 0; flex-shrink: 0;
}

.attach-btn:hover { opacity: .7; }

.attach-btn svg {
  width: 15px; height: 15px;
  stroke: #fff; fill: none;
  stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.input-container textarea {
  flex: 1;
  background: transparent; border: none; outline: none;
  color: #f5f5f5;
  font-family: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px; font-weight: 300;
  line-height: 1.6;
  resize: none;
  min-height: 22px; max-height: 160px;
  overflow-y: auto;
}

.input-container textarea::placeholder { color: #444; }
.input-container textarea::-webkit-scrollbar { width: 2px; }
.input-container textarea::-webkit-scrollbar-thumb { background: #333; }

.send-btn {
  width: 32px; height: 32px; min-width: 32px;
  background: linear-gradient(135deg, rgba(129,140,248,0.2), rgba(192,132,252,0.1));
  border: 1px solid rgba(129,140,248,0.4);
  border: none; border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: .15;
  transition: all .15s;
  pointer-events: none;
  flex-shrink: 0;
}

.send-btn.active { opacity: 1; pointer-events: auto; }
.send-btn.active:hover { background: #e0e0e0; transform: scale(1.05); }

.send-btn svg {
  width: 13px; height: 13px;
  stroke: #000; fill: none;
  stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp   { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeDown { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }

/* ── RESPONSIVE ── */
@media (min-width: 1200px) {
  .app { max-width: 860px; }
  .messages { padding: 32px 28px 12px; }
  .input-area { padding: 14px 20px 26px; }
  .bot-content { font-size: 14.5px; }
}

@media (min-width: 600px) and (max-width: 1199px) {
  .messages { padding: 22px 20px 10px; }
  .bubble { max-width: 82%; }
}

@media (max-width: 599px) {
  .header { padding: 14px 16px; }
  .messages { padding: 16px 14px 10px; }
  #attachPreview { padding: 8px 16px 0; }
  .input-area {
    padding: 10px 12px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .bubble { max-width: 90%; }
  .input-container textarea { font-size: 16px; }
}

@media (max-width: 379px) {
  .logo-text { font-size: 12.5px; }
  .status-pill { display: none; }
  .bubble { max-width: 95%; }
  #infoBtn { display: flex !important; }
}

@media (hover: none) and (pointer: coarse) {
  .send-btn.active:hover { transform: none; }
}

@media (max-width: 767px) and (orientation: landscape) and (max-height: 500px) {
  .header { padding: 8px 16px; }
  .messages { padding: 10px 14px 6px; }
  .input-area { padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .message-row { margin-bottom: 12px; }
}

/* ── ONBOARDING FORM (layout gestito da style#metrix-final-profile-fix) ── */

.form-header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid #1f1f1f;
  flex-shrink: 0;
}

.form-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.form-header-logo img {
  width: 28px; height: 28px;
  border-radius: 6px;
}

.form-header-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(90deg,#818cf8,#c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  letter-spacing: 0.01em;
}

.form-header-sub {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
}

.form-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-body::-webkit-scrollbar { width: 3px; }
.form-body::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }

.form-row {
  display: flex;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.form-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #555;
}

.form-input,
.form-select {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 10px 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #f0f0f0;
  outline: none;
  width: 100%;
  transition: border-color .18s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder { color: #3a3a3a; }

.form-input:focus,
.form-select:focus {
  border-color: #444;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-select option {
  background: #1a1a1a;
  color: #f0f0f0;
}

/* Radio sport */
.sport-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sport-option {
  display: none;
}

.sport-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}

.sport-option:checked + .sport-label {
  border-color: #818cf8;
  color: #a5b4fc;
  background: #1a1a2e;
}

.form-footer {
  padding: 16px 24px 22px;
  border-top: 1px solid #1f1f1f;
  flex-shrink: 0;
}

.form-submit {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, rgba(129,140,248,0.12) 0%, rgba(192,132,252,0.07) 100%);
  border: 1px solid rgba(129,140,248,0.4);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #a5b4fc;
  cursor: pointer;
  transition: all .2s ease;
  letter-spacing: 0.04em;
  box-shadow: 0 0 16px rgba(129,140,248,0.1), inset 0 1px 0 rgba(255,255,255,0.04);
}

.form-submit:hover { background: linear-gradient(135deg, rgba(129,140,248,0.2) 0%, rgba(192,132,252,0.12) 100%); border-color: rgba(129,140,248,0.6); color: #c4b5fd; box-shadow: 0 0 24px rgba(129,140,248,0.18); }
.form-submit:disabled { background: #2a2a2a; color: #555; cursor: not-allowed; }

.form-error {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 11px;
  color: #ff4444;
  margin-top: 8px;
  display: none;
  text-align: center;
}

@media (max-width: 599px) {
  .form-header { padding: 18px 18px 14px; }
  .form-body { padding: 16px 18px; gap: 12px; }
  .form-footer { padding: 12px 18px 18px; }
  .form-row { flex-direction: column; gap: 12px; }
}

/* ── STARTER PILLS ── */
#starterPills {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 24px 10px;
  flex: 1;
  width: 100%;
}

.starter-pill {
  padding: 15px 48px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 100px;
  -webkit-appearance: none;
  appearance: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .25s ease;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.12em;
  width: 100%;
  max-width: 300px;
  position: relative;
  /* Bordo gradient via background-clip */
  background: linear-gradient(#000, #000) padding-box,
              linear-gradient(135deg, rgba(129,140,248,0.4), rgba(192,132,252,0.4)) border-box;
  /* Testo gradient */
  color: transparent;
  -webkit-text-fill-color: transparent;
  /* Non possiamo usare background-clip:text quando background è già usato per il bordo */
  /* Usiamo il colore diretto con opacità */
}

/* Testo gradient tramite span interno generato */
.starter-pill-label {
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}

.starter-pill:hover {
  background: linear-gradient(#0a0a0a, #0a0a0a) padding-box,
              linear-gradient(135deg, rgba(129,140,248,0.7), rgba(192,132,252,0.7)) border-box;
}



/* upload-submit active = starter-pill luminoso */
.starter-pill.upload-submit { opacity: 0.4; pointer-events: none; }
.starter-pill.upload-submit.active { opacity: 1; pointer-events: auto;
  background: linear-gradient(#000, #000) padding-box,
              linear-gradient(135deg, rgba(129,140,248,0.8), rgba(192,132,252,0.8)) border-box; }

.starter-pill.secondary:hover {
  background: rgba(129,140,248,0.08);
  border-color: rgba(129,140,248,0.5);
  color: #a5b4fc;
}

/* ── UPLOAD MODAL ── */
#uploadOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 8500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#uploadModal {
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 1px solid #333;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.9);
  overflow: hidden;
}

.upload-header {
  padding: 20px 22px 14px;
  border-bottom: 1px solid #1f1f1f;
  flex-shrink: 0;
}

.upload-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(90deg,#818cf8,#c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  line-height: 1.4;
  margin-bottom: 6px;
}

.upload-subtitle {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #a5b4fc;
  line-height: 1.5;
}

.upload-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-textarea {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #f0f0f0;
  resize: none;
  min-height: 120px;
  max-height: 200px;
  outline: none;
  transition: border-color .18s;
  width: 100%;
  line-height: 1.6;
}

.upload-textarea::placeholder { color: #3a3a3a; }
.upload-textarea:focus { border-color: #444; }

.upload-divider {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-divider-line {
  flex: 1;
  height: 1px;
  background: #1f1f1f;
}

.upload-divider-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 10px;
  color: #444;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.upload-file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  background: #1a1a1a;
  border: 1px dashed #2a2a2a;
  border-radius: 12px;
  cursor: pointer;
  transition: all .18s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #666;
}

.upload-file-btn:hover {
  border-color: #3a3a3a;
  color: #aaa;
  background: #1f1f1f;
}

.upload-file-btn svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.upload-file-preview {
  display: none;
  align-items: center;
  gap: 8px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 8px 12px;
}

.upload-file-name {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 11px;
  color: #aaa;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-file-remove {
  background: none; border: none;
  font-size: 12px; color: #555;
  cursor: pointer; padding: 0 2px;
  transition: color .15s; flex-shrink: 0;
}

.upload-file-remove:hover { color: #aaa; }

.upload-footer {
  padding: 4px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-submit {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, rgba(129,140,248,0.06) 0%, rgba(192,132,252,0.04) 100%);
  border: 1px solid rgba(129,140,248,0.2);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  cursor: not-allowed;
  transition: all .2s ease;
  opacity: 1;
  pointer-events: auto;
  letter-spacing: 0.04em;
}

.upload-submit.active {
  background: linear-gradient(135deg, rgba(129,140,248,0.14) 0%, rgba(192,132,252,0.08) 100%);
  border-color: rgba(129,140,248,0.45);
  color: #a5b4fc;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(129,140,248,0.12), inset 0 1px 0 rgba(255,255,255,0.04);
}

.upload-submit.active:hover { background: linear-gradient(135deg, rgba(129,140,248,0.22) 0%, rgba(192,132,252,0.14) 100%); border-color: rgba(129,140,248,0.65); color: #c4b5fd; }

.upload-cancel {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #818cf8;
  cursor: pointer;
  transition: color .15s;
}

.upload-cancel:hover { color: #a5b4fc; }

.upload-section-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: -4px;
}

/* ── CHAT LOCKED STATE ── */
.chat-locked {
  pointer-events: none;
  opacity: 0.5;
}

/* ── LOADER ── */
#analysisLoader {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 8000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.loader-spinner {
  width: 36px; height: 36px;
  border: 2px solid #333;
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #666;
  letter-spacing: 0.06em;
}

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

@media (max-width: 599px) {
  #uploadModal { border-radius: 16px; }
  .upload-header { padding: 16px 18px 12px; }
  .upload-body { padding: 14px 18px; }
  .upload-footer { padding: 4px 18px 18px; }
}

/* ── SHARE BAR ── */
#shareBar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px 16px;
  flex-shrink: 0;
  border-top: 1px solid #1f1f1f;
  animation: fadeUp 0.3s ease both;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 100px;
  border: 1px solid #2a2a2a;
  background: #111;
  color: #aaa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}

.share-btn:hover {
  background: #1a1a2e;
  border-color: #818cf8;
  color: #a5b4fc;
}

.share-btn svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── SHARE BUTTON ── */
.share-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
  margin-bottom: 8px;
  animation: fadeUp 0.25s ease both;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 100px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 11px;
  color: #666;
  transition: all .18s;
}

.share-btn:hover {
  border-color: #3a3a3a;
  color: #aaa;
}

.share-btn svg {
  width: 12px; height: 12px;
  stroke: currentColor; fill: none;
  stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── SHARE BAR ── */
#shareBar {
  display: none;
  padding: 12px 22px 16px;
  flex-shrink: 0;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #1f1f1f;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 100px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #aaa;
  transition: all .18s;
  white-space: nowrap;
}

.share-btn:hover {
  background: #1a1a2e;
  border-color: #818cf8;
  color: #a5b4fc;
}

.share-btn svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.share-btn.copied {
  border-color: #34c759;
  color: #34c759;
}

/* ── TOGGLE TIPO ANALISI ── */
.upload-toggle {
  display: flex;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.toggle-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #555;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.toggle-btn.active {
  background: linear-gradient(135deg, rgba(129,140,248,0.18), rgba(192,132,252,0.1));
  border-color: rgba(129,140,248,0.4);
  color: #a5b4fc;
  font-weight: 600;
}

/* ── STORICO ANALISI ── */
.history-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 100px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #888;
  transition: all .18s;
  white-space: nowrap;
}
.history-btn:hover { border-color: #3a3a3a; color: #a5b4fc; background: #1a1a1a; }
.history-btn svg { width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0; }

/* Overlay storico */
/* LED tooltip */




.led-tooltip-title.verde  { color: #a5b4fc; }


.led-tooltip-title.rosso  { color: #6366f1; }




#dashboard {
  display: none;
  flex-direction: column;
  position: fixed; inset: 0;
  z-index: 90;
  background: #000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: max(32px, env(safe-area-inset-top)) 24px calc(90px + env(safe-area-inset-bottom));
  gap: 20px;
  align-items: stretch;
  max-width: 540px;
  margin: 0 auto;
}

/* 3 LED */






.led.verde  { background: #818cf8; box-shadow: 0 0 10px #818cf8, 0 0 24px rgba(129,140,248,0.6); }

.led.rosso  { background: #3730a3; box-shadow: 0 0 6px rgba(55,48,163,0.8); }




/* Score + Bar — layout orizzontale centrato */
.score-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.score-number {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 72px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.score-number span {
  font-size: 20px;
  color: #555;
  font-weight: 400;
  letter-spacing: 0;
}

.bar-container {
  width: 8px;
  height: 100px;
  background: #1a1a1a;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.bar-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  border-radius: 6px;
  height: 0%;
  transition: height 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bar-fill.verde,
.bar-fill.giallo,
.bar-fill.rosso { background: linear-gradient(to top, #3730a3 0%, #818cf8 60%, #e0e7ff 100%); box-shadow: 0 0 12px rgba(129,140,248,0.4); }
.bar-fill.grigio { background: #2a2a2a; }

.score-label { background:linear-gradient(90deg,#818cf8,#c084fc);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #555;
  text-align: left;
  line-height: 1.6;
  flex-shrink: 0;
  min-width: 60px;
}

/* Alert copy btn */
.alert-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 7px 14px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 100px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #888;
  transition: all .18s;
}
.alert-copy-btn:hover { border-color: #818cf8; color: #a5b4fc; }
.alert-copy-btn.copied { border-color: #818cf8; color: #818cf8; }
.alert-copy-btn svg {
  width: 12px; height: 12px;
  stroke: currentColor; fill: none;
  stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* Alert box */
.alert-box {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.alert-box-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(90deg,#818cf8,#c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 8px;
}

.alert-box-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.7;
  font-weight: 300;
}

/* ── SPLASH SCREEN ── */
#splashOverlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  transition: opacity 0.6s ease;
}

#splashOverlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo-img {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  animation: splashNeon 1.4s ease-in-out infinite;
}

@keyframes splashNeon {
  0%, 100% {
    opacity: 0.5;
    transform: scale(0.95);
    box-shadow: 0 0 0 rgba(255,255,255,0), 0 0 0 rgba(255,255,255,0);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255,255,255,0.25), 0 0 60px rgba(255,255,255,0.08);
  }
}

.splash-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 11px;
  color: #333;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: splashTextPulse 1.4s ease-in-out infinite;
}

@keyframes splashTextPulse {
  0%, 100% { color: #666; }
  50%       { color: #aaa; }
}

/* Logo pulse durante processing */
#processingOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}

.pulse-logo {
  width: 90px;
  height: 90px;
  border-radius: 14px;
  animation: logoPulse 1.2s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.95); box-shadow: 0 0 0 rgba(255,255,255,0); }
  50%       { opacity: 1;   transform: scale(1.05); box-shadow: 0 0 30px rgba(255,255,255,0.15); }
}

.pulse-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 11px;
  color: #444;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.form-section-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(90deg,#818cf8,#c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  padding: 8px 0 4px;
  border-top: 1px solid #1f1f1f;
  margin-top: 4px;
}

.form-checkbox-group {
  display: flex;
  align-items: flex-start;
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #888;
  line-height: 1.4;
}

.form-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #fff;
  flex-shrink: 0;
  cursor: pointer;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row .form-group {
  flex: 1;
}

/* Alert box position relative */
.alert-box { position: relative; }

/* ── ONBOARDING CLOSE BTN ── */
.form-header-close {
  position: absolute;
  top: 14px; right: 16px;
  width: 26px; height: 26px;
  background: #222;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #a5b4fc;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  transition: all .15s;
}
.form-header-close:hover { color: #818cf8; background: #1a1a2e; }

/* ── STARTER PILLS GRANDE ── */
#starterPills {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  flex: 1;
}

/* ── FIRMA ── */
.app-footer {
  position: sticky;
  bottom: 0;
  z-index: 125;
  margin: 12px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  text-align: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(18,18,24,.88), rgba(10,10,14,.84));
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 24px 50px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.05);
}
.app-footer-tagline {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 11px;
  font-style: italic;
  color: #ffffff;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.app-footer-copy {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 10px;
  color: #ffffff;
  letter-spacing: 0.04em;
}
.app-footer-copywrap {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
}
.app-footer-info {
  width:44px;
  height:44px;
  min-width:44px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.04);
  color:#a5b4fc;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  user-select:none;
  font-family:Georgia,serif;
  font-size:28px;
  font-style:italic;
  font-weight:bold;
  line-height:1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
} 
@media (max-width: 640px) {
  .app-footer {
    gap: 12px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .app-footer-tagline { font-size: 10px; }
  .app-footer-copy { font-size: 9px; }
  .app-footer-info { width:40px; height:40px; min-width:40px; font-size:24px; }
}

/* ── TRAINING MODAL ── */
#trainingOverlay {
  position: fixed; inset: 0;
  background: #000;
  z-index: 8600;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#trainingOverlay::-webkit-scrollbar { display: none; }
#trainingModal {
  background: #000;
  border: none;
  border-radius: 0;
  width: 100%; max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
#trainingModalBody {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-top: max(16px, env(safe-area-inset-top));
  min-height: 0;
}
#trainingModalFooter {
  flex-shrink: 0;
  padding: 12px 22px max(32px, env(safe-area-inset-bottom));
  background: #000;
  border-top: 1px solid #111;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
#trainingModalFooter .starter-pill {
  max-width: 100%;
  width: 100%;
}
.tr-handle {
  display: flex; justify-content: center; padding: 12px 0 4px;
}
.tr-handle-bar {
  width: 40px; height: 3px;
  background: rgba(255,255,255,0.12); border-radius: 4px;
}
.tr-header {
  padding: 4px 22px 16px;
  border-bottom: 1px solid #1a1a2a;
}
.tr-title {
  font-family: ui-monospace,'SF Mono',monospace;
  font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase;
  background: linear-gradient(90deg,#818cf8,#c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 4px;
}
.tr-subtitle {
  font-family: -apple-system,sans-serif;
  font-size: 13px; color: #555; line-height: 1.5;
}
.tr-section {
  padding: 18px 22px 0;
}
.tr-section-label {
  font-family: ui-monospace,monospace;
  font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; color: #444; margin-bottom: 10px;
}
/* Chip selector disciplina */
.tr-chips {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.tr-chip {
  flex: 1; min-width: 80px;
  padding: 12px 10px;
  background: #111; border: 1px solid #2a2a2a;
  border-radius: 12px; cursor: pointer;
  text-align: center; transition: all .18s;
}
.tr-chip.active {
  background: #0f0f1e;
  border-color: #818cf8;
  box-shadow: 0 0 12px rgba(129,140,248,0.2);
}
.tr-chip-name {
  font-family: ui-monospace,monospace;
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em;
  background: linear-gradient(90deg,#818cf8,#c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tr-chip-sub {
  font-family: -apple-system,sans-serif;
  font-size: 10px; color: #555; margin-top: 3px;
}
/* Scroll picker numerico */
.tr-picker-row {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.tr-picker-group {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.tr-picker-label {
  font-family: ui-monospace,monospace;
  font-size: 9px; letter-spacing: .1em;
  text-transform: uppercase; color: #555;
}
/* ── ROLL PICKER stile iOS ── */
.tr-roll {
  width: 80px;
  height: 150px;
  position: relative;
  flex-shrink: 0;
}
.tr-roll-scroll {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tr-roll-scroll::-webkit-scrollbar { display: none; }
.tr-roll-item {
  height: 50px;
  display: flex; align-items: center; justify-content: center;
  scroll-snap-align: center;
  font-family: ui-monospace,monospace;
  font-size: 26px; font-weight: 700;
  color: #333;
  transition: color .15s;
  cursor: pointer;
  user-select: none;
}
.tr-roll-item.selected {
  background: linear-gradient(90deg,#818cf8,#c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}
/* Spacer top/bottom per centrare il primo/ultimo item */
.tr-roll-spacer { height: 50px; flex-shrink: 0; scroll-snap-align: none; }
/* Linee selezione */
.tr-roll::before,
.tr-roll::after {
  content: '';
  position: absolute;
  left: 8px; right: 8px;
  height: 1px;
  background: rgba(129,140,248,0.25);
  pointer-events: none;
  z-index: 2;
}
.tr-roll::before { top: 50px; }
.tr-roll::after  { top: 100px; }
/* Fade top/bottom */
.tr-roll-fade {
  position: absolute;
  left: 0; right: 0;
  height: 50px;
  pointer-events: none;
  z-index: 1;
}
.tr-roll-fade.top {
  top: 0;
  background: linear-gradient(to bottom, #000 0%, rgba(0,0,0,0) 100%);
}
.tr-roll-fade.bottom {
  bottom: 0;
  background: linear-gradient(to top, #000 0%, rgba(0,0,0,0) 100%);
}
/* Kcal row labels leggibili */
.tr-day-name {
  font-family: -apple-system,sans-serif;
  font-size: 12px; color: #cbd5e1;
  min-width: 64px; flex-shrink: 0; font-weight: 500;
}
/* Toggle kcal manuali */
.tr-toggle-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.tr-toggle-label {
  font-family: -apple-system,sans-serif;
  font-size: 13px; color: #cbd5e1; flex: 1;
}
.tr-toggle {
  width: 42px; height: 24px;
  background: #1e1e1e; border: 1px solid #2a2a2a;
  border-radius: 12px; position: relative;
  cursor: pointer; transition: background .2s;
  flex-shrink: 0;
}
.tr-toggle.on { background: #3730a3; border-color: #818cf8; }
.tr-toggle::after {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: #555; top: 2px; left: 2px;
  transition: left .2s, background .2s;
}
.tr-toggle.on::after { left: 20px; background: #818cf8; }
/* Kcal giornaliere manuali */
.tr-daily-kcal {
  display: flex; flex-direction: column; gap: 8px; margin-top: 8px;
}
.tr-day-row {
  display: flex; align-items: center; gap: 10px;
}
.tr-day-name {
  font-family: ui-monospace,monospace;
  font-size: 10px; letter-spacing: .08em;
  color: #555; width: 52px; flex-shrink: 0;
}
.tr-day-input {
  flex: 1; background: #111; border: 1px solid #2a2a2a;
  border-radius: 8px; padding: 8px 10px;
  font-family: ui-monospace,monospace; font-size: 13px;
  color: #a5b4fc; outline: none;
  transition: border-color .15s;
}
.tr-day-input:focus { border-color: #818cf8; }
/* Bottone calcola */
.tr-calc-btn {
  margin: 18px 22px 0;
  width: calc(100% - 44px);
  padding: 14px;
  background: linear-gradient(135deg,#0f0f1a,#1a1a2e);
  border: 1px solid #2a2a4a; border-radius: 14px;
  color: #818cf8; font-family: -apple-system,sans-serif;
  font-size: 13px; font-weight: 700;
  letter-spacing: .06em; cursor: pointer;
  transition: all .18s;
}
.tr-calc-btn:active { background: #1a1a3a; }
.tr-calc-btn:disabled { opacity: .4; cursor: default; }
/* Result screen TRAINING */
#trainingResult {
  display: none;
  flex-direction: column;
  position: fixed;
  inset: 0;
  width: 100%;
  z-index: 200;
  background: #000;
  overflow: hidden;
  box-sizing: border-box;
}
#trainingResult::-webkit-scrollbar { display: none; }
#trResultScroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 0 24px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  box-sizing: border-box;
  min-height: 0;
}
#trResultHeader {
  position: relative;
  top: auto;
  z-index: 1;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
  padding: max(28px, env(safe-area-inset-top)) 0 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}
#trResultFooter {
  padding: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  width: 100%;
  box-sizing: border-box;
}


/* Dedicated BPM page */
#rhrPage {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9200;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
  box-sizing: border-box;
}
#rhrPage.active {
  display: flex !important;
  flex-direction: column;
}
#rhrPage::-webkit-scrollbar { display: none; }
#rhrPageInner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  position: relative;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: transparent;
  box-sizing: border-box;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  min-height: 0;
}
#rhrPageHeader {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: max(18px, env(safe-area-inset-top)) 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
}
#rhrPageScroll {
  padding: 0 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  box-sizing: border-box;
}
#rhrPageFooter {
  padding: 8px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  box-sizing: border-box;
}
.tr-result-badge {
  font-family: ui-monospace,monospace;
  font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; color: #444;
  text-align: center; margin-bottom: 4px;
}
.tr-result-score-section {
  display: flex; align-items: center;
  justify-content: center; gap: 16px;
}
.tr-result-number {
  font-family: -apple-system,sans-serif;
  font-size: 72px; font-weight: 800;
  color: #fff; line-height: 1;
  letter-spacing: -0.03em; flex-shrink: 0;
}
.tr-result-number span {
  font-size: 20px; color: #555; font-weight: 400;
}
.tr-result-label {
  background: linear-gradient(90deg,#818cf8,#c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase;
  flex-shrink: 0;
}
.tr-result-bar-container {
  width: 8px; height: 100px;
  background: #1a1a1a; border-radius: 6px;
  overflow: hidden; position: relative; flex-shrink: 0;
}
.tr-result-bar-fill {
  position: absolute; bottom: 0; width: 100%;
  border-radius: 6px; height: 0%;
  background: linear-gradient(to top,#3730a3 0%,#818cf8 60%,#e0e7ff 100%);
  box-shadow: 0 0 12px rgba(129,140,248,0.4);
  transition: height 1.2s cubic-bezier(0.34,1.56,0.64,1);
}
.tr-result-alert {
  background: transparent;
  border: none;
  border-top: 1px solid #111;
  padding: 20px 0 0;
}
.tr-result-alert-label {
  font-family: ui-monospace,monospace;
  font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase;
  background: linear-gradient(90deg,#818cf8,#c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 12px;
}
.tr-result-alert-text {
  font-family: -apple-system,sans-serif;
  font-size: 14px; color: #888; line-height: 1.8;
}
.tr-stats-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tr-stat-card {
  background: #111; border: 1px solid #1e1e1e;
  border-radius: 12px; padding: 12px 14px;
}
.tr-stat-label {
  font-family: ui-monospace,monospace;
  font-size: 8px; letter-spacing: .1em;
  text-transform: uppercase; color: #444; margin-bottom: 4px;
}
.tr-stat-value {
  font-family: ui-monospace,monospace;
  font-size: 18px; font-weight: 700;
  background: linear-gradient(90deg,#818cf8,#c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tr-stat-unit {
  font-size: 10px; color: #555; font-weight: 400;
}
/* ── NUOVI STILI KPI TRAINING ─── */
.tr-tab-row { display:flex; border-bottom:1px solid #1e1e2e; margin-bottom:20px; }
.tr-tab { background:none; border:none; border-bottom:2px solid transparent; padding:9px 18px; font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:#666; cursor:pointer; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif; transition:color .2s,border-color .2s; }
.tr-tab.active { color:#a5b4fc; border-bottom-color:#a5b4fc; }
.tr-sec-lbl { font-size:9px; letter-spacing:.12em; text-transform:uppercase; background:linear-gradient(90deg,#818cf8,#c084fc); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; margin:0 0 12px; font-weight:500; display:block; }
.tr-kpi-grid { display:grid; gap:0; width:100%; }
.tr-kpi-card { background:transparent; border:none; border-bottom:1px solid #111; padding:12px 14px; }
.tr-kpi-card:last-child { border-bottom:none; }
.tr-kpi-ttl { font-size:9px; letter-spacing:.08em; text-transform:uppercase; color:#444; margin-bottom:4px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif; }
.tr-kpi-val { font-size:22px; font-weight:600; color:#fff; line-height:1.1; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif; }
.tr-kpi-sub { font-size:9px; color:#333; margin-top:3px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif; }
.tr-dpill { display:inline-block; font-size:9px; font-weight:600; padding:2px 7px; border-radius:20px; letter-spacing:.04em; white-space:nowrap; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif; }
.tr-dpill.up { background:transparent; color:#a5b4fc; }
.tr-dpill.down { background:transparent; color:#555; }
.tr-dpill.neu { background:transparent; color:#333; }
.tr-score-bar-wrap { background:#111; border:none; border-radius:2px; height:2px; overflow:hidden; margin-top:10px; }
.tr-score-bar { height:2px; border-radius:2px; background:linear-gradient(90deg,#3730a3 0%,#818cf8 60%,#e0e7ff 100%); width:0%; transition:width .8s cubic-bezier(.34,1.56,.64,1); }

/* ── GOAL ALIGNMENT ── */
.ga-card {
  border:1px solid #1a1a2e;
  border-radius:16px;
  padding:18px 16px 16px;
  margin-bottom:24px;
  background:transparent;
  position:relative;
  overflow:hidden;
}
.ga-card::before {
  content:'';
  position:absolute;
  inset:0;
  border-radius:16px;
  padding:1px;
  background:linear-gradient(135deg,rgba(129,140,248,0.25),rgba(192,132,252,0.1),transparent 60%);
  -webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  -webkit-mask-composite:xor;
  mask-composite:exclude;
  pointer-events:none;
}
.ga-question {
  font-size:11px;
  color:#555;
  letter-spacing:.04em;
  line-height:1.5;
  margin-bottom:14px;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
  font-style:italic;
}
.ga-score-row {
  display:flex;
  align-items:baseline;
  gap:10px;
  margin-bottom:10px;
  width:100%;
}
.ga-score-val {
  font-size:38px;
  font-weight:700;
  line-height:1;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
  color:#fff;
  transition:color .3s;
}
.ga-score-val.ga-low {
  color:#fff;
}
.ga-score-val.ga-mid {
  color:#fff;
}
.ga-score-label {
  font-size:10px;
  font-weight:700;
  letter-spacing:.1em;
  text-transform:uppercase;
  font-family:ui-monospace,'SF Mono',monospace;
  padding:3px 9px;
  border-radius:20px;
  border:1px solid transparent;
  margin-left:auto;
  transition:background .3s, color .3s, border-color .3s;
}
.ga-score-label.ga-badge-low  { background:#1a1a1a; color:#f87171; border-color:#2a2020; }
.ga-score-label.ga-badge-mid  { background:#1a1a1a; color:#fbbf24; border-color:#2a2010; }
.ga-score-label.ga-badge-high { background:#1a1a1a; color:#4ade80; border-color:#202a20; }
.ga-bar-wrap {
  background:#111;
  border-radius:3px;
  height:3px;
  overflow:hidden;
  margin-bottom:16px;
}
.ga-bar {
  height:3px;
  border-radius:3px;
  background:linear-gradient(90deg,#facc15 0%,#f97316 60%,#ef4444 100%);
  width:0%;
  transition:width 1s cubic-bezier(.34,1.56,.64,1);
}
.ga-bar.ga-low { background:linear-gradient(90deg,#facc15 0%,#f97316 60%,#ef4444 100%); }
.ga-bar.ga-mid { background:linear-gradient(90deg,#facc15 0%,#f97316 60%,#ef4444 100%); }
.ga-detail-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0;
  margin-bottom:14px;
  border-top:1px solid #111;
}
.ga-detail-item {
  padding:10px 0;
  border-bottom:1px solid #111;
}
.ga-detail-item:nth-child(odd) { padding-right:10px; }
.ga-detail-item:nth-child(even) { padding-left:10px; border-left:1px solid #111; }
.ga-detail-lbl {
  font-size:8px;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:#aaa;
  font-family:ui-monospace,monospace;
  margin-bottom:4px;
}
.ga-detail-val {
  font-size:16px;
  font-weight:600;
  color:#fff;
  font-family:-apple-system,sans-serif;
  line-height:1;
}
.ga-detail-val.ga-good { color:#fff; }
.ga-detail-val.ga-warn { color:#fff; }
.ga-detail-val.ga-bad  { color:#fff; }
.ga-detail-weight {
  font-size:8px;
  color:#333;
  font-family:ui-monospace,monospace;
  margin-top:2px;
}
.ga-answer {
  font-size:12px;
  color:#cbd5e1;
  letter-spacing:.04em;
  line-height:1.6;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
  border-top:1px solid #1a1a2e;
  padding:14px 16px 0;
  width:100%;
  box-sizing:border-box;
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* ── DISPENDIO CARD (stessa struttura ga-card, palette blu) ── */
.disp-card {
  border:1px solid #1a1a2e;
  border-radius:16px;
  padding:18px 16px 16px;
  margin-bottom:24px;
  background:transparent;
  position:relative;
  overflow:hidden;
}
.disp-card::before {
  content:'';
  position:absolute;
  inset:0;
  border-radius:16px;
  padding:1px;
  background:linear-gradient(135deg,rgba(129,140,248,0.25),rgba(192,132,252,0.1),transparent 60%);
  -webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  -webkit-mask-composite:xor;
  mask-composite:exclude;
  pointer-events:none;
}
.disp-score-row {
  display:flex;
  align-items:baseline;
  gap:10px;
  margin-bottom:10px;
}
.disp-score-val {
  font-size:38px;
  font-weight:700;
  line-height:1;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
  color:#fff;
}
.disp-score-unit {
  font-size:14px;
  font-weight:400;
  color:#555;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
}
.disp-status-badge {
  margin-left:auto;
  font-size:9px;
  font-weight:700;
  letter-spacing:.12em;
  text-transform:uppercase;
  padding:3px 10px;
  border-radius:20px;
  font-family:ui-monospace,monospace;
  background:#1a1a2e;
  color:#555;
  border:1px solid #222;
}
.disp-status-badge.critico { background:#1a1a1a; color:#f87171; border-color:#2a2020; }
.disp-status-badge.buono   { background:#1a1a1a; color:#4ade80; border-color:#202a20; }
.disp-bar-wrap {
  background:#111;
  border-radius:3px;
  height:3px;
  overflow:hidden;
  margin-bottom:16px;
}
.disp-bar {
  height:3px;
  border-radius:3px;
  background:linear-gradient(90deg,#ffffff 0%,#a5b4fc 50%,#6b8cff 100%);
  width:0%;
  transition:width 1s cubic-bezier(.34,1.56,.64,1);
}
.disp-detail-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0;
  margin-bottom:14px;
  border-top:1px solid #111;
}
.disp-detail-item {
  padding:10px 0;
  border-bottom:1px solid #111;
}
.disp-detail-item:nth-child(odd)  { padding-right:10px; }
.disp-detail-item:nth-child(even) { padding-left:10px; border-left:1px solid #111; }
.disp-detail-lbl {
  font-size:8px;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:#aaa;
  font-family:ui-monospace,monospace;
  margin-bottom:4px;
}
.disp-detail-val {
  font-size:16px;
  font-weight:600;
  color:#fff;
  font-family:-apple-system,sans-serif;
  line-height:1;
}
.disp-detail-sub {
  font-size:8px;
  color:#888;
  font-family:ui-monospace,monospace;
  margin-top:2px;
}
.disp-answer {
  font-size:12px;
  color:#cbd5e1;
  letter-spacing:.04em;
  line-height:1.6;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
  border-top:1px solid #1a2a3e;
  padding:14px 16px 0;
  width:100%;
  box-sizing:border-box;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.coach-summary {
  margin:4px 0 24px;
  padding:0;
}
.coach-summary-label {
  font-size:10px;
  letter-spacing:.18em;
  text-transform:uppercase;
  font-family:ui-monospace,monospace;
  color:#8b5cf6;
  margin-bottom:10px;
}
.coach-summary-text {
  font-size:12px;
  color:#cbd5e1;
  letter-spacing:.04em;
  line-height:1.9;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
  width:100%;
  box-sizing:border-box;
  overflow-wrap:anywhere;
  word-break:break-word;
}
/* ── RHR CARD ── */
.rhr-card { border:1px solid #1a1a2e; border-radius:16px; padding:18px 16px 16px; margin-bottom:24px; background:transparent; position:relative; overflow:hidden; }
.rhr-card::before { content:''; position:absolute; inset:0; border-radius:16px; padding:1px; background:linear-gradient(135deg,rgba(248,113,113,0.25),rgba(251,146,60,0.1),transparent 60%); -webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0); -webkit-mask-composite:xor; mask-composite:exclude; pointer-events:none; }
.rhr-score-row { display:flex; align-items:baseline; gap:10px; margin-bottom:10px; }
.rhr-score-val { font-size:38px; font-weight:700; line-height:1; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif; color:#fff; }
.rhr-score-unit { font-size:14px; font-weight:400; color:#aaa; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif; }
.rhr-status-badge { margin-left:auto; font-size:9px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; padding:3px 10px; border-radius:20px; font-family:ui-monospace,monospace; background:#1a1a2e; color:#555; border:1px solid #222; }
.rhr-status-badge.critico { background:#1a1a1a; color:#f87171; border-color:#2a2020; }
.rhr-status-badge.normale { background:#1a1a1a; color:#fbbf24; border-color:#2a2010; }
.rhr-status-badge.ottimo  { background:#1a1a1a; color:#4ade80; border-color:#202a20; }
.rhr-bar-wrap { background:#111; border-radius:3px; height:3px; overflow:hidden; margin-bottom:16px; }
.rhr-bar { height:3px; border-radius:3px; background:linear-gradient(90deg,#4ade80 0%,#fbbf24 50%,#f87171 100%); width:0%; transition:width 1s cubic-bezier(.34,1.56,.64,1); }
.rhr-detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:0; margin-bottom:14px; border-top:1px solid #111; }
.rhr-detail-item { padding:10px 0; border-bottom:1px solid #111; }
.rhr-detail-item:nth-child(odd)  { padding-right:10px; }
.rhr-detail-item:nth-child(even) { padding-left:10px; border-left:1px solid #111; }
.rhr-detail-lbl { font-size:8px; letter-spacing:.1em; text-transform:uppercase; color:#aaa; font-family:ui-monospace,monospace; margin-bottom:4px; }
.rhr-detail-val { font-size:16px; font-weight:600; color:#fff; font-family:-apple-system,sans-serif; line-height:1; }
.rhr-detail-sub { font-size:8px; color:#888; font-family:ui-monospace,monospace; margin-top:2px; }
.rhr-answer { font-size:12px; color:#cbd5e1; letter-spacing:.04em; line-height:1.6; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif; border-top:1px solid #1a2a3e; padding:14px 16px 0; width:100%; box-sizing:border-box; overflow-wrap:anywhere; word-break:break-word; }
.rhr-measure-wrap { margin-bottom:16px; }
.rhr-cam-box { width:100%; aspect-ratio:1; max-width:180px; margin:0 auto 14px; border-radius:50%; overflow:hidden; border:3px solid #1a1a2e; position:relative; display:block; background:#000; }
.rhr-cam-box video { width:100%; height:100%; object-fit:cover; display:block; }
.rhr-cam-ring { position:absolute; inset:0; border-radius:50%; border:3px solid transparent; transition:border-color 0.3s; }
.rhr-cam-ring.active { border-color:#f87171; animation:rhrPulse 1s infinite; }
@keyframes rhrPulse { 0%,100%{border-color:rgba(248,113,113,0.3);}50%{border-color:rgba(248,113,113,1);} }
.rhr-waveform { width:100%; height:44px; display:block; margin-bottom:6px; }
.rhr-timer { font-size:11px; font-family:ui-monospace,monospace; color:#444; text-align:center; margin-bottom:12px; letter-spacing:.08em; }
.rhr-btn-row { display:flex; gap:8px; margin-bottom:10px; }
.rhr-btn { flex:1; padding:10px 0; border-radius:10px; border:none; font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; cursor:pointer; font-family:ui-monospace,monospace; transition:opacity 0.2s; }
.rhr-btn:disabled { opacity:0.35; cursor:default; }
.rhr-btn-start  { background:linear-gradient(135deg,#22c55e,#16a34a); color:#04130a; border:1px solid rgba(34,197,94,.28); box-shadow:0 10px 24px rgba(34,197,94,.22), inset 0 1px 0 rgba(255,255,255,.18); }
.rhr-btn-stop   { background:#1a1a2e; color:#f87171; border:1px solid #2a2020; }
.rhr-btn-manual { background:#1a1a2e; color:#818cf8; border:1px solid #1a1a3e; width:100%; margin-bottom:0; }
.rhr-manual-row { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.rhr-manual-input { flex:1; background:#111; border:1px solid #222; border-radius:8px; color:#fff; font-size:20px; font-weight:600; padding:10px 12px; font-family:-apple-system,sans-serif; text-align:center; -webkit-appearance:none; }
.rhr-manual-input:focus { outline:none; border-color:#818cf8; }
.rhr-manual-confirm { padding:10px 18px; border-radius:8px; border:none; background:linear-gradient(135deg,#818cf8,#c084fc); color:#000; font-size:11px; font-weight:700; letter-spacing:.08em; cursor:pointer; font-family:ui-monospace,monospace; white-space:nowrap; }
.rhr-signal-quality { font-size:9px; font-family:ui-monospace,monospace; color:#333; text-align:center; letter-spacing:.08em; margin-bottom:4px; min-height:14px; transition:color 0.4s; }
.rhr-debug { font-size:9px; font-family:ui-monospace,monospace; color:#333; text-align:center; letter-spacing:.06em; margin-bottom:8px; line-height:1.8; background:#0a0a0a; border-radius:6px; padding:6px 8px; }
.rhr-action-row { display:flex; gap:8px; margin-top:10px; }
.rhr-remeasure { flex:1; padding:8px 0; border-radius:8px; border:1px solid #1a1a3e; background:transparent; color:#818cf8; font-size:10px; font-weight:700; letter-spacing:.08em; cursor:pointer; font-family:ui-monospace,monospace; }
.rhr-confirm   { flex:1; padding:8px 0; border-radius:8px; border:none; background:linear-gradient(135deg,#818cf8,#c084fc); color:#000; font-size:10px; font-weight:700; letter-spacing:.08em; cursor:pointer; font-family:ui-monospace,monospace; }
.rhr-confirm-ok { font-size:9px; font-family:ui-monospace,monospace; color:#4ade80; text-align:center; letter-spacing:.08em; margin-top:6px; min-height:12px; }
.rhr-new-btn { width:100%; margin-top:14px; padding:10px 0; border-radius:8px; border:1px solid #1a1a3e; background:transparent; color:#818cf8; font-size:10px; font-weight:700; letter-spacing:.1em; cursor:pointer; font-family:ui-monospace,monospace; text-transform:uppercase; display:none; }
/* ── PROFILE TOAST ── */
#profileToast {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%) translateY(120%);
  width: 100%; max-width: 540px;
  background: #111;
  border-top: 1px solid rgba(129,140,248,0.25);
  border-radius: 20px 20px 0 0;
  padding: 18px 22px max(28px, env(safe-area-inset-bottom));
  z-index: 9100;
  transition: transform 0.38s cubic-bezier(0.34,1.2,0.64,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.8);
  box-sizing: border-box;
}
#profileToast.visible { transform: translateX(-50%) translateY(0); }
.profile-toast-label {
  font-family: ui-monospace,'SF Mono',monospace;
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  background: linear-gradient(90deg,#818cf8,#c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 8px; display: block;
}
.profile-toast-text {
  font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
  font-size: 13px; color: #666; line-height: 1.7;
}
.profile-toast-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; color: #333; font-size: 20px;
  cursor: pointer; padding: 4px; line-height: 1;
}
/* ── TREND HINT TOAST ── */
#trendHintToast {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%) translateY(120%);
  width: 100%; max-width: 540px;
  background: #111;
  border-top: 1px solid rgba(129,140,248,0.25);
  border-radius: 20px 20px 0 0;
  padding: 18px 22px max(28px, env(safe-area-inset-bottom));
  z-index: 9100;
  transition: transform 0.38s cubic-bezier(0.34,1.2,0.64,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.8);
  box-sizing: border-box;
}
#trendHintToast.visible { transform: translateX(-50%) translateY(0); }
.trend-hint-label {
  font-family: ui-monospace,'SF Mono',monospace;
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  background: linear-gradient(90deg,#818cf8,#c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 8px; display: block;
}
.trend-hint-text {
  font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
  font-size: 13px; color: #666; line-height: 1.7;
}
.trend-hint-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; color: #333; font-size: 20px;
  cursor: pointer; padding: 4px; line-height: 1;
}

/* ── BOTTOM TAB BAR ── */
#bottomTabBar {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  flex-shrink: 0;
  position: fixed;
  bottom: calc(8px + env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  max-width: calc(780px - 24px);
  margin: 0 auto;
  z-index: 120;
  border-radius: 24px;
  overflow: hidden;
}
.tab-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  padding: 10px 4px 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: #444;
  transition: color .18s ease, transform .22s ease, filter .22s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  isolation: isolate;
}
.tab-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  transform: translate(-50%, -56%) scale(0.78);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(129,140,248,.26) 0%, rgba(192,132,252,.18) 42%, rgba(79,70,229,0) 75%);
  opacity: 0;
  filter: blur(8px);
  transition: opacity .24s ease, transform .24s ease;
  pointer-events: none;
  z-index: -1;
}
.tab-btn.active {
  color: #818cf8;
  filter: drop-shadow(0 0 8px rgba(129,140,248,.18));
}
.tab-btn.active::after {
  opacity: 1;
  transform: translate(-50%, -56%) scale(1);
}
.tab-btn.tap-anim {
  animation: metrixTabTap .44s cubic-bezier(.22,.9,.3,1.25);
}
.tab-btn.tap-anim::after {
  opacity: 1;
  transform: translate(-50%, -56%) scale(1.16);
}
@keyframes metrixTabTap {
  0% { transform: scale(1); }
  30% { transform: scale(.93); }
  68% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.tab-btn svg {
  width: 22px; height: 22px;
  stroke: currentColor; fill: none;
  stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.tab-btn span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

/* ── RHR SIGNAL PROGRESS BAR ── */
#rhrSignalProgress {
  width: 100%;
  height: 4px;
  background: #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
  transition: opacity .3s;
}
#rhrSignalProgressFill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width .5s ease, background-color .5s ease;
  background: #333;
}

/* ── RHR CELEBRATION FLASH ── */
@keyframes rhrCelebrate {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes bpmPop {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}
#rhrCelebrateOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: radial-gradient(circle, rgba(52,199,89,0.25) 0%, transparent 70%);
  animation: rhrCelebrate 1.2s ease forwards;
}
.rhr-val-wrap.celebrate #rhrVal {
  animation: bpmPop 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
}

.ux-section-card {
  padding: 18px;
  border: 1px solid #171729;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(14,14,20,0.98), rgba(8,8,12,0.98));
  box-shadow: 0 18px 50px rgba(0,0,0,0.22);
  margin-bottom: 18px;
}
.ux-section-head { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin-bottom:16px; }
.ux-kicker {
  font-family: ui-monospace,monospace; font-size:10px; text-transform:uppercase; letter-spacing:.14em;
  color:#8b5cf6; margin-bottom:6px;
}
.ux-title { font-size:22px; font-weight:700; color:#fff; line-height:1.1; margin-bottom:6px; }
.ux-copy { font-size:13px; color:#8a8aa0; line-height:1.55; max-width:440px; }
.ux-progress { min-width:90px; text-align:right; }
.ux-progress span { display:block; font-size:10px; letter-spacing:.12em; text-transform:uppercase; color:#818cf8; margin-bottom:8px; font-family: ui-monospace,monospace; }
.ux-progressbar { height:7px; border-radius:999px; background:rgba(255,255,255,0.08); overflow:hidden; }
.ux-progressbar i { display:block; height:100%; border-radius:999px; background:linear-gradient(90deg,#818cf8,#c084fc); }
.ux-stat-row { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:12px 0 18px; }
.ux-stat-chip {
  border:1px solid #26263a; background:#0d0d14; border-radius:18px; padding:14px 16px;
}
.ux-stat-chip-label { font-size:11px; text-transform:uppercase; letter-spacing:.12em; color:#9ca3af; font-family:ui-monospace,monospace; margin-bottom:8px; }
.ux-stat-chip strong { font-size:24px; color:#fff; display:block; line-height:1; }
.ux-stat-chip small { display:block; margin-top:6px; color:#8a8aa0; font-size:12px; line-height:1.4; }
 .ux-goal-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
.ux-goal-card {
  border:1px solid #26263a; background:#0d0d14; border-radius:18px; padding:14px; cursor:pointer;
  color:#c8c8d9; transition:all .18s ease; min-height:92px; display:flex; flex-direction:column; gap:8px; justify-content:center;
}
.ux-goal-card.active {
  border-color:#818cf8; background:rgba(129,140,248,0.12); box-shadow:0 0 0 1px rgba(129,140,248,0.18), 0 14px 30px rgba(99,102,241,0.12); color:#fff;
}
.ux-goal-icon { font-size:20px; line-height:1; }
.ux-goal-title { font-size:15px; font-weight:600; }
.ux-goal-copy { font-size:12px; color:#8a8aa0; line-height:1.45; }
.ux-helper-box {
  border:1px solid rgba(129,140,248,0.18); background:rgba(129,140,248,0.08); border-radius:18px; padding:12px 14px; margin-bottom:16px;
  font-size:13px; color:#d8d8e6; line-height:1.5;
}
.ux-hidden-select { display:none; }
.ux-field-note { font-size:12px; color:#7d7d92; line-height:1.5; margin:-4px 0 12px; }
@media (max-width: 640px) {
  .ux-section-head { flex-direction:column; }
  .ux-progress { min-width:0; width:100%; text-align:left; }
  .ux-stat-row, .ux-goal-grid { grid-template-columns:1fr; }
}


/* ── PROFILE STEPPED CARD FLOW (layout gestito da style#metrix-final-profile-fix) ── */
.profile-flow-head{ justify-content:flex-end; 
  display:flex; align-items:flex-start; justify-content:space-between; gap:16px;
  margin-bottom:18px;
}
.profile-flow-brand{
  display:flex; align-items:center; gap:14px;
}
.profile-flow-brand img{ width:52px; height:52px; object-fit:contain; }
.profile-flow-copy strong{
  display:block; font-size:18px; font-weight:800; letter-spacing:.04em; color:#fff;
}
.profile-flow-copy span{
  display:block; margin-top:4px; font-size:12px; color:#98a2b3; line-height:1.55;
}
.profile-flow-progress{
  min-width:124px;
}
.profile-flow-progress small{
  display:block; text-align:right; font-size:11px; color:#9ca3af; letter-spacing:.14em; text-transform:uppercase; margin-bottom:8px;
}
.profile-flow-progressbar{
  width:100%; height:8px; border-radius:999px; background:rgba(255,255,255,.06); overflow:hidden;
}
.profile-flow-progressbar i{
  display:block; height:100%; width:25%;
  background:linear-gradient(90deg,#818cf8,#c084fc);
  border-radius:999px; transition:width .22s ease;
}
.profile-step-card{
  display:none;
  border:1px solid rgba(129,140,248,.14);
  border-radius:24px;
  background:linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
  padding:18px;
  margin-bottom:14px;
}
.profile-step-card.active{ display:block; animation:profileFade .22s ease; }
@keyframes profileFade{
  from{ opacity:0; transform:translateY(10px); }
  to{ opacity:1; transform:translateY(0); }
}
.profile-step-kicker{
  font-size:11px; color:#9ca3af; text-transform:uppercase; letter-spacing:.16em; margin-bottom:8px;
}
.profile-step-title{
  font-size:24px; font-weight:800; color:#fff; letter-spacing:.01em; line-height:1.1; margin-bottom:8px;
}
.profile-step-subtitle{
  font-size:13px; color:#b8bfd0; line-height:1.65; margin-bottom:18px;
}
.profile-slider-block{ margin-bottom:18px; }
.profile-slider-label{
  display:flex; align-items:end; justify-content:space-between; gap:12px; margin-bottom:10px;
}
.profile-slider-label label{
  font-size:13px; color:#d9ddea; font-weight:700; letter-spacing:.02em;
}
.profile-slider-value{
  display:flex; align-items:baseline; gap:6px; color:#fff;
}
.profile-slider-value span{ font-size:34px; font-weight:800; line-height:1; }
.profile-slider-value small{ font-size:12px; color:#9ca3af; text-transform:uppercase; letter-spacing:.14em; }
.profile-slider{
  width:100%; appearance:none; -webkit-appearance:none; height:9px; border-radius:999px;
  background:linear-gradient(90deg, rgba(129,140,248,.28), rgba(192,132,252,.28));
  outline:none;
}
.profile-slider::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none; width:24px; height:24px; border-radius:50%;
  background:linear-gradient(135deg,#818cf8,#c084fc); border:2px solid #fff;
  box-shadow:0 8px 22px rgba(129,140,248,.35);
}
.profile-slider::-moz-range-thumb{
  width:24px; height:24px; border-radius:50%;
  background:linear-gradient(135deg,#818cf8,#c084fc); border:2px solid #fff;
}
.profile-slider-scale{
  display:flex; justify-content:space-between; margin-top:8px;
  color:#60687a; font-size:11px; letter-spacing:.08em;
}
.profile-bmi-card{
  border:1px solid rgba(129,140,248,.22);
  background:rgba(129,140,248,.08);
  border-radius:18px; padding:14px 16px; margin-bottom:18px;
}
.profile-bmi-top{
  display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:6px;
}
.profile-bmi-top strong{ font-size:24px; color:#fff; }
.profile-bmi-label{ font-size:11px; color:#9ca3af; text-transform:uppercase; letter-spacing:.14em; }
.profile-bmi-bottom{ color:#dbe0ee; font-size:13px; line-height:1.5; }
.profile-sex-grid,
.profile-goal-grid,
.profile-choice-grid{
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-bottom:16px;
}
.profile-sex-card,
.profile-goal-card,
.profile-choice-card{
  border:1px solid #26263a; background:#0e0e16; border-radius:18px; padding:16px 14px;
  color:#c8c8d9; cursor:pointer; transition:all .18s ease;
}
.profile-sex-card.active,
.profile-goal-card.active,
.profile-choice-card.active{
  border-color:#818cf8; background:rgba(129,140,248,.12);
  box-shadow:0 0 0 1px rgba(129,140,248,.14), 0 16px 34px rgba(99,102,241,.12);
  color:#fff;
}
.profile-sex-card{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px;
}
.profile-sex-card.profile-goal-card{
  display:block;
  text-align:left;
}
.profile-sex-card.profile-goal-card .profile-goal-head{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
}
.profile-sex-card.profile-goal-card span{
  display:block;
  font-size:12px;
  line-height:1.55;
  color:#9da6ba;
  letter-spacing:.01em;
}
.profile-sex-card.profile-goal-card.active span{
  color:#dbe0ee;
}
.profile-sex-icon{ font-size:24px; }
.profile-sex-text{ font-size:14px; font-weight:700; }
.profile-goal-card strong,
.profile-choice-card strong{
  display:block; font-size:14px; margin-bottom:6px;
}
.profile-goal-head{ display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.profile-goal-head strong{ margin-bottom:0; }
.profile-goal-icon{
  width:18px; height:18px; flex-shrink:0;
  stroke:currentColor; fill:none; stroke-width:1.4;
  stroke-linecap:round; stroke-linejoin:round;
  opacity:.96;
}
.profile-goal-card span,
.profile-choice-card span{
  display:block; font-size:12px; line-height:1.5; color:#9da6ba;
}
.profile-goal-card.active span,
.profile-choice-card.active span{ color:#dbe0ee; }
.profile-inline-grid{
  display:grid; grid-template-columns:1fr 1fr; gap:12px;
}
.profile-stat-row{
  display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:16px;
}
.profile-stat-chip{
  border:1px solid rgba(255,255,255,.08); border-radius:18px; background:#0d0d14; padding:14px;
}
.profile-stat-chip-label{ font-size:11px; color:#818a9d; text-transform:uppercase; letter-spacing:.14em; margin-bottom:10px; }
.profile-stat-chip strong{ display:block; font-size:28px; color:#fff; margin-bottom:6px; }
.profile-stat-chip small{ display:block; font-size:12px; line-height:1.55; color:#97a0b3; }
.profile-helper-box{
  border:1px dashed rgba(129,140,248,.24); background:rgba(129,140,248,.06);
  color:#d1d8ea; font-size:12px; line-height:1.65; border-radius:16px; padding:12px 14px; margin-bottom:16px;
}
.profile-input, .profile-select{
  width:100%; box-sizing:border-box; border-radius:16px; border:1px solid #26263a;
  background:#0d0d14; color:#fff; padding:14px 15px; font-size:14px; outline:none;
}
.profile-input::placeholder{ color:#596277; }
.profile-input:focus, .profile-select:focus{
  border-color:#818cf8; box-shadow:0 0 0 2px rgba(129,140,248,.12);
}
.profile-info-card{
  margin: 14px 0 18px;
  border: 1px solid rgba(129,140,248,.20);
  border-radius: 20px;
  padding: 16px 16px 14px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(79,70,229,.18), transparent 45%),
    radial-gradient(120% 120% at 100% 0%, rgba(192,132,252,.16), transparent 46%),
    linear-gradient(180deg, rgba(14,14,20,.96), rgba(8,8,12,.96));
  box-shadow: 0 18px 40px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.04);
}
.profile-info-kicker{
  display:block;
  margin-bottom:8px;
  font-size:10px;
  font-family:ui-monospace,'SF Mono',monospace;
  letter-spacing:.14em;
  text-transform:uppercase;
  background:linear-gradient(90deg,#818cf8,#c084fc);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}
.profile-info-title{
  margin:0 0 8px;
  color:#fff;
  font-size:18px;
  font-weight:700;
  letter-spacing:.01em;
}
.profile-info-text{
  margin:0;
  color:#cbd5e1;
  font-size:13px;
  line-height:1.75;
}
.profile-info-copy{
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid rgba(255,255,255,.06);
  color:#8f99ad;
  font-size:11px;
  letter-spacing:.04em;
}
.profile-footer-back{ max-width:160px; opacity:.6; }
.profile-hidden{ display:none !important; }
@media (max-width:640px){
  #onboardingOverlay{ padding:14px; }
  #onboardingModalBody{ padding:18px 16px 6px; }
  #onboardingModalFooter{ padding:14px 16px 18px; flex-direction:column-reverse; }
  .profile-flow-head{ justify-content:flex-end;  flex-direction:column; }
  .profile-flow-progress{ width:100%; }
  .profile-flow-progress small{ text-align:left; }
  .profile-sex-grid, .profile-goal-grid, .profile-choice-grid, .profile-inline-grid, .profile-stat-row{
    grid-template-columns:1fr;
  }
}


/* blocchi ridondanti rimossi — vedi style#metrix-final-profile-fix */
.profile-info-card, .profile-step-card { position: relative; z-index: 1; }


/* Override finale card sesso: allineamento come le goal card */
.profile-sex-grid{
  display:grid !important;
  grid-template-columns:1fr 1fr !important;
  gap:12px !important;
  align-items:stretch !important;
}

.profile-sex-card.profile-goal-card{
  min-height:118px !important;
  padding:16px 16px 14px !important;
  border-radius:22px !important;
  border:1px solid rgba(121,91,255,.20) !important;
  background:linear-gradient(180deg, rgba(255,255,255,.022), rgba(255,255,255,.014)) !important;
  color:#f5f7ff !important;
  display:flex !important;
  flex-direction:column !important;
  align-items:flex-start !important;
  justify-content:flex-start !important;
  text-align:left !important;
  gap:0 !important;
}

.profile-sex-card.profile-goal-card .profile-goal-head{
  display:flex !important;
  align-items:center !important;
  gap:10px !important;
  margin-bottom:10px !important;
}

.profile-sex-card.profile-goal-card .profile-goal-head strong{
  display:block !important;
  margin:0 !important;
  font-size:13px !important;
  line-height:1.2 !important;
  letter-spacing:.01em !important;
}

.profile-sex-card.profile-goal-card .profile-goal-icon{
  width:17px !important;
  height:17px !important;
  flex:0 0 17px !important;
  display:block !important;
  stroke:currentColor !important;
  fill:none !important;
  stroke-width:1.6 !important;
  stroke-linecap:round !important;
  stroke-linejoin:round !important;
  opacity:.96 !important;
}

.profile-sex-card.profile-goal-card > span{
  display:block !important;
  margin:0 !important;
  font-size:12px !important;
  line-height:1.55 !important;
  letter-spacing:.01em !important;
  color:#9da6ba !important;
}

.profile-sex-card.profile-goal-card.active > span{
  color:#dbe0ee !important;
}

.profile-sex-card.profile-goal-card.active{
  border-color:#7b6dff !important;
  box-shadow:0 0 0 1px rgba(123,109,255,.34), 0 14px 30px rgba(67,41,165,.16) !important;
  background:linear-gradient(180deg, rgba(125,115,255,.12), rgba(255,255,255,.035)) !important;
}


/* Uniforma le card "Calcolali per me" / "Li inserisco io" */
.profile-nutrition-mode-grid{
  display:grid !important;
  grid-template-columns:1fr 1fr !important;
  gap:12px !important;
  align-items:stretch !important;
}

.profile-nutrition-mode-card,
.profile-macro-mode-card,
.profile-macro-choice-card,
.macro-choice-card,
.macro-mode-card{
  align-items:flex-start !important;
  justify-content:flex-start !important;
  text-align:left !important;
}

.profile-nutrition-mode-card .profile-goal-head,
.profile-macro-mode-card .profile-goal-head,
.profile-macro-choice-card .profile-goal-head,
.macro-choice-card .profile-goal-head,
.macro-mode-card .profile-goal-head,
.profile-nutrition-mode-card .goal-head,
.profile-macro-mode-card .goal-head,
.profile-macro-choice-card .goal-head,
.macro-choice-card .goal-head,
.macro-mode-card .goal-head{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:10px !important;
  margin-bottom:10px !important;
}

.profile-nutrition-mode-card svg,
.profile-macro-mode-card svg,
.profile-macro-choice-card svg,
.macro-choice-card svg,
.macro-mode-card svg{
  width:18px !important;
  height:18px !important;
  flex:0 0 18px !important;
  display:block !important;
  vertical-align:middle !important;
  margin:0 !important;
}

.profile-nutrition-mode-card strong,
.profile-macro-mode-card strong,
.profile-macro-choice-card strong,
.macro-choice-card strong,
.macro-mode-card strong,
.profile-nutrition-mode-card .title,
.profile-macro-mode-card .title,
.profile-macro-choice-card .title,
.macro-choice-card .title,
.macro-mode-card .title{
  display:block !important;
  margin:0 !important;
  line-height:1.2 !important;
}

.profile-nutrition-mode-card p,
.profile-macro-mode-card p,
.profile-macro-choice-card p,
.macro-choice-card p,
.macro-mode-card p,
.profile-nutrition-mode-card span,
.profile-macro-mode-card span,
.profile-macro-choice-card span,
.macro-choice-card span,
.macro-mode-card span{
  margin:0 !important;
}


/* Fix definitivo card macro-mode: icona e testo separati correttamente */
.profile-choice-card .profile-choice-title{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:10px !important;
  margin:0 0 10px !important;
  line-height:1.2 !important;
}

.profile-choice-card .profile-choice-title .profile-goal-icon{
  width:18px !important;
  height:18px !important;
  flex:0 0 18px !important;
  display:block !important;
  margin:0 !important;
}

.profile-choice-card .profile-choice-title span{
  display:block !important;
  margin:0 !important;
}

.profile-choice-card > span{
  display:block !important;
  margin:0 !important;
}


/* MINDFULL — modulo separato nella tab BPM */
 .mindfull-launcher-wrap{margin-top:14px;margin-bottom:2px;display:flex;justify-content:stretch;}
.mindfull-launcher{width:100%;height:56px;border:none;border-radius:18px;background:linear-gradient(90deg,#8f8bff 0%,#8a88f6 55%,#8578ee 100%);color:#111827;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 16px 34px rgba(99,102,241,0.22), inset 0 1px 0 rgba(255,255,255,0.28);transition:transform .18s ease, box-shadow .18s ease, opacity .18s ease;-webkit-tap-highlight-color:transparent;font-size:13px;font-weight:800;letter-spacing:.18em;text-transform:uppercase;}
.mindfull-launcher:hover{transform:translateY(-1px);box-shadow:0 18px 38px rgba(99,102,241,0.28), inset 0 1px 0 rgba(255,255,255,0.34);}
.mindfull-launcher:active{transform:scale(.985);}
.mindfull-card{margin-top:14px;padding:16px 14px;border-radius:22px;background:linear-gradient(180deg,rgba(129,140,248,0.08),rgba(15,23,42,0.02));border:1px solid rgba(129,140,248,0.12);box-shadow:0 14px 32px rgba(15,23,42,0.06);}
.mindfull-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px;}
.mindfull-title-wrap{display:flex;flex-direction:column;gap:4px;}
.mindfull-kicker{font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:#818cf8;font-weight:700;}
.mindfull-title{font-size:16px;font-weight:700;color:#111827;line-height:1.2;}
.mindfull-sub{font-size:12px;color:#6b7280;line-height:1.5;}
.mindfull-chip{padding:7px 10px;border-radius:999px;background:rgba(129,140,248,0.1);color:#4f46e5;font-size:11px;font-weight:700;white-space:nowrap;}
.mindfull-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:12px 0;}
.mindfull-stat{padding:12px 10px;border-radius:18px;background:#fff;border:1px solid rgba(129,140,248,0.08);text-align:center;}
.mindfull-stat-val{font-size:20px;font-weight:800;color:#111827;line-height:1;}
.mindfull-stat-lbl{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:#94a3b8;margin-top:6px;}
.mindfull-cta{display:flex;flex-direction:column;gap:10px;margin-top:10px;}
.mindfull-btn{width:100%;height:56px;border:none;border-radius:18px;padding:14px 16px;background:linear-gradient(90deg,#8f8bff 0%,#8a88f6 55%,#8578ee 100%);color:#111827;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 16px 34px rgba(99,102,241,0.22), inset 0 1px 0 rgba(255,255,255,0.28);transition:transform .18s ease,box-shadow .18s ease,opacity .18s ease;-webkit-tap-highlight-color:transparent;font-size:13px;font-weight:800;letter-spacing:.18em;text-transform:uppercase;}
.mindfull-btn:disabled{opacity:.42;cursor:not-allowed;transform:none;}
.mindfull-note,.mindfull-prompt,.mindfull-result{font-size:12px;line-height:1.6;color:#475569;}
.mindfull-prompt{display:none;padding:12px 14px;border-radius:16px;background:rgba(129,140,248,0.08);border:1px solid rgba(129,140,248,0.12);color:#4338ca;}
.mindfull-result{display:none;margin-top:12px;padding:14px;border-radius:18px;background:#fff;border:1px solid rgba(129,140,248,0.1);}
.mindfull-result-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:10px;}
.mindfull-result-item{text-align:center;}
.mindfull-result-val{font-size:20px;font-weight:800;color:#111827;}
.mindfull-result-lbl{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:#94a3b8;margin-top:4px;}
.mindfull-badge{display:inline-flex;align-items:center;gap:6px;padding:7px 10px;border-radius:999px;background:rgba(74,222,128,0.14);color:#15803d;font-size:11px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;}
.mindfull-history-card{margin-top:16px;padding:16px 14px;border-radius:22px;background:linear-gradient(180deg,rgba(129,140,248,0.08),rgba(15,23,42,0.02));border:1px solid rgba(129,140,248,0.12);}
.mindfull-history-list{display:flex;flex-direction:column;gap:10px;margin-top:12px;}
.mindfull-history-item{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;border-radius:16px;background:#fff;border:1px solid rgba(129,140,248,0.08);}
.mindfull-history-main{display:flex;flex-direction:column;gap:4px;min-width:0;}
.mindfull-history-time{font-size:12px;font-weight:700;color:#111827;}
.mindfull-history-sub{font-size:11px;color:#64748b;}
.mindfull-history-delta{font-size:18px;font-weight:800;color:#111827;white-space:nowrap;}
.mindfull-empty{font-size:12px;line-height:1.6;color:#64748b;padding:12px 0;}
#mindfullOverlay{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:rgba(15,23,42,0.66);backdrop-filter:blur(12px);z-index:9999;padding:22px;}
#mindfullOverlay.active{display:flex;}
.mindfull-overlay-card{width:min(100%,420px);padding:26px 20px 22px;border-radius:28px;background:linear-gradient(180deg,#0f172a 0%,#1e293b 100%);border:1px solid rgba(129,140,248,0.18);box-shadow:0 24px 60px rgba(15,23,42,0.38);text-align:center;}
.mindfull-breath-circle-wrap{display:flex;justify-content:center;align-items:center;padding:6px 0 14px;}
.mindfull-breath-circle{width:136px;height:136px;border-radius:50%;background:radial-gradient(circle at 30% 30%,rgba(165,180,252,0.95),rgba(99,102,241,0.72));box-shadow:0 0 0 14px rgba(129,140,248,0.08),0 14px 40px rgba(99,102,241,0.22);transform:scale(.82);transition:transform .3s linear;display:flex;align-items:center;justify-content:center;color:#fff;font-size:16px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;}
.mindfull-overlay-phase{display:none;}
.mindfull-overlay-timer{font-size:34px;font-weight:900;color:#f8fafc;line-height:1;margin-top:14px;}
.mindfull-overlay-close{margin-top:18px;border:none;background:transparent;color:#cbd5e1;font-size:12px;font-weight:700;cursor:pointer;}

/* STYLE BLOCK 2 */
/* hide any previous footer */
.app-footer, .footer, .bottom-bar, .footer-bar, .disclaimer-bar {
  display:none !important;
}

/* new clean footer */
.metrix-footer {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 720px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(15,15,20,0.85);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.metrix-footer-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.metrix-footer-tagline {
  font-size: 11px;
  color: #fff;
  opacity: 0.9;
  font-style: italic;
}
.metrix-footer-copy {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
}
.metrix-footer-info {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #a5b4fc;
  background: rgba(255,255,255,0.04);
}

/* STYLE BLOCK 3 */
.disclaimer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.42);
  letter-spacing: 0.5px;
  z-index: 121;
  pointer-events: none;
  white-space: nowrap;
}
body {
  padding-bottom: 90px;
}

/* STYLE BLOCK 4 */
@keyframes _siSlideUp {
  from { opacity:0; transform:translateY(32px) scale(.94); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

/* STYLE BLOCK 5 */
.profile-step-card {
  padding: 18px;
  border: 1px solid #171729;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(17,17,26,0.94), rgba(8,8,12,0.98));
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
  margin-bottom: 18px;
}
.profile-step-header { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin-bottom:18px; }
.profile-step-kicker {
  font-family: ui-monospace,monospace; font-size:10px; text-transform:uppercase; letter-spacing:.14em;
  color:#8b5cf6; margin-bottom:6px;
}
.profile-step-title { font-size:24px; font-weight:700; color:#fff; line-height:1.1; margin-bottom:6px; }
.profile-step-copy { font-size:13px; color:#8a8aa0; line-height:1.5; max-width:340px; }
.profile-step-progress { min-width:86px; text-align:right; }
.profile-step-progress span {
  display:block; font-size:10px; letter-spacing:.12em; text-transform:uppercase; color:#818cf8; margin-bottom:8px;
  font-family: ui-monospace,monospace;
}
.profile-step-progressbar {
  height:7px; border-radius:999px; background:rgba(255,255,255,0.08); overflow:hidden;
}
.profile-step-progressbar i {
  display:block; width:25%; height:100%; border-radius:999px;
  background:linear-gradient(90deg,#818cf8,#c084fc);
}
.profile-slider-group { margin-bottom:18px; }
.profile-label-wide { font-size:13px; margin-bottom:10px; color:#d3d3df; }
.profile-slider-value {
  display:flex; align-items:flex-end; gap:6px; margin-bottom:10px;
  font-family:-apple-system,sans-serif;
}
.profile-slider-value span { font-size:32px; line-height:1; color:#fff; font-weight:700; }
.profile-slider-value small {
  font-size:13px; color:#7c7c90; text-transform:uppercase; letter-spacing:.08em; padding-bottom:4px;
}
.profile-slider-value-small span { font-size:28px; }
.profile-slider {
  width:100%; appearance:none; -webkit-appearance:none; height:8px; border-radius:999px;
  background:linear-gradient(90deg,rgba(129,140,248,0.32),rgba(192,132,252,0.32)); outline:none;
}
.profile-slider::-webkit-slider-thumb {
  -webkit-appearance:none; appearance:none; width:24px; height:24px; border-radius:50%;
  background:linear-gradient(135deg,#818cf8,#c084fc); border:2px solid #fff; box-shadow:0 6px 18px rgba(129,140,248,0.4);
}
.profile-slider::-moz-range-thumb {
  width:24px; height:24px; border-radius:50%; background:linear-gradient(135deg,#818cf8,#c084fc);
  border:2px solid #fff; box-shadow:0 6px 18px rgba(129,140,248,0.4);
}
.profile-slider-scale {
  display:flex; justify-content:space-between; margin-top:8px; font-size:11px; color:#606078; font-family:ui-monospace,monospace;
}
.profile-bmi-card {
  border:1px solid rgba(129,140,248,0.22); background:rgba(129,140,248,0.08); border-radius:18px;
  padding:14px 16px; margin-bottom:18px;
}
.profile-bmi-top { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:6px; }
.profile-bmi-label { font-size:11px; text-transform:uppercase; letter-spacing:.12em; color:#9ca3af; font-family:ui-monospace,monospace; }
.profile-bmi-top strong { font-size:22px; color:#fff; }
.profile-bmi-bottom { font-size:13px; color:#d8d8e6; line-height:1.45; }
.profile-inline-grid { display:grid; grid-template-columns:1fr; gap:12px; margin-bottom:18px; }
.profile-sex-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.profile-sex-card {
  border:1px solid #26263a; background:#0d0d14; border-radius:18px; padding:16px 14px; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; gap:6px; color:#c8c8d9; transition:all .18s ease;
}
.profile-sex-card.active {
  border-color:#818cf8; background:rgba(129,140,248,0.12); box-shadow:0 0 0 1px rgba(129,140,248,0.18), 0 14px 30px rgba(99,102,241,0.12);
  color:#fff;
}
.profile-sex-icon { font-size:22px; line-height:1; }
.profile-sex-text { font-size:14px; font-weight:600; }
@media (max-width: 640px) {
  .profile-step-header { flex-direction:column; }
  .profile-step-progress { min-width:0; width:100%; text-align:left; }
}

/* STYLE BLOCK 6 id=premium-v2-overrides */
:root {
  --mx-surface: rgba(255,255,255,.045);
  --mx-surface-2: rgba(255,255,255,.065);
  --mx-border: rgba(255,255,255,.075);
  --mx-shadow: 0 18px 48px rgba(0,0,0,.34);
}
html, body {
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(129,140,248,.12), transparent 48%),
    radial-gradient(900px 400px at 50% 120%, rgba(192,132,252,.08), transparent 40%),
    #000;
}
body.premium-v2 .app {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.018), rgba(255,255,255,0) 18%),
    linear-gradient(180deg, rgba(8,8,12,.94), rgba(0,0,0,1));
}
body.premium-v2 .app::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(640px 220px at 50% 0%, rgba(129,140,248,.10), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,.04), transparent 16%);
  opacity: .9;
}
body.premium-v2 .header,
body.premium-v2 #trResultHeader {
  background: linear-gradient(180deg, rgba(8,8,12,.95), rgba(8,8,12,.85));
}
body.premium-v2 .header { padding-top: calc(16px + env(safe-area-inset-top)); }
body.premium-v2 .logo img[data-metrix-logo] {
  filter: drop-shadow(0 8px 16px rgba(129,140,248,.12));
}
body.premium-v2 #headerMenuBtn {
  border-radius: 18px;
  border-color: rgba(255,255,255,.09);
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  box-shadow: 0 10px 24px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.06);
}
body.premium-v2 #dashboard {
  padding: 10px 18px 24px;
}
body.premium-v2 .messages {
  padding-left: 18px;
  padding-right: 18px;
}

body.premium-v2 
body.premium-v2 .score-section { padding: 22px 20px; margin-bottom: 14px; justify-content: space-between; }
body.premium-v2 .welcome { padding: 18px 18px 16px; margin-bottom: 14px; }
body.premium-v2 .tr-section { margin-bottom: 14px; padding-top: 18px; padding-bottom: 18px; }
body.premium-v2 .rhr-card,
body.premium-v2 .ga-card,
body.premium-v2 .disp-card,
body.premium-v2 .tr-kpi-card {
  border-color: rgba(255,255,255,.065);
  border-radius: 26px;
  box-shadow: 0 22px 50px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.05);
}
body.premium-v2 .ga-card,
body.premium-v2 .disp-card,
body.premium-v2 .tr-kpi-card {
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
}
body.premium-v2 .rhr-card::before,
body.premium-v2 .ga-card::before,
body.premium-v2 .disp-card::before,
body.premium-v2 .tr-kpi-card::before,
body.premium-v2 .score-section::before,

body.premium-v2 .score-number {
  font-size: 80px;
  letter-spacing: -0.05em;
  text-shadow: 0 10px 30px rgba(129,140,248,.12);
}
body.premium-v2 .score-number span { color: rgba(255,255,255,.35); }
body.premium-v2 .bar-container {
  width: 10px;
  height: 112px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
}
body.premium-v2 
body.premium-v2 
body.premium-v2 .led-label,
body.premium-v2 .score-label,
body.premium-v2 .tr-sec-lbl,
body.premium-v2 .tr-section-label,
body.premium-v2 .form-section-title {
  letter-spacing: .12em;
}
body.premium-v2 .starter-pill,
body.premium-v2 .rhr-btn,
body.premium-v2 .rhr-manual-confirm,
body.premium-v2 .rhr-confirm,
body.premium-v2 .rhr-remeasure,
body.premium-v2 .rhr-secondary-btn,
body.premium-v2 .share-btn,
body.premium-v2 .tr-calc-btn,
body.premium-v2 .tr-tab,
body.premium-v2 .tr-chip,
body.premium-v2 .logo-dropdown-item,
body.premium-v2 #trArchiveSelectorBtn {
  border-radius: 18px !important;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
  box-shadow: 0 10px 22px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.04);
}
body.premium-v2 .starter-pill,
body.premium-v2 .rhr-confirm,
body.premium-v2 .tr-calc-btn {
  background: linear-gradient(180deg, rgba(129,140,248,.95), rgba(167,139,250,.92));
  color: #09090f;
}
body.premium-v2 .rhr-btn.rhr-btn-start {
  background: linear-gradient(180deg, rgba(34,197,94,.96), rgba(22,163,74,.92));
  color: #04130a;
  border: 1px solid rgba(34,197,94,.28);
  box-shadow: 0 10px 24px rgba(34,197,94,.18), inset 0 1px 0 rgba(255,255,255,.08);
}
body.premium-v2 .starter-pill .starter-pill-label {
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: #09090f;
  background-clip: unset;
  color: #09090f;
}
body.premium-v2 .starter-pill:active,
body.premium-v2 .rhr-btn:active,
body.premium-v2 .rhr-secondary-btn:active,
body.premium-v2 .share-btn:active,
body.premium-v2 .tr-chip:active,
body.premium-v2 .tab-btn:active { transform: scale(.98); }
body.premium-v2 .share-btn,
body.premium-v2 .rhr-secondary-btn,
body.premium-v2 .rhr-remeasure,
body.premium-v2 .tr-tab,
body.premium-v2 .tr-chip,
body.premium-v2 #trArchiveSelectorBtn,
body.premium-v2 .logo-dropdown-item,
body.premium-v2 .rhr-btn.rhr-btn-stop {
  border-color: rgba(255,255,255,.07);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  color: rgba(255,255,255,.55);
}
body.premium-v2 .rhr-secondary-btn.ghost,
body.premium-v2 .rhr-new-btn {
  border-radius: 18px;
  background: rgba(255,255,255,.03);
}
body.premium-v2 .tr-chip.active,
body.premium-v2 .tr-tab.active {
  border-color: rgba(129,140,248,.55);
  background: linear-gradient(180deg, rgba(129,140,248,.16), rgba(192,132,252,.09));
  box-shadow: 0 12px 30px rgba(99,102,241,.18), inset 0 1px 0 rgba(255,255,255,.07);
}
body.premium-v2 .rhr-answer,
body.premium-v2 .ga-answer,
body.premium-v2 .disp-answer,
body.premium-v2 #rhrInterpretation {
  background: rgba(255,255,255,.028);
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 18px;
}
body.premium-v2 #rhrSignalProgress {
  height: 10px !important;
  border-radius: 999px !important;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.04);
}
body.premium-v2 #rhrSignalProgressFill { border-radius: inherit; }
body.premium-v2 .tr-result-alert-text,
body.premium-v2 #trResultAlertText {
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.premium-v2 #rhrSignalProgressLabel {
  font-size: 11px;
  color: rgba(255,255,255,.62);
  letter-spacing: .06em;
}
body.premium-v2 .rhr-timer {
  font-size: 56px;
  letter-spacing: -.04em;
  text-shadow: 0 12px 30px rgba(129,140,248,.08);
}
body.premium-v2 #bottomTabBar {
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(18,18,24,.88), rgba(10,10,14,.84));
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 24px 50px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.05);
  overflow: hidden;
}
body.premium-v2 .tab-btn {
  position: relative;
  padding: 12px 6px 10px;
  color: rgba(255,255,255,.34);
}
body.premium-v2 .tab-btn.active {
  color: #eef2ff;
  filter: drop-shadow(0 0 14px rgba(129,140,248,.30));
}
body.premium-v2 .tab-btn.active::before {
  content:'';
  position:absolute;
  top:7px; left:50%; transform:translateX(-50%);
  width:36px; height:4px; border-radius:999px;
  background: linear-gradient(90deg, #4f46e5 0%, #818cf8 45%, #c084fc 100%);
  box-shadow: 0 0 16px rgba(129,140,248,.34);
}
body.premium-v2 .tab-btn::after {
  width: 64px;
  height: 64px;
  background: radial-gradient(circle, rgba(129,140,248,.30) 0%, rgba(192,132,252,.20) 42%, rgba(15,23,42,0) 74%);
}
body.premium-v2 .tab-btn span { font-size: 9.5px; letter-spacing: .11em; }
body.premium-v2 #trainingResult,
body.premium-v2 #trainingOverlay,
body.premium-v2 #mainMenuOverlay {
  background:
    radial-gradient(800px 240px at 50% 0%, rgba(129,140,248,.09), transparent 56%),
    #000 !important;
}
body.premium-v2 #trainingModal,
body.premium-v2 #starterOverlayContent,
body.premium-v2 .trend-hint,
body.premium-v2 #logoDropdownMenu,
body.premium-v2 #memoriaSubmenu {
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(18,18,24,.96), rgba(10,10,14,.95));
  box-shadow: 0 22px 60px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.04);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
}
body.premium-v2 .premium-reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: premiumFadeUp .55s cubic-bezier(.22,.82,.2,1) forwards;
}
@keyframes premiumFadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* STYLE BLOCK 7 id=rhr-page-fix-v3 */
/* BPM PAGE — layout e contrasto corretti */
#rhrPage {
  background:
    radial-gradient(900px 320px at 50% -10%, rgba(129,140,248,.14), transparent 55%),
    radial-gradient(800px 240px at 50% 120%, rgba(192,132,252,.08), transparent 40%),
    #000 !important;
}
#rhrPageInner {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  justify-content: flex-start;
}
#rhrPageHeader {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: max(18px, env(safe-area-inset-top)) 24px 14px;
  background: linear-gradient(180deg, rgba(6,6,10,.96), rgba(6,6,10,.82) 82%, rgba(6,6,10,0));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
#rhrPageScroll {
  padding: 16px 24px 8px;
  gap: 18px;
  flex: none;
  min-height: unset;
}
#rhrPage #rhrPanelHistory .tr-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(3,1fr) !important;
}
#rhrPageFooter {
  padding: 12px 24px calc(16px + env(safe-area-inset-bottom));
  background: transparent;
}
#rhrPage .tr-result-score-section {
  justify-content: flex-start;
  align-items: center;
  gap: 18px;
  min-height: auto;
}
#rhrPage .tr-result-number {
  font-size: clamp(48px, 8vw, 72px);
  color: #f8fafc;
  text-shadow: 0 10px 30px rgba(99,102,241,.16);
}
#rhrPage .tr-result-number span {
  margin-left: 6px;
  font-size: .34em;
  color: #94a3b8;
}
#rhrPage .tr-result-label {
  font-size: 11px;
  letter-spacing: .16em;
  color: #cbd5e1;
  background: linear-gradient(90deg,#a5b4fc,#c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#rhrPage .tr-result-bar-container {
  width: 10px;
  height: 104px;
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.05);
}
#rhrPage .tr-tab-row {
  border-top: 1px solid rgba(129,140,248,.12);
  padding-top: 14px;
}
#rhrPage .tr-tab {
  color: rgba(255,255,255,.58);
  border-color: rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}
#rhrPage .tr-tab.active {
  color: #eef2ff;
  border-color: rgba(129,140,248,.65);
  background: linear-gradient(180deg, rgba(99,102,241,.18), rgba(168,85,247,.12));
  box-shadow: 0 10px 24px rgba(99,102,241,.16), inset 0 1px 0 rgba(255,255,255,.06);
}
#rhrPage .tr-sec-lbl,
#rhrPage .tr-kpi-ttl,
#rhrPage .tr-kpi-sub,
#rhrPage .tr-result-alert-label,
#rhrPage .coach-summary-label,
#rhrPage .rhr-detail-lbl,
#rhrPage .rhr-detail-sub {
  color: #94a3b8 !important;
}
#rhrPage .rhr-card,
#rhrPage .tr-kpi-card,
#rhrPage .tr-result-alert {
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.025));
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 18px 40px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.04);
}
#rhrPage .coach-summary {
  margin: 6px 0 0;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#rhrPage .rhr-card {
  border-radius: 28px;
  padding: 22px 18px 18px;
  margin-bottom: 0;
}
#rhrPage .rhr-card::before {
  background: linear-gradient(135deg, rgba(129,140,248,.26), rgba(192,132,252,.18), rgba(255,255,255,.05));
}
#rhrPage .rhr-score-val,
#rhrPage .tr-kpi-val,
#rhrPage .rhr-detail-val {
  color: #f8fafc;
}
#rhrPage .rhr-score-unit,
#rhrPage .rhr-answer,
#rhrPage .tr-result-alert-text,
#rhrPage .coach-summary-text {
  color: #cbd5e1;
}
#rhrPage .coach-summary-label {
  margin-bottom: 8px;
}
#rhrPage .coach-summary-text {
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0;
  font-weight: 300;
}

#rhrPage .rhr-status-badge {
  background: rgba(255,255,255,.05);
  color: #e2e8f0;
  border-color: rgba(255,255,255,.08);
}
#rhrPage .rhr-bar-wrap,
#rhrPage .rhr-detail-grid,
#rhrPage .rhr-detail-item,
#rhrPage .rhr-answer {
  border-color: rgba(255,255,255,.08);
}
#rhrPage .rhr-cam-box {
  max-width: 220px;
  border-color: rgba(129,140,248,.28);
  box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 14px 36px rgba(99,102,241,.10);
}
#rhrPage .rhr-waveform { opacity: .95; }
#rhrPage .rhr-signal-quality,
#rhrPage .rhr-debug,
#rhrPage .rhr-timer {
  color: #cbd5e1;
}
#rhrPage .rhr-debug {
  background: rgba(255,255,255,.04);
}
#rhrPage .rhr-btn,
#rhrPage .rhr-remeasure,
#rhrPage .rhr-confirm,
#rhrPage .rhr-secondary-btn,
#rhrPage .rhr-new-btn,
#rhrPageFooter .starter-pill {
  min-height: 52px;
  border-radius: 18px;
}
#rhrPage .rhr-btn-stop,
#rhrPage .rhr-btn-manual,
#rhrPage .rhr-remeasure,
#rhrPage .rhr-secondary-btn,
#rhrPage .rhr-new-btn {
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-color: rgba(255,255,255,.08);
}
#rhrPage .rhrBtn, #rhrPage .rhr-btn { box-shadow: 0 10px 22px rgba(0,0,0,.18); }
#rhrPageFooter .starter-pill {
  max-width: 100%;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(129,140,248,.95), rgba(167,139,250,.92)) !important;
  border: none !important;
  color: #09090f !important;
  -webkit-text-fill-color: initial !important;
  box-shadow: 0 12px 28px rgba(99,102,241,.22), inset 0 1px 0 rgba(255,255,255,.14);
}
#rhrPageFooter .starter-pill .starter-pill-label {
  background: none !important;
  -webkit-text-fill-color: currentColor !important;
  color: inherit !important;
}
#rhrHistChartWrap {
  height: 240px !important;
  padding: 10px 6px 0;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.06);
}
@media (max-width: 640px) {
  #rhrPageHeader { padding-left: 18px; padding-right: 18px; }
  #rhrPageScroll { padding-left: 18px; padding-right: 18px; }
  #rhrPageFooter { padding-left: 18px; padding-right: 18px; }
  #rhrPage .tr-result-score-section { gap: 14px; }
  #rhrPage .tr-result-bar-container { height: 86px; }
  #rhrPage .tr-kpi-grid { grid-template-columns: 1fr !important; }
}

/* STYLE BLOCK 8 id=metrix-final-profile-fix */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  height: 100% !important;
  overscroll-behavior: none !important;
}

#onboardingOverlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  background: #000 !important;
  display: none;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  overflow: hidden !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}
html.profile-flow-open #onboardingOverlay,
body.profile-flow-open #onboardingOverlay { display: flex !important; }

#onboardingModal {
  width: 100% !important;
  max-width: 540px !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: #000 !important;
  box-sizing: border-box !important;
  padding-top: env(safe-area-inset-top, 0px) !important;
}

#onboardingModalBody {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  touch-action: pan-y !important;
  padding: 16px 20px 20px !important;
  box-sizing: border-box !important;
}

#onboardingModalFooter {
  flex: 0 0 auto !important;
  position: relative !important;
  width: 100% !important;
  z-index: 4 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 14px 20px max(20px, env(safe-area-inset-bottom, 0px)) !important;
  background: #000 !important;
  border-top: 1px solid rgba(255,255,255,0.05) !important;
  box-sizing: border-box !important;
}
#onboardingModalFooter .starter-pill { width: 100% !important; margin: 0 !important; }
#onboardingModalFooter { align-items: center !important; }
#onboardingModalFooter .starter-pill { max-width: 320px !important; }

#trainingOverlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9998 !important;
  display: none;
  flex-direction: column !important;
  overflow: hidden !important;
  background: #000 !important;
}
html.training-open #trainingOverlay,
body.training-open #trainingOverlay { display: flex !important; }

#trainingModal {
  width: 100% !important;
  max-width: 540px !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: #000 !important;
}

#trainingModalBody {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  touch-action: pan-y !important;
  padding-bottom: 18px !important;
}

#trainingModalFooter {
  flex: 0 0 auto !important;
  position: relative !important;
}

#rhrPage {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9200 !important;
  width: 100vw !important;
  height: 100dvh !important;
  background: #000 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}
#rhrPage.active {
  display: flex !important;
  flex-direction: column !important;
}
#rhrPageInner {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  max-width: 780px !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
#rhrPageScroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  touch-action: pan-y !important;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)) !important;
}
#rhrPageFooter {
  flex-shrink: 0 !important;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)) !important;
  background: #000 !important;
}

#onboardingOverlay, #onboardingOverlay *,
#trainingOverlay, #trainingOverlay *,
#rhrPage, #rhrPage * {
  pointer-events: auto !important;
}
.profile-slider { touch-action: pan-x !important; }
#onboardingModal input,
#onboardingModal select,
#onboardingModal textarea,
#onboardingModal button,
#onboardingModal label,
#trainingModal button,
#trainingModal input,
#trainingModal select,
#trainingModal textarea,
#rhrPage button,
#rhrPage input {
  touch-action: manipulation !important;
}

.profile-info-card { display: none !important; }
.profile-info-card.visible { display: block !important; }
#profileToast { pointer-events: auto !important; z-index: 9998 !important; }
#profileToast.visible { transform: translateX(-50%) translateY(0) !important; }

@media (max-width: 640px) {
  #onboardingModalBody { padding-left: 16px !important; padding-right: 16px !important; }
  #onboardingModalFooter { padding-left: 16px !important; padding-right: 16px !important; }
}

/* STYLE BLOCK 9 id=rhr-page-unified-scroll-fix */
/* BPM PAGE — corpo unico scrollabile, senza schermo diviso */
#rhrPage {
  overflow: hidden !important;
}

#rhrPageInner {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  max-width: 780px !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  touch-action: pan-y !important;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)) !important;
  background: transparent !important;
}

#rhrPageHeader {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: none !important;
  padding: max(18px, env(safe-area-inset-top)) 24px 14px !important;
}

#rhrPageScroll {
  flex: 0 0 auto !important;
  min-height: auto !important;
  overflow: visible !important;
  padding: 0 24px 8px !important;
}

#rhrPageFooter {
  flex-shrink: 0 !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 12px 24px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  background: transparent !important;
  box-sizing: border-box !important;
}

@media (max-width: 640px) {
  #rhrPageHeader { padding-left: 18px !important; padding-right: 18px !important; }
  #rhrPageScroll { padding-left: 18px !important; padding-right: 18px !important; }
  #rhrPageFooter { padding-left: 18px !important; padding-right: 18px !important; }
}

/* STYLE BLOCK 10 id=profile-single-scroll-fix */
#onboardingModal {
  display: block !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
}
#onboardingModalBody {
  flex: none !important;
  min-height: auto !important;
  overflow: visible !important;
  padding-bottom: 10px !important;
}
#onboardingModalFooter {
  flex: none !important;
  position: static !important;
  width: 100% !important;
  z-index: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 0 20px max(20px, env(safe-area-inset-bottom, 0px)) !important;
  background: transparent !important;
  border-top: 0 !important;
  box-sizing: border-box !important;
}
@media (max-width: 640px) {
  #onboardingModalFooter {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* ── BPM TAB: rimuovi elementi ridondanti ── */
/* 1. Nasconde il box con testo in corsivo "Il tuo RHR di X BPM..." */
#rhrAnswer { display: none !important; }

/* 2. Nasconde il riquadro "RHR / BPM rilevati" (terzo item nel grid) */
.rhr-detail-grid .rhr-detail-item:nth-child(3) { display: none !important; }

/* 3. Nasconde il tasto nero "NUOVA MISURAZIONE" dentro il card (è ridondante col pulsante in fondo) */
.rhr-remeasure { display: none !important; }
/* Rende il tasto CONFERMA a piena larghezza ora che è l'unico */
.rhr-action-row { display: flex !important; }
.rhr-confirm { flex: 1 !important; }

/* STYLE BLOCK 11 id=oai-final-rhr-fix */
#rhrPageLabel:empty,
#rhrPanelMeasure > .tr-sec-lbl:empty { display:none !important; }
#rhrPage .rhr-btn.rhr-btn-start,
#rhrPage button.rhr-btn-start,
body.premium-v2 #rhrPage .rhr-btn.rhr-btn-start,
body.premium-v2 #rhrPage button.rhr-btn-start{
  background:linear-gradient(135deg,#22c55e,#16a34a) !important;
  color:#04130a !important;
  border:1px solid rgba(34,197,94,.30) !important;
  box-shadow:0 10px 24px rgba(34,197,94,.22), inset 0 1px 0 rgba(255,255,255,.16) !important;
}

