* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: #000;
  font-family: "Courier New", monospace;
}

body {
  margin: 0;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: #000;
}

.video-wrapper,
.final-screen,
.loading-screen,
.skills-screen {
  position: absolute;
  inset: 0;
}

.video-wrapper {
  z-index: 1;
  background: #000;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  background: #000;
}

.loading-screen {
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #87ceeb 0%, #b8ecff 100%);
  color: #1d3557;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 20px;
}

.loading-screen.show {
  opacity: 1;
  visibility: visible;
}

.kid-cloud {
  background: #fff;
  border: 4px solid #000;
  border-radius: 22px;
  padding: 18px 26px;
  font-size: clamp(1rem, 3vw, 1.3rem);
  font-weight: bold;
  transform: rotate(-2deg);
  box-shadow: 6px 6px 0 #000;
  margin-bottom: 18px;
}

.kid-progress-wrap {
  width: min(360px, 85vw);
  background: #fff7a8;
  border: 4px solid #000;
  border-radius: 18px;
  padding: 8px;
  box-shadow: 6px 6px 0 #000;
  transform: rotate(1deg);
}

.kid-progress {
  width: 0;
  height: 28px;
  border-radius: 12px;
  background: repeating-linear-gradient(
    45deg,
    #ff6b6b 0px,
    #ff6b6b 18px,
    #ffd93d 18px,
    #ffd93d 36px,
    #6bcb77 36px,
    #6bcb77 54px,
    #4d96ff 54px,
    #4d96ff 72px
  );
  border: 3px solid #000;
}

.loading-screen.show .kid-progress {
  animation: kidLoad 3s linear forwards;
}

@keyframes kidLoad {
  from { width: 0; }
  to { width: 100%; }
}

.final-screen {
  z-index: 5;
  opacity: 0;
  visibility: hidden;
  background: url('background.png') center center / cover no-repeat;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.final-screen.show {
  opacity: 1;
  visibility: visible;
}

.character {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-100%);
  width: min(300px, 35vw);
  max-width: 500px;
  min-width: 160px;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 7;
}

.controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 8;
  pointer-events: none;
}

.btn-move {
  width: 82px;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
}

.btn-right {
  transform: scaleX(-1);
}

.dialogue-box {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(930px, calc(100% - 18px));
  min-height: 138px;
  background: #e8f8d8;
  border: 4px solid #1c1c1c;
  box-shadow: inset 0 0 0 4px #c8d8a8, 4px 4px 0 #1c1c1c;
  padding: 14px 16px 30px;
  z-index: 10;
  display: none;
  cursor: pointer;
}

.dialogue-box.show {
  display: block;
}

.dialogue-name {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 8px;
  background: #d8e8b8;
  border: 3px solid #1a1a1a;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #111;
}

.dialogue-text {
  color: #111;
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.45;
  white-space: pre-wrap;
}

.dialogue-next {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: #111;
  font-size: 1rem;
  animation: blink 0.8s infinite alternate;
}

.question-box {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(930px, calc(100% - 18px));
  min-height: 140px;

  background: #e8f8d8;
  border: 4px solid #1c1c1c;
  box-shadow: inset 0 0 0 4px #c8d8a8, 4px 4px 0 #1c1c1c;

  padding: 14px 16px 20px;
  z-index: 11;

  display: none;
  flex-direction: column;
  gap: 12px;
}

.question-box.show {
  display: flex;
}

.question-title {
  color: #111;
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.45;
}

.choice-btn {
  font-family: inherit;
  font-size: 0.95rem;
  color: #111;
  background: #ece9d8;
  border: 2px solid #000;
  border-top-color: #fff;
  border-left-color: #fff;
  border-right-color: #7f7f7f;
  border-bottom-color: #7f7f7f;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
}

.choice-btn:active {
  border-top-color: #7f7f7f;
  border-left-color: #7f7f7f;
  border-right-color: #fff;
  border-bottom-color: #fff;
}

.skills-screen {
  z-index: 12;
  display: none;
  pointer-events: none;
}

.skills-screen.show {
  display: block;
}

.skills-card {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 30px));
  max-height: 84vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: #ece9d8;
  border: 2px solid #000;
  border-top-color: #fff;
  border-left-color: #fff;
  border-right-color: #7f7f7f;
  border-bottom-color: #7f7f7f;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  padding: 0;
  pointer-events: auto;
}

.skills-window-head {
  position: sticky;
  top: 0;
  z-index: 2;
  cursor: grab;
}

.skills-window-head:active {
  cursor: grabbing;
}

.skills-card h2 {
  font-size: 1.05rem;
  color: #fff;
  margin: 0;
  background: linear-gradient(to right, #0a246a, #3a6ea5);
  padding: 8px 10px;
  font-weight: bold;
}

.skills-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  background: #c0504d;
  color: #fff;
  font-weight: bold;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.45);
}

.skills-content {
  padding: 16px 14px 14px;
}

.skills-card p {
  color: #222;
  margin-bottom: 16px;
  line-height: 1.5;
  font-size: 0.96rem;
}

.skill {
  margin-bottom: 16px;
}

.skill-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.98rem;
  color: #111;
  margin-bottom: 6px;
  font-weight: bold;
  text-transform: uppercase;
}

.skill-bar {
  height: 24px;
  border: 3px solid #111;
  background: #d8d8d8;
  overflow: visible;
  position: relative;
}

.skill-fill {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    #3b82f6 0px,
    #3b82f6 12px,
    #93c5fd 12px,
    #93c5fd 24px
  );
  border-right: 3px solid #111;
}

.skill-fill.purple {
  background: repeating-linear-gradient(
    90deg,
    #a855f7 0px,
    #a855f7 12px,
    #d8b4fe 12px,
    #d8b4fe 24px
  );
}

.skill-fill.orange {
  background: repeating-linear-gradient(
    90deg,
    #f97316 0px,
    #f97316 12px,
    #fdba74 12px,
    #fdba74 24px
  );
}

/* Creativity skill — placeholder visible dans la carte */
.creativity-skill {
  margin-bottom: 16px;
}

.creativity-placeholder {
  height: 30px;
}

.overdrive-bar {
  position: fixed;
  height: 30px;
  background: repeating-linear-gradient(
    90deg,
    #a855f7 0px,
    #a855f7 12px,
    #d8b4fe 12px,
    #d8b4fe 24px
  );
  border-top: 3px solid #111;
  border-bottom: 3px solid #111;
  z-index: 9999;
  pointer-events: none;
  display: none;
}

.overdrive-bar.show {
  display: block;
}

@keyframes blink {
  from { opacity: 0.2; }
  to { opacity: 1; }
}

@media (max-width: 640px) {
  .controls {
    padding: 0 14px;
  }

  .btn-move {
    width: 66px;
  }

  .question-box {
    right: 12px;
    bottom: 182px;
    width: 160px;
  }

  .dialogue-box {
    min-height: 165px;
  }

  .skills-card {
    top: 40px;
  }
}

.loading-screen {
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
}

.loading-screen.show {
  opacity: 1;
  visibility: visible;
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loader-img {
  width: 80px;
  height: 100px;
  animation: spin 1s linear infinite;
}

.loader-text {
  color: #fff;
  font-size: 1rem;
  letter-spacing: 1px;
}

.question-actions {
  display: flex;
  gap: 10px;
}

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