/* Home */
/* 6. Home */
/* ========= Home appbar ========= */
.search-controls{
  box-shadow: none !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  padding:
    10px var(--page-pad-x)
    10px var(--page-pad-x);
  padding-top: calc(var(--tg-top, 0px) + 10px);
}

.home-appbar{
  position: relative;
  display:grid;
  grid-template-columns: 44px 1fr 44px;
  align-items:center;
  gap: 0;
  min-height: 44px;
}

.home-heading{
  font-weight: 900;
  font-size: 26px;
  line-height: 1.05;
  margin: 10px 2px 10px;
}

.home-intro{
  padding: 12px 12px 0;
}

.home-intro--spacer{
  min-height: 22px;
}

.home-heading--spacer{
  min-height: 28px;
}

.home-heading--recent{
  margin-top: 16px;
  margin-bottom: 6px;
}

.home-section--recent{
  margin-top: 14px;
}

.home-intro-sub{
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
  color: var(--tg-hint-color);
  opacity: .95;
}

.home-appbar-right{
  display: contents;
  pointer-events: auto;
}

.home-appbar-left{
  display:flex;
  align-items:center;
  min-width: 36px;
  grid-column: 1;
  justify-self: start;
}

.home-search-icon{
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  color: inherit;
  flex: 0 0 auto;
}

.home-search-icon svg{
  width: 22px;
  height: 22px;
  display: block;
  fill: var(--text-color);
  opacity: 0.85;
}

.home-search-icon:active{
  opacity: 1;
  background: transparent;
}

.account-btn{
  appearance: none;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: grid;
  place-items: center;
  padding: 0;
  flex: 0 0 auto;
  border-radius: 999px;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.account-btn:focus,
.account-btn:focus-visible,
.account-btn:active{
  outline: none;
  box-shadow: none;
  background: transparent;
}

.account-btn img{
  width:36px;
  height:36px;
  border-radius:50%;
  object-fit:cover;
  display:block;
}

#account-avatar-fallback{
  width:36px;
  height:36px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  font-weight:700;
}

button,
a,
[role="button"],
.home-card,
.search-item,
.mg-history-item,
.mg-thumb-card,
.playlist-page-card,
.track-more,
.track-action-btn,
.po-btn,
.search-action,
.search-sheet-voice,
.home-search-icon,
.account-btn,
.account-share-btn {
  -webkit-tap-highlight-color: transparent;
}

button:focus,
button:focus-visible,
a:focus,
a:focus-visible,
[role="button"]:focus,
[role="button"]:focus-visible {
  outline: none;
  box-shadow: none;
}


/* ========= Home grid cards ========= */
.home-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.home-card{
  position: relative;
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 14px;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.home-card-cover{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-card-overlay{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 8px 7px;
  background: linear-gradient(to top, rgba(0,0,0,.70), rgba(0,0,0,0));
}

.home-card-more{
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  z-index: 2;
}
.home-card-more svg{
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.home-card-more:active{
  background: transparent;
}

.home-card-title{
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ========= Playlist card on home ========= */
.home-card--playlist{
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(48,230,220,.22) 0%, transparent 55%),
    radial-gradient(120% 140% at 100% 100%, rgba(139,92,246,.20) 0%, transparent 58%),
    linear-gradient(135deg,
      color-mix(in srgb, var(--bg-color) 86%, var(--brand-blue) 14%) 0%,
      color-mix(in srgb, var(--bg-color) 88%, var(--brand-purple) 12%) 100%);
  border: 1px solid color-mix(in srgb, var(--text-color) 10%, transparent);
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
}

.home-card--playlist:active{
  transform: none;
}

.home-playlist-bg{
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.home-playlist-bg img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.home-playlist-bg::after{
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.12) 0%, rgba(0,0,0,.46) 100%);
}

.home-playlist-card{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 14px 12px;
  gap: 4px;
  text-align: left;
}

.home-playlist-icon{
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  background: transparent;
  box-shadow: none;
  z-index: 2;
}
.home-playlist-icon svg{
  width: 18px;
  height: 18px;
}

.home-playlist-title{
  font-size: 13px;
  line-height: 1.1;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  position: relative;
  z-index: 2;
}

.home-playlist-sub{
  font-size: 12px;
  line-height: 1.15;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  position: relative;
  z-index: 2;
}

/* === First-run === */
.first-run {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 0 18px;
}

.first-run-welcome {
  background: var(--tg-secondary-bg-color, rgba(255,255,255,.88));
  border-radius: 24px;
  padding: 18px 18px 16px;
  border: 1px solid color-mix(in srgb, var(--text-color) 8%, transparent);
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}

.first-run-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--brand-cyan) 24%, transparent) 0%,
    color-mix(in srgb, var(--brand-blue) 18%, transparent) 100%
  );
}

.first-run-badge img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.first-run-title {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--text-color);
  margin-bottom: 8px;
}

.first-run-text {
  font-size: 15px;
  line-height: 1.4;
  color: var(--tg-hint-color, #8e8e93);
}

.first-run-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.first-run-btn {
  appearance: none;
  border: 0;
  border-radius: 16px;
  min-height: 46px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.first-run-btn--primary {
  background: var(--accent-grad);
  color: var(--accent-text, #fff);
  flex: 1;
}

.first-run-btn--secondary {
  background: var(--tg-secondary-bg-color, rgba(255,255,255,.88));
  color: var(--text-color);
  border: 1px solid color-mix(in srgb, var(--text-color) 8%, transparent);
}

.first-run-btn:active {
  transform: scale(.985);
}

.first-run-section-title {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--tg-hint-color, #8e8e93);
  padding: 0 8px 2px;
}

body.dark .first-run-welcome {
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
}
