/* 报错弹框：沿用页面面板的拟物质感（浮雕外壳、四角螺丝、内凹的信息槽、实体按钮） */
.app-dialog {
  width: min(440px, calc(100vw - 28px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, var(--surface), var(--paper));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(60, 40, 40, 0.09),
    0 4px 0 color-mix(in srgb, var(--line) 80%, #6f6262),
    0 18px 48px rgba(30, 18, 18, 0.26);
}

.app-dialog[open] {
  animation: app-dialog-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.app-dialog::backdrop {
  background: rgba(22, 14, 14, 0.46);
  backdrop-filter: blur(2px);
}

.app-dialog-form {
  position: relative;
  padding: 22px;
}

.app-dialog-form::before,
.app-dialog-form::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--line) 70%, #8f8080);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.75),
    0 1px 1px rgba(60, 40, 40, 0.18);
}

.app-dialog-form::before {
  top: 8px;
  left: 8px;
}

.app-dialog-form::after {
  right: 8px;
  bottom: 8px;
}

.app-dialog-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.app-dialog-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 72%, white);
  border-radius: 9px;
  background: linear-gradient(155deg, var(--surface), var(--paper));
  box-shadow:
    inset 0 1px 0 white,
    0 2px 0 var(--line),
    0 4px 8px rgba(40, 25, 25, 0.08);
}

/* 红色圆形指示灯，中间是感叹号 */
.app-dialog-icon::before {
  content: "!";
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: radial-gradient(circle at 38% 30%, #e08a80, var(--danger, #943d38) 62%, #6a2622);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.45),
    0 1px 2px rgba(70, 25, 22, 0.35);
  font: 900 14px/1 Arial, sans-serif;
  text-shadow: 0 1px 0 rgba(70, 20, 18, 0.45);
}

.app-dialog-heading-copy {
  min-width: 0;
}

.app-dialog-eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.app-dialog-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.35;
}

.app-dialog-message {
  max-height: min(42vh, 280px);
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--line) 90%, #8f8080);
  border-radius: 7px;
  color: var(--ink);
  background: var(--well, color-mix(in srgb, var(--paper) 80%, #d9cccc));
  box-shadow:
    inset 0 3px 7px rgba(60, 40, 40, 0.1),
    0 1px 0 #fff;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}

.app-dialog-message p {
  margin: 0;
}

.app-dialog-message p + p {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--line) 85%, #8f8080);
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
}

.app-dialog-button {
  min-width: 96px;
  padding: 8px 16px;
  border: 1px solid var(--green-dark);
  border-radius: 7px;
  color: white;
  background: linear-gradient(color-mix(in srgb, var(--green) 85%, white), var(--green-dark));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 2px 0 color-mix(in srgb, var(--green-dark) 78%, black),
    0 4px 8px rgba(40, 25, 25, 0.13);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.app-dialog-button:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 3px rgba(0, 0, 0, 0.18),
    0 0 0 color-mix(in srgb, var(--green-dark) 78%, black);
}

.app-dialog-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--green) 24%, transparent);
  outline-offset: 2px;
}

@keyframes app-dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@media (max-width: 520px) {
  .app-dialog-form {
    padding: 18px;
  }
  .app-dialog-heading h2 {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-dialog[open] {
    animation: none;
  }
}
