* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  min-height: 100dvh;
  color: #fff;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.header {
  padding: 20px;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 999999;
}

.header h1 {
  font-size: 28px;
  margin-bottom: 8px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin-bottom: 15px;
}

.actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.upload-area {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  padding: 12px 25px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #e94560;
  background: rgba(233, 69, 96, 0.1);
}

.upload-btn,
.text-btn {
  padding: 10px 24px;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-btn {
  background: #e94560;
}

.upload-btn:hover {
  background: #ff6b6b;
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(233, 69, 96, 0.4);
}

.text-btn {
  background: #4facfe;
}

.text-btn:hover {
  background: #00f2fe;
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(79, 172, 254, 0.4);
}

.upload-btn:disabled,
.text-btn:disabled {
  background: #666;
  cursor: not-allowed;
  transform: none;
}

.upload-tip {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
}

.wall {
  flex: 1;
  position: relative;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(233, 69, 96, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(79, 172, 254, 0.1) 0%, transparent 50%);
  min-height: 0;
}

.wall-image,
.wall-text {
  position: absolute;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  cursor: grab;
  transition: transform 0.1s, box-shadow 0.2s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.wall-image {
  max-width: 350px;
  max-height: 350px;
  -webkit-user-drag: none;
}

.wall-text {
  max-width: 350px;
  min-width: 80px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.wall-text .text-content {
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.wall-text .text-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
  white-space: nowrap;
  pointer-events: none;
}

.wall-image:hover,
.wall-text:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 99999 !important;
}

.wall-image:hover .delete-btn,
.wall-text:hover .delete-btn {
  opacity: 1;
}

.wall-image.dragging,
.wall-text.dragging {
  cursor: grabbing;
  transform: scale(1.05);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  z-index: 99999 !important;
}

.wall-image img {
  display: block;
  max-width: 100%;
  max-height: 350px;
  border-radius: 8px;
  pointer-events: none;
}

.delete-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e94560;
  color: #fff;
  border: 2px solid #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding-bottom: 2px;
}

.delete-btn:hover,
.delete-btn:active {
  background: #ff6b6b;
  transform: scale(1.1);
}

.empty-tip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
}

.empty-tip h2 {
  font-size: 48px;
  margin-bottom: 10px;
}

.empty-tip p {
  font-size: 16px;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 28px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error {
  background: rgba(233, 69, 96, 0.9);
}

.toast.success {
  background: rgba(46, 204, 113, 0.9);
}

/* 文本编辑弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal h3 {
  margin-bottom: 16px;
  font-size: 20px;
  text-align: center;
}

.modal textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 15px;
  resize: vertical;
  margin-bottom: 4px;
}

.modal textarea:focus {
  outline: none;
  border-color: #4facfe;
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 16px;
}

.format-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.format-row label {
  min-width: 70px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.format-row input[type="range"] {
  flex: 1;
  min-width: 120px;
}

.format-row input[type="color"] {
  width: 50px;
  height: 36px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

.format-row select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 14px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.toggles {
  gap: 10px;
}

.toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: #4facfe;
  border-color: #4facfe;
}

.preview-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 20px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.text-preview {
  max-width: 100%;
  word-break: break-word;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.cancel-btn,
.submit-btn {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.cancel-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.submit-btn {
  background: #e94560;
  color: #fff;
}

.submit-btn:hover {
  background: #ff6b6b;
}

.submit-btn:disabled {
  background: #666;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .header {
    padding: 12px 10px;
  }

  .header h1 {
    font-size: 20px;
    margin-bottom: 4px;
  }

  .header p {
    font-size: 12px;
    margin-bottom: 10px;
    line-height: 1.4;
  }

  .actions {
    flex-direction: row;
    gap: 8px;
  }

  .upload-area {
    padding: 8px 12px;
    gap: 8px;
  }

  .upload-btn,
  .text-btn {
    padding: 8px 16px;
    font-size: 14px;
  }

  .upload-tip {
    font-size: 12px;
  }

  .wall-image {
    max-width: 180px;
    max-height: 180px;
  }

  .wall-image img {
    max-height: 180px;
  }

  .wall-text {
    max-width: 180px;
    padding: 8px 10px;
  }

  .delete-btn {
    opacity: 1;
    width: 24px;
    height: 24px;
    font-size: 16px;
    top: -8px;
    right: -8px;
  }

  .modal {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .modal textarea {
    min-height: 80px;
  }

  .format-row {
    margin-bottom: 10px;
  }

  .format-row label {
    min-width: 60px;
    font-size: 13px;
  }

  .preview-box {
    padding: 14px;
    margin-bottom: 14px;
  }
}

@media (max-width: 380px) {
  .header h1 {
    font-size: 18px;
  }

  .upload-btn,
  .text-btn {
    padding: 7px 12px;
    font-size: 13px;
  }

  .upload-tip {
    display: none;
  }

  .wall-image {
    max-width: 150px;
    max-height: 150px;
  }

  .wall-image img {
    max-height: 150px;
  }

  .wall-text {
    max-width: 150px;
  }

  .actions {
    flex-direction: column;
    width: 100%;
  }

  .upload-area,
  .upload-btn,
  .text-btn {
    width: 100%;
    justify-content: center;
  }
}
