/* ============================================================
 *  lang.css — 语言面板（自配语言 / 全球语言切换）
 *  前缀 htl- 避免与落地页既有样式冲突
 * ============================================================ */

/* 顶部语言按钮 */
.lang-btn {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform .15s ease, background .15s ease;
}
html[dir="rtl"] .lang-btn { right: auto; left: 14px; }
.lang-btn:hover { background: rgba(255, 255, 255, .24); }
.lang-btn:active { transform: scale(.96); }
.lang-btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.lang-btn__txt { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-btn__code { opacity: .78; font-size: 11px; font-weight: 500; text-transform: uppercase; }

/* 遮罩层 */
.htl {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Microsoft YaHei", sans-serif;
}
.htl.is-open { pointer-events: auto; visibility: visible; }
.htl__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 16, 26, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .22s ease;
}
.htl.is-open .htl__backdrop { opacity: 1; }

/* 面板 */
.htl__panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  border-radius: 22px 22px 0 0;
  background: #fff;
  color: #45313a;
  box-shadow: 0 -18px 50px rgba(70, 20, 40, .28);
  transform: translateY(102%);
  transition: transform .26s cubic-bezier(.22, .8, .28, 1);
}
.htl.is-open .htl__panel { transform: none; }

.htl__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 56px 10px;
  flex: 0 0 auto;
}
.htl__handle {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 38px;
  height: 4px;
  margin-left: -19px;
  border-radius: 999px;
  background: #ecd6df;
}
.htl__title { font-size: 16px; font-weight: 700; color: #7a3f57; }
.htl__close, .htl__back {
  position: absolute;
  top: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #fdeef4;
  color: #b8577c;
  cursor: pointer;
}
.htl__close { right: 12px; }
.htl__back { left: 12px; }
.htl__close:active, .htl__back:active { background: #fbdde8; }
.htl__close svg, .htl__back svg { width: 16px; height: 16px; }

.htl__body { overflow-y: auto; padding: 4px 16px 18px; -webkit-overflow-scrolling: touch; }
.htl__hint { margin: 2px 2px 12px; font-size: 12.5px; line-height: 1.6; color: #9b7f8b; }

/* 跟随系统 */
.htl__switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid #f3dfe7;
  border-radius: 14px;
  background: #fff7fa;
  font-size: 13.5px;
  color: #6c4b58;
  cursor: pointer;
}
.htl__switch input { position: absolute; opacity: 0; pointer-events: none; }
.htl__switch i {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #ecd6df;
  transition: background .18s ease;
  flex: 0 0 auto;
}
.htl__switch i::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  transition: transform .18s ease;
}
.htl__switch input:checked + i { background: #e64980; }
.htl__switch input:checked + i::after { transform: translateX(18px); }
.htl__switch span { flex: 1; }

/* 搜索 */
.htl__tools { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.htl__search {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #f0d9e2;
  border-radius: 12px;
  background: #fffafc;
  color: #45313a;
  font-size: 13.5px;
  outline: none;
}
.htl__search::placeholder { color: #c3a9b4; }
.htl__search:focus { border-color: #f0a6c0; background: #fff; }
.htl__count { font-size: 11.5px; color: #b499a4; white-space: nowrap; }

/* 语言列表 */
.htl__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
  padding: 2px;
}
.htl__chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 52px;
  padding: 8px 11px;
  border: 1px solid #f3e2e9;
  border-radius: 12px;
  background: #fff;
  color: #5c414d;
  text-align: start;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.htl__chip:active { transform: scale(.985); }
.htl__chip.is-active { border-color: #e64980; background: #fff2f7; box-shadow: 0 0 0 1px #e64980 inset; }
.htl__chip-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.htl__chip-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.htl__chip-code { font-size: 10.5px; letter-spacing: .04em; color: #b499a4; }
.htl__chip-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ffe3ee;
  color: #c14a75;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .02em;
}
.htl__empty { grid-column: 1/-1; padding: 18px 0; text-align: center; color: #bfa5b0; font-size: 13px; }

/* 按钮 */
.htl__actions { display: flex; gap: 8px; margin-top: 14px; }
.htl__btn {
  flex: 1;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #f0d9e2;
  border-radius: 12px;
  background: #fffafc;
  color: #8a4a64;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease;
}
.htl__btn:active { transform: scale(.985); background: #fdeef4; }
.htl__btn--primary { border-color: #e64980; background: #e64980; color: #fff; }
.htl__btn--primary:active { background: #d6336c; }
.htl__btn--danger { color: #c0344f; border-color: #f6cdd7; }
.htl__btn--sm { min-height: 36px; font-size: 12px; }

/* 导入导出 */
.htl__io { margin-top: 14px; }
.htl__io-row { display: flex; gap: 6px; flex-wrap: wrap; }
.htl__io-row .htl__btn { flex: 1 1 auto; min-width: 0; white-space: nowrap; }
.htl__io-text {
  width: 100%;
  min-height: 92px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #f0d9e2;
  border-radius: 12px;
  background: #fffafc;
  color: #6c4b58;
  font-family: ui-monospace, Consolas, Monaco, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
}

/* 编辑器 */
.htl__meta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.htl__row { display: flex; align-items: center; gap: 10px; }
.htl__row > span { flex: 0 0 76px; font-size: 12.5px; color: #9b7f8b; }
.htl__input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #f0d9e2;
  border-radius: 10px;
  background: #fffafc;
  color: #45313a;
  font-size: 13px;
  outline: none;
}
.htl__input:disabled { opacity: .55; }
.htl__list { display: flex; flex-direction: column; gap: 9px; }
.htl__item { display: flex; flex-direction: column; gap: 5px; }
.htl__key { font-family: ui-monospace, Consolas, Monaco, monospace; font-size: 10.5px; color: #b499a4; }
.htl__field {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #f0d9e2;
  border-radius: 10px;
  background: #fffafc;
  color: #4a3540;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.htl__field:focus { border-color: #f0a6c0; background: #fff; }

/* toast */
.htl__toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  z-index: 1000;
  max-width: 82vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(58, 30, 44, .92);
  color: #fff;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.htl__toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.htl__toast.is-err { background: rgba(176, 40, 66, .94); }

/* 桌面：居中卡片 */
@media (min-width: 640px) {
  .htl { align-items: center; }
  .htl__panel { border-radius: 22px; max-height: 82vh; transform: translateY(16px) scale(.98); opacity: 0; }
  .htl.is-open .htl__panel { transform: none; opacity: 1; }
  .htl__handle { display: none; }
  .htl__grid { max-height: 44vh; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
