:root{
  /* ===== Professional Light Theme ===== */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --card: #ffffff;
  --card2: #fbfcff;

  --stroke: rgba(15, 23, 42, .12);
  --stroke2: rgba(15, 23, 42, .18);

  --text: rgba(15, 23, 42, .92);
  --muted: rgba(15, 23, 42, .62);

  --shadow: 0 10px 28px rgba(15, 23, 42, .10);
  --shadow2: 0 6px 18px rgba(15, 23, 42, .08);

  --r: 14px;
  --pad: 18px;

  --primary: #1e40af;         /* أزرق رسمي */
  --primary-soft: rgba(30,64,175,.10);
  --focus: rgba(30,64,175,.22);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  color:var(--text);
  background: var(--bg);
  font-family: Inter, Cairo, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* تحسينات رسمية بسيطة */
a{ color: inherit; }
:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 10px;
}

.control{ text-align:center; }

.container{
  width:min(1100px, calc(100% - 32px));
  margin-inline:auto;
}

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); border:0;
}

/* ===== Background Orbs (مخففة جداً / رسمية) ===== */
.bg-orbs{ position:fixed; inset:0; pointer-events:none; }
.orb{ position:absolute; filter: blur(60px); opacity:.12; }
.o1{ width:340px; height:340px; inset-inline-start: -120px; top:80px; background: rgba(30,64,175,.55); border-radius: 999px; }
.o2{ width:280px; height:280px; inset-inline-end: -120px; top:150px; background: rgba(14,116,144,.50); border-radius: 999px; }
.o3{ width:460px; height:460px; left: 35%; bottom:-240px; background: rgba(100,116,139,.45); border-radius: 999px; }

/* ===== Topbar (رسمي، بدون تدرج قوي) ===== */
.topbar{
  position:sticky; top:0; z-index:20;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,.80);
  border-bottom: 1px solid var(--stroke);
}

.topbar__inner{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 0;
}

.brand{
  display:flex; align-items:center; gap:12px;
  text-decoration:none; color:inherit;
}

.brand__logo{
  width:42px; height:42px;
  display:grid; place-items:center;
  border:1px solid var(--stroke);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow2);
}

.brand__name{ font-weight:800; letter-spacing:.2px; font-size:16px; }
.brand__tag{ display:block; font-size:12px; color:var(--muted); margin-top:2px; }

.topbar__actions{ display:flex; align-items:center; gap:10px; }

/* ===== Select ===== */
.select select{
  appearance:none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--stroke);
  padding:10px 12px;
  border-radius: 12px;
  outline:none;
  box-shadow: var(--shadow2);
}

/* ===== Buttons (رسمي) ===== */
.btn{
  border:1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  padding:11px 14px;
  border-radius: 12px;
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
  text-decoration:none;
  display:inline-flex; align-items:center; justify-content:center;
  width: 100%;
  box-shadow: var(--shadow2);
}

.btn:hover{
  transform: translateY(-1px);
  border-color: var(--stroke2);
  box-shadow: var(--shadow);
}

.btn:active{ transform: translateY(0); }

.btn--primary{
  background: var(--primary);
  color: #fff;
  border-color: rgba(30,64,175,.40);
  box-shadow: 0 10px 22px rgba(30,64,175,.18);
}

.btn--primary:hover{
  box-shadow: 0 14px 28px rgba(30,64,175,.22);
}

.btn--ghost{
  background: transparent;
  box-shadow:none;
}

/* ===== Hero ===== */
.hero{ padding: 0 0 28px; }
.hero__title{ font-size: clamp(28px, 4.2vw, 42px); margin: 10px 0 8px; }
.hero__subtitle{ color: var(--muted); margin:0 0 18px; line-height:1.65; max-width: 62ch; }

/* ===== Panel ===== */
.panel{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.86);
  border-radius: calc(var(--r) + 4px);
  box-shadow: var(--shadow);
  padding: var(--pad);
}

.panel__row{
  display:flex;
  gap: 10px;
  justify-content: space-around;
  align-items: center;
}

.panel__row--actions{
  grid-template-columns: repeat(4, minmax(0,1fr));
  margin-top: 14px;
}

@media (max-width: 760px){
  .panel__row{ grid-template-columns:1fr; }
  .panel__row--actions{ grid-template-columns:1fr 1fr; }
}

/* ===== Controls ===== */
.control__label{ color: var(--muted); margin-bottom:8px; font-size: 14px; }

.stepper{
  display:flex; align-items:center; gap:3px;
  border-radius: 14px;
  padding: 10px;
}

.stepper__btn{
  width:44px; height:44px;
  border-radius: 12px;
  border:1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  cursor:pointer;
  font-size: 22px;
  box-shadow: var(--shadow2);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.stepper__btn:hover{
  transform: translateY(-1px);
  border-color: var(--stroke2);
  box-shadow: var(--shadow);
}

.stepper__btn:active{ transform: translateY(0); }

.stepper__input{
  flex:1;
  height:44px;
  border-radius: 12px;
  border:1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  padding-inline: 12px;
  font-size: 16px;
  outline:none;
  box-shadow: var(--shadow2);
}

/* ===== Output ===== */
.output{ margin-top: 14px; }

.output__bar{
  display:flex; gap:10px; flex-wrap:wrap;
  margin-bottom: 10px;
}

.pill{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.92);
  color: var(--muted);
  padding:7px 10px;
  border-radius: 999px;
  font-size: 12px;
}

/* textarea رسمي وواضح */
.output__textarea{
  width:100%;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  padding: 14px;
  line-height: 1.9;
  resize: vertical;
  outline:none;
  box-shadow: var(--shadow2);
}

/* ===== Footer ===== */
.footer{
  margin-top: 26px;
  padding: 18px 0 24px;
  border-top: 1px solid var(--stroke);
  color: var(--muted);
}

.footer__inner{
  display:flex; gap:10px; flex-wrap:wrap; align-items:center; justify-content:center;
}

.footer a{ color: var(--muted); text-decoration:none; border-bottom:1px dashed transparent; }
.footer a:hover{ border-bottom-color: var(--muted); }
.sep{ opacity:.6; }

/* ===== Toast (رسمي) ===== */
.toast{
  position: fixed;
  inset-inline-start: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(255,255,255,.95);
  border: 1px solid var(--stroke);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  box-shadow: var(--shadow);
}

.toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* Responsive controls and readable multilingual content. */
body { overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; }
button, select { touch-action: manipulation; }
[hidden] { display: none !important; }
main { position: relative; padding-top: 18px; }
.bg-orbs { overflow: hidden; }
.topbar__inner { gap: 16px; }
.brand { min-width: 0; }
.brand__logo { flex: 0 0 42px; }
.topbar__actions { flex-shrink: 0; }
.btn { width: auto; min-height: 44px; font-weight: 600; }
.btn:disabled, .stepper__btn:disabled { opacity: .6; cursor: wait; transform: none; }
.panel__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.panel__row--actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.control { min-width: 0; }
.control__label { display: block; font-weight: 600; color: var(--text); }
.stepper { padding: 0; gap: 8px; max-width: 320px; margin-inline: auto; }
.stepper__btn { flex: 0 0 44px; }
.stepper__input { min-width: 0; width: 100%; text-align: center; }
.output__textarea { font-size: 16px; min-height: 230px; }
.output__bar { color: var(--text); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.8; }
.content-card { border: 1px solid var(--stroke); border-radius: 18px; background: var(--surface); padding: clamp(18px, 3vw, 30px); margin-block: 20px; box-shadow: var(--shadow2); }
.content-card h2 { margin-top: 0; font-size: 23px; }
.content-card p { line-height: 1.9; max-width: 85ch; }
.prose { max-width: 900px; margin-inline: auto; }
.prose .hero__title { margin-top: 0; }
.back-link { margin-top: 14px; }
summary { cursor: pointer; padding-block: 12px; font-weight: 600; }
.language-links { margin-top: 12px; text-align: center; }
.language-links nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; padding: 10px; }
.language-links a { min-height: 32px; display: inline-flex; align-items: center; }
.footer__inner { gap: 12px 20px; }
[aria-current="page"] { font-weight: 800; }
.ad-container { margin-block: 24px; min-height: 130px; text-align: center; }
.ad-label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 10px; }
.adsbygoogle { display: block; }
.toast { left: 50%; right: auto; inset-inline-start: auto; max-width: calc(100vw - 32px); width: max-content; z-index: 100; text-align: center; }
.skip-link { position: fixed; top: 8px; inset-inline-start: 16px; z-index: 101; background: white; padding: 12px; border: 2px solid var(--primary); border-radius: 8px; transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.error-code { font-size: 48px; font-weight: 800; color: var(--primary); margin: 0; }
@media (max-width: 760px) {
  .topbar__inner { flex-wrap: wrap; }
  .topbar__actions { width: 100%; justify-content: space-between; }
  .select { flex: 1; max-width: 240px; }
  .select select { width: 100%; min-height: 44px; }
  .panel__row--actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
  .container { width: calc(100% - 24px); }
  .panel { padding: 14px; }
  .panel__row:not(.panel__row--actions) { grid-template-columns: 1fr; gap: 18px; }
  .hero__title { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
