/* ============================================================
   A2W Dialog — 全站统一弹窗组件（替代浏览器原生 alert / confirm / prompt）
   ------------------------------------------------------------
   设计语言：延续站点的像素风 / 新粗野主义（Neo-brutalism）
     · 2px 纯黑描边 + 无模糊硬阴影，与 .toast / .content-card 一致
     · 像素字体、小字号高对比
     · 三段式分层：顶部信号色带 / 内容区 / 操作区
   动效：
     · 弹入带回弹（cubic-bezier），硬阴影同步“长出”
     · 图标延迟弹入，按钮组随后浮起
     · 按钮 hover 抬起 1px、按下压平 3px（手感）
     · 移动端改为底部上滑（sheet）
   ============================================================ */

.a2w-dlg-root,
.a2w-dlg-root * { box-sizing: border-box; }

.a2w-dlg-root{
  position: fixed; inset: 0; z-index: 999999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow: hidden;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color .22s ease;
  -webkit-tap-highlight-color: transparent;
}
.a2w-dlg-root.show{ background-color: rgba(0, 0, 0, .44); }

/* ---------- 卡片 ---------- */
.a2w-dlg{
  position: relative;
  width: 100%; max-width: 388px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: #fff; color: #111;
  border: 2px solid #000; border-radius: 8px;
  font-family: var(--pixel-font, 'Cubic-11', 'Courier New', monospace);
  box-shadow: 0 0 0 rgba(0, 0, 0, 1);
  opacity: 0; transform: scale(.9);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1),
              box-shadow .3s ease, opacity .18s ease;
  overflow: hidden;
}
.a2w-dlg-root.show .a2w-dlg{
  opacity: 1; transform: scale(1);
  box-shadow: 8px 8px 0 #000;
}
.a2w-dlg-root.hide .a2w-dlg{
  opacity: 0; transform: scale(.95);
  box-shadow: 2px 2px 0 #000;
  transition-duration: .16s;
}

/* ---------- 顶部信号色带 ---------- */
.a2w-dlg-band{
  flex: 0 0 auto; height: 7px;
  border-bottom: 2px solid #000;
  background: #4169E1;
}
.a2w-dlg-root.tone-danger .a2w-dlg-band{
  background: repeating-linear-gradient(45deg, #e03e3e 0 7px, #b92626 7px 14px);
}
.a2w-dlg-root.tone-warn .a2w-dlg-band{ background: #E9A020; }
.a2w-dlg-root.tone-success .a2w-dlg-band{ background: #1F9D55; }

/* ---------- 内容区 ---------- */
.a2w-dlg-body{
  flex: 1 1 auto; min-height: 0;
  padding: 18px 18px 6px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.a2w-dlg-body::-webkit-scrollbar{ width: 8px; }
.a2w-dlg-body::-webkit-scrollbar-track{ background: #f2f0ea; }
.a2w-dlg-body::-webkit-scrollbar-thumb{ background: #000; border: 2px solid #fff; }

.a2w-dlg-head{ display: flex; align-items: flex-start; gap: 14px; }

.a2w-dlg-ico{
  flex: 0 0 auto; width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 2px solid #000; border-radius: 6px; background: #fff;
  box-shadow: 3px 3px 0 #000;
  color: #4169E1;
  opacity: 0; transform: scale(.4) rotate(-14deg);
  transition: transform .42s cubic-bezier(.34, 1.56, .64, 1) .07s,
              opacity .2s ease .07s;
}
.a2w-dlg-root.show .a2w-dlg-ico{ opacity: 1; transform: none; }
.a2w-dlg-root.tone-danger .a2w-dlg-ico{ color: #e03e3e; }
.a2w-dlg-root.tone-warn .a2w-dlg-ico{ color: #E9A020; }
.a2w-dlg-root.tone-success .a2w-dlg-ico{ color: #1F9D55; }
.a2w-dlg-ico svg{ width: 26px; height: 26px; display: block; }

.a2w-dlg-text{ flex: 1 1 auto; min-width: 0; padding-top: 1px; }

.a2w-dlg-t{
  font-size: 14px; font-weight: 700; line-height: 1.55;
  letter-spacing: .2px; word-break: break-word;
}
.a2w-dlg-d{
  margin-top: 7px;
  font-size: 11.5px; line-height: 1.8; color: #5c5c5c;
  white-space: pre-line; word-break: break-word;
}

.a2w-dlg-extra{ margin-top: 14px; }

/* 输入框（prompt） */
.a2w-dlg-input{
  width: 100%; padding: 11px 12px;
  border: 2px solid #000; border-radius: 4px;
  background: #fff; color: #111;
  font-family: inherit; font-size: 12px; line-height: 1.5;
  outline: none;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .12);
  transition: transform .14s ease, box-shadow .14s ease;
}
.a2w-dlg-input:focus{ transform: translate(-1px, -1px); box-shadow: 3px 3px 0 #000; }

/* ---------- 操作区 ---------- */
.a2w-dlg-foot{
  flex: 0 0 auto;
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  padding: 14px 18px 16px;
  background: #FAF8F3;
  border-top: 2px solid #000;
  opacity: 0; transform: translateY(7px);
  transition: opacity .24s ease .13s,
              transform .32s cubic-bezier(.34, 1.56, .64, 1) .13s;
}
.a2w-dlg-root.show .a2w-dlg-foot{ opacity: 1; transform: none; }

.a2w-dlg-btn{
  font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: .3px;
  padding: 10px 18px; min-width: 84px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #000; border-radius: 6px;
  background: #fff; color: #111;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer; user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, background-color .16s ease;
}
.a2w-dlg-btn:hover{ transform: translate(-1px, -1px); box-shadow: 5px 5px 0 #000; }
.a2w-dlg-btn:active{ transform: translate(3px, 3px); box-shadow: 1px 1px 0 #000; }
.a2w-dlg-btn:focus-visible{ outline: 2px dashed #000; outline-offset: 3px; }

.a2w-dlg-btn.primary{ background: #4169E1; color: #fff; }
.a2w-dlg-btn.danger{ background: #e03e3e; color: #fff; }
.a2w-dlg-btn.ghost{ background: #fff; color: #111; }

/* ---------- 移动端：底部 sheet ---------- */
@media (max-width: 520px){
  .a2w-dlg-root{ padding: 0; align-items: flex-end; }
  .a2w-dlg{
    max-width: none; width: 100%; max-height: 88vh;
    border-radius: 10px 10px 0 0; border-bottom: 0;
    transform: translateY(30px) scale(.98);
  }
  .a2w-dlg-root.show .a2w-dlg{ transform: none; box-shadow: none; }
  .a2w-dlg-root.hide .a2w-dlg{ transform: translateY(26px) scale(.98); box-shadow: none; }
  .a2w-dlg-body{ padding: 16px 16px 4px; }
  .a2w-dlg-foot{
    padding: 13px 16px calc(15px + env(safe-area-inset-bottom, 0px));
  }
  .a2w-dlg-foot .a2w-dlg-btn{ flex: 1 1 0; min-width: 0; padding: 11px 10px; }
}

/* ---------- 暗色主题适配 ---------- */
html[data-theme="dark"] .a2w-dlg{
  background: #17171a; color: #f2f2f2; border-color: #000;
}
html[data-theme="dark"] .a2w-dlg-ico{ background: #22222a; border-color: #000; }
html[data-theme="dark"] .a2w-dlg-d{ color: #a5a5ad; }
html[data-theme="dark"] .a2w-dlg-foot{ background: #101014; }
html[data-theme="dark"] .a2w-dlg-btn{ background: #22222a; color: #f2f2f2; }

/* ---------- 降低动效偏好 ---------- */
@media (prefers-reduced-motion: reduce){
  .a2w-dlg-root, .a2w-dlg, .a2w-dlg-ico, .a2w-dlg-foot, .a2w-dlg-btn{
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }
  .a2w-dlg-root.show .a2w-dlg{ transform: none; }
}
