*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #003366;
  --blue-lt: #004488;
  --bg:      #cfcfcf;
  --panel:   #e6e6e6;
  --border:  #999;
  --text:    #000;
  --link:    #0000ee;
  --white:   #fff;
  --accent:  #c8d8f0;
}

html, body {
  height: 100vh;
  font-family: Verdana, Tahoma, Arial, sans-serif;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#top-bar {
  background: var(--blue);
  color: #fff;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 2px solid #002244;
}

#top-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 320px;
  min-width: 260px;
}

#top-left strong {
  font-size: 15px;
  letter-spacing: 0.3px;
}

#home-link {
  color: #fff;
  text-decoration: none;
}

#home-link:hover {
  text-decoration: underline;
}

#top-sub {
  font-size: 11px;
  color: #a0c0e8;
  max-width: 520px;
  line-height: 1.35;
}

#top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex: 1 1 auto;
}

.top-nav-link {
  color: #cfe2ff;
  text-decoration: none;
  font-size: 11px;
  padding: 7px 12px;
  border: 1px solid #35567f;
  background: rgba(0,18,40,0.18);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-nav-link:hover {
  color: #fff;
  border-color: #4d6f99;
  background: rgba(255,255,255,0.08);
}

.top-nav-link.active {
  color: #fff;
  border-color: #6f8fb9;
  background: rgba(255,255,255,0.14);
}

#top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  flex: 1 1 320px;
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  line-height: 1;
}

#top-right label {
  font-size: 11px;
  color: #c0d8f0;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

select {
  font-family: Verdana, Tahoma, Arial, sans-serif;
  font-size: 11px;
  padding: 3px 6px;
  border: 1px solid #669;
  background: #002255;
  color: #fff;
  cursor: pointer;
  min-width: 90px;
}

select:focus { outline: 1px solid #88aaff; }

.btn {
  font-family: Verdana, Tahoma, Arial, sans-serif;
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid #668;
  background: #003d80;
  color: #ddeeff;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover  { background: #004fa0; color: #fff; }
.btn.hidden { display: none; }

#timer-display {
  font-size: 10px;
  color: #444;
  white-space: nowrap;
  padding: 7px 9px;
  border: 1px solid #b5b5b5;
  background: #fff;
}

#main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#file-browser {
  width: 240px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#browser-header {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  background: #d8d8d8;
  position: sticky;
  top: 0;
  z-index: 2;
}

#control-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, border-color 0.2s ease;
}

#control-sidebar.collapsed {
  width: 0;
  border-left-color: transparent;
}

#control-sidebar.collapsed > * {
  display: none;
}

#control-sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #d8d8d8;
  border-bottom: 1px solid var(--border);
}

#control-sidebar-header h3 {
  font-size: 12px;
  color: var(--blue);
  margin-bottom: 4px;
}

#control-sidebar-header p {
  font-size: 10px;
  line-height: 1.45;
  color: #555;
}

#control-sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #8f8f8f;
  background: #ededed;
  color: #333;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
}

#control-sidebar-close:hover {
  background: #fff;
}

#control-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-section {
  border: 1px solid var(--border);
  background: #f0f0f0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-section-title {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}

.control-search-form,
.control-button-stack,
.control-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-search-form input[type="search"],
.control-field select {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: #111;
}

.control-field select {
  cursor: pointer;
}

.control-field label {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #555;
}

.control-button-stack .btn,
.control-search-form .btn,
.timer-btn {
  width: 100%;
}

.control-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.control-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 10px;
  color: #444;
  border: 1px solid #b5b5b5;
  background: #fff;
  padding: 6px 7px;
}

.control-filter-chip input {
  margin: 0;
}

#file-search {
  width: 100%;
  font-family: Verdana, Tahoma, Arial, sans-serif;
  font-size: 11px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  background: var(--white);
}

#file-search:focus { outline: 1px solid var(--blue); }

#file-legend {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  font-size: 10px;
  color: #555;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(0,0,0,0.15);
}

.legend-new {
  background: #28eb003d;
}

.legend-changed {
  background: #ff98002b;
}

#file-stats {
  font-size: 10px;
  color: #666;
  margin-top: 4px;
  text-align: right;
}

#file-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
}

#file-list::-webkit-scrollbar { width: 10px; }
#file-list::-webkit-scrollbar-track { background: var(--panel); }
#file-list::-webkit-scrollbar-thumb { background: #aaa; border: 1px solid #ccc; }

.file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  cursor: pointer;
  border-bottom: 1px solid #d0d0d0;
  font-size: 11px;
  transition: background 0.1s;
}

.file-item:hover  { background: var(--accent); }
.file-item.active { background: var(--blue); color: #fff; }
.file-item.active .file-size { color: #aac; }
.file-item-new { background: #28eb003d; }
.file-item-changed { background: #ff98002b; }
.file-item-new:hover,
.file-item-changed:hover { background: #d7ebf7; }
.file-item.active.file-item-new,
.file-item.active.file-item-changed { background: var(--blue); }

.file-ext {
  font-size: 9px;
  font-weight: bold;
  padding: 1px 4px;
  border: 1px solid #aaa;
  background: #ddd;
  color: #333;
  flex-shrink: 0;
  min-width: 26px;
  text-align: center;
}

.file-item.active .file-ext { background: #224; color: #aaf; border-color: #446; }

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  font-size: 9px;
  color: #888;
  flex-shrink: 0;
}

.placeholder {
  padding: 20px 10px;
  color: #888;
  font-size: 11px;
  text-align: center;
  list-style: none;
}

#viewer-wrap {
  flex: 1;
  position: relative;
  background: var(--white);
  border-left: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.assets-page {
  display: block;
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
}

body.changelog-page {
  display: block;
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
}

.hidden { display: none !important; }

#viewer-placeholder {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#welcome-card {
  display: flex;
  gap: 18px;
  width: min(100%, 1080px);
  background: #fff;
  border: 1px solid var(--border);
  padding: 18px;
  margin: 0 auto;
}

#welcome-body {
  flex: 1;
}

#welcome-body h2 {
  font-size: 15px;
  color: var(--blue);
  margin-bottom: 6px;
  font-weight: bold;
}

.welcome-lead {
  font-size: 12px;
  color: #222;
  margin-bottom: 14px;
  line-height: 1.6;
}

.welcome-version-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.welcome-version-pill {
  background: #f1f1f1;
  border: 1px solid #d4d4d4;
  padding: 10px 12px;
}

.welcome-version-label {
  display: block;
  font-size: 10px;
  font-weight: bold;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.welcome-version-pill strong {
  display: block;
  font-size: 13px;
  color: #222;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.info-block {
  background: #f4f4f4;
  border: 1px solid #ddd;
  padding: 9px 11px;
}

.info-label {
  font-size: 10px;
  font-weight: bold;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 4px;
}

.info-text {
  font-size: 11px;
  line-height: 1.65;
  color: #333;
}

.info-text a { color: var(--link); }
.info-text a:visited { color: #551a8b; }
.info-text code { font-family: "Courier New", Courier, monospace; font-size: 10px; background: #e8e8e8; padding: 1px 3px; }

.welcome-cta {
  font-size: 11px;
  color: #666;
  border-top: 1px solid #eee;
  padding-top: 10px;
  font-style: italic;
}

.change-panel {
  border-top: 1px solid var(--border);
  background: #f3f3f3;
}

.change-panel.hidden {
  display: none;
}

.change-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #d5d5d5;
  background: #e5e5e5;
}

.change-panel-head h3 {
  font-size: 11px;
  letter-spacing: 0.4px;
  color: var(--blue);
}

#latest-changes-meta,
#latest-assets-meta,
#selected-file-meta {
  font-size: 10px;
  color: #666;
  white-space: nowrap;
}

.change-panel-body {
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.55;
  color: #333;
}

.change-panel-actions {
  padding: 0 12px 12px;
}

.change-panel-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 0;
  font-size: 11px;
}

.change-panel-toolbar select {
  background: #fff;
  color: #111;
  border: 1px solid #999;
  min-width: 220px;
}

.btn-inline {
  font-size: 10px;
  padding: 2px 8px;
}

.change-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.change-block {
  border: 1px solid #ddd;
  background: #fff;
  padding: 8px 10px;
}

.change-block h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--blue);
  margin-bottom: 6px;
}

.change-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.change-list li {
  word-break: break-word;
}

.change-note {
  color: #666;
}

.change-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 10px;
}

.change-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid #c9c9c9;
  background: #fff;
  color: #333;
}

.change-chip.positive {
  border-color: #1f8a3b;
  color: #1f8a3b;
}

.change-chip.neutral {
  border-color: #888;
  color: #555;
}

.change-file-link {
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-align: left;
}

.change-card {
  display: block;
}

.change-card.hidden-extra {
  display: none;
}

.asset-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.asset-preview-card {
  border: 1px solid #ddd;
  background: #fff;
  padding: 8px;
  cursor: pointer;
}

.asset-preview-card:hover,
.change-file-link:hover,
.change-target:hover {
  filter: brightness(0.98);
}

.asset-preview-card.hidden-extra {
  display: none;
}

.asset-preview-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #ccc;
  background: #f3f3f3;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  overflow: hidden;
}

.asset-preview-thumb canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
}

.asset-preview-name {
  font-weight: bold;
  word-break: break-word;
}

.asset-preview-meta {
  font-size: 10px;
  color: #666;
  margin-top: 3px;
}

.changelog-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px;
  overflow: visible;
}

.changelog-intro {
  margin: 0 auto 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 12px;
}

.changelog-intro h1 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.changelog-intro p {
  font-size: 11px;
  line-height: 1.5;
  color: #333;
}

.changelog-intro-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.changelog-stat {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid #999;
  background: #efefef;
  font-size: 10px;
  color: #333;
}

.changelog-status {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #999;
  background: #f4f4f4;
  font-size: 10px;
  color: #444;
}

.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.version-block {
  background: var(--panel);
  border: 1px solid var(--border);
}

.version-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #d8d8d8;
}

.version-head h2 {
  font-size: 14px;
  color: var(--text);
}

.version-meta {
  font-size: 10px;
  color: #666;
}

.version-files {
  padding: 10px 12px 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.version-file-card {
  border: 1px solid #999;
  background: #fff;
  padding: 10px 12px;
}

.version-file-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.version-file-card h3 {
  font-size: 11px;
  margin-bottom: 0;
}

.file-kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border: 1px solid #999;
  font-size: 10px;
  font-weight: bold;
  white-space: nowrap;
}

.file-kind-new {
  border-color: #1f8a3b;
  color: #1f8a3b;
  background: #effaf2;
}

.file-kind-changed {
  border-color: #a05b00;
  color: #a05b00;
  background: #fff6e8;
}

.version-file-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.changelog-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.changelog-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.changelog-asset-tile {
  border: 1px solid #ddd;
  background: #f8f8f8;
  padding: 8px;
}

.changelog-asset-tile-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.changelog-asset-tile-head .changelog-detail-link {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.changelog-asset-tile-head .file-kind-badge {
  flex: 0 0 auto;
}

.changelog-asset-tile-meta {
  margin-top: 6px;
  font-size: 10px;
  color: #666;
}

.changelog-detail {
  border: 1px solid #ddd;
  background: #f8f8f8;
  padding: 8px;
}

.changelog-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
}

.changelog-detail-side {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.changelog-detail-link {
  color: var(--link);
  text-decoration: underline;
  font-weight: bold;
}

.changelog-detail-meta {
  font-size: 10px;
  color: #666;
}

.changelog-code-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.changelog-code-card {
  border: 1px solid #ddd;
  background: #f7f7f7;
}

.changelog-preview-block {
  position: relative;
}

.changelog-preview-block.is-collapsed pre {
  max-height: 180px;
  overflow: hidden;
}

.changelog-code-head {
  font-size: 10px;
  color: #003366;
  background: #ececec;
  border-bottom: 1px solid #ddd;
  padding: 4px 6px;
  font-weight: bold;
}

.changelog-code-card pre {
  margin: 0;
  padding: 8px;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.changelog-diff-preview {
  display: block;
}

.changelog-code-line {
  display: block;
  margin: 0 -8px;
  padding: 0 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.changelog-code-line.is-added {
  background: #e6ffed;
}

.changelog-code-line.is-removed {
  background: #ffeef0;
}

.changelog-code-line.is-placeholder {
  background: #f7f7f7;
}

.changelog-expand-btn {
  width: 100%;
  border: none;
  border-top: 1px solid #ddd;
  background: #efefef;
  color: #003366;
  font-size: 10px;
  font-weight: bold;
  padding: 6px 8px;
  cursor: pointer;
  text-align: center;
}

.changelog-expand-btn:hover {
  background: #e5e5e5;
}

.hl-keyword { color: #0000ff; font-weight: bold; }
.hl-operator { color: #444444; }
.hl-string { color: #008000; }
.hl-comment { color: #808080; font-style: italic; }
.hl-number { color: #ff6600; }
.hl-symbol { color: #990099; }
.hl-builtin { color: #008080; }

.version-file-link {
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
}

.change-target {
  display: inline;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.change-target strong {
  color: var(--link);
  text-decoration: underline;
}

.pagination-bar {
  max-width: 980px;
  margin: 10px auto 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  padding: 10px 12px;
}

.pagination-meta {
  font-size: 11px;
  color: #555;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-link {
  color: var(--link);
  text-decoration: underline;
  font-size: 11px;
}

.pagination-link.disabled {
  color: #888;
  text-decoration: none;
  pointer-events: none;
}

.site-mascot {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 250;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  text-decoration: none;
}

.site-mascot img {
  display: block;
  image-rendering: pixelated;
  max-width: 59px;
  height: auto;
}

#prw-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: none;
  background: #cfcfcf;
}
#prw-frame.hidden { display: none; }

footer {
  background: #e9e9e9;
  border-top: 1px solid var(--border);
  padding: 5px 14px;
  font-size: 10px;
  color: #444;
  text-align: center;
  flex-shrink: 0;
  padding-right: 84px;
}

footer a           { color: var(--link); }
footer a:visited   { color: #551a8b; }
footer a:hover     { text-decoration: underline; }

#sidebar-toggle {
  display: none;
  background: #003d80;
  border: 1px solid #668;
  color: #ddeeff;
  font-size: 18px;
  padding: 2px 8px;
  cursor: pointer;
  line-height: 1;
  font-family: Verdana, Tahoma, Arial, sans-serif;
}
#sidebar-toggle:hover { background: #004fa0; }

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
}

@media (max-width: 768px) {
  html, body { height: auto; overflow: auto; }

  body {
    min-height: 100svh;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  #top-bar {
    align-items: stretch;
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }

  #top-left {
    width: 100%;
    min-width: 0;
    gap: 3px;
  }

  #top-left strong {
    font-size: 14px;
    line-height: 1.2;
  }

  #top-sub {
    display: block;
    font-size: 10px;
    line-height: 1.35;
    color: #b5cde8;
  }

  #top-nav {
    width: 100%;
    margin: 0;
    order: 2;
    gap: 6px;
  }

  .top-nav-link {
    flex: 1 1 0;
    text-align: center;
    padding: 6px 8px;
    font-size: 12px;
  }

  #top-right {
    flex: 0 0 auto;
    width: auto;
    order: 3;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  #top-right label {
    display: none;
  }

  #sidebar-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-height: 34px;
    font-size: 18px;
    padding: 0;
  }

  #controls-toggle {
    min-height: 34px;
    padding: 6px 10px;
  }

  #version-select,
  #compare-version-select {
    min-width: 0;
    width: 100%;
    font-size: 12px;
    padding: 7px 8px;
  }

  #refresh-btn,
  #clear-cache-btn,
  #pull-btn {
    min-height: 34px;
    font-size: 12px;
    padding: 6px 8px;
    width: 100%;
  }

  #timer-display {
    display: block;
    font-size: 10px;
    text-align: left;
    color: #9fb7d0;
  }

  #main-layout {
    flex-direction: column;
    overflow: visible;
    height: auto;
    min-height: 0;
  }

  #file-browser {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    width: min(88vw, 320px);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.4);
    height: 100%;
    border-right: 1px solid var(--border);
  }
  #file-browser.open { transform: translateX(0); }
  #control-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 210;
    width: min(88vw, 320px);
    transform: translateX(100%);
    transition: transform 0.22s ease;
    height: 100%;
    border-left: 1px solid var(--border);
  }
  #control-sidebar.collapsed {
    width: min(88vw, 320px);
    border-left: 1px solid var(--border);
  }
  #control-sidebar.collapsed > * {
    display: flex;
  }
  #control-sidebar.open {
    transform: translateX(0);
  }
  #sidebar-overlay.open { display: block; }

  #viewer-wrap {
    flex: 1;
    overflow: visible;
    min-height: calc(100svh - 165px);
    border-left: none;
  }

  #viewer-placeholder {
    padding: 10px;
    align-items: stretch;
  }

  #welcome-card {
    flex-direction: column;
    max-width: 100%;
    padding: 12px;
  }

  #welcome-body h2 {
    font-size: 16px;
  }

  .info-grid { grid-template-columns: 1fr; }
  .change-grid { grid-template-columns: 1fr; }
  .asset-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .version-files { grid-template-columns: 1fr; }
  .changelog-code-grid { grid-template-columns: 1fr; }
  .welcome-lead {
    font-size: 12px;
    line-height: 1.55;
  }

  .change-panel-head,
  .version-head,
  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .change-panel-toolbar {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .change-panel-toolbar select {
    width: 100%;
    min-width: 0;
  }

  .change-panel-body,
  .version-files,
  .changelog-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .site-mascot {
    right: 6px;
    bottom: 6px;
  }

  .site-mascot img {
    max-width: 48px;
  }

  #latest-changes-meta,
  #latest-assets-meta,
  #selected-file-meta {
    white-space: normal;
    text-align: left;
  }

  footer {
    padding: 7px 68px 7px 10px;
    line-height: 1.5;
  }
}

@media (max-width: 560px) {
  #top-right {
    grid-template-columns: 1fr 1fr;
  }

  #sidebar-toggle {
    grid-row: auto;
    grid-column: 1 / -1;
    width: 100%;
  }

  #version-select,
  #compare-version-select,
  #refresh-btn,
  #clear-cache-btn,
  #pull-btn {
    grid-column: auto;
  }

  #timer-display {
    text-align: left;
  }

  #viewer-placeholder {
    padding: 8px;
  }

  .asset-preview-grid {
    grid-template-columns: 1fr;
  }

  .info-block,
  .change-block,
  .version-file-card,
  .changelog-intro,
  .pagination-bar {
    padding-left: 8px;
    padding-right: 8px;
  }

  .version-file-top {
    align-items: flex-start;
    flex-direction: column;
  }
}

.header-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 0;
  min-height: 56px;
  flex: 1 1 340px;
  align-self: stretch;
}

.header-search-form input[type="search"] {
  width: 240px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #5f83ad;
  background: #0b2745;
  color: #eaf4ff;
}

.header-search-form input[type="search"]::placeholder {
  color: #9fb9d7;
}

.header-panel {
  background: rgba(0,16,34,0.28);
  border: 1px solid #35567f;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  padding: 8px 10px;
  min-height: 56px;
}

.header-controls-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 10px;
  align-self: stretch;
}

.header-version-stack {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 188px;
}

.header-select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 188px;
}

.header-button-group,
.header-button-stack {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.header-utility-column {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.header-button-stack .btn {
  width: 100%;
  text-align: center;
}

.timer-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 6px;
  min-width: 190px;
}

.timer-btn {
  width: 100%;
  text-align: center;
}

.search-shell {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 980px;
  margin: 0 auto;
  padding: 12px;
  overflow: auto;
  width: 100%;
}

.search-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0;
  margin-bottom: 12px;
}

.search-panel-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #d8d8d8;
}

.search-panel-head h1 {
  margin: 0 0 4px;
  font-size: 14px;
}

.search-panel-head p {
  margin: 0;
  color: #333;
}

.search-controls {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}

.search-query-field {
  flex: 1 1 420px;
}

.search-version-field {
  flex: 0 1 270px;
}

.search-limit-field {
  flex: 0 1 120px;
}

.search-field input,
.search-field select {
  padding: 5px 6px;
  border: 1px solid #999;
  background: #fff;
  color: #000;
}

.search-actions {
  display: flex;
  align-items: end;
}

.search-filter-row {
  align-items: center;
}

.search-filter-label {
  font-size: 11px;
  font-weight: 700;
  color: #333;
  letter-spacing: 0.08em;
}

.search-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid #999;
  background: #efefef;
  font-size: 11px;
}

.search-status {
  margin: 0 12px 12px;
  padding: 8px 10px;
  border: 1px solid #999;
  background: #f4f4f4;
  color: #333;
}

.search-results {
  display: grid;
  gap: 14px;
}

.search-result-card {
  background: #fff;
  border: 1px solid #999;
  padding: 10px 12px;
}

.search-result-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}

.search-result-kind {
  display: inline-block;
  padding: 2px 6px;
  background: #e1e1e1;
  color: #000;
  border: 1px solid #999;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.search-result-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--link);
  text-decoration: underline;
}

.search-result-link:hover {
  color: var(--link);
}

.search-result-meta {
  color: #444;
  font-size: 11px;
  margin-bottom: 8px;
}

.search-asset-preview {
  width: 124px;
  min-height: 124px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  background: #f3f3f3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #666;
  font-size: 11px;
  text-align: center;
}

.search-asset-preview canvas {
  max-width: 100%;
  max-height: 120px;
  image-rendering: pixelated;
}

.search-snippet {
  margin: 0;
  padding: 10px;
  overflow-x: auto;
  background: #f8f8f8;
  border: 1px solid #ddd;
  white-space: pre-wrap;
  word-break: break-word;
}

.search-snippet mark {
  background: #ffe27a;
  color: #1f1a00;
  padding: 0 2px;
}

.search-snippet-code {
  background: #fff;
}

.hl-keyword { color: #0000ff; font-weight: bold; }
.hl-operator { color: #444444; }
.hl-string { color: #008000; }
.hl-comment { color: #808080; font-style: italic; }
.hl-number { color: #ff6600; }
.hl-symbol { color: #990099; }
.hl-builtin { color: #008080; }

.changelog-asset-preview {
  width: 100%;
  min-height: 132px;
  margin: 8px 0;
  border: 1px solid #ccc;
  background: #f3f3f3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #666;
  font-size: 11px;
  text-align: center;
}

.changelog-asset-preview canvas {
  max-width: 100%;
  max-height: 128px;
  image-rendering: pixelated;
}

.changelog-text-compare {
  margin-top: 8px;
}

.search-empty {
  padding: 16px;
  border: 1px solid #999;
  background: #f4f4f4;
  color: #333;
}

.assets-shell {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 980px;
  margin: 0 auto;
  padding: 12px;
  width: 100%;
  overflow: visible;
}

.assets-page-head,
.assets-toolbar {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.assets-page-head h1 {
  margin-bottom: 4px;
  font-size: 14px;
}

.assets-page-head p {
  color: #333;
}

.assets-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.assets-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assets-field span {
  font-size: 11px;
  font-weight: 700;
  color: #333;
  letter-spacing: 0.04em;
}

.assets-query-field {
  flex: 1 1 420px;
}

.assets-version-field,
.assets-kind-field {
  flex: 0 1 220px;
}

.assets-field input,
.assets-field select {
  padding: 5px 6px;
  border: 1px solid #999;
  background: #fff;
  color: #000;
}

.assets-actions {
  display: flex;
  align-items: end;
}

.assets-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #999;
  background: #efefef;
  font-size: 11px;
}

.assets-check input[type="checkbox"] {
  margin: 0;
}

.assets-status {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #999;
  background: #f4f4f4;
  color: #333;
}

.assets-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.assets-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.asset-gallery-card {
  border: 1px solid #999;
  background: #fff;
  padding: 12px;
  cursor: pointer;
}

.asset-gallery-card:hover,
.asset-gallery-card.active {
  border-color: #6f8fb9;
  background: #d6e6ff;
}

.asset-gallery-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #ccc;
  background: #f3f3f3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 8px;
  color: #666;
  font-size: 11px;
  text-align: center;
}

.asset-gallery-thumb canvas {
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
}

.asset-gallery-name {
  font-weight: bold;
  margin-bottom: 4px;
  word-break: break-word;
}

.asset-gallery-meta {
  font-size: 11px;
  color: #444;
  word-break: break-word;
}

.asset-inspector {
  border: 1px solid #999;
  background: var(--panel);
  position: sticky;
  top: 18px;
}

.asset-inspector-head {
  padding: 14px 16px;
  border-bottom: 1px solid #999;
  background: #d8d8d8;
}

.asset-inspector-head h2 {
  margin-bottom: 4px;
}

.asset-inspector-head p {
  font-size: 11px;
  color: #333;
}

.asset-inspector-body {
  padding: 16px;
  background: var(--panel);
}

.asset-inspector-placeholder,
.asset-inspector-loading {
  color: #333;
}

.asset-inspector-preview {
  width: 100%;
  min-height: 260px;
  border: 1px solid #ccc;
  background: #f3f3f3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 12px;
  color: #666;
  text-align: center;
}

.asset-inspector-preview canvas {
  max-width: 100%;
  max-height: 320px;
  image-rendering: pixelated;
}

.asset-inspector-viewport {
  position: relative;
  width: 100%;
  min-height: 258px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.asset-inspector-viewport.dragging {
  cursor: grabbing;
}

.asset-inspector-viewport canvas {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  image-rendering: pixelated;
}

.asset-inspector-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
  word-break: break-word;
}

.asset-inspector-hint {
  margin-bottom: 10px;
  font-size: 11px;
  color: #555;
}

.asset-inspector-meta {
  font-size: 12px;
  color: #333;
  margin-bottom: 8px;
  word-break: break-word;
}

.asset-inspector-actions {
  margin-top: 14px;
}

@media (max-width: 1200px) {
  .header-search-form input[type="search"] {
    width: 180px;
  }
}

@media (max-width: 900px) {
  .header-search-form {
    width: 100%;
    margin-right: 0;
    order: 10;
  }

  .header-search-form input[type="search"] {
    width: 100%;
    flex: 1 1 auto;
  }

  .header-controls-cluster {
    width: 100%;
    justify-content: flex-start;
  }

  .header-version-stack,
  .header-utility-column,
  .timer-panel {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .search-shell {
    padding: 12px;
  }

  .assets-shell {
    padding: 12px;
  }

  .search-panel {
    padding: 14px;
  }

  .assets-page-head,
  .assets-toolbar {
    padding: 14px;
  }

  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .assets-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .search-field,
  .search-query-field,
  .search-version-field,
  .search-limit-field {
    flex: 1 1 auto;
    width: 100%;
  }

  .assets-field,
  .assets-query-field,
  .assets-version-field,
  .assets-kind-field {
    flex: 1 1 auto;
    width: 100%;
  }

  .search-actions {
    width: 100%;
  }

  .assets-actions {
    width: 100%;
  }

  .search-actions .btn {
    width: 100%;
  }

  .assets-actions .btn {
    width: 100%;
  }

  .assets-layout {
    grid-template-columns: 1fr;
  }

  .assets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .asset-inspector {
    position: static;
  }
}

