:root {
  --bg: #10161d;
  --bg-soft: #14202a;
  --card: #f8f2e8;
  --card-2: #fff9ef;
  --ink: #10161d;
  --muted: #5f5549;
  --line: rgba(16, 22, 29, .12);
  --gold: #d7a84d;
  --green: #76b58a;
  --red: #d66c5d;
  --shadow: 0 24px 80px rgba(0,0,0,.28);
  --radius: 28px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  font-family: 'Amiri', serif;
  font-weight: 700;
  background: var(--bg);
  color: var(--card-2);
  line-height: 1.8;
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; }
button, input, select { font: inherit; font-weight: 700; }
.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .18;
  background-image:
    radial-gradient(circle at 12% 20%, rgba(215,168,77,.22), transparent 28%),
    radial-gradient(circle at 84% 8%, rgba(118,181,138,.18), transparent 24%),
    linear-gradient(135deg, rgba(255,255,255,.05) 0 1px, transparent 1px 12px);
  z-index: -1;
}
.hero { padding: 22px clamp(16px, 4vw, 56px) 48px; }
.topbar, .hero-grid, .toolbar, .categories, .skill-page, footer {
  width: min(1180px, 100%);
  margin-inline: auto;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 54px;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 21px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--gold); color: var(--bg); border-radius: 14px;
  box-shadow: 0 12px 30px rgba(215,168,77,.25);
}
.top-link { color: var(--card-2); text-decoration: none; opacity: .88; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: stretch;
}
.eyebrow { color: var(--gold); margin: 0 0 10px; font-size: 20px; }
h1 {
  font-size: clamp(42px, 8vw, 92px);
  line-height: 1.05;
  margin: 0;
  letter-spacing: -1px;
  text-wrap: balance;
}
.lead { font-size: clamp(20px, 2.4vw, 27px); color: #eadfce; max-width: 720px; margin: 22px 0 0; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.btn, .back-btn {
  border: 0; border-radius: 999px; padding: 13px 22px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; transition: transform .2s ease, background .2s ease;
}
.btn:hover, .back-btn:hover { transform: translateY(-2px); }
.primary { background: var(--gold); color: var(--bg); }
.ghost { background: rgba(255,255,255,.08); color: var(--card-2); border: 1px solid rgba(255,255,255,.14); }
.stats-card {
  background: linear-gradient(160deg, var(--card-2), #e7d7bd);
  color: var(--ink); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: center; min-height: 280px;
}
.small-label { color: var(--muted); font-size: 19px; }
.stats-card strong { font-size: 92px; line-height: 1; margin: 14px 0; }
#liveState { color: #2f6d46; font-size: 18px; }
.toolbar {
  display: grid; grid-template-columns: 1fr 260px; gap: 14px;
  padding: 0 clamp(16px, 2vw, 0px); margin-top: 10px; margin-bottom: 26px;
}
.search-box, select {
  background: rgba(255,249,239,.96); color: var(--ink); border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px; min-height: 58px; box-shadow: 0 16px 40px rgba(0,0,0,.16);
}
.search-box { display: flex; align-items: center; gap: 10px; padding: 0 18px; }
.search-box span { color: var(--gold); font-size: 28px; }
input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); min-width: 0; }
select { padding: 0 16px; outline: 0; }
.categories { display: grid; gap: 20px; padding: 0 clamp(16px, 2vw, 0px) 36px; }
.category-card {
  background: rgba(255,249,239,.97); color: var(--ink); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.24);
}
.category-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.category-head h2 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.15; }
.count-pill, .pill {
  background: rgba(215,168,77,.18); color: #805a12; border: 1px solid rgba(215,168,77,.30);
  border-radius: 999px; padding: 6px 14px; white-space: nowrap;
}
.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.skill-card {
  border: 1px solid var(--line); background: #fffaf1; border-radius: 20px; padding: 16px;
  cursor: pointer; text-align: right; color: var(--ink); min-height: 150px; text-decoration: none;
  display: flex; flex-direction: column; gap: 8px; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.skill-card:hover, .skill-card:focus-visible { transform: translateY(-3px); border-color: rgba(215,168,77,.65); box-shadow: 0 18px 40px rgba(16,22,29,.12); outline: none; }
.skill-card h3 { margin: 0; font-size: 22px; line-height: 1.2; direction: ltr; text-align: left; }
.skill-card p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.skill-page { padding: 0 clamp(16px, 2vw, 0px) 42px; }
.back-btn { margin-bottom: 16px; background: var(--gold); color: var(--bg); }
.skill-detail {
  background: var(--card-2); color: var(--ink); border-radius: var(--radius); padding: clamp(18px, 4vw, 36px); box-shadow: var(--shadow);
}
.detail-head h2 { direction: ltr; text-align: left; font-size: clamp(36px, 6vw, 70px); margin: 14px 0 10px; line-height: 1.05; }
.detail-head p { color: var(--muted); font-size: 22px; margin: 0; max-width: 900px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-top: 26px; }
.info-panel, .meta-panel {
  border: 1px solid var(--line); border-radius: 22px; background: #fffaf1; padding: 20px;
}
.info-panel h3, .meta-panel h3 { margin: 0 0 12px; font-size: 25px; }
ul { margin: 0; padding-inline-start: 24px; color: var(--muted); }
li { margin-bottom: 8px; }
.meta-panel { margin-top: 14px; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.meta-item { background: rgba(16,22,29,.045); border-radius: 16px; padding: 13px; overflow-wrap: anywhere; }
.meta-item span { display: block; color: var(--muted); font-size: 15px; margin-bottom: 4px; }
.meta-item strong { color: var(--ink); }
footer { color: #eadfce; opacity: .9; padding: 24px 16px 42px; text-align: center; }
code { background: rgba(255,255,255,.10); padding: 2px 8px; border-radius: 8px; direction: ltr; display: inline-block; }
.empty { text-align: center; padding: 38px; color: var(--card-2); }

@media (max-width: 900px) {
  .hero-grid, .toolbar, .detail-grid, .meta-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-card { min-height: 180px; }
  .stats-card strong { font-size: 70px; }
}
@media (max-width: 560px) {
  :root { --radius: 20px; }
  body { line-height: 1.65; }
  .hero { padding: 14px 10px 24px; }
  .topbar { margin-bottom: 22px; }
  .brand { font-size: clamp(15px, 4.4vw, 18px); gap: 8px; min-width: 0; }
  .brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; flex: 0 0 auto; }
  .top-link { display: none; }
  h1 { font-size: clamp(30px, 10vw, 42px); letter-spacing: 0; }
  .eyebrow { font-size: 16px; margin-bottom: 6px; }
  .lead { font-size: clamp(16px, 4.6vw, 19px); margin-top: 14px; }
  .hero-actions { gap: 8px; margin-top: 18px; }
  .hero-actions .btn { width: 100%; }
  .btn, .back-btn { min-height: 42px; padding: 9px 16px; }
  .stats-card { min-height: 140px; padding: 18px; }
  .small-label { font-size: 16px; }
  .stats-card strong { font-size: clamp(50px, 18vw, 66px); margin: 8px 0; }
  #liveState { font-size: 15px; }
  .toolbar { gap: 10px; padding-inline: 10px; margin-bottom: 16px; }
  .search-box, select { min-height: 48px; border-radius: 16px; }
  .search-box { padding-inline: 12px; }
  .search-box span { font-size: 22px; }
  select { width: 100%; padding-inline: 12px; }
  .categories { gap: 14px; padding: 0 10px 24px; }
  .skills-grid { grid-template-columns: 1fr; }
  .category-card { padding: 13px; border-radius: 18px; }
  .category-head { flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .category-head h2 { font-size: clamp(23px, 7vw, 30px); }
  .count-pill, .pill { padding: 4px 10px; font-size: 15px; }
  .skill-card { min-height: auto; padding: 12px; border-radius: 16px; gap: 4px; }
  .skill-card h3 { font-size: clamp(18px, 5vw, 21px); overflow-wrap: anywhere; }
  .skill-card p { font-size: 14px; line-height: 1.55; -webkit-line-clamp: 2; }
  .skill-page { padding: 0 10px 28px; }
  .skill-detail { padding: 14px; border-radius: 18px; }
  .detail-head h2 { font-size: clamp(28px, 10vw, 42px); overflow-wrap: anywhere; }
  .detail-head p { font-size: 17px; }
  .info-panel, .meta-panel { padding: 14px; border-radius: 16px; }
  .info-panel h3, .meta-panel h3 { font-size: 21px; }
  .meta-item { padding: 10px; border-radius: 12px; }
}

@media (max-width: 380px) {
  .hero, .toolbar, .categories, .skill-page { padding-inline: 8px; }
  .category-card, .skill-detail { padding: 11px; }
  .stats-card strong { font-size: 48px; }
}

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