:root {
  --ink: #171914;
  --muted: #676b62;
  --paper: #f4f0e5;
  --surface: #fffdf7;
  --line: #d8d1c1;
  --accent: #b9790e;
  --accent-dark: #754a07;
  --green: #316447;
  --danger: #9b302b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 88% 5%, rgba(213,154,36,.13), transparent 28rem), var(--paper); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, label:focus-visible { outline: 3px solid rgba(185,121,14,.28); outline-offset: 3px; }

.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 46px 0 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 72px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -.02em; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--ink); border-radius: 50%; font-family: Georgia, serif; }
.service { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.service-dot { width: 8px; height: 8px; border-radius: 50%; background: #aaa69c; box-shadow: 0 0 0 4px rgba(120,120,110,.1); }
.service-dot[data-state="online"] { background: #4d9769; box-shadow: 0 0 0 4px rgba(77,151,105,.13); }
.service-dot[data-state="sleeping"] { background: #d39a35; }

.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); align-items: end; gap: 36px; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 14px; color: var(--accent-dark); font-size: 11px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(54px, 9vw, 112px); font-weight: 500; line-height: .84; letter-spacing: -.065em; }
.lede { margin: 0 0 4px; color: var(--muted); font-size: 16px; line-height: 1.65; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.metric { padding: 19px 15px 18px 0; border-right: 1px solid var(--line); }
.metric:not(:first-child) { padding-left: 20px; }
.metric:last-child { border-right: 0; }
.metric strong { display: block; font-family: Georgia, serif; font-size: 24px; font-weight: 500; letter-spacing: -.025em; }
.metric span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; text-transform: uppercase; letter-spacing: .08em; }

.workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; padding: 36px 0; }
.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); background: rgba(255,253,247,.75); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.step { color: var(--accent-dark); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.text-button { border: 0; padding: 4px; color: var(--muted); background: transparent; font-size: 12px; }
.text-button:hover { color: var(--ink); }

.drop-zone { position: relative; display: grid; place-items: center; min-height: 286px; overflow: hidden; border: 1px dashed #bcb3a1; background: #f9f6ed; transition: border-color .18s, background .18s; }
.drop-zone.is-dragging { border-color: var(--accent); background: #fff7df; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone label { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.preview { display: block; max-width: 100%; max-height: 260px; object-fit: contain; mix-blend-mode: multiply; }
.preview-placeholder { padding: 24px; color: var(--muted); text-align: center; }
.upload-icon { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 14px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent-dark); font-size: 24px; }
.preview-placeholder strong { display: block; margin-bottom: 5px; color: var(--ink); }
.preview-placeholder span { font-size: 12px; }

.primary { width: 100%; margin-top: 14px; border: 1px solid var(--ink); padding: 13px 16px; background: var(--ink); color: #fffdf7; font-weight: 720; transition: transform .15s, opacity .15s; }
.primary:hover:not(:disabled) { transform: translateY(-1px); }
.primary:disabled { cursor: not-allowed; opacity: .38; }
.primary.is-loading { background: var(--accent-dark); }

.result { width: 100%; min-height: 286px; resize: vertical; border: 1px solid var(--line); padding: 28px; background: #fff; color: var(--ink); direction: rtl; text-align: right; font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", "Geeza Pro", serif; font-size: clamp(26px, 4vw, 40px); line-height: 2; }
.status { min-height: 24px; margin: 13px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.status[data-kind="error"] { color: var(--danger); }
.status[data-kind="success"] { color: var(--green); }
.status[data-kind="working"] { color: var(--accent-dark); }

.notice { display: grid; grid-template-columns: 140px 1fr; gap: 28px; margin: 0; padding: 22px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.65; }
.notice strong { color: var(--ink); text-transform: uppercase; font-size: 11px; letter-spacing: .11em; }
.footer { display: flex; justify-content: space-between; gap: 24px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer a { color: var(--ink); text-decoration: none; border-bottom: 1px solid #aaa28f; }

@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 620px); padding-top: 22px; }
  .topbar { margin-bottom: 48px; }
  .hero { grid-template-columns: 1fr; gap: 22px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .workspace { grid-template-columns: 1fr; padding: 24px 0; }
  .panel { padding: 15px; }
  .drop-zone, .result { min-height: 230px; }
  .notice { grid-template-columns: 1fr; gap: 7px; }
  .footer { flex-direction: column; gap: 8px; }
}

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