:root {
  --bg: #f4f7f2;
  --card: #ffffff;
  --ink: #1f2a20;
  --muted: #5d6a5e;
  --line: #d9e1d8;
  --brand: #2e6f40;
  --brand-2: #183d25;
  --danger: #c53f3f;
  --dock-top: 156px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #d9eed7 0%, transparent 36%),
    radial-gradient(circle at 90% 100%, #dce8ff 0%, transparent 30%),
    var(--bg);
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.hero {
  background: linear-gradient(130deg, var(--brand), var(--brand-2));
  color: #fff;
  padding: 22px 0 18px;
}

.hero-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
}

.hero h1 { margin: 0; font-size: 34px; line-height: 1.1; }
.hero p { margin: 0; opacity: 0.92; }

.hero-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.hero-logo-image {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.hero-subrow {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lang-switch {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.hero .lang-switch {
  margin-bottom: 0;
}

.lang-switch button {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  padding: 6px 12px;
}

.lang-switch button.active {
  background: #fff;
  color: var(--brand-2);
}

.hero-center-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
  font-weight: 600;
  line-height: 1;
  min-height: 40px;
}

button.hero-nav-btn {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  cursor: pointer;
}

.hero-nav-btn.active {
  background: #fff;
  color: var(--brand-2);
}

.hero-nav-btn--icon {
  min-width: 42px;
  width: 42px;
  padding: 8px 0;
}

.hero-nav-btn--icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.lang-menu {
  position: relative;
  display: inline-flex;
}

.lang-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  padding: 6px 0;
}

.lang-menu-popup {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 120px;
  max-height: 70vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.97);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  z-index: 50;
}

.lang-menu-popup .lang-option {
  width: 100%;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
}

.lang-menu-popup .lang-option:hover {
  background: rgba(46, 111, 64, 0.12);
}

.lang-switch--light {
  margin-bottom: 12px;
}

.lang-switch--light button {
  background: #eef3ed;
  border: 1px solid var(--line);
  color: var(--ink);
}

.lang-switch--light button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.layout {
  position: relative;
  display: block;
  padding: 20px 0 40px;
}

.left-nav {
  position: fixed;
  left: calc((100vw - min(1100px, 92vw)) / 2 - 96px);
  top: calc(var(--dock-top) + 44px);
  transform: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.left-nav button {
  width: 82px;
  background: #eef3ed;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px 0 0 10px;
}

.left-nav button.active {
  background: var(--brand);
  color: #fff;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.toolbar input {
  flex: 1;
  min-width: 0;
}

.admin .toolbar input {
  flex: 1;
  min-width: 220px;
}

input, textarea, button {
  font: inherit;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.hidden-input {
  display: none;
}

.rich-editor {
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  overflow: auto;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #95a299;
}

.rich-editor img {
  max-width: 100%;
  height: auto;
}

.editor-shell {
  position: relative;
}

.editor-scroll-actions {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2;
}

.editor-scroll-actions button {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  padding: 0;
  line-height: 1;
}

label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--muted);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

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

#searchBtn {
  white-space: nowrap;
  min-width: 64px;
  flex-shrink: 0;
}

.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg);
  padding: 0;
}

.categories button {
  background: #eef3ed;
  color: var(--ink);
}

.categories button.active {
  background: var(--brand);
  color: #fff;
}

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

.skeleton-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  min-height: 132px;
}

.skeleton-line {
  display: block;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e9efe8 25%, #f5f8f4 50%, #e9efe8 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.1s linear infinite;
}

.skeleton-line + .skeleton-line {
  margin-top: 10px;
}

.skeleton-line.title {
  width: 58%;
  height: 18px;
}

.skeleton-line.url {
  width: 82%;
}

.skeleton-line.desc {
  width: 92%;
}

.skeleton-line.desc.short {
  width: 64%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

.site-footer-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-footer-links a,
.site-footer-line a {
  color: var(--brand-2);
  text-decoration: none;
}

.site-footer-links a:hover,
.site-footer-line a:hover {
  text-decoration: underline;
}

.site-footer-sep {
  opacity: 0.7;
}

.icon-preview {
  display: block;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 8px;
  background: #fff;
  object-fit: cover;
}

.logo-preview {
  display: block;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 8px;
  background: #fff;
  object-fit: cover;
}

.site-card-link {
  text-decoration: none;
  color: inherit;
}

.site-card, .review-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.site-card {
  position: relative;
  min-height: 166px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.site-card:hover {
  background: #bfe5c7;
  border-color: #79b589;
}

.skills-toolbar-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  margin: -4px 0 14px;
}

.skills-toolbar-note a {
  color: var(--brand-2);
  text-decoration: none;
}

.skill-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.skill-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}

.skill-card-icon--placeholder {
  background: linear-gradient(135deg, #eef3ed, #dfe8e1);
}

.skill-card-head-text {
  min-width: 0;
}

.skill-card-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.skill-card-category {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.site-badge-stack {
  position: absolute;
  top: 12px;
  right: 54px;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  z-index: 1;
}

.site-badge {
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 28px;
  padding: 3px 7px;
  border-radius: 999px;
  line-height: 1;
  text-align: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.site-badge--hot {
  background: #d92c2c;
}

.site-badge--pinned {
  background: #d6a312;
}

.site-badge--new {
  background: #2f6fed;
}

.hot-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #d92c2c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.review-card h3 {
  margin: 0 0 8px;
}

.review-card a {
  color: var(--brand-2);
  text-decoration: none;
}

.site-row {
  display: block;
  margin-bottom: 8px;
}

.site-row:last-child {
  margin-bottom: 0;
}

.site-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.site-favorite-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #d7dfd8;
  background: #fff;
  color: #7c8c7f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(21, 49, 28, 0.08);
}

.site-favorite-btn:hover {
  background: #f6faf6;
  color: #4b5f4d;
}

.site-favorite-btn.active {
  background: #fff1f1;
  border-color: #f2bbbb;
  color: #d93a52;
}

.site-favorite-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.site-value {
  color: var(--ink);
  word-break: break-word;
}

.site-link {
  display: block;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--brand-2);
  text-decoration: underline;
}

.message { font-size: 13px; margin: 8px 0 0; }
.message.success { color: #256e2f; }
.message.error { color: var(--danger); }

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

.hidden { display: none; }

.admin {
  max-width: 1000px;
  padding: 20px 0 40px;
}

.admin-panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: start;
}

.admin-nav button {
  width: auto;
  min-width: 120px;
  flex: 0 0 auto;
}

.admin-add-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.admin-add-form button { grid-column: 1 / -1; }

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

.visit-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.visit-stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.visit-stat-card strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
  margin-top: 8px;
}

.tutorial-item {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-decoration: none;
  color: var(--ink);
}

.tutorial-item:hover {
  background: #bfe5c7;
  border-color: #79b589;
}

.tutorial-item h3 {
  margin: 0 0 8px;
}

.review-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.inline-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.inline-edit-grid textarea {
  grid-column: 1 / -1;
}

.inline-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.sort-row {
  align-items: end;
}

.sort-row label {
  margin: 0;
  min-width: 120px;
}

.sort-row input {
  margin-top: 4px;
}

.small {
  color: var(--muted);
  font-size: 12px;
}

.submit-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.submit-modal.hidden {
  display: none;
}

.submit-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 24, 17, 0.45);
}

.submit-modal-card {
  position: relative;
  width: min(620px, 92vw);
  max-height: 88vh;
  overflow: auto;
}

.submit-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.submit-close-btn {
  background: #eef3ed;
  color: var(--ink);
  border: 1px solid var(--line);
}

.tutorial-layout {
  grid-template-columns: 1fr;
}

.tutorial-card h2 {
  margin-top: 0;
}

.tutorial-content {
  /* Speed up long tutorial rendering: only paint what is near the viewport. */
  content-visibility: auto;
  contain-intrinsic-size: 1000px;
}

.tutorial-preview {
  white-space: pre-wrap;
  margin: 0;
  font: inherit;
  line-height: 1.7;
}

.tutorial-content img {
  max-width: 100%;
  height: auto;
}

.tutorial-side-action {
  position: fixed;
  left: calc((100vw - min(1100px, 92vw)) / 2 - 120px);
  top: 200px;
  z-index: 20;
}

.tutorial-side-action button {
  width: 96px;
  border-radius: 10px 0 0 10px;
}

.tutorial-scroll-action {
  position: fixed;
  left: calc((100vw + min(1100px, 92vw)) / 2 + 12px);
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.tutorial-scroll-action button {
  width: 42px;
  height: 42px;
  border-radius: 21px;
  padding: 0;
  line-height: 1;
}

@media (max-width: 900px) {
  .layout { display: block; }
  .hero-top {
    grid-template-columns: 1fr;
  }
  .hero-subrow {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero .lang-switch {
    width: 100%;
    justify-content: flex-start;
  }
  .hero-center-nav {
    justify-content: flex-start;
  }
  .hero-subrow {
    align-items: flex-start;
    flex-direction: column;
  }
  .left-nav {
    position: static;
    transform: none;
    flex-direction: row;
    margin-bottom: 12px;
  }
  .categories {
    position: static;
    background: transparent;
    padding: 0;
  }
  .tutorial-side-action {
    position: static;
    margin-bottom: 10px;
  }
  .tutorial-side-action button {
    width: auto;
    border-radius: 10px;
  }
  .tutorial-scroll-action {
    left: 10px;
    bottom: 10px;
  }
.left-nav button { border-radius: 10px; width: auto; }
.left-nav button:empty {
  /* Keep the dock width/height consistent while hiding label text. */
  width: 56px;
  height: 56px;
  padding: 0;
}

@media (max-width: 640px) {
  .toolbar {
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .toolbar input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  #searchBtn {
    flex: 0 0 auto;
    width: auto;
    min-width: 92px;
  }

  .categories {
    gap: 6px;
    margin-bottom: 12px;
  }

  .categories button {
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.15;
    min-height: 40px;
  }

  .hero-subrow {
    position: relative;
    padding-top: 6px;
    padding-right: 54px;
  }

  .hero .lang-switch {
    gap: 10px;
    flex-wrap: nowrap;
  }

  .hero-nav-btn,
  #openSubmitFormBtn {
    min-width: 0;
    flex: 0 1 auto;
    text-align: center;
    white-space: nowrap;
    min-height: 42px;
    padding: 9px 12px;
    font-weight: 700;
    border-radius: 14px;
    -webkit-tap-highlight-color: transparent;
    font-size: 0.875rem;
  }

  .lang-menu {
    position: absolute;
    right: 0;
    top: -54px;
    margin-left: 0;
    flex: 0 0 auto;
  }
}
  .skills-toolbar-note {
    flex-direction: column;
    align-items: flex-start;
  }
  .admin-panel-grid { grid-template-columns: 1fr; }
  .admin-add-form { grid-template-columns: 1fr; }
}

.games-page,
.minesweeper-page,
.fortune-page,
.muyu-page {
  padding: 14px 0 28px;
}

.muyu-page {
  background:
    radial-gradient(circle at top, rgba(151, 104, 44, 0.18), transparent 24%),
    linear-gradient(180deg, #060606 0%, #020202 100%);
  min-height: calc(100vh - 80px);
}

.games-hero-card,
.minesweeper-shell,
.fortune-shell,
.muyu-shell {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(217, 225, 216, 0.92);
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(31, 42, 32, 0.08);
}

.games-hero-card {
  padding: 24px;
  margin-bottom: 20px;
}

.games-eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.games-hero-card h2,
.minesweeper-header h2,
.fortune-header h2,
.muyu-header h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.minesweeper-header h2 {
  display: none;
}

.fortune-header h2 {
  display: none;
}

.muyu-header h2 {
  display: none;
}

.games-hero-card p:last-child,
.minesweeper-subtitle,
.fortune-subtitle,
.muyu-subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.game-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(217, 225, 216, 0.92);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(31, 42, 32, 0.08);
}

.game-card__body {
  flex: 1 1 auto;
}

.game-card__icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: linear-gradient(135deg, rgba(46, 111, 64, 0.16), rgba(24, 61, 37, 0.08));
}

.game-card__icon--image {
  overflow: hidden;
  padding: 0;
}

.game-card__icon--image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-card__icon--muyu {
  position: relative;
  overflow: visible;
  background: linear-gradient(135deg, rgba(143, 96, 44, 0.18), rgba(78, 46, 20, 0.06));
}

.game-card__muyu-body {
  position: absolute;
  inset: 14px 10px 12px;
  border-radius: 44% 44% 50% 50% / 36% 36% 58% 58%;
  background: linear-gradient(180deg, #d5a15f 0%, #b77833 48%, #855228 100%);
  box-shadow:
    inset 0 -8px 12px rgba(66, 37, 12, 0.18),
    inset 0 6px 10px rgba(255, 236, 186, 0.42);
}

.game-card__muyu-groove {
  position: absolute;
  left: 19px;
  right: 13px;
  top: 24px;
  height: 9px;
  border-radius: 999px;
  background: rgba(72, 36, 13, 0.82);
  transform: rotate(-14deg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

.game-card__muyu-base {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 8px;
  height: 7px;
  border-radius: 999px;
  background: rgba(31, 22, 14, 0.18);
  filter: blur(1px);
}

.game-card__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(217, 225, 216, 0.92);
  background: linear-gradient(135deg, rgba(46, 111, 64, 0.16), rgba(24, 61, 37, 0.08));
}

.game-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-card__actions {
  display: flex;
  justify-content: flex-start;
  margin-top: auto;
}

.game-card h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.game-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.game-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.game-card__meta li {
  background: #f1f6ef;
  color: var(--brand-2);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
}

.game-card__play,
.minesweeper-back,
.minesweeper-difficulties button,
.minesweeper-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(46, 111, 64, 0.16);
  background: #fff;
  color: var(--brand-2);
  text-decoration: none;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.minesweeper-back svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

@media (min-width: 1180px) {
  .games-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.minesweeper-intro-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.minesweeper-subtitle {
  flex: 1;
  min-width: 0;
}

.game-card__play {
  background: var(--brand);
  color: #fff;
  min-width: 108px;
}

.minesweeper-shell {
  padding: 24px;
}

.fortune-shell {
  padding: 24px;
}

.muyu-shell {
  padding: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(188, 133, 63, 0.18), transparent 32%),
    radial-gradient(circle at 85% 100%, rgba(139, 101, 47, 0.16), transparent 26%),
    linear-gradient(180deg, rgba(14, 14, 14, 0.98), rgba(6, 6, 6, 0.99));
  border: 1px solid rgba(255, 231, 194, 0.1);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

.fortune-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.muyu-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.muyu-header h2 {
  color: #fff;
}

.fortune-intro-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.muyu-intro-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fortune-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(46, 111, 64, 0.16);
  background: #fff;
  color: var(--brand-2);
  text-decoration: none;
  flex-shrink: 0;
}

.muyu-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 235, 206, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.fortune-back svg {
  width: 18px;
  height: 18px;
}

.muyu-back svg {
  width: 18px;
  height: 18px;
}

.muyu-subtitle {
  color: rgba(255, 255, 255, 0.84);
}

.fortune-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0 18px;
}

.muyu-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 22px;
  position: relative;
}

.muyu-meritboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-bottom: 8px;
}

.muyu-meritboard strong {
  display: block;
  font-size: clamp(92px, 18vw, 180px);
  line-height: 0.92;
  color: #fff;
  font-weight: 300;
  letter-spacing: -0.04em;
}

.muyu-meritboard span {
  display: block;
  color: rgba(255, 255, 255, 0.24);
  font-size: clamp(42px, 7vw, 78px);
  line-height: 1;
  font-weight: 700;
}

.fortune-bucket {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.fortune-bucket__sticks {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 72px;
}

.fortune-bucket__sticks i {
  display: block;
  width: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f7d18b, #d7a85d);
}

.fortune-bucket__sticks i:nth-child(1) { height: 54px; }
.fortune-bucket__sticks i:nth-child(2) { height: 66px; }
.fortune-bucket__sticks i:nth-child(3) { height: 72px; }
.fortune-bucket__sticks i:nth-child(4) { height: 62px; }
.fortune-bucket__sticks i:nth-child(5) { height: 58px; }

.fortune-bucket__body {
  width: 108px;
  height: 92px;
  border-radius: 24px 24px 30px 30px;
  background: linear-gradient(180deg, #bb3b3f, #8f1d27);
  box-shadow: inset 0 -10px 20px rgba(0, 0, 0, 0.16);
  margin-top: -18px;
}

.fortune-bucket__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.fortune-bucket.is-shaking {
  animation: fortune-shake 1.1s ease-in-out;
}

@keyframes fortune-shake {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-8deg); }
  30% { transform: rotate(7deg); }
  45% { transform: rotate(-6deg); }
  60% { transform: rotate(5deg); }
  75% { transform: rotate(-3deg); }
}

.fortune-hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.muyu-wood {
  position: relative;
  width: min(400px, 80vw);
  min-height: 300px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.muyu-impact-ripple,
.muyu-impact-spark {
  position: absolute;
  pointer-events: none;
  opacity: 0;
}

.muyu-impact-ripple {
  width: 180px;
  height: 180px;
  border-radius: 999px;
  border: 2px solid rgba(255, 209, 144, 0.42);
  box-shadow: 0 0 0 8px rgba(255, 209, 144, 0.06);
}

.muyu-impact-ripple--late {
  width: 220px;
  height: 220px;
}

.muyu-impact-spark {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 234, 183, 0.95) 0%, rgba(255, 234, 183, 0.18) 38%, transparent 70%);
  filter: blur(0.5px);
}

.muyu-wood__body {
  position: relative;
  width: min(188px, 42vw);
  display: grid;
  place-items: center;
  margin-top: 42px;
}

.muyu-wood__image {
  width: 100%;
  height: auto;
  display: block;
  filter:
    drop-shadow(0 14px 22px rgba(0, 0, 0, 0.45))
    saturate(1.03)
    brightness(0.98);
}

.muyu-wood__image[src=""],
.muyu-mallet__image[src=""] {
  visibility: hidden;
}

.muyu-mallet {
  position: absolute;
  right: 46px;
  top: 56px;
  width: min(129px, 25.2vw);
  transform: rotate(22deg);
  transform-origin: 82% 60%;
  pointer-events: none;
  z-index: 2;
}

.muyu-mallet__image {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.38));
}

.muyu-wood__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  color: rgba(255, 243, 222, 0.9);
  font-size: 14px;
  font-weight: 700;
}

.muyu-blessing-text {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translate(-50%, 20px) scale(0.92);
  color: #f7d480;
  font-size: clamp(16px, 3.2vw, 22px);
  font-weight: 800;
  white-space: nowrap;
  text-shadow: 0 8px 20px rgba(247, 212, 128, 0.22);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}

.muyu-blessing-text.is-active {
  animation: muyu-blessing-rise 1.15s ease-out forwards;
}

.muyu-wood.is-striking .muyu-wood__body {
  transform: scale(0.97);
}

.muyu-wood.is-striking .muyu-mallet {
  transform: rotate(8deg) translate(-12px, 20px);
}

.muyu-wood.is-striking .muyu-impact-ripple {
  animation: muyu-ripple 0.55s ease-out;
}

.muyu-wood.is-striking .muyu-impact-ripple--late {
  animation: muyu-ripple 0.55s ease-out 0.08s;
}

.muyu-wood.is-striking .muyu-impact-spark {
  animation: muyu-spark 0.35s ease-out;
}

.muyu-hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  text-align: center;
}

.muyu-controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
  align-items: stretch;
}

.muyu-stat-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 227, 184, 0.12);
  border-radius: 22px;
  padding: 18px;
  backdrop-filter: blur(10px);
}

.muyu-control-item,
.muyu-control-btn {
  min-width: 0;
}

.muyu-stat-card span {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
  margin-bottom: 10px;
}

.muyu-stat-card strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  color: #fff;
}

.muyu-control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 206, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.muyu-control-btn.active {
  background: rgba(217, 162, 95, 0.2);
  border-color: rgba(255, 221, 167, 0.38);
  color: #fff5e8;
}

@keyframes muyu-ripple {
  0% {
    opacity: 0.95;
    transform: scale(0.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.3);
  }
}

@keyframes muyu-spark {
  0% {
    opacity: 0.9;
    transform: scale(0.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

@keyframes muyu-blessing-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 24px) scale(0.92);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, 6px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -26px) scale(1.04);
  }
}

  cursor: pointer;
}

.fortune-result {
  border: 1px solid rgba(46, 111, 64, 0.1);
  background: linear-gradient(180deg, rgba(248, 251, 246, 0.92), rgba(255, 255, 255, 0.98));
  border-radius: 22px;
  padding: 18px;
}

.fortune-result__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.fortune-grade,
.fortune-wealth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.fortune-grade {
  background: rgba(143, 29, 39, 0.12);
  color: #8f1d27;
}

.fortune-wealth {
  background: rgba(46, 111, 64, 0.12);
  color: var(--brand-2);
}

.fortune-result h3 {
  margin: 0 0 10px;
  font-size: 24px;
}

.fortune-summary {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.7;
}

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

.fortune-card,
.fortune-advice {
  border-radius: 18px;
  background: #f6faf5;
  border: 1px solid rgba(46, 111, 64, 0.08);
  padding: 14px;
}

.fortune-card span,
.fortune-advice span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.fortune-card strong {
  line-height: 1.5;
}

.fortune-advice p {
  margin: 0;
  line-height: 1.7;
}

.fortune-retry {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(46, 111, 64, 0.16);
  background: #fff;
  color: var(--brand-2);
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.minesweeper-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 14px;
}

.minesweeper-toolbar,
.minesweeper-difficulties {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.minesweeper-toolbar {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.minesweeper-difficulties button.active {
  background: var(--brand);
  color: #fff;
}

.minesweeper-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.minesweeper-stat {
  padding: 14px;
  border-radius: 18px;
  background: #f6faf5;
  border: 1px solid rgba(46, 111, 64, 0.08);
}

.minesweeper-stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.minesweeper-stat strong {
  font-size: 24px;
}

.minesweeper-board-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 8px;
}

.minesweeper-board {
  --cell-size: 32px;
  display: grid;
  gap: 4px;
  justify-content: center;
  min-width: max-content;
  width: 100%;
}

.mine-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  border: 1px solid rgba(46, 111, 64, 0.18);
  border-radius: 10px;
  background: linear-gradient(180deg, #fefefe, #eef5ed);
  color: var(--brand-2);
  font: inherit;
  font-size: clamp(10px, calc(var(--cell-size) * 0.52), 15px);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.mine-cell.is-revealed {
  background: #ffffff;
  border-color: rgba(46, 111, 64, 0.12);
}

.mine-cell.is-flagged {
  color: transparent;
}

.mine-cell.is-flagged::before {
  content: "";
  position: absolute;
  left: calc(var(--cell-size) * 0.48);
  top: calc(var(--cell-size) * 0.24);
  width: max(1px, calc(var(--cell-size) * 0.08));
  height: calc(var(--cell-size) * 0.46);
  background: #37453a;
  border-radius: 999px;
  transform: translateX(-50%);
}

.mine-cell.is-flagged::after {
  content: "";
  position: absolute;
  left: calc(var(--cell-size) * 0.48);
  top: calc(var(--cell-size) * 0.2);
  width: calc(var(--cell-size) * 0.26);
  height: calc(var(--cell-size) * 0.2);
  background: linear-gradient(135deg, #ff6b7b, #d9485f);
  clip-path: polygon(0 0, 100% 28%, 0 100%);
  border-radius: 2px;
}

.mine-cell.is-mine {
  background: #ffe7e9;
  border-color: rgba(217, 72, 95, 0.24);
  font-size: clamp(10px, calc(var(--cell-size) * 0.46), 14px);
}

.minesweeper-help {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 720px) {
  .games-page,
  .minesweeper-page,
  .fortune-page,
  .muyu-page {
    padding: 10px 0 22px;
  }

  .games-hero-card,
  .game-card,
  .minesweeper-shell,
  .fortune-shell,
  .muyu-shell {
    border-radius: 18px;
  }

  .games-hero-card,
  .minesweeper-shell,
  .fortune-shell,
  .muyu-shell,
  .game-card {
    padding: 16px;
  }

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

  .game-card {
    align-items: stretch;
    gap: 12px;
  }

  .game-card__icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
    border-radius: 14px;
  }

  .game-card h3 {
    font-size: 20px;
    margin-bottom: 6px;
  }

  .game-card p {
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .game-card__meta {
    gap: 6px;
    margin-top: 10px;
  }

  .game-card__meta li {
    padding: 5px 8px;
    font-size: 12px;
  }

  .game-card__actions {
    width: 100%;
  }

  .game-card__play {
    width: 100%;
    min-width: 0;
  }

  .minesweeper-header,
  .minesweeper-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .minesweeper-header h2 {
    display: none;
  }

  .minesweeper-subtitle {
    font-size: 0.9rem;
    line-height: 1.35;
    letter-spacing: -0.01em;
  }

  .minesweeper-back,
  .muyu-back {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 10px;
  }

  .minesweeper-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .fortune-page .container,
  .muyu-page .container {
    max-width: 420px;
    margin: 0 auto;
    padding: 0 12px;
  }

  .fortune-shell,
  .muyu-shell {
    width: 100%;
    margin: 0 auto;
  }

  .fortune-header h2,
  .muyu-header h2 {
    display: none;
  }

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

  .fortune-intro-row,
  .muyu-intro-row,
  .minesweeper-intro-row {
    gap: 8px;
    align-items: center;
  }

  .fortune-subtitle,
  .muyu-subtitle {
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .fortune-bucket__sticks {
    height: 62px;
  }

  .fortune-bucket__body {
    width: 92px;
    height: 82px;
  }

  .fortune-result__top {
    flex-direction: column;
    align-items: flex-start;
  }

  .muyu-wood {
    width: min(300px, 84vw);
    min-height: 258px;
  }

  .muyu-wood__body {
    width: min(154px, 43.4vw);
    margin-top: 34px;
  }

  .muyu-mallet {
    right: 34px;
    top: 70px;
    width: min(90px, 21.7vw);
    transform: rotate(20deg);
  }

  .muyu-meritboard strong {
    font-size: clamp(74px, 24vw, 120px);
  }

  .muyu-meritboard span {
    font-size: clamp(28px, 8vw, 52px);
  }

  .muyu-blessing-text {
    top: 4px;
    font-size: 14px;
  }

  .muyu-stat-card {
    padding: 14px;
  }

  .muyu-stat-card strong {
    font-size: 34px;
  }

  .muyu-controls-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  .muyu-stat-card,
  .muyu-control-btn {
    border-radius: 16px;
    min-height: 72px;
    padding: 10px 8px;
  }

  .muyu-stat-card span {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .muyu-stat-card strong {
    font-size: 24px;
  }

  .muyu-control-btn {
    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;
    text-align: center;
    padding: 10px 6px;
  }

  .minesweeper-difficulties {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(48px, auto);
  }

  .minesweeper-subtitle {
    font-size: 0.72rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .minesweeper-back {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    border-radius: 9px;
  }

  .minesweeper-back svg {
    width: 15px;
    height: 15px;
  }

  .minesweeper-toolbar {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .minesweeper-difficulties {
    gap: 6px;
    align-items: stretch;
    width: max-content;
  }

  .minesweeper-difficulties button {
    min-width: 0;
    padding: 0 10px;
    font-size: 0.82rem;
    min-height: 38px;
    white-space: nowrap;
  }
}

@media (max-width: 360px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
}
