:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface-2: #1f1f1f;
  --ink: #f5f5f2;
  --muted: #a3a3a0;
  --yellow: #f5c518;
  --yellow-dark: #d9a90a;
  --line: #2a2a2a;
  --radius: 14px;
  --font: "Cairo", "Segoe UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(13,13,13,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--yellow); color: #0d0d0d;
  display: grid; place-items: center; font-weight: 900; font-size: 20px;
}
.brand-text { font-weight: 700; font-size: 17px; }

/* buttons */
.btn {
  font-family: inherit; font-weight: 700; font-size: 15px;
  border: none; border-radius: 10px; padding: 10px 22px;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: filter .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--yellow); color: #0d0d0d; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--yellow); color: var(--yellow); }
.btn-disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.btn-wide { width: 100%; text-align: center; }

/* hero */
.hero { padding: 64px 0 40px; text-align: center; }
.eyebrow {
  color: var(--yellow); font-weight: 700; letter-spacing: .12em;
  font-size: 13px; margin-bottom: 12px;
}
.hero h1 { font-size: clamp(28px, 5vw, 44px); font-weight: 900; line-height: 1.3; }
.hero h1 em { color: var(--yellow); font-style: normal; }
.hero .lead { color: var(--muted); font-size: 18px; max-width: 620px; margin: 14px auto 0; }

/* catalog */
.catalog { padding: 24px 0 40px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .2s ease, transform .2s ease;
}
.card:hover { border-color: var(--yellow-dark); transform: translateY(-3px); }
.card-top { padding: 18px 20px 14px; }
.card-top.free { background: linear-gradient(135deg, #123f1e, #0c2a14); }
.card-top.paid { background: linear-gradient(135deg, #3d3005, #241c03); }
.tag {
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  background: var(--yellow); color: #0d0d0d;
  padding: 4px 12px; border-radius: 20px;
}
.card-top.free .tag { background: #3ddc78; }
.card-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-body h2 { font-size: 21px; font-weight: 900; }
.desc { color: var(--muted); font-size: 15px; }
.bullets { list-style: none; display: grid; gap: 6px; }
.bullets li { font-size: 14px; padding-right: 20px; position: relative; }
.bullets li::before {
  content: "✓"; position: absolute; right: 0;
  color: var(--yellow); font-weight: 900;
}
.fineprint { font-size: 12px; color: var(--muted); text-align: center; }

/* howto */
.howto { padding: 32px 0 56px; text-align: center; }
.howto h3 { font-size: 22px; margin-bottom: 22px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 18px;
}
.num {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--yellow); color: #0d0d0d;
  font-weight: 900; font-size: 18px; margin-bottom: 10px;
}

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0; }
.site-footer p { color: var(--muted); font-size: 13px; text-align: center; }

/* auth + library shared */
.auth-page { max-width: 440px; margin: 56px auto; padding: 0 20px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px;
}
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; font-family: inherit; font-size: 15px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
}
.field input:focus { outline: none; border-color: var(--yellow); }
.msg { font-size: 14px; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; display: none; }
.msg.err { display: block; background: #3a1212; color: #ff9e9e; border: 1px solid #5c1f1f; }
.msg.ok { display: block; background: #0f2c18; color: #8af0ae; border: 1px solid #1f5c33; }
.auth-switch { text-align: center; font-size: 14px; color: var(--muted); margin-top: 16px; }
.auth-switch a { color: var(--yellow); }

.library-page { max-width: 860px; margin: 40px auto; padding: 0 20px; }
.library-page h1 { font-size: 26px; margin-bottom: 6px; }
.library-page .sub { color: var(--muted); margin-bottom: 24px; }
.lib-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.lib-item .meta h2 { font-size: 18px; }
.lib-item .meta p { font-size: 13px; color: var(--muted); }
.locked { opacity: .55; }
