/* ═══════════════════════════════════════════════════════════════════════════
   Guided Exercise – exercise.css
   ══════════════════════════════════════════════════════════════════════════ */

/* ─── Reset / Base ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  color: #1a1a1a;
  background: #f4f8fb;
  /* allow body to fill screen on mobile */
  min-height: 100dvh;
}

.d-none { display: none !important; }

/* ─── Brand bar ────────────────────────────────────────────────────────────── */

.ex-brand-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  background: #1f4e79;
  color: #fff;
  text-align: center;
  padding: 7px 12px 6px;
  font-size: 0.88em;
  font-weight: 700;
  letter-spacing: 0.06em;
}

body { padding-top: 34px; }

/* KSZ mérés indítóképernyőn a fix márka-sávot ÉS a haladásjelzőt is elrejtjük, hogy a
   "KOPPINTS AZ INDÍTÁSHOZ" felirat mindig teljesen beférjen a képernyőre (lásd showScreen()
   a JS-ben). */
body.ex-hide-brandbar .ex-brand-bar { display: none; }
body.ex-hide-brandbar { padding-top: 0; }
body.ex-hide-brandbar #ex-progress { display: none; }

/* ─── Progress bar ─────────────────────────────────────────────────────────── */

.ex-progress {
  background: #1f4e79;
  color: #fff;
  padding: 6px 16px 8px;
}

.ex-progress-label {
  font-size: 0.82em;
  margin-bottom: 4px;
  opacity: 0.9;
}

.ex-progress-track {
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  overflow: hidden;
}

.ex-progress-fill {
  height: 100%;
  background: #3ac5a0;
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ─── Screens ──────────────────────────────────────────────────────────────── */

.ex-screen {
  min-height: calc(100dvh - 34px);   /* full viewport minus brand bar */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 12px 40px;
}

/* Ha a márka-sáv el van rejtve (KSZ mérés indítóképernyő), a teljes dvh használható. */
body.ex-hide-brandbar .ex-screen {
  min-height: 100dvh;
}

/* Card-based screens (login, start, cp-result, audio, summary) */
.ex-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 28px 24px;
  width: 100%;
  max-width: 480px;
  margin-top: 8px;
}

/* Full-screen tap screens (cp-prep, cp-measure) */
.ex-fullscreen-content {
  width: 100%;
  max-width: 520px;
  padding: 20px 8px;
}

/* ─── Screen: Login ────────────────────────────────────────────────────────── */

.ex-screen-login {
  background: #f4f8fb;
}

/* ─── Screen: Start ────────────────────────────────────────────────────────── */

.ex-screen-start {
  background: #eaf4fb;
}

.ex-logged-as {
  font-size: 0.82em;
  color: #888;
  margin: 0 0 1em;
  text-align: center;
}

.ex-meta {
  margin: 0.3em 0 1em;
}

.ex-badge {
  display: inline-block;
  background: #d6eaf8;
  color: #1f4e79;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 0.85em;
  font-weight: 600;
  margin: 2px 3px;
}

.ex-coupon-banner {
  background: #fff7ed;
  border: 1px dashed #e8922a;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 1em;
  text-align: center;
}

.ex-coupon-banner-label {
  margin: 0 0 4px;
  font-size: 0.75em;
  color: #a15c0a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.ex-coupon-banner-title {
  margin: 0 0 6px;
  font-size: 1.1em;
  font-weight: 700;
  color: #1f4e79;
}

.ex-coupon-highlight {
  color: #c0392b;
}

.ex-coupon-banner-timer-label {
  margin: 8px 0 2px;
  font-size: 0.78em;
  color: #a15c0a;
  font-weight: 600;
}

.ex-coupon-banner-code {
  margin: 0 0 10px;
  font-size: 0.9em;
  color: #444;
}

.ex-coupon-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #e8c9a0;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 1em;
  font-weight: 700;
  font-family: inherit;
  color: #1f4e79;
  cursor: pointer;
}

.ex-coupon-code-btn:active {
  background: #fdf0e0;
}

.ex-coupon-copy-icon {
  display: inline-flex;
  color: #1f4e79;
}

.ex-coupon-copy-icon svg {
  width: 16px;
  height: 16px;
}

.ex-coupon-copy-icon.is-copied {
  color: #2a9d8f;
}

.ex-coupon-banner-timer {
  margin: 0 0 12px;
  font-size: 1.5em;
  font-weight: 700;
  color: #c0392b;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.ex-coupon-banner-btn {
  display: inline-block;
  padding: 10px 22px;
  background: #d4781a;
  background: linear-gradient(to bottom, #e8922a, #d4781a);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95em;
}

.ex-session-info {
  background: #f0f8ff;
  border-left: 4px solid #2a9d8f;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
  margin-top: 1em;
}

.ex-session-info p {
  margin: 0 0 0.5em;
  font-weight: 600;
  color: #1f4e79;
}

.ex-session-list {
  margin: 0 0 0 1.1em;
  padding: 0;
  color: #333;
}

.ex-session-list li { margin-bottom: 0.25em; }

/* ─── Screen: CP Prep (green) ──────────────────────────────────────────────── */

.ex-screen-cp-prep {
  background: #c8e6c9;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  align-items: flex-start;
  position: relative;
  padding-top: 0;
  padding-bottom: 10px;
  overflow: hidden;
}

.ex-screen-cp-prep .ex-fullscreen-content {
  position: relative;
  padding: 0 8px;
}

.ex-cp-prep-img {
  position: absolute;
  top: 0;
  right: 8px;
  width: 36%;
  max-width: 185px;
  height: auto;
  pointer-events: none;
}

.ex-cp-prep-header {
  position: relative;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.ex-cp-prep-block--get-ready .ex-cp-prep-list {
  width: 58%;
}

.ex-cp-prep-main-title {
  font-size: 1.15em;
  font-weight: 700;
  color: #1f4e79;
  margin: 0;
  margin-right: 38%;
  text-align: center;
}

.ex-cp-prep-sub {
  font-size: 1.05em;
  font-weight: 400;
  color: #111;
  margin: 0 0 5px;
}

.ex-screen-title {
  font-size: 1.6em;
  font-weight: 700;
  color: #1f4e79;
  margin: 0 0 0.8em;
  text-align: center;
}

.ex-cp-prep-block {
  background: rgba(255,255,255,0.65);
  border: 2px solid rgba(46,125,50,0.35);
  border-radius: 10px;
  padding: 7px 12px;
  margin-bottom: 6px;
}

.ex-cp-prep-label {
  font-weight: 700;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #2e7d32;
  margin: 0 0 0.3em;
}

.ex-cp-prep-list {
  list-style: decimal;
  padding-left: 1.3em;
  margin: 0;
  line-height: 1.38;
  font-size: 0.93em;
}

.ex-cp-prep-list li { margin-bottom: 0.2em; }

.ex-cp-tap-cta {
  text-align: center;
  font-size: 1.7em;
  font-weight: 700;
  color: #1f4e79;
  letter-spacing: 0.04em;
  margin: 0.3em 0 0;
  animation: tapPulse 2s ease-in-out infinite;
}

.ex-vitals-wrap {
  border: 2px solid rgba(31,78,121,0.25);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 0.6em;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.ex-vitals-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ex-vitals-label {
  display: block;
  font-size: 0.85em;
  color: #444;
  margin: 0 0 4px;
  white-space: nowrap;
}

.ex-vitals-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ex-vitals-slash {
  margin: 0 2px;
  font-size: 1.3em;
  color: #999;
}

.ex-vitals-input {
  width: 136px;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1.3em;
  box-sizing: border-box;
  text-align: center;
}

.ex-vitals-input--narrow {
  width: 76px;
}

.ex-vitals-input::placeholder {
  color: #dcdcdc;
}

@keyframes tapPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Screen: CP Measuring (yellow) ─────────────────────────────────────────── */

.ex-screen-cp-measure {
  background: #fff9c4;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  align-items: center;
}

.ex-screen-cp-measure h2 { color: #f57f17; }

.ex-screen-cp-measure p {
  font-size: 1.05em;
  line-height: 1.5;
  margin: 0.5em 0;
}

/* ─── Screen: CP Result (orange) ─────────────────────────────────────────────── */

.ex-screen-cp-result {
  background: #fbe5d6;
}

.ex-cp-result-wrap {
  width: 100%;
  max-width: 480px;
  margin-top: 8px;
}

.ex-result-label {
  font-size: 1.05em;
  color: #555;
  margin: 0.5em 0 0.2em;
}

.ex-result-value {
  font-size: 3.2em;
  font-weight: 700;
  color: #7030a0;
  margin: 0 0 0.2em;
  line-height: 1;
}

.ex-result-unit {
  font-size: 0.45em;
  color: #888;
  font-weight: 400;
}

.ex-save-status {
  font-size: 0.85em;
  color: #888;
  min-height: 1.4em;
  margin-bottom: 0.4em;
}

/* ─── Screen: Audio (teal) ───────────────────────────────────────────────────── */

.ex-screen-audio {
  background: #e0f7f4;
  overflow: hidden;
}

.ex-audio-wrap {
  width: 100%;
  max-width: 480px;
  margin-top: 8px;
}

/* A vezérlők (csúszka, gomb) a fehér kártyán kívül, közvetlenül a zöld
   képernyő-háttéren jelennek meg, a kártya alatt. */
.ex-audio-controls {
  margin-top: 1.6em;
  padding: 0 8px;
}

.ex-audio-status {
  font-size: 0.65em;
  color: #00796b;
  font-weight: 600;
}

/* Ripple animation */
.ex-ripple-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.6em auto 1.2em;
  width: 100%;
  aspect-ratio: 1 / 1;
  pointer-events: none;
  overflow: hidden;
}

.ex-ripple {
  position: absolute;
  width: 6px;
  height: 6px;
  border: 1.5px solid #2a9d8f;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  animation: rippleContract 20s linear infinite;
}

.ex-ripple:nth-child(1)  { animation-delay:  0s; }
.ex-ripple:nth-child(2)  { animation-delay:  2s; }
.ex-ripple:nth-child(3)  { animation-delay:  4s; }
.ex-ripple:nth-child(4)  { animation-delay:  6s; }
.ex-ripple:nth-child(5)  { animation-delay:  8s; }
.ex-ripple:nth-child(6)  { animation-delay: 10s; }
.ex-ripple:nth-child(7)  { animation-delay: 12s; }
.ex-ripple:nth-child(8)  { animation-delay: 14s; }
.ex-ripple:nth-child(9)  { animation-delay: 16s; }
.ex-ripple:nth-child(10) { animation-delay: 18s; }

@keyframes rippleContract {
  0%   { transform: scale(80); opacity: 0; }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.4; }
  100% { transform: scale(0.1); opacity: 0; }
}

/* Audio progress bar */
.ex-audio-track {
  height: 10px;
  background: rgba(0,0,0,0.12);
  border-radius: 5px;
  overflow: hidden;
  margin: 0 auto 6px;
  max-width: 320px;
  cursor: pointer;
}

.ex-audio-fill {
  height: 100%;
  background: #2a9d8f;
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s linear;
}

.ex-audio-time {
  font-size: 0.82em;
  color: #1b5e20;
  margin: 0 0 0.8em;
}

.ex-audio-blocked {
  margin-top: 1em;
  padding: 14px;
  background: #fff3cd;
  border-radius: 10px;
  border: 1px solid #ffc107;
}

/* ─── Screen: Summary ────────────────────────────────────────────────────────── */

.ex-screen-summary {
  background: #f4f8fb;
}

.ex-summary-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.97em;
}

.ex-summary-table th,
.ex-summary-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.ex-summary-table th {
  font-weight: 600;
  color: #1f4e79;
  background: #eaf4fb;
}

.ex-summary-table tr:last-child td { border-bottom: none; }

.ex-summary-table .ex-sum-val {
  font-weight: 700;
  color: #7030a0;
  font-size: 1.1em;
}

.ex-summary-table .ex-sum-vitals {
  font-weight: 400;
  color: #555;
  font-size: 0.75em;
}

.ex-summary-divider {
  text-align: center;
  font-style: italic;
  color: #2a9d8f;
  font-size: 0.9em;
  padding: 6px 0;
  border-bottom: 1px solid #e0e0e0;
}

.ex-summary-change {
  text-align: center;
  font-size: 1.05em;
  margin: 1em 0 0.5em;
  padding: 12px;
  border-radius: 10px;
  background: #e8f5e9;
  font-weight: 600;
  color: #2e7d32;
}

.ex-summary-change.negative {
  background: #fbe5d6;
  color: #c0392b;
}

.ex-summary-feedback {
  margin-top: 1.2em;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 0.93em;
  line-height: 1.65;
  color: #333;
}

.ex-summary-feedback p { margin: 0 0 0.75em; }
.ex-summary-feedback p:last-child { margin-bottom: 0; }
.ex-summary-feedback ul { margin: 0.4em 0 0.75em 1.2em; padding: 0; }
.ex-summary-feedback li { margin-bottom: 0.4em; }

.ex-summary-feedback--positive {
  background: #e8f5e9;
  border-left: 4px solid #2e7d32;
}

.ex-summary-feedback--neutral {
  background: #e3f2fd;
  border-left: 4px solid #1565c0;
}

/* ─── Shared UI components ───────────────────────────────────────────────────── */

.ex-title {
  font-size: 1.55em;
  font-weight: 700;
  color: #1f4e79;
  margin: 0 0 0.3em;
}

.ex-subtitle {
  font-size: 1em;
  color: #555;
  margin: 0 0 0.8em;
}

.ex-label {
  display: block;
  font-size: 0.88em;
  font-weight: 600;
  color: #333;
  margin: 0.9em 0 0.3em;
}

.ex-input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 1em;
  outline: none;
  transition: border-color 0.2s;
}

.ex-input:focus { border-color: #2a9d8f; }

.ex-btn {
  display: inline-block;
  padding: 12px 22px;
  border: none;
  border-radius: 12px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s;
  text-align: center;
}

.ex-btn:hover { filter: brightness(1.07); }
.ex-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.ex-btn-primary {
  background: linear-gradient(to bottom, #3ac5a0, #2a9d8f);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.ex-btn-secondary {
  background: #e8e8e8;
  color: #444;
  box-shadow: none;
}

/* Halványabb, kevésbé hívogató felirat, mint a többi másodlagos gomb. */
#ex-btn-finish-early {
  color: #999;
}

.ex-btn-large {
  font-size: 1.12em;
  padding: 14px 28px;
  border-radius: 14px;
}

.ex-msg-error {
  background: #fdecea;
  border-left: 4px solid #d32f2f;
  border-radius: 8px;
  padding: 10px 14px;
  color: #c62828;
  font-size: 0.92em;
  margin: 0.6em 0;
}

/* ─── Mobile ─────────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .ex-screen { padding: 12px 8px 32px; }
  .ex-card { padding: 22px 16px; }
  .ex-result-value { font-size: 2.6em; }
}

/* ─── Screen: History ────────────────────────────────────────────────────────── */

.ex-screen-history { background: #f4f8fb; }

.ex-history-group { margin-bottom: 1.4em; }

.ex-history-group-header {
  background: #daeaf6;
  border: 1px solid #7aaac8;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 10px 12px;
  text-align: center;
}

.ex-hist-group-date {
  font-weight: 400;
  color: #1f4e79;
  font-size: 1em;
  margin-bottom: 2px;
}

.ex-hist-group-level {
  font-size: 0.88em;
  font-weight: 600;
  color: #2a7a6e;
  margin-bottom: 4px;
}

.ex-hist-group-avgs {
  font-size: 0.82em;
  color: #444;
}

.ex-hist-avg-val {
  font-size: 1.25em;
  font-weight: 700;
  color: #7030a0;
}

/* border-separate + border-spacing:0 avoids overflow:hidden/border-collapse conflict */
.ex-hist-table-wrap {
  border: 1px solid #7aaac8;
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.ex-hist-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.ex-col-time    { width: 22%; }
.ex-col-cp-edge { width: 15%; }
.ex-col-change  { width: 9%; }
.ex-col-del     { width: 22px; }

.ex-hist-table td {
  padding: 2px 2px;
  background: #fff;
  border-right: 1px solid #7aaac8;
  border-bottom: 0.5px solid #7aaac8;
  vertical-align: top;
  font-size: 0.86em;
  overflow: hidden;
}

.ex-hist-table td:last-child  { border-right: none; }
.ex-hist-table tr:last-child td { border-bottom: none; }

/* Napváltás: az adott napot kezdő sor vastagabb felső vonalat kap, hogy a napok egyértelműen
   elváljanak az ugyanazon a napon belüli (vékony) sorválasztóktól. */
.ex-hist-daybreak td { border-top: 1px solid #7aaac8; }

.ex-hist-time {
  font-size: 0.78em;
  color: #444;
  white-space: nowrap;
  padding-left: 4px !important;
}

.ex-hist-audio {
  font-size: 0.88em;
  font-style: italic;
  color: #2a9d8f;
}

.ex-hist-cp-val {
  text-align: center;
  font-weight: 400;
  color: #1f4e79;
}

.ex-hist-vitals {
  font-size: 0.78em;
  font-weight: 400;
  color: #888;
  white-space: nowrap;
}

/* A pulzus (és a hozzá tartozó %-os változás) a táblázat vonalánál (#7aaac8) halványabb
   vonallal elválasztva jelenik meg a fölötte lévő értékektől. */
.ex-hist-vitals-sep {
  display: block;
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px solid #e0e0e0;
}

.ex-hist-vitals-hi {
  color: #c0392b;
}

.ex-hist-vitals-lo {
  color: #2e7d32;
}

.ex-hist-change {
  text-align: right;
  font-weight: 700;
  font-size: 0.82em;
  white-space: nowrap;
  padding-right: 4px !important;
  /* Vastagabb elválasztó a KSZ-oszlopoktól, mint az Összegzés oszlop – lásd .ex-hist-daybreak. */
  border-left: 1px solid #7aaac8;
}

.ex-hist-change.positive { color: #2e7d32; }
.ex-hist-change.negative { color: #c0392b; }
.ex-hist-change.neutral  { color: #888; }

.ex-hist-del { text-align: center; padding: 0 !important; }
.ex-hist-del-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 0.85em;
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 4px;
  line-height: 1;
}
.ex-hist-del-btn:hover   { color: #e53935; background: #ffeaea; }
.ex-hist-del-btn:disabled { opacity: 0.4; cursor: default; }

.ex-hist-pct {
  font-size: 0.78em;
  font-weight: 600;
  opacity: 0.75;
}

.ex-hist-pairs {
  white-space: normal;
  padding-left: 4px !important;
}

.ex-hist-pair {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 6px;
  margin: 0 10px 4px 0;
}

.ex-hist-pair-val {
  font-weight: 400;
  color: #1f4e79;
}

.ex-hist-pair-activity {
  font-size: 0.85em;
  font-style: italic;
  color: #777;
}

.ex-hist-pair-del {
  font-size: 0.8em;
  padding: 1px 4px;
}

.ex-history-loading {
  text-align: center;
  color: #888;
  padding: 1em 0;
}

/* Keep screen awake hint (iOS Safari) */
#ex-wakelock-hint {
  font-size: 0.78em;
  color: #aaa;
  text-align: center;
  margin-top: 0.4em;
}
