:root {
  color-scheme: light;
  --bg: #eef8f2;
  --panel: #ffffff;
  --ink: #12352d;
  --muted: #5f766d;
  --line: #cfe7da;
  --brand: #20a66b;
  --brand-strong: #0b7f4a;
  --accent: #18a35f;
  --soft: #effaf4;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #dff4e8 0, #eef8f2 230px),
    var(--bg);
}

body.subpage {
  background: #efefef;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar.compact {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 4px;
  font-size: 26px;
  line-height: 1.15;
}

h2 {
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.2;
}

.back,
.back-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(32, 166, 107, .24);
  color: var(--brand-strong);
  background: rgba(255, 255, 255, .74);
  font-size: 0;
  font-weight: 700;
  line-height: 1;
}

.back::before,
.back-link::before {
  content: "";
  width: 11px;
  height: 11px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
}

.page-heading {
  min-width: 0;
  text-align: right;
}

.page-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.group-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.group-list + .group-list {
  margin-top: 12px;
}

.group-list.compact {
  gap: 10px;
}

.catalog-list {
  display: grid;
  gap: 18px;
}

.catalog-section {
  display: grid;
  gap: 10px;
}

.catalog-section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.catalog-section-header h2 {
  font-size: 19px;
}

.catalog-section-header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
}

.group-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(25, 75, 50, .08);
}

.group-card img {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--soft);
}

.group-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.group-copy strong {
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.25;
}

.group-copy span:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.enter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-size: 0;
  line-height: 1;
}

.enter::before {
  content: "";
  width: 10px;
  height: 10px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: rotate(45deg);
}

.sub-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 72px;
  padding: max(0px, env(safe-area-inset-top)) 24px 0;
  background: #fff;
  color: #000;
}

.sub-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 44px;
  color: #1687e8;
  font-size: 0;
  line-height: 1;
}

.sub-nav a::before {
  content: "";
  width: 12px;
  height: 12px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
}

.sub-nav strong {
  font-size: 22px;
  font-weight: 800;
}

.list-page {
  width: min(720px, 100%);
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 24px 24px 38px;
}

.list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.list-title h1 {
  color: #000;
  font-size: 28px;
  line-height: 1.15;
}

.list-title strong {
  color: #000;
  font-size: 28px;
  line-height: 1.15;
}

.stack-list {
  display: grid;
  gap: 12px;
}

.stack-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 112px;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
}

.stack-card img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: #fff;
}

.stack-card span {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.stack-card strong {
  overflow-wrap: anywhere;
  color: #111;
  font-size: 25px;
  font-weight: 500;
}

.stack-card em {
  color: #8b8f99;
  font-size: 19px;
  font-style: normal;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.model-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

.model-card.disabled {
  opacity: .58;
  pointer-events: none;
}

.model-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.model-card strong {
  min-height: 42px;
  color: #111;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.model-card span {
  color: #8b8f99;
  font-size: 13px;
}

@media (min-width: 720px) {
  .shell {
    padding: 30px 24px 42px;
  }

  h1 {
    font-size: 34px;
  }

  .group-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-card {
    grid-template-columns: 104px minmax(0, 1fr) 42px;
    min-height: 132px;
    padding: 14px;
  }

  .group-card img {
    width: 104px;
    height: 104px;
  }

  .model-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
