:root {
  --green: #0b6b4f;
  --green-dark: #074a3d;
  --gold: #d4af37;
  --bg: #f4f7f5;
  --card: #ffffff;
  --text: #1d2a25;
  --muted: #687d74;
  --line: #e8efeb;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
img { max-width: 100%; display: block; }

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

header.topbar { background: var(--green); color: white; position: sticky; top: 0; z-index: 20; }

.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 15px 0; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: white; }

.brand-mark {
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--gold); background: white;
  display: flex; align-items: center; justify-content: center;
}

.brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.nav { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.9rem; }
.nav a { color: white; opacity: 0.9; }
.nav a:hover { opacity: 1; }

.hero { background: linear-gradient(135deg, var(--green-dark), var(--green)); color: white; padding: 52px 0 32px; }
.hero-inner { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 32px; align-items: center; }

.hero-badge {
  display: inline-block; background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 999px;
  padding: 8px 14px; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
}

.hero h1 { font-size: clamp(2.3rem, 4vw, 4rem); line-height: 1.1; margin: 12px 0 16px; }
.hero p { font-size: 1.04rem; opacity: 0.92; margin: 0; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.btn { display: inline-block; padding: 12px 18px; border-radius: 10px; font-weight: 700; }
.btn-primary { background: var(--gold); color: #0d2923; }
.btn-secondary { background: rgba(255,255,255,0.08); color: white; border: 1px solid rgba(255,255,255,0.15); }

.hero-card {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow);
}

.hero-card img { width: 100%; height: 320px; object-fit: cover; }

.main-layout {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 0.72fr);
  gap: 28px; padding: 32px 0 60px;
}

.content-section { display: grid; gap: 22px; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}

.section-header h2 { margin: 0; font-size: 1.45rem; }
.more-link { font-weight: 700; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }

.article-card {
  background: white; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow);
}

.article-card img { width: 100%; height: 200px; object-fit: cover; }
.article-card-body { padding: 16px; }

.meta-row { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 0.74rem; margin-bottom: 10px; }

.pill {
  display: inline-block; background: #edf5f1; color: var(--green);
  border-radius: 999px; padding: 5px 8px; font-weight: 700;
}

.article-card h3 { margin: 0 0 8px; font-size: 1.12rem; line-height: 1.4; }
.article-card p { margin: 0 0 12px; color: var(--muted); font-size: 0.94rem; }

.sidebar { display: grid; gap: 22px; }

.panel {
  background: white; border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; box-shadow: var(--shadow);
}

.panel h3 { margin: 0 0 16px; font-size: 1.1rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-block; background: #edf5f1; color: var(--green);
  padding: 8px 10px; border-radius: 999px; font-weight: 700; font-size: 0.78rem;
  border: none; cursor: pointer;
}
.tag.active { background: var(--green); color: white; }

.share-box { display: flex; flex-wrap: wrap; gap: 8px; }
.share-box a {
  display: inline-block; background: #edf5f1; color: var(--green);
  padding: 8px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
}

footer { background: #0d2d26; color: white; padding: 46px 0 18px; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 0.8fr 0.8fr 1fr; gap: 24px; }
.footer-grid h4 { margin: 0 0 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-grid a, .footer-grid p, .footer-grid li { color: rgba(255,255,255,0.75); font-size: 0.92rem; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12); margin-top: 24px; padding-top: 18px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  color: rgba(255,255,255,0.72); font-size: 0.8rem;
}

.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 12px; }

.tool-card {
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; box-shadow: var(--shadow); display: block; text-align: left;
  cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
  color: inherit; font: inherit;
}

.tool-card:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(0,0,0,0.09); }
.tool-card h3 { margin-top: 0; margin-bottom: 10px; font-size: 1.05rem; color: var(--text); }
.tool-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.form-box {
  background: white; border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow);
}

.form-box label { display: block; margin-bottom: 8px; font-weight: 700; }

.form-box input,
.form-box select,
.form-box textarea,
.form-box button {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #dfe7e1; margin-bottom: 12px; font-size: 1rem;
  font-family: inherit;
}

.form-box button {
  background: var(--green); color: white; font-weight: 700; cursor: pointer;
}

.form-box button:hover { background: var(--green-dark); }

.result-box {
  background: #edf6f2; border: 1px solid #dfeae4; border-radius: 12px;
  padding: 16px; margin-top: 10px; color: var(--text);
}

.ayat-list { display: grid; gap: 14px; margin-top: 12px; }
.ayat-item {
  background: #f8fbf9; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
.ayat-arab { font-size: 1.6rem; text-align: right; direction: rtl; margin: 0 0 8px; line-height: 2; }
.ayat-latin { font-style: italic; color: var(--muted); margin: 0 0 6px; }
.ayat-id { margin: 0 0 8px; }

.prayer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px; margin-top: 12px;
}

.prayer-item {
  background: #f8fbf9; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; display: flex; flex-direction: column; gap: 4px;
}

.prayer-item span { color: var(--muted); font-size: 0.8rem; }
.prayer-item strong { font-size: 1.15rem; color: var(--green); }

.qibla-compass {
  position: relative; width: 220px; height: 220px; margin: 20px auto;
  border-radius: 50%; border: 6px solid #dfeae4; background: #f8fbf9;
}

.qibla-label { position: absolute; font-weight: 700; color: var(--muted); font-size: 0.8rem; }
.qibla-n { top: 6px; left: 50%; transform: translateX(-50%); }
.qibla-s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.qibla-w { left: 8px; top: 50%; transform: translateY(-50%); }
.qibla-e { right: 8px; top: 50%; transform: translateY(-50%); }

.qibla-needle {
  position: absolute; left: 50%; bottom: 50%; width: 4px; height: 90px;
  background: linear-gradient(to top, transparent, var(--gold));
  transform-origin: bottom center; transform: rotate(0deg);
  transition: transform 0.6s ease; border-radius: 4px;
}

.qibla-center {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  background: var(--green); border-radius: 50%; transform: translate(-50%, -50%);
}

.pegon-output { font-size: 1.8rem; direction: rtl; text-align: right; margin: 8px 0 0; }
.caligrafi-preview { text-align: center; }

.arabic-keys { display: flex; flex-wrap: wrap; gap: 8px; }
.arabic-key { font-size: 1.2rem; min-width: 44px; }
.arabic-space, .arabic-del { font-size: 0.85rem; }

.color-preview {
  width: 100%; height: 80px; border-radius: 12px;
  border: 1px solid var(--line); margin-bottom: 12px; background: var(--green);
}

.code-box {
  background: #0d1c1a; color: #eaf7f2; padding: 16px; border-radius: 12px;
  font-family: monospace; white-space: pre-wrap; word-break: break-word;
  overflow-x: auto; margin: 0;
}

@media (max-width: 900px) {
  .hero-inner, .main-layout, .footer-grid { grid-template-columns: 1fr; }
  .hero-card img { height: 220px; }
  .topbar-inner { flex-direction: column; align-items: flex-start; }
  .nav { width: 100%; }
}