:root {
  --ink: #202c39;
  --cream: #f8f3e8;
  --paper: #fffdf7;
  --blue: #1768ac;
  --blue-dark: #0f4f87;
  --coral: #ef6a52;
  --yellow: #ffd768;
  --green: #a9d8b5;
  --pink: #f3b8c4;
  --lavender: #c8bee8;
  --line: rgba(32, 44, 57, 0.18);
  --shadow: 0 14px 34px rgba(39, 48, 56, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(239, 106, 82, 0.08), transparent 24rem),
    radial-gradient(circle at 92% 20%, rgba(23, 104, 172, 0.09), transparent 27rem),
    var(--cream);
  font-family: "Gowun Dodum", sans-serif;
  font-size: 16px;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.24;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
  content: "";
  pointer-events: none;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  align-items: center;
  min-height: 430px;
  padding: 72px 5% 55px;
  border-bottom: 2px solid var(--ink);
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.eyebrow span {
  display: inline-block;
  margin-right: 8px;
  color: var(--coral);
  animation: pulse 1.8s infinite;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  font-family: "Jua", sans-serif;
  font-size: clamp(3.5rem, 8vw, 6.8rem);
  font-weight: 400;
  line-height: 0.86;
  letter-spacing: -0.035em;
}

h1 em {
  color: var(--coral);
  font-style: normal;
}

.hero-description {
  margin-bottom: 0;
  color: #53606d;
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.8;
}

.hero-doodle {
  position: relative;
  display: grid;
  min-height: 260px;
  place-items: center;
}

.sample-note {
  position: relative;
  width: 235px;
  min-height: 220px;
  padding: 60px 24px 24px;
  transform: rotate(5deg);
  background: var(--yellow);
  box-shadow: 9px 12px 0 rgba(32, 44, 57, 0.12);
  text-align: center;
}

.sample-note::after {
  position: absolute;
  right: 0;
  bottom: 0;
  border-width: 0 0 28px 28px;
  border-style: solid;
  border-color: transparent transparent var(--cream) transparent;
  filter: drop-shadow(-3px -2px 1px rgba(0, 0, 0, 0.06));
  content: "";
}

.sample-note p {
  font-family: "Jua", sans-serif;
  font-size: 1.48rem;
  line-height: 1.45;
}

.pin {
  position: absolute;
  top: 18px;
  left: 50%;
  color: var(--coral);
  font-size: 1.5rem;
  text-shadow: 2px 3px 0 rgba(0, 0, 0, 0.13);
  transform: translateX(-50%);
}

.smile {
  color: var(--blue);
  font-size: 1.8rem;
  font-weight: 700;
}

.tape {
  position: absolute;
  z-index: 2;
  top: 28px;
  width: 90px;
  height: 28px;
  transform: rotate(-4deg);
  background: rgba(255, 255, 255, 0.58);
}

.spark {
  position: absolute;
  color: var(--blue);
  font-size: 2rem;
}

.spark-one {
  top: 15%;
  right: 3%;
}

.spark-two {
  bottom: 8%;
  left: 6%;
  color: var(--coral);
  font-size: 1.35rem;
}

main {
  padding: 68px 5% 90px;
}

.write-section {
  max-width: 900px;
  margin: 0 auto 90px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin-bottom: 3px;
  font-family: "Jua", sans-serif;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  font-weight: 400;
}

.section-heading p {
  margin-bottom: 0;
  color: #6f7880;
}

.step-number {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  color: white;
  background: var(--blue);
  font-family: "Jua", sans-serif;
  place-items: center;
}

.step-number.coral {
  background: var(--coral);
}

.message-form {
  display: grid;
  grid-template-columns: 0.55fr 1.45fr auto;
  align-items: end;
  gap: 16px;
  padding: 26px;
  border: 1px solid rgba(32, 44, 57, 0.12);
  border-radius: 6px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: var(--shadow);
}

.field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.88rem;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1.5px solid #c9c8c2;
  border-radius: 3px;
  outline: none;
  color: var(--ink);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input {
  height: 54px;
  padding: 0 15px;
}

.field textarea {
  height: 90px;
  padding: 14px 55px 14px 15px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 104, 172, 0.12);
}

.char-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: #8b9196;
  font-size: 0.76rem;
}

.submit-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 175px;
  height: 90px;
  padding: 0 18px;
  border: 0;
  border-radius: 3px;
  color: white;
  background: var(--blue);
  font-family: "Jua", sans-serif;
  font-size: 1.04rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.submit-button:hover {
  transform: translateY(-2px);
  background: var(--blue-dark);
}

.submit-button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.button-arrow {
  font-size: 1.5rem;
}

.status-message {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--blue-dark);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
}

.status-message.error {
  color: #b9382b;
}

.wall-section {
  min-height: 360px;
}

.wall-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #66717a;
  font-size: 0.85rem;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #35a65b;
  box-shadow: 0 0 0 4px rgba(53, 166, 91, 0.12);
  animation: pulse 1.8s infinite;
}

.message-wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 27px 23px;
}

.note-card {
  --note-color: var(--yellow);
  position: relative;
  display: flex;
  min-height: 225px;
  flex-direction: column;
  padding: 39px 28px 24px;
  transform: rotate(var(--rotation, 0deg));
  background: var(--note-color);
  box-shadow: 7px 9px 0 rgba(32, 44, 57, 0.1);
  animation: stick 0.4s both;
}

.note-card::before {
  position: absolute;
  top: 17px;
  left: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(32, 44, 57, 0.36);
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.15);
  content: "";
  transform: translateX(-50%);
}

.note-card::after {
  position: absolute;
  right: 0;
  bottom: 0;
  border-width: 0 0 22px 22px;
  border-style: solid;
  border-color: transparent transparent var(--cream) transparent;
  content: "";
}

.note-message {
  flex: 1;
  margin-bottom: 22px;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.note-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(32, 44, 57, 0.17);
  padding-top: 12px;
}

.note-author {
  overflow: hidden;
  font-family: "Jua", sans-serif;
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-time {
  flex: 0 0 auto;
  color: rgba(32, 44, 57, 0.64);
  font-size: 0.72rem;
}

.error-box {
  margin: 0 0 28px;
  padding: 18px 20px;
  border: 1px solid #e8a39b;
  border-radius: 4px;
  color: #8a2f24;
  background: #fff1ef;
  font-weight: 700;
  line-height: 1.6;
}

.loading-state,
.empty-state {
  padding: 70px 20px;
  color: #778089;
  text-align: center;
}

.loading-note {
  display: inline-block;
  width: 45px;
  height: 45px;
  margin-bottom: 15px;
  background: var(--yellow);
  animation: loading 1.1s ease-in-out infinite;
}

.empty-paper {
  display: grid;
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
  transform: rotate(-5deg);
  color: var(--blue);
  background: var(--yellow);
  font-size: 2rem;
  place-items: center;
}

.empty-state h3 {
  margin-bottom: 7px;
  color: var(--ink);
  font-family: "Jua", sans-serif;
  font-size: 1.4rem;
  font-weight: 400;
}

.empty-state p {
  margin-bottom: 0;
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 30px 20px 42px;
  border-top: 2px solid var(--ink);
  color: #6f7880;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

@keyframes stick {
  from { opacity: 0; transform: translateY(-14px) rotate(var(--rotation, 0deg)) scale(0.96); }
  to { opacity: 1; transform: translateY(0) rotate(var(--rotation, 0deg)) scale(1); }
}

@keyframes loading {
  50% { transform: rotate(10deg) scale(0.85); opacity: 0.55; }
}

@media (max-width: 850px) {
  .hero {
    grid-template-columns: 1fr 0.6fr;
    padding-inline: 2%;
  }

  .sample-note {
    width: 190px;
    min-height: 185px;
    padding-top: 52px;
  }

  .sample-note p {
    font-size: 1.2rem;
  }

  main {
    padding-inline: 2%;
  }

  .message-form {
    grid-template-columns: 1fr 1.5fr;
  }

  .submit-button {
    grid-column: 1 / -1;
    width: 100%;
    height: 58px;
  }

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

@media (max-width: 600px) {
  .page-shell {
    width: min(100% - 24px, 520px);
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 54px 2% 40px;
  }

  h1 {
    font-size: clamp(3.25rem, 18vw, 5rem);
  }

  .hero-doodle {
    display: none;
  }

  main {
    padding: 46px 1% 68px;
  }

  .write-section {
    margin-bottom: 65px;
  }

  .message-form {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .field textarea {
    height: 120px;
  }

  .submit-button {
    grid-column: auto;
  }

  .wall-heading {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 17px;
  }

  .wall-heading .section-heading {
    margin-bottom: 0;
  }

  .live-indicator {
    align-self: flex-end;
  }

  .message-wall {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .note-card {
    min-height: 200px;
  }

  footer {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
