body.has-modal { overflow: hidden; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 8, 10, .42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: overlay-in .2s ease both;
}
.modal-overlay.is-leaving { animation: overlay-out .16s ease both; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlay-out { to { opacity: 0; } }

/* 复刻游戏内表情菜单：半透明灰面板、顶部 Z/C 页签、分区横线、底部按键提示 */
.emote-panel {
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  height: min(780px, calc(100vh - 32px));
  overflow: hidden;
  border-radius: 26px;
  background:
    linear-gradient(115deg, transparent 30%, rgba(255, 250, 235, .06) 45%, transparent 60%),
    linear-gradient(180deg, rgba(74, 82, 82, .78), rgba(46, 54, 55, .84));
  box-shadow: inset 0 0 0 1px rgba(255, 244, 220, .12), 0 30px 80px rgba(0, 0, 0, .5);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  outline: none;
  animation: panel-in .26s var(--ease-spring) both;
}
@keyframes panel-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

.ep-tabs {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 14px 0;
  box-shadow: inset 0 -2px 0 rgba(255, 244, 220, .5);
}
.ep-tabs__key { align-self: center; padding: 4px; border: 0; background: transparent; }
.ep-tabs__key:active { transform: scale(.9); }
.ep-tabs__list { display: flex; gap: clamp(18px, 7vw, 40px); }
.ep-tab {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 4px 4px 0 0;
  background: transparent;
}
.ep-tab img { width: 40px; height: 40px; object-fit: contain; opacity: .7; transition: opacity .2s; }
.ep-tab:hover img { opacity: 1; }
.ep-tab.is-active { background: linear-gradient(180deg, rgba(255, 244, 220, .04), rgba(255, 244, 220, .18)); }
.ep-tab.is-active img { opacity: 1; }
.ep-tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--cream); }
.ep-tab:focus-visible { outline: 2px solid var(--cream); outline-offset: -2px; }

.ep-body { flex: 1; overflow-y: auto; padding: 18px 24px 22px; overscroll-behavior: contain; }
.ep-gap { height: 22px; }
.ep-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.ep-cell { width: 100%; }
.ep-cell > img { width: 70%; height: 70%; }

.ep-grid--dye { row-gap: 30px; padding-top: 8px; }
.ep-dye { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ep-dye__count {
  position: absolute;
  right: 4px;
  top: -20px;
  color: var(--cream);
  font-size: 13px;
  white-space: nowrap;
}
.ep-dye__name { color: var(--cream-faint); font-size: 11px; }

.ep-empty { padding: 26px 0; color: var(--cream-faint); text-align: center; }

.ep-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  min-height: 54px;
  padding: 0 22px;
  box-shadow: inset 0 2px 0 rgba(255, 244, 220, .5);
}
.ep-foot__item { display: inline-flex; align-items: center; gap: 6px; color: var(--cream); font-size: 14px; }
.ep-foot__item .kbd + .kbd { margin-left: -2px; }
.ep-foot__close { padding: 4px 6px; border: 0; border-radius: 10px; background: transparent; }
.ep-foot__close:hover { background: rgba(255, 244, 220, .1); }

@media (max-width: 480px) {
  .emote-panel { height: calc(100vh - 24px); border-radius: 22px; }
  .ep-body { padding: 12px 16px 18px; }
  .ep-grid { gap: 12px; }
  .ep-tabs { padding: 8px 10px 0; }
  .ep-tabs__list { gap: clamp(10px, 5vw, 24px); }
  .ep-tab { width: 52px; height: 50px; }
  .ep-tab img { width: 34px; height: 34px; }
  .ep-foot { padding: 0 14px; gap: 14px; min-height: 50px; }
  .ep-foot__item { font-size: 13px; }
}

@media (max-width: 400px) {
  .modal-overlay { padding: 8px; }
  .emote-panel { height: calc(100vh - 16px); }
  .ep-body { padding: 10px 12px 14px; }
  .ep-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .ep-tab { width: 46px; height: 46px; }
  .ep-tab img { width: 30px; height: 30px; }
  .ep-dye__count { font-size: 12px; }
}
