:root {
  color-scheme: light;
  --ink: #2f2f3c;
  --muted: #6d6673;
  --paper: #fff4d8;
  --panel: #fff8e8;
  --line: #e6bd72;
  --red: #b7192e;
  --red-dark: #741927;
  --forest: #243d37;
  --gold: #d79a36;
  --blue: #6f86a8;
  --shadow: 0 18px 38px rgba(47, 47, 60, .16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 12%, rgba(215, 154, 54, .3), transparent 18rem),
    radial-gradient(circle at 88% 18%, rgba(111, 134, 168, .28), transparent 18rem),
    linear-gradient(145deg, #fff4d8 0%, #f8dfbd 52%, #e9edf2 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .22;
  background-image:
    linear-gradient(90deg, rgba(47, 47, 60, .08) 1px, transparent 1px),
    linear-gradient(rgba(47, 47, 60, .08) 1px, transparent 1px);
  background-size: 26px 26px;
}

a {
  color: var(--red-dark);
}

.book-page {
  min-height: 100vh;
}

.shell,
.admin-shell {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 18px;
}

.welcome {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 22px 18px 12px;
  display: grid;
  gap: 18px;
}

.cover {
  overflow: hidden;
  border: 5px solid #fff9ea;
  border-radius: 26px 26px 12px 26px;
  background: #30303e;
  box-shadow: var(--shadow);
  transform: rotate(-1.2deg);
}

.cover img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.letter {
  position: relative;
  border: 2px solid rgba(116, 25, 39, .18);
  border-radius: 26px 12px 26px 26px;
  padding: 22px;
  background:
    linear-gradient(90deg, transparent 31px, rgba(183, 25, 46, .12) 32px, transparent 33px),
    repeating-linear-gradient(#fff8e8, #fff8e8 31px, rgba(230, 189, 114, .32) 32px);
  box-shadow: var(--shadow);
}

.letter::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -12px;
  width: 84px;
  height: 34px;
  border-radius: 999px;
  background: rgba(183, 25, 46, .78);
  transform: rotate(-4deg);
  opacity: .86;
}

.badge {
  width: fit-content;
  border: 2px solid rgba(183, 25, 46, .24);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--red-dark);
  background: rgba(255, 244, 216, .82);
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 {
  margin-top: 14px;
  color: var(--ink);
  font-size: clamp(2.8rem, 15vw, 6.4rem);
  text-wrap: balance;
}

h2 {
  color: var(--ink);
  font-size: clamp(2.15rem, 10vw, 4.1rem);
}

.letter p {
  max-width: 42rem;
  margin: 16px 0 0;
  color: #413b45;
  font-size: 1.04rem;
  line-height: 1.58;
}

.adult-note {
  display: inline-block;
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(215, 154, 54, .22);
  font-weight: 850;
}

.message-board {
  position: relative;
  margin: 14px 0 34px;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: 28px 14px 28px 14px;
  background: color-mix(in srgb, var(--panel) 95%, white);
  box-shadow: var(--shadow);
}

.message-board::before {
  content: "";
  position: absolute;
  inset: 12px;
  pointer-events: none;
  border: 2px dashed rgba(183, 25, 46, .18);
  border-radius: 20px 8px 20px 8px;
}

.message-board > * {
  position: relative;
}

form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.type-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.type-button,
.ghost-button {
  min-height: 64px;
  border: 2px solid color-mix(in srgb, var(--line) 78%, #8a6247);
  border-radius: 18px;
  padding: 10px;
  color: var(--ink);
  background: #fffaf0;
  box-shadow: 0 8px 18px rgba(47, 47, 60, .1);
}

.type-button span {
  display: block;
  width: 36px;
  height: 36px;
  margin: 0 auto 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff8e8;
  background: var(--red);
  font-weight: 900;
}

.type-button.active {
  border-color: var(--red);
  background: #ffe7c5;
  transform: translateY(-1px);
}

.field-row {
  display: grid;
  gap: 14px;
}

label,
legend {
  display: grid;
  gap: 7px;
  color: #403843;
  font-size: .95rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  min-height: 50px;
  border: 2px solid color-mix(in srgb, var(--line) 84%, #7a523b);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fffdf7;
  font: inherit;
}

input[type="file"] {
  padding: 12px;
}

textarea {
  resize: vertical;
  min-height: 142px;
}

input:focus,
textarea:focus,
button:focus {
  outline: 4px solid rgba(215, 154, 54, .34);
  border-color: var(--gold);
}

.upload-panel {
  border: 2px dashed color-mix(in srgb, var(--blue) 60%, white);
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, .36);
}

.recorder {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: .92rem;
}

.hidden {
  display: none;
}

.trap-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, .38);
}

.choice {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: start;
  gap: 10px;
  font-weight: 760;
  line-height: 1.38;
}

.choice input {
  width: 20px;
  min-height: 20px;
  margin: 2px 0 0;
  accent-color: var(--red);
}

.consent {
  color: var(--muted);
  font-size: .9rem;
}

button,
.send-button {
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  color: #fff8ea;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(116, 25, 39, .22);
}

button:hover {
  filter: brightness(.98);
}

.ghost-button {
  color: var(--red-dark);
  background: #fffaf0;
  box-shadow: none;
}

.notice {
  margin: 0 0 18px;
  border: 2px solid rgba(36, 61, 55, .2);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(232, 241, 232, .88);
  color: var(--forest);
  font-weight: 800;
}

.danger {
  border-color: rgba(183, 25, 46, .25);
  background: rgba(255, 232, 224, .92);
  color: var(--red-dark);
}

.gallery {
  padding: 8px 0 56px;
}

.gallery h2 {
  text-align: center;
}

.cards {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.reader-card,
.mod-card {
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 24px 12px 24px 12px;
  background: rgba(255, 250, 240, .92);
  box-shadow: 0 8px 22px rgba(47, 47, 60, .1);
}

.reader-card img,
.reader-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #30303e;
}

.reader-card > div {
  padding: 16px;
}

.reader-card p,
.empty,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.reader-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: .9rem;
}

.reader-card footer span::before {
  content: "/ ";
}

.audio-note {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: #30303e;
}

.audio-note span {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff8e8;
  background: var(--red);
  font-size: 1.8rem;
}

.audio-note audio {
  width: 100%;
}

.admin {
  background: #f6f0e6;
}

.admin-shell {
  max-width: 1120px;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.admin-login h1,
.admin-nav h1 {
  color: var(--ink);
}

.admin-nav {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 20px 0;
}

.book-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.book-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 250, 240, .78);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 750;
}

.control-panel {
  margin: 0 0 18px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 250, 240, .84);
}

.control-panel h2 {
  font-size: clamp(1.8rem, 6vw, 3rem);
}

.control-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.control-card {
  display: grid;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, .42);
}

.control-card div {
  display: grid;
  gap: 4px;
}

.control-card span {
  color: var(--muted);
  font-size: .92rem;
}

.control-card form {
  margin: 0;
}

.mod-list {
  display: grid;
  gap: 14px;
  padding-bottom: 40px;
}

.mod-card {
  display: grid;
}

.mod-card img,
.mod-card video,
.mod-card .audio-note {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.mod-body {
  padding: 14px;
}

.mod-body header {
  display: grid;
  gap: 3px;
}

.mod-body span,
.mod-body small {
  color: var(--muted);
}

.mod-body p {
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions form {
  margin: 0;
}

.actions button,
.admin-nav button {
  min-height: 38px;
  padding: 0 12px;
  background: var(--blue);
  box-shadow: none;
}

.actions form:last-child button {
  background: var(--red-dark);
}

.status-approved {
  border-color: rgba(36, 61, 55, .38);
}

.status-hidden {
  opacity: .72;
}

@media (min-width: 760px) {
  .shell,
  .admin-shell {
    padding: 30px;
  }

  .welcome {
    grid-template-columns: minmax(280px, 420px) 1fr;
    align-items: center;
    padding: 38px 30px 22px;
  }

  .letter {
    padding: 30px;
  }

  .message-board {
    padding: 30px;
  }

  .type-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-card {
    grid-template-columns: 1fr auto;
  }

  .mod-card {
    grid-template-columns: 240px 1fr;
  }

  .mod-card img,
  .mod-card video,
  .mod-card .audio-note {
    height: 100%;
    aspect-ratio: auto;
  }
}

@media (min-width: 1040px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
