/* ---- Fonts (embedded from Segoe UI + Segoe MDL2 Assets) ---- */
@font-face {
  font-family: "Segoe UI";
  src: url("../fonts/segoeuil.ttf") format("truetype");
  font-weight: 300;
}
@font-face {
  font-family: "Segoe UI";
  src: url("../fonts/segoeuisl.ttf") format("truetype");
  font-weight: 350;
}
@font-face {
  font-family: "Segoe UI";
  src: url("../fonts/segoeui.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "Segoe UI";
  src: url("../fonts/seguisb.ttf") format("truetype");
  font-weight: 600;
}
@font-face {
  font-family: "Segoe UI";
  src: url("../fonts/segoeuib.ttf") format("truetype");
  font-weight: 700;
}
@font-face {
  font-family: "Segoe MDL2 Assets";
  src: url("../fonts/segmdl2.ttf") format("truetype");
}

/* ---- Base ---- */
/* Windows 10 Mobile / IE / old Edge ignore the <meta viewport> tag and render
   at the device's physical width. These rules force device-width so the media
   queries actually apply on those browsers. */
@-ms-viewport { width: device-width; }
@-o-viewport { width: device-width; }
@viewport { width: device-width; }
:root {
  --bg: #000000;
  --panel: #0a0a0a;
  --panel-2: #141414;
  --line: #262626;
  --text: #ffffff;
  --muted: #9a9a9a;
  --danger: #e81123;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  font-weight: 350;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

.glyph {
  font-family: "Segoe MDL2 Assets";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  vertical-align: -2px;
}
.glyph.big { font-size: 48px; display: block; }

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}
.wrap.narrow { max-width: 720px; }

/* ---- Top bar ---- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
}
.logo { font-size: 18px; font-weight: 600; letter-spacing: .2px; white-space: nowrap; }
.logo .glyph { color: var(--accent); margin-right: 6px; }
.spacer { flex: 1; }
.inline { display: inline; margin: 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .12s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn.full { width: 100%; justify-content: center; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 8px;
}
.ghost-btn:hover { color: var(--text); }
.ghost-btn.danger:hover { color: var(--danger); }

/* ---- Topbar right (search + admin) ---- */
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 6px 12px;
  min-width: 0;
}
.search:focus-within { border-color: var(--accent); }
.search .glyph { color: var(--muted); font-size: 14px; }
.search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  width: 180px;
  min-width: 0;
}
.search input::placeholder { color: var(--muted); }

/* ---- Catalog list (stacked two-column rows) ---- */
.app-list {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 28px 0 48px;
}
.app-row {
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}
.app-row[hidden] { display: none; }
.shot {
  background: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.app-row .shot { aspect-ratio: 9 / 16; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot.noshot .glyph { color: #333; }
.app-info { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.app-info h2 { margin: 0; font-size: 20px; font-weight: 600; }
.meta { display: flex; gap: 14px; font-size: 12px; align-items: center; flex-wrap: wrap; }
.meta .ver { color: var(--accent); font-weight: 600; }
.meta .arch { color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.meta .date { color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.meta .date .glyph { font-size: 13px; }
.desc { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.link { color: var(--accent); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.actions .btn { padding: 8px 12px; font-size: 13px; }

.no-results { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---- Lightbox (click-to-zoom) ---- */
img.zoomable { cursor: zoom-in; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .6);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
}
.lightbox-close .glyph { font-size: 22px; }
.lightbox-close:hover { color: var(--accent); }

@media (max-width: 820px) {
  .wrap { padding: 0 12px; }
  .topbar .wrap { gap: 8px; }
  .topbar-right { gap: 4px; }
  .search { flex: 1 1 auto; padding: 6px 10px; }
  .search input { width: auto; flex: 1 1 auto; }
  .app-list { gap: 24px; }
  .app-row { grid-template-columns: 130px 1fr; }
  .app-info { padding: 14px 16px; gap: 8px; }
  .app-info h2 { font-size: 17px; }
}

@media (max-width: 480px) {
  .logo { font-size: 16px; }
  .app-row { grid-template-columns: 104px 1fr; }
  .app-info { padding: 12px 14px; }
  .actions .btn { padding: 7px 10px; font-size: 12px; }
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 80px 0;
}
.empty .glyph { color: #333; margin-bottom: 12px; }

/* ---- Login ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.login-card .glyph.big { color: var(--accent); }
.login-card h1 { margin: 0 0 8px; font-size: 24px; font-weight: 350; }
.login-card label { text-align: left; }
.back { color: var(--muted); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; justify-content: center; margin-top: 6px; }
.back:hover { color: var(--text); }

/* ---- Forms ---- */
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
input[type="text"],
input[type="password"],
input[type="url"] {
  width: 100%;
  margin-top: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
}
input:focus { border-color: var(--accent); }
.fields { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }

/* ---- Panels ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 22px;
  margin: 24px 0;
}
.panel h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.panel h2 .glyph { color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 16px; }

/* ---- Drop zone ---- */
.drop {
  display: block;
  border: 2px dashed var(--line);
  background: var(--panel-2);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  margin-bottom: 16px;
  transition: border-color .12s ease, color .12s ease;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.drop input[type="file"] { display: none; }
.drop .glyph.big { color: var(--accent); margin-bottom: 10px; }
.drop-text { display: block; font-size: 14px; }
.drop-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.drop-file {
  background: #000;
  border: 1px solid var(--line);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.drop-file:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.drop-file:hover::after {
  content: " \00d7";
}

/* ---- Tables ---- */
table.apps { width: 100%; border-collapse: collapse; font-size: 14px; }
table.apps th, table.apps td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.apps th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.thumb { width: 44px; }
.thumb img { width: 36px; height: 64px; object-fit: cover; display: block; }
.thumb .glyph { color: #333; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions-inner { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }

.shot-preview { max-width: 200px; margin-bottom: 16px; }

/* ---- Dependency list ---- */
.dep-list { list-style: none; margin: 0 0 16px; padding: 0; }
.dep-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  margin-bottom: 6px;
}
.dep-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  word-break: break-all;
}
.dep-name .glyph { color: var(--muted); font-size: 14px; }
.shot-preview img { width: 100%; border: 1px solid var(--line); }

/* ---- Alerts ---- */
.alert { padding: 12px 14px; font-size: 14px; margin: 16px 0; border: 1px solid; }
.alert.ok { border-color: var(--accent); color: #fff; background: rgba(0,120,215,.12); }
.alert.err { border-color: var(--danger); color: #fff; background: rgba(232,17,35,.12); }
