/* Layout shared by every theme. Themes only change the look. */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
img { max-width: 100%; display: block; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: #fff; color: #000; padding: 6px 10px; border: 1px solid #000; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Window skeleton */
.window { display: flex; flex-direction: column; max-width: 1240px; margin: 0 auto; }
.titlebar { display: flex; align-items: stretch; }
.titlebar-text { flex: 1; margin: 0; align-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl, .sizer { flex: none; }
.sizer-close { display: none; }

.menubar { display: flex; align-items: center; gap: 4px; }
.menubar > a { text-decoration: none; }
.menubar-search { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.menubar-search input { width: 16rem; max-width: 50vw; }

.client { min-height: 60vh; }
.statusbar { display: flex; gap: 6px; flex-wrap: wrap; }
.panel:first-child { flex: 1; }

/* Browse */
.browse { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.filters { position: sticky; top: 16px; }
.filters .group { margin-top: 8px; display: grid; gap: 12px; }
.filters label { display: grid; gap: 4px; }
.filters select { width: 100%; }
.filters .year-range { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; }
.filters label.check { display: flex; gap: 8px; align-items: center; }
.filters .buttons { display: flex; gap: 8px; margin-top: 14px; }
.filter-note { margin: 0 0 18px; }

.tiles { list-style: none; margin: 0; padding: 0; display: grid;
         grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 26px 14px; }
.tile { display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none; outline: none; }
.tile-art { width: 100%; aspect-ratio: 3 / 4; display: flex; align-items: flex-end; justify-content: center; }
.tile-art img { max-height: 100%; object-fit: contain; }
.tile-art.is-screen { align-items: center; }
.tile-art.is-screen img { image-rendering: pixelated; }
.tile-noart { width: 70%; height: 80%; }
.tile-label { margin-top: 8px; padding: 1px 4px; line-height: 1.3; max-width: 100%; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 34px; }

/* Game page */
.game-top { display: grid; grid-template-columns: minmax(220px, 360px) minmax(0, 1fr); gap: 28px; align-items: start; }
.game-cover { padding: 10px; }
.game-cover img { margin: 0 auto; }
.game-cover.is-screen img { image-rendering: pixelated; }
.game-cover figcaption { margin-top: 8px; text-align: center; }
.details dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; }
.details dd { margin: 0; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.shot { padding: 6px; margin: 0; }
.shot img { width: 100%; image-rendering: pixelated; }
.shot figcaption { margin-top: 6px; }
.aka { border-collapse: collapse; }
.aka td { padding: 3px 18px 3px 0; vertical-align: top; }
.covers { display: flex; flex-wrap: wrap; gap: 16px; }
.covers figure { margin: 0; width: 130px; text-align: center; }
.covers img { margin: 0 auto 6px; }
.collection-groups { display: grid; gap: 8px; margin: 0; }
.collection-groups dd { margin: 0; }
.collection-groups dd a { margin-right: 14px; display: inline-block; }
.versions { margin: 0; padding-left: 1.2em; }
.group { position: relative; min-width: 0; }

/* Search */
.result-count { margin: 0 0 16px; }
.results-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-width: 760px; }
.result { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: center; padding: 6px; text-decoration: none; outline: none; }
.result-art { height: 70px; display: flex; align-items: center; justify-content: center; }
.result-art img { max-height: 70px; object-fit: contain; }
.result-meta, .result-aka { display: block; }

@media (max-width: 760px) {
  .menubar { flex-wrap: wrap; }
  .menubar-search { width: 100%; margin-left: 0; }
  .menubar-search input { flex: 1; max-width: none; width: auto; }
  .browse, .game-top { grid-template-columns: 1fr; }
  .filters { position: static; }
  .filters .group { grid-template-columns: 1fr 1fr; }
  .filters .wide { grid-column: 1 / -1; }
  .filters label.check { align-self: end; min-height: 28px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 20px 8px; }
}

/* ---------- Accounts, stories, editor (layout) ---------- */
.messages { list-style: none; margin: 0 0 18px; padding: 0; }
.message { padding: 8px 12px; margin-bottom: 6px; border: 1px solid currentColor; }
.menubar-inline { display: inline; margin: 0; }
.menubar-link { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 3px 9px; }
.notice { padding: 8px 12px; border: 1px solid currentColor; }
.hint { font-size: 0.92em; }
.subhead { margin: 24px 0 10px; font-size: 1em; }
.buttons, .story-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 22px; }

.stories-intro { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.stories-intro .help { margin: 0; }
.story-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.story-card-title { font-weight: 700; }
.story-card-meta { display: block; }
.story { max-width: 48em; }
.story-byline { margin: 0 0 20px; }
.story-license { margin-top: 26px; }
.story-cta { margin: 18px 0 0; }
.tiles-small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

.story-form, .report-form { max-width: 48em; display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field input[type="text"], .field textarea, .report-form textarea { width: 100%; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.field-error, .errorlist { margin: 0; padding: 0; list-style: none; }

.editor-wrap { position: relative; }
.editor { min-height: 16em; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tag-chip { white-space: nowrap; padding: 0 2px; cursor: default; }
.tag-picker { position: absolute; z-index: 20; width: min(440px, 100%); max-height: 330px; overflow: auto; margin: 0; padding: 2px; list-style: none; }
.tag-option { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; align-items: center; padding: 5px 8px; cursor: pointer; }
.tag-option-art img { max-height: 46px; margin: 0 auto; }
.tag-option-title { display: block; font-weight: 700; }
.tag-option-meta, .tag-option-aka { display: block; font-size: 0.86em; }

.profile-stats { display: flex; flex-wrap: wrap; gap: 32px; margin: 0 0 18px; }
.profile-stats dt { font-weight: 700; }
.profile-stats dd { margin: 0; font-size: 1.6em; }

.auth-page .client form p, .auth-page .client form > div { margin: 0 0 14px; }
.auth-page .client input[type="email"], .auth-page .client input[type="password"], .auth-page .client input[type="text"] { width: 100%; max-width: 26rem; }
.auth-page .client form { max-width: 34em; }

/* ---------- Home ---------- */
.home { max-width: 54em; }
.home-title { margin: 0 0 14px; font-size: 1.25em; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.pack-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pack-count { margin-left: 8px; }
.home-fine p { font-size: 0.92em; }

.site-page { max-width: 46em; }

/* Sign in with Google / Discord buttons. The extra selectors outrank the
   theme's general button rule and the "images on their own line" rule. */
.social-buttons { display: grid; gap: 10px; max-width: 22rem; margin: 14px 0 6px; }
.social-buttons form { margin: 0; }
.auth-page .client .social-buttons .social-btn,
.client .social-buttons .social-btn {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  width: 100%; text-align: left;
}
.client .social-buttons .social-btn img { display: inline-block; width: 20px; height: 20px; flex: none; margin: 0; }

/* ---------- Profiles ---------- */
.profile-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.profile-avatar svg, .mod-avatar svg { display: block; border: 1px solid currentColor; image-rendering: pixelated; }
.profile-name { margin: 0 0 6px; font-size: 1.2em; }
.profile-bio { margin: 0; max-width: 40em; white-space: pre-line; }
.badge { display: inline-block; font-size: 0.75em; padding: 1px 6px; border: 1px solid currentColor; vertical-align: middle; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; margin-top: 8px; }
.avatar-option { position: relative; display: flex; justify-content: center; padding: 4px; cursor: pointer; }
.avatar-option input { position: absolute; opacity: 0; }
.avatar-option svg { display: block; border: 2px solid transparent; }
.avatar-option input:checked + svg { border-color: currentColor; outline: 2px solid currentColor; outline-offset: 2px; }
.avatar-option input:focus-visible + svg { outline: 2px dotted currentColor; outline-offset: 4px; }

/* ---------- Mod page ---------- */
.mod-summary { margin: 0 0 4px; }
.mod-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.mod-item { border-bottom: 1px dotted currentColor; padding-bottom: 18px; }
.mod-item:last-child { border-bottom: 0; }
.mod-head { display: flex; gap: 12px; align-items: flex-start; }
.mod-read { margin: 10px 0 0; }
.mod-read summary { cursor: pointer; }
.mod-reports { margin: 10px 0 0; padding-left: 1.2em; }
.mod-note { margin: 2px 0 6px; font-style: italic; }
.inline-form { display: inline; margin: 0; }
.mod-log { border-collapse: collapse; width: 100%; }
.mod-log td { padding: 4px 12px 4px 0; vertical-align: top; }

/* ---------- Reactions ---------- */
.reactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 22px 0 6px; }
.reaction { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 5px; font: inherit; color: inherit;
  background: transparent; border: 1px solid transparent; border-radius: 999px; cursor: pointer; }
.reaction img { width: 32px; height: 32px; display: block; image-rendering: auto; }
.reaction:hover { border-color: currentColor; }
.reaction.is-mine { border: 2px solid currentColor; padding: 2px 8px 2px 4px; font-weight: 700; }
.reaction.is-static { cursor: default; }
.reaction.is-static:hover { border-color: transparent; }
.reaction-count { min-width: 1ch; }

/* ---------- Comments ---------- */
.comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.comment { display: flex; gap: 12px; align-items: flex-start; }
.comment-avatar svg { display: block; border: 1px solid currentColor; }
.comment-main { min-width: 0; flex: 1; }
.comment-meta { margin: 0 0 4px; font-size: 0.92em; }
.comment-body { overflow-wrap: anywhere; }
.comment-actions { margin: 4px 0 0; font-size: 0.9em; }
.comment-form { margin-top: 22px; display: grid; gap: 10px; max-width: 46em; }
.comment-form textarea { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.quoted { margin: 6px 0; padding: 6px 12px; border-left: 3px solid currentColor; white-space: normal; }

/* ---------- Ratings and collections (game page) ---------- */
.game-rating { margin-top: 18px; }
.rating-summary { margin: 0 0 6px; }
.star-form { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.star { font-size: 26px; line-height: 1; background: none; border: 0; padding: 0 2px; cursor: pointer; color: #9a9a9a; }
.star.is-on { color: #e8a800; }
.star:hover, .star:focus-visible { color: #ffbf00; }
.star-form .hint { margin-right: 6px; }
.star-form .linklike { margin-left: 8px; font-size: 0.9em; }
.game-collection { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.collection-btn.is-on { font-weight: 700; }
.collection-total { margin-right: 14px; }
.story-order { margin: 0 0 12px; }

/* ---------- Profile tabs, Playing now ---------- */
.profile-tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 18px 0 0; }
.profile-tabs a { color: inherit; }
.profile-tabs a[aria-current="page"] { font-weight: 700; text-decoration: none; }
.playing-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.playing-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center;
  border-bottom: 1px dotted currentColor; padding-bottom: 12px; }
.playing-item .buttons { margin: 0; }

/* ---------- Uploaded images ---------- */
.avatar-photo { display: block; object-fit: cover; border: 1px solid currentColor; }
.story-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 18px 0; }
.story-photo { margin: 0; }
.story-photo img { width: 100%; height: auto; border: 1px solid currentColor; }
.story-photo figcaption { margin-top: 4px; font-size: 0.9em; }
.photo-upload { display: grid; gap: 10px; }
.photo-slot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-slot input[type="text"] { flex: 1; min-width: 12rem; }
.photo-manage { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.photo-manage li { display: flex; gap: 12px; align-items: flex-start; }
.photo-manage img { width: 120px; height: auto; border: 1px solid currentColor; }
.photo-manage p { margin: 0 0 6px; }
.avatar-upload { display: grid; gap: 10px; }
.avatar-current { display: flex; gap: 12px; align-items: center; margin: 0; }
.avatar-current img, .inline-thumb { border: 1px solid currentColor; object-fit: cover; }
.inline-thumb { vertical-align: middle; margin-right: 8px; }
.avatar-upload-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.avatar-upload-form .hint { flex-basis: 100%; margin: 0; }
.mod-images { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.mod-image { display: flex; gap: 14px; align-items: flex-start; border-bottom: 1px dotted currentColor; padding-bottom: 14px; }
.mod-image img { width: 160px; height: auto; border: 1px solid currentColor; }
.mod-image-info p { margin: 0 0 8px; }
.reject-form select { margin-right: 4px; }
.btn-danger { color: #a00000; }

/* ---------- Following ---------- */
.following-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.following-list li { display: flex; align-items: center; gap: 10px; }
.favorites .subhead { margin-top: 0; }

/* ---------- Windows-style dialog (used for the LaunchBox download) ---------- */
.win-dialog { padding: 0; border: 1px solid #000; max-width: min(520px, calc(100vw - 24px)); background: #c0c0c0; color: #000;
  box-shadow: inset -1px -1px 0 #0a0a0a, inset 1px 1px 0 #dfdfdf, 3px 3px 0 rgba(0,0,0,.4); font: 13px/1.45 Tahoma, "MS Sans Serif", sans-serif; }
.win-dialog::backdrop { background: rgba(0,0,0,.35); }
.win-dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 4px 3px 8px;
  background: linear-gradient(90deg, #000080, #1084d0); color: #fff; }
.win-dialog-title h2 { margin: 0; font: 700 13px/1.4 Tahoma, sans-serif; }
.win-dialog-x { width: 18px; height: 16px; padding: 0; border: 0; background: #c0c0c0; font: 700 13px/14px Tahoma, sans-serif; cursor: pointer;
  box-shadow: inset -1px -1px 0 #0a0a0a, inset 1px 1px 0 #dfdfdf; }
.win-dialog-body { padding: 14px 16px 16px; display: grid; gap: 10px; }
.win-dialog-body p { margin: 0; }
.win-dialog-body .group { margin: 8px 0 0; background: transparent; }
.win-dialog-body .group > legend { background: #c0c0c0; }
.win-dialog code { font-family: "Courier New", monospace; }

/* ---------- Story search ---------- */
.story-search { display: flex; gap: 8px; align-items: center; margin: 0 0 18px; max-width: 34rem; }
.story-search input { flex: 1; min-width: 0; }

/* ---------- Inbox, prompts ---------- */
.inbox { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.inbox-item { display: flex; gap: 12px; align-items: flex-start; padding: 6px 8px; }
.inbox-item.is-new { outline: 1px dotted currentColor; }
.inbox-text { margin: 0 0 2px; }
.inbox-new { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.05em; }
.inbox-dot { width: 32px; text-align: center; font-size: 22px; line-height: 32px; }
.prompt-text { font-size: 1.25em; font-weight: 700; margin: 0 0 8px; }
.prompt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.prompt-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.story-prompt { margin: 0 0 12px; }


/* ---------- Main menu (taskbar) on every page; each theme styles it ---------- */
body.has-taskbar { padding-bottom: 44px; }
.taskbar .start-menu li { list-style: none; }
.taskbar .start-menu form { margin: 0; }
.taskbar .start-button { list-style: none; cursor: pointer; }
.taskbar .start-button::-webkit-details-marker { display: none; }
.taskbar .start-menu { max-height: calc(100vh - 60px); overflow-y: auto; }
.taskbar .start-button::marker { content: ""; }

/* ---------- This Month in History page ---------- */
.history-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 6px; }
