/* بيان — light studio theme. Orange from the logo: #F4B63F. Cream #F6EFE6. Red accent #E4483B. */
:root {
  --bg: #FBF8F3;
  --bg-tint: #F6EFE6;
  --surface: #FFFFFF;
  --ink: #1C1916;
  --ink-soft: #5C554E;
  --line: #E8E0D6;
  --line-strong: #D4CBBE;
  --orange: #F4B63F;
  --orange-deep: #E0A32C;
  --orange-soft: #FFF3D6;
  --red: #E4483B;
  --red-deep: #C5372C;
  --black: #0C0C0C;
  --shadow: 0 10px 40px rgba(28, 25, 22, 0.06);
  --shadow-lg: 0 18px 60px rgba(28, 25, 22, 0.09);
  --radius: 20px;
  --radius-sm: 14px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --max: 860px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
body {
  min-height: 100vh;
  background-image:
    radial-gradient(1200px 500px at 100% -10%, rgba(244, 182, 63, 0.14), transparent 55%),
    radial-gradient(900px 400px at -10% 20%, rgba(228, 72, 59, 0.05), transparent 50%);
}
img { max-width: 100%; height: auto; display: block; }
button, textarea, input, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.wrap {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

/* Header */
.site-header {
  padding: 28px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.logo-link { text-decoration: none; display: inline-block; }
.logo {
  width: min(280px, 78vw);
  height: auto;
  background: var(--black);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.eyebrow {
  margin: 28px 0 8px;
  color: var(--red);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}
h1 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 4.4vw, 2.35rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.lead {
  margin: 0 auto 36px;
  max-width: 38em;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* Studio card */
.studio {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 24px;
}
.modes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.mode {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 8px;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
  transition: background 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.mode small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 2px;
}
.mode:hover { border-color: var(--orange); }
.mode:focus-visible { outline: 3px solid rgba(244, 182, 63, 0.55); outline-offset: 2px; }
.mode[aria-pressed="true"] {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--black);
  box-shadow: 0 4px 16px rgba(244, 182, 63, 0.35);
}
.mode[aria-pressed="true"] small { color: rgba(28, 25, 22, 0.72); }

.label {
  display: block;
  font-weight: 600;
  margin: 4px 0 8px;
  font-size: 0.95rem;
}
.field textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 14px 16px;
  color: var(--ink);
  line-height: 1.7;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.field textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(244, 182, 63, 0.22);
  background: #fff;
}
.field-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.8rem;
}
.random-hint {
  background: var(--bg-tint);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: var(--ink-soft);
  border: 1px dashed var(--line-strong);
}

/* Celebrities */
.celebs-wrap { margin-top: 22px; }
.celebs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.celebs-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.celebs-head p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 400;
}
.celebs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.celeb {
  appearance: none;
  text-align: right;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px 12px;
  color: var(--ink);
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.celeb:hover { border-color: var(--orange); }
.celeb:focus-visible { outline: 3px solid rgba(244, 182, 63, 0.55); outline-offset: 2px; }
.celeb[aria-pressed="true"] {
  background: var(--orange-soft);
  border-color: var(--orange);
  box-shadow: inset 0 0 0 1px var(--orange);
}
.celeb .cn {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.4;
}
.celeb .ce {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.celeb .cb {
  display: block;
  margin-top: 5px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  align-items: center;
}
.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:focus-visible { outline: 3px solid rgba(244, 182, 63, 0.7); outline-offset: 3px; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--orange);
  color: var(--black);
  box-shadow: 0 8px 22px rgba(244, 182, 63, 0.38);
}
.btn-primary:hover:not(:disabled) { background: var(--orange-deep); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-tint); border-color: var(--ink-soft); }
.spin {
  width: 16px; height: 16px;
  border: 2px solid rgba(28,25,22,0.2);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading / error */
.status {
  margin-top: 28px;
}
.loader {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}
.loader-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-tint);
  overflow: hidden;
  margin: 0 auto 16px;
  max-width: 280px;
}
.loader-bar > span {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--orange);
  border-radius: inherit;
  animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(250%); }
  100% { transform: translateX(-250%); }
}
.loader p { margin: 0; color: var(--ink-soft); font-weight: 500; }
.err {
  background: #FDF3F2;
  border: 1px solid #F3C8C4;
  color: #8A241C;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

/* Result document — editorial, like her treatments */
.result {
  margin: 36px 0 20px;
  animation: rise 0.45s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.doc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.doc-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--bg-tint);
  border-bottom: 1px solid var(--line);
}
.doc-top h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-actions .btn { padding: 9px 16px; font-size: 0.88rem; }

.doc-body { padding: 28px 28px 36px; }
.doc-kicker {
  color: var(--red);
  font-weight: 700;
  font-size: 0.8rem;
  margin: 0 0 6px;
}
.doc-title {
  margin: 0 0 6px;
  font-size: clamp(1.45rem, 3.2vw, 2rem);
  font-weight: 700;
  line-height: 1.4;
}
.doc-sub {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 28px;
  padding: 12px 14px;
  background: var(--bg);
  border-right: 4px solid var(--orange);
  border-radius: 0 10px 10px 0;
}
.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.chip strong { color: var(--ink); font-weight: 600; }

.section { margin: 0 0 26px; }
.section h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section h3::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}
.section p, .section li { margin: 0 0 8px; }
.essence {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.7;
  padding: 4px 0 0;
}

.scenes { display: flex; flex-direction: column; gap: 12px; }
.scene {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 12px;
  background: var(--bg);
}
.scene.is-twist {
  border-color: #F0C56A;
  background: var(--orange-soft);
}
.scene-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  margin-bottom: 8px;
}
.scene-num { font-weight: 700; }
.scene-time { color: var(--ink-soft); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.scene-name { font-weight: 700; }
.twist-flag {
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
}
.scene dl {
  margin: 0;
  display: grid;
  grid-template-columns: 7.2rem 1fr;
  gap: 4px 10px;
  font-size: 0.95rem;
}
.scene dt { color: var(--ink-soft); font-weight: 600; font-size: 0.82rem; }
.scene dd { margin: 0; }
.scene dd:empty, .scene dt:has(+ dd:empty) { display: none; }

.notes {
  display: grid;
  gap: 8px;
}
.notes div {
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
}
.notes strong { display: block; font-size: 0.82rem; margin-bottom: 2px; color: var(--red-deep); }

.treats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.treat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--bg);
}
.treat.preferred { border-color: var(--orange); background: var(--orange-soft); }
.treat h4 { margin: 0 0 6px; font-size: 0.95rem; }
.pref-flag {
  display: inline-block;
  margin-right: 6px;
  background: var(--orange);
  color: var(--black);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
}

.tagline-block {
  margin-top: 8px;
  text-align: center;
  padding: 28px 16px 22px;
  background: var(--black);
  color: #F6EFE6;
  border-radius: 16px;
}
.tagline-block .lbl {
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.tagline-block q {
  display: block;
  font-size: clamp(1.2rem, 2.8vw, 1.65rem);
  font-weight: 700;
  line-height: 1.55;
  quotes: "«" "»";
}
.tagline-block .endc {
  margin: 12px 0 0;
  color: rgba(246, 239, 230, 0.72);
  font-size: 0.88rem;
}

.chars { margin: 0; padding: 0; list-style: none; }
.chars li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.chars li:last-child { border-bottom: 0; }

/* Footer */
footer {
  text-align: center;
  padding: 40px 0 48px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
footer strong { color: var(--ink); font-weight: 600; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--black);
  color: #F6EFE6;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .wrap { width: calc(100% - 28px); }
  .studio { padding: 16px 14px 18px; }
  .modes { grid-template-columns: 1fr; }
  .celebs { grid-template-columns: 1fr 1fr; }
  .treats { grid-template-columns: 1fr; }
  .doc-body { padding: 20px 16px 28px; }
  .scene dl { grid-template-columns: 1fr; gap: 0; }
  .scene dt { margin-top: 8px; }
  h1 { font-size: 1.65rem; }
  .lead { font-size: 1rem; margin-bottom: 24px; }
}
@media (max-width: 400px) {
  .celebs { grid-template-columns: 1fr; }
}
