:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --muted: #94a3b8;
  --text: #1f2937;
  --brand: #8b5cf6;
  --brand-2: #662eed;
  --ring: rgba(139, 92, 246, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans Thai,
    "Noto Sans Thai", sans-serif;
  background: linear-gradient(145deg, #f8fafc, #f1f5f9);
  color: var(--text);
  display: grid;
  place-items: start center;
  padding: 2rem 1rem 4rem;
  gap: 1.5rem;
}

header {
  text-align: center;
}

h1 {
  font-size: clamp(1.6rem, 2.5vw + 1rem, 2.6rem);
  margin: 0 0 0.25rem;
  letter-spacing: 0.5px;
  background: linear-gradient(to left, #f45284, #be57ba, #8a5cee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--muted);
  margin: 0 auto 1rem;
  max-width: 52ch;
}

.app {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.7),
    rgba(255, 255, 255, 0.6)
  );
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

form {
  display: grid;
  gap: 0.75rem;
}

.row {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .row {
    grid-template-columns: repeat(3, 1fr);
  }
}

label {
  font-size: 0.95rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.35rem;
}

input[type="text"],
select,
textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  background: #fff;
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
textarea {
  min-height: 90px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
  transform: scale(1.01);
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

button {
  border: 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  background: var(--brand);
  color: #fff;
  transition: background 0.2s ease;
}
button:hover {
  background: var(--brand-2);
}

button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--brand);
}
button.secondary:hover {
  background: var(--brand);
  color: #fff;
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed rgba(0, 0, 0, 0.18);
}
button.ghost:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.poem {
  white-space: pre-wrap;
  line-height: 1.9;
  font-size: 1.2rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 1rem;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.4rem;
}

footer {
  background-color: #f5f1fe;
  width: 100vw;
  margin: 0;
  padding: 1rem;
  text-align: center;
  border-radius: 0;
}

footer a {
  color: #f65282;
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  color: var(--brand);
  text-decoration: underline;
}
