:root {
  --blue: #002bcb;
  --orange: #ff650d;
  --white: #ffffff;
  --green: #29d137;
  --danger: #ff1b11;
  --text-soft: rgba(255, 255, 255, 0.86);
  --shell-width: min(100vw, 430px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--blue);
  color: var(--white);
}

.app {
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

.phone-shell {
  width: var(--shell-width);
  min-height: 100vh;
  margin: 0 auto;
  padding: 38px 22px 28px;
  background:
    url("/assets/images/bg_app.png") center / cover no-repeat,
    var(--blue);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  width: min(240px, 70vw);
  display: block;
  margin: 16px auto 32px;
}

.screen-title {
  width: 100%;
  margin: 0 0 20px;
  text-align: center;
  font-size: clamp(1.6rem, 5.4vw, 2.1rem);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.screen-title.compact {
  font-size: clamp(1.02rem, 3.7vw, 1.28rem);
  line-height: 1.08;
}

.home-title {
  font-size: clamp(1.35rem, 4.7vw, 1.78rem);
}

.template-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 18px;
}

.template-button {
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.78);
  background: transparent;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: none;
  cursor: pointer;
}

.template-button.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(41, 209, 55, 0.32);
}

.template-button img,
.template-poster {
  display: block;
  width: 100%;
  aspect-ratio: 0.74;
  object-fit: cover;
  border-radius: 12px;
}

.template-button img {
  border-radius: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 23, 100, 0.54);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  z-index: 30;
}

.modal-card {
  width: min(100%, 530px);
  background: #fff;
  color: var(--blue);
  border-radius: 22px;
  padding: 26px 26px 24px;
  box-shadow: 0 28px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.modal-card h2 {
  margin: 2px 0 22px;
  font-size: clamp(0.9rem, 3.5vw, 1.2rem);
  line-height: 1.1;
}

.modal-art {
  width: min(62vw, 290px);
  margin: 0 auto 24px;
  border-radius: 12px;
  overflow: hidden;
}

.panel {
  width: 100%;
  border: 2px solid rgba(255, 255, 255, 0.84);
  border-radius: 24px;
  padding: 30px 20px 28px;
  position: relative;
  text-align: center;
}

.panel-title {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  min-width: 58%;
  background: var(--orange);
  border-radius: 18px;
  padding: 10px 18px;
  font-size: clamp(0.88rem, 3.2vw, 1.08rem);
  font-weight: 800;
}

.instructions-poster {
  width: min(64vw, 290px);
  margin: 18px auto 20px;
}

.instructions-copy {
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(0.84rem, 3.15vw, 1rem);
  line-height: 1.22;
  font-weight: 600;
}

.instructions-copy + .instructions-copy {
  margin-top: 14px;
}

.actions {
  width: 100%;
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.action-button {
  width: 100%;
  min-height: 68px;
  border-radius: 999px;
  border: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 20px;
  font-size: clamp(1rem, 3.9vw, 1.28rem);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.action-button.primary {
  background: var(--white);
  color: var(--blue);
}

.action-button.orange {
  background: var(--orange);
  color: var(--white);
}

.action-button.outline {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.86);
}

.action-button.subtle {
  background: var(--white);
  color: var(--blue);
}

.action-button.small {
  min-height: 58px;
  font-size: clamp(0.92rem, 3.5vw, 1.12rem);
}

.button-icon,
.inline-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
}

.inline-icon {
  vertical-align: middle;
  margin-right: 8px;
}

.button-icon.large {
  width: 32px;
  height: 32px;
}

.recording-poster {
  width: min(100%, 328px);
  margin: 0 auto 22px;
  border-radius: 26px;
  overflow: hidden;
  position: relative;
  background: rgba(0, 0, 0, 0.22);
}

.recording-poster img,
.recording-poster video {
  width: 100%;
  display: block;
  aspect-ratio: 0.74;
  object-fit: cover;
  border-radius: 26px;
  background: #000;
}

.recording-poster.dimmed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
}

.countdown-number {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: clamp(6rem, 28vw, 10rem);
  z-index: 2;
}

.rec-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 54px);
  z-index: 2;
}

.rec-chip {
  width: 100%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(0, 0, 0, 0.28);
  font-size: clamp(1.1rem, 5vw, 1.85rem);
  font-weight: 800;
}

.rec-chip-main {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.rec-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ff1b11;
}

.rec-time-left {
  font-size: clamp(1rem, 4vw, 1.4rem);
  opacity: 0.88;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--white);
  border-radius: inherit;
  transition: width 0.25s linear;
}

.progress-fill.red {
  background: #ff1b11;
}

.mic-stage {
  width: 100%;
  text-align: center;
  margin-top: 8px;
}

.mic-button,
.stop-button,
.status-icon {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
}

.mic-button,
.stop-button {
  appearance: none;
  border: none;
  background: transparent;
  width: 110px;
  height: 110px;
  cursor: pointer;
}

.mic-button img,
.stop-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mic-copy {
  margin: 24px 0 0;
  font-size: clamp(1.02rem, 4.1vw, 1.42rem);
  line-height: 1.05;
  font-weight: 800;
}

.processing-wrap {
  margin-top: 56px;
  width: 100%;
  text-align: center;
}

.status-icon {
  width: 126px;
  height: 126px;
  margin: 0 auto 24px;
  background: var(--orange);
}

.status-icon img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.processing-title {
  margin: 0 0 20px;
  font-size: clamp(1.6rem, 5.9vw, 2.15rem);
  line-height: 1.06;
  font-weight: 800;
}

.processing-subtitle {
  margin: 14px 0 0;
  font-size: clamp(0.98rem, 3.8vw, 1.2rem);
  color: var(--text-soft);
}

.preview-video-wrap {
  width: min(100%, 330px);
  border-radius: 26px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.28);
  margin: 0 auto 24px;
}

.preview-video {
  width: 100%;
  display: block;
  aspect-ratio: 0.74;
  object-fit: cover;
  background: #000;
}

.qr-card {
  width: min(100%, 290px);
  background: var(--white);
  color: var(--blue);
  border-radius: 28px;
  padding: 26px 18px 22px;
  text-align: center;
}

.qr-image {
  display: block;
  width: 100%;
  max-width: 206px;
  margin: 0 auto 18px;
  image-rendering: pixelated;
}

.qr-fallback {
  color: var(--blue);
  font-size: 0.95rem;
  word-break: break-word;
}

.qr-helper {
  margin: 0;
  font-size: clamp(0.88rem, 3.4vw, 1.02rem);
  line-height: 1.2;
  font-weight: 700;
}

.timer-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.timer-label {
  font-weight: 700;
  font-size: clamp(0.9rem, 3.4vw, 1rem);
}

.hidden {
  display: none !important;
}

@media (min-width: 768px) {
  body {
    background: var(--blue);
  }
}
