:root {
  color-scheme: dark;
  font-family: Tahoma, "Leelawadee UI", system-ui, sans-serif;
  color: #f8f7ff;
  background: #0e0c1d;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: #0e0c1d; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #ffca4b; outline-offset: 3px; }
[hidden] { display: none !important; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 16px; border-radius: 10px; background: #fff; color: #17132e; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: 210px minmax(240px, 620px) 1fr;
  gap: 24px;
  align-items: center;
  min-height: 76px;
  padding: 12px 28px;
  background: rgba(21, 18, 43, 0.94);
  border-bottom: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 23px; font-weight: 900; letter-spacing: -.04em; text-decoration: none; }
.brand > span:last-child > span { color: #ff6f91; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: linear-gradient(135deg, #7c5cff, #d657ff); box-shadow: 0 8px 22px rgba(124,92,255,.35); font-size: 22px; }
.search { position: relative; }
.search svg { position: absolute; top: 50%; left: 17px; width: 20px; fill: none; stroke: #9f9ab4; stroke-linecap: round; stroke-width: 2; transform: translateY(-50%); }
.search input { width: 100%; height: 48px; padding: 0 18px 0 48px; border: 1px solid rgba(255,255,255,.08); border-radius: 15px; background: #292541; color: #fff; }
.search input::placeholder { color: #a9a3bb; }
.search input:focus { border-color: #8d70ff; background: #302a4d; }
.header-note { justify-self: end; padding: 9px 14px; border: 1px solid rgba(255,111,145,.2); border-radius: 999px; background: rgba(255,111,145,.08); color: #ffb4c5; font-size: 12px; }
.menu-button { display: none; width: 42px; height: 42px; padding: 11px; border: 0; border-radius: 12px; background: #292541; }
.menu-button span { display: block; height: 2px; margin: 4px 0; border-radius: 2px; background: #fff; }

.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.sidebar { position: sticky; top: 76px; height: calc(100vh - 76px); padding: 26px 17px; overflow-y: auto; background: #15122b; border-right: 1px solid rgba(255,255,255,.06); }
.sidebar nav { display: grid; gap: 5px; }
.nav-label { margin: 0 12px 12px; color: #817b98; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.nav-item { display: flex; gap: 12px; align-items: center; width: 100%; padding: 11px 12px; border: 0; border-radius: 11px; background: transparent; color: #bdb8ce; text-align: left; cursor: pointer; transition: background 150ms ease, color 150ms ease; }
.nav-item span { width: 22px; font-size: 16px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: linear-gradient(100deg, rgba(124,92,255,.2), rgba(214,87,255,.08)); color: #fff; box-shadow: inset 3px 0 #8b6cff; }
.sidebar-card { margin-top: 28px; padding: 18px; border: 1px solid rgba(255,255,255,.07); border-radius: 16px; background: linear-gradient(145deg, #24203e, #19162d); }
.sidebar-card > span { font-size: 24px; }
.sidebar-card strong { display: block; margin-top: 9px; font-size: 13px; }
.sidebar-card p { margin: 6px 0 0; color: #9993aa; font-size: 11px; line-height: 1.65; }

main { min-width: 0; padding: 0 clamp(18px, 3vw, 46px); overflow: hidden; background: radial-gradient(circle at 85% 0%, rgba(124,92,255,.14), transparent 34%), #0e0c1d; }
.topic-rail { display: flex; gap: 9px; padding: 22px 0 20px; overflow-x: auto; scrollbar-width: none; }
.topic-rail::-webkit-scrollbar { display: none; }
.topic { flex: 0 0 auto; padding: 9px 15px; border: 1px solid rgba(255,255,255,.08); border-radius: 11px; background: #201c36; color: #aca6bd; font-size: 12px; cursor: pointer; }
.topic:hover { color: #fff; }
.topic.active { border-color: #8468f7; background: #7254ed; color: #fff; box-shadow: 0 7px 20px rgba(114,84,237,.28); }

.spotlight { position: relative; min-height: clamp(300px, 35vw, 480px); overflow: hidden; border: 1px solid rgba(255,255,255,.1); border-radius: 24px; background: #27223e; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.spotlight > img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.spotlight-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,8,24,.94) 0%, rgba(10,8,24,.72) 38%, rgba(10,8,24,.05) 76%), linear-gradient(0deg, rgba(10,8,24,.35), transparent 45%); }
.spotlight-copy { position: absolute; z-index: 1; top: 50%; left: clamp(24px, 5vw, 68px); width: min(460px, 54%); transform: translateY(-50%); }
.pill { display: inline-block; padding: 6px 11px; border: 1px solid rgba(255,202,75,.3); border-radius: 999px; background: rgba(255,202,75,.11); color: #ffd56e; font-size: 11px; font-weight: 700; }
.spotlight h1 { margin: 13px 0 8px; font-size: clamp(30px, 4vw, 54px); line-height: 1.1; letter-spacing: -.035em; }
.spotlight p { margin: 0; color: #d1cddd; font-size: clamp(13px, 1.3vw, 17px); line-height: 1.65; }
.read-button { display: inline-flex; gap: 12px; align-items: center; margin-top: 22px; padding: 12px 17px; border: 0; border-radius: 12px; background: #fff; color: #1c1733; font-weight: 700; cursor: pointer; transition: transform 150ms ease; }
.read-button:hover { transform: translateY(-2px); }

.catalog { padding: 40px 0 54px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading span { color: #ff8daa; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.section-heading h2 { margin: 4px 0 0; font-size: clamp(22px, 2.5vw, 32px); }
.section-heading > p { margin: 0; color: #8f899f; font-size: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(13px, 1.5vw, 20px); }
.content-card { min-width: 0; }
.content-card > button { display: block; width: 100%; padding: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.07); border-radius: 17px; background: #19162b; text-align: left; cursor: pointer; transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease; }
.content-card > button:hover { border-color: rgba(139,108,255,.5); box-shadow: 0 16px 36px rgba(0,0,0,.28); transform: translateY(-4px); }
.image-wrap { position: relative; display: block; overflow: hidden; aspect-ratio: 16/9; background: #292542; }
.image-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 280ms ease; }
.content-card > button:hover img { transform: scale(1.04); }
.badge { position: absolute; top: 10px; left: 10px; padding: 5px 8px; border-radius: 7px; background: #b91f4b; color: #fff; font-size: 9px; font-weight: 700; box-shadow: 0 5px 14px rgba(0,0,0,.25); }
.card-copy { display: grid; min-height: 113px; padding: 14px 15px 16px; }
.card-category { margin-bottom: 5px; color: #9a80ff; font-size: 10px; font-weight: 700; }
.card-copy strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.card-copy small { margin-top: 6px; overflow: hidden; color: #9791a8; font-size: 11px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { padding: 70px 20px; border: 1px dashed rgba(255,255,255,.12); border-radius: 20px; color: #a19aaf; text-align: center; }
.empty-state > span { font-size: 32px; }
.empty-state h2 { margin: 10px 0 5px; color: #fff; }
.empty-state p { margin: 0 0 18px; }
.empty-state button { padding: 10px 15px; border: 0; border-radius: 10px; background: #7356ed; cursor: pointer; }

footer { display: grid; grid-template-columns: auto minmax(220px, 620px) auto; gap: 28px; align-items: center; padding: 28px 0 36px; border-top: 1px solid rgba(255,255,255,.07); color: #7e788e; font-size: 11px; }
footer p { margin: 0; line-height: 1.6; }
footer > span { justify-self: end; }
.footer-brand { color: #fff; font-size: 17px; font-weight: 900; text-decoration: none; }

.content-dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 1px solid rgba(255,255,255,.13); border-radius: 22px; background: #19162c; color: #fff; box-shadow: 0 35px 90px rgba(0,0,0,.65); }
.content-dialog::backdrop { background: rgba(4,3,11,.78); backdrop-filter: blur(8px); }
.content-dialog > img { display: block; width: 100%; aspect-ratio: 16/7; object-fit: cover; }
.dialog-close { position: absolute; top: 13px; right: 13px; display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; background: rgba(10,8,24,.78); font-size: 24px; line-height: 1; cursor: pointer; }
.dialog-body { padding: clamp(22px, 4vw, 38px); }
.dialog-category { color: #a88fff; font-size: 11px; font-weight: 700; }
.dialog-body h2 { margin: 6px 0 10px; font-size: clamp(25px, 4vw, 38px); }
.dialog-lead { margin: 0; color: #c9c4d5; line-height: 1.75; }
.dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.dialog-grid > div { padding: 17px; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; background: #211d37; }
.dialog-grid strong { font-size: 12px; }
.dialog-grid p { margin: 7px 0 0; color: #a8a2b6; font-size: 12px; line-height: 1.7; }
.backdrop { display: none; }

@media (max-width: 1050px) {
  .site-header { grid-template-columns: 180px minmax(220px, 1fr) auto; }
  .layout { grid-template-columns: 205px minmax(0, 1fr); }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .site-header { grid-template-columns: 42px auto minmax(120px, 1fr); gap: 10px; min-height: 68px; padding: 10px 14px; }
  .menu-button { display: block; }
  .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
  .brand { font-size: 19px; }
  .header-note { display: none; }
  .search { grid-column: auto; }
  .search input { height: 42px; }
  .layout { display: block; min-height: calc(100vh - 68px); }
  .sidebar { position: fixed; z-index: 50; top: 0; left: 0; width: 260px; height: 100vh; padding-top: 82px; box-shadow: 18px 0 50px rgba(0,0,0,.4); transform: translateX(-105%); transition: transform 180ms ease; }
  .menu-open .sidebar { transform: translateX(0); }
  .backdrop { position: fixed; z-index: 40; inset: 0; background: rgba(5,3,14,.67); }
  .menu-open .backdrop { display: block; }
  main { padding: 0 18px; }
  .topic-rail { padding-top: 16px; }
  .spotlight { min-height: 360px; }
  .spotlight-copy { top: auto; bottom: 25px; left: 25px; width: calc(100% - 50px); transform: none; }
  .spotlight-shade { background: linear-gradient(0deg, rgba(9,7,22,.96), rgba(9,7,22,.2) 75%); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  footer { grid-template-columns: 1fr; gap: 9px; }
  footer > span { justify-self: start; }
}

@media (max-width: 480px) {
  .site-header { grid-template-columns: 42px auto; }
  .search { grid-column: 1 / -1; }
  .site-header { padding-bottom: 12px; }
  .topic-rail { padding-top: 13px; }
  main { padding: 0 13px; }
  .spotlight { min-height: 330px; border-radius: 18px; }
  .spotlight-copy { bottom: 21px; left: 20px; width: calc(100% - 40px); }
  .spotlight h1 { font-size: 29px; }
  .spotlight p { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .catalog { padding-top: 30px; }
  .section-heading { align-items: start; }
  .section-heading > p { padding-top: 5px; white-space: nowrap; }
  .card-grid { gap: 11px; }
  .content-card > button { border-radius: 13px; }
  .card-copy { min-height: 96px; padding: 11px; }
  .card-copy strong { font-size: 13px; }
  .card-copy small { font-size: 10px; }
  .dialog-grid { grid-template-columns: 1fr; }
}

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