:root {
  --wall: #e9ddc5;
  --paper: #fff6df;
  --paper-alt: #f5e8ca;
  --ink: #0d0c0a;
  --muted: #564b3b;
  --line: #5e513f;
  --wine: #5f111b;
  --gold: #b58512;
  --blue: #172d48;
  font-family: Georgia, "Times New Roman", "Noto Serif Hebrew", "David Libre", serif;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(13, 12, 10, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(13, 12, 10, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 10% 14%, rgba(95, 17, 27, 0.08), transparent 30%),
    var(--wall);
  background-size: 36px 36px, 36px 36px, auto, auto;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  min-height: 100vh;
  padding: 32px 18px 48px;
  display: grid;
  gap: 14px;
  align-content: start;
  place-items: center;
}

.notice {
  position: relative;
  width: min(900px, 100%);
  min-height: 660px;
  padding: 46px 56px;
  border: 8px solid var(--ink);
  background:
    radial-gradient(ellipse at 50% 18%, rgba(95, 17, 27, 0.08), transparent 34%),
    linear-gradient(90deg, rgba(13, 12, 10, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(13, 12, 10, 0.03) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px, 34px 34px, auto;
  box-shadow: 16px 16px 0 var(--ink), 0 24px 70px rgba(13, 12, 10, 0.24);
}

.notice::before,
.notice::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.notice::before {
  inset: 14px;
  border: 3px double var(--ink);
}

.notice::after {
  inset: 28px;
  border: 1px solid rgba(13, 12, 10, 0.45);
}

.corner {
  position: absolute;
  top: 52px;
  z-index: 1;
  color: var(--muted);
  font-weight: 900;
}

.corner.left {
  left: 64px;
}

.corner.right {
  right: 64px;
}

.notice-header,
.message-preview,
.ornament-band,
.controls {
  position: relative;
  z-index: 1;
}

.notice-header {
  width: min(720px, 100%);
  margin: 0 auto;
  text-align: center;
}

.notice-type {
  width: fit-content;
  margin: 0 auto 8px;
  padding: 8px 24px;
  border-top: 4px solid var(--ink);
  border-bottom: 4px solid var(--ink);
  background: #fffaf0;
  box-shadow: 4px 4px 0 rgba(13, 12, 10, 0.18);
  font-size: 1.55rem;
  font-weight: 900;
}

.notice h1 {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 8px double var(--wine);
  font-size: clamp(4.7rem, 10.8vw, 8.9rem);
  line-height: 0.86;
  letter-spacing: 0;
  text-shadow: 5px 5px 0 rgba(13, 12, 10, 0.08);
}

.message-preview {
  width: min(690px, 100%);
  margin: 18px auto 0;
  padding: 22px 24px 28px;
  border-bottom: 6px solid var(--wine);
  text-align: center;
}

.to-line {
  margin: 0;
  color: var(--wine);
  font-size: 1.35rem;
  font-weight: 900;
}

.recipient {
  max-width: 17ch;
  margin: 8px auto 0;
  color: var(--wine);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.reason {
  margin: 18px auto 0;
  font-size: clamp(1.14rem, 2.6vw, 1.55rem);
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.sender {
  margin: 18px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.1vw, 1.22rem);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.notice-ornaments {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.ornament {
  position: absolute;
  width: 66px;
  height: 66px;
  opacity: 0.9;
}

.ornament::before,
.ornament::after {
  content: "";
  position: absolute;
  background: var(--wine);
}

.ornament::before {
  width: 100%;
  height: 5px;
}

.ornament::after {
  width: 5px;
  height: 100%;
}

.ornament-top-left {
  top: 50px;
  left: 56px;
}

.ornament-bottom-left {
  bottom: 52px;
  left: 56px;
  transform: rotate(-90deg);
}

.ornament-bottom-right {
  right: 56px;
  bottom: 52px;
  transform: rotate(180deg);
}

.editor-notice .ornament-bottom-left,
.editor-notice .ornament-bottom-right {
  display: none;
}

.ornament-band {
  width: min(470px, 72%);
  margin: 30px auto 0;
  display: grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  gap: 13px;
  align-items: center;
}

.ornament-band::before,
.ornament-band::after {
  content: "";
  height: 4px;
  border-top: 2px solid var(--wine);
  border-bottom: 2px solid var(--wine);
}

.ornament-band span {
  width: 15px;
  aspect-ratio: 1;
  border: 3px solid var(--wine);
  transform: rotate(45deg);
  background: var(--paper);
}

.ornament-band span:nth-child(2) {
  width: 23px;
  background: var(--wine);
}

.controls {
  width: min(690px, 100%);
  margin: 28px auto 0;
  padding: 20px;
  border: 4px solid var(--ink);
  background: var(--paper-alt);
  box-shadow: 8px 8px 0 var(--ink);
}

.info-foldout {
  position: relative;
  width: min(690px, 100%);
  z-index: 1;
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 6px 6px 0 var(--ink);
}

.info-foldout summary {
  min-height: 42px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 900;
}

.info-body {
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.42;
}

.info-body p {
  margin: 8px 0 0;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(260px, 1.25fr);
  gap: 16px;
}

.field-stack {
  display: grid;
  gap: 14px;
  align-content: start;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 0;
  background: #fffaf0;
  color: var(--ink);
  font-weight: 800;
  outline: none;
}

input {
  height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  padding: 11px 12px;
  line-height: 1.35;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--wine);
  box-shadow: 0 0 0 4px rgba(95, 17, 27, 0.15);
}

.control-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid rgba(13, 12, 10, 0.18);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.style-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 8px;
  align-items: center;
}

.style-label {
  grid-column: 1 / -1;
  font-weight: 900;
}

.style-button,
.plain-button {
  min-height: 42px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: #fffaf0;
  color: var(--muted);
  font-weight: 900;
}

.style-button.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 4px 4px 0 var(--gold);
}

.make-button {
  display: inline-flex;
  min-height: 48px;
  min-width: 176px;
  margin-top: 0;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 5px 5px 0 var(--gold);
}

.style-button:active,
.plain-button:active,
.make-button:active {
  translate: 1px 1px;
  box-shadow: none;
}

.leibedik {
  --paper: #fffbec;
  --paper-alt: #fde9a8;
  --wine: #8b3210;
  --gold: #b07820;
  --ink: #2a1505;
  --muted: #6b4520;
  --line: #8b5020;
}

.leibedik .notice-type {
  color: var(--wine);
  border-top-color: var(--wine);
  border-bottom-color: var(--wine);
}

.leibedik .message-preview {
  border-top-color: var(--wine);
  border-bottom-color: var(--wine);
}

.formal {
  --paper: #eef3f8;
  --paper-alt: #d4e0ec;
  --wine: #172d48;
  --gold: #2a5490;
  --ink: #0a1e35;
  --muted: #2a4060;
  --line: #172d48;
}

.formal .notice-type {
  color: var(--wine);
  border-top-color: var(--wine);
  border-bottom-color: var(--wine);
}

.formal .message-preview {
  border-top-style: double;
  border-bottom-style: double;
  border-top-color: var(--wine);
  border-bottom-color: var(--wine);
}

.message-page {
  align-content: center;
  gap: 20px;
}

.message-page .notice {
  min-height: min(720px, calc(100vh - 140px));
  display: grid;
  align-content: center;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.plain-button {
  padding: 0 16px;
}

.link-button {
  margin-top: 0;
}

.status {
  min-height: 1.4em;
  margin: 0;
  color: var(--wine);
  font-weight: 900;
}

@media (max-width: 720px) {
  .page {
    padding: 18px 12px;
  }

  .notice {
    min-height: 0;
    padding: 36px 20px;
    border-width: 5px;
    box-shadow: 8px 8px 0 var(--ink);
  }

  .corner {
    top: 32px;
    font-size: 0.85rem;
  }

  .corner.left {
    left: 34px;
  }

  .corner.right {
    right: 34px;
  }

  .notice h1 {
    font-size: clamp(3.2rem, 17vw, 5.5rem);
  }

  .notice-type {
    margin-top: 20px;
    font-size: 1.1rem;
  }

  .message-preview {
    padding: 18px 6px 22px;
  }

  .field-row,
  .control-actions,
  .style-row {
    grid-template-columns: 1fr;
  }

  .style-label {
    margin-bottom: 2px;
  }

  .style-button,
  .plain-button,
  .make-button {
    width: 100%;
  }

  .message-actions {
    width: min(100%, 900px);
    display: grid;
    grid-template-columns: 1fr;
  }
}
