/* 作者：余纪柱，辅助编辑：柱子AI */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f9f9f7;
  --text: #1a1a1a;
  --muted: #888;
  --accent: #2563eb;
  --border: #e5e5e5;
}

html {
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4rem 2rem 2rem;
  padding: max(4rem, env(safe-area-inset-top)) max(2rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(2rem, env(safe-area-inset-left));
  max-width: 100vw;
  overflow-x: hidden;
}

main {
  max-width: 560px;
  width: 100%;
  min-width: 0;
}

/* intro */
.intro {
  margin-bottom: 3rem;
}

.intro h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.intro .tagline {
  color: var(--muted);
  margin-top: 0.25rem;
  font-size: 1rem;
}

/* sections */
section + section {
  margin-top: 2rem;
}

h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

ul {
  list-style: none;
}

/* 作品分栏 */
.works-tab-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.works-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.works-tabs label {
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.35rem 0;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.works-tabs label:hover {
  color: var(--text);
}

#works-games:checked ~ .works-tabs label[for="works-games"],
#works-sites:checked ~ .works-tabs label[for="works-sites"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.works-panels {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: clip;
  transition: height 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.works-panels.works-panels--instant {
  transition: none;
}

.works-panel {
  display: none;
  width: 100%;
  min-width: 0;
}

#works-games:checked ~ .works-panels .works-panel-games,
#works-sites:checked ~ .works-panels .works-panel-sites {
  display: block;
}

.sites li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.sites li:first-child {
  border-top: 1px solid var(--border);
}

.sites span:last-child {
  color: var(--muted);
  font-size: 0.875rem;
}

/* contact */
.contact a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.contact a:hover {
  color: var(--accent);
}

.site-footer {
  text-align: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 560px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

@media (max-width: 480px) {
  body {
    align-items: stretch;
    padding: max(2.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }

  main {
    max-width: none;
  }

  .intro {
    margin-bottom: 2rem;
  }

  .intro h1 {
    font-size: 1.75rem;
  }

  section + section {
    margin-top: 1.75rem;
  }

  .sites li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .sites span:last-child {
    font-size: 0.8125rem;
  }

  .site-footer {
    max-width: none;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 11px;
  }
}

/* 动漫 */
.anime li {
  padding: 0.4rem 0;
  color: var(--text);
  font-size: 0.9rem;
}

/* 无链接作品名 */
.project-name {
  color: var(--text);
  font-weight: 500;
}

/* 游戏轮播 */
.game-carousel {
  width: 100%;
  min-width: 0;
}

.game-carousel-loading {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 2rem 0;
  text-align: center;
}

.game-carousel-shell {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  width: 100%;
  min-width: 0;
}

.game-switcher {
  padding: 0.85rem 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: #fafaf8;
}

.game-switcher-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-switch-btn,
.shot-switch-btn {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}

.game-switch-btn:hover:not(:disabled),
.shot-switch-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.game-switch-btn:disabled,
.shot-switch-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.game-switch-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.game-switch-icon[hidden] {
  display: none;
}

.game-switch-meta {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  text-align: center;
}

.game-switch-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-switch-count {
  margin-top: 0.1rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.game-switch-stores {
  margin-top: 0.45rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  min-height: 1.25rem;
}

.game-switch-stores[hidden] {
  display: none;
}

.game-switch-stores a {
  color: var(--muted);
  text-decoration: none;
}

.game-switch-stores a:hover {
  color: var(--accent);
}

.game-carousel-viewport {
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

.game-carousel-track {
  display: flex;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.game-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  padding: 0.85rem 0.85rem 1rem;
}

.shot-carousel {
  position: relative;
}

.shot-carousel-empty {
  margin-bottom: 0;
}

.shot-placeholder {
  height: 220px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: #f5f5f3;
  color: var(--muted);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shot-viewport {
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f3f3f1;
  width: 100%;
  min-width: 0;
  touch-action: pan-y;
  cursor: pointer;
  user-select: none;
}

.shot-track {
  display: flex;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.shot-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: 320px;
}

.shot-slide img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.shot-slide.is-icon img {
  width: auto;
  max-width: 120px;
  max-height: 120px;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.shot-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.shot-footer-dots {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.shot-footer-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.shot-label {
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.shot-dots {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.shot-dot {
  width: 6px;
  height: 6px;
  border: none;
  border-radius: 999px;
  padding: 0;
  background: #d4d4d4;
  cursor: pointer;
  transition: width 0.2s, background 0.2s;
}

@media (hover: hover) and (pointer: fine) {
  .shot-viewport:hover {
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
  }

  .shot-dot:hover {
    background: #a3a3a3;
  }
}

.shot-dot.is-active {
  width: 18px;
  background: var(--accent);
}

@media (max-width: 480px) {
  .game-switcher-row {
    gap: 0.35rem;
  }

  .game-switch-btn,
  .shot-switch-btn {
    font-size: 0.6875rem;
    padding: 0.45rem 0.5rem;
    min-height: 2.5rem;
  }

  .game-switch-icon {
    width: 40px;
    height: 40px;
  }

  .game-switch-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    max-width: 100%;
  }

  .game-switch-stores {
    font-size: 0.75rem;
    padding: 0 0.25rem;
  }

  .game-slide {
    padding: 0.75rem 0.65rem 0.9rem;
  }

  .shot-slide {
    min-height: 180px;
    max-height: 52vw;
  }

  .shot-slide img {
    max-height: 52vw;
  }

  .shot-placeholder {
    height: 180px;
  }

  .shot-dot {
    width: 8px;
    height: 8px;
  }

  .shot-dot.is-active {
    width: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .works-panels {
    transition: none;
  }

  .game-carousel-track,
  .shot-track {
    transition: none;
  }
}
