:root {
  --ink: #f7f2ec;
  --muted: rgba(247, 242, 236, 0.74);
  --dark: #070914;
  --line: rgba(255, 255, 255, 0.18);
  --paper: #fffdf8;
  --paper-ink: #201a1d;
  --paper-muted: #6b5d62;
  --accent: #d8b26e;
  --accent-dark: #8d6a35;
  --shadow: 0 34px 90px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--dark);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -4;
  background-image: url("darina-bg.jpg");
  background-position: center 24%;
  background-size: cover;
  content: "";
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(circle at 62% 26%, rgba(255, 255, 255, 0.1), transparent 28%),
    linear-gradient(90deg, rgba(3, 5, 14, 0.86), rgba(6, 8, 20, 0.52) 46%, rgba(3, 5, 14, 0.84)),
    linear-gradient(180deg, rgba(3, 5, 14, 0.1), rgba(3, 5, 14, 0.68));
  content: "";
}

.app {
  position: relative;
  min-height: 100svh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  min-height: 100svh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 260ms ease, transform 260ms ease;
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.screen-invite {
  align-content: center;
  gap: 24px;
}

.invite-copy {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 24px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 10, 24, 0.58);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 11ch;
  margin: 0;
  font-family: "Russo One", "Manrope", sans-serif;
  font-size: clamp(2.45rem, 12vw, 5rem);
  line-height: 0.96;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.62);
}

.subtext {
  max-width: 34rem;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  font-weight: 700;
  line-height: 1.55;
}

.button-zone {
  position: relative;
  width: min(100%, 620px);
  min-height: 190px;
  margin: 0 auto;
}

.btn {
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 150ms ease, filter 150ms ease, left 190ms ease, top 190ms ease;
}

.btn:active {
  transform: translateY(2px) scale(0.98);
}

.btn-yes {
  position: absolute;
  left: 0;
  bottom: 22px;
  width: min(78vw, 360px);
  min-height: 68px;
  padding: 0 22px;
  color: #1d1710;
  background: linear-gradient(135deg, #f3d79e, #c89646);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
  font-size: clamp(1.08rem, 5vw, 1.45rem);
}

.btn-yes:hover {
  filter: brightness(1.06);
}

.btn-no {
  position: absolute;
  right: 6px;
  top: 16px;
  min-width: 94px;
  min-height: 48px;
  padding: 0 18px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.btn-no.is-running {
  transition: left 180ms cubic-bezier(0.2, 0.9, 0.2, 1.2), top 180ms cubic-bezier(0.2, 0.9, 0.2, 1.2), transform 180ms ease;
}

.screen-tease,
.screen-contract,
.screen-final {
  place-items: center;
}

.tease-box,
.final-card {
  width: min(100%, 500px);
  padding: 26px 20px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 10, 24, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.tease-box h2,
.final-card h2 {
  margin: 0;
  font-family: "Russo One", "Manrope", sans-serif;
  font-size: clamp(2.05rem, 9vw, 3.8rem);
  line-height: 1;
  text-transform: uppercase;
}

.tease-box p,
.final-card p {
  color: var(--muted);
  font-weight: 700;
}

.contract {
  position: relative;
  width: min(100%, 900px);
  max-height: calc(100svh - 34px);
  overflow: auto;
  padding: clamp(24px, 5vw, 52px);
  color: var(--paper-ink);
  background:
    linear-gradient(90deg, rgba(141, 106, 53, 0.08), transparent 18%, transparent 82%, rgba(141, 106, 53, 0.08)),
    var(--paper);
  border: 1px solid rgba(88, 72, 58, 0.32);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.contract-header {
  display: grid;
  gap: 10px;
  padding-bottom: 22px;
  border-bottom: 2px solid rgba(32, 26, 29, 0.18);
  text-align: center;
}

.contract-header p,
.contract-header span {
  margin: 0;
  color: var(--paper-muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.contract-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 7vw, 3.2rem);
  line-height: 1.04;
  text-transform: uppercase;
}

.contract-body {
  display: grid;
  gap: 12px;
  padding: 24px 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.02rem, 3.5vw, 1.22rem);
  line-height: 1.72;
}

.contract-body h3 {
  margin: 10px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 3.8vw, 1.28rem);
  text-transform: uppercase;
}

.contract-body p {
  margin: 0;
  text-align: justify;
}

.contract-intro {
  padding-bottom: 8px;
}

.signature-area {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.signature-area label {
  color: var(--paper-muted);
  font-weight: 900;
}

#signatureCanvas {
  display: block;
  width: 100%;
  height: 170px;
  background:
    linear-gradient(transparent 72%, rgba(32, 26, 29, 0.18) 72% 73%, transparent 73%),
    #fff;
  border: 1px solid rgba(32, 26, 29, 0.24);
  border-radius: 6px;
  touch-action: none;
}

.signature-actions {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 10px;
}

.icon-btn {
  min-height: 54px;
  border: 1px solid rgba(32, 26, 29, 0.18);
  border-radius: 8px;
  background: #fff;
  color: var(--paper-ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.btn-sign {
  min-height: 54px;
  padding-inline: 14px;
  color: #1d1710;
  background: linear-gradient(135deg, #f1d69d, #c39044);
}

.tiny-note {
  position: absolute;
  left: 18px;
  bottom: 7px;
  margin: 0;
  color: rgba(32, 26, 29, 0.075);
  font-size: 0.46rem;
  line-height: 1;
  text-align: left;
  transform: rotate(-1deg);
  pointer-events: none;
  user-select: none;
}

.telegram-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  margin-top: 10px;
  padding: 0 20px;
  color: #1d1710;
  font-weight: 900;
  text-decoration: none;
  background: linear-gradient(135deg, #f1d69d, #c39044);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.send-status {
  min-height: 22px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 520px) {
  body::before {
    background-position: center 24%;
  }

  .screen-invite {
    align-content: end;
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }

  .button-zone {
    min-height: 178px;
  }

  .btn-yes {
    width: min(82vw, 340px);
  }

  .contract {
    max-height: calc(100svh - 20px);
    padding: 24px 18px;
  }

  #signatureCanvas {
    height: 150px;
  }

  .signature-actions {
    grid-template-columns: 1fr;
  }
}
