/* ===== PALETA ===== */
:root{
  --bg1:#3a6186;   /* azul */
  --bg2:#89253e;   /* borgoña */
  --panel: rgba(0,0,0,0.28);
  --text:#fff;

  --p1:#355a7b;
  --p2:#46557a;    /* botón primario */
  --p3:#5a4866;    /* select cerrado */
  --p4:#6f334c;    /* botón detener */
}

/* Reset / base */
*{ box-sizing:border-box; }
html, body { height:100%; }
html{ height: -webkit-fill-available; }
body{
  min-height: 100svh;
  min-height: calc(var(--vh, 1vh) * 100);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior-y: contain;
  touch-action: manipulation;
}

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  color: var(--text);
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
}

/* ===== Header (2 filas centradas) ===== */
.app-header{
  width:100%;
  display:flex;
  flex-direction: column;
  align-items:center;
  gap: 8px;
  padding: clamp(10px, 2vw, 18px);
}
.brand{
  margin:0;
  font-size: clamp(18px, 3.5vw, 28px);
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.header-center{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: clamp(8px, 2vw, 16px);
  flex-wrap: wrap;
}
.toggle{ display:inline-flex; gap:6px; align-items:center; cursor:pointer; }
#volume{ width: clamp(120px, 40vw, 240px); }
.chip{
  background: rgba(255,255,255,0.18);
  color:#fff; border:1px solid rgba(255,255,255,0.28);
  border-radius:999px; padding:6px 10px; cursor:pointer;
}

/* ===== Tabs ===== */
.tabs{ width:100%; display:flex; justify-content:center; gap:8px; padding:6px 10px; }
.tab{
  background: transparent; color:#fff;
  border: 2px solid rgba(255,255,255,0.4);
  padding: 8px 14px; border-radius:999px; cursor:pointer;
  transition: background .2s, transform .05s;
}
.tab:hover{ background: rgba(255,255,255,0.16); }
.tab:active{ transform: translateY(1px); }
.tab.active{ background: rgba(255,255,255,0.26); border-color: rgba(255,255,255,0.6); }

/* ===== Panel central ===== */
.app-container{
  margin: 12px auto 16px;
  text-align:center;
  max-width: 920px; width:100%;
  padding: clamp(8px, 2vw, 14px);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(0,0,0,0.25);
}

/* Secciones */
.section{ display:none; }
.section.visible{ display:block; }
.section[hidden]{ display:none !important; }

/* ===== Visual respiración ===== */
.breath-visual{
  margin: clamp(12px, 3vw, 34px) auto;
  width: clamp(260px, 52vmin, 520px);
  height: clamp(260px, 52vmin, 520px);
  position: relative; overflow: hidden; border-radius: 24px;
}
#circle{
  --phase-duration: 4000ms;
  position:absolute; top:50%; left:50%;
  width:40%; height:40%;
  border-radius:50%;
  background: rgba(255,255,255,0.72);
  transform: translate(-50%, -50%) scale(1);
  transition: transform var(--phase-duration) ease-in-out;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
}
#ola {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% calc(50% - 15px);
  border-radius: 50%;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.18));
  opacity: 0.96;
  pointer-events: none;
}
#instruction{ font-size: clamp(20px, 4.8vw, 32px); margin: 10px 0 16px; }
.controls{ margin:10px 0; display:flex; flex-direction:column; align-items:center; gap:12px; }

.session-row{ display:grid; grid-template-areas:'slot'; align-items:center; justify-items:center; }
.session-controls, .countdown{ grid-area: slot; }
.session-controls.hidden, .countdown.hidden{ display:none; }

.controls select{
  appearance:none; -webkit-appearance:none; -moz-appearance:none;
  background: var(--p3);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 16px; text-align:center;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.controls select:focus{ outline:2px solid rgba(255,255,255,0.6); outline-offset:2px; }
.controls select option{ background:#4e3f60; color:#fff; }

.countdown{
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 10px; border-radius:999px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.18);
  font-weight:600;
}
#countdown{ letter-spacing:.5px; }

/* ===== Botones ===== */
.buttons{
  display:flex; justify-content:center; flex-wrap:wrap;
  gap:22px; margin-top: clamp(12px, 2.2vw, 20px);
}
.buttons button{
  padding: 12px 28px;
  border: none; border-radius: 12px; font-size: 16px; cursor:pointer;
  transition: background 0.2s, transform 0.05s, opacity 0.2s; color:#fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.buttons button:active{ transform: translateY(1px); }
.btn-start{ background: var(--p2); }
.btn-start:hover{ background:#56628a; }
.btn-stop{ background: var(--p4); }
.btn-stop:hover{ background:#843255; }

/* ===== ANCLAJE ===== */
.ground-card{
  background: linear-gradient(180deg, rgba(255,255,255,0.20), rgba(255,255,255,0.10));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.28);
  box-shadow: 0 12px 28px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.25);
  border-radius: 18px;
  padding: 16px;
  color: #f7f7f7;
  margin: 14px auto;
  max-width: 820px;
  text-align:left;
}
.ground-status .bar{ width:100%; height:10px; background: rgba(255,255,255,0.18); border-radius:999px; overflow:hidden; }
.ground-status .bar .bar-fill{ height:100%; width:0%; background: linear-gradient(90deg, #6c9fcf, #8f5aac); transition: width .25s ease; }
.ground-status .legend{ font-weight:600; margin-top:6px; color:#fff; }
#anchorTitle{ color:#fff; }
.ground-prompt{ font-size: 18px; font-weight: 800; margin: 12px 0 8px; color:#fff; }
.ground-hints{ margin: 6px 0 8px; color: rgba(255,255,255,0.92); }
.ground-hints summary{ cursor:pointer; }
.ground-hints ul{ margin: 6px 0 10px 20px; }

.ground-inputs{ margin: 10px 0; }
.ground-inputs label{ color:#f0f0f0; }
.ground-inputs textarea{
  width:100%; min-height: 100px; resize: vertical;
  padding: 12px 12px;
  border-radius: 12px; border:1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
  color:#fff;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.25);
}
.ground-inputs textarea::placeholder{ color: rgba(255,255,255,0.75); }
.ground-actions{ display:flex; gap:10px; justify-content:flex-end; }
.btn-primary{
  background: var(--p2); color:#fff;
  border:none; padding:10px 16px; border-radius:10px; cursor:pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.22);
}
.btn-primary:hover{ background:#56628a; }
.btn-good{
  background:#2f8f83; color:#fff;
  border:none; padding:10px 16px; border-radius:10px; cursor:pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.btn-good:hover{ background:#38a596; }
.btn-bad{
  background:#7a3a56; color:#fff;
  border:none; padding:10px 16px; border-radius:10px; cursor:pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.btn-bad:hover{ background:#92456a; }
.btn-restart{
  background: linear-gradient(135deg, #3a86c6, #2a6aa5);
  color:#fff;
  border:none; padding:10px 16px; border-radius:10px; cursor:pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.btn-restart:hover{ background: linear-gradient(135deg, #4496da, #2f74b6); }
.ground-done{ margin-top: 14px; }
.ground-done h3{ margin: 6px 0 4px; }
.feel-msg{
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

/* ===== SONIDOS (nuevo bloque) ===== */
.sound-list{
  list-style:none; padding:0; margin: 8px auto 0; max-width: 640px;
  display:flex; flex-direction:column; gap:10px;
}
.sound-item{
  display:grid; grid-template-columns: 36px 1fr auto;
  align-items:center; gap:10px;
  padding:10px 12px; border-radius:14px;
  background: rgba(0,0,0,0.20); border:1px solid rgba(255,255,255,0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.sound-emoji{ font-size: 22px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.sound-title{ text-align:left; font-weight:700; }
.sound-actions{ display:flex; gap:8px; }
.sound-btn{
  width:42px; height:42px; display:grid; place-items:center;
  border:none; border-radius:12px; cursor:pointer; color:#fff;
  background: rgba(255,255,255,0.13); box-shadow: 0 5px 16px rgba(0,0,0,.18);
  transition: transform .05s, background .2s, box-shadow .2s, filter .15s;
}
.sound-btn:active{ transform: translateY(1px); }
.sound-btn.play.is-playing{
  background: #2f8f83; box-shadow: 0 6px 18px rgba(0,0,0,.22);
  filter: saturate(1.15);
}
.sound-btn.stop{ background:#7a3a56; }

/* Footer */
.site-footer{
  width:100%;
  text-align:center;
  padding: 10px 8px;
  color: rgba(255,255,255,0.9);
  margin-top: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* Blackout overlay */
#blackout{
  position: fixed; inset:0; background:#000; opacity:0; pointer-events:none;
  transition: opacity 12s ease; z-index: 9999;
}
#blackout.active{ opacity:1; pointer-events:auto; }

/* Círculo y ola (respiración) — al final para asegurar prioridad */
#circle{ position:absolute; top:50%; left:50%; width:40%; height:40%;
  transform: translate(-50%, -50%) scale(1); border-radius:50%;
  background: rgba(255,255,255,0.72); overflow:hidden; display:flex; align-items:center; justify-content:center; }
#ola{ position:absolute; left:50%; bottom:-6%; transform:translateX(-50%);
  height:115%; width:auto; max-width:none; pointer-events:none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.18)); opacity:.96; border-radius:0; }

/* Línea extra bajo prompt del anclaje */
.speak-aloud{ margin:6px 0 10px; opacity:.9; font-style:italic; font-size:14px; color:#f0f0f0; }
