:root{
  font-family: 'Roboto', 'Montserrat', sans-serif;
}

*{box-sizing:border-box}

html,body{
  height:100%;
  margin:0;
}

body{
  background:
    radial-gradient(1600px 900px at 100% 100%, rgba(3,166,176,0.95), transparent 50%),
    linear-gradient(180deg, #003a8f 0%, #004ea6 60%, #05306e 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  width: 100%;
  max-width: 1000px;
  padding: clamp(20px, 4vh, 60px) 20px;
  margin: 0 auto;
  position: relative; /* allow absolute centering of the icon-window */
}

.content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(2.5rem, 8vw, 4.8rem); /* Slightly larger */
  font-weight: 700;
  line-height: 1.05;
  margin: 0 0 clamp(20px, 4vh, 48px) 0;
  color: white;
  text-shadow: 0 8px 32px rgba(0,0,0,0.4);
  letter-spacing: -0.02em; /* Tighter for a more modern feel */
  animation: fadeInDown 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.main-icon {
  width: clamp(120px, 20vw, 180px);
  height: clamp(120px, 20vw, 180px);
  margin-bottom: 0px;
  border-radius: 30px; /* Slightly rounder */
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 10px 20px rgba(0,0,0,0.3);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: scaleIn 0.8s 0.2s both;
}

/* Adjust icon window to be centered in the viewport */
.icon-window{
  /* keep compatibility if referenced elsewhere but make it non-decorative */
  position: relative;
  display: block;
  margin: 18px auto 12px auto;
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  z-index: 2;
}

/* New alert button styling */
.alert-button {
  margin: 0;
  width: clamp(60px, 12vw, 80px); /* Slightly larger */
  height: clamp(60px, 12vw, 80px);
  padding: 0;
  background: rgba(255, 255, 255, 0.08); /* More refined glassmorphism */
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25), inset 0 0 15px rgba(255,255,255,0.1);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  animation: fadeInUp 0.8s 0.4s both;
}

/* Distinguish start button */
#startBtn {
  width: clamp(70px, 15vw, 96px);
  height: clamp(70px, 15vw, 96px);
  background: rgba(3, 166, 176, 0.15);
  border-color: rgba(3, 166, 176, 0.5);
  box-shadow: 0 15px 40px rgba(3, 166, 176, 0.25), inset 0 0 20px rgba(255,255,255,0.1);
}
/* new: horizontal container for the two icon buttons */
.button-row {
  display: inline-flex;
  gap: clamp(16px, 4vw, 32px);
  align-items: center;
  margin-top: clamp(24px, 5vh, 48px);
}
.alert-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: none;
}
.alert-button span { display:none; }

/* hover: scale up slightly, enhance glow and darken background to show click */
@media (hover: hover) {
  .alert-button:hover {
    transform: translateY(-8px) scale(1.1);
    box-shadow: 0 30px 60px rgba(0,0,0,0.5), inset 0 0 20px rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.18);
  }
  #startBtn:hover {
    background: rgba(3, 166, 176, 0.25);
    border-color: rgba(3, 166, 176, 0.7);
    box-shadow: 0 30px 60px rgba(3, 166, 176, 0.35);
  }
}
.alert-button:active {
  transform: translateY(-2px) scale(0.95) !important;
  box-shadow: 0 5px 15px rgba(0,0,0,0.4) !important;
  background: rgba(255,255,255,0.25) !important;
}

.fing-btn {
    position: absolute;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    padding: 0;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 140ms ease, filter 140ms ease;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 260; /* ensure buttons sit above floating panels/menus so they're clickable on mobile */
    pointer-events: auto; /* explicitly allow pointer events */
}

.logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(20px, 5vw, 40px);
  width: 100%;
  padding-top: clamp(20px, 4vh, 40px);
}

.logo {
  max-height: clamp(40px, 8vw, 75px);
  width: auto;
  opacity: 0.8;
  filter: brightness(1.1) contrast(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease, filter 0.3s ease;
  animation: fadeInUp 0.8s 0.6s both;
}

.logo:hover {
  opacity: 1;
  transform: translateY(-4px) scale(1.05);
  filter: brightness(1.2) contrast(1);
}

.fca-logo {
    max-width: 120px;
}

.institut-logo {
    max-width: 220px;
    max-height: 80px;
    transform: translateX(-8px); /* move slightly left */
}

.cause-info-panel {
  position: fixed;
  background: rgba(255,255,255,0.12); /* match desktop transparency */
  color: #072b2c;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.68rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  z-index: 250;
  max-width: 160px;
  word-wrap: break-word;
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.4); /* clearer view */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 60;
  padding: 24px;
}

.modal-panel{
  position: relative;
  background: rgba(3, 20, 38, 0.50);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  max-width: 760px;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.6);
  padding: 20px 22px;
  outline: none;
  max-height: 90vh;
  overflow: auto;
}

.modal-panel h2 {
  margin: 0 0 12px 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.25rem;
}

.modal-body p {
  margin: 0 0 12px 0;
  line-height: 1.4;
  font-size: 0.95rem;
  text-align: left;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.btn-accept{
  background: #0b74ff;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(11,116,255,0.18);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.btn-accept:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(11,116,255,0.22); }

.modal-lang{
  display: flex;
  gap: 8px;
  margin: 8px 0 12px 0;
  justify-content: flex-start;
}
.lang-btn{
  appearance: none;
  background: #0e1f36;
  color: #cfe3ff;
  border: 1px solid rgba(255,255,255,0.14);
  padding: clamp(8px, 1.5vw, 12px) clamp(12px, 2vw, 16px);
  border-radius: 999px;
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
  flex: 1; /* evenly distributed */
  -webkit-tap-highlight-color: transparent;
}
.lang-btn:hover{ border-color: rgba(255,255,255,0.28); }
.lang-btn.active{
  background: #0b74ff;
  color: #fff;
  border-color: #0b74ff;
  box-shadow: 0 4px 12px rgba(11,116,255,0.3);
}

.link-integrat {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s;
}

.link-integrat:hover {
  color: #00bfa5; /* o el color accent de l'app */
}

/* unify external and internal info-links appearance */
.info-link,
.link-integrat {
  display: inline-block;
  text-decoration: none; /* removed underline */
  background: rgba(0,166,176,0.12); /* adjusted to app green-teal */
  color: #007f75; /* darker green-teal for text */
  border: 1px solid rgba(0,166,176,0.18); /* green-teal border */
  padding: 1px 4px; /* tighter padding to fit more closely to text */
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight:400; /* even lighter for a tighter appearance */
  transition: background 140ms ease, transform 120ms ease, box-shadow 140ms ease, color 140ms ease;
  margin-left:2px;
}
.info-link:hover,
.link-integrat:hover {
  background: rgba(0,166,176,0.20); /* slightly stronger green-teal on hover */
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,166,176,0.06);
  color: #004f4b; /* subtle darker tint on hover for contrast */
}

/* small language modal (compact) */
.small-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  padding: 12px;
}
.small-panel {
  position: relative;
  background: #041726;
  color: #fff;
  width: 92%;
  max-width: 420px;
  min-width: 280px;
  border-radius: 12px;
  padding: 18px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  outline: none;
}
.small-panel h3 {
  margin: 0 0 8px 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  text-align: left;
}
.small-lang {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.lang-select-btn{
  appearance: none;
  background: #0e1f36;
  color: #cfe3ff;
  border: 1px solid rgba(255,255,255,0.10);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.lang-select-btn:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.22); }
.lang-select-btn.active{
  background: #0b74ff;
  color: #fff;
  border-color: #0b74ff;
}

/* modern inline link used in "Més informació" panels */
.info-link{
  display:inline-block;
  text-decoration: none;
  background: rgba(0,166,176,0.12); /* match app green-teal */
  color: #007f75; /* darker green-teal for text */
  border: 1px solid rgba(0,166,176,0.18); /* green-teal border */
  padding: 1px 4px; /* tighter padding to fit more closely to text */
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight:400;
  transition: background 140ms ease, transform 120ms ease, box-shadow 140ms ease, color 140ms ease;
  margin-left:2px;
}
.info-link:hover{ 
  background: rgba(0,166,176,0.20);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,166,176,0.06);
  color: #004f4b;
}

.small-modal[hidden],
.modal[hidden] {
  display: none !important;
}

@media (max-width: 480px) {
  /* removed redundant h1, icon and logos overrides completely as they are handled by clamp() now */
  .institut-logo {
    transform: translateX(-4px); /* just slightly adjust left */
  }
}

@media (max-width: 600px) {
  /* Use same layout and positioning as desktop so the mannequin looks identical */
  .man-image {
    display: block;
    width: 56vw;
    max-width: 720px;
    height: 100vh;
    margin: 0 auto;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    object-fit: cover;
    object-position: 50% 0%; /* shows head, trunk and pelvis */
    position: relative;
    transform: translateY(-2vh); /* slightly lower the viewpoint without affecting other elements */
  }
  /* Make the additional info modal occupy full width at bottom on mobile,
     keep same right margin as left, and let height size to content */
  /* ensure symptom list items can scroll fully into view on mobile */
  #symptomPickerModal #symptomList {
    padding-bottom: 72px; /* leave space so the last item isn't hidden by modal edges / controls */
  }

  /* New: keep symptom picker modal clipping content and make the inner list size aware
     so items cannot scroll under the modal header (top) — add smooth touch scrolling. */
  #symptomPickerModal {
    overflow: hidden; /* ensure children are clipped to modal bounds */
  }
  #symptomPickerModal #symptomList {
    box-sizing: border-box;
    padding-top: 8px; /* avoid first items touching modal header */
    /* reserve space for header/actions and ensure scrolling area fits inside modal */
    max-height: calc(60vh - 96px); /* adjust to available modal height */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.zone-modal #symptomList label,
#symptomList label {
  justify-content: flex-start;
  text-align: left;
}
.zone-modal #symptomList label span,
#symptomList label span {
  display: inline-block;
  width: 100%;
  text-align: left;
}

/* Center the image overlay modal on screen when visible */
/* The layout logic is now handled by JS in start.html/index.html */

/* Close button for modals (X) */
.close-modal-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  padding: 0;
  appearance: none;
  font-size: 0; /* ensure no text label shows */
  line-height: 0;
  overflow: hidden;
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg) scale(1.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.close-modal-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* Specific adjustments for light mods if needed */
.zone-modal .close-modal-btn,
.small-panel .close-modal-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #072b2c;
}

.zone-modal .close-modal-btn:hover,
.small-panel .close-modal-btn:hover {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.25);
}

/* Image Gallery Navigation Styles */
.img-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 110;
  transition: all 0.2s ease;
  user-select: none;
}

.img-nav-btn:hover {
  background: rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-50%) scale(1.1);
}

.img-nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.img-nav-btn.prev {
  left: 10px;
}

.img-nav-btn.next {
  right: 10px;
}

.img-nav-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.img-counter {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 999px;
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 105;
  pointer-events: none;
}

@media (max-width: 600px) {
  .img-nav-btn {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
  }
  .img-nav-btn.prev { left: 5px; }
  .img-nav-btn.next { right: 5px; }
}

