* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: #f5f7fb;
  color: #333;
}

.app {
  display: flex;
  gap: 16px;
  padding: 16px;
  min-height: 100vh;
}

.left-panel {
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  padding: 16px;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 18px;
}

.preview-box {
  min-height: 260px;
  border: 1px dashed #ccc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  overflow: hidden;
}

.preview-box img {
  max-width: 100%;
  max-height: 480px;
  display: none;
}

.empty-text {
  color: #888;
  text-align: center;
  white-space: pre-line;
}

.tip {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-family: inherit;
}

.btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #1677ff;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

button:hover {
  background: #0f62d1;
}

button:disabled {
  background: #b9c0c9;
  cursor: not-allowed;
}

.ppt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ppt-item {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d9d9d9;
  cursor: pointer;
  background: #fff;
}

.ppt-item:hover {
  background: #f0f7ff;
}

.ppt-item.active {
  border-color: #1677ff;
  background: #eaf3ff;
  color: #1677ff;
  font-weight: bold;
}

.ppt-select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  font-size: 14px;
}

.replace-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  align-items: center;
}

.field-label {
  background: #f2f2f2;
  padding: 8px 10px;
  border-radius: 6px;
  word-break: break-all;
}

.field-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.link-hint {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f0f7ff;
  border: 1px solid #cfe3ff;
  color: #1d4f91;
  font-size: 14px;
  line-height: 1.5;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-log-btn {
  background: #eef3fb;
  color: #27496d;
}

.toggle-log-btn:hover {
  background: #dfe9f7;
}

.log-container {
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.log-container.collapsed {
  max-height: 0;
}

.log-container.expanded {
  max-height: 400px;
  margin-top: 10px;
}

.log-box {
  height: 180px;
  overflow: auto;
  background: #0f172a;
  color: #cbd5e1;
  padding: 12px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.status {
  margin-left: auto;
  color: #1677ff;
  font-weight: bold;
}

.result-box img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin-top: 10px;
}

.result-link {
  display: inline-block;
  margin-top: 8px;
  color: #1677ff;
  text-decoration: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.modal-content {
  width: 700px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
  background: white;
  border-radius: 10px;
  padding: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.template-content {
  white-space: pre-wrap;
  word-break: break-all;
  background: #f6f8fa;
  padding: 12px;
  border-radius: 8px;
}

.image-modal-content {
  width: 95vw;
  max-width: 95vw;
  max-height: 90vh;
}

.large-image-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 75vh;
  overflow: auto;
  background: #fafafa;
  border-radius: 8px;
  padding: 10px;
}

.large-image-wrap img {
  max-width: 100%;
  height: auto;
  display: block;
}

.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .app {
    flex-direction: column;
    padding: 10px;
    gap: 12px;
  }

  .left-panel,
  .right-panel {
    width: 100%;
  }

  .card {
    padding: 12px;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }

  .preview-box {
    min-height: 180px;
  }

  .preview-box img {
    max-height: 260px;
  }

  .field-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .field-label {
    width: 100%;
    font-size: 14px;
    line-height: 1.4;
  }

  .field-input {
    width: 100%;
    min-height: 40px;
    font-size: 16px;
  }

  textarea {
    font-size: 16px;
    min-height: 140px;
  }

  button {
    min-height: 40px;
    font-size: 14px;
  }

  .btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-row button {
    flex: 1 1 auto;
  }

  .send-btn {
    min-width: 120px;
  }

  .log-box {
    height: 140px;
    font-size: 12px;
  }

  .modal-content {
    width: 95vw;
    max-width: 95vw;
    max-height: 85vh;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .card h3 {
    font-size: 16px;
  }

  .preview-box {
    min-height: 140px;
  }

  .preview-box img {
    max-height: 220px;
  }

  .field-input,
  textarea,
  .ppt-select {
    font-size: 16px;
  }

  .ppt-item {
    padding: 8px 10px;
    font-size: 14px;
  }

  .status {
    width: 100%;
    margin-left: 0;
    margin-top: 6px;
  }

  .action-row {
    align-items: stretch;
  }
}