:root {
  --bg: #16344d;
  --accent: #1b1464;
  --accent-soft: #e2e2e2;
  --win-bg: #c0c0c0;
  --win-fg: #111;
  --title-bg: #181e4b;
  --title-fg: #e2e2e2;
  --border-hi: #ffffff;
  --border-lo: #4a4a4a;
  --link: #1b1464;
  --text-main: #111;
  --text-muted: #111;
  --article-bg: var(--win-bg);
  --sidebar-panel-width: 280px;
}

* { box-sizing: border-box; }

html {
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html::-webkit-scrollbar-button:vertical:start:increment,
html::-webkit-scrollbar-button:vertical:end:decrement,
body::-webkit-scrollbar-button:vertical:start:increment,
body::-webkit-scrollbar-button:vertical:end:decrement {
  display: none;
  height: 0;
}

body {
  background: #16344d;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--win-fg);
  font-family: "Press Start 2P", monospace;
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: auto;
  font-smooth: never;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#stars canvas {
  width: 100vw !important;
  height: 100vh !important;
  display: block;
}

main {
  --hero-gap: 13px;
  position: relative;
  z-index: 1;
  max-width: 1180px;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px 8px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
}

.landing-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-image.hero-layout-pending {
  visibility: hidden;
}

.landing-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lib-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-image {
  display: block;
  max-width: 100%;
  box-sizing: border-box;
  width: min(60%, 252px);
  height: auto;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #444;
  background: #222;
  border-radius: 2px;
  object-fit: cover;
  aspect-ratio: 16 / 9;
  position: static;
  margin: 0 auto var(--hero-gap) auto;
  transform: none;
}

main.landing-fit {
  justify-content: center;
}

main.landing-fit .landing-content {
  position: relative;
}

main.landing-fit .game-image {
  position: absolute;
  left: 50%;
  bottom: calc(100% + var(--hero-gap));
  margin: 0;
  transform: translateX(-50%);
}

.brand {
  text-align: center;
  color: #fff;
  margin: 0;
}

.glow {
  font-family: "Press Start 2P", monospace;
  font-size: 2.3rem;
  color: #fff;
  text-shadow: 2px 2px #000, 0 0 20px #fff8, 0 0 3px #fff2;
  margin-bottom: 8px;
  margin-top: 0;
  letter-spacing: 2px;
  text-align: center;
  padding-top: 30px;
}

.subtitle {
  font-family: "Press Start 2P", monospace;
  color: #eee;
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 1rem;
  text-align: center;
  text-shadow: 1px 1px 2px #222;
  letter-spacing: 1px;
  padding-bottom: 30px;
}

.shelf-footer {
  width: 100%;
  text-align: center;
  margin-top: 32px;
}

.lang-switcher {
  margin: 8px 0 10px 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.lang-switcher button,
button.pager-btn {
  font-family: "Press Start 2P", monospace;
  background: #e2e2e2;
  font-size: 0.75rem;
  scale: 70%;
  margin: 0;
  margin-left: -5px;
  margin-right: -5px;
  outline: none;
  transition: background 0.18s, color 0.18s, opacity 0.15s;
}

.lang-switcher button {
  opacity: 0.7;
}

.lang-switcher button.active,
.lang-switcher button:focus,
button.pager-btn:focus {
  opacity: 1;
  filter: none;
}

.shelf-footer-copy {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shelf-footer small {
  color: #c9c9c9;
  font-size: 0.9em;
  font-family: "Press Start 2P", monospace;
  line-height: 1.35;
}

.window {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--win-bg) !important;
  margin-bottom: 16px;
}

.window:last-of-type {
  margin-bottom: 0;
}

.title-bar {
  background: var(--title-bg) !important;
  color: var(--title-fg) !important;
  border-bottom: 1px solid #5661a2;
  cursor: default;
}

.title-bar-controls button:active,
.title-bar-controls button.pressed {
  background: #9dbafe;
  box-shadow: none;
}

.title-bar-text {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  line-height: 18px;
  letter-spacing: 0;
  padding-left: 3px;
  padding-top: 1px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.window-body {
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  line-height: 24px;
  padding: 7px 5px;
  color: var(--text-main);
  word-break: break-word;
}

.window.minimized .window-body {
  display: none;
}

.window.maximized {
  width: 100%;
  height: auto;
  left: 0;
  top: 0;
  z-index: 80;
}

.intro-copy {
  color: var(--text-muted);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.row.actions.stacked {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.row.actions.stacked .btn,
.row.actions.stacked input[type="submit"],
.row.actions.stacked button {
  width: 100%;
  text-align: center;
}

.cards-grid {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.shelf-index-layout {
  width: 100%;
}

.shelf-index-main {
  position: relative;
  width: 100%;
  max-width: 940px;
  margin-left: auto;
  margin-right: auto;
  min-width: 0;
}

.shelf-menu-slot,
.shelf-empty-window {
  width: 100%;
}

.shelf-menu-slot {
  margin-bottom: 16px;
}

.menu-actions {
  width: 100%;
}

@media (min-width: 901px) {
  .shelf-menu-slot {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--sidebar-panel-width);
    margin: 0;
    transform: translateX(calc(-100% - 16px));
  }

}

.lib-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-bottom: 0;
}

.ghost-card {
  user-select: none;
}

.lib-card.minimized {
  height: auto;
  align-self: start;
}

.lib-card .window-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.card-head {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.card-author {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}

.avatar {
  width: 82px;
  height: 82px;
  object-fit: cover;
  image-rendering: auto;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #444;
}

.avatar-large {
  width: 120px;
  height: 120px;
}

.avatar-noise {
  background:
    linear-gradient(135deg, #d6d6d6 25%, #eeeeee 25%, #eeeeee 50%, #d6d6d6 50%, #d6d6d6 75%, #eeeeee 75%, #eeeeee 100%);
  background-size: 16px 16px;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.lib-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  background: #e2e2e2;
  border: 2px solid #1b1464;
  color: #111;
  box-shadow: 2px 2px 0 #222;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  background: #e2e2e2;
  border: 2px solid #1b1464;
  color: #111;
  box-shadow: 2px 2px 0 #222;
}

.nickname {
  font-size: 14px;
  line-height: 24px;
  color: #111;
  margin-top: 6px;
}

h2,
.article-title {
  margin: 10px 0 0;
  font-family: "Press Start 2P", monospace;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.35;
  color: #111;
}

h2 {
  font-size: 20px;
}

.card-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-top: 2px;
  width: 100%;
}

.card-meta-top {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.card-meta-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.card-date {
  font-size: 10px;
  line-height: 16px;
}

.card-author-line {
  font-size: 10px;
  line-height: 16px;
  color: #111;
}

.card-author-label {
  color: inherit;
}

.card-author-name {
  color: inherit;
}

.card-title {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  color: #111;
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

h2 a,
.card-footer .btn,
.meta-actions .btn {
  color: inherit;
}

a {
  color: var(--link);
}

.card-summary,
.article-summary {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  line-height: 24px;
  color: #111;
}

.card-summary {
  font-size: 12px;
  line-height: 22px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
  max-height: calc(22px * 5);
}

.ghost-meta {
  padding-top: 3px;
}

.ghost-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}

.ghost-line {
  position: relative;
  display: block;
  border: 1px solid rgba(128, 128, 128, 0.6);
  background:
    linear-gradient(135deg, #d6d6d6 25%, #eeeeee 25%, #eeeeee 50%, #d6d6d6 50%, #d6d6d6 75%, #eeeeee 75%, #eeeeee 100%);
  background-size: 16px 16px;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.2);
}

.ghost-line-date {
  width: 42%;
  height: 12px;
}

.ghost-line-author {
  width: 56%;
  height: 12px;
}

.ghost-line-title {
  width: 74%;
  height: 24px;
  margin-top: 2px;
  border-bottom-width: 2px;
}

.ghost-line-summary {
  width: 88%;
  height: 16px;
}

.ghost-line-summary-wide {
  width: 94%;
}

.ghost-line-summary-short {
  width: 68%;
}

.author-bio {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  line-height: 22px;
  color: #111;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  background: #e2e2e2;
  border: 2px solid var(--title-bg);
  box-shadow: 2px 2px 0 #222;
  color: #111;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  transition: background 0.2s;
}

.btn:hover,
.btn:focus {
  background: #26345b;
  color: #e2e2e2;
}

.card-open-btn {
  align-self: start;
  min-height: 0;
  padding: 6px 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  line-height: 1.15;
  white-space: nowrap;
  transition: background 0.2s;
}

.shelf-pager {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

button.pager-btn {
  opacity: 1;
  inline-size: 2rem;
  min-inline-size: 2rem;
  block-size: 2rem;
  padding: 0;
  text-align: center;
  font-family: Tahoma, Verdana, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
}

button.pager-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.pager-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  color: #e2e2e2;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 0;
}

.meta-actions {
  width: 100%;
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.article-layout {
  position: relative;
  width: min(860px, calc(100% - (var(--sidebar-panel-width) + 16px)));
  max-width: 100%;
  margin: 0 auto;
}

.article-window {
  width: 100%;
  min-width: 0;
}

.article-sidebar {
  position: absolute;
  top: 0;
  right: calc(100% + 16px);
  width: var(--sidebar-panel-width);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-menu-slot {
  width: 100%;
}

.article-window-body {
  background: var(--article-bg) !important;
}

.article-kicker-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.article-title {
  font-size: 28px;
  margin: 0 0 16px;
  text-align: center;
}

.article-body {
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  line-height: 28px;
  letter-spacing: 0;
  color: #111;
  overflow-wrap: anywhere;
}

.article-body p,
.article-body blockquote,
.article-body ul,
.article-body ol,
.article-body pre,
.article-body figure {
  margin: 0 0 1.25rem;
}

.article-body figure,
.article-image {
  max-width: 100%;
  overflow: hidden;
}

.article-body h2,
.article-body h3 {
  margin: 2rem 0 0.9rem;
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  line-height: 28px;
  letter-spacing: 0;
}

.article-body h3 {
  font-size: 16px;
}

.article-body blockquote {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.05);
  border-left: 3px solid rgba(0, 0, 0, 0.35);
}

.article-body pre {
  overflow-x: auto;
  padding: 12px;
  background: #181a28;
  color: #f1f1f1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.article-body img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0 auto;
}

.article-image img {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 560px;
  object-fit: contain;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #444;
}

.article-image figcaption {
  margin-top: 8px;
  font-size: 12px;
  line-height: 18px;
  color: var(--text-muted);
  text-align: center;
}

.side-window {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.meta-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.meta-row .muted,
.published-value {
  font-size: 11px;
  line-height: 16px;
}

.published-value {
  font-weight: 400;
}

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

@media (max-width: 1540px) and (min-width: 901px) {
  .shelf-menu-slot {
    position: static;
    width: 100%;
    margin: 0 0 16px 0;
    transform: none;
  }

  .shelf-index-layout .shelf-menu-slot .menu-actions {
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
  }

  .shelf-index-layout .shelf-menu-slot .menu-actions .btn {
    width: auto;
    flex: 1 1 0;
  }

  .article-layout {
    position: static;
    width: min(860px, 100%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .article-sidebar {
    position: static;
    width: 100%;
    display: contents;
  }

  .article-menu-slot,
  .article-window,
  .article-aside {
    width: 100%;
  }

  .article-menu-slot {
    order: 1;
    margin-bottom: 16px;
  }

  .article-window {
    order: 2;
  }

  .article-aside {
    order: 3;
    margin-top: 16px;
  }
}

@media (max-width: 900px) {
  .shelf-index-main {
    max-width: 420px;
  }

  .cards-grid {
    max-width: 420px;
    grid-template-columns: 1fr;
  }

  .ghost-card {
    display: none;
  }

  .shelf-pager {
    max-width: 420px;
  }

  .pager-btn {
    width: auto;
  }

  .article-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .article-sidebar {
    position: static;
    width: 100%;
    display: contents;
  }

  .article-window,
  .article-menu-slot,
  .article-aside {
    width: 100%;
  }

  .article-menu-slot {
    order: 1;
    margin-bottom: 16px;
  }

  .article-window {
    order: 2;
  }

  .article-aside {
    order: 3;
    margin-top: 16px;
  }
}

@media (max-width: 600px) {
  main {
    padding-inline: 8px;
  }

  .shelf-footer {
    margin-top: 14px;
  }

  .lang-switcher button {
    font-size: 0.72rem;
  }

  .card-head {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
  }

  .avatar {
    width: 72px;
    height: 72px;
  }

  h2 {
    font-size: 16px;
  }

  .card-date {
    font-size: 9px;
    line-height: 14px;
  }

  .card-author-line {
    font-size: 9px;
    line-height: 14px;
  }

  .card-meta-top {
    gap: 10px;
  }

  .card-title {
    font-size: 13px;
    line-height: 20px;
  }

  .card-summary {
    font-size: 11px;
    line-height: 20px;
    max-height: calc(20px * 5);
  }

  .card-open-btn {
    font-size: 12px;
    padding: 5px 8px;
  }

  .article-title {
    font-size: 22px;
  }

  .article-body {
    font-size: 12px;
    line-height: 24px;
  }
}

@media (max-width: 520px) {
  main {
    padding: 10px 6px 16px 6px;
  }

  .cards-grid {
    gap: 10px;
  }

  .title-bar-text {
    font-size: 0.72rem;
    line-height: 1.3;
  }

  .window {
    margin-bottom: 10px;
  }

  .row {
    gap: 6px;
  }

  .window-body {
    padding: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .shelf-menu-slot {
    margin-bottom: 10px;
  }

  .article-menu-slot {
    margin-bottom: 10px;
  }

  .article-aside {
    margin-top: 10px;
  }

  .lang-switcher {
    margin: 6px 0 8px 0;
    gap: 6px;
  }
}

@media (max-width: 520px) and (max-height: 700px) {
  .game-image {
    width: min(56%, 220px);
  }
}
