.discover-category-plus {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  color: #6c4cf1;
  background: transparent;
  font: 300 32px/44px -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.discover-category-page {
  min-height: 100dvh;
  padding: 0 14px calc(96px + env(safe-area-inset-bottom));
  color: #28232d;
  background: #fbf8f5;
}

.discover-category-head {
  height: 56px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin: 0 -14px;
  padding: 0 14px;
  border-bottom: 1px solid #eee6df;
  background: #fff;
}

.discover-category-head button {
  width: 44px;
  height: 44px;
  padding: 0 8px 4px 0;
  border: 0;
  color: #28232d;
  background: transparent;
  font: 300 38px/1 sans-serif;
}

.discover-category-head h1 {
  margin: 0;
  text-align: center;
  font-size: 19px;
  font-weight: 650;
}

.discover-category-anchors {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -14px 18px;
  padding: 16px 14px 9px;
  background: linear-gradient(#fbf8f5 80%, rgba(251,248,245,.88));
  scrollbar-width: none;
}

.discover-category-anchors::-webkit-scrollbar { display: none; }
.discover-category-anchors button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid #e7dfda;
  border-radius: 18px;
  color: #554e5c;
  background: #fff;
  font: inherit;
  font-size: 13px;
}
.discover-category-anchors button.active {
  border-color: #cfc2ff;
  color: #6d4aff;
  background: #f1edff;
  font-weight: 650;
}

.discover-category-group {
  scroll-margin-top: 66px;
  margin-bottom: 22px;
}
.discover-category-group > header {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 9px;
  margin: 0 2px 10px;
}
.discover-category-group h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 680;
}
.discover-category-group header span {
  color: #716978;
  font-size: 11px;
}
.discover-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.discover-category-tile,
.discover-ranking-tile {
  position: relative;
  min-width: 0;
  height: 82px;
  overflow: hidden;
  isolation: isolate;
  padding: 0;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #eee7e1, #d8cec6);
  box-shadow: 0 5px 16px rgba(55,39,29,.07);
}
.discover-category-tile::after,
.discover-ranking-tile::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 34% 0 0;
  background: linear-gradient(transparent, rgba(25,17,18,.78));
  opacity: 0;
  transition: opacity .2s ease;
}
.discover-category-tile img,
.discover-ranking-tile img {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .2s ease;
}
.discover-category-tile b,
.discover-ranking-tile b {
  position: absolute;
  right: 5px;
  bottom: 8px;
  left: 5px;
  overflow: hidden;
  color: #4d4139;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: none;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}
.discover-ranking-tile { height: 90px; }
.discover-ranking-tile { background: linear-gradient(145deg,#8e7bd3,#5d4c93); }
.discover-ranking-tile::after {
  inset: 0;
  background: linear-gradient(145deg, rgba(77,48,10,.02), rgba(24,13,19,.76));
}
.discover-ranking-tile b { left: 9px; text-align: left; }
.discover-ranking-tile b,
.discover-category-tile.image-loaded b { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.45); }
.discover-category-tile.image-loaded img,
.discover-ranking-tile.image-loaded img,
.discover-category-tile.image-loaded::after,
.discover-ranking-tile.image-loaded::after { opacity: 1; }
.discover-ranking-tile.is-unavailable { cursor: default; }
.discover-category-tile.image-unavailable {
  border: 1px solid #efe5da;
  background: linear-gradient(145deg, #fff8ef, #eee8e1);
  box-shadow: none;
}
.discover-category-tile.image-unavailable::after { display: none; }
.discover-category-tile.image-unavailable b { color: #4d4139; text-shadow: none; }
.discover-ranking-tile.image-unavailable {
  background: linear-gradient(145deg, #8e7bd3, #5d4c93);
}
.discover-ranking-icon {
  position: absolute;
  top: 7px;
  left: 8px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 1px 1px rgba(20,13,14,.82)) drop-shadow(0 2px 3px rgba(20,13,14,.32));
}
.discover-ranking-icon svg {
  width: 26px;
  height: 26px;
  overflow: visible;
  fill: none;
  stroke: rgba(255,255,255,.98);
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.discover-ranking-icon .rank-icon-body { fill: rgba(255,255,255,.18); stroke-width: 1.4; }
.discover-ranking-icon .rank-icon-fill { fill: rgba(255,255,255,.22); stroke-width: 1.15; }
.discover-category-tile.is-seasonal {
  border: 1px solid #efe5da;
  color: #4d4139;
  background: linear-gradient(145deg, #fff7e9, #f1ebdf);
  box-shadow: none;
}
.discover-category-tile.is-seasonal::after { display: none; }
.discover-category-tile.is-seasonal b { color: #4d4139; text-shadow: none; }
.discover-season-symbol {
  position: absolute;
  top: 9px;
  right: 0;
  left: 0;
  text-align: center;
  font-size: 30px;
  filter: drop-shadow(0 4px 6px rgba(72,47,27,.12));
}
.discover-category-placeholder {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.6), transparent 36%), linear-gradient(145deg,#d8cfc7,#b8aaa0);
}
.discover-category-status {
  margin: 4px 0 20px;
  color: #716978;
  text-align: center;
  font-size: 12px;
}
.discover-ranking-filter { color: #6d4aff !important; }

.discover-preference-backdrop {
  position: fixed;
  z-index: 220;
  inset: 0;
  display: flex;
  align-items: flex-end;
  background: rgba(37,29,35,.44);
}
.discover-preference-sheet {
  width: 100%;
  max-height: min(680px, 78dvh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: #fffdfb;
  box-shadow: 0 -20px 55px rgba(43,29,37,.18);
}
.discover-preference-grabber {
  width: 42px;
  height: 5px;
  flex: 0 0 auto;
  margin: 0 auto 14px;
  border-radius: 5px;
  background: #ded7dc;
}
.discover-preference-sheet > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.discover-preference-sheet h2 { margin: 0; font-size: 23px; }
.discover-preference-sheet header p { margin: 5px 0 0; color: #6e6772; font-size: 13px; }
.discover-preference-sheet header button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 50%;
  color: #6f6871;
  background: #f1edf2;
  font-size: 28px;
}
.discover-preference-note {
  margin: 15px 0 8px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #5e5170;
  background: #f5f0ff;
  font-size: 12px;
  line-height: 1.5;
}
.discover-preference-groups { flex: 1; min-height: 0; overflow-y: auto; }
.discover-preference-groups section { padding: 12px 0; border-bottom: 1px solid #f0ebe7; }
.discover-preference-groups h3 { margin: 0 0 10px; font-size: 14px; }
.discover-preference-groups section > div { display: flex; flex-wrap: wrap; gap: 9px; }
.discover-preference-groups button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #e5dfdb;
  border-radius: 12px;
  color: #4f4851;
  background: #fff;
  font: inherit;
  font-size: 13px;
}
.discover-preference-groups button.is-selected {
  border-color: #7457e8;
  color: #5635ca;
  background: #f1ecff;
  font-weight: 700;
}
.discover-preference-groups button.is-selected::before { content: "✓"; margin-right: 5px; }
.discover-preference-sheet > footer {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  padding-top: 14px;
}
.discover-preference-sheet > footer button {
  height: 48px;
  border: 0;
  border-radius: 14px;
  color: #443b41;
  background: #f1eeee;
  font: inherit;
  font-weight: 750;
}
.discover-preference-sheet > footer button:last-child { color: #fff; background: #6c4cf1; }
.discover-preference-sheet button:disabled { opacity: .5; }

@media (max-width: 360px) {
  .discover-category-page { padding-right: 12px; padding-left: 12px; }
  .discover-category-grid { gap: 7px; }
  .discover-category-group h2 { font-size: 16px; }
}
