:root {
  --ink: #111;
  --paper: #fff;
  --desk: #e8e8e2;
  --accent: #164f7a;
  --rule: #222;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--desk);
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 12px;
  background: #f8f8f6;
  border-bottom: 1px solid #c8c8c0;
}

button,
.button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #9da8ad;
  border-radius: 6px;
  background: #fff;
  color: #10212c;
  font: 600 14px/36px Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

#printBtn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button:focus-visible,
.button:focus-visible,
input:focus-visible {
  outline: 2px solid #2274a5;
  outline-offset: 2px;
}

.page {
  width: min(100%, 840px);
  margin: 24px auto;
  padding: 0 14px;
}

form {
  width: 100%;
  max-width: 700px;
  min-height: 990px;
  margin: 0 auto;
  padding: 86px 72px 86px;
  background: var(--paper);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.18);
  font-size: 16px;
  line-height: 1.45;
}

h1 {
  margin: 0 0 76px;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
}

p {
  margin: 0 0 27px;
}

.versus {
  margin: 52px 0 52px;
  text-align: center;
  font-weight: 700;
}

.line {
  display: inline-block;
  width: var(--line-width, var(--min-line-width, 90px));
  min-width: var(--min-line-width, 90px);
  max-width: calc(100% - 10px);
  height: 28px;
  margin: 0 2px;
  padding: 0 4px 2px;
  border: 0;
  border-bottom: 2px dotted var(--rule);
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1;
  vertical-align: baseline;
}

.court {
  --min-line-width: 400px;
}

.case-line {
  --min-line-width: 500px;
}

.party-line {
  --min-line-width: 355px;
}

.defendant-line {
  --min-line-width: 330px;
}

.full-line {
  --min-line-width: 100%;
}

.instructed-by {
  --min-line-width: 180px;
}

.instructed-party {
  --min-line-width: 380px;
}

.date-line {
  --min-line-width: 120px;
}

.footer-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 40px;
  margin-top: 74px;
}

.advocate-label {
  min-width: 130px;
  text-align: center;
  font-weight: 700;
}

@media (max-width: 720px) {
  .page {
    margin: 12px auto;
    padding: 0 8px;
  }

  form {
    padding: 52px 22px 64px;
    font-size: 18px;
  }

  h1 {
    margin-bottom: 46px;
    font-size: 24px;
  }

  .court,
  .case-line,
  .party-line,
  .defendant-line,
  .instructed-by,
  .instructed-party {
    --min-line-width: min(100%, 260px);
  }

  .footer-line {
    flex-wrap: wrap;
  }
}

@media print {
  @page {
    size: A4;
    margin: 16mm;
  }

  body {
    background: #fff;
  }

  .toolbar {
    display: none;
  }

  .page {
    width: auto;
    margin: 0;
    padding: 0;
  }

  form {
    width: auto;
    max-width: none;
    min-height: auto;
    margin: 0;
    padding: 0;
    box-shadow: none;
    font-size: 16pt;
  }

  h1 {
    font-size: 21pt;
  }

  .line {
    border-bottom-color: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
