:root{
  --bg: #f8f9fa;
  --text: #202122;
  --muted: #54595d;
  --link: #0645ad;
  --link-visited: #0b0080;
  --border: #a2a9b1;
  --border-soft: #c8ccd1;
  --panel: #ffffff;
  --panel2: #f8f9fa;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

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

body{
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  background-image: url("https://f4.bcbits.com/img/0036900258_130.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a{ color: var(--link); text-decoration: none; }
a:hover{ text-decoration: underline; }
a:visited{ color: var(--link-visited); }

.topbar{
  background: var(--panel);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-inner{
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.logo{
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(#ffffff, #eaecf0);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}
.brand-title{
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-title strong{
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-title span{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toplinks{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 12px;
  color: var(--muted);
}

.layout{
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}

.sidebar{
  background: var(--panel);
  border: 1px solid var(--border-soft);
  padding: 12px;
  position: sticky;
  top: 12px;
}
.sidebar h3{
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 700;
}
.sidebar ul{
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  font-size: 13px;
  display: grid;
  gap: 6px;
}
.sidebar .note{
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
}

.content{
  background: var(--panel);
  border: 1px solid var(--border-soft);
  padding: 16px;
  min-width: 0;
}

.title-row{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

h1{
  margin: 0;
  font-family: "Linux Libertine", "Georgia", "Times New Roman", Times, serif;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.15;
}

.subtitle{
  margin: 6px 0 14px 0;
  font-size: 13px;
  color: var(--muted);
}

.tabs{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 8px;
}
.tab{
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--link);
}
.tab.active{
  border-color: var(--border-soft);
  background: var(--panel2);
  color: var(--text);
}

.infobox{
  float: right;
  width: 280px;
  margin: 0 0 12px 16px;
  border: 1px solid var(--border);
  background: #f8f9fa;
  font-size: 13px;
}
.infobox .ibox-title{
  background: #eaecf0;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  text-align: center;
}
.infobox .ibox-img{
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-soft);
}
.infobox .ibox-img img{
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-soft);
  background: #fff;
}
.infobox table{
  width: 100%;
  border-collapse: collapse;
}
.infobox th, .infobox td{
  padding: 6px 8px;
  vertical-align: top;
  border-top: 1px solid var(--border-soft);
}
.infobox th{
  text-align: left;
  font-weight: 700;
  width: 40%;
  color: #202122;
}
.infobox td{
  color: #202122;
}

.lead{
  font-size: 14px;
  margin-top: 0;
}
h2{
  font-family: "Linux Libertine", "Georgia", "Times New Roman", Times, serif;
  font-size: 20px;
  font-weight: 400;
  margin: 18px 0 8px 0;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 4px;
}

.toc{
  border: 1px solid var(--border-soft);
  background: #f8f9fa;
  padding: 10px 12px;
  display: inline-block;
  margin: 10px 0 14px 0;
  font-size: 13px;
}
.toc-title{
  font-weight: 700;
  margin-bottom: 6px;
}
.toc ol{
  margin: 0;
  padding-left: 20px;
}
.toc li{
  margin: 4px 0;
}

.list{
  display: grid;
  gap: 10px;
  margin: 10px 0 0 0;
  padding: 0;
  list-style: none;
}

.entry{
  border: 1px solid var(--border-soft);
  background: #fff;
  padding: 10px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: start;
}
.thumb{
  width: 72px;
  height: 72px;
  border: 1px solid var(--border-soft);
  background: #f8f9fa;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.entry-title{
  margin: 0;
  font-weight: 700;
  font-size: 14px;
}
.kv{
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.kv span{ white-space: nowrap; }

.footnotes{
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
  margin-top: 16px;
  padding-top: 10px;
}

.sitefooter{
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px 24px;
  color: var(--muted);
  font-size: 12px;
}

.no-scroll{
  overflow: hidden;
}

.img-modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}
.img-modal.open{
  display: block;
}
.img-modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
}
.img-modal-img{
  position: relative;
  display: block;
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  margin: 4vh auto;
  border: 1px solid rgba(255,255,255,0.25);
  background: #fff;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  cursor: zoom-out;
}

@media (max-width: 900px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ position: static; }
  .infobox{ float: none; width: 100%; margin: 0 0 12px 0; }
}
