:root {
  color-scheme: dark;
  --ink: #17130d;
  --bone: #ead9ae;
  --bone-bright: #fff2ce;
  --gold: #c69b50;
  --gold-soft: #e6c77d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 568px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0f0c08;
}

body {
  color: var(--bone-bright);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button {
  font: inherit;
}

.hub-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.5vh, 16px);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding:
    max(14px, var(--safe-top))
    max(22px, var(--safe-right))
    max(12px, var(--safe-bottom))
    max(22px, var(--safe-left));
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(10, 9, 6, 0.18), rgba(10, 8, 5, 0.78)),
    radial-gradient(circle at 50% -20%, rgba(202, 159, 78, 0.24), transparent 45%),
    repeating-linear-gradient(90deg, rgba(255, 245, 213, 0.014) 0 1px, transparent 1px 62px),
    #17120c;
}

.hub-shell::before,
.hub-shell::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.hub-shell::before {
  inset: 0;
  opacity: 0.42;
  background:
    linear-gradient(90deg, transparent 0 49.8%, rgba(232, 202, 135, 0.06) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 0 49.8%, rgba(232, 202, 135, 0.035) 50%, transparent 50.2%);
  background-size: 84px 84px;
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

.hub-shell::after {
  inset: 7px;
  border: 1px solid rgba(223, 189, 118, 0.2);
  border-radius: 20px;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.38);
}

.ambient {
  position: absolute;
  z-index: -1;
  width: 30vw;
  height: 56vh;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.14;
  pointer-events: none;
}

.ambient-left {
  top: 8%;
  left: -14%;
  background: #4e8a72;
}

.ambient-right {
  right: -14%;
  bottom: -4%;
  background: #913e28;
}

.hub-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 1.8vw, 24px);
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
}

.brand-seal {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(58px, 7.5vh, 76px);
  aspect-ratio: 1;
  color: #fae9bd;
  border: 2px solid #e5bd6c;
  border-radius: 17px 11px 16px 9px;
  background: linear-gradient(145deg, #923829, #681d18);
  box-shadow: inset 0 0 0 5px rgba(255, 231, 177, 0.1), 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: rotate(-2deg);
}

.brand-seal::after {
  position: absolute;
  inset: 6px;
  content: "";
  border: 1px solid rgba(255, 227, 174, 0.48);
  border-radius: 10px 7px 11px 6px;
}

.brand-seal span {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(34px, 4.8vh, 48px);
  font-weight: 700;
  line-height: 1;
}

.brand-copy {
  min-width: 0;
}

.eyebrow,
.stage-heading p,
.feature {
  margin: 0;
  color: var(--gold-soft);
  font-size: clamp(9px, 1.35vh, 13px);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin: 2px 0 3px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(25px, 4.2vh, 42px);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.12;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.52);
}

.intro {
  overflow: hidden;
  margin: 0;
  color: rgba(242, 226, 189, 0.68);
  font-size: clamp(11px, 1.65vh, 16px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offline-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: #d9e8d8;
  border: 1px solid rgba(143, 186, 150, 0.35);
  border-radius: 999px;
  background: rgba(39, 69, 50, 0.36);
  font-size: clamp(11px, 1.55vh, 14px);
  white-space: nowrap;
}

.offline-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #91c49b;
  box-shadow: 0 0 12px rgba(145, 196, 155, 0.7);
}

.stage-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
  padding-top: 1px;
}

.stage-heading h2 {
  margin: 1px 0 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(18px, 2.8vh, 27px);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.stage-hint {
  color: rgba(235, 221, 188, 0.55) !important;
  font-size: clamp(10px, 1.45vh, 13px) !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1.8vw, 26px);
  max-width: 1540px;
  min-height: 0;
  width: 100%;
  margin: 0 auto;
}

.game-card {
  --accent: #8bb5a0;
  --accent-deep: #345b4d;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: clamp(16px, 2.5vh, 24px);
  background: #16130e;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(255, 240, 203, 0.04);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.game-card::after {
  position: absolute;
  inset: 7px;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(255, 237, 193, 0.12);
  border-radius: calc(clamp(16px, 2.5vh, 24px) - 6px);
}

.accent-jade {
  --accent: #8bbca5;
  --accent-deep: #315d4e;
}

.accent-bronze {
  --accent: #d1a659;
  --accent-deep: #765128;
}

.accent-crimson {
  --accent: #bd6a54;
  --accent-deep: #71362b;
}

.game-card:not(.is-coming):hover,
.game-card:not(.is-coming):focus-within {
  border-color: color-mix(in srgb, var(--accent) 88%, white 12%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), 0 0 28px color-mix(in srgb, var(--accent) 12%, transparent);
  transform: translateY(-3px);
}

.card-art,
.card-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.card-art {
  object-fit: cover;
  object-position: center;
  opacity: 0.73;
  transform: scale(1.015);
  transition: transform 600ms ease, filter 300ms ease;
}

.game-card:hover .card-art {
  transform: scale(1.055);
}

.card-shade {
  background:
    linear-gradient(180deg, rgba(7, 7, 5, 0.12) 0%, rgba(9, 8, 6, 0.25) 28%, rgba(12, 10, 7, 0.92) 72%, rgba(10, 8, 5, 0.98) 100%),
    linear-gradient(115deg, color-mix(in srgb, var(--accent-deep) 38%, transparent), transparent 58%);
}

.card-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  padding: clamp(14px, 2.2vh, 23px);
}

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

.stage-index {
  color: rgba(255, 239, 202, 0.44);
  font-family: Georgia, serif;
  font-size: clamp(12px, 1.8vh, 17px);
}

.stage-pill,
.age-label {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: clamp(10px, 1.45vh, 13px);
  white-space: nowrap;
}

.stage-pill {
  color: #fff2ce;
  border: 1px solid color-mix(in srgb, var(--accent) 58%, transparent);
  background: color-mix(in srgb, var(--accent-deep) 68%, transparent);
  font-weight: 700;
}

.age-label {
  justify-self: end;
  color: rgba(244, 229, 193, 0.72);
  background: rgba(9, 8, 6, 0.36);
}

.card-main {
  align-self: end;
  min-height: 0;
  margin-bottom: clamp(10px, 2vh, 20px);
}

.feature {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: clamp(10px, 1.45vh, 13px);
}

.card-main h3 {
  margin: 0 0 clamp(5px, 1vh, 10px);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(24px, 4.2vh, 40px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.78);
}

.description {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: rgba(244, 232, 203, 0.75);
  font-size: clamp(11px, 1.65vh, 15px);
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.launch-button {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: clamp(42px, 6.6vh, 62px);
  padding: 8px 18px;
  color: #fff4d7;
  border: 1px solid color-mix(in srgb, var(--accent) 84%, white 16%);
  border-radius: 13px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-deep) 84%, #111 16%), var(--accent-deep));
  box-shadow: inset 0 1px 0 rgba(255, 245, 218, 0.17), 0 6px 18px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: filter 150ms ease, transform 150ms ease;
}

.launch-button span {
  font-size: clamp(13px, 2vh, 18px);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.launch-button b {
  font-family: Georgia, serif;
  font-size: clamp(22px, 3.4vh, 32px);
  font-weight: 400;
  line-height: 0.8;
}

.launch-button small {
  color: rgba(244, 229, 197, 0.5);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.launch-button:not(:disabled):hover,
.launch-button:not(:disabled):focus-visible {
  filter: brightness(1.18);
  outline: 2px solid rgba(255, 238, 195, 0.38);
  outline-offset: 2px;
  transform: translateY(-1px);
}

.launch-button:not(:disabled):active {
  transform: translateY(1px) scale(0.995);
}

.launch-button:disabled {
  color: rgba(237, 224, 193, 0.62);
  border-color: rgba(214, 183, 120, 0.22);
  background: rgba(53, 45, 35, 0.76);
  cursor: default;
}

.is-coming .card-art {
  filter: grayscale(0.72) sepia(0.16) brightness(0.68);
}

.coming-ribbon {
  position: absolute;
  z-index: 3;
  top: 23px;
  right: -39px;
  width: 150px;
  padding: 6px 0;
  color: rgba(255, 239, 205, 0.86);
  background: rgba(108, 52, 41, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  transform: rotate(38deg);
}

.hub-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(224, 207, 170, 0.46);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(10px, 1.4vh, 13px);
  letter-spacing: 0.1em;
}

.footer-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(218, 180, 106, 0.62);
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: max(24px, calc(var(--safe-bottom) + 14px));
  max-width: min(80vw, 560px);
  padding: 12px 22px;
  color: #fff1ca;
  border: 1px solid rgba(222, 187, 115, 0.44);
  border-radius: 999px;
  background: rgba(20, 16, 10, 0.94);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.44);
  font-size: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.portrait-guard {
  display: none;
}

@media (max-height: 620px) {
  .hub-shell {
    gap: 7px;
    padding-top: max(9px, var(--safe-top));
    padding-bottom: max(8px, var(--safe-bottom));
  }

  .brand-seal {
    width: 50px;
  }

  .brand-seal span {
    font-size: 31px;
  }

  .brand-copy h1 {
    font-size: 25px;
  }

  .intro {
    font-size: 11px;
  }

  .stage-heading h2 {
    font-size: 18px;
  }

  .card-content {
    padding: 12px;
  }

  .card-main {
    margin-bottom: 7px;
  }

  .card-main h3 {
    margin-bottom: 3px;
    font-size: 24px;
  }

  .description {
    font-size: 11px;
    line-height: 1.42;
  }

  .launch-button {
    min-height: 39px;
  }
}

@media (max-height: 400px) {
  .hub-shell {
    gap: 4px;
    padding-top: max(6px, var(--safe-top));
    padding-bottom: max(5px, var(--safe-bottom));
  }

  .hub-header {
    min-height: 54px;
  }

  .brand-seal {
    width: 42px;
  }

  .brand-seal span {
    font-size: 25px;
  }

  .eyebrow {
    font-size: 8px;
  }

  .brand-copy h1 {
    font-size: 20px;
  }

  .intro {
    max-width: none;
    font-size: 9px;
  }

  .offline-badge {
    padding: 7px 10px;
    font-size: 10px;
  }

  .stage-heading h2 {
    font-size: 15px;
  }

  .stage-kicker,
  .stage-advice,
  .footer-note {
    font-size: 8px;
  }

  .card-content {
    padding: 8px;
  }

  .card-number {
    display: none;
  }

  .card-topline {
    grid-template-columns: 1fr;
  }

  .stage-pill {
    padding: 4px 8px;
    font-size: 10px;
  }

  .feature {
    font-size: 9px;
  }

  .card-main {
    margin-bottom: 3px;
  }

  .card-main h3 {
    margin-bottom: 1px;
    font-size: 18px;
    line-height: 1.08;
  }

  .description {
    display: none;
  }

  .launch-button {
    min-height: 34px;
    font-size: 14px;
  }
}

@media (max-width: 850px) {
  .hub-shell {
    padding-right: max(12px, var(--safe-right));
    padding-left: max(12px, var(--safe-left));
  }

  .game-grid {
    gap: 9px;
  }

  .card-content {
    padding: 11px;
  }

  .age-label {
    display: none;
  }

  .card-topline {
    grid-template-columns: auto 1fr;
  }

  .stage-pill {
    justify-self: start;
  }

  .description {
    -webkit-line-clamp: 2;
  }
}

@media (orientation: portrait) {
  html,
  body {
    min-width: 0;
  }

  .hub-shell {
    filter: blur(8px) brightness(0.42);
    pointer-events: none;
  }

  .portrait-guard {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px;
    color: #fff0c6;
    background: rgba(14, 11, 7, 0.9);
    text-align: center;
  }

  .rotate-icon {
    display: grid;
    place-items: center;
    width: 82px;
    height: 52px;
    margin-bottom: 8px;
    border: 2px solid #c99e52;
    border-radius: 9px;
    font-size: 32px;
    transform: rotate(-12deg);
  }

  .portrait-guard strong {
    font-size: 24px;
  }

  .portrait-guard span {
    color: rgba(240, 223, 185, 0.68);
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
