* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; background: #f5f7fa; color: #222; }

#app { display: flex; justify-content: center; align-items: center; padding: 24px; min-height: 100vh; }
.card { width: var(--card-w, 960px); height: var(--card-h, auto); max-width: 100%; max-height: calc(100vh - 48px); background: #fff; border-radius: 12px; box-shadow: 0 8px 20px rgba(0,0,0,0.08); overflow: hidden; display: flex; flex-direction: column; }
.card-header { border-bottom: 1px solid #eef0f3; padding: 16px 20px; background: #fafbfc; }
.card-body { padding: 16px 20px; flex: 1; overflow: auto; }
#messages { min-height: 200px; }
.message { margin: 10px 0; white-space: pre-wrap; line-height: 1.7; }
.message .cursor { display: inline-block; width: 1px; background: #333; animation: blink 1s steps(1) infinite; vertical-align: text-bottom; }
@keyframes blink { 50% { opacity: 0; } }

/* Thumbnail for <img:...> */
.thumb { max-width: 180px; max-height: 140px; object-fit: cover; border-radius: 8px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.button { appearance: none; border: 1px solid #d5dae0; background: #fff; color: #333; padding: 8px 14px; border-radius: 8px; cursor: pointer; transition: all .15s ease; }
.button:hover { border-color: #c0c7d0; background: #f6f8fa; }
.button.primary { background: #1677ff; border-color: #1677ff; color: #fff; }

.modal { position: fixed; inset: 0; display: flex; justify-content: center; align-items: center; background: rgba(0,0,0,0.5); }
.modal.hidden { display: none; }
.modal-inner { background: #fff; padding: 12px; border-radius: 12px; max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; gap: 8px; }
.modal-inner img { max-width: 80vw; max-height: 70vh; border-radius: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.overlay { position: fixed; inset: 0; display: flex; justify-content: center; align-items: center; background: rgba(0,0,0,0.8); }
.overlay.hidden { display: none; }
.overlay img { max-width: 90vw; max-height: 90vh; border-radius: 12px; box-shadow: 0 10px 24px rgba(0,0,0,0.3); }

/* Responsive adjustments */
@media (max-width: 640px) {
  #app { padding: 12px; }
  .card { width: 100%; height: auto; max-height: calc(100vh - 24px); }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 12px 14px; }
  .button { padding: 8px 12px; }
  .thumb { max-width: 45vw; max-height: 35vh; }
  .modal-inner img { max-width: 88vw; max-height: 60vh; }
}
/* Hide scrollbar but keep scrollability */
.card-body {
  overflow: auto;
  scrollbar-width: none; /* Firefox */
}
.card-body::-webkit-scrollbar {
  width: 0; height: 0; display: none; /* WebKit */
}

/* Dialog Modal styles */
#dialog-modal.hidden { display: none; }
#dialog-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
}
.dialog {
  background: #fff;
  border-radius: 12px;
  width: min(520px, 90vw);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}
.dialog-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  font-weight: 600;
}
.dialog-body { padding: 16px 20px; }
.dialog-body input {
  width: 100%;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.dialog-actions {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}