:root {
  --gold: #b8860b;
  --text: #1a1a1a;
  --muted: #555;
  --bg: #f4f4f6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

header {
  border-top: 4px solid var(--gold);
  background: linear-gradient(135deg, #ffffff, #ececf0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  padding: 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.2;
}

.by {
  font-size: 0.85rem;
  color: var(--muted);
}

.by strong { color: var(--gold); }

main {
  flex: 1;
  padding: 32px 0;
}

footer {
  border-top: 3px solid var(--gold);
  background: linear-gradient(135deg, #ffffff, #ececf0);
  padding: 14px 0;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
}

footer p + p { margin-top: 8px; }

footer a { color: var(--gold); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Layout: sidebar + panel ---------- */
:root { --line: #dcdce2; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

.layout.collapsed { grid-template-columns: 72px 1fr; }

/* Sidebar */
.sidebar {
  background: #f0f0f3;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
}

.sidebar-title {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.count {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.collapse {
  width: 30px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.addon-list { list-style: none; }

.addon-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-left: 4px solid transparent;
  text-decoration: none;
  color: var(--gold);
  font-weight: 700;
}

.addon-item:hover { background: #e8e8ed; }

.addon-item[aria-current="true"] {
  background: #e6e6ea;
  border-left-color: var(--gold);
}

.addon-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  font-size: 0.85rem;
}

.layout.collapsed .sidebar-title,
.layout.collapsed .count,
.layout.collapsed .addon-name { display: none; }

.layout.collapsed .sidebar-head { justify-content: center; padding: 14px 0; }
.layout.collapsed .addon-item { justify-content: center; padding: 14px 0; }

/* Panel */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 12px 0;
  background: #f1f1f4;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  margin-bottom: -1px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }

.tab[aria-selected="true"] {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.tab-body { padding: 28px; }

.tab-body h2 {
  margin-bottom: 8px;
  font-size: 1.9rem;
  color: var(--gold);
}

.text {
  white-space: pre-line;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
}

.shots {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.shots img {
  display: block;
  width: 165px;
  height: 95px;
  object-fit: cover;
  border-radius: 8px;
  background: #222;
}

.downloads { list-style: none; }
.downloads li + li { margin-top: 8px; }
.downloads a { color: var(--gold); font-weight: 600; }

.notice { color: var(--muted); }

@media (max-width: 760px) {
  .layout,
  .layout.collapsed { grid-template-columns: 1fr; }
}

/* Addon meta (version, API, dependencies) */
.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin-top: 18px;
  font-size: 0.95rem;
}

.meta dt { font-weight: 600; color: var(--text); }
.meta dd { color: var(--muted); }
.meta a { color: var(--gold); font-weight: 600; }

/* ---------- Info tab: description + download card ---------- */
.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.btn-download {
  display: block;
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.btn-download:hover { filter: brightness(1.08); }

.card-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.95rem;
}

.card-meta dt,
.card-meta dd {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.card-meta dt:first-of-type,
.card-meta dt:first-of-type + dd { border-top: 0; }

.card-meta dt { font-weight: 700; color: var(--text); }
.card-meta dd { color: var(--muted); text-align: right; }
.card-meta a { color: var(--gold); font-weight: 600; }

.card-more { margin-top: 12px; font-size: 0.9rem; }

/* Screenshots: same size, max 5 per row, click to enlarge */
.shots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.shots a { display: block; cursor: zoom-in; }

.shots img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.82);
  cursor: zoom-out;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

@media (max-width: 900px) {
  .info-grid { grid-template-columns: 1fr; }
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Fixed header/footer: only the content area scrolls ---------- */
html, body { height: 100%; overflow: hidden; }

header, footer { flex: none; }

main {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 24px 0;
}

main > .layout {
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}

.sidebar { align-self: start; }

.panel {
  align-self: start;
  max-height: 100%;
  display: flex;
  flex-direction: column;
}

.tabs {
  flex: none;
  overflow-x: auto;
  overflow-y: hidden;
}

.tab-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

@media (max-width: 760px) {
  main { display: block; overflow-y: auto; padding: 16px 0; }
  main > .layout { grid-template-rows: none; }
  .panel { max-height: none; }
  .tab-body { overflow: visible; }
}

/* Footer shadow, same as the header but cast upward */
footer {
  position: relative;
  z-index: 1;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.12);
}
