/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #008080;
  font-family: 'Arial', sans-serif;
  font-size: 11px;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* ── Win95 bevel helpers ────────────────────────────────── */
.bevel-out {
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
}
.bevel-out-2 {
  border-top:    2px solid #DFDFDF;
  border-left:   2px solid #DFDFDF;
  border-right:  2px solid #404040;
  border-bottom: 2px solid #404040;
}
.bevel-in {
  border-top:    1px solid #404040;
  border-left:   1px solid #404040;
  border-right:  1px solid #DFDFDF;
  border-bottom: 1px solid #DFDFDF;
}
.bevel-in-2 {
  border-top:    2px solid #808080;
  border-left:   2px solid #808080;
  border-right:  2px solid #DFDFDF;
  border-bottom: 2px solid #DFDFDF;
}

/* ── App window ─────────────────────────────────────────── */
#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #C0C0C0;
  border-top:    2px solid #DFDFDF;
  border-left:   2px solid #DFDFDF;
  border-right:  2px solid #404040;
  border-bottom: 2px solid #404040;
  overflow: hidden;
}

/* ── Title bar ──────────────────────────────────────────── */
#titlebar {
  height: 23px;
  background: linear-gradient(to right, #00007B, #1058A4);
  display: flex;
  align-items: center;
  padding: 0 3px;
  gap: 4px;
  flex-shrink: 0;
  user-select: none;
}
#titlebar svg { flex-shrink: 0; }
#titlebar-text {
  flex: 1;
  color: #FFF;
  font-size: 13px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0.3px;
}
#titlebar-btns { display: flex; gap: 2px; }
.wnd-btn {
  width: 16px; height: 14px;
  background: #C0C0C0;
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 8px; font-weight: bold; color: #000;
}
.wnd-btn:active {
  border-top:    1px solid #404040;
  border-left:   1px solid #404040;
  border-right:  1px solid #DFDFDF;
  border-bottom: 1px solid #DFDFDF;
}

/* ── Menu bar ───────────────────────────────────────────── */
#menubar {
  height: 23px;
  background: #C0C0C0;
  display: flex;
  align-items: center;
  padding: 0 2px;
  flex-shrink: 0;
  border-bottom: 1px solid #808080;
}
.mitem {
  padding: 2px 10px;
  font-size: 13px;
  cursor: default;
  white-space: nowrap;
  position: relative;
}
.mitem:hover { background: #000080; color: #FFF; }
.mitem.open { background: #000080; color: #FFF; }
.menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #C0C0C0;
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  box-shadow: 2px 2px 0 #000;
  z-index: 1000;
  padding: 2px;
}
.mitem.open .menu-dropdown { display: block; }
.menu-dropdown .mditem {
  padding: 4px 20px 4px 24px;
  font-size: 13px;
  color: #000;
  white-space: nowrap;
  cursor: default;
}
.menu-dropdown .mditem:hover { background: #000080; color: #FFF; }
.menu-dropdown .mditem.disabled { color: #808080; }
.menu-dropdown .mditem.disabled:hover { background: transparent; color: #808080; }
.menu-dropdown-scroll { max-height: 70vh; overflow-y: auto; }
.mditem-sub {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mditem-sub .sub-arrow { margin-left: 12px; font-size: 10px; }
#subcategory-popup {
  display: none;
  position: absolute;
  min-width: 200px;
  max-height: 60vh;
  overflow-y: auto;
  background: #C0C0C0;
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  box-shadow: 2px 2px 0 #000;
  z-index: 1002;
  padding: 2px;
}
#subcategory-popup .mditem {
  padding: 4px 20px 4px 24px;
  font-size: 13px;
  color: #000;
  white-space: nowrap;
  cursor: default;
}
#subcategory-popup .mditem:hover { background: #000080; color: #FFF; }
.menu-dropdown .mdsep {
  height: 1px;
  background: #808080;
  border-bottom: 1px solid #DFDFDF;
  margin: 2px 0;
}

/* ── Toolbar ────────────────────────────────────────────── */
#toolbar {
  background: #C0C0C0;
  display: flex;
  align-items: center;
  padding: 3px 4px;
  gap: 2px;
  flex-shrink: 0;
  border-bottom: 2px solid #808080;
  height: 40px;
}

/* Small icon+text toolbar button */
.tb-btn {
  height: 32px;
  padding: 0 8px;
  background: #C0C0C0;
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  color: #000;
  flex-shrink: 0;
}
.tb-btn:hover { background: #D0D0D0; }
.tb-btn:active, .tb-btn.tb-pressed {
  border-top:    1px solid #404040;
  border-left:   1px solid #404040;
  border-right:  1px solid #DFDFDF;
  border-bottom: 1px solid #DFDFDF;
  background: #B8B8B8;
}
.tb-btn.tb-disabled { color: #808080; cursor: default; }
.tb-btn.tb-disabled:hover { background: #C0C0C0; }
.tb-btn.tb-disabled:active {
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  background: #C0C0C0;
}

/* Dropdown toolbar select */
.tb-select {
  height: 24px;
  background: #FFFFFF;
  border-top:    1px solid #404040;
  border-left:   1px solid #404040;
  border-right:  1px solid #DFDFDF;
  border-bottom: 1px solid #DFDFDF;
  font-size: 13px;
  font-family: 'Arial', sans-serif;
  padding: 0 2px;
  cursor: pointer;
  color: #000;
  flex-shrink: 0;
}
.tb-select:focus { outline: none; }

.tb-vsep {
  width: 2px;
  height: 26px;
  border-left:  1px solid #808080;
  border-right: 1px solid #DFDFDF;
  margin: 0 2px;
  flex-shrink: 0;
}


/* ── Main area ──────────────────────────────────────────── */
#main {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* ── Left panel ─────────────────────────────────────────── */
#sidebar {
  width: 240px;
  min-width: 240px;
  background: #C0C0C0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  border-right: 2px solid #808080;
}


/* Image area */
#sb-image-area {
  flex-shrink: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-bottom: 1px solid #808080;
  position: relative;
  min-height: 120px;
  max-height: 160px;
  overflow: hidden;
}
#sb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  flex: 1;
}
#sb-image-placeholder {
  width: 100%;
  min-height: 130px;
  background: #404040;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #808080;
  font-size: 10px;
  text-align: center;
  padding: 8px;
}
#sb-image-btns {
  display: flex;
  gap: 3px;
  padding: 3px 4px;
  background: #C0C0C0;
  border-top: 1px solid #808080;
  flex-shrink: 0;
}
.sb-img-btn {
  flex: 1;
  padding: 2px 0;
  background: #C0C0C0;
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  font-size: 12px;
  font-family: 'Arial', sans-serif;
  cursor: pointer;
  text-align: center;
  color: #000;
}
.sb-img-btn:active {
  border-top:    1px solid #404040;
  border-left:   1px solid #404040;
  border-right:  1px solid #DFDFDF;
  border-bottom: 1px solid #DFDFDF;
}

/* Outline / Related sections */
#sb-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

#sb-related-bar {
  flex-shrink: 0;
  border-top: 2px solid #808080;
  background: #C0C0C0;
  padding: 5px 6px 6px;
}
#sb-related-label {
  font-size: 12px;
  font-weight: bold;
  font-family: Arial, sans-serif;
  color: #000;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#sb-related-select,
#sb-category-select {
  width: 100%;
  font-family: Arial, sans-serif;
  font-size: 13px;
  background: #FFF;
  border-top: 1px solid #404040;
  border-left: 1px solid #404040;
  border-right: 1px solid #DFDFDF;
  border-bottom: 1px solid #DFDFDF;
  outline: none;
  box-sizing: border-box;
  height: 24px;
}

.sb-section {
  border-bottom: 1px solid #808080;
}
.sb-section-header {
  background: #C0C0C0;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: bold;
  color: #000;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid #808080;
  user-select: none;
}
.sb-section-header:hover { background: #B8B8B8; cursor: pointer; }
.sb-section-body {
  background: #C0C0C0;
}
.sb-link {
  display: block;
  padding: 3px 14px;
  font-size: 12px;
  color: #CC0000;
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Arial', sans-serif;
}
.sb-link:hover { background: #000080; color: #FFFFFF; text-decoration: none; }
.sb-outline-item {
  display: block;
  padding: 3px 14px;
  font-size: 12px;
  color: #000;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Arial', sans-serif;
}
.sb-outline-item:hover { background: #000080; color: #FFFFFF; }
.sb-outline-item.h3 { padding-left: 26px; }
.sb-outline-item.active { color: #CC0000; font-weight: bold; }
.sb-outline-item.active:hover { color: #FFFFFF; }

/* Welcome panel (replaces sidebar content when no article) */
#sb-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#sb-results-label {
  font-size: 12px;
  color: #000;
  padding: 3px 5px 1px;
  font-weight: bold;
  flex-shrink: 0;
  border-bottom: 1px solid #808080;
}
#sb-results {
  flex: 1;
  overflow-y: auto;
  background: #FFFFFF;
  border-top:    1px solid #404040;
  border-left:   1px solid #404040;
  border-right:  1px solid #DFDFDF;
  border-bottom: 1px solid #DFDFDF;
  margin: 0 5px 5px;
}
.sb-result-item {
  padding: 3px 6px;
  font-size: 13px;
  cursor: pointer;
  color: #000;
  border-bottom: 1px solid #E8E8E8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-result-item:hover { background: #000080; color: #FFFFFF; }
.sb-result-item.active { background: #000080; color: #FFFFFF; }

/* Featured categories in welcome panel */
#sb-cats {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.sb-cat {
  padding: 3px 10px;
  font-size: 12px;
  color: #CC0000;
  cursor: pointer;
  text-decoration: underline;
  font-family: 'Arial', sans-serif;
}
.sb-cat:hover { background: #000080; color: #FFF; text-decoration: none; }

/* ── Content (article) pane ─────────────────────────────── */
#content {
  flex: 1;
  min-height: 0;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 2px solid #DFDFDF;
}

/* Welcome / article-loading message in content pane */
#content-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 24px;
  background: #f5efe0;
  overflow-y: auto;
}
#cw-logo {
  font-family: 'Times New Roman', serif;
  font-size: 42px;
  font-weight: bold;
  color: #000080;
  letter-spacing: -2px;
  margin-bottom: 2px;
}
#cw-logo em { font-style: normal; color: #CC0000; }
#cw-logo-img {
  width: 440px;
  max-width: 90%;
  height: auto;
  display: block;
  margin-bottom: 10px;
}
#cw-byline {
  font-family: 'Arial', sans-serif;
  font-size: 11px;
  color: #808080;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
}
#cw-rule {
  width: 360px;
  height: 1px;
  background: #000080;
  margin-bottom: 20px;
}
#cw-intro {
  font-family: 'Times New Roman', serif;
  font-size: 13px;
  color: #333;
  line-height: 1.7;
  text-align: center;
  max-width: 420px;
  margin-bottom: 28px;
}
#cw-grid {
  display: grid;
  grid-template-columns: repeat(3, 130px);
  gap: 4px;
}
.cw-card {
  background: #C0C0C0;
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  padding: 5px 8px;
  cursor: pointer;
  font-family: 'Arial', sans-serif;
}
.cw-card:hover { background: #D8D8D8; }
.cw-card:active {
  border-top:    1px solid #404040;
  border-left:   1px solid #404040;
  border-right:  1px solid #DFDFDF;
  border-bottom: 1px solid #DFDFDF;
}
.cw-card-title { font-size: 11px; font-weight: bold; color: #000000; }
.cw-card-cat   { font-size: 10px; color: #555; margin-top: 1px; }

/* Prevent any injected Wikipedia element from coloring the background */
#article-scroll * { background-color: transparent; }
#article-scroll table td, #article-scroll table th { background-color: revert; }

/* Article scroll container */
#article-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #FFFFFF !important;
  padding: 0;
  display: none;
}
#article-scroll .art-body {
  padding: 10px 20px 28px 18px;
}

/* ── Article typography ──────────────────────────────────── */
#article-scroll .art-title {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #000000;
  color: #FFFFFF;
  font-family: 'Times New Roman', Georgia, serif;
  font-size: 30px;
  font-weight: bold;
  line-height: 1.1;
  padding: 10px 18px;
  margin: 0;
  border-bottom: 1px solid #404040;
}
#article-scroll .art-desc {
  font-family: 'Arial', sans-serif;
  font-size: 11px;
  color: #555;
  font-style: italic;
  margin-bottom: 10px;
}
#article-scroll .art-rule {
  height: 1px;
  background: #000000;
  margin-bottom: 13px;
}

/* Body text */
#article-scroll p {
  font-family: 'Times New Roman', Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
  color: #000000;
  margin-bottom: 11px;
  text-align: justify;
}
/* Section headings — Encarta style: bold black, no color */
#article-scroll h2 {
  font-family: 'Arial', sans-serif;
  font-size: 16px;
  font-weight: bold;
  color: #000000;
  margin: 18px 0 5px;
  padding-bottom: 0;
  border: none;
}
#article-scroll h3 {
  font-family: 'Arial', sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: #000000;
  margin: 14px 0 4px;
}
#article-scroll h4 {
  font-family: 'Arial', sans-serif;
  font-size: 13px;
  font-weight: bold;
  color: #000;
  margin: 12px 0 3px;
}
/* Links — Encarta used bright red */
#article-scroll a {
  color: #CC0000;
  text-decoration: underline;
  cursor: pointer;
}
#article-scroll a:hover { color: #FF0000; }

#article-scroll ul, #article-scroll ol {
  margin: 4px 0 9px 24px;
}
#article-scroll li {
  font-family: 'Times New Roman', Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
  color: #000;
  margin-bottom: 2px;
}

/* Tables */
#article-scroll table {
  border-collapse: collapse;
  margin-bottom: 10px;
  max-width: 100%;
  font-size: 11px;
}
#article-scroll td, #article-scroll th {
  border: 1px solid #C0C0C0;
  padding: 3px 6px;
  vertical-align: top;
  font-family: 'Arial', sans-serif;
  font-size: 11px;
}
#article-scroll th {
  background: #E8E8F8;
  font-weight: bold;
  color: #000060;
}
#article-scroll tr:nth-child(even) td { background: #F8F8F8; }

/* Infobox — push to main article, Win95 bordered */
#article-scroll .infobox,
#article-scroll table.infobox,
#article-scroll .infobox_v2 {
  float: right !important;
  clear: right !important;
  margin: 0 0 12px 14px !important;
  background: #F4F4F8 !important;
  border-top:    1px solid #DFDFDF !important;
  border-left:   1px solid #DFDFDF !important;
  border-right:  1px solid #404040 !important;
  border-bottom: 1px solid #404040 !important;
  font-size: 10px !important;
  max-width: 220px !important;
  width: auto !important;
  font-family: 'Arial', sans-serif !important;
  padding: 0 !important;
}
#article-scroll .infobox caption,
#article-scroll table.infobox caption {
  background: #000080 !important;
  color: #FFFFFF !important;
  font-size: 10px !important;
  font-weight: bold !important;
  padding: 3px 5px !important;
  text-align: center !important;
}
#article-scroll .infobox td,
#article-scroll .infobox th,
#article-scroll table.infobox td,
#article-scroll table.infobox th {
  border: none !important;
  border-bottom: 1px solid #DCDCDC !important;
  padding: 2px 4px !important;
  background: transparent !important;
  font-size: 10px !important;
}
#article-scroll .infobox th,
#article-scroll table.infobox th {
  background: #E0E0F0 !important;
  font-weight: bold !important;
}

/* Article sidebar boxes */
#article-scroll .sidebar,
#article-scroll table.sidebar {
  float: right !important;
  clear: right !important;
  margin: 0 0 12px 14px !important;
  background: #F4F4F8 !important;
  border-top:    1px solid #DFDFDF !important;
  border-left:   1px solid #DFDFDF !important;
  border-right:  1px solid #404040 !important;
  border-bottom: 1px solid #404040 !important;
  font-size: 10px !important;
  max-width: 220px !important;
  width: auto !important;
  font-family: 'Arial', sans-serif !important;
  padding: 0 !important;
}

/* Thumb images — Win95 beveled frame */
#article-scroll .thumb {
  float: right;
  clear: right;
  margin: 0 0 10px 14px;
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  background: #F0F0F0;
  padding: 2px;
  max-width: 180px;
}
#article-scroll .thumbimage img { display: block; max-width: 100%; }
#article-scroll .thumbcaption {
  font-size: 9px;
  font-family: 'Arial', sans-serif;
  padding: 2px 3px;
  color: #444;
  background: #F0F0F0;
  border-top: 1px solid #C0C0C0;
  text-align: center;
}

/* Hatnote */
#article-scroll .hatnote {
  font-size: 11px;
  font-style: italic;
  color: #555;
  margin: 0 0 10px;
  padding: 2px 8px;
  border-left: 3px solid #CC0000;
  background: #FFF8F8;
}

/* ── Status bar ──────────────────────────────────────────── */
#statusbar {
  height: 20px;
  background: #C0C0C0;
  border-top: 2px solid #808080;
  display: flex;
  align-items: center;
  padding: 0 4px;
  gap: 4px;
  flex-shrink: 0;
}
.st-pane {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #DFDFDF;
  border-bottom: 1px solid #DFDFDF;
  padding: 1px 5px;
  font-size: 11px;
  height: 16px;
  line-height: 14px;
  overflow: hidden;
  white-space: nowrap;
}
#st-main  { flex: 1; text-overflow: ellipsis; }
#st-right { width: 180px; flex-shrink: 0; text-align: right; }

/* ── Win95 scrollbars ───────────────────────────────────── */
::-webkit-scrollbar { width: 17px; height: 17px; }
::-webkit-scrollbar-track { background: #C0C0C0; }
::-webkit-scrollbar-thumb {
  background: #C0C0C0;
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  min-height: 20px;
}
::-webkit-scrollbar-corner { background: #C0C0C0; }
::-webkit-scrollbar-button {
  background: #C0C0C0;
  border-top:    1px solid #DFDFDF;
  border-left:   1px solid #DFDFDF;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  height: 17px; width: 17px;
  display: block;
}
