:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #61707f;
  --line: #d8e0e7;
  --panel: #ffffff;
  --field: #f7fafc;
  --accent: #1f7a5f;
  --accent-2: #a83f39;
  --warn: #9f6b14;
  --bg: #edf1f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 15px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  background: #152026;
  color: #f7fafc;
  border-bottom: 4px solid var(--accent);
}

.topbar-inner,
.main,
.footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: #28343c;
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a,
.nav button {
  border: 0;
  color: #f7fafc;
  background: transparent;
  padding: 8px 10px;
  font: inherit;
  border-radius: 4px;
  cursor: pointer;
}

.nav a:hover,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.main {
  padding: 28px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.hero-copy p {
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.7;
}

.hero-media {
  min-height: 220px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(0deg, rgba(21, 32, 38, 0.72), rgba(21, 32, 38, 0.18)),
    url("/legacy/image/main_logo_main.jpg") center / cover no-repeat,
    #28343c;
  display: flex;
  align-items: end;
  padding: 18px;
  color: white;
}

.hero-media strong {
  display: block;
  font-size: 20px;
  line-height: 1.3;
}

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

.two {
  grid-template-columns: 1fr 1fr;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel h2,
.card h2,
.panel h3,
.card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric b {
  font-size: 28px;
}

.metric span {
  color: var(--muted);
}

.metric small {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.metric.status.online b,
.status-line.online {
  color: #126347;
}

.metric.status.maintenance b,
.metric.status.disabled b,
.status-line.maintenance,
.status-line.disabled {
  color: var(--warn);
}

.status-line {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.notice {
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #f1d48c;
  background: #fff8e6;
  color: var(--warn);
  margin-bottom: 12px;
}

.plain-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  line-height: 1.6;
}

.article {
  display: grid;
  gap: 12px;
  max-width: 880px;
  line-height: 1.75;
}

.article p {
  margin: 0;
}

.admin-actions {
  display: grid;
  gap: 8px;
  min-width: 260px;
}

.admin-actions form {
  display: grid;
  gap: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.flash {
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 12px;
}

.flash.success {
  border-color: #9ad1bd;
  background: #edf9f4;
  color: #126347;
}

.flash.danger {
  border-color: #e6a5a0;
  background: #fff0ef;
  color: #922c27;
}

.flash.warning {
  border-color: #f1d48c;
  background: #fff8e6;
  color: var(--warn);
}

form.stack,
.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.choice-field {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.choice-field legend {
  padding: 0 6px;
  color: var(--muted);
}

.choice-field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.choice-field input {
  width: auto;
}

.face-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.face-choice {
  display: grid;
  grid-template-rows: 76px auto;
  align-items: center;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
}

.face-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.face-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  height: 76px;
}

.face-thumb img {
  max-width: 62px;
  max-height: 72px;
  image-rendering: auto;
}

.face-code {
  font-size: 12px;
  color: var(--muted);
  line-height: 1;
}

.face-choice:has(input:checked) {
  border-color: var(--accent);
  background: #eef6fb;
}

.face-choice:focus-within {
  outline: 2px solid rgba(26, 115, 150, 0.25);
  outline-offset: 2px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.actions input {
  flex: 1 1 260px;
}

.actions select {
  width: auto;
  min-width: 150px;
}

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font: inherit;
  cursor: pointer;
}

.button.secondary {
  background: #52616d;
}

.button.danger {
  background: var(--accent-2);
}

.button:hover {
  text-decoration: none;
  filter: brightness(0.96);
}

.button.disabled {
  cursor: default;
  opacity: 0.55;
  filter: none;
}

.rank-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  background: #f1f5f8;
  color: #344450;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.shop-filter {
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.shop-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.shop-item img {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f1f5f8;
  object-fit: cover;
}

.shop-summary {
  min-width: 0;
}

.shop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 8px;
}

.shop-meta span {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  background: #f8fafb;
  color: #52616d;
  font-size: 12px;
  line-height: 1.45;
}

.shop-buy-form {
  grid-column: 1 / -1;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.detail-head h2,
.shop-summary h3 {
  margin: 0;
}

.shop-detail {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.shop-detail-image {
  width: 128px;
  height: 128px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f1f5f8;
  object-fit: cover;
}

.shop-detail-image.pet {
  height: 116px;
}

.detail-actions {
  margin-top: 16px;
}

.download-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.download-missing {
  color: var(--warn);
  margin-top: 6px;
}

.muted {
  color: var(--muted);
}

.footer {
  color: var(--muted);
  padding: 18px 0 28px;
}

@media (max-width: 820px) {
  .topbar-inner,
  .hero,
  .grid,
  .two {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    display: grid;
    align-items: start;
  }

  .nav {
    justify-content: flex-start;
  }

  .hero-copy h1 {
    font-size: 24px;
  }

  .shop-filter {
    grid-template-columns: 1fr;
  }

  .download-item {
    grid-template-columns: 1fr;
  }

  .shop-detail {
    grid-template-columns: 1fr;
  }
}
