:root {
  color-scheme: light;
  --ink: #162033;
  --muted: #667085;
  --line: #dde3ec;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --blue: #2557d6;
  --blue-dark: #173fa9;
  --green: #177d55;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 3%, rgba(37, 87, 214, 0.09), transparent 26rem),
    var(--canvas);
}

button, input { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 80px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 16px;
  color: white;
  background: linear-gradient(145deg, #3671f5, #173fa9);
  box-shadow: 0 12px 28px rgba(37, 87, 214, 0.24);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(30px, 5vw, 44px); letter-spacing: -0.04em; }
h2 { margin-bottom: 0; font-size: 24px; letter-spacing: -0.025em; }
.subtitle { margin-bottom: 0; color: var(--muted); }

.control-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(360px, 1.18fr);
  gap: 26px;
  padding: 28px;
  border: 1px solid rgba(221, 227, 236, 0.9);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 45px rgba(22, 32, 51, 0.07);
}

label {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 750;
}

.version-row, .search-row { display: flex; gap: 10px; }

input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #cbd3df;
  border-radius: 10px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color 160ms, box-shadow 160ms;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 87, 214, 0.12);
}

.hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.success-text { color: var(--green); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms, background 140ms, border-color 140ms;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.55; }
.primary { color: white; background: var(--blue); }
.primary:hover:not(:disabled) { background: var(--blue-dark); }
.secondary { color: #344054; border-color: #cbd3df; background: white; }
.secondary:hover:not(:disabled) { border-color: #98a2b3; background: #f9fafb; }
.ghost { color: var(--blue); background: #edf3ff; }

.result-section { margin-top: 44px; }
.result-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.count-badge { padding: 6px 10px; border-radius: 999px; color: var(--blue); background: #e9efff; font-size: 12px; font-weight: 750; }

.status {
  display: flex;
  min-height: 250px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  border: 1px dashed #cbd3df;
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
}

.status strong { color: var(--ink); font-size: 17px; }
.status-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 5px; border-radius: 50%; color: var(--blue); background: #e9efff; font-size: 22px; font-weight: 800; }
.status.error .status-icon { color: #b42318; background: #fee4e2; }
.status.loading .status-icon { animation: pulse 1s ease-in-out infinite; }

.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.app-card {
  display: flex;
  flex-direction: column;
  min-height: 360px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(22, 32, 51, 0.045);
}

.card-top { display: flex; align-items: flex-start; gap: 12px; }
.app-icon { --app-color: #2557d6; display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; color: white; background: var(--app-color); font-weight: 800; }
.app-identity { min-width: 0; flex: 1; }
.app-name { overflow: hidden; margin-bottom: 4px; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.app-id { display: block; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.license { padding: 4px 7px; border-radius: 6px; color: var(--green); background: #ecfdf3; font-size: 11px; font-weight: 750; }
.overview { display: -webkit-box; min-height: 66px; overflow: hidden; margin: 20px 0 18px; color: #475467; font-size: 13px; line-height: 1.7; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }

.metadata { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 14px 0; border-top: 1px solid #eef1f5; border-bottom: 1px solid #eef1f5; }
.metadata div { min-width: 0; padding: 0 8px; border-right: 1px solid #eef1f5; }
.metadata div:first-child { padding-left: 0; }
.metadata div:last-child { padding-right: 0; border-right: 0; }
.metadata dt { margin-bottom: 5px; color: #98a2b3; font-size: 10px; }
.metadata dd { overflow: hidden; margin: 0; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }

.download-info { margin-top: 14px; padding: 12px; border-radius: 10px; background: #f0fdf7; }
.download-info span, .download-info strong { display: block; }
.matched-label { margin-bottom: 4px; color: var(--green); font-size: 10px; font-weight: 800; }
.matched-version { font-size: 15px; }
.matched-file { margin-top: 3px; overflow-wrap: anywhere; color: #475467; font-size: 11px; }
.matched-size { margin-top: 3px; color: var(--muted); font-size: 11px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 18px; }
.card-actions .button { min-height: 38px; padding: 0 12px; font-size: 12px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; color: var(--muted); font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; padding: 12px 16px; border-radius: 10px; color: white; background: #162033; box-shadow: 0 12px 30px rgba(22, 32, 51, 0.2); font-size: 13px; }

@keyframes pulse { 50% { opacity: 0.45; transform: scale(0.94); } }

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

@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 1180px); padding-top: 30px; }
  .hero { align-items: flex-start; }
  .control-panel { padding: 20px; }
  .version-row, .search-row { flex-direction: column; }
  .app-grid { grid-template-columns: 1fr; }
  .app-card { min-height: 0; }
}
