:root {
  --ink: #23415a;
  --muted: #70859a;
  --line: #d8e4ec;
  --paper: #ffffff;
  --soft: #f2f8fb;
  --teal: #00a9b7;
  --teal-dark: #007c8d;
  --navy: #265a78;
  --amber: #f5b72e;
  --coral: #ef7b62;
  --mint: #7ad9c4;
  --shadow: 0 12px 30px rgba(34, 65, 90, 0.12);
  --content-width: 1440px;
  --page-gutter: clamp(20px, 4vw, 56px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 18px rgba(38, 90, 120, 0.18);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--content-width), calc(100% - (var(--page-gutter) * 2)));
  min-height: 64px;
  margin: 0 auto;
  gap: 16px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #fff;
  color: var(--amber);
  font-weight: 900;
}

.brand-logo {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
}

.brand small,
.eyebrow {
  display: block;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand strong {
  display: block;
  overflow: hidden;
  font-size: 17px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

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

.icon-button,
.text-button,
.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.icon-button {
  width: 40px;
  color: inherit;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.text-button,
.ghost-button {
  padding: 0 14px;
  background: #fff;
  color: var(--teal-dark);
  border-color: var(--line);
  font-weight: 800;
}

.primary-button {
  padding: 0 18px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0, 169, 183, 0.22);
}

.icon-button:hover,
.text-button:hover,
.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.page-shell {
  width: min(var(--content-width), calc(100% - (var(--page-gutter) * 2)));
  margin: 0 auto;
  padding: 42px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  align-items: stretch;
  gap: 20px;
  margin-bottom: 22px;
}

.hero-copy {
  padding: 12px 0;
}

.hero h1 {
  max-width: 680px;
  margin: 12px 0 12px;
  font-size: clamp(32px, 4.2vw, 50px);
  line-height: 1.12;
  letter-spacing: 0;
}

.hero p {
  max-width: 610px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.featured-panel {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #17394f 0%, #1d6f78 56%, #f0b43b 100%);
  box-shadow: var(--shadow);
}

.featured-panel.has-image .featured-art {
  display: none;
}

.featured-link {
  display: block;
  min-height: 320px;
  color: inherit;
}

.featured-art {
  position: absolute;
  inset: 0;
  opacity: 0.72;
  background:
    radial-gradient(circle at 18% 25%, rgba(255,255,255,0.32), transparent 18%),
    linear-gradient(120deg, transparent 0 45%, rgba(255,255,255,0.24) 45% 48%, transparent 48%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.12) 0 2px, transparent 2px 34px);
}

.featured-content {
  position: absolute;
  inset: auto 20px 20px;
  color: #fff;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--amber);
  color: #28394b;
  font-size: 12px;
  font-weight: 900;
}

.featured-content h2 {
  margin: 12px 0 8px;
  font-size: 28px;
}

.featured-content p {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.6;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px;
  margin: 18px 0;
}

.search-box,
.select-box,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.search-box span {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: none;
  color: var(--ink);
}

.select-box {
  padding: 0 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 20px;
}

.chip {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.chip.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 24px;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.game-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(34, 65, 90, 0.08);
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-top: 28px;
  min-height: 240px;
  padding: 38px 34px;
  border: 1px dashed #a8c4d3;
  border-radius: 8px;
  background: #fff;
}

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

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

.cover {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #dfeff3;
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cover-art, linear-gradient(135deg, #255a78, #00a9b7));
}

.cover.has-image::before {
  background: transparent;
}

.cover .tag {
  position: absolute;
  top: 10px;
  left: 10px;
  max-width: calc(100% - 20px);
  padding: 4px 7px;
  border-radius: 5px;
  background: rgba(35, 65, 90, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.card-body {
  padding: 12px;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.meta-line span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.meta-line span:last-child {
  flex: 0 0 auto;
}

.game-card h3 {
  margin: 8px 0 6px;
  font-size: 19px;
  line-height: 1.25;
}

.game-card h3 a {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.game-card p {
  display: -webkit-box;
  min-height: 44px;
  margin: 0 0 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.play-link {
  color: var(--teal-dark);
  font-weight: 900;
}

.admin-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
}

.panel,
.form-panel,
.side-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(34, 65, 90, 0.08);
}

.side-panel,
.form-panel {
  padding: 18px;
}

.admin-side-head,
.form-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.admin-side-head h2,
.form-head h1 {
  margin-bottom: 0;
}

.form-actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.admin-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.admin-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.admin-item-body {
  min-width: 0;
}

.admin-item-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.mini-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--teal-dark);
  font-weight: 800;
  cursor: pointer;
}

.mini-button.danger {
  color: #b24343;
}

.login-card {
  width: min(430px, calc(100% - 32px));
  margin: 58px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-card h1,
.form-panel h1,
.side-panel h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

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

.field {
  margin-bottom: 14px;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.required {
  color: var(--coral);
}

.field input,
.field select,
.field textarea {
  padding: 10px 12px;
}

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

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

.full-span {
  grid-column: 1 / -1;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #b8c9d4;
  cursor: pointer;
}

.slider::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.switch input:checked + .slider {
  background: var(--teal);
}

.switch input:checked + .slider::after {
  transform: translateX(20px);
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 132px;
  border: 1px dashed #a8c4d3;
  border-radius: 8px;
  background: #f6fbfd;
  color: var(--muted);
  text-align: center;
}

.upload-zone strong {
  display: block;
  margin-bottom: 5px;
  color: var(--teal-dark);
}

.thumb {
  width: 58px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--amber));
}

.admin-item strong,
.admin-item span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.admin-item strong {
  margin-bottom: 2px;
}

.admin-item span {
  color: var(--muted);
  font-size: 12px;
}

.game-stage {
  display: grid;
  grid-template-rows: auto minmax(420px, 62vh) auto;
  min-height: calc(100vh - 64px);
}

.stage-header,
.stage-footer {
  width: min(var(--content-width), calc(100% - (var(--page-gutter) * 2)));
  margin: 0 auto;
  padding: 16px 0;
}

.stage-frame {
  display: grid;
  place-items: center;
  width: min(var(--content-width), calc(100% - (var(--page-gutter) * 2)));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0,169,183,0.15), transparent 38%),
    linear-gradient(45deg, rgba(245,183,46,0.18), transparent 42%),
    #102f45;
  color: #fff;
  box-shadow: var(--shadow);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.18fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 20px;
}

.detail-cover {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  border-radius: 8px;
  background: #dfeff3 center / cover no-repeat;
  box-shadow: var(--shadow);
}

.detail-cover-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
}

.detail-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 0;
}

.detail-copy h1 {
  margin: 12px 0 10px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.12;
}

.detail-copy p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.detail-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.detail-stat small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-stat strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-section h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.detail-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.stage-frame h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 46px);
}

.beian {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding: 24px 16px 34px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

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

@media (max-width: 1180px) {
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .hero,
  .detail-hero,
  .admin-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

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

  .detail-cover {
    min-height: 240px;
  }

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

@media (max-width: 560px) {
  .topbar-inner,
  .page-shell,
  .stage-header,
  .stage-footer,
  .stage-frame {
    width: min(100% - 24px, 1120px);
  }

  .brand strong {
    font-size: 15px;
  }

  .text-button.hide-mobile {
    display: none;
  }

  .hero h1 {
    font-size: 32px;
  }

  .featured-panel {
    min-height: 260px;
  }

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

  .login-card {
    margin-top: 28px;
  }
}
