:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --soft: #f2f2f7;
  --line: #d9d9df;
  --line-strong: #c7c7cc;
  --brand: #0071e3;
  --brand-dark: #005bb5;
  --green: #1d8f45;
  --red: #c7362f;
  --amber: #946200;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Microsoft YaHei", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(250, 250, 252, 0.88);
  backdrop-filter: saturate(180%) blur(20px);
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 470px);
  align-items: center;
  gap: clamp(18px, 4vw, 36px);
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 16px;
}

.headline-wrap {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.store-mark {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.22)),
    linear-gradient(160deg, #1d9bf0 0%, #0071e3 48%, #6e5cff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 16px 34px rgba(0, 113, 227, 0.22);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.headline {
  min-width: 0;
  max-width: 760px;
  text-align: left;
}

.headline h1 {
  margin: 0 0 8px;
  max-width: 740px;
  font-size: 36px;
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: 0;
}

.headline p {
  margin: 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.header-tools {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  justify-self: end;
  width: min(100%, 470px);
  min-width: 0;
  text-align: left;
}

.layout {
  width: min(1220px, calc(100% - 32px));
  margin: 22px auto 34px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.refresh-button {
  min-height: 34px;
  padding: 0 18px;
  border-color: var(--brand);
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.refresh-button:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.refresh-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.search {
  display: grid;
  min-width: 0;
}

input {
  width: 100%;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--soft);
  color: var(--text);
  font: inherit;
  outline: none;
}

input::placeholder {
  color: #86868b;
}

input:focus {
  border-color: rgba(0, 113, 227, 0.36);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

button,
.store-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--soft);
  color: var(--brand);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: #e8e8ed;
}

.store-link {
  background: var(--brand);
  color: #fff;
}

.store-link:hover {
  background: var(--brand-dark);
}

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

.app-card {
  display: grid;
  min-width: 0;
  gap: 13px;
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.045);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.app-card:hover {
  border-color: rgba(0, 113, 227, 0.24);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.app-card.is-compact {
  gap: 12px;
}

.app-summary {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.app-icon {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  background: var(--soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
  object-fit: cover;
}

.app-title-block {
  display: grid;
  gap: 8px;
  min-width: 0;
  text-align: left;
}

.app-title-block h2 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: left;
}

.app-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
}

.app-id,
.app-status {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.app-id {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-status[data-status="available"] {
  background: #eaf7ef;
  color: var(--green);
}

.app-status[data-status="unavailable"] {
  background: #fff1f0;
  color: var(--red);
}

.app-status[data-status="error"],
.app-status[data-status="unknown"],
.app-status[data-status="unchecked"] {
  background: #fff7e6;
  color: var(--amber);
}

.detail-panel {
  min-width: 0;
  padding: 12px 0 0;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 0;
  background: transparent;
}

.detail-panel[hidden] {
  display: none;
}

.detail-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
}

.detail-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #2c2c2e;
  font-size: 13px;
  line-height: 1.55;
}

.card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, auto);
  gap: 9px;
  min-width: 0;
  align-items: stretch;
}

.card-actions .store-link,
.card-actions .copy-link {
  width: 100%;
  min-width: 0;
  padding-right: 12px;
  padding-left: 12px;
  font-size: 13px;
}

.copy-link.is-copied {
  background: #eaf7ef;
  color: var(--green);
}

.copy-link.is-error {
  background: #fff1f0;
  color: var(--red);
}

.empty-state {
  padding: 38px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: var(--panel);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(250, 250, 252, 0.92);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 20px;
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.footer-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.footer-item {
  min-width: 0;
}

.footer-source {
  color: var(--text);
  font-weight: 650;
}

.footer-count strong {
  margin-left: 4px;
  color: var(--text);
}

.footer-icp {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  min-width: 0;
  white-space: nowrap;
}

.footer-icp[hidden] {
  display: none;
}

.footer-icp a {
  color: var(--muted);
  text-decoration: none;
}

.footer-icp a:hover {
  color: var(--brand);
}

@media (max-width: 900px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 14px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .headline-wrap {
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 12px;
  }

  .store-mark {
    width: 66px;
    height: 66px;
    border-radius: 17px;
    font-size: 17px;
  }

  .headline h1 {
    font-size: 28px;
  }

  .headline p {
    font-size: 13px;
  }

  .header-tools {
    justify-self: stretch;
    width: 100%;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar {
    position: static;
  }

  .topbar-inner,
  .layout {
    width: min(100% - 24px, 1220px);
  }

  .headline-wrap {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 11px;
  }

  .store-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    font-size: 15px;
  }

  .headline h1 {
    margin-bottom: 6px;
    font-size: 20px;
    line-height: 1.16;
  }

  .headline p {
    font-size: 12px;
    line-height: 1.42;
  }

  .refresh-button {
    width: 100%;
  }

  .header-tools {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .toolbar {
    grid-template-columns: 1fr auto;
    gap: 7px;
  }

  input {
    height: 32px;
    border-radius: 9px;
    font-size: 13px;
  }

  button,
  .store-link {
    min-height: 32px;
    border-radius: 9px;
    font-size: 13px;
  }

  .layout {
    margin-top: 14px;
    margin-bottom: 22px;
  }

  .app-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .app-card {
    gap: 12px;
    padding: 13px;
    border-radius: 16px;
  }

  .app-summary {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 11px;
  }

  .app-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
  }

  .app-title-block h2 {
    font-size: 15px;
  }

  .app-meta {
    gap: 5px;
  }

  .app-id,
  .app-status {
    min-height: 22px;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 11px;
  }

  .detail-panel {
    padding-top: 10px;
  }

  .detail-text {
    font-size: 12px;
  }

  .card-actions {
    grid-template-columns: minmax(0, 1fr) minmax(76px, auto);
    gap: 7px;
  }

  .card-actions .store-link,
  .card-actions .copy-link {
    padding-right: 8px;
    padding-left: 8px;
    font-size: 12px;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    width: min(100% - 24px, 1220px);
    padding-top: 14px;
    padding-bottom: 16px;
    font-size: 11px;
  }

  .footer-meta {
    display: grid;
    gap: 4px;
  }

  .footer-icp {
    justify-self: start;
    white-space: normal;
  }
}
