:root {
  --ink: #252238;
  --cream: #f8f4ec;
  --coral: #e8654d;
  --lilac: #d9d0f4;
  --mint: #dceee5;
  --border: rgba(37, 34, 56, 0.12);
}

* { box-sizing: border-box; }
html { background: var(--cream); overflow-x: hidden; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  background:
    radial-gradient(circle at 8% 80%, rgba(232, 101, 77, 0.1), transparent 28%),
    radial-gradient(circle at 90% 15%, rgba(217, 208, 244, 0.38), transparent 30%),
    var(--cream);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.wrap { width: min(1152px, calc(100% - 32px)); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding-block: 16px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--ink); padding: 0; font-size: 18px; font-weight: 750; letter-spacing: -0.02em; }
.brand-icon, .card-icon, .message-icon { display: grid; place-items: center; background: var(--ink); color: var(--cream); }
.brand-icon { width: 36px; height: 36px; border-radius: 12px; }
.tagline { max-width: 145px; border: 1px solid rgba(37, 34, 56, 0.1); border-radius: 999px; background: rgba(255, 255, 255, 0.62); padding: 6px 12px; text-align: center; color: rgba(37, 34, 56, 0.62); font-size: 11px; font-weight: 600; line-height: 1.45; }
.hero { padding-block: 34px 38px; text-align: center; }
.eyebrow, .card-label { margin: 0; color: var(--coral); font-size: 12px; font-weight: 800; letter-spacing: 0.19em; text-transform: uppercase; }
.hero h1 { max-width: 900px; margin: 16px auto 0; font-size: clamp(40px, 8vw, 88px); line-height: 0.96; letter-spacing: -0.055em; }
em { color: var(--coral); font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.hero-copy { max-width: 690px; margin: 22px auto 0; color: rgba(37, 34, 56, 0.66); font-size: 17px; line-height: 1.75; }
.mini-formula, .result-formula { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.mini-formula { max-width: 700px; margin: 28px auto 0; font-size: 15px; font-weight: 650; }
.mini-formula span, .result-formula span { border: 1px solid rgba(37, 34, 56, 0.1); border-radius: 999px; background: rgba(255, 255, 255, 0.7); padding: 9px 14px; }
.mini-formula b, .result-formula b { color: var(--coral); }
.mini-formula .dark-chip, .result-formula .dark-chip { background: var(--ink); color: var(--cream); }
.form-section { padding-bottom: 80px; }
.input-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.input-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 28px; padding: 28px; box-shadow: 0 18px 50px rgba(37, 34, 56, 0.06); transition: border-color 0.2s ease, transform 0.2s ease; }
.input-card:focus-within { border-color: rgba(37, 34, 56, 0.27); transform: translateY(-2px); }
.input-card.invalid { border-color: var(--coral); }
.input-card.coral { background: #f5d7ce; }
.input-card.lilac { background: #e5ddf7; }
.input-card.mint { background: var(--mint); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-icon, .message-icon { width: 44px; height: 44px; border-radius: 16px; background: rgba(255, 255, 255, 0.66); color: var(--ink); font-size: 20px; }
.number { color: rgba(37, 34, 56, 0.37); font-size: 14px; font-weight: 650; }
.input-card .card-label { margin-top: 24px; color: rgba(37, 34, 56, 0.52); }
.input-card h2 { margin: 8px 0 0; font-size: 24px; line-height: 1.15; letter-spacing: -0.025em; }
.card-copy { min-height: 78px; margin: 12px 0 0; color: rgba(37, 34, 56, 0.62); font-size: 14px; line-height: 1.7; }
textarea { width: 100%; border: 1px solid rgba(37, 34, 56, 0.1); border-radius: 16px; outline: none; background: rgba(255, 255, 255, 0.67); color: var(--ink); }
.input-card textarea { min-height: 176px; margin-top: 20px; padding: 16px; resize: vertical; font-size: 16px; line-height: 1.5; }
textarea::placeholder { color: rgba(37, 34, 56, 0.38); font-size: 14px; line-height: 1.65; }
textarea:focus { border-color: rgba(37, 34, 56, 0.3); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5); }
.error { display: none; margin: 12px 0 0; color: var(--coral); font-size: 14px; font-weight: 650; }
.invalid .error { display: block; }
.submit-wrap { display: flex; flex-direction: column; align-items: center; margin-top: 28px; }
.submit-wrap p { margin: 12px 0 0; color: rgba(37, 34, 56, 0.43); font-size: 12px; text-align: center; }
.primary, .secondary, .reset-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 999px; font-weight: 700; transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.primary { min-height: 48px; background: var(--ink); color: var(--cream); padding: 12px 22px; }
.primary:hover { background: var(--coral); }
.submit-button { min-height: 56px; padding-inline: 32px; font-size: 16px; box-shadow: 0 12px 35px rgba(37, 34, 56, 0.18); }
.result-section { border-top: 1px solid rgba(37, 34, 56, 0.1); background: rgba(255, 255, 255, 0.46); padding-block: 72px; }
.result-title { max-width: 780px; margin: 12px 0 0; font-size: clamp(38px, 6vw, 60px); line-height: 1.02; letter-spacing: -0.04em; }
.result-formula { justify-content: flex-start; margin-top: 30px; border: 1px solid rgba(37, 34, 56, 0.1); border-radius: 24px; background: rgba(255, 255, 255, 0.76); padding: 26px; font-weight: 600; }
.result-formula span { color: rgba(37, 34, 56, 0.74); overflow-wrap: anywhere; }
.ai-panel { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 20px; margin-top: 32px; border: 1px solid rgba(37, 34, 56, 0.1); border-radius: 32px; background: rgba(217, 208, 244, 0.56); padding: 32px; }
.ai-intro { display: flex; flex-direction: column; justify-content: space-between; }
.ai-intro .card-label { margin-top: 24px; color: rgba(37, 34, 56, 0.48); }
.ai-intro h3 { margin: 8px 0 0; font-size: 30px; line-height: 1.1; letter-spacing: -0.035em; }
.ai-intro p:not(.card-label) { margin: 16px 0 0; color: rgba(37, 34, 56, 0.66); font-size: 14px; line-height: 1.7; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.secondary { min-height: 42px; background: transparent; color: rgba(37, 34, 56, 0.62); padding: 8px 16px; font-size: 14px; }
.secondary:hover { background: rgba(255, 255, 255, 0.5); }
.prompt-card { border: 1px solid rgba(37, 34, 56, 0.1); border-radius: 22px; background: rgba(255, 255, 255, 0.72); padding: 20px; }
.prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; color: rgba(37, 34, 56, 0.46); font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.copied-badge { border-radius: 999px; background: var(--mint); padding: 5px 12px; color: var(--ink); font-size: 12px; letter-spacing: 0; text-transform: none; }
#prepared-prompt { min-height: 385px; border: 0; border-radius: 0; background: transparent; padding: 0; resize: none; color: rgba(37, 34, 56, 0.74); font-size: 14px; line-height: 1.72; box-shadow: none; }
.footer-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-top: 32px; border-radius: 16px; background: var(--ink); padding: 20px 28px; color: var(--cream); }
.footer-note strong { display: block; }
.footer-note p { margin: 5px 0 0; color: rgba(248, 244, 236, 0.62); font-size: 14px; }
.reset-button { min-height: 40px; background: var(--cream); color: var(--ink); padding: 10px 20px; }
.reset-button:hover { background: var(--coral); color: white; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .input-grid { grid-template-columns: 1fr; }
  .card-copy { min-height: 0; }
  .ai-panel { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .wrap { width: min(100% - 32px, 1152px); }
  .hero { padding-block: 28px 36px; }
  .hero h1 { font-size: clamp(40px, 12vw, 56px); }
  .hero-copy { font-size: 15px; line-height: 1.6; }
  .mini-formula { gap: 6px; font-size: 12px; }
  .mini-formula span { padding: 7px 10px; }
  .form-section { padding-bottom: 64px; }
  .input-card { border-radius: 24px; padding: 20px; box-shadow: 0 12px 30px rgba(37, 34, 56, 0.06); }
  .input-card textarea { min-height: 140px; }
  .submit-button { width: 100%; }
  .result-section { padding-block: 56px; }
  .result-formula { gap: 7px; padding: 16px; font-size: 12px; }
  .result-formula span { max-width: 100%; padding: 8px 11px; }
  .ai-panel { border-radius: 28px; padding: 20px; }
  #prepared-prompt { min-height: 320px; }
  .footer-note { padding: 20px; }
  .reset-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
