/* 都聊 · 弹层样式（App 与 Web 共用，配合 js/ui.js 里的 sheet / multiSheet / confirmBox / promptBox / avatarPicker / openPanel）
 *
 * 只用两端都有的颜色变量，缺的用 fallback 补：
 *   App：--bg-2 --bg-3 --red --safe-bottom（app.css）
 *   Web：--card --hover --danger（web.css）
 * 窄屏（手机）：选择列表从底部弹出；宽屏（电脑）：一律居中。
 */

#layer {
  --dlg-surface: var(--card, var(--bg-2, #fff));
  --dlg-muted: var(--bg-3, var(--hover, #f4f4f6));
  --dlg-line: var(--line, #e6e6ea);
  --dlg-line-strong: var(--line-strong, #d9d9de);
  --dlg-danger: var(--red, var(--danger, #ff3b30));
  --dlg-safe-bottom: var(--safe-bottom, 0px);
}

/* 每个弹层一个 .layer，可以叠加；后打开的盖在上面 */
.layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.32);
  animation: dlg-fade 0.16s ease;
}

/* 叠在上面的弹层遮罩淡一点，避免越叠越黑 */
.layer + .layer {
  background: rgba(0, 0, 0, 0.18);
}

@media (min-width: 620px) {
  .layer {
    align-items: center;
    padding: 24px;
  }
}

@keyframes dlg-fade {
  from { opacity: 0; }
}

@keyframes dlg-up {
  from { transform: translateY(30px); opacity: 0.6; }
}

@keyframes dlg-pop {
  from { transform: scale(0.96); opacity: 0.5; }
}

/* ---------------------------------------------------------------- 选择列表 */

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--dlg-surface);
  color: var(--text);
  border-radius: 16px 16px 0 0;
  padding-bottom: var(--dlg-safe-bottom);
  animation: dlg-up 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@media (min-width: 620px) {
  .sheet {
    max-width: 420px;
    border-radius: 16px;
    padding-bottom: 0;
    box-shadow: 0 18px 60px rgba(20, 20, 30, 0.18);
  }
}

.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--dlg-line);
}

.sheet-head .sheet-title {
  font-size: 16px;
  font-weight: 600;
}

.sheet-head .text-btn {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
}

.sheet-body {
  overflow-y: auto;
  padding-bottom: 8px;
}

.sheet-list {
  display: flex;
  flex-direction: column;
}

.sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 15px 18px;
  text-align: left;
  font-size: 16px;
  color: var(--text);
  border-bottom: 0.5px solid var(--dlg-line);
}

.sheet-item:last-child {
  border-bottom: 0;
}

.sheet-item:active,
.sheet-item:hover {
  background: var(--dlg-muted);
}

.sheet-item.active {
  color: var(--accent);
  font-weight: 600;
}

.sheet-item.danger {
  color: var(--dlg-danger);
}

.sheet-item .sheet-sub {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-3);
}

.sheet-cancel {
  flex: none;
  width: 100%;
  padding: 15px;
  text-align: center;
  font-size: 16px;
  color: var(--text);
  background: var(--dlg-surface);
  border-top: 0.5px solid var(--dlg-line);
}

/* 多选（chip 本身的样式在 forms.css） */
.sheet .chip-wrap {
  padding: 12px 16px 4px;
}



/* 选头像 */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
}

.picker-grid .avatar {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--avatar-radius, 22%);
  border: 2px solid transparent;
}

.picker-grid .avatar.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.picker-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  height: 44px;
  margin: 4px 16px 18px;
  border-radius: 11px;
  border: 1px dashed var(--dlg-line-strong);
  font-size: 14.5px;
  color: var(--text-2);
}

/* ---------------------------------------------------------------- 确认框 / 输入框 */

.modal {
  max-width: 92vw;
  overflow: hidden;
  color: var(--text);
  background: var(--dlg-surface);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(20, 20, 30, 0.18);
  animation: dlg-pop 0.18s ease;
}

.modal.alert {
  width: 100%;
  max-width: min(92vw, 340px);
  margin: auto 0;
}

.modal.alert.prompt {
  max-width: min(92vw, 420px);
}

.modal.alert .modal-body {
  padding: 20px 18px 16px;
  font-size: 15px;
  line-height: 1.55;
}

.alert-title {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.alert-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  text-align: center;
  white-space: pre-line;
}

.modal.prompt .alert-title,
.modal.prompt .alert-text {
  text-align: left;
}

.modal.prompt .alert-text {
  margin-bottom: 10px;
}

.prompt-field {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--dlg-muted);
}

.prompt-field input,
.prompt-field textarea {
  display: block;
  width: 100%;
  min-height: 24px;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  text-align: left;
  resize: none;
}

.prompt-field textarea {
  min-height: 72px;
  line-height: 1.5;
}

/* 验证码一行（设置里换手机号、注销账号）：输入框 + 「获取验证码」 */
.prompt-field.prompt-code {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt-code input {
  flex: 1;
  min-width: 0;
}

.prompt-code .code-btn {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.prompt-code .code-btn:disabled {
  color: var(--text-3);
  cursor: default;
}

.prompt-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-height: 16px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-3);
}

.prompt-meta [data-role="error"] {
  color: var(--dlg-danger);
}

.modal-actions {
  display: flex;
  border-top: 0.5px solid var(--dlg-line);
}

.modal-actions button {
  flex: 1;
  height: 48px;
  font-size: 16px;
  color: var(--accent);
}

.modal-actions button:hover {
  background: var(--dlg-muted);
}

.modal-actions button + button {
  border-left: 0.5px solid var(--dlg-line);
}

.modal-actions button.strong {
  font-weight: 600;
}

.modal-actions button.danger {
  color: var(--dlg-danger);
  font-weight: 600;
}

/* ---------------------------------------------------------------- 面板（大表单） */

.modal.panel {
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  margin: auto 0;
}

@media (max-width: 619px) {
  .modal.panel {
    width: 100% !important;
    max-width: 100vw;
    max-height: 92vh;
    margin: 0;
    border-radius: 16px 16px 0 0;
    padding-bottom: var(--dlg-safe-bottom);
    animation: dlg-up 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
  }
}

.modal-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 12px 18px;
  border-bottom: 1px solid var(--dlg-line);
}

.modal-head .t {
  font-size: 15px;
  font-weight: 600;
}

.modal-head .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}

.modal-head .icon-btn:hover {
  background: var(--dlg-muted);
}

.modal-head .icon-btn svg {
  width: 18px;
  height: 18px;
}

.panel .modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.modal-foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--dlg-line);
}

/* App 内更新提示 */
.modal.alert.update-box {
  max-width: min(92vw, 360px);
}

.update-box .update-meta {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
}

.update-box .update-meta b {
  color: var(--accent);
}

.update-box .update-notes {
  max-height: 40vh;
  margin: 0;
  padding: 0 0 0 18px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  text-align: left;
}

.update-box .update-notes li + li {
  margin-top: 4px;
}

/* 意见反馈 */
.modal.alert.feedback-box {
  max-width: min(92vw, 420px);
}

.feedback-box .feedback-types {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.feedback-box .feedback-type {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--dlg-muted);
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.feedback-box .feedback-type.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.feedback-box .prompt-field textarea {
  min-height: 120px;
}

/* 充值 */
.modal.alert.recharge-box {
  max-width: min(92vw, 400px);
}

.recharge-box .recharge-balance {
  margin-bottom: 12px;
  font-size: 13.5px;
  color: var(--text-2);
  text-align: center;
}

.recharge-box .recharge-balance b {
  color: var(--text);
  font-size: 15px;
}

.recharge-box .recharge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.recharge-box .recharge-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 62px;
  padding: 6px 4px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: var(--dlg-muted);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.recharge-box .recharge-option .amount {
  font-size: 18px;
  font-weight: 700;
}

.recharge-box .recharge-option .sub {
  font-size: 11.5px;
  color: var(--text-2);
}

.recharge-box .recharge-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.recharge-box .recharge-option.active .amount {
  color: var(--accent);
}

.recharge-box .recharge-custom {
  margin-bottom: 4px;
}

.recharge-box .recharge-closed {
  margin: 6px 0 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  text-align: center;
}

.recharge-box .recharge-history {
  display: block;
  margin: 10px auto 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}

.recharge-list .recharge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 0.5px solid var(--dlg-line);
}

.recharge-list .recharge-row:last-child {
  border-bottom: 0;
}

.recharge-list .main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recharge-list .amount {
  font-size: 16px;
  font-weight: 600;
}

.recharge-list .time {
  font-size: 12px;
  color: var(--text-2);
}

.recharge-list .status {
  font-size: 13px;
  color: var(--text-2);
}

.recharge-list .status-paid {
  color: var(--green, #07c160);
  font-weight: 600;
}

.recharge-list .status-pending {
  color: var(--accent);
}

.recharge-empty {
  padding: 30px 0;
  text-align: center;
  color: var(--text-2);
}

.recharge-pay .recharge-qr {
  width: 190px;
  height: 190px;
  margin: 12px auto 8px;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
}

.recharge-pay .recharge-qr svg {
  width: 100%;
  height: 100%;
}

.recharge-pay .recharge-paylink {
  display: block;
  margin: 14px auto 2px;
  padding: 11px 0;
  border-radius: 12px;
  background: #1677ff;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.recharge-pay .recharge-paylink.secondary {
  width: 100%;
  border: 0;
  background: var(--bg-2, rgba(127, 127, 127, 0.12));
  color: var(--text, inherit);
  font-family: inherit;
  cursor: pointer;
}

.recharge-pay .recharge-alt {
  display: block;
  margin: 12px auto 0;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.recharge-pay .recharge-wait,
.recharge-pay .recharge-note {
  margin-top: 12px;
  color: var(--text-2);
  font-size: 14px;
  text-align: center;
}
