:root {
  --saffron: #FF9933;
  --green: #138808;
  --ink: #141414;
  --rec: #e02424;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #fff3e0;
  color: #fff;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px env(safe-area-inset-right) calc(10px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  background: linear-gradient(180deg,
    #ff9933 0%,
    #ffb24d 10%,
    #fff3e0 38%,
    #eef9ec 60%,
    #76c073 86%,
    #138808 100%);
}

/* ---- Header (language switcher + welcome) ---- */
.apphead {
  width: min(94vw, 60vh);
  text-align: center;
  margin-bottom: 10px;
}
.lang-switch {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 10px;
}
.lang-btn {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #5a3100;
  padding: 6px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.lang-btn.active {
  background: #138808;
  color: #fff;
  border-color: #0f6a06;
}
.welcome {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  opacity: 0.96;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ---- Stage (square poster + camera) ---- */
.stage-wrap {
  position: relative;
  width: min(94vw, 60vh);
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  background: #000;
}

#stage,
.playback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.playback { background: #000; object-fit: fill; }

/* ---- Timer / REC indicator ---- */
.timer {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.62);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.timer .maxtime { opacity: 0.6; font-weight: 500; }
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--rec);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

/* ---- Overlay (start / status) ---- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(160deg, rgba(255,153,51,0.92), rgba(0,0,0,0.78) 55%, rgba(19,136,8,0.92));
  padding: 24px;
  z-index: 3;
}
.overlay.hidden { display: none; }
.ov-inner { max-width: 320px; }
.ov-title { font-size: 20px; font-weight: 800; line-height: 1.35; }
.ov-sub { margin-top: 6px; font-size: 14px; opacity: 0.9; }
.ov-msg { margin-top: 14px; font-size: 13px; color: #ffd9d9; min-height: 18px; }

/* ---- Controls ---- */
.controls {
  width: min(94vw, 60vh);
  margin-top: 14px;
}
.btnrow {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btnrow.hidden,
.hidden { display: none !important; }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 15px 22px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-height: 54px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-start {
  background: #fff; color: #b1360a; margin-top: 22px;
  flex: 0 0 auto; padding: 14px 30px; font-size: 17px;
}
.btn-ghost { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255,255,255,0.3); }
.btn-record { background: var(--rec); }
.btn-record .dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; }
.btn-stop { background: #111; border: 2px solid var(--rec); color: #fff; }
.btn-submit { background: var(--green); }

/* ---- Thank you ---- */
.thankyou {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--saffron), #ffffff 50%, var(--green));
}
.thankyou.hidden { display: none; }
.ty-card {
  background: #fff;
  color: var(--ink);
  border-radius: 20px;
  padding: 34px 26px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}
.ty-check {
  width: 76px; height: 76px; margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 42px;
  display: flex; align-items: center; justify-content: center;
}
.ty-card h1 { margin: 0; font-size: 26px; color: var(--saffron); }
.ty-card h2 { margin: 2px 0 10px; font-size: 20px; }
.ty-card p { margin: 0 0 22px; color: #555; font-size: 15px; line-height: 1.5; }
.ty-card .btn-submit { display: inline-flex; flex: 0 0 auto; padding: 14px 28px; }

/* Upload progress bar inside overlay */
.progress {
  margin-top: 16px;
  width: 220px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: #fff;
  transition: width 0.2s ease;
}
