@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: #0e0f14;
  color: #f7f7fa;
  --card: #181a22;
  --line: #292c37;
  --muted: #9699a7;
  --accent: #9cff65;
  --accent-2: #c8ff54;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 0%, rgba(159, 255, 94, .09), transparent 30rem),
    #0e0f14;
}
.shell { width: min(100% - 28px, 680px); margin: 0 auto; padding: 34px 0 64px; }
header { position: relative; text-align: center; margin-bottom: 28px; }
.language-toggle { position: absolute; inset: 0 0 auto auto; border: 1px solid var(--line); border-radius: 99px; padding: 7px 11px; background: #1b1e27; color: #d8d9df; font: 600 .76rem inherit; cursor: pointer; }
.brand { direction: ltr; font-size: 2rem; font-weight: 800; letter-spacing: -.08em; }
.brand span { color: var(--accent); }
header p { color: var(--muted); margin: 4px 0 8px; }
.test-badge { display: inline-block; color: var(--accent); border: 1px solid #3e5b32; background: #1a2519; border-radius: 99px; padding: 3px 11px; font-size: .75rem; }
.card { position: relative; padding: 23px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 22px; background: rgba(24, 26, 34, .95); box-shadow: 0 16px 60px rgba(0,0,0,.16); }
.step { position: absolute; inset: 22px 22px auto auto; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; background: #273420; color: var(--accent); font-weight: 700; }
.section-copy { padding-right: 44px; margin-bottom: 20px; }
h1, h2 { font-size: 1.08rem; margin: 0 0 5px; }
.section-copy p, .state-card p { color: var(--muted); font-size: .83rem; margin: 0; }
.drop-zone { display: grid; min-height: 230px; place-items: center; overflow: hidden; border: 1px dashed #484b58; border-radius: 17px; background: #13151b; cursor: pointer; transition: .2s ease; }
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); background: #171d16; }
.drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
#upload-prompt { display: grid; justify-items: center; gap: 7px; color: #d8d9df; }
#upload-prompt small { color: var(--muted); }
.upload-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; background: #242731; color: var(--accent); font-size: 1.7rem; }
#preview { display: none; width: 100%; max-height: 390px; object-fit: contain; }
.drop-zone.has-image #preview { display: block; }
.drop-zone.has-image #upload-prompt { display: none; }
.presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.presets input { position: absolute; opacity: 0; }
.presets span { display: block; padding: 13px 12px; border: 1px solid var(--line); border-radius: 13px; background: #20222b; color: #d8d9df; font-size: .85rem; text-align: center; cursor: pointer; transition: .18s ease; }
.presets input:checked + span { color: #eaffdf; border-color: #71b44c; background: #23301e; box-shadow: inset 0 0 0 1px #4f7e38; }
.field { margin-top: 20px; }
.field label { display: block; margin-bottom: 8px; font-size: .88rem; font-weight: 600; }
.field label small { color: var(--muted); font-weight: 400; }
textarea, .field input { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 13px; background: #111319; color: #f5f5f8; padding: 13px; font: inherit; outline: none; }
textarea:focus, .field input:focus { border-color: #66884f; }
.hint { color: var(--muted); margin: 7px 2px 0; font-size: .72rem; }
.generate { display: flex; width: 100%; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 15px; padding: 15px; background: linear-gradient(115deg, var(--accent), var(--accent-2)); color: #14200e; font: 700 1rem inherit; text-decoration: none; cursor: pointer; box-shadow: 0 10px 30px rgba(156, 255, 101, .16); }
.generate:disabled { opacity: .45; cursor: wait; }
.text-button { display: block; margin: 13px auto 0; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.message { margin-top: 12px; padding: 12px 15px; border-radius: 12px; font-size: .85rem; }
.error { color: #ffc5c5; border: 1px solid #6d363b; background: #321d22; }
.hidden { display: none !important; }
.state-card, .result-card { text-align: center; padding: 40px 24px; }
.spinner { width: 48px; height: 48px; margin: 0 auto 18px; border: 3px solid #333640; border-top-color: var(--accent); border-radius: 50%; animation: spin .85s linear infinite; }
.success { display: inline-block; margin-bottom: 13px; color: var(--accent); }
.result-card h2 { margin-bottom: 18px; }
#result-image { display: block; max-width: 100%; max-height: 65vh; margin: 0 auto 20px; border-radius: 15px; background: #101116; }
html[dir="ltr"] body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
html[dir="ltr"] .language-toggle { inset: 0 auto auto 0; }
html[dir="ltr"] .step { inset: 22px auto auto 22px; }
html[dir="ltr"] .section-copy { padding-right: 0; padding-left: 44px; }
html[dir="ltr"] .submit-arrow { transform: rotate(180deg); }
@keyframes spin { to { transform: rotate(1turn); } }
@media (max-width: 430px) {
  .shell { width: min(100% - 20px, 680px); padding-top: 25px; }
  .card { padding: 18px; border-radius: 18px; }
  .step { inset: 18px 18px auto auto; }
  html[dir="ltr"] .step { inset: 18px auto auto 18px; }
  .presets span { min-height: 49px; display: grid; place-items: center; padding: 9px 7px; font-size: .78rem; }
  .drop-zone { min-height: 190px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
