/* ── Page shell — centers everything on desktop, full-bleed on mobile ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f4f0;
  color: #1a1a18;
  margin: 0;
  padding: 0;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

/* White card that contains the whole app */
.widget-container {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border: 0.5px solid #d3d1c7;
  border-radius: 16px;
  padding: 28px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Language selector ── */
.selectionTainer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.selectionTainer label {
  font-size: 13px;
  font-weight: 500;
  color: #5f5e5a;
  white-space: nowrap;
}

#selectExercise {
  flex: 1;
  min-width: 160px;
  height: 36px;
  padding: 0 28px 0 12px;
  border: 0.5px solid #c4c2b8;
  border-radius: 8px;
  background: #f5f4f0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%235f5e5a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  font-size: 14px;
  color: #1a1a18;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

#selectExercise:focus {
  border-color: #378add;
  box-shadow: 0 0 0 2px rgba(55, 138, 221, 0.15);
}

/* ── Avatar canvas — fills card width, maintains 3:4 ratio ── */
.sign2me-canvas-container-sign2me-widget {
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 4;
  display: block;
  position: relative;
}

#sign2me-canvas-sign2me-widget {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: cover;
}

/* ── Playback controls ── */
.sign2me-controls-wrapper-sign2me-widget {
  background: #f5f4f0 !important;
  border: 0.5px solid #d3d1c7 !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  margin: 10px 0 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.sign2me-media-control-sign2me-widget {
  width: 34px !important;
  height: 34px !important;
  border-radius: 8px !important;
  border: 0.5px solid #c4c2b8 !important;
  background-color: #fff !important;
  background-size: 55% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  transition: background-color 0.12s;
}

.sign2me-media-control-sign2me-widget:hover {
  background-color: #ebe9e3 !important;
}

.sign2me-slider-sign2me-widget {
  flex: 1 !important;
  height: 4px !important;
  background: #c4c2b8 !important;
  border-radius: 4px !important;
  outline: none !important;
  border: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  cursor: pointer !important;
  min-width: 60px;
}

.sign2me-slider-sign2me-widget::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #378add;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(55, 138, 221, 0.3);
  cursor: grab;
}

.sign2me-slider-sign2me-widget:active::-webkit-slider-thumb {
  cursor: grabbing;
}

.sign2me-slider-sign2me-widget::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #378add;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(55, 138, 221, 0.3);
  cursor: grab;
  border: none;
}

/* ── Answer area ── */
.feedbackArea {
  position: relative;
  width: 100%;
  min-height: 40px;
  margin: 0;
}

.buildanswer {
  border-bottom: 2px solid #c4c2b8;
  min-height: 32px;
  padding: 4px 0;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a18;
  letter-spacing: 0.01em;
  width: 100%;
}

.feedback {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 16px;
  background: #1d9e75;
  color: #fff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  position: absolute;
  right: 0;
  top: 0;
}

/* ── Error ── */
.error-message {
  color: #a32d2d;
  font-size: 13px;
  min-height: 16px;
  margin: 0;
  display: block;
  width: 100%;
}

/* ── Word buttons ── */
.isolatedWords {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
}

.wordbutton {
  padding: 11px 18px !important;
  margin: 0 !important;
  width: auto !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  letter-spacing: 0.04em !important;
  border: 0.5px solid #c4c2b8 !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: #1a1a18 !important;
  cursor: pointer !important;
  white-space: nowrap;
  transition: background 0.12s, transform 0.08s;
}

.wordbutton:hover {
  background: #f0ede5 !important;
  border-color: #888780 !important;
}

.wordbutton:active {
  transform: scale(0.96);
}

.wordbutton[style*="visibility: hidden"],
.wordbutton[style*="visibility:hidden"] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

/* ── Next button — full width ── */
.btnNext {
  width: 100% !important;
  margin: 4px 0 0 !important;
  padding: 13px 0 !important;
  background: #378add !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  letter-spacing: 0.01em;
  transition: background 0.15s;
}

.btnNext:hover {
  background: #185fa5 !important;
}


/* mobile */

@media (max-width: 600px) {
  .page-shell {
    padding: 0;
    max-height: 100dvh;
    justify-content: flex-start;
  }

  .widget-container {
    max-width: 100% !important;
    width: 80% !important;
    height:     70dvh;
    overflow: hidden;
    border-radius: 0 !important;
    border: none !important;
    padding: 12px 16px 16px !important;
    gap: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  /* Avatar takes remaining space but never overflows */
  .sign2me-canvas-container-sign2me-widget {
    border-radius: 8px !important;
    aspect-ratio: unset !important;
    flex: 1 1 0;
    min-height: 0;        /* critical — allows flex child to shrink below content size */
    overflow: hidden;
  }

  #sign2me-widget,
  .sign2me-wrapper-sign2me-widget {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0;
    min-height: 0;
  }

  #sign2me-canvas-sign2me-widget {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }

  .sign2me-controls-wrapper-sign2me-widget {
    flex-shrink: 0;
  }

  .feedbackArea {
    flex-shrink: 0;
    min-height: 36px;
    margin: 5% 0 !important;
	max-width:80%;
  }

  .isolatedWords {
    flex-shrink: 0;
  }

  .wordbutton {
    padding: 13px 16px !important;
    font-size: 12px !important;
  }

  .btnNext {
    flex-shrink: 0;
    padding: 15px 0 !important;
    font-size: 16px !important;
  }
}