/* main.css - 选歌页样式（明黄波普漫画风 × VOCALOID 三色） */

:root {
  --ink: #1d1d1d;          /* 墨色描边 */
  --paper: #ffffff;        /* 卡片白 */
  --stage: #FFD93D;        /* 明黄底 */
  --accent-red: #F0605A;   /* Teto 红 */
  --accent-yellow: #FFD93D;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--stage);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100vh;
  height: 100svh;
  padding:
    max(12px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  /* 半调网点 */
  background-image: radial-gradient(rgba(0, 0, 0, 0.07) 1.6px, transparent 1.6px);
  background-size: 18px 18px;
  overflow: hidden;
}

/* 装饰元素（songs.html 中的静态装饰） */
.deco {
  position: absolute;
  pointer-events: none;
  color: #fff;
  text-shadow: 2px 2px 0 var(--ink);
  z-index: 0;
}

.deco.star-a { top: 22px; left: 44px; font-size: 34px; transform: rotate(-12deg); }
.deco.star-b { top: 58px; right: 54px; font-size: 22px; transform: rotate(16deg); }
.deco.star-c { bottom: 54px; left: 118px; font-size: 18px; transform: rotate(6deg); }

.deco.star-a, .deco.star-b, .deco.star-c { color: #fff; }

.deco.burst {
  top: -50px;
  right: -70px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.35) 0deg 6deg, transparent 6deg 18deg);
  text-shadow: none;
}

/* 标题区 */
.title-area {
  position: relative;
  z-index: 1;
  text-align: center;
  padding-top: clamp(6px, 3vh, 24px);
}

.game-title {
  display: inline-block;
  font-size: clamp(30px, 6.5vw, 46px);
  font-weight: 900;
  color: #fff;
  letter-spacing: 4px;
  transform: rotate(-3deg);
  /* 白填充 + 黑描边 + Teto 红错位影 */
  text-shadow:
    -3px -3px 0 var(--ink), 3px -3px 0 var(--ink),
    -3px 3px 0 var(--ink), 3px 3px 0 var(--ink),
    -3px 0 0 var(--ink), 3px 0 0 var(--ink),
    0 -3px 0 var(--ink), 0 3px 0 var(--ink),
    6px 6px 0 var(--accent-red);
}

.game-subtitle {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 16px;
  background: var(--ink);
  color: var(--accent-yellow);
  font-size: clamp(10px, 1.6vw, 12px);
  font-weight: 900;
  letter-spacing: 6px;
  transform: rotate(-1deg);
}

/* 选歌区 */
.song-select {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.song-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vw, 30px);
  padding: 10px;
}

/* 歌曲卡片（紧凑） */
.song-card {
  position: relative;
  width: clamp(140px, 20vw, 160px);
  height: clamp(158px, 24vw, 176px);
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 6px 6px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.song-item:nth-child(1) .song-card { transform: rotate(-3deg); }
.song-item:nth-child(2) .song-card { transform: rotate(2deg); }
.song-item:nth-child(3) .song-card { transform: rotate(-1.5deg); }

.song-card.available:hover,
.song-card.available:focus-visible {
  transform: rotate(-1deg) translate(-3px, -3px);
  box-shadow: 10px 10px 0 var(--ink);
  outline: none;
}

.song-card.available:active {
  transform: rotate(-1deg) translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--ink);
}

/* 主题色头图区：平涂 + 网点 */
.card-head {
  width: 100%;
  height: 88px;
  flex-shrink: 0;
  background: var(--card-theme, #39C5BB);
  background-image: radial-gradient(rgba(255, 255, 255, 0.35) 1.5px, transparent 1.5px);
  background-size: 12px 12px;
  border-bottom: 4px solid var(--ink);
  display: grid;
  place-items: center;
  font-size: 42px;
  position: relative;
}

.card-head .mini-star {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 14px;
  color: var(--accent-yellow);
  text-shadow: 1.5px 1.5px 0 var(--ink);
}

.card-title {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: 1px;
  text-align: center;
}

.card-artist {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 800;
  color: #777;
  text-align: center;
}

/* 锁定卡 */
.song-card.locked {
  cursor: default;
}

.song-card.locked .card-head {
  background: #b9b2a4;
  background-image: radial-gradient(rgba(255, 255, 255, 0.3) 1.5px, transparent 1.5px);
  background-size: 12px 12px;
}

.song-card.locked .card-title,
.song-card.locked .card-artist {
  color: #9a927f;
}

.lock-banner {
  position: absolute;
  top: 34px;
  left: 50%;
  transform: translateX(-50%) rotate(-6deg);
  background: var(--accent-red);
  color: #fff;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  border-radius: 6px;
  padding: 3px 14px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  white-space: nowrap;
}

/* 底部提示 */
.footer-hint {
  position: relative;
  z-index: 1;
  padding-bottom: clamp(4px, 2vh, 14px);
  text-align: center;
}

.footer-hint p {
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 18px;
}

/* 矮屏横屏（手机横置高度不足） */
@media (max-height: 520px) {
  .game-title {
    font-size: clamp(26px, 5.5vw, 36px);
  }

  .title-area {
    padding-top: 4px;
  }

  .song-card {
    width: clamp(128px, 18vw, 148px);
    height: clamp(136px, 40vh, 158px);
  }

  .card-head {
    height: 70px;
    font-size: 34px;
  }

  .card-title {
    margin-top: 8px;
    font-size: 16px;
  }
}

/* 竖屏：卡片纵向排列，可滚动 */
@media (orientation: portrait) {
  html, body {
    overflow-y: auto;
  }

  #app {
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }

  .song-cards {
    flex-direction: column;
    gap: 20px;
    padding: 20px 10px;
  }

  .song-card {
    width: min(70vw, 220px);
    height: 190px;
  }

  .card-head {
    height: 96px;
  }
}

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

/* ===== 搜索框 ===== */
.search-bar {
  position: relative;
  z-index: 1;
  margin-top: clamp(8px, 2vh, 16px);
}

.search-bar input {
  width: clamp(240px, 42vw, 320px);
  height: 44px;
  padding: 0 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--ink);
  outline: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.search-bar input::placeholder {
  color: #9a927f;
  font-weight: 700;
}

.search-bar input:focus {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

/* ===== 歌曲条目（卡片 + 下方按钮条） ===== */
.song-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* UP主名 */
.card-up {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 800;
  color: #b0a893;
  text-align: center;
}

.song-card.locked .card-up {
  color: #b7b0a0;
}

/* ===== 点赞 / 收藏按钮 ===== */
.card-marks {
  display: flex;
  gap: 14px;
}

.mark-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: #b0a893;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.1s ease, color 0.1s ease;
}

.mark-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.mark-btn.mark-like.on {
  color: var(--accent-red);
}

.mark-btn.mark-fav.on {
  color: #ffb800;
}

/* 矮屏横屏：压缩按钮条间距 */
@media (max-height: 520px) {
  .song-item {
    gap: 6px;
  }

  .search-bar {
    margin-top: 4px;
  }

  .search-bar input {
    height: 38px;
  }
}
