* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: radial-gradient(circle at top, #2b2d42, #0f1020);
  color: #eaeaea;
}

.page {
  min-height: 100vh;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero {
  text-align: center;
  max-width: 640px;
  margin-bottom: 28px;
}

.badge {
  padding: 6px 14px;
  background: rgba(139,92,246,0.15);
  border-radius: 999px;
  font-size: 13px;
  margin-bottom: 12px;
}

.subtitle { color: #cfcfcf; }
.desc { color: rgba(255,255,255,0.6); font-size: 14px; }

.card {
  width: 100%;
  max-width: 640px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  font-size: 13px;
  color: #cfcfcf;
  margin-top: 18px;
  display: block;
}

input, textarea {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: #fff;
}

textarea { height: 90px; resize: none; }

button {
  width: 100%;
  padding: 14px;
  margin-top: 22px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
}

.writing-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.loading-box { width: 300px; }

.shimmer {
  height: 14px;
  margin-bottom: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #ffffff10, #ffffff35, #ffffff10);
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0% { opacity: .3; }
  50% { opacity: .9; }
  100% { opacity: .3; }
}

.letter-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.postcard {
  background: linear-gradient(145deg, #1f2238, #121420);
  padding: 28px;
  border-radius: 16px;
  max-width: 600px;
  white-space: pre-wrap;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.postcard pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.7;
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.actions button { flex: 1; }

.reset {
  background: transparent;
  color: #aaa;
  margin-top: 16px;
}

footer {
  margin-top: 30px;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
}

/* =================================================
   MOBILE POSTCARD & LAYOUT FIX
   Paste this at the VERY END of style.css
   ================================================= */
@media (max-width: 768px) {

  /* General page spacing */
  body {
    font-size: 15px;
  }

  .page {
    padding: 18px 10px;
  }

  /* HERO */
  h1 {
    font-size: 26px;
  }

  .subtitle {
    font-size: 14px;
  }

  .desc {
    font-size: 13px;
  }

  /* CARD / FORM */
  .card {
    padding: 20px 16px;
    border-radius: 16px;
  }

  .row {
    grid-template-columns: 1fr; /* stack inputs */
  }

  input,
  textarea {
    font-size: 14px;
    padding: 12px;
  }

  textarea {
    height: 110px;
  }

  /* WRITING PAGE */
  .writing-page {
    padding: 0 14px;
    text-align: center;
  }

  .writing-page h2 {
    font-size: 18px;
  }

  .loading-box {
    width: 100%;
    max-width: 320px;
  }

  /* LETTER PAGE */
  .letter-page {
    padding: 16px 10px;
  }

  /* ⭐ MAIN FIX: FULL-WIDTH POSTCARD ⭐ */
  .postcard {
    width: 100%;
    max-width: 100%;
    padding: 22px 18px;
    border-radius: 14px;
    margin: 0 auto;
  }

  .postcard pre {
    font-size: 15px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    letter-spacing: 0.2px;
  }

  /* ACTION BUTTONS */
  .actions {
    width: 100%;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
  }

  .actions button {
    width: 100%;
    padding: 14px;
    font-size: 15px;
  }

  .reset {
    margin-top: 14px;
    font-size: 13px;
  }

  /* FOOTER */
  footer {
    font-size: 11px;
    margin-top: 24px;
  }
}
